Controllers and models of authorings steps for ArticleInJournal
parent
bec3a90529
commit
35a72236a1
|
|
@ -8,7 +8,13 @@ package org.scientificcms.publications.contenttypes;
|
|||
|
||||
import org.hibernate.envers.Audited;
|
||||
import org.librecms.contenttypes.ContentTypeDescription;
|
||||
import org.librecms.ui.contentsections.documents.MvcAuthoringKit;
|
||||
import org.scientificcms.publications.ArticleInJournal;
|
||||
import org.scientificcms.publications.ui.contenttypes.ArticleInJournalExtendedPropertiesStep;
|
||||
import org.scientificcms.publications.ui.contenttypes.ArticleInJournalItemCreateStep;
|
||||
import org.scientificcms.publications.ui.contenttypes.ArticleInJournalPropertiesStep;
|
||||
import org.scientificcms.publications.ui.contenttypes.PublicationAbstractStep;
|
||||
import org.scientificcms.publications.ui.contenttypes.PublicationMiscStep;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Table;
|
||||
|
|
@ -26,6 +32,15 @@ import static org.scientificcms.publications.SciPublicationsConstants.*;
|
|||
labelBundle = "org.scientificcms.publications.contenttypes.ArticleInJournal",
|
||||
descriptionBundle = "org.scientificcms.publications.contenttypes.ArticleInJournal"
|
||||
)
|
||||
@MvcAuthoringKit(
|
||||
createStep = ArticleInJournalItemCreateStep.class,
|
||||
authoringSteps = {
|
||||
ArticleInJournalPropertiesStep.class,
|
||||
ArticleInJournalExtendedPropertiesStep.class,
|
||||
PublicationAbstractStep.class,
|
||||
PublicationMiscStep.class
|
||||
}
|
||||
)
|
||||
public class ArticleInJournalItem extends PublicationItem<ArticleInJournal> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ import javax.ws.rs.PathParam;
|
|||
bundle = SciPublicationsUiConstants.BUNDLE,
|
||||
descriptionKey = "authoringsteps.extendedproperties.description",
|
||||
labelKey = "authoringsteps.extendedproperties.label",
|
||||
supportedDocumentType = MonographItem.class
|
||||
supportedDocumentType = ArticleInCollectedVolumeItem.class
|
||||
)
|
||||
public class ArticleInCollectedVolumeExtendedPropertiesStep
|
||||
extends AbstractPublicationExtendedPropertiesStep<ArticleInCollectedVolumeItem, ArticleInCollectedVolume> {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,161 @@
|
|||
package org.scientificcms.publications.ui.contenttypes;
|
||||
|
||||
import org.libreccm.security.AuthorizationRequired;
|
||||
import org.librecms.ui.contentsections.documents.MvcAuthoringStepDef;
|
||||
import org.librecms.ui.contentsections.documents.MvcAuthoringSteps;
|
||||
import org.scientificcms.publications.ArticleInJournal;
|
||||
import org.scientificcms.publications.contenttypes.ArticleInJournalItem;
|
||||
import org.scientificcms.publications.ui.SciPublicationsUiConstants;
|
||||
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.mvc.Controller;
|
||||
import javax.transaction.Transactional;
|
||||
import javax.ws.rs.FormParam;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.PathParam;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@RequestScoped
|
||||
@Path(MvcAuthoringSteps.PATH_PREFIX + "articleinjournal-extendedproperties")
|
||||
@Controller
|
||||
@MvcAuthoringStepDef(
|
||||
bundle = SciPublicationsUiConstants.BUNDLE,
|
||||
descriptionKey = "authoringsteps.extendedproperties.description",
|
||||
labelKey = "authoringsteps.extendedproperties.label",
|
||||
supportedDocumentType = ArticleInJournalItem.class
|
||||
)
|
||||
public class ArticleInJournalExtendedPropertiesStep
|
||||
extends AbstractPublicationExtendedPropertiesStep<ArticleInJournalItem, ArticleInJournal> {
|
||||
|
||||
@Override
|
||||
public Class<ArticleInJournalExtendedPropertiesStep> getStepClass() {
|
||||
return ArticleInJournalExtendedPropertiesStep.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Class<ArticleInJournal> getPublicationClass() {
|
||||
return ArticleInJournal.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEditStepUrlFragment() {
|
||||
return "articleinjournal-extendedproperties";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getStepTemplatePath() {
|
||||
return "org/scientificcms/contenttypes/ui/articleinjournal/edit-extended-properties.xhtml";
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/")
|
||||
@AuthorizationRequired
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
@Override
|
||||
public String showStep(
|
||||
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
|
||||
final String sectionIdentifier,
|
||||
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
|
||||
final String documentPath
|
||||
) {
|
||||
return super.showStep(sectionIdentifier, documentPath);
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/properties")
|
||||
@AuthorizationRequired
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
@Override
|
||||
public String updateProperties(
|
||||
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
|
||||
final String sectionIdentifier,
|
||||
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
|
||||
final String documentPath,
|
||||
@FormParam("languageOfPublication")
|
||||
final String languageOfPublicationParam,
|
||||
@FormParam("peerReviewed")
|
||||
final String peerReviewedParam,
|
||||
@FormParam("yearFirstPublished")
|
||||
final String yearFirstPublishedParam
|
||||
) {
|
||||
return super.updateProperties(
|
||||
sectionIdentifier,
|
||||
documentPath,
|
||||
languageOfPublicationParam,
|
||||
peerReviewedParam,
|
||||
yearFirstPublishedParam
|
||||
);
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/series")
|
||||
@AuthorizationRequired
|
||||
@Transactional
|
||||
@Override
|
||||
public String addSeries(
|
||||
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
|
||||
final String sectionIdentifier,
|
||||
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
|
||||
final String documentPath,
|
||||
@FormParam("seriesIdentifier")
|
||||
final String seriesIdentifier,
|
||||
@FormParam("volumeOfSeries")
|
||||
final String volumeOfSeries
|
||||
) {
|
||||
return super.addSeries(
|
||||
sectionIdentifier,
|
||||
documentPath,
|
||||
seriesIdentifier,
|
||||
volumeOfSeries
|
||||
);
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/series/{volumeInSeriesUuid}")
|
||||
@AuthorizationRequired
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
@Override
|
||||
public String editVolumeInSeries(
|
||||
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
|
||||
final String sectionIdentifier,
|
||||
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
|
||||
final String documentPath,
|
||||
@PathParam("volumeInSeriesUuid")
|
||||
final String volumeInSeriesUuid,
|
||||
@FormParam("volumeOfSeries")
|
||||
final String volumeOfSeries
|
||||
) {
|
||||
return super.editVolumeInSeries(
|
||||
sectionIdentifier,
|
||||
documentPath,
|
||||
volumeInSeriesUuid,
|
||||
volumeOfSeries
|
||||
);
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/series/{volumeInSeriesUuid}/remove")
|
||||
@AuthorizationRequired
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
@Override
|
||||
public String removeVolumeInSeries(
|
||||
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
|
||||
final String sectionIdentifier,
|
||||
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
|
||||
final String documentPath,
|
||||
@PathParam("volumeInSeriesUuid")
|
||||
final String volumeInSeriesUuid
|
||||
) {
|
||||
return super.removeVolumeInSeries(
|
||||
sectionIdentifier,
|
||||
documentPath,
|
||||
volumeInSeriesUuid
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
package org.scientificcms.publications.ui.contenttypes;
|
||||
|
||||
import org.libreccm.l10n.GlobalizationHelper;
|
||||
import org.scientificcms.publications.ArticleInJournal;
|
||||
import org.scientificcms.publications.contenttypes.ArticleInJournalItem;
|
||||
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@RequestScoped
|
||||
@Named("SciPublicationsArticleInJournalCreateStep")
|
||||
public class ArticleInJournalItemCreateStep
|
||||
extends AbstractPublicationItemCreateStep<ArticleInJournalItem, ArticleInJournal> {
|
||||
|
||||
@Inject
|
||||
private GlobalizationHelper globalizationHelper;
|
||||
|
||||
@Override
|
||||
public String getDocumentType() {
|
||||
return ArticleInJournalItem.class.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return globalizationHelper
|
||||
.getLocalizedTextsUtil(getBundle())
|
||||
.getText("b");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String showCreateStep() {
|
||||
return "org/scientificcms/contenttypes/ui/articleinjournal/create-articleinjournal.xhtml";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<ArticleInJournalItem> getPublicationItemClass() {
|
||||
return ArticleInJournalItem.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArticleInJournal createPublication() {
|
||||
return new ArticleInJournal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEditStepName() {
|
||||
return ArticleInJournalPropertiesStep.EDIT_STEP_URL_FRAGMENT;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,526 @@
|
|||
package org.scientificcms.publications.ui.contenttypes;
|
||||
|
||||
import org.libreccm.api.Identifier;
|
||||
import org.libreccm.api.IdentifierParser;
|
||||
import org.libreccm.security.AuthorizationRequired;
|
||||
import org.librecms.ui.contentsections.ContentSectionNotFoundException;
|
||||
import org.librecms.ui.contentsections.ItemPermissionChecker;
|
||||
import org.librecms.ui.contentsections.documents.DocumentNotFoundException;
|
||||
import org.librecms.ui.contentsections.documents.DocumentUi;
|
||||
import org.librecms.ui.contentsections.documents.MvcAuthoringStepDef;
|
||||
import org.librecms.ui.contentsections.documents.MvcAuthoringSteps;
|
||||
import org.scientificcms.publications.ArticleInJournal;
|
||||
import org.scientificcms.publications.ArticleInJournalManager;
|
||||
import org.scientificcms.publications.Journal;
|
||||
import org.scientificcms.publications.JournalRepository;
|
||||
import org.scientificcms.publications.contenttypes.ArticleInJournalItem;
|
||||
import org.scientificcms.publications.ui.SciPublicationsUiConstants;
|
||||
import org.scientificcms.publications.ui.SciPublicationsUiMessageBundle;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.format.DateTimeParseException;
|
||||
import java.util.Optional;
|
||||
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.inject.Inject;
|
||||
import javax.mvc.Controller;
|
||||
import javax.mvc.Models;
|
||||
import javax.transaction.Transactional;
|
||||
import javax.ws.rs.DefaultValue;
|
||||
import javax.ws.rs.FormParam;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.PathParam;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@RequestScoped
|
||||
@Path(
|
||||
MvcAuthoringSteps.PATH_PREFIX
|
||||
+ ArticleInJournalPropertiesStep.EDIT_STEP_URL_FRAGMENT
|
||||
)
|
||||
@Controller
|
||||
@MvcAuthoringStepDef(
|
||||
bundle = SciPublicationsUiConstants.BUNDLE,
|
||||
descriptionKey = "authoringsteps.basicproperties.description",
|
||||
labelKey = "authoringsteps.basicproperties.label",
|
||||
supportedDocumentType = ArticleInJournalItem.class
|
||||
)
|
||||
public class ArticleInJournalPropertiesStep
|
||||
extends AbstractPublicationPropertiesStep<ArticleInJournalItem, ArticleInJournal> {
|
||||
|
||||
public static final String EDIT_STEP_URL_FRAGMENT
|
||||
= "articleinjournal-basicproperties";
|
||||
|
||||
@Inject
|
||||
private ArticleInJournalManager articleManager;
|
||||
|
||||
@Inject
|
||||
private DocumentUi documentUi;
|
||||
|
||||
@Inject
|
||||
private IdentifierParser identifierParser;
|
||||
|
||||
@Inject
|
||||
private ItemPermissionChecker itemPermissionChecker;
|
||||
|
||||
@Inject
|
||||
private JournalRepository journalRepository;
|
||||
|
||||
@Inject
|
||||
private Models models;
|
||||
|
||||
@Inject
|
||||
private ArticleInJournalPropertiesStepModel propertiesStepModel;
|
||||
|
||||
@Inject
|
||||
private SciPublicationsUiMessageBundle messageBundle;
|
||||
|
||||
@Override
|
||||
public Class<ArticleInJournalPropertiesStep> getStepClass() {
|
||||
return ArticleInJournalPropertiesStep.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEditStepUrlFragment() {
|
||||
return EDIT_STEP_URL_FRAGMENT;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getStepTemplatePath() {
|
||||
return "org/scientificcms/contenttypes/ui/articleinjournal/edit-articleinjournal.xhtml";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<ArticleInJournal> getPublicationClass() {
|
||||
return ArticleInJournal.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
protected void init() throws ContentSectionNotFoundException,
|
||||
DocumentNotFoundException {
|
||||
super.init();
|
||||
|
||||
propertiesStepModel.setEndPage(getPublication().getEndPage());
|
||||
propertiesStepModel.setIssue(getPublication().getIssue());
|
||||
propertiesStepModel.setJournalTitle(
|
||||
Optional
|
||||
.ofNullable(getPublication().getJournal())
|
||||
.map(Journal::getTitle)
|
||||
.orElse(null)
|
||||
);
|
||||
propertiesStepModel.setPublicationDate(
|
||||
Optional
|
||||
.ofNullable(getPublication().getPublicationDate())
|
||||
.map(date -> DateTimeFormatter.ISO_DATE.format(date))
|
||||
.orElse(null)
|
||||
);
|
||||
propertiesStepModel.setStartPage(getPublication().getStartPage());
|
||||
propertiesStepModel.setVolume(getPublication().getVolume());
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/")
|
||||
@AuthorizationRequired
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
@Override
|
||||
public String showStep(
|
||||
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
|
||||
final String sectionIdentifier,
|
||||
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
|
||||
final String documentPath
|
||||
) {
|
||||
return super.showStep(sectionIdentifier, documentPath);
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/name")
|
||||
@AuthorizationRequired
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
@Override
|
||||
public String updateName(
|
||||
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
|
||||
final String sectionIdentifier,
|
||||
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
|
||||
final String documentPath,
|
||||
@FormParam("name") @DefaultValue("")
|
||||
final String name
|
||||
) {
|
||||
return super.updateName(sectionIdentifier, documentPath, name);
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/title/@add")
|
||||
@AuthorizationRequired
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
@Override
|
||||
public String addTitle(
|
||||
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
|
||||
final String sectionIdentifier,
|
||||
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
|
||||
final String documentPath,
|
||||
@FormParam("locale") final String localeParam,
|
||||
@FormParam("value") final String value
|
||||
) {
|
||||
return super.addTitle(
|
||||
sectionIdentifier,
|
||||
documentPath,
|
||||
localeParam,
|
||||
value
|
||||
);
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/title/@edit/{locale}")
|
||||
@AuthorizationRequired
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
@Override
|
||||
public String editTitle(
|
||||
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
|
||||
final String sectionIdentifier,
|
||||
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
|
||||
final String documentPath,
|
||||
@PathParam("locale") final String localeParam,
|
||||
@FormParam("value") final String value
|
||||
) {
|
||||
return super.editTitle(
|
||||
sectionIdentifier,
|
||||
documentPath,
|
||||
localeParam,
|
||||
value
|
||||
);
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/title/@remove/{locale}")
|
||||
@AuthorizationRequired
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
@Override
|
||||
public String removeTitle(
|
||||
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
|
||||
final String sectionIdentifier,
|
||||
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
|
||||
final String documentPath,
|
||||
@PathParam("locale") final String localeParam
|
||||
) {
|
||||
return super.removeTitle(sectionIdentifier, documentPath, localeParam);
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/shortdescription/@add")
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
@Override
|
||||
public String addShortDescription(
|
||||
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
|
||||
final String sectionIdentifier,
|
||||
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
|
||||
final String documentPath,
|
||||
@FormParam("locale") final String localeParam,
|
||||
@FormParam("value") final String value
|
||||
) {
|
||||
return super.addShortDescription(
|
||||
sectionIdentifier,
|
||||
documentPath,
|
||||
localeParam,
|
||||
value
|
||||
);
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/shortdescription/@edit/{locale}")
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
@Override
|
||||
public String editShortDescription(
|
||||
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
|
||||
final String sectionIdentifier,
|
||||
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
|
||||
final String documentPath,
|
||||
@PathParam("locale") final String localeParam,
|
||||
@FormParam("value") final String value
|
||||
) {
|
||||
return super.editShortDescription(
|
||||
sectionIdentifier,
|
||||
documentPath,
|
||||
localeParam,
|
||||
value
|
||||
);
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/shortdescription/@remove/{locale}")
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
@Override
|
||||
public String removeShortDescription(
|
||||
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
|
||||
final String sectionIdentifier,
|
||||
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
|
||||
final String documentPath,
|
||||
@PathParam("locale") final String localeParam
|
||||
) {
|
||||
return super.removeShortDescription(
|
||||
sectionIdentifier,
|
||||
documentPath,
|
||||
localeParam
|
||||
);
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/authors")
|
||||
@AuthorizationRequired
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
@Override
|
||||
public String addAuthor(
|
||||
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
|
||||
final String sectionIdentifier,
|
||||
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
|
||||
final String documentPath,
|
||||
@FormParam("authorIdentifier")
|
||||
final String authorIdentifier,
|
||||
@FormParam("editor")
|
||||
final String editorParam
|
||||
) {
|
||||
return super.addAuthor(
|
||||
sectionIdentifier,
|
||||
documentPath,
|
||||
authorIdentifier,
|
||||
editorParam
|
||||
);
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/authors/{authorshipUuid}")
|
||||
@AuthorizationRequired
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
@Override
|
||||
public String editAuthorship(
|
||||
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
|
||||
final String sectionIdentifier,
|
||||
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
|
||||
final String documentPath,
|
||||
@PathParam("authorshipUuid")
|
||||
final String authorshipUuid,
|
||||
@FormParam("editor")
|
||||
final String editorParam
|
||||
) {
|
||||
return super.editAuthorship(
|
||||
sectionIdentifier,
|
||||
documentPath,
|
||||
authorshipUuid,
|
||||
editorParam
|
||||
);
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/authors/{authorshipUuid}/remove")
|
||||
@AuthorizationRequired
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
@Override
|
||||
public String removeAuthorship(
|
||||
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
|
||||
final String sectionIdentifier,
|
||||
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
|
||||
final String documentPath,
|
||||
@PathParam("authorshipUuid")
|
||||
final String authorshipUuid
|
||||
) {
|
||||
return super.removeAuthorship(
|
||||
sectionIdentifier,
|
||||
documentPath,
|
||||
authorshipUuid
|
||||
);
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/journal")
|
||||
@AuthorizationRequired
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
public String setJournal(
|
||||
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
|
||||
final String sectionIdentifier,
|
||||
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM)
|
||||
final String documentPath,
|
||||
@FormParam("journalIdentifier")
|
||||
final String journalIdentifer
|
||||
) {
|
||||
try {
|
||||
init();
|
||||
} catch (ContentSectionNotFoundException ex) {
|
||||
return ex.showErrorMessage();
|
||||
} catch (DocumentNotFoundException ex) {
|
||||
return ex.showErrorMessage();
|
||||
}
|
||||
|
||||
if (itemPermissionChecker.canEditItem(getDocument())) {
|
||||
final Identifier identifier = identifierParser.parseIdentifier(
|
||||
journalIdentifer
|
||||
);
|
||||
final Optional<Journal> journalResult;
|
||||
switch (identifier.getType()) {
|
||||
case ID:
|
||||
journalResult = journalRepository.findById(
|
||||
Long.parseLong(
|
||||
identifier.getIdentifier()
|
||||
)
|
||||
);
|
||||
break;
|
||||
case UUID:
|
||||
journalResult = journalRepository.findByUuid(
|
||||
identifier.getIdentifier()
|
||||
);
|
||||
break;
|
||||
default:
|
||||
journalResult = Optional.empty();
|
||||
break;
|
||||
}
|
||||
|
||||
if (journalResult.isEmpty()) {
|
||||
return showJournalNotFound(
|
||||
sectionIdentifier,
|
||||
documentPath,
|
||||
journalIdentifer
|
||||
);
|
||||
}
|
||||
|
||||
final Journal journal = journalResult.get();
|
||||
articleManager.setJournal(getPublication(), journal);
|
||||
|
||||
return buildRedirectPathForStep();
|
||||
} else {
|
||||
return documentUi.showAccessDenied(
|
||||
getContentSection(),
|
||||
getDocument(),
|
||||
getLabel()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/journal/remove")
|
||||
@AuthorizationRequired
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
public String removeCollectedVolume(
|
||||
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
|
||||
final String sectionIdentifier,
|
||||
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
|
||||
final String documentPath
|
||||
) {
|
||||
try {
|
||||
init();
|
||||
} catch (ContentSectionNotFoundException ex) {
|
||||
return ex.showErrorMessage();
|
||||
} catch (DocumentNotFoundException ex) {
|
||||
return ex.showErrorMessage();
|
||||
}
|
||||
|
||||
if (itemPermissionChecker.canEditItem(getDocument())) {
|
||||
articleManager.unsetJournal(getPublication());
|
||||
|
||||
return buildRedirectPathForStep();
|
||||
} else {
|
||||
return documentUi.showAccessDenied(
|
||||
getContentSection(),
|
||||
getDocument(),
|
||||
getLabel()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/properties")
|
||||
@AuthorizationRequired
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
public String updateProperties(
|
||||
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
|
||||
final String sectionIdentifier,
|
||||
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
|
||||
final String documentPath,
|
||||
@FormParam("yearOfPublication")
|
||||
final String yearOfPublicationParam,
|
||||
@FormParam("endPage")
|
||||
final String endPageParam,
|
||||
@FormParam("issue")
|
||||
final String issue,
|
||||
@FormParam("publicationDate")
|
||||
final String publicationDateParam,
|
||||
@FormParam("startPage")
|
||||
final String startPageParam,
|
||||
@FormParam("volume")
|
||||
final String volumeParam
|
||||
) {
|
||||
try {
|
||||
init();
|
||||
} catch (ContentSectionNotFoundException ex) {
|
||||
return ex.showErrorMessage();
|
||||
} catch (DocumentNotFoundException ex) {
|
||||
return ex.showErrorMessage();
|
||||
}
|
||||
|
||||
if (itemPermissionChecker.canEditItem(getDocument())) {
|
||||
updateProperties(
|
||||
sectionIdentifier,
|
||||
documentPath,
|
||||
yearOfPublicationParam
|
||||
);
|
||||
|
||||
if (endPageParam.matches("\\d*")) {
|
||||
getPublication().setEndPage(Integer.parseInt(endPageParam));
|
||||
}
|
||||
|
||||
getPublication().setIssue(issue);
|
||||
|
||||
final LocalDate publicationDate;
|
||||
try {
|
||||
publicationDate = LocalDate.parse(
|
||||
publicationDateParam,
|
||||
DateTimeFormatter.ISO_DATE
|
||||
);
|
||||
} catch (DateTimeParseException ex) {
|
||||
return showInvalidPublicationDate(
|
||||
sectionIdentifier,
|
||||
documentPath,
|
||||
publicationDateParam
|
||||
);
|
||||
}
|
||||
|
||||
if (startPageParam.matches("\\d*")) {
|
||||
getPublication().setStartPage(Integer.parseInt(startPageParam));
|
||||
}
|
||||
|
||||
if (volumeParam.matches("\\d*")) {
|
||||
getPublication().setVolume(Integer.parseInt(volumeParam));
|
||||
}
|
||||
|
||||
return buildRedirectPathForStep();
|
||||
} else {
|
||||
return documentUi.showAccessDenied(
|
||||
getContentSection(),
|
||||
getDocument(),
|
||||
messageBundle.getMessage("publication.edit.denied")
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private String showJournalNotFound(
|
||||
final String sectionIdentifier,
|
||||
final String documentPath,
|
||||
final String journalIdentifier
|
||||
) {
|
||||
models.put("journalNotFound", journalIdentifier);
|
||||
return showStep(sectionIdentifier, documentPath);
|
||||
}
|
||||
|
||||
private String showInvalidPublicationDate(
|
||||
final String sectionIdentifier,
|
||||
final String documentPath,
|
||||
final String publicationDateParam
|
||||
) {
|
||||
models.put("invalidPublicationDate", publicationDateParam);
|
||||
return showStep(sectionIdentifier, documentPath);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,74 @@
|
|||
package org.scientificcms.publications.ui.contenttypes;
|
||||
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.inject.Named;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@RequestScoped
|
||||
@Named("SciCmsArticleInJournalPropertiesStepModel")
|
||||
public class ArticleInJournalPropertiesStepModel {
|
||||
|
||||
private String journalTitle;
|
||||
|
||||
private Integer volume;
|
||||
|
||||
private String issue;
|
||||
|
||||
private Integer startPage;
|
||||
|
||||
private Integer endPage;
|
||||
|
||||
private String publicationDate;
|
||||
|
||||
public String getJournalTitle() {
|
||||
return journalTitle;
|
||||
}
|
||||
|
||||
public void setJournalTitle(final String journalTitle) {
|
||||
this.journalTitle = journalTitle;
|
||||
}
|
||||
|
||||
public Integer getVolume() {
|
||||
return volume;
|
||||
}
|
||||
|
||||
public void setVolume(final Integer volume) {
|
||||
this.volume = volume;
|
||||
}
|
||||
|
||||
public String getIssue() {
|
||||
return issue;
|
||||
}
|
||||
|
||||
public void setIssue(final String issue) {
|
||||
this.issue = issue;
|
||||
}
|
||||
|
||||
public Integer getStartPage() {
|
||||
return startPage;
|
||||
}
|
||||
|
||||
public void setStartPage(final Integer startPage) {
|
||||
this.startPage = startPage;
|
||||
}
|
||||
|
||||
public Integer getEndPage() {
|
||||
return endPage;
|
||||
}
|
||||
|
||||
public void setEndPage(final Integer endPage) {
|
||||
this.endPage = endPage;
|
||||
}
|
||||
|
||||
public String getPublicationDate() {
|
||||
return publicationDate;
|
||||
}
|
||||
|
||||
public void setPublicationDate(final String publicationDate) {
|
||||
this.publicationDate = publicationDate;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -18,6 +18,8 @@ public class PublicationAuthoringSteps implements MvcAuthoringSteps {
|
|||
return Set.of(
|
||||
ArticleInCollectedVolumePropertiesStep.class,
|
||||
ArticleInCollectedVolumeExtendedPropertiesStep.class,
|
||||
ArticleInJournalPropertiesStep.class,
|
||||
ArticleInJournalExtendedPropertiesStep.class,
|
||||
CollectedVolumePropertiesStep.class,
|
||||
CollectedVolumeExtendedPropertiesStep.class,
|
||||
InProceedingsPropertiesStep.class,
|
||||
|
|
|
|||
|
|
@ -536,3 +536,4 @@ basicproperties.errors.paper_not_found=The selected paper {0} was not found.
|
|||
basicproperties.errors.paper_not_part_of_proceedings=The paper {0} was selected for removal from these Proceeedings, but is not part of these Proceedings.
|
||||
basicproperties.errors.organizer_not_found=The selected organizer {0} was found.
|
||||
inproceedings.basicproperties.errors.proceedings_not_found=The selected Proceedings {0} were not found.
|
||||
articleinjournal.createstep.description=Create a new article in a journal.
|
||||
|
|
|
|||
|
|
@ -536,3 +536,4 @@ basicproperties.errors.paper_not_found=Der ausgew\u00e4hlte Beitrag {0} wurde ni
|
|||
basicproperties.errors.paper_not_part_of_proceedings=Der Beitrag {0} soll aus diesem Tagungsband entfernt werden, ist aber nicht Teil dieses Tagungsbandes.
|
||||
basicproperties.errors.organizer_not_found=Der ausgew\u00e4hlte Organisator wurde nicht gefunden.
|
||||
inproceedings.basicproperties.errors.proceedings_not_found=Der ausgew\u00e4hlte Tagungsband {0} wurde nicht gefunden.
|
||||
articleinjournal.createstep.description=Einen neuen Zeitschriftenartikel anlegen.
|
||||
|
|
|
|||
Loading…
Reference in New Issue