- */
-public abstract class AbstractPublicationCreateForm>
- extends PageCreateForm {
-
- public AbstractPublicationCreateForm(
- final ItemSelectionModel itemModel,
- final CreationSelector creationSelector,
- final StringParameter selectedLanguageParam
- ) {
- super(itemModel, creationSelector, selectedLanguageParam);
- }
-
- @Override
- @SuppressWarnings("unchecked")
- protected ContentItemInitializer> getItemInitializer(
- final FormData data, final PageState state) {
-
- return item -> ((T) item).setPublication(
- createPublication(data)
- );
- }
-
- protected P createPublication(final FormData data) {
-
- final Locale locale = new Locale((String) data.get(LANGUAGE));
- final String title = (String) data.get(TITLE);
-
- final P publication = createPublication();
- publication.getTitle().addValue(locale, title);
-
- return publication;
- }
-
- protected abstract P createPublication();
-
-}
diff --git a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ArticleInCollectedVolumeCollectedVolumeForm.java b/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ArticleInCollectedVolumeCollectedVolumeForm.java
deleted file mode 100644
index 199f207..0000000
--- a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ArticleInCollectedVolumeCollectedVolumeForm.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.FormData;
-import com.arsdigita.bebop.FormProcessException;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.event.FormInitListener;
-import com.arsdigita.bebop.event.FormProcessListener;
-import com.arsdigita.bebop.event.FormSectionEvent;
-import com.arsdigita.bebop.parameters.StringParameter;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.ui.authoring.BasicItemForm;
-import com.arsdigita.globalization.GlobalizedMessage;
-
-import org.libreccm.cdi.utils.CdiUtil;
-import org.scientificcms.publications.ArticleInCollectedVolume;
-import org.scientificcms.publications.CollectedVolume;
-import org.scientificcms.publications.SciPublicationsConstants;
-import org.scientificcms.publications.contenttypes.ArticleInCollectedVolumeItem;
-
-/**
- * Form for adding an association between an ArticleInCollectedVolume and a
- * CollectedVolume.
- *
- * @author Jens Pelzetter
- */
-public class ArticleInCollectedVolumeCollectedVolumeForm
- extends BasicItemForm
- implements FormProcessListener, FormInitListener {
-
- private final static String COLLECTED_VOLUME_SEARCH
- = "collectedVolumeSearch";
-
- private PublicationSearchWidget collectedVolumeSearch;
-
- public ArticleInCollectedVolumeCollectedVolumeForm(
- final ItemSelectionModel itemSelectionModel,
- final StringParameter selectedLanguageParam) {
-
- super(
- "ArticleInCollectedVolumeCollectedVolumeForm",
- itemSelectionModel,
- selectedLanguageParam
- );
- }
-
- @Override
- protected void addWidgets() {
-
- collectedVolumeSearch = new PublicationSearchWidget(
- COLLECTED_VOLUME_SEARCH, CollectedVolume.class
- );
-
- collectedVolumeSearch.setLabel(
- new GlobalizedMessage(
- "publications.ui.articleInCollectedVolume.selectCollectedVolume",
- SciPublicationsConstants.BUNDLE
- )
- );
- add(collectedVolumeSearch);
- }
-
- @Override
- public void init(final FormSectionEvent event) throws FormProcessException {
- final PageState state = event.getPageState();
-
- setVisible(state, true);
- }
-
- @Override
- public void process(final FormSectionEvent event)
- throws FormProcessException {
-
- final FormData data = event.getFormData();
- final PageState state = event.getPageState();
-
- final ArticleInCollectedVolumeItem articleItem
- = (ArticleInCollectedVolumeItem) getItemSelectionModel()
- .getSelectedObject(state);
- final ArticleInCollectedVolume article = articleItem.getPublication();
-
- if (this.getSaveCancelSection().getSaveButton().isSelected(state)) {
- final CollectedVolume collectedVolume = (CollectedVolume) data.get(
- COLLECTED_VOLUME_SEARCH
- );
-
- final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
- final ArticleInCollectedVolumeController controller = cdiUtil
- .findBean(ArticleInCollectedVolumeController.class);
- controller.setCollectedVolume(
- article.getPublicationId(), collectedVolume.getPublicationId()
- );
- }
-
- init(event);
- }
-
-}
diff --git a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ArticleInCollectedVolumeCollectedVolumeSheet.java b/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ArticleInCollectedVolumeCollectedVolumeSheet.java
deleted file mode 100644
index cca05d4..0000000
--- a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ArticleInCollectedVolumeCollectedVolumeSheet.java
+++ /dev/null
@@ -1,305 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.Component;
-import com.arsdigita.bebop.ControlLink;
-import com.arsdigita.bebop.FormProcessException;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.Table;
-import com.arsdigita.bebop.Text;
-import com.arsdigita.bebop.event.TableActionEvent;
-import com.arsdigita.bebop.event.TableActionListener;
-import com.arsdigita.bebop.parameters.StringParameter;
-import com.arsdigita.bebop.table.TableCellRenderer;
-import com.arsdigita.bebop.table.TableColumn;
-import com.arsdigita.bebop.table.TableColumnModel;
-import com.arsdigita.bebop.table.TableModel;
-import com.arsdigita.bebop.table.TableModelBuilder;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.ui.authoring.SelectedLanguageUtil;
-import com.arsdigita.globalization.GlobalizedMessage;
-import com.arsdigita.util.LockableImpl;
-
-import org.libreccm.cdi.utils.CdiUtil;
-import org.libreccm.security.PermissionChecker;
-import org.librecms.contentsection.privileges.ItemPrivileges;
-import org.scientificcms.publications.CollectedVolume;
-import org.scientificcms.publications.SciPublicationsConstants;
-import org.scientificcms.publications.contenttypes.ArticleInCollectedVolumeItem;
-
-import java.util.Locale;
-
-/**
- * Sheet which displays the collected volume to which an article in a collected
- * volume is associated to.
- *
- * @author Jens Pelzetter
- */
-public class ArticleInCollectedVolumeCollectedVolumeSheet
- extends Table
- implements TableActionListener {
-
- private final String TABLE_COL_EDIT = "table_col_edit";
-
- private final String TABLE_COL_DEL = "table_col_del";
-
- private ItemSelectionModel itemModel;
-
- public ArticleInCollectedVolumeCollectedVolumeSheet(
- final ItemSelectionModel itemModel,
- final StringParameter selectedLangParam
- ) {
- super();
- this.itemModel = itemModel;
-
- setEmptyView(
- new Label(
- new GlobalizedMessage(
- "publications.ui.articleInCollectedVolume.collectedVolume.none",
- SciPublicationsConstants.BUNDLE
- )
- )
- );
-
- final TableColumnModel colModel = getColumnModel();
- colModel.add(
- new TableColumn(
- 0,
- new Label(
- new GlobalizedMessage(
- "publications.ui.articleInCollectedVolume.collectedVolume",
- SciPublicationsConstants.BUNDLE
- )
- ),
- TABLE_COL_EDIT
- )
- );
- colModel.add(
- new TableColumn(
- 1,
- new Label(
- new GlobalizedMessage(
- "publications.ui.articleInCollectedVolume.collectedVolume.remove",
- SciPublicationsConstants.BUNDLE
- )
- ),
- TABLE_COL_DEL
- )
- );
-
- setModelBuilder(
- new ArticleInCollectedVolumeCollectedVolumeSheetModelBuilder(
- itemModel, selectedLangParam
- )
- );
- colModel.get(0).setCellRenderer(new EditCellRenderer());
- colModel.get(1).setCellRenderer(new DeleteCellRenderer());
-
- addTableActionListener(this);
-
- }
-
- @Override
- public void cellSelected(final TableActionEvent event)
- throws FormProcessException {
-
- final PageState state = event.getPageState();
-
- final ArticleInCollectedVolumeItem articleItem
- = (ArticleInCollectedVolumeItem) itemModel
- .getSelectedObject(state);
-
- final TableColumn column = getColumnModel().get(event.getColumn());
-
- if (column.getHeaderKey().toString().equals(TABLE_COL_EDIT)) {
- // Nothing
- } else if (column.getHeaderKey().toString().equals(TABLE_COL_DEL)) {
- final ArticleInCollectedVolumeController controller = CdiUtil
- .createCdiUtil()
- .findBean(ArticleInCollectedVolumeController.class);
- controller.unsetCollectedVolume(
- articleItem.getPublication().getPublicationId()
- );
- }
-
- }
-
- @Override
- public void headSelected(TableActionEvent event) {
- // Nothing
- }
-
- private class ArticleInCollectedVolumeCollectedVolumeSheetModelBuilder
- extends LockableImpl
- implements TableModelBuilder {
-
- private final ItemSelectionModel itemModel;
- private final StringParameter selectedLangParam;
-
- public ArticleInCollectedVolumeCollectedVolumeSheetModelBuilder(
- final ItemSelectionModel itemModel,
- final StringParameter selectedLangParam
- ) {
- this.itemModel = itemModel;
- this.selectedLangParam = selectedLangParam;
- }
-
- @Override
- public TableModel makeModel(final Table table, final PageState state) {
- table.getRowSelectionModel().clearSelection(state);
- final ArticleInCollectedVolumeItem article
- = (ArticleInCollectedVolumeItem) itemModel
- .getSelectedObject(state);
- return new ArticleInCollectedVolumeCollectedVolumeSheetModel(
- table, state, article, selectedLangParam
- );
- }
-
- }
-
- private class ArticleInCollectedVolumeCollectedVolumeSheetModel
- implements TableModel {
-
- private final Table table;
-
- private final String collectedVolumeTitle;
-
- private final Long collectedVolumeId;
-
- private boolean done;
-
- public ArticleInCollectedVolumeCollectedVolumeSheetModel(
- final Table table,
- final PageState state,
- final ArticleInCollectedVolumeItem articleItem,
- final StringParameter selectedLangParam
- ) {
- this.table = table;
- final CollectedVolume collectedVolume = articleItem
- .getPublication()
- .getCollectedVolume();
- if (collectedVolume == null) {
- done = false;
- collectedVolumeTitle = null;
- collectedVolumeId = null;
- } else {
- done = true;
- final Locale selectedLang = SelectedLanguageUtil.selectedLocale(
- state, selectedLangParam
- );
- collectedVolumeTitle = collectedVolume.getTitle().getValue(
- selectedLang
- );
- collectedVolumeId = collectedVolume.getPublicationId();
- }
- }
-
- @Override
- public int getColumnCount() {
- return table.getColumnModel().size();
- }
-
- @Override
- public boolean nextRow() {
- boolean ret;
-
- if (done) {
- ret = true;
- done = false;
- } else {
- ret = false;
- }
-
- return ret;
- }
-
- @Override
- public Object getElementAt(final int columnIndex) {
- switch (columnIndex) {
- case 0:
- return collectedVolumeTitle;
- case 1:
- return new Label(
- new GlobalizedMessage(
- "publications.ui.articleInCollectedVolume.collectedVolume.remove",
- SciPublicationsConstants.BUNDLE
- )
- );
- default:
- return null;
- }
- }
-
- @Override
- public Object getKeyAt(int columnIndex) {
- return collectedVolumeId;
- }
-
- }
-
- private class EditCellRenderer
- extends LockableImpl
- implements TableCellRenderer {
-
- @Override
- public Component getComponent(
- final Table table,
- final PageState state,
- final Object value,
- final boolean isSelected,
- final Object key,
- final int row,
- final int column
- ) {
- return new Text((String) value);
- }
-
- }
-
- private class DeleteCellRenderer
- extends LockableImpl
- implements TableCellRenderer {
-
- @Override
- public Component getComponent(
- final Table table,
- final PageState state,
- final Object value,
- final boolean isSelected,
- final Object key,
- final int row,
- final int column
- ) {
- final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
- final PermissionChecker permissionChecker = cdiUtil
- .findBean(PermissionChecker.class);
- final ArticleInCollectedVolumeItem articleItem
- = (ArticleInCollectedVolumeItem) itemModel
- .getSelectedObject(state);
- final boolean canEdit = permissionChecker.isPermitted(
- ItemPrivileges.EDIT, articleItem
- );
-
- if (canEdit) {
- final ControlLink link = new ControlLink((Component) value);
- link.setConfirmation(
- new GlobalizedMessage(
- "publications.ui.articleInCollectedVolume.collectedVolume."
- + "confirm_remove",
- SciPublicationsConstants.BUNDLE
- )
- );
- return link;
- } else {
- return new Text("");
- }
- }
-
- }
-
-}
diff --git a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ArticleInCollectedVolumeCollectedVolumeStep.java b/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ArticleInCollectedVolumeCollectedVolumeStep.java
deleted file mode 100644
index 2e7531d..0000000
--- a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ArticleInCollectedVolumeCollectedVolumeStep.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.parameters.StringParameter;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
-import com.arsdigita.cms.ui.authoring.BasicItemForm;
-import com.arsdigita.cms.ui.authoring.SimpleEditStep;
-import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
-import com.arsdigita.globalization.GlobalizedMessage;
-
-import org.scientificcms.publications.SciPublicationsConstants;
-
-/**
- * /**
- * Step for adding a association between a ArticleInCollectedVolume and a
- * CollectedVolume.
- *
- * @author Jens Pelzetter
- */
-public class ArticleInCollectedVolumeCollectedVolumeStep
- extends SimpleEditStep {
-
- private final static String ADD_COLLECTED_VOLUME_STEP = "addCollectedVolume";
-
- public ArticleInCollectedVolumeCollectedVolumeStep(
- final ItemSelectionModel itemModel,
- final AuthoringKitWizard parent,
- final StringParameter selectedLanguageParam
- ) {
- this(itemModel, parent, selectedLanguageParam, null);
- }
-
- public ArticleInCollectedVolumeCollectedVolumeStep(
- final ItemSelectionModel itemSelectionModel,
- final AuthoringKitWizard authoringKitWizard,
- final StringParameter selectedLanguageParam,
- final String parameterSuffix
- ) {
- super(
- itemSelectionModel,
- authoringKitWizard,
- selectedLanguageParam,
- parameterSuffix
- );
-
- final BasicItemForm addCollectedVolumeForm
- = new ArticleInCollectedVolumeCollectedVolumeForm(
- itemSelectionModel,
- selectedLanguageParam
- );
-
- add(
- ADD_COLLECTED_VOLUME_STEP,
- new GlobalizedMessage(
- "publications.ui.collectedVolume.addCollectedVolume",
- SciPublicationsConstants.BUNDLE
- ),
- new WorkflowLockedComponentAccess(
- addCollectedVolumeForm, itemSelectionModel
- ),
- addCollectedVolumeForm.getSaveCancelSection().getCancelButton()
- );
-
- final ArticleInCollectedVolumeCollectedVolumeSheet sheet
- = new ArticleInCollectedVolumeCollectedVolumeSheet(
- itemSelectionModel, selectedLanguageParam);
- setDisplayComponent(sheet);
- }
-
-}
diff --git a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ArticleInCollectedVolumeController.java b/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ArticleInCollectedVolumeController.java
deleted file mode 100644
index 7f7973b..0000000
--- a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ArticleInCollectedVolumeController.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import org.scientificcms.publications.ArticleInCollectedVolume;
-import org.scientificcms.publications.ArticleInCollectedVolumeManager;
-import org.scientificcms.publications.CollectedVolume;
-import org.scientificcms.publications.PublicationRepository;
-
-import java.util.Locale;
-import java.util.Map;
-
-import javax.enterprise.context.RequestScoped;
-import javax.inject.Inject;
-import javax.transaction.Transactional;
-
-/**
- *
- * @author Jens Pelzetter
- */
-@RequestScoped
-public class ArticleInCollectedVolumeController {
-
- public static final String START_PAGE = "startPage";
-
- public static final String END_PAGE = "endPage";
-
- public static final String CHAPTER = "chapter";
-
- public static final String PEER_REVIEWED = "peerReviewed";
-
- @Inject
- private ArticleInCollectedVolumeManager articleManager;
-
- @Inject
- private PublicationRepository publicationRepository;
-
- /**
- * Save a changed {@link ArticleInCollectedVolume}.
- *
- * @param articleId The ID of the article.
- * @param selectedLocale The locale selected in the UI.
- * @param data The data to set on the article.
- */
- @Transactional(Transactional.TxType.REQUIRED)
- public void saveArticle(
- final long articleId,
- final Locale selectedLocale,
- final Map data
- ) {
- final ArticleInCollectedVolume article = publicationRepository
- .findByIdAndType(articleId, ArticleInCollectedVolume.class)
- .orElseThrow(
- () -> new IllegalArgumentException(
- String.format(
- "No ArticleInCollectedVolume with ID %d found.",
- articleId
- )
- )
- );
-
- if (data.get(START_PAGE) != null) {
- final Integer startPage = (Integer) data.get(START_PAGE);
- article.setStartPage(startPage);
- }
- if (data.get(END_PAGE) != null) {
- final Integer endPage = (Integer) data.get(END_PAGE);
- article.setEndPage(endPage);
- }
- if (data.get(CHAPTER) != null) {
- final String chapter = (String) data.get(CHAPTER);
- article.setChapter(chapter);
- }
- if (data.get(PEER_REVIEWED) != null) {
- final Boolean peerReviewed = (Boolean) data.get(PEER_REVIEWED);
- article.setPeerReviewed(peerReviewed);
- }
-
- publicationRepository.save(article);
- }
-
- /**
- * Set the value of the {@link ArticleInCollectedVolume#collectedVolume}
- * property to a {@link CollectedVolume}.
- *
- * @param articleId The ID of the article to use.
- * @param collectedVolumeId The ID of the collected volume to use.
- */
- @Transactional(Transactional.TxType.REQUIRED)
- public void setCollectedVolume(
- final long articleId, final long collectedVolumeId
- ) {
- final ArticleInCollectedVolume article = publicationRepository
- .findByIdAndType(articleId, ArticleInCollectedVolume.class)
- .orElseThrow(
- () -> new IllegalArgumentException(
- String.format(
- "No ArticleInCollectedVolume with ID %d found",
- articleId
- )
- )
- );
-
- final CollectedVolume collectedVolume = publicationRepository
- .findByIdAndType(collectedVolumeId, CollectedVolume.class)
- .orElseThrow(
- () -> new IllegalArgumentException(
- String.format(
- "No CollectedVolume with ID %d found.",
- collectedVolumeId
- )
- )
- );
-
- articleManager.setCollectedVolume(article, collectedVolume);
- }
-
- @Transactional(Transactional.TxType.REQUIRED)
- public void unsetCollectedVolume(
- final long articleId
- ) {
- final ArticleInCollectedVolume article = publicationRepository
- .findByIdAndType(articleId, ArticleInCollectedVolume.class)
- .orElseThrow(
- () -> new IllegalArgumentException(
- String.format(
- "No ArticleInCollectedVolume with ID %d found",
- articleId
- )
- )
- );
-
- articleManager.unsetCollectedVolume(article);
- }
-
-}
diff --git a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ArticleInCollectedVolumeCreateForm.java b/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ArticleInCollectedVolumeCreateForm.java
deleted file mode 100644
index 766feea..0000000
--- a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ArticleInCollectedVolumeCreateForm.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.parameters.StringParameter;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.ui.authoring.CreationSelector;
-
-import org.scientificcms.publications.ArticleInCollectedVolume;
-import org.scientificcms.publications.contenttypes.ArticleInCollectedVolumeItem;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class ArticleInCollectedVolumeCreateForm
- extends AbstractPublicationCreateForm {
-
- public ArticleInCollectedVolumeCreateForm(
- final ItemSelectionModel itemModel,
- final CreationSelector creationSelector,
- final StringParameter selectedLanguageParam
- ) {
- super(itemModel, creationSelector, selectedLanguageParam);
- }
-
- @Override
- protected ArticleInCollectedVolume createPublication() {
- return new ArticleInCollectedVolume();
- }
-
-}
diff --git a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ArticleInCollectedVolumePropertiesStep.java b/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ArticleInCollectedVolumePropertiesStep.java
deleted file mode 100644
index bf4c179..0000000
--- a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ArticleInCollectedVolumePropertiesStep.java
+++ /dev/null
@@ -1,169 +0,0 @@
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.Component;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.parameters.StringParameter;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
-import com.arsdigita.cms.ui.authoring.BasicPageForm;
-import com.arsdigita.cms.ui.authoring.SimpleEditStep;
-import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
-import com.arsdigita.domain.DomainService;
-import com.arsdigita.globalization.GlobalizedMessage;
-import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
-
-import org.scientificcms.publications.SciPublicationsConstants;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class ArticleInCollectedVolumePropertiesStep
- extends PublicationPropertiesStep {
-
- private final StringParameter selectedLangParameter;
-
- public ArticleInCollectedVolumePropertiesStep(
- final ItemSelectionModel itemModel,
- final AuthoringKitWizard parent,
- final StringParameter selectedLangParameter
- ) {
- super(itemModel, parent, selectedLangParameter);
- this.selectedLangParameter = selectedLangParameter;
- }
-
- public static Component getArticleInCollectedVolumePropertySheet(
- final ItemSelectionModel itemModel,
- final StringParameter selectedLanguageParam
- ) {
-
- final DomainObjectPropertySheet sheet
- = (DomainObjectPropertySheet) PublicationPropertiesStep
- .getPublicationPropertySheet(itemModel, selectedLanguageParam);
-
- sheet.add(
- new GlobalizedMessage(
- "publications.ui.article_in_collected_volume.pages_from",
- SciPublicationsConstants.BUNDLE
- ),
- ArticleInCollectedVolumeController.START_PAGE
- );
-
- sheet.add(
- new GlobalizedMessage(
- "publications.ui.article_in_collected_volume.pages_to",
- SciPublicationsConstants.BUNDLE
- ),
- ArticleInCollectedVolumeController.END_PAGE
- );
-
- sheet.add(
- new GlobalizedMessage(
- "publications.ui.article_in_collected_volume.chapter",
- SciPublicationsConstants.BUNDLE
- ),
- ArticleInCollectedVolumeController.CHAPTER
- );
-
- sheet.add(
- new GlobalizedMessage(
- "publications.ui.articleInCollectedVolume.reviewed",
- SciPublicationsConstants.BUNDLE
- ),
- ArticleInCollectedVolumeController.PEER_REVIEWED,
- new ReviewedFormatter()
- );
-
- return sheet;
- }
-
- @Override
- protected void addBasicProperties(
- final ItemSelectionModel itemModel, final AuthoringKitWizard parent
- ) {
- final SimpleEditStep basicProperties = new SimpleEditStep(
- itemModel, parent, selectedLangParameter, EDIT_SHEET_NAME
- );
-
- final BasicPageForm editBasicSheet
- = new ArticleInCollectedVolumePropertyForm(
- itemModel, this, selectedLangParameter
- );
-
- basicProperties.add(
- EDIT_SHEET_NAME,
- new GlobalizedMessage(
- "publications.ui.article_in_collected_volume.edit_basic_sheet",
- SciPublicationsConstants.BUNDLE
- ),
- new WorkflowLockedComponentAccess(editBasicSheet, itemModel),
- editBasicSheet.getSaveCancelSection().getCancelButton()
- );
-
- basicProperties.setDisplayComponent(
- getArticleInCollectedVolumePropertySheet(
- itemModel, selectedLangParameter
- )
- );
-
- getSegmentedPanel().addSegment(
- new Label(
- new GlobalizedMessage(
- "publications.ui.publication.basic_properties",
- SciPublicationsConstants.BUNDLE
- )
- ),
- basicProperties
- );
- }
-
- @Override
- protected void addSteps(
- final ItemSelectionModel itemModel, final AuthoringKitWizard parent
- ) {
- super.addSteps(itemModel, parent);
-
- addStep(
- new ArticleInCollectedVolumeCollectedVolumeStep(
- itemModel, parent, selectedLangParameter
- ),
- new GlobalizedMessage(
- "publications.ui.articleInCollectedVolume.collectedVolume",
- SciPublicationsConstants.BUNDLE
- )
- );
- }
-
- private static class ReviewedFormatter
- extends DomainService
- implements DomainObjectPropertySheet.AttributeFormatter {
-
- @Override
- public String format(
- final Object obj, final String attribute, final PageState state
- ) {
- final GlobalizedMessage msg;
- if ((get(obj, attribute) instanceof Boolean)
- && ((Boolean) get(obj, attribute) == true)) {
- msg = new GlobalizedMessage(
- "publications.ui.articleInCollectedVolume.reviewed.yes",
- SciPublicationsConstants.BUNDLE
- );
- } else {
- msg = new GlobalizedMessage(
- "publications.ui.articleInCollectedVolume.reviewed.no",
- SciPublicationsConstants.BUNDLE
- );
- }
- return (String) msg.localize();
- }
-
- }
-
- @Override
- protected boolean isSeriesStepEnabled() {
- return false;
- }
-
-}
diff --git a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ArticleInCollectedVolumePropertyForm.java b/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ArticleInCollectedVolumePropertyForm.java
deleted file mode 100644
index a80e57e..0000000
--- a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ArticleInCollectedVolumePropertyForm.java
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.FormData;
-import com.arsdigita.bebop.FormProcessException;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.event.FormInitListener;
-import com.arsdigita.bebop.event.FormProcessListener;
-import com.arsdigita.bebop.event.FormSectionEvent;
-import com.arsdigita.bebop.event.FormSubmissionListener;
-import com.arsdigita.bebop.form.CheckboxGroup;
-import com.arsdigita.bebop.form.Option;
-import com.arsdigita.bebop.form.TextField;
-import com.arsdigita.bebop.parameters.IntegerParameter;
-import com.arsdigita.bebop.parameters.ParameterModel;
-import com.arsdigita.bebop.parameters.StringParameter;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.ui.authoring.SelectedLanguageUtil;
-import com.arsdigita.globalization.GlobalizedMessage;
-
-import org.libreccm.cdi.utils.CdiUtil;
-import org.scientificcms.publications.ArticleInCollectedVolume;
-import org.scientificcms.publications.SciPublicationsConstants;
-import org.scientificcms.publications.contenttypes.ArticleInCollectedVolumeItem;
-
-import java.util.HashMap;
-import java.util.Locale;
-import java.util.Map;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class ArticleInCollectedVolumePropertyForm
- extends PublicationPropertyForm
- implements FormProcessListener, FormInitListener, FormSubmissionListener {
-
- public static final String ID = "ArticleInCollectedVolumeEdit";
-
- private static final String REVIEWED = "reviewed";
-
- private final ArticleInCollectedVolumePropertiesStep propertiesStep;
-
- private final StringParameter selectedLangParam;
-
- private CheckboxGroup reviewed;
-
- public ArticleInCollectedVolumePropertyForm(
- final ItemSelectionModel itemModel,
- final StringParameter selectedLangParam
- ) {
- this(itemModel, null, selectedLangParam);
- }
-
- public ArticleInCollectedVolumePropertyForm(
- final ItemSelectionModel itemModel,
- final ArticleInCollectedVolumePropertiesStep step,
- final StringParameter selectedLangParam
- ) {
- super(itemModel, step, selectedLangParam);
- propertiesStep = step;
- this.selectedLangParam = selectedLangParam;
- addSubmissionListener(this);
- }
-
- @Override
- protected void addWidgets() {
-
- super.addWidgets();
-
- final ParameterModel startPageParam = new IntegerParameter(
- ArticleInCollectedVolumeController.START_PAGE);
- final TextField startPage = new TextField(startPageParam);
- startPage.setLabel(
- new GlobalizedMessage(
- "publications.ui.article_in_collected_volume.pages_from",
- SciPublicationsConstants.BUNDLE
- )
- );
- add(startPage);
-
- ParameterModel endPageParam = new IntegerParameter(
- ArticleInCollectedVolumeController.END_PAGE
- );
- final TextField endPage = new TextField(endPageParam);
- endPage.setLabel(
- new GlobalizedMessage(
- "publications.ui.article_in_collected_volume.pages_to",
- SciPublicationsConstants.BUNDLE
- )
- );
- add(endPage);
-
- ParameterModel chapterParam = new StringParameter(
- ArticleInCollectedVolumeController.CHAPTER
- );
- final TextField chapter = new TextField(chapterParam);
- chapter.setLabel(
- new GlobalizedMessage(
- "publications.ui.article_in_collected_volume.chapter",
- SciPublicationsConstants.BUNDLE
- )
- );
- add(chapter);
-
- reviewed = new CheckboxGroup("reviewedGroup");
- reviewed.addOption(
- new Option(
- REVIEWED,
- new Label(
- new GlobalizedMessage(
- "publications.ui.articleInCollectedVolume.reviewed",
- SciPublicationsConstants.BUNDLE
- )
- )
- )
- );
- reviewed.setLabel(
- new GlobalizedMessage(
- "publications.ui.articleInCollectedVolume.reviewed",
- SciPublicationsConstants.BUNDLE
- )
- );
- add(reviewed);
- }
-
- @Override
- public void init(final FormSectionEvent event) throws FormProcessException {
-
- super.init(event);
-
- final FormData data = event.getFormData();
- final ArticleInCollectedVolumeItem articleItem
- = (ArticleInCollectedVolumeItem) initBasicWidgets(
- event);
-
- final ArticleInCollectedVolume article = articleItem.getPublication();
-
- data.put(
- ArticleInCollectedVolumeController.START_PAGE,
- article.getStartPage()
- );
- data.put(
- ArticleInCollectedVolumeController.END_PAGE,
- article.getEndPage()
- );
- data.put(
- ArticleInCollectedVolumeController.CHAPTER, article.getChapter()
- );
-
- if ((article.getPeerReviewed() != null)
- && (article.getPeerReviewed())) {
- reviewed.setValue(event.getPageState(), new String[]{REVIEWED});
- } else {
- reviewed.setValue(event.getPageState(), null);
- }
- }
-
- @Override
- public void process(final FormSectionEvent event)
- throws FormProcessException {
-
- super.process(event);
-
- final FormData formData = event.getFormData();
- final PageState state = event.getPageState();
- final ArticleInCollectedVolumeItem articleItem
- = (ArticleInCollectedVolumeItem) processBasicWidgets(
- event);
-
- if (articleItem != null
- && getSaveCancelSection().getSaveButton().isSelected(state)) {
-
- final Map data = new HashMap<>();
-
- data.put(
- ArticleInCollectedVolumeController.START_PAGE,
- formData.get(ArticleInCollectedVolumeController.START_PAGE)
- );
- data.put(
- ArticleInCollectedVolumeController.END_PAGE,
- formData.get(ArticleInCollectedVolumeController.END_PAGE)
- );
- data.put(
- ArticleInCollectedVolumeController.CHAPTER,
- formData.get(ArticleInCollectedVolumeController.CHAPTER)
- );
-
- if (reviewed.getValue(event.getPageState()) == null) {
- data.put(
- ArticleInCollectedVolumeController.PEER_REVIEWED,
- Boolean.FALSE
- );
- } else {
- data.put(
- ArticleInCollectedVolumeController.PEER_REVIEWED,
- Boolean.TRUE
- );
- }
-
- final Locale selectedLocale = SelectedLanguageUtil.selectedLocale(
- state, selectedLangParam
- );
-
- final ArticleInCollectedVolumeController controller = CdiUtil
- .createCdiUtil()
- .findBean(ArticleInCollectedVolumeController.class);
- controller.saveArticle(
- articleItem.getPublication().getPublicationId(),
- selectedLocale,
- data
- );
- }
- }
-
-}
diff --git a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ArticleInJournalController.java b/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ArticleInJournalController.java
deleted file mode 100644
index 268e189..0000000
--- a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ArticleInJournalController.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import org.scientificcms.publications.ArticleInJournal;
-import org.scientificcms.publications.ArticleInJournalManager;
-import org.scientificcms.publications.Journal;
-import org.scientificcms.publications.JournalRepository;
-import org.scientificcms.publications.PublicationRepository;
-
-import java.time.LocalDate;
-import java.util.Locale;
-import java.util.Map;
-
-import javax.enterprise.context.RequestScoped;
-import javax.inject.Inject;
-import javax.transaction.Transactional;
-
-/**
- *
- * @author Jens Pelzetter
- */
-@RequestScoped
-public class ArticleInJournalController {
-
- public static final String VOLUME = "volume";
-
- public static final String ISSUE = "issue";
-
- public static final String START_PAGE = "startPage";
-
- public static final String END_PAGE = "endPage";
-
- public static final String PUBLICATION_DATE = "publicationDate";
-
- public static final String PEER_REVIEWED = "reviewed";
-
- @Inject
- private ArticleInJournalManager articleManager;
-
- @Inject
- private JournalRepository journalRepository;
-
- @Inject
- private PublicationRepository publicationRepository;
-
- /**
- * Save a changed {@link ArticleInJournal}.
- *
- * @param articleId The ID of the article.
- * @param selectedLocale The locale selected in the UI.
- * @param data The data to set on the article.
- */
- @Transactional(Transactional.TxType.REQUIRED)
- public void saveArticle(
- final long articleId,
- final Locale selectedLocale,
- final Map data
- ) {
- final ArticleInJournal article = publicationRepository
- .findByIdAndType(articleId, ArticleInJournal.class)
- .orElseThrow(
- () -> new IllegalArgumentException(
- String.format(
- "No ArticleInJournal with ID %d found.",
- articleId
- )
- )
- );
-
- if (data.get(VOLUME) != null) {
- final Integer volume = (Integer) data.get(VOLUME);
- article.setVolume(volume);
- }
- if (data.get(ISSUE) != null) {
- final String issue = (String) data.get(ISSUE);
- article.setIssue(issue);
- }
- if (data.get(START_PAGE) != null) {
- final Integer startPage = (Integer) data.get(START_PAGE);
- article.setStartPage(startPage);
- }
- if (data.get(END_PAGE) != null) {
- final Integer endPage = (Integer) data.get(END_PAGE);
- article.setStartPage(endPage);
- }
- if (data.get(PUBLICATION_DATE) != null) {
- final LocalDate publicationDate = (LocalDate) data.get(
- PUBLICATION_DATE
- );
- article.setPublicationDate(publicationDate);
- }
- if (data.get(PEER_REVIEWED) != null) {
- final Boolean peerReviewed = (Boolean) data.get(PEER_REVIEWED);
- article.setPeerReviewed(peerReviewed);
- }
-
- publicationRepository.save(article);
- }
-
- /**
- * Set the value of the {@link ArticleInJournal#journal} property to a
- * {@link Journal}.
- *
- * @param articleId The ID of the article to use.
- * @param journalId The ID of the journal to use.
- */
- @Transactional(Transactional.TxType.REQUIRED)
- public void setJournal(
- final long articleId, final long journalId
- ) {
- final ArticleInJournal article = publicationRepository
- .findByIdAndType(articleId, ArticleInJournal.class)
- .orElseThrow(
- () -> new IllegalArgumentException(
- String.format(
- "No ArticleInJournal with ID %d found.",
- articleId
- )
- )
- );
- final Journal journal = journalRepository
- .findById(journalId)
- .orElseThrow(
- () -> new IllegalArgumentException(
- String.format(
- "No Journal with ID %d found",
- journalId
- )
- )
- );
-
- articleManager.setJournal(article, journal);
- }
-
- @Transactional(Transactional.TxType.REQUIRED)
- public void unsetJournal(
- final long articleId) {
- final ArticleInJournal article = publicationRepository
- .findByIdAndType(articleId, ArticleInJournal.class)
- .orElseThrow(
- () -> new IllegalArgumentException(
- String.format(
- "No ArticleInJournal with ID %d found.",
- articleId
- )
- )
- );
-
- articleManager.unsetJournal(article);
- }
-
-}
diff --git a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ArticleInJournalCreateForm.java b/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ArticleInJournalCreateForm.java
deleted file mode 100644
index 0111a6d..0000000
--- a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ArticleInJournalCreateForm.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.parameters.StringParameter;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.ui.authoring.CreationSelector;
-
-import org.scientificcms.publications.ArticleInJournal;
-import org.scientificcms.publications.contenttypes.ArticleInJournalItem;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class ArticleInJournalCreateForm
- extends AbstractPublicationCreateForm {
-
- public ArticleInJournalCreateForm(
- final ItemSelectionModel itemModel,
- final CreationSelector creationSelector,
- final StringParameter selectedLanguageParam
- ) {
- super(itemModel, creationSelector, selectedLanguageParam);
- }
-
- @Override
- protected ArticleInJournal createPublication() {
- return new ArticleInJournal();
- }
-
-}
diff --git a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ArticleInJournalJournalForm.java b/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ArticleInJournalJournalForm.java
deleted file mode 100644
index 3df2902..0000000
--- a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ArticleInJournalJournalForm.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.FormData;
-import com.arsdigita.bebop.FormProcessException;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.event.FormInitListener;
-import com.arsdigita.bebop.event.FormProcessListener;
-import com.arsdigita.bebop.event.FormSectionEvent;
-import com.arsdigita.bebop.parameters.StringParameter;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.ui.authoring.BasicItemForm;
-import com.arsdigita.globalization.GlobalizedMessage;
-
-import org.libreccm.cdi.utils.CdiUtil;
-import org.scientificcms.publications.ArticleInJournal;
-import org.scientificcms.publications.Journal;
-import org.scientificcms.publications.SciPublicationsConstants;
-import org.scientificcms.publications.contenttypes.ArticleInJournalItem;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class ArticleInJournalJournalForm
- extends BasicItemForm
- implements FormProcessListener, FormInitListener {
-
- private JournalSearchWidget journalSearch;
- private final String JOURNAL_SEARCH = "journal";
- //private final static PublicationsConfig config = new PublicationsConfig();
-
- public ArticleInJournalJournalForm(
- final ItemSelectionModel itemSelectionModel,
- final StringParameter selectedLanguageParam
- ) {
-
- super(
- "ArticleInJournalJournal",
- itemSelectionModel,
- selectedLanguageParam
- );
- }
-
- @Override
- protected void addWidgets() {
-
- journalSearch = new JournalSearchWidget(JOURNAL_SEARCH);
- journalSearch.setLabel(
- new GlobalizedMessage(
- "publications.ui.articleInJournal.selectJournal",
- SciPublicationsConstants.BUNDLE
- )
- );
- add(journalSearch);
- }
-
- @Override
- public void init(final FormSectionEvent event) throws FormProcessException {
- final PageState state = event.getPageState();
-
- setVisible(state, true);
- }
-
- @Override
- public void process(final FormSectionEvent event)
- throws FormProcessException {
- final FormData data = event.getFormData();
- final PageState state = event.getPageState();
-
- final ArticleInJournalItem articleItem = (ArticleInJournalItem) getItemSelectionModel().
- getSelectedObject(state);
- final ArticleInJournal article = articleItem.getPublication();
-
- if (this.getSaveCancelSection().getSaveButton().isSelected(state)) {
- final Journal journal = (Journal) data.get(JOURNAL_SEARCH);
-
- final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
- final ArticleInJournalController controller = cdiUtil
- .findBean(ArticleInJournalController.class);
- controller.setJournal(
- article.getPublicationId(), journal.getJournalId()
- );
- }
-
- init(event);
- }
-
-}
diff --git a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ArticleInJournalJournalSheet.java b/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ArticleInJournalJournalSheet.java
deleted file mode 100644
index 5f0bb5c..0000000
--- a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ArticleInJournalJournalSheet.java
+++ /dev/null
@@ -1,284 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.Component;
-import com.arsdigita.bebop.ControlLink;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.Table;
-import com.arsdigita.bebop.Text;
-import com.arsdigita.bebop.event.TableActionEvent;
-import com.arsdigita.bebop.event.TableActionListener;
-import com.arsdigita.bebop.parameters.StringParameter;
-import com.arsdigita.bebop.table.TableCellRenderer;
-import com.arsdigita.bebop.table.TableColumn;
-import com.arsdigita.bebop.table.TableColumnModel;
-import com.arsdigita.bebop.table.TableModel;
-import com.arsdigita.bebop.table.TableModelBuilder;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.globalization.GlobalizedMessage;
-import com.arsdigita.util.LockableImpl;
-
-import org.libreccm.cdi.utils.CdiUtil;
-import org.libreccm.security.PermissionChecker;
-import org.librecms.contentsection.privileges.ItemPrivileges;
-import org.scientificcms.publications.Journal;
-import org.scientificcms.publications.SciPublicationsConstants;
-import org.scientificcms.publications.contenttypes.ArticleInJournalItem;
-
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class ArticleInJournalJournalSheet
- extends Table
- implements TableActionListener {
-
- private final String TABLE_COL_EDIT = "table_col_edit";
-
- private final String TABLE_COL_DEL = "table_col_del";
-
- private ItemSelectionModel itemSelectionModel;
-
- public ArticleInJournalJournalSheet(
- final ItemSelectionModel itemSelectionModel,
- final StringParameter selectedLangParam
- ) {
- super();
- this.itemSelectionModel = itemSelectionModel;
-
- setEmptyView(
- new Label(
- new GlobalizedMessage(
- "publications.ui.articleInJournal.journal.none",
- SciPublicationsConstants.BUNDLE
- )
- )
- );
-
- final TableColumnModel columnModel = getColumnModel();
- columnModel.add(
- new TableColumn(
- 0,
- new Label(
- new GlobalizedMessage(
- "publications.ui.articleInJournal.journal",
- SciPublicationsConstants.BUNDLE
- )
- ),
- TABLE_COL_EDIT
- )
- );
- columnModel.add(
- new TableColumn(
- 1,
- new Label(
- new GlobalizedMessage(
- "publications.ui.articleInJournal.journal.remove",
- SciPublicationsConstants.BUNDLE
- )
- ),
- TABLE_COL_DEL
- )
- );
-
- setModelBuilder(
- new ArticleInJournalJournalSheetModelBuilder(
- itemSelectionModel, selectedLangParam
- )
- );
- columnModel.get(0).setCellRenderer(new EditCellRenderer());
- columnModel.get(1).setCellRenderer(new DeleteCellRenderer());
-
- addTableActionListener(this);
- }
-
- @Override
- public void cellSelected(final TableActionEvent event) {
- final PageState state = event.getPageState();
-
- final ArticleInJournalItem article
- = (ArticleInJournalItem) itemSelectionModel
- .getSelectedObject(state);
-
- final TableColumn column = getColumnModel().get(event.getColumn());
-
- if (column.getHeaderKey().toString().equals(TABLE_COL_EDIT)) {
- // Nothing
- } else if (column.getHeaderKey().toString().equals(TABLE_COL_DEL)) {
- final ArticleInJournalController controller = CdiUtil
- .createCdiUtil()
- .findBean(ArticleInJournalController.class);
- controller.unsetJournal(article.getPublication().getPublicationId());
- }
- }
-
- @Override
- public void headSelected(TableActionEvent event) {
- //Nothing to do
- }
-
- private class ArticleInJournalJournalSheetModelBuilder
- extends LockableImpl
- implements TableModelBuilder {
-
- private final ItemSelectionModel itemModel;
- private final StringParameter selectedLangParam;
-
- public ArticleInJournalJournalSheetModelBuilder(
- final ItemSelectionModel itemModel,
- final StringParameter selectedLangParam
- ) {
- this.itemModel = itemModel;
- this.selectedLangParam = selectedLangParam;
- }
-
- @Override
- public TableModel makeModel(final Table table, final PageState state) {
- table.getRowSelectionModel().clearSelection(state);
- final ArticleInJournalItem article
- = (ArticleInJournalItem) itemModel.
- getSelectedObject(state);
- return new ArticleInJournalJournalSheetModel(
- table, state, article, selectedLangParam);
- }
-
- }
-
- private class ArticleInJournalJournalSheetModel implements TableModel {
-
- private final Table table;
-
- private final String journalTitle;
-
- private final Long journalId;
-
- private boolean done;
-
- public ArticleInJournalJournalSheetModel(
- final Table table,
- final PageState state,
- final ArticleInJournalItem articleItem,
- final StringParameter selectedLangParam
- ) {
- this.table = table;
- final Journal journal = articleItem
- .getPublication()
- .getJournal();
- if (journal == null) {
- done = false;
- journalTitle = null;
- journalId = null;
- } else {
- done = true;
- journalTitle = journal.getTitle();
- journalId = journal.getJournalId();
- }
- }
-
- @Override
- public int getColumnCount() {
- return table.getColumnModel().size();
- }
-
- @Override
- public boolean nextRow() {
- boolean ret;
-
- if (done) {
- ret = true;
- done = false;
- } else {
- ret = false;
- }
-
- return ret;
- }
-
- @Override
- public Object getElementAt(final int columnIndex) {
- switch (columnIndex) {
- case 0:
- return journalTitle;
- case 1:
- return new Label(
- new GlobalizedMessage(
- "publications.ui.articleInCollectedVolume.collectedVolume.remove",
- SciPublicationsConstants.BUNDLE
- )
- );
- default:
- return null;
- }
- }
-
- @Override
- public Object getKeyAt(final int columnIndex) {
- return journalId;
- }
-
- }
-
- private class EditCellRenderer
- extends LockableImpl
- implements TableCellRenderer {
-
- public Component getComponent(
- final Table table,
- final PageState state,
- final Object value,
- final boolean isSelected,
- final Object key,
- final int row,
- final int column
- ) {
- return new Text((String) value);
- }
-
- }
-
- private class DeleteCellRenderer
- extends LockableImpl
- implements TableCellRenderer {
-
- public Component getComponent(
- final Table table,
- final PageState state,
- final Object value,
- final boolean isSelected,
- final Object key,
- final int row,
- final int column
- ) {
- final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
- final PermissionChecker permissionChecker = cdiUtil
- .findBean(PermissionChecker.class);
- final ArticleInJournalItem articleItem
- = (ArticleInJournalItem) itemSelectionModel
- .getSelectedItem(state);
- final boolean canEdit = permissionChecker.isPermitted(
- ItemPrivileges.EDIT, articleItem
- );
-
- if (canEdit) {
- final ControlLink link = new ControlLink((Component) value);
- link.setConfirmation(
- new GlobalizedMessage(
- "publication.ui.articleInJournal.journal.confirm_remove",
- SciPublicationsConstants.BUNDLE
- )
- );
- return link;
- } else {
- return new Text("");
- }
- }
-
- }
-
-}
diff --git a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ArticleInJournalJournalStep.java b/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ArticleInJournalJournalStep.java
deleted file mode 100644
index 2d6c555..0000000
--- a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ArticleInJournalJournalStep.java
+++ /dev/null
@@ -1,68 +0,0 @@
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.parameters.StringParameter;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
-import com.arsdigita.cms.ui.authoring.BasicItemForm;
-import com.arsdigita.cms.ui.authoring.SimpleEditStep;
-import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
-import com.arsdigita.globalization.GlobalizedMessage;
-
-import org.scientificcms.publications.SciPublicationsConstants;
-
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-/**
- *
- * @author Jens Pelzetter
- */
-public class ArticleInJournalJournalStep extends SimpleEditStep {
-
- private String ADD_JOURNAL_STEP = "addJournal";
-
- public ArticleInJournalJournalStep(
- final ItemSelectionModel itemModel,
- final AuthoringKitWizard parent,
- final StringParameter selectedLanguageParam
- ) {
- this(itemModel, parent, selectedLanguageParam, null);
- }
-
- public ArticleInJournalJournalStep(
- final ItemSelectionModel itemSelectionModel,
- final AuthoringKitWizard authoringKitWizard,
- final StringParameter selectedLanguageParam,
- final String parameterSuffix
- ) {
- super(
- itemSelectionModel,
- authoringKitWizard,
- selectedLanguageParam,
- parameterSuffix
- );
-
- final BasicItemForm addJournalForm = new ArticleInJournalJournalForm(
- itemSelectionModel, selectedLanguageParam
- );
- add(
- ADD_JOURNAL_STEP,
- new GlobalizedMessage(
- "publications.ui.articleInJournal.addJournal",
- SciPublicationsConstants.BUNDLE),
- new WorkflowLockedComponentAccess(
- addJournalForm, itemSelectionModel
- ),
- addJournalForm.getSaveCancelSection().getCancelButton());
-
- final ArticleInJournalJournalSheet sheet
- = new ArticleInJournalJournalSheet(
- itemSelectionModel,
- selectedLanguageParam
- );
- setDisplayComponent(sheet);
- }
-
-}
diff --git a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ArticleInJournalPropertiesStep.java b/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ArticleInJournalPropertiesStep.java
deleted file mode 100644
index 28b0a32..0000000
--- a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ArticleInJournalPropertiesStep.java
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.Component;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.parameters.StringParameter;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
-import com.arsdigita.cms.ui.authoring.BasicPageForm;
-import com.arsdigita.cms.ui.authoring.SimpleEditStep;
-import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
-import com.arsdigita.globalization.GlobalizedMessage;
-import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
-
-import org.librecms.CmsConstants;
-import org.scientificcms.publications.ArticleInJournal;
-import org.scientificcms.publications.SciPublicationsConstants;
-
-import java.text.DateFormat;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class ArticleInJournalPropertiesStep extends PublicationPropertiesStep {
-
- private final StringParameter selectedLanguageParam;
-
- public ArticleInJournalPropertiesStep(
- final ItemSelectionModel itemModel,
- final AuthoringKitWizard parent,
- final StringParameter selectedLanguageParam
- ) {
- super(itemModel, parent, selectedLanguageParam);
-
- this.selectedLanguageParam = selectedLanguageParam;
- }
-
- public static Component getArticleInJournalPropertySheet(
- final ItemSelectionModel itemModel,
- final StringParameter selectedLanguageParameter
- ) {
- final DomainObjectPropertySheet sheet
- = (DomainObjectPropertySheet) PublicationPropertiesStep
- .getPublicationPropertySheet(
- itemModel,
- selectedLanguageParameter
- );
-
- sheet.add(
- new GlobalizedMessage(
- "publications.ui.articleinjournal.volume",
- SciPublicationsConstants.BUNDLE
- ),
- ArticleInJournalController.VOLUME
- );
-
- sheet.add(new GlobalizedMessage(
- "publications.ui.articleinjournal.issue",
- SciPublicationsConstants.BUNDLE
- ),
- ArticleInJournalController.ISSUE);
-
- sheet.add(
- new GlobalizedMessage(
- "publications.ui.articleinjournal.pages_from",
- SciPublicationsConstants.BUNDLE
- ),
- ArticleInJournalController.START_PAGE
- );
-
- sheet.add(
- new GlobalizedMessage(
- "publications.ui.articleinjournal.pages_to",
- SciPublicationsConstants.BUNDLE
- ),
- ArticleInJournalController.END_PAGE
- );
-
- sheet.add(
- new GlobalizedMessage(
- "publications.ui.articleinjournal.publication_date",
- SciPublicationsConstants.BUNDLE
- ),
- ArticleInJournalController.PUBLICATION_DATE,
- ArticleInJournalPropertiesStep::formatPublicationDate
- );
-
- sheet.add(new GlobalizedMessage(
- "publications.ui.articleinjournal.reviewed"
- ),
- ArticleInJournalController.PEER_REVIEWED,
- ArticleInJournalPropertiesStep::formatReviewed
- );
-
- return sheet;
- }
-
- @Override
- protected void addBasicProperties(final ItemSelectionModel itemModel,
- final AuthoringKitWizard parent
- ) {
- final SimpleEditStep basicProperties = new SimpleEditStep(
- itemModel,
- parent,
- selectedLanguageParam,
- EDIT_SHEET_NAME
- );
-
- final BasicPageForm editBasicSheet = new ArticleInJournalPropertyForm(
- itemModel, this, selectedLanguageParam
- );
-
- basicProperties.add(
- EDIT_SHEET_NAME,
- new GlobalizedMessage(
- "publications.ui.articleinjournal.edit_basic_sheet",
- SciPublicationsConstants.BUNDLE
- ),
- new WorkflowLockedComponentAccess(editBasicSheet,
- itemModel
- ),
- editBasicSheet.getSaveCancelSection().getCancelButton()
- );
-
- basicProperties.setDisplayComponent(
- getArticleInJournalPropertySheet(
- itemModel,
- selectedLanguageParam
- )
- );
-
- getSegmentedPanel().addSegment(
- new Label(
- new GlobalizedMessage(
- "publications.ui.publication.basic_properties",
- SciPublicationsConstants.BUNDLE)
- ),
- basicProperties
- );
- }
-
- @Override
- protected void addSteps(
- final ItemSelectionModel itemModel,
- final AuthoringKitWizard parent
- ) {
- super.addSteps(itemModel, parent);
-
- addStep(
- new ArticleInJournalJournalStep(
- itemModel, parent, selectedLanguageParam
- ),
- new GlobalizedMessage(
- "publication.ui.articleInJournal.journal",
- SciPublicationsConstants.BUNDLE
- )
- );
-
- }
-
- private static String formatPublicationDate(
- final Object obj, final String attribute, final PageState state
- ) {
- final ArticleInJournal article = (ArticleInJournal) obj;
-
- if (article.getPublicationDate() != null) {
- return DateFormat.getDateInstance(DateFormat.LONG)
- .format(
- article.getPublicationDate());
- } else {
- return (String) new GlobalizedMessage(
- "cms.ui.unknown",
- CmsConstants.CMS_BUNDLE
- ).localize();
- }
- }
-
- private static String formatReviewed(
- final Object obj, final String attribute, final PageState state
- ) {
- final ArticleInJournal article = (ArticleInJournal) obj;
-
- if (article.getPeerReviewed()) {
- return (String) new GlobalizedMessage(
- "publications.ui.articleinjournal.reviewed.yes",
- SciPublicationsConstants.BUNDLE
- ).localize();
- } else {
- return (String) new GlobalizedMessage(
- "publications.ui.articleinjournal.reviewed.no",
- SciPublicationsConstants.BUNDLE
- ).localize();
- }
- }
-
-}
diff --git a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ArticleInJournalPropertyForm.java b/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ArticleInJournalPropertyForm.java
deleted file mode 100644
index 9991ef0..0000000
--- a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ArticleInJournalPropertyForm.java
+++ /dev/null
@@ -1,273 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.FormData;
-import com.arsdigita.bebop.FormProcessException;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.event.FormInitListener;
-import com.arsdigita.bebop.event.FormProcessListener;
-import com.arsdigita.bebop.event.FormSectionEvent;
-import com.arsdigita.bebop.event.FormSubmissionListener;
-import com.arsdigita.bebop.form.CheckboxGroup;
-import com.arsdigita.bebop.form.Option;
-import com.arsdigita.bebop.form.TextField;
-import com.arsdigita.bebop.parameters.DateParameter;
-import com.arsdigita.bebop.parameters.IntegerParameter;
-import com.arsdigita.bebop.parameters.ParameterModel;
-import com.arsdigita.bebop.parameters.StringParameter;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.ui.authoring.SelectedLanguageUtil;
-import com.arsdigita.globalization.GlobalizedMessage;
-
-import org.libreccm.cdi.utils.CdiUtil;
-import org.scientificcms.publications.ArticleInJournal;
-import org.scientificcms.publications.SciPublicationsConstants;
-import org.scientificcms.publications.contenttypes.ArticleInJournalItem;
-
-import java.util.Calendar;
-import java.util.GregorianCalendar;
-import java.util.HashMap;
-import java.util.Locale;
-import java.util.Map;
-
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class ArticleInJournalPropertyForm
- extends PublicationPropertyForm
- implements FormInitListener,
- FormProcessListener,
- FormSubmissionListener {
-
- public static final String ID = "ArticleInJournalEdit";
-
- private static final String REVIEWED = "reviewed";
-
- private final ArticleInJournalPropertiesStep propertiesStep;
-
- private final StringParameter selectedLanguageParam;
-
- private CheckboxGroup reviewed;
-
- public ArticleInJournalPropertyForm(
- final ItemSelectionModel itemModel,
- final StringParameter selectedLanguageParam
- ) {
- this(itemModel, null, selectedLanguageParam);
- }
-
- public ArticleInJournalPropertyForm(
- final ItemSelectionModel itemModel,
- final ArticleInJournalPropertiesStep propertiesStep,
- final StringParameter selectedLanguageParam
- ) {
-
- super(itemModel, propertiesStep, selectedLanguageParam);
- this.propertiesStep = propertiesStep;
- this.selectedLanguageParam = selectedLanguageParam;
- addSubmissionListener(this);
- }
-
- @Override
- protected void addWidgets() {
-
- super.addWidgets();
-
- final ParameterModel volumeParam = new IntegerParameter(
- ArticleInJournalController.VOLUME
- );
- final TextField volume = new TextField(volumeParam);
- volume.setLabel(
- new GlobalizedMessage(
- "publications.ui.articleinjournal.volume",
- SciPublicationsConstants.BUNDLE
- )
- );
- add(volume);
-
- final ParameterModel issueParam = new StringParameter(
- ArticleInJournalController.ISSUE
- );
- final TextField issue = new TextField(issueParam);
- issue.setLabel(
- new GlobalizedMessage(
- "publications.ui.articleinjournal.issue",
- SciPublicationsConstants.BUNDLE
- )
- );
- add(issue);
-
- final ParameterModel pagesFromParam = new IntegerParameter(
- ArticleInJournalController.START_PAGE
- );
- final TextField startPage = new TextField(pagesFromParam);
- startPage.setLabel(
- new GlobalizedMessage(
- "publications.ui.articleinjournal.pages_from",
- SciPublicationsConstants.BUNDLE
- )
- );
- add(startPage);
-
- final ParameterModel pagesToParam = new IntegerParameter(
- ArticleInJournalController.END_PAGE
- );
- final TextField endPage = new TextField(pagesToParam);
- endPage.setLabel(
- new GlobalizedMessage(
- "publications.ui.articleinjournal.pages_to",
- SciPublicationsConstants.BUNDLE
- )
- );
- add(endPage);
-
- final Calendar today = new GregorianCalendar();
- final ParameterModel pubDateParam = new DateParameter(
- ArticleInJournalController.PUBLICATION_DATE
- );
- final com.arsdigita.bebop.form.Date pubDate
- = new com.arsdigita.bebop.form.Date(
- pubDateParam
- );
- pubDate.setYearAsc(false);
- pubDate.setYearRange(1900, today.get(Calendar.YEAR) + 2);
- pubDate.setLabel(
- new GlobalizedMessage(
- "publications.ui.articleinjournal.publicationDate",
- SciPublicationsConstants.BUNDLE
- )
- );
- add(pubDate);
-
- reviewed = new CheckboxGroup("reviewedGroup");
- reviewed.addOption(new Option(
- REVIEWED,
- new Label(
- new GlobalizedMessage(
- "publications.ui.articleinjournal.reviewed",
- SciPublicationsConstants.BUNDLE)
- )
- )
- );
- reviewed.setLabel(
- new GlobalizedMessage(
- "publications.ui.articleinjournal.reviewed"
- )
- );
- add(reviewed);
- }
-
- protected final CheckboxGroup getReviewed() {
- return reviewed;
- }
-
- @Override
- public void init(final FormSectionEvent event) throws FormProcessException {
- super.init(event);
-
- final FormData data = event.getFormData();
- final ArticleInJournalItem articleItem
- = (ArticleInJournalItem) initBasicWidgets(
- event);
- final ArticleInJournal article = articleItem.getPublication();
-
- data.put(ArticleInJournalController.VOLUME, article.getVolume());
- data.put(ArticleInJournalController.ISSUE, article.getIssue());
- data.put(ArticleInJournalController.START_PAGE, article.getStartPage());
- data.put(ArticleInJournalController.END_PAGE, article.getEndPage());
- data.put(ArticleInJournalController.PUBLICATION_DATE,
- article.getPublicationDate());
-
- if ((article.getPeerReviewed() != null)
- && (article.getPeerReviewed())) {
- reviewed.setValue(event.getPageState(), new String[]{REVIEWED});
- } else {
- reviewed.setValue(event.getPageState(), null);
- }
- }
-
- @Override
- public void process(final FormSectionEvent event)
- throws FormProcessException {
-
- super.process(event);
-
- final FormData formData = event.getFormData();
- final PageState state = event.getPageState();
- final ArticleInJournalItem articleItem
- = (ArticleInJournalItem) processBasicWidgets(
- event
- );
-
- if ((articleItem != null)
- && getSaveCancelSection().getSaveButton().isSelected(event
- .getPageState()
- )) {
-
- final Map data = new HashMap<>();
-
- data.put(
- ArticleInJournalController.VOLUME,
- formData.get(ArticleInJournalController.VOLUME
- )
- );
-
- data.put(
- ArticleInJournalController.ISSUE,
- formData.get(ArticleInJournalController.ISSUE
- )
- );
-
- data.put(
- ArticleInJournalController.START_PAGE,
- formData.get(ArticleInJournalController.START_PAGE
- )
- );
-
- data.put(
- ArticleInJournalController.END_PAGE,
- formData.get(ArticleInJournalController.END_PAGE
- )
- );
-
- data.put(
- ArticleInJournalController.PUBLICATION_DATE,
- formData.get(ArticleInJournalController.PUBLICATION_DATE
- )
- );
-
- if (reviewed.getValue(event.getPageState()) == null) {
- data.put(
- ArticleInCollectedVolumeController.PEER_REVIEWED,
- Boolean.FALSE
- );
- } else {
- data.put(
- ArticleInCollectedVolumeController.PEER_REVIEWED,
- Boolean.TRUE
- );
- }
-
- final Locale selectedLocale = SelectedLanguageUtil.selectedLocale(
- state, selectedLanguageParam
- );
-
- final ArticleInJournalController controller = CdiUtil
- .createCdiUtil()
- .findBean(ArticleInJournalController.class);
- controller.saveArticle(
- articleItem.getPublication().getPublicationId(),
- selectedLocale,
- data
- );
- }
- }
-
-}
diff --git a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/CollectedVolumeArticlesAddForm.java b/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/CollectedVolumeArticlesAddForm.java
deleted file mode 100644
index b492a17..0000000
--- a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/CollectedVolumeArticlesAddForm.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.FormData;
-import com.arsdigita.bebop.FormProcessException;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.event.FormInitListener;
-import com.arsdigita.bebop.event.FormProcessListener;
-import com.arsdigita.bebop.event.FormSectionEvent;
-import com.arsdigita.bebop.parameters.StringParameter;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.ui.authoring.BasicItemForm;
-import com.arsdigita.globalization.GlobalizedMessage;
-
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-import org.libreccm.cdi.utils.CdiUtil;
-import org.scientificcms.publications.ArticleInCollectedVolume;
-import org.scientificcms.publications.SciPublicationsConstants;
-import org.scientificcms.publications.contenttypes.CollectedVolumeItem;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class CollectedVolumeArticlesAddForm
- extends BasicItemForm
- implements FormProcessListener,
- FormInitListener {
-
- private static final Logger LOGGER = LogManager.getLogger(
- CollectedVolumeArticlesAddForm.class
- );
-
- private final String ARTICLE_SEARCH = "articles";
-
- private final ItemSelectionModel itemModel;
-
- private PublicationSearchWidget articleSearch;
-
- public CollectedVolumeArticlesAddForm(
- final ItemSelectionModel itemModel,
- final StringParameter selectedLangParam
- ) {
- super("ArticlesAddForm", itemModel, selectedLangParam);
- this.itemModel = itemModel;
- }
-
- @Override
- protected void addWidgets() {
-
- articleSearch = new PublicationSearchWidget(
- ARTICLE_SEARCH, ArticleInCollectedVolume.class
- );
- articleSearch.setLabel(
- new GlobalizedMessage(
- "publications.ui.collected_volume.articles.select_article",
- SciPublicationsConstants.BUNDLE
- )
- );
- add(articleSearch);
- }
-
- @Override
- public void init(final FormSectionEvent event) throws FormProcessException {
- final PageState state = event.getPageState();
-
- setVisible(state, true);
- }
-
- @Override
- public void process(final FormSectionEvent event)
- throws FormProcessException {
- final FormData formData = event.getFormData();
- final PageState state = event.getPageState();
- final CollectedVolumeItem collectedVolumeItem
- = (CollectedVolumeItem) getItemSelectionModel()
- .getSelectedItem(state);
-
- if (this.getSaveCancelSection().getSaveButton().isSelected(state)) {
- final ArticleInCollectedVolume article
- = (ArticleInCollectedVolume) formData
- .get(ARTICLE_SEARCH);
-
- final CollectedVolumeController controller = CdiUtil
- .createCdiUtil()
- .findBean(CollectedVolumeController.class);
-
- controller.addArticle(
- collectedVolumeItem.getPublication().getPublicationId(),
- article.getPublicationId()
- );
- }
-
- init(event);
- }
-
-}
diff --git a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/CollectedVolumeArticlesStep.java b/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/CollectedVolumeArticlesStep.java
deleted file mode 100644
index f374816..0000000
--- a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/CollectedVolumeArticlesStep.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.parameters.StringParameter;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
-import com.arsdigita.cms.ui.authoring.BasicItemForm;
-import com.arsdigita.cms.ui.authoring.SimpleEditStep;
-import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
-import com.arsdigita.globalization.GlobalizedMessage;
-
-import org.scientificcms.publications.SciPublicationsConstants;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class CollectedVolumeArticlesStep extends SimpleEditStep {
-
- private static final String ADD_ARTICLE_SHEET_NAME = "addArticle";
-
- public CollectedVolumeArticlesStep(
- final ItemSelectionModel itemModel,
- final AuthoringKitWizard parent,
- final StringParameter selectedLangParam
- ) {
- this(itemModel, parent, selectedLangParam, null);
- }
-
- public CollectedVolumeArticlesStep(
- final ItemSelectionModel itemModel,
- final AuthoringKitWizard parent,
- final StringParameter selectedLangParam,
- final String prefix
- ) {
- super(itemModel, parent, selectedLangParam, prefix);
-
- final BasicItemForm addArticleSheet = new CollectedVolumeArticlesAddForm(
- itemModel, selectedLangParam
- );
- add(
- ADD_ARTICLE_SHEET_NAME,
- new GlobalizedMessage(
- "publications.ui.collected_volume.add_article",
- SciPublicationsConstants.BUNDLE
- ),
- new WorkflowLockedComponentAccess(addArticleSheet, itemModel),
- addArticleSheet.getSaveCancelSection().getCancelButton());
-
- final CollectedVolumeArticlesTable articlesTable
- = new CollectedVolumeArticlesTable(
- itemModel,
- selectedLangParam
- );
- setDisplayComponent(articlesTable);
- }
-
-}
diff --git a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/CollectedVolumeArticlesTable.java b/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/CollectedVolumeArticlesTable.java
deleted file mode 100644
index 9881d3b..0000000
--- a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/CollectedVolumeArticlesTable.java
+++ /dev/null
@@ -1,328 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.Component;
-import com.arsdigita.bebop.ControlLink;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.Table;
-import com.arsdigita.bebop.Text;
-import com.arsdigita.bebop.event.TableActionEvent;
-import com.arsdigita.bebop.event.TableActionListener;
-import com.arsdigita.bebop.parameters.StringParameter;
-import com.arsdigita.bebop.table.TableCellRenderer;
-import com.arsdigita.bebop.table.TableColumn;
-import com.arsdigita.bebop.table.TableColumnModel;
-import com.arsdigita.bebop.table.TableModel;
-import com.arsdigita.bebop.table.TableModelBuilder;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.globalization.GlobalizedMessage;
-import com.arsdigita.util.LockableImpl;
-
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-import org.libreccm.cdi.utils.CdiUtil;
-import org.libreccm.security.PermissionChecker;
-import org.librecms.contentsection.privileges.ItemPrivileges;
-import org.scientificcms.publications.ArticleInCollectedVolume;
-import org.scientificcms.publications.CollectedVolume;
-import org.scientificcms.publications.SciPublicationsConstants;
-import org.scientificcms.publications.contenttypes.CollectedVolumeItem;
-
-import java.util.Iterator;
-import java.util.List;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class CollectedVolumeArticlesTable
- extends Table
- implements TableActionListener {
-
- private static final Logger LOGGER = LogManager.getLogger(
- CollectedVolumeArticlesTable.class
- );
-
- private final String TABLE_COL_EDIT = "table_col_edit";
-
- private final String TABLE_COL_DEL = "table_col_del";
-
- private final ItemSelectionModel itemModel;
-
- public CollectedVolumeArticlesTable(
- final ItemSelectionModel itemModel,
- final StringParameter selectedLangParam
- ) {
- super();
- this.itemModel = itemModel;
-
- setEmptyView(
- new Label(
- new GlobalizedMessage(
- "publications.ui.collected_volume.no_articles",
- SciPublicationsConstants.BUNDLE
- )
- )
- );
-
- TableColumnModel colModel = getColumnModel();
- colModel.add(new TableColumn(
- 0,
- new Label(
- new GlobalizedMessage(
- "publications.ui.collected_volume.article",
- SciPublicationsConstants.BUNDLE
- )),
- TABLE_COL_EDIT));
- colModel.add(new TableColumn(
- 1,
- new Label(
- new GlobalizedMessage(
- "publications.ui.collected_volume.article.remove",
- SciPublicationsConstants.BUNDLE
- )
- ),
- TABLE_COL_DEL));
-
- setModelBuilder(
- new CollectedVolumeArticlesTableModelBuilder(itemModel));
-
- colModel.get(0).setCellRenderer(new EditCellRenderer());
- colModel.get(1).setCellRenderer(new DeleteCellRenderer());
-
- addTableActionListener(this);
- }
-
- @Override
- public void cellSelected(final TableActionEvent event) {
- final PageState state = event.getPageState();
-
- final CollectedVolumeController controller = CdiUtil
- .createCdiUtil()
- .findBean(CollectedVolumeController.class);
-
- final ArticleInCollectedVolume article = controller
- .findArticle((Long) event.getRowKey());
-
- final CollectedVolumeItem collectedVolumeItem
- = (CollectedVolumeItem) itemModel
- .getSelectedObject(state);
- final CollectedVolume collectedVolume = collectedVolumeItem
- .getPublication();
-
- final TableColumn column = getColumnModel().get(event.getColumn());
-
- if (column.getHeaderKey().toString().equals(TABLE_COL_EDIT)) {
- // Nothing
- } else if (column.getHeaderKey().toString().equals(TABLE_COL_DEL)) {
- controller.removeArticle(
- collectedVolume.getPublicationId(),
- article.getPublicationId()
- );
- }
-// else if (column.getHeaderKey().toString().equals(TABLE_COL_UP)) {
-// controller.swapWithPreviousArticle(
-// collectedVolume.getPublicationId(),
-// article.getPublicationId()
-// );
-// } else if (column.getHeaderKey().toString().equals(TABLE_COL_DOWN)) {
-// controller.swapWithNextArticle(
-// collectedVolume.getPublicationId(),
-// article.getPublicationId()
-// );
-// }
- }
-
- @Override
- public void headSelected(TableActionEvent event) {
- //Nothing to do.
- }
-
- private class CollectedVolumeArticlesTableModelBuilder
- extends LockableImpl
- implements TableModelBuilder {
-
- private final ItemSelectionModel itemModel;
-
- public CollectedVolumeArticlesTableModelBuilder(
- final ItemSelectionModel itemModel
- ) {
- this.itemModel = itemModel;
- }
-
- @Override
- public TableModel makeModel(final Table table, final PageState state) {
- table.getRowSelectionModel().clearSelection(state);
- final CollectedVolumeItem collectedVolumeItem
- = (CollectedVolumeItem) itemModel
- .getSelectedItem(state);
- return new CollectedVolumeArticlesTableModel(
- table, state, collectedVolumeItem.getPublication()
- );
- }
-
- }
-
- private class CollectedVolumeArticlesTableModel implements TableModel {
-
- private final Table table;
-
- private final Iterator articles;
-
- private ArticleInCollectedVolume article;
-
- private CollectedVolumeArticlesTableModel(
- final Table table,
- final PageState state,
- final CollectedVolume collectedVolume
- ) {
- this.table = table;
- articles = collectedVolume.getArticles().iterator();
- }
-
- @Override
- public int getColumnCount() {
- return table.getColumnModel().size();
- }
-
- @Override
- public boolean nextRow() {
- if (articles != null && articles.hasNext()) {
- article = articles.next();
- return true;
- } else {
- return false;
- }
- }
-
- @Override
- public Object getElementAt(final int columnIndex) {
- switch (columnIndex) {
- case 0:
- return article.getTitle();
- case 1:
- return new Label(
- new GlobalizedMessage(
- "publications.ui.collected_volume.article.remove",
- SciPublicationsConstants.BUNDLE
- )
- );
- default:
- return null;
- }
- }
-
- @Override
- public Object getKeyAt(final int columnIndex) {
- return article.getPublicationId();
- }
-
- }
-
- private class EditCellRenderer
- extends LockableImpl
- implements TableCellRenderer {
-
- @Override
- public Component getComponent(
- final Table table,
- final PageState state,
- final Object value,
- final boolean isSelected,
- final Object key,
- final int row,
- final int col
- ) {
-// SecurityManager securityManager = Utilities
-// .getSecurityManager(state);
-// CollectedVolume collectedVolume = (CollectedVolume) m_itemModel.
-// getSelectedObject(state);
-//
-// boolean canEdit = securityManager.canAccess(
-// state.getRequest(),
-// SecurityManager.EDIT_ITEM,
-// collectedVolume);
-//
-// if (canEdit) {
-// ArticleInCollectedVolume article;
-// try {
-// article = new ArticleInCollectedVolume((BigDecimal) key);
-// } catch (ObjectNotFoundException ex) {
-// s_log.warn(String.format("No object with key '%s' found.",
-// key),
-// ex);
-// return new Label(value.toString());
-// }
-//
-// ContentSection section = article.getContentSection();//CMS.getContext().getContentSection();
-// ItemResolver resolver = section.getItemResolver();
-// Link link = new Link(value.toString(),
-// resolver.generateItemURL(state,
-// article,
-// section,
-// article
-// .getVersion()));
-//
-// return link;
-// } else {
-// ArticleInCollectedVolume article;
-// try {
-// article = new ArticleInCollectedVolume((BigDecimal) key);
-// } catch (ObjectNotFoundException ex) {
-// s_log.warn(String.format("No object with key '%s' found.",
-// key),
-// ex);
-// return new Label(value.toString());
-// }
-//
-// Label label = new Label(value.toString());
-// return label;
-// }
- return new Text((String) value);
- }
-
- }
-
- private class DeleteCellRenderer
- extends LockableImpl
- implements TableCellRenderer {
-
- @Override
- public Component getComponent(
- final Table table,
- final PageState state,
- final Object value,
- final boolean isSelected,
- final Object key,
- final int row,
- final int col
- ) {
- final PermissionChecker permissionChecker = CdiUtil
- .createCdiUtil()
- .findBean(PermissionChecker.class);
-
- final CollectedVolumeItem collectedVolumeItem
- = (CollectedVolumeItem) itemModel
- .getSelectedObject(state);
-
- boolean canEdit = permissionChecker
- .isPermitted(ItemPrivileges.DELETE, collectedVolumeItem);
-
- if (canEdit) {
- ControlLink link = new ControlLink((Label) value);
- link.setConfirmation(new GlobalizedMessage(
- "publications.ui.collected_volume.articles.confirm_remove"));
- return link;
- } else {
- return new Text("");
- }
- }
-
- }
-
-}
diff --git a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/CollectedVolumeController.java b/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/CollectedVolumeController.java
deleted file mode 100644
index f883ce9..0000000
--- a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/CollectedVolumeController.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import org.scientificcms.publications.ArticleInCollectedVolume;
-import org.scientificcms.publications.CollectedVolume;
-import org.scientificcms.publications.CollectedVolumeManager;
-import org.scientificcms.publications.PublicationRepository;
-
-import java.util.Locale;
-import java.util.Map;
-
-import javax.enterprise.context.RequestScoped;
-import javax.inject.Inject;
-import javax.transaction.Transactional;
-
-/**
- *
- * @author Jens Pelzetter
- */
-@RequestScoped
-public class CollectedVolumeController {
-
- public static final String PEER_REVIEWED = "peerReviewed";
-
- @Inject
- private CollectedVolumeManager collectedVolumeManager;
-
- @Inject
- private PublicationRepository publicationRepository;
-
- @Transactional(Transactional.TxType.REQUIRED)
- public void save(
- final long collectedVolumeId,
- final Locale selectedLocale,
- final Map data
- ) {
- final CollectedVolume collectedVolume = publicationRepository
- .findByIdAndType(collectedVolumeId, CollectedVolume.class)
- .orElseThrow(
- () -> new IllegalArgumentException(
- String.format(
- "No CollectedVolume with ID %d found.",
- collectedVolumeId
- )
- )
- );
-
- if (data.get(PEER_REVIEWED) != null) {
- final Boolean reviewed = (Boolean) data.get(PEER_REVIEWED);
- collectedVolume.setPeerReviewed(reviewed);
- }
-
- publicationRepository.save(collectedVolume);
- }
-
- public ArticleInCollectedVolume findArticle(final long articleId) {
- return publicationRepository
- .findByIdAndType(articleId, ArticleInCollectedVolume.class)
- .orElseThrow(
- () -> new IllegalArgumentException(
- String.format(
- "No ArticleInCollectedVolume with ID %d found.",
- articleId
- )
- )
- );
- }
-
- public void addArticle(
- final long collectedVolumeId, final long articleId
- ) {
- final CollectedVolume collectedVolume = publicationRepository
- .findByIdAndType(collectedVolumeId, CollectedVolume.class)
- .orElseThrow(
- () -> new IllegalArgumentException(
- String.format(
- "No CollectedVolume with ID %d found",
- collectedVolumeId
- )
- )
- );
-
- final ArticleInCollectedVolume article = publicationRepository
- .findByIdAndType(articleId, ArticleInCollectedVolume.class)
- .orElseThrow(
- () -> new IllegalArgumentException(
- String.format(
- "No ArticleInCollectedVolume with ID %d found.",
- articleId
- )
- )
- );
-
- collectedVolumeManager.addArticleToCollectedVolume(
- article, collectedVolume
- );
- }
-
- public void removeArticle(
- final long collectedVolumeId, final long articleId
- ) {
- final CollectedVolume collectedVolume = publicationRepository
- .findByIdAndType(collectedVolumeId, CollectedVolume.class)
- .orElseThrow(
- () -> new IllegalArgumentException(
- String.format(
- "No CollectedVolume with ID %d found",
- collectedVolumeId
- )
- )
- );
-
- final ArticleInCollectedVolume article = publicationRepository
- .findByIdAndType(articleId, ArticleInCollectedVolume.class)
- .orElseThrow(
- () -> new IllegalArgumentException(
- String.format(
- "No ArticleInCollectedVolume with ID %d found.",
- articleId
- )
- )
- );
-
- collectedVolumeManager.removeArticleFromCollectedVolume(
- article, collectedVolume
- );
- }
-
-}
diff --git a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/CollectedVolumeCreateForm.java b/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/CollectedVolumeCreateForm.java
deleted file mode 100644
index 1b0d10b..0000000
--- a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/CollectedVolumeCreateForm.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.parameters.StringParameter;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.ui.authoring.CreationSelector;
-
-import org.scientificcms.publications.CollectedVolume;
-import org.scientificcms.publications.Publication;
-import org.scientificcms.publications.contenttypes.CollectedVolumeItem;
-import org.scientificcms.publications.contenttypes.PublicationItem;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class CollectedVolumeCreateForm
- extends AbstractPublicationCreateForm {
-
- public CollectedVolumeCreateForm(
- final ItemSelectionModel itemModel,
- final CreationSelector creationSelector,
- final StringParameter selectedLanguageParam
- ) {
- super(itemModel, creationSelector, selectedLanguageParam);
- }
-
- @Override
- protected CollectedVolume createPublication() {
- return new CollectedVolume();
- }
-
-}
diff --git a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/CollectedVolumePropertiesStep.java b/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/CollectedVolumePropertiesStep.java
deleted file mode 100644
index 5ad7904..0000000
--- a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/CollectedVolumePropertiesStep.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.Component;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.parameters.StringParameter;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
-import com.arsdigita.cms.ui.authoring.BasicPageForm;
-import com.arsdigita.cms.ui.authoring.SimpleEditStep;
-import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
-import com.arsdigita.domain.DomainService;
-import com.arsdigita.globalization.GlobalizedMessage;
-import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
-
-import org.scientificcms.publications.SciPublicationsConstants;
-
-import static com.arsdigita.cms.contenttypes.ui.PublicationPropertiesStep.*;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class CollectedVolumePropertiesStep
- extends PublicationWithPublisherPropertiesStep {
-
- private final StringParameter selectedLangParam;
-
- public CollectedVolumePropertiesStep(
- final ItemSelectionModel itemModel,
- final AuthoringKitWizard parent,
- final StringParameter selectedLangParam
- ) {
- super(itemModel, parent, selectedLangParam);
- this.selectedLangParam = selectedLangParam;
- }
-
- public static Component getCollectedVolumePropertySheet(
- final ItemSelectionModel itemModel,
- final StringParameter selectedLangParam
- ) {
- final DomainObjectPropertySheet sheet
- = (DomainObjectPropertySheet) PublicationWithPublisherPropertiesStep
- .getPublicationWithPublisherPropertySheet(
- itemModel, selectedLangParam
- );
-
- sheet.add(new GlobalizedMessage(
- "publications.ui.collectedVolume.reviewed",
- SciPublicationsConstants.BUNDLE
- ),
- CollectedVolumeController.PEER_REVIEWED,
- new ReviewedFormatter());
-
- return sheet;
- }
-
- @Override
- protected void addBasicProperties(
- ItemSelectionModel itemModel,
- AuthoringKitWizard parent) {
- SimpleEditStep basicProperties = new SimpleEditStep(
- itemModel, parent, selectedLangParam, EDIT_SHEET_NAME);
-
- final BasicPageForm editBasicSheet
- = new CollectedVolumePropertyForm(
- itemModel,
- this,
- selectedLangParam
- );
-
- basicProperties.add(
- EDIT_SHEET_NAME,
- new GlobalizedMessage(
- "publications.ui.collected_volume.edit_basic_sheet",
- SciPublicationsConstants.BUNDLE
- ),
- new WorkflowLockedComponentAccess(editBasicSheet, itemModel),
- editBasicSheet.getSaveCancelSection().getCancelButton());
-
- basicProperties.setDisplayComponent(
- getCollectedVolumePropertySheet(itemModel, selectedLangParam));
-
- getSegmentedPanel().addSegment(
- new Label(
- new GlobalizedMessage(
- "publications.ui.publication.basic_properties",
- SciPublicationsConstants.BUNDLE
- )
- ),
- basicProperties);
- }
-
- @Override
- protected void addSteps(
- final ItemSelectionModel itemModel, final AuthoringKitWizard parent
- ) {
- super.addSteps(itemModel, parent);
-
- addStep(
- new CollectedVolumeArticlesStep(
- itemModel, parent, selectedLangParam
- ),
- new GlobalizedMessage(
- "publications.ui.collected_volume_articles",
- SciPublicationsConstants.BUNDLE
- ));
- }
-
- private static class ReviewedFormatter
- extends DomainService
- implements DomainObjectPropertySheet.AttributeFormatter {
-
- public ReviewedFormatter() {
- super();
- }
-
- @Override
- public String format(
- final Object obj, final String attribute, final PageState state
- ) {
- if ((get(obj, attribute) != null)
- && (get(obj, attribute) instanceof Boolean)
- && ((Boolean) get(obj, attribute) == true)) {
- return (String) new GlobalizedMessage(
- "publications.ui.collectedVolume.reviewed.yes",
- SciPublicationsConstants.BUNDLE
- ).localize();
- } else {
- return (String) new GlobalizedMessage(
- "publications.ui.collectedVolume.reviewed.no",
- SciPublicationsConstants.BUNDLE
- ).localize();
- }
- }
-
- }
-
-}
diff --git a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/CollectedVolumePropertyForm.java b/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/CollectedVolumePropertyForm.java
deleted file mode 100644
index 9ae4029..0000000
--- a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/CollectedVolumePropertyForm.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.FormData;
-import com.arsdigita.bebop.FormProcessException;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.event.FormInitListener;
-import com.arsdigita.bebop.event.FormProcessListener;
-import com.arsdigita.bebop.event.FormSectionEvent;
-import com.arsdigita.bebop.event.FormSubmissionListener;
-import com.arsdigita.bebop.form.CheckboxGroup;
-import com.arsdigita.bebop.form.Option;
-import com.arsdigita.bebop.parameters.StringParameter;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.ui.authoring.SelectedLanguageUtil;
-import com.arsdigita.globalization.GlobalizedMessage;
-
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-import org.libreccm.cdi.utils.CdiUtil;
-import org.scientificcms.publications.CollectedVolume;
-import org.scientificcms.publications.SciPublicationsConstants;
-import org.scientificcms.publications.contenttypes.CollectedVolumeItem;
-
-import java.util.HashMap;
-import java.util.Locale;
-import java.util.Map;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class CollectedVolumePropertyForm
- extends PublicationWithPublisherPropertyForm
- implements FormProcessListener,
- FormInitListener,
- FormSubmissionListener {
-
- private static final Logger LOGGER = LogManager.getLogger(
- CollectedVolumePropertyForm.class
- );
-
- private static final String ID = "CollectedVolumeEdit";
-
- private final StringParameter selectedLangParam;
-
- private final CollectedVolumePropertiesStep step;
-
- private CheckboxGroup reviewed;
-
- public CollectedVolumePropertyForm(
- final ItemSelectionModel itemModel,
- final StringParameter selectedLangParam
- ) {
- this(itemModel, null, selectedLangParam);
- }
-
- public CollectedVolumePropertyForm(
- final ItemSelectionModel itemModel,
- CollectedVolumePropertiesStep step,
- final StringParameter selectedLangParam
- ) {
- super(itemModel, step, selectedLangParam);
- this.step = step;
- this.selectedLangParam = selectedLangParam;
- addSubmissionListener(this);
- }
-
- @Override
- protected void addWidgets() {
-
- super.addWidgets();
-
- reviewed = new CheckboxGroup("reviewedGroup");
- reviewed.addOption(
- new Option(
- CollectedVolumeController.PEER_REVIEWED,
- new Label(
- new GlobalizedMessage(
- "publications.ui.collectedVolume.reviewed",
- SciPublicationsConstants.BUNDLE
- )
- )
- )
- );
- reviewed.setLabel(
- new GlobalizedMessage(
- "publications.ui.collectedVolume.reviewed",
- SciPublicationsConstants.BUNDLE
- )
- );
- add(reviewed);
- }
-
- @Override
- public void init(final FormSectionEvent event) throws FormProcessException {
- super.init(event);
-
- final FormData data = event.getFormData();
- final CollectedVolumeItem collectedVolumeItem
- = (CollectedVolumeItem) super
- .initBasicWidgets(event);
-
- final CollectedVolume collectedVolume = collectedVolumeItem
- .getPublication();
-
- if ((collectedVolume.getPeerReviewed() != null)
- && (collectedVolume.getPeerReviewed())) {
- reviewed.setValue(
- event.getPageState(),
- new String[]{CollectedVolumeController.PEER_REVIEWED}
- );
- } else {
- reviewed.setValue(event.getPageState(), null);
- }
- }
-
- @Override
- public void process(final FormSectionEvent event) throws
- FormProcessException {
- super.process(event);
-
- final PageState state = event.getPageState();
- final CollectedVolumeItem collectedVolumeItem
- = (CollectedVolumeItem) super
- .processBasicWidgets(event);
-
- if ((collectedVolumeItem != null)
- && getSaveCancelSection().getSaveButton().isSelected(state)) {
-
- final CollectedVolumeController controller = CdiUtil
- .createCdiUtil()
- .findBean(CollectedVolumeController.class);
- final Map data = new HashMap<>();
- if (reviewed.getValue(state.getPageState()) == null) {
- data.put(CollectedVolumeController.PEER_REVIEWED, false);
- } else {
- data.put(CollectedVolumeController.PEER_REVIEWED, true);
- }
-
- controller.save(
- collectedVolumeItem.getPublication().getPublicationId(),
- SelectedLanguageUtil.selectedLocale(
- state, selectedLangParam
- ),
- data);
- }
- }
-
-}
diff --git a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ExpertiseController.java b/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ExpertiseController.java
deleted file mode 100644
index fc8fe5f..0000000
--- a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ExpertiseController.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import org.librecms.assets.Organization;
-import org.librecms.contentsection.AssetRepository;
-import org.scientificcms.publications.Expertise;
-import org.scientificcms.publications.PublicationRepository;
-
-import java.util.Map;
-
-import javax.enterprise.context.RequestScoped;
-import javax.inject.Inject;
-import javax.transaction.Transactional;
-
-/**
- *
- * @author Jens Pelzetter
- */
-@RequestScoped
-public class ExpertiseController {
-
- public static final String PLACE = "place";
- public static final String NUMBER_OF_PAGES = "numberOfPages";
-
- @Inject
- private AssetRepository assetRepository;
-
- @Inject
- private PublicationRepository publicationRepository;
-
- @Transactional(Transactional.TxType.REQUIRED)
- public void save(final long expertiseId, final Map data) {
- final Expertise expertise = publicationRepository
- .findByIdAndType(expertiseId, Expertise.class)
- .orElseThrow(
- () -> new IllegalArgumentException(
- String.format("No Expertise with ID %d found.", expertiseId)
- )
- );
-
- if (data.containsKey(PLACE)) {
- expertise.setPlace((String) data.get(PLACE));
- }
-
- if (data.containsKey(NUMBER_OF_PAGES)) {
- expertise.setNumberOfPages((Integer) data.get(NUMBER_OF_PAGES));
- }
-
- publicationRepository.save(expertise);
- }
-
- @Transactional
- public void setOrderer(final long expertiseId, final long ordererId) {
- final Expertise expertise = publicationRepository
- .findByIdAndType(expertiseId, Expertise.class)
- .orElseThrow(
- () -> new IllegalArgumentException(
- String.format("No Expertise with ID %d found.", expertiseId)
- )
- );
-
- final Organization orderer = assetRepository
- .findById(ordererId, Organization.class)
- .orElseThrow(
- () -> new IllegalArgumentException(
- String.format(
- "No Organization with ID %d found.", ordererId
- )
- )
- );
-
- expertise.setOrderer(orderer);
- publicationRepository.save(expertise);
- }
-
- @Transactional
- public void unsetOrderer(final long expertiseId) {
- final Expertise expertise = publicationRepository
- .findByIdAndType(expertiseId, Expertise.class)
- .orElseThrow(
- () -> new IllegalArgumentException(
- String.format("No Expertise with ID %d found.", expertiseId)
- )
- );
-
- expertise.setOrderer(null);
- publicationRepository.save(expertise);
- }
-
- @Transactional
- public void setOrganization(
- final long expertiseId, final long organizationId
- ) {
- final Expertise expertise = publicationRepository
- .findByIdAndType(expertiseId, Expertise.class)
- .orElseThrow(
- () -> new IllegalArgumentException(
- String.format("No Expertise with ID %d found.", expertiseId)
- )
- );
-
- final Organization organization = assetRepository
- .findById(organizationId, Organization.class)
- .orElseThrow(
- () -> new IllegalArgumentException(
- String.format(
- "No Organization with ID %d found.", organizationId
- )
- )
- );
-
- expertise.setOrganization(organization);
- publicationRepository.save(expertise);
- }
-
- @Transactional
- public void unsetOrganization(final long expertiseId) {
- final Expertise expertise = publicationRepository
- .findByIdAndType(expertiseId, Expertise.class)
- .orElseThrow(
- () -> new IllegalArgumentException(
- String.format("No Expertise with ID %d found.", expertiseId)
- )
- );
- expertise.setOrganization(null);
- publicationRepository.save(expertise);
- }
-
-}
diff --git a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ExpertiseCreateForm.java b/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ExpertiseCreateForm.java
deleted file mode 100644
index edd039a..0000000
--- a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ExpertiseCreateForm.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.parameters.StringParameter;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.ui.authoring.CreationSelector;
-
-import org.scientificcms.publications.Expertise;
-import org.scientificcms.publications.contenttypes.ExpertiseItem;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class ExpertiseCreateForm
- extends AbstractPublicationCreateForm{
-
- public ExpertiseCreateForm(final ItemSelectionModel itemModel,
- final CreationSelector creationSelector,
- final StringParameter selectedLanguageParam) {
- super(itemModel, creationSelector, selectedLanguageParam);
- }
-
- @Override
- protected Expertise createPublication() {
- return new Expertise();
- }
-
-}
diff --git a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ExpertiseOrdererForm.java b/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ExpertiseOrdererForm.java
deleted file mode 100644
index c6119da..0000000
--- a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ExpertiseOrdererForm.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.FormData;
-import com.arsdigita.bebop.FormProcessException;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.event.FormInitListener;
-import com.arsdigita.bebop.event.FormProcessListener;
-import com.arsdigita.bebop.event.FormSectionEvent;
-import com.arsdigita.bebop.parameters.StringParameter;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.ui.assets.AssetSearchWidget;
-import com.arsdigita.cms.ui.authoring.BasicItemForm;
-import com.arsdigita.globalization.GlobalizedMessage;
-
-import org.hibernate.resource.beans.container.internal.CdiBasedBeanContainer;
-import org.libreccm.cdi.utils.CdiUtil;
-import org.librecms.assets.Organization;
-import org.scientificcms.publications.SciPublicationsConstants;
-import org.scientificcms.publications.contenttypes.ExpertiseItem;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class ExpertiseOrdererForm
- extends BasicItemForm
- implements FormProcessListener, FormInitListener {
-
- private static final String ORGA_SEARCH = "expertiseOrderer";
-
- private AssetSearchWidget orgaSearch;
-
- private final ItemSelectionModel itemModel;
-
- public ExpertiseOrdererForm(
- final ItemSelectionModel itemModel,
- final StringParameter selectedLangParam
- ) {
- super("ExpertiseOrdererForm", itemModel, selectedLangParam);
- this.itemModel = itemModel;
- }
-
- @Override
- protected void addWidgets() {
- orgaSearch = new AssetSearchWidget(
- ORGA_SEARCH, Organization.class
- );
- orgaSearch.setLabel(
- new GlobalizedMessage(
- "publications.ui.expertise.orderer",
- SciPublicationsConstants.BUNDLE
- )
- );
- add(orgaSearch);
- }
-
- @Override
- public void init(final FormSectionEvent event) throws FormProcessException {
- final PageState state = event.getPageState();
-
- setVisible(state, true);
- }
-
- @Override
- public void process(final FormSectionEvent event)
- throws FormProcessException {
- final PageState state = event.getPageState();
- final ExpertiseItem expertise = (ExpertiseItem) itemModel.
- getSelectedItem(state);
-
- if (getSaveCancelSection().getSaveButton().isSelected(state)) {
- final Organization orderer = (Organization) orgaSearch
- .getValue(state);
- final ExpertiseController controller = CdiUtil
- .createCdiUtil()
- .findBean(ExpertiseController.class);
- controller.setOrderer(
- expertise.getPublication().getPublicationId(),
- orderer.getObjectId()
- );
- }
-
- init(event);
- }
-
-}
diff --git a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ExpertiseOrdererSheet.java b/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ExpertiseOrdererSheet.java
deleted file mode 100644
index 6e73018..0000000
--- a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ExpertiseOrdererSheet.java
+++ /dev/null
@@ -1,266 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.Component;
-import com.arsdigita.bebop.ControlLink;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.Table;
-import com.arsdigita.bebop.Text;
-import com.arsdigita.bebop.event.TableActionEvent;
-import com.arsdigita.bebop.event.TableActionListener;
-import com.arsdigita.bebop.table.TableCellRenderer;
-import com.arsdigita.bebop.table.TableColumn;
-import com.arsdigita.bebop.table.TableColumnModel;
-import com.arsdigita.bebop.table.TableModel;
-import com.arsdigita.bebop.table.TableModelBuilder;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.globalization.GlobalizedMessage;
-import com.arsdigita.util.LockableImpl;
-
-import org.libreccm.cdi.utils.CdiUtil;
-import org.libreccm.security.PermissionChecker;
-import org.librecms.assets.Organization;
-import org.librecms.contentsection.privileges.ItemPrivileges;
-import org.scientificcms.publications.Expertise;
-import org.scientificcms.publications.SciPublicationsConstants;
-import org.scientificcms.publications.contenttypes.ExpertiseItem;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class ExpertiseOrdererSheet
- extends Table
- implements TableActionListener {
-
- private static final String TABLE_COL_EDIT = "table_col_edit";
-
- private static final String TABLE_COL_DEL = "table_col_del";
-
- private final ItemSelectionModel itemModel;
-
- public ExpertiseOrdererSheet(final ItemSelectionModel itemModel) {
- super();
-
- this.itemModel = itemModel;
-
- setEmptyView(
- new Label(
- new GlobalizedMessage(
- "publications.ui.expertise.orderer.none",
- SciPublicationsConstants.BUNDLE
- )
- )
- );
-
- final TableColumnModel columnModel = getColumnModel();
- columnModel.add(
- new TableColumn(
- 0,
- new Label(
- new GlobalizedMessage(
- "publications.ui.expertise.orderer",
- SciPublicationsConstants.BUNDLE
- )
- ),
- TABLE_COL_EDIT
- )
- );
- columnModel.add(
- new TableColumn(
- 1,
- new Label(
- new GlobalizedMessage(
- "publications.ui.expertise.orderer.remove",
- SciPublicationsConstants.BUNDLE
- )
- ),
- TABLE_COL_DEL
- )
- );
-
- setModelBuilder(new ExpertiseOrganizationSheetModelBuilder(itemModel));
- columnModel.get(0).setCellRenderer(new EditCellRenderer());
- columnModel.get(1).setCellRenderer(new DeleteCellRenderer());
-
- addTableActionListener(this);
- }
-
- @Override
- public void cellSelected(final TableActionEvent event) {
- final PageState state = event.getPageState();
-
- final ExpertiseItem expertiseItem = (ExpertiseItem) itemModel
- .getSelectedItem(state);
-
- final TableColumn column = getColumnModel().get(event.getColumn());
-
- if (column.getHeaderKey().toString().equals(TABLE_COL_EDIT)) {
- // Nothing
- } else if (column.getHeaderKey().toString().equals(TABLE_COL_DEL)) {
- final ExpertiseController controller = CdiUtil
- .createCdiUtil()
- .findBean(ExpertiseController.class);
- controller.unsetOrderer(
- expertiseItem.getPublication().getPublicationId()
- );
- }
- }
-
- @Override
- public void headSelected(final TableActionEvent event) {
- //Nothing to do
- }
-
- private class ExpertiseOrganizationSheetModelBuilder
- extends LockableImpl
- implements TableModelBuilder {
-
- private final ItemSelectionModel itemModel;
-
- public ExpertiseOrganizationSheetModelBuilder(
- final ItemSelectionModel itemModel
- ) {
- this.itemModel = itemModel;
- }
-
- @Override
- public final TableModel makeModel(
- final Table table, final PageState state
- ) {
- table.getRowSelectionModel().clearSelection(state);
- final ExpertiseItem expertiseItem = (ExpertiseItem) itemModel
- .getSelectedItem(state);
- return new ExpertiseOrganizationSheetModel(
- table, state, expertiseItem.getPublication()
- );
- }
-
- }
-
- private class ExpertiseOrganizationSheetModel implements TableModel {
-
- private final Table table;
- private final Organization orderer;
- private boolean done;
-
- public ExpertiseOrganizationSheetModel(
- final Table table,
- final PageState state,
- final Expertise expertise
- ) {
- this.table = table;
- orderer = expertise.getOrderer();
- done = orderer != null;
- }
-
- @Override
- public int getColumnCount() {
- return table.getColumnModel().size();
- }
-
- @Override
- public boolean nextRow() {
- boolean ret;
-
- if (done) {
- ret = true;
- done = false;
- } else {
- ret = false;
- }
-
- return ret;
- }
-
- @Override
- public Object getElementAt(final int columnIndex) {
- switch (columnIndex) {
- case 0:
- return orderer.getTitle();
- case 1:
- return new Label(
- new GlobalizedMessage(
- "publications.ui.expertise.orderer.remove",
- SciPublicationsConstants.BUNDLE
- )
- );
- default:
- return null;
- }
- }
-
- @Override
- public Object getKeyAt(final int columnIndex) {
- return orderer.getObjectId();
- }
-
- }
-
- private class EditCellRenderer
- extends LockableImpl
- implements TableCellRenderer {
-
- @Override
- public final Component getComponent(
- final Table table,
- final PageState state,
- final Object value,
- final boolean isSelected,
- final Object key,
- final int row,
- final int column
- ) {
- return new Text((String) value);
- }
-
- }
-
- private class DeleteCellRenderer
- extends LockableImpl
- implements TableCellRenderer {
-
- @Override
- public Component getComponent(
- final Table table,
- final PageState state,
- final Object value,
- final boolean isSelected,
- final Object key,
- final int row,
- final int col
- ) {
- final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
-
- final PermissionChecker permissionChecker = cdiUtil
- .findBean(PermissionChecker.class);
-
- final ExpertiseItem expertiseItem = (ExpertiseItem) itemModel
- .getSelectedItem(state);
-
- final boolean canEdit = permissionChecker.isPermitted(
- ItemPrivileges.DELETE, expertiseItem
- );
-
- if (canEdit) {
- final ControlLink link = new ControlLink((Component) value);
- link.setConfirmation(
- new GlobalizedMessage(
- "publication.ui.expertise.orderer.remove.confirm",
- SciPublicationsConstants.BUNDLE
- )
- );
- return link;
- } else {
- return new Text("");
- }
- }
-
- }
-
-}
diff --git a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ExpertiseOrdererStep.java b/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ExpertiseOrdererStep.java
deleted file mode 100644
index d33d506..0000000
--- a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ExpertiseOrdererStep.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.parameters.StringParameter;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
-import com.arsdigita.cms.ui.authoring.BasicItemForm;
-import com.arsdigita.cms.ui.authoring.SimpleEditStep;
-import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
-import com.arsdigita.globalization.GlobalizedMessage;
-
-import org.scientificcms.publications.SciPublicationsConstants;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class ExpertiseOrdererStep extends SimpleEditStep {
-
- private static final String SET_EXPERTISE_ORDERER_STEP
- = "setExpertiseOrdererStep";
-
- public ExpertiseOrdererStep(
- final ItemSelectionModel itemModel,
- final AuthoringKitWizard parent,
- final StringParameter selectedLangParam
- ) {
- this(itemModel, parent, selectedLangParam, null);
- }
-
- public ExpertiseOrdererStep(
- final ItemSelectionModel itemModel,
- final AuthoringKitWizard parent,
- final StringParameter selectedLangParam,
- final String prefix
- ) {
- super(itemModel, parent, selectedLangParam, prefix);
-
- final BasicItemForm setOrdererForm = new ExpertiseOrdererForm(
- itemModel,
- selectedLangParam
- );
- add(
- SET_EXPERTISE_ORDERER_STEP,
- new GlobalizedMessage(
- "publications.ui.expertise.setOrderer",
- SciPublicationsConstants.BUNDLE
- ),
- new WorkflowLockedComponentAccess(setOrdererForm, itemModel),
- setOrdererForm.getSaveCancelSection().getCancelButton()
- );
-
- final ExpertiseOrdererSheet sheet = new ExpertiseOrdererSheet(
- itemModel
- );
- setDisplayComponent(sheet);
- }
-
-}
diff --git a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ExpertiseOrganizationForm.java b/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ExpertiseOrganizationForm.java
deleted file mode 100644
index 4d12011..0000000
--- a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ExpertiseOrganizationForm.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.FormProcessException;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.event.FormInitListener;
-import com.arsdigita.bebop.event.FormProcessListener;
-import com.arsdigita.bebop.event.FormSectionEvent;
-import com.arsdigita.bebop.parameters.StringParameter;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.ui.assets.AssetSearchWidget;
-import com.arsdigita.cms.ui.authoring.BasicItemForm;
-import com.arsdigita.globalization.GlobalizedMessage;
-
-import org.libreccm.cdi.utils.CdiUtil;
-import org.librecms.assets.Organization;
-import org.scientificcms.publications.SciPublicationsConstants;
-import org.scientificcms.publications.contenttypes.ExpertiseItem;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class ExpertiseOrganizationForm
- extends BasicItemForm
- implements FormProcessListener, FormInitListener {
-
- private static final String ORGA_SEARCH = "expertiseOrganization";
-
- private AssetSearchWidget orgaSearch;
-
- private final ItemSelectionModel itemModel;
-
- public ExpertiseOrganizationForm(
- final ItemSelectionModel itemModel,
- final StringParameter selectedLangParam
- ) {
- super("ExpertiseOrganizationForm", itemModel, selectedLangParam);
- this.itemModel = itemModel;
- }
-
- @Override
- protected void addWidgets() {
- orgaSearch = new AssetSearchWidget(
- ORGA_SEARCH, Organization.class
- );
- orgaSearch.setLabel(
- new GlobalizedMessage(
- "publications.ui.expertise.orderer",
- SciPublicationsConstants.BUNDLE
- )
- );
- add(orgaSearch);
- }
-
- @Override
- public void init(final FormSectionEvent event) throws FormProcessException {
- final PageState state = event.getPageState();
-
- setVisible(state, true);
- }
-
- @Override
- public void process(final FormSectionEvent event)
- throws FormProcessException {
- final PageState state = event.getPageState();
- final ExpertiseItem expertise = (ExpertiseItem) itemModel.
- getSelectedItem(state);
-
- if (getSaveCancelSection().getSaveButton().isSelected(state)) {
- final Organization organization = (Organization) orgaSearch
- .getValue(state);
- final ExpertiseController controller = CdiUtil
- .createCdiUtil()
- .findBean(ExpertiseController.class);
- controller.setOrganization(
- expertise.getPublication().getPublicationId(),
- organization.getObjectId()
- );
- }
-
- init(event);
- }
-
-}
diff --git a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ExpertiseOrganizationSheet.java b/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ExpertiseOrganizationSheet.java
deleted file mode 100644
index fedacb1..0000000
--- a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ExpertiseOrganizationSheet.java
+++ /dev/null
@@ -1,268 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.Component;
-import com.arsdigita.bebop.ControlLink;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.Table;
-import com.arsdigita.bebop.Text;
-import com.arsdigita.bebop.event.TableActionEvent;
-import com.arsdigita.bebop.event.TableActionListener;
-import com.arsdigita.bebop.table.TableCellRenderer;
-import com.arsdigita.bebop.table.TableColumn;
-import com.arsdigita.bebop.table.TableColumnModel;
-import com.arsdigita.bebop.table.TableModel;
-import com.arsdigita.bebop.table.TableModelBuilder;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.globalization.GlobalizedMessage;
-import com.arsdigita.util.LockableImpl;
-
-import org.libreccm.cdi.utils.CdiUtil;
-import org.libreccm.security.PermissionChecker;
-import org.librecms.assets.Organization;
-import org.librecms.contentsection.privileges.ItemPrivileges;
-import org.scientificcms.publications.Expertise;
-import org.scientificcms.publications.SciPublicationsConstants;
-import org.scientificcms.publications.contenttypes.ExpertiseItem;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class ExpertiseOrganizationSheet
- extends Table
- implements TableActionListener {
-
- private static final String TABLE_COL_EDIT = "table_col_edit";
-
- private static final String TABLE_COL_DEL = "table_col_del";
-
- private final ItemSelectionModel itemModel;
-
- public ExpertiseOrganizationSheet(final ItemSelectionModel itemModel) {
- super();
-
- this.itemModel = itemModel;
-
- setEmptyView(
- new Label(
- new GlobalizedMessage(
- "publications.ui.expertise.organization.none",
- SciPublicationsConstants.BUNDLE
- )
- )
- );
-
- final TableColumnModel columnModel = getColumnModel();
- columnModel.add(
- new TableColumn(
- 0,
- new Label(
- new GlobalizedMessage(
- "publications.ui.expertise.organization",
- SciPublicationsConstants.BUNDLE
- )
- ),
- TABLE_COL_EDIT
- )
- );
- columnModel.add(
- new TableColumn(
- 1,
- new Label(
- new GlobalizedMessage(
- "publications.ui.expertise.organization.remove",
- SciPublicationsConstants.BUNDLE
- )
- ),
- TABLE_COL_DEL
- )
- );
-
- setModelBuilder(new ExpertiseOrganizationSheetModelBuilder(itemModel));
- columnModel.get(0).setCellRenderer(new EditCellRenderer());
- columnModel.get(1).setCellRenderer(new DeleteCellRenderer());
-
- addTableActionListener(this);
- }
-
- @Override
- public void cellSelected(final TableActionEvent event) {
- final PageState state = event.getPageState();
-
- final ExpertiseItem expertiseItem = (ExpertiseItem) itemModel
- .getSelectedItem(state);
-
- final TableColumn column = getColumnModel().get(event.getColumn());
-
- if (column.getHeaderKey().toString().equals(TABLE_COL_EDIT)) {
- // Nothing
- } else if (column.getHeaderKey().toString().equals(TABLE_COL_DEL)) {
- final ExpertiseController controller = CdiUtil
- .createCdiUtil()
- .findBean(ExpertiseController.class);
- controller.unsetOrganization(
- expertiseItem.getPublication().getPublicationId()
- );
- }
- }
-
- @Override
- public void headSelected(final TableActionEvent event) {
- //Nothing to do
- }
-
- private class ExpertiseOrganizationSheetModelBuilder
- extends LockableImpl
- implements TableModelBuilder {
-
- private final ItemSelectionModel itemModel;
-
- public ExpertiseOrganizationSheetModelBuilder(
- final ItemSelectionModel itemModel
- ) {
- this.itemModel = itemModel;
- }
-
- @Override
- public final TableModel makeModel(
- final Table table, final PageState state
- ) {
- table.getRowSelectionModel().clearSelection(state);
- final ExpertiseItem expertiseItem = (ExpertiseItem) itemModel
- .getSelectedItem(state);
- return new ExpertiseOrganizationSheetModel(
- table, state, expertiseItem.getPublication()
- );
- }
-
- }
-
- private class ExpertiseOrganizationSheetModel implements TableModel {
-
- private final Table table;
-
- private final Organization organization;
-
- private boolean done;
-
- public ExpertiseOrganizationSheetModel(
- final Table table,
- final PageState state,
- final Expertise expertise
- ) {
- this.table = table;
- organization = expertise.getOrganization();
- done = organization != null;
- }
-
- @Override
- public int getColumnCount() {
- return table.getColumnModel().size();
- }
-
- @Override
- public boolean nextRow() {
- boolean ret;
-
- if (done) {
- ret = true;
- done = false;
- } else {
- ret = false;
- }
-
- return ret;
- }
-
- @Override
- public Object getElementAt(final int columnIndex) {
- switch (columnIndex) {
- case 0:
- return organization.getTitle();
- case 1:
- return new Label(
- new GlobalizedMessage(
- "publications.ui.expertise.organization.remove",
- SciPublicationsConstants.BUNDLE
- )
- );
- default:
- return null;
- }
- }
-
- @Override
- public Object getKeyAt(final int columnIndex) {
- return organization.getObjectId();
- }
-
- }
-
- private class EditCellRenderer
- extends LockableImpl
- implements TableCellRenderer {
-
- @Override
- public final Component getComponent(
- final Table table,
- final PageState state,
- final Object value,
- final boolean isSelected,
- final Object key,
- final int row,
- final int column
- ) {
- return new Text((String) value);
- }
-
- }
-
- private class DeleteCellRenderer
- extends LockableImpl
- implements TableCellRenderer {
-
- @Override
- public Component getComponent(
- final Table table,
- final PageState state,
- final Object value,
- final boolean isSelected,
- final Object key,
- final int row,
- final int col
- ) {
- final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
-
- final PermissionChecker permissionChecker = cdiUtil
- .findBean(PermissionChecker.class);
-
- final ExpertiseItem expertiseItem = (ExpertiseItem) itemModel
- .getSelectedItem(state);
-
- final boolean canEdit = permissionChecker.isPermitted(
- ItemPrivileges.DELETE, expertiseItem
- );
-
- if (canEdit) {
- final ControlLink link = new ControlLink((Component) value);
- link.setConfirmation(
- new GlobalizedMessage(
- "publication.ui.expertise.organization.remove.confirm",
- SciPublicationsConstants.BUNDLE
- )
- );
- return link;
- } else {
- return new Text("");
- }
- }
-
- }
-
-}
diff --git a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ExpertiseOrganizationStep.java b/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ExpertiseOrganizationStep.java
deleted file mode 100644
index ce23177..0000000
--- a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ExpertiseOrganizationStep.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.parameters.StringParameter;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
-import com.arsdigita.cms.ui.authoring.BasicItemForm;
-import com.arsdigita.cms.ui.authoring.SimpleEditStep;
-import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
-import com.arsdigita.globalization.GlobalizedMessage;
-
-import org.scientificcms.publications.SciPublicationsConstants;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class ExpertiseOrganizationStep extends SimpleEditStep {
-
- private static final String SET_EXPERTISE_ORGANIZATION_STEP
- = "setExpertiseOrganizationStep";
-
- public ExpertiseOrganizationStep(
- final ItemSelectionModel itemModel,
- final AuthoringKitWizard parent,
- final StringParameter selectedLangParam
- ) {
- this(itemModel, parent, selectedLangParam, null);
- }
-
- public ExpertiseOrganizationStep(
- final ItemSelectionModel itemModel,
- final AuthoringKitWizard parent,
- final StringParameter selectedLangParam,
- final String prefix
- ) {
- super(itemModel, parent, selectedLangParam, prefix);
-
- final BasicItemForm setOrgaForm = new ExpertiseOrganizationForm(
- itemModel, selectedLangParam
- );
- add(
- SET_EXPERTISE_ORGANIZATION_STEP,
- new GlobalizedMessage(
- "publications.ui.expertise.setOrganization",
- SciPublicationsConstants.BUNDLE
- ),
- new WorkflowLockedComponentAccess(
- setOrgaForm, itemModel),
- setOrgaForm.getSaveCancelSection().getCancelButton()
- );
-
- final ExpertiseOrganizationSheet sheet = new ExpertiseOrganizationSheet(
- itemModel
- );
- setDisplayComponent(sheet);
- }
-
-}
diff --git a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ExpertisePropertiesStep.java b/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ExpertisePropertiesStep.java
deleted file mode 100644
index 4302825..0000000
--- a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ExpertisePropertiesStep.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.Component;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.parameters.StringParameter;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
-import com.arsdigita.cms.ui.authoring.BasicPageForm;
-import com.arsdigita.cms.ui.authoring.SimpleEditStep;
-import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
-import com.arsdigita.globalization.GlobalizedMessage;
-import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
-
-import org.scientificcms.publications.SciPublicationsConstants;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class ExpertisePropertiesStep extends PublicationPropertiesStep {
-
- private final StringParameter selectedLangParam;
-
- public ExpertisePropertiesStep(
- final ItemSelectionModel itemModel,
- final AuthoringKitWizard parent,
- final StringParameter selectedLangParam
- ) {
- super(itemModel, parent, selectedLangParam);
- this.selectedLangParam = selectedLangParam;
- }
-
- public static Component getExpertisePropertySheet(
- final ItemSelectionModel itemModel,
- final StringParameter selectedLangParam
- ) {
- final DomainObjectPropertySheet sheet
- = (DomainObjectPropertySheet) getPublicationPropertySheet(
- itemModel, selectedLangParam);
-
- sheet.add(
- new GlobalizedMessage(
- "publications.ui.expertise.place",
- SciPublicationsConstants.BUNDLE
- ),
- ExpertiseController.PLACE
- );
-
- sheet.add(
- new GlobalizedMessage(
- "publications.ui.expertise.number_of_pages",
- SciPublicationsConstants.BUNDLE
- ),
- ExpertiseController.NUMBER_OF_PAGES
- );
-
- return sheet;
- }
-
- @Override
- protected void addBasicProperties(
- final ItemSelectionModel itemModel,
- final AuthoringKitWizard parent
- ) {
- final SimpleEditStep basicProperties = new SimpleEditStep(
- itemModel,
- parent,
- selectedLangParam,
- EDIT_SHEET_NAME
- );
-
- final BasicPageForm editBasicSheet
- = new ExpertisePropertyForm(
- itemModel, this, selectedLangParam
- );
-
- basicProperties.add(
- EDIT_SHEET_NAME,
- new GlobalizedMessage(
- "publications.ui.expertise.edit_basic_sheet",
- SciPublicationsConstants.BUNDLE
- ),
- new WorkflowLockedComponentAccess(
- editBasicSheet,
- itemModel
- ),
- editBasicSheet.getSaveCancelSection().getCancelButton()
- );
-
- basicProperties.setDisplayComponent(
- getExpertisePropertySheet(itemModel, selectedLangParam)
- );
-
- getSegmentedPanel().addSegment(
- new Label(
- new GlobalizedMessage(
- "publications.ui.publication.basic_properties"
- )
- ),
- basicProperties
- );
- }
-
- @Override
- protected void addSteps(
- final ItemSelectionModel itemModel, final AuthoringKitWizard parent
- ) {
- super.addSteps(itemModel, parent);
-
- addStep(
- new ExpertiseOrganizationStep(itemModel, parent, selectedLangParam),
- new GlobalizedMessage(
- "publications.ui.expertise.setOrganization",
- SciPublicationsConstants.BUNDLE
- )
- );
- addStep(
- new ExpertiseOrdererStep(itemModel, parent, selectedLangParam),
- new GlobalizedMessage(
- "publications.ui.expertise.setOrderer",
- SciPublicationsConstants.BUNDLE
- )
- );
- }
-
-}
diff --git a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ExpertisePropertyForm.java b/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ExpertisePropertyForm.java
deleted file mode 100644
index 96bb25e..0000000
--- a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ExpertisePropertyForm.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.FormData;
-import com.arsdigita.bebop.FormProcessException;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.event.FormInitListener;
-import com.arsdigita.bebop.event.FormProcessListener;
-import com.arsdigita.bebop.event.FormSectionEvent;
-import com.arsdigita.bebop.event.FormSubmissionListener;
-import com.arsdigita.bebop.form.TextField;
-import com.arsdigita.bebop.parameters.IntegerParameter;
-import com.arsdigita.bebop.parameters.ParameterModel;
-import com.arsdigita.bebop.parameters.StringParameter;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.globalization.GlobalizedMessage;
-
-import org.libreccm.cdi.utils.CdiUtil;
-import org.scientificcms.publications.Expertise;
-import org.scientificcms.publications.SciPublicationsConstants;
-import org.scientificcms.publications.contenttypes.ExpertiseItem;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class ExpertisePropertyForm
- extends PublicationPropertyForm
- implements FormInitListener, FormProcessListener, FormSubmissionListener {
-
- public static final String ID = "ExpertiseEdit";
-
- private final ExpertisePropertiesStep step;
-
- public ExpertisePropertyForm(
- final ItemSelectionModel itemModel,
- final StringParameter selectedLangParam
- ) {
- this(itemModel, null, selectedLangParam);
- }
-
- public ExpertisePropertyForm(
- final ItemSelectionModel itemModel,
- final ExpertisePropertiesStep step,
- final StringParameter selectedLangParam
- ) {
- super(itemModel, step, selectedLangParam);
- this.step = step;
- addSubmissionListener(this);
- }
-
- @Override
- protected void addWidgets() {
-
- super.addWidgets();
-
- final ParameterModel placeParam = new StringParameter(
- ExpertiseController.PLACE
- );
- final TextField place = new TextField(placeParam);
- place.setLabel(
- new GlobalizedMessage(
- "publications.ui.expertise.place",
- SciPublicationsConstants.BUNDLE
- )
- );
- add(place);
-
- final ParameterModel numberOfPagesParam = new IntegerParameter(
- ExpertiseController.NUMBER_OF_PAGES
- );
- final TextField numberOfPages = new TextField(numberOfPagesParam);
- numberOfPages.setLabel(
- new GlobalizedMessage(
- "publications.ui.expertise.number_of_pages",
- SciPublicationsConstants.BUNDLE
- )
- );
- add(numberOfPages);
- }
-
- @Override
- public void init(final FormSectionEvent event) throws FormProcessException {
- super.init(event);
-
- final FormData data = event.getFormData();
- final ExpertiseItem expertiseItem = (ExpertiseItem) initBasicWidgets(
- event);
-
- final Expertise expertise = expertiseItem.getPublication();
-
- data.put(ExpertiseController.PLACE, expertise.getPlace());
- data.put(
- ExpertiseController.NUMBER_OF_PAGES,
- expertise.getNumberOfPages()
- );
- }
-
- @Override
- public void process(final FormSectionEvent event)
- throws FormProcessException {
- super.process(event);
-
- final FormData formData = event.getFormData();
- final PageState state = event.getPageState();
- final ExpertiseItem expertiseItem = (ExpertiseItem) processBasicWidgets(
- event
- );
-
- if ((expertiseItem != null)
- && getSaveCancelSection().getSaveButton().isSelected(state)) {
-
- final Map data = new HashMap<>();
- data.put(
- ExpertiseController.PLACE,
- formData.get(ExpertiseController.PLACE)
- );
- data.put(
- ExpertiseController.NUMBER_OF_PAGES,
- formData.get(ExpertiseController.NUMBER_OF_PAGES)
- );
-
- final ExpertiseController controller = CdiUtil
- .createCdiUtil()
- .findBean(ExpertiseController.class);
-
- controller.save(
- expertiseItem.getPublication().getPublicationId(),
- data
- );
- }
- }
-
-}
diff --git a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/GreyLiteratureController.java b/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/GreyLiteratureController.java
deleted file mode 100644
index f6b2f51..0000000
--- a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/GreyLiteratureController.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import org.scientificcms.publications.GreyLiterature;
-import org.scientificcms.publications.PublicationRepository;
-
-import java.util.Map;
-
-import javax.enterprise.context.RequestScoped;
-import javax.inject.Inject;
-import javax.transaction.Transactional;
-
-/**
- *
- * @author Jens Pelzetter
- */
-@RequestScoped
-public class GreyLiteratureController {
-
- public static final String START_PAGE = "startPage";
- public static final String END_PAGE = "endPage";
-
- @Inject
- private PublicationRepository publicationRepository;
-
- @Transactional(Transactional.TxType.REQUIRED)
- public void saveGreyLiterature(
- final long greyLiteratureId, final Map data
- ) {
- final GreyLiterature publication = publicationRepository
- .findByIdAndType(greyLiteratureId, GreyLiterature.class
- )
- .orElseThrow(
- () -> new IllegalArgumentException(
- String.format(
- "No GreyLiterature publication with ID %d found",
- greyLiteratureId
- )
- )
- );
-
- if (data.containsKey(START_PAGE)) {
- publication.setStartPage((Integer) data.get(START_PAGE));
- }
-
- if (data.containsKey(END_PAGE)) {
- publication.setEndPage((Integer) data.get(END_PAGE));
- }
-
- publicationRepository.save(publication);
- }
-
-}
diff --git a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/GreyLiteratureCreateForm.java b/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/GreyLiteratureCreateForm.java
deleted file mode 100644
index bb1a75c..0000000
--- a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/GreyLiteratureCreateForm.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.parameters.StringParameter;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.ui.authoring.CreationSelector;
-
-import org.scientificcms.publications.GreyLiterature;
-import org.scientificcms.publications.contenttypes.GreyLiteratureItem;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class GreyLiteratureCreateForm
- extends AbstractPublicationCreateForm {
-
- public GreyLiteratureCreateForm(
- final ItemSelectionModel itemModel,
- final CreationSelector creationSelector,
- final StringParameter selectedLanguageParam
- ) {
- super(itemModel, creationSelector, selectedLanguageParam);
- }
-
- @Override
- protected GreyLiterature createPublication() {
- return new GreyLiterature();
- }
-
-}
diff --git a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/GreyLiteraturePropertiesStep.java b/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/GreyLiteraturePropertiesStep.java
deleted file mode 100644
index 02960e6..0000000
--- a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/GreyLiteraturePropertiesStep.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.Component;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.parameters.StringParameter;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
-import com.arsdigita.cms.ui.authoring.BasicPageForm;
-import com.arsdigita.cms.ui.authoring.SimpleEditStep;
-import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
-import com.arsdigita.globalization.GlobalizedMessage;
-import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
-
-import org.scientificcms.publications.SciPublicationsConstants;
-
-import static com.arsdigita.cms.contenttypes.ui.PublicationPropertiesStep.*;
-import static com.arsdigita.cms.contenttypes.ui.UnPublishedPropertiesStep.*;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class GreyLiteraturePropertiesStep extends UnPublishedPropertiesStep {
-
- private final StringParameter selectedLangParam;
-
- public GreyLiteraturePropertiesStep(
- final ItemSelectionModel itemModel,
- final AuthoringKitWizard parent,
- final StringParameter selectedLangParam
- ) {
- super(itemModel, parent, selectedLangParam);
- this.selectedLangParam = selectedLangParam;
- }
-
- public static Component getGreyLiteraturePropertySheet(
- final ItemSelectionModel itemModel,
- final StringParameter selectedLangParam
- ) {
- final DomainObjectPropertySheet sheet
- = (DomainObjectPropertySheet) getUnPublishedPropertySheet(
- itemModel, selectedLangParam
- );
-
- sheet.add(
- new GlobalizedMessage(
- "publications.ui.greyliterature.pages_from",
- SciPublicationsConstants.BUNDLE
- ),
- GreyLiteratureController.START_PAGE
- );
-
- sheet.add(
- new GlobalizedMessage(
- "publications.ui.greyliterature.pages_to",
- SciPublicationsConstants.BUNDLE
- ),
- GreyLiteratureController.END_PAGE);
-
- return sheet;
- }
-
- @Override
- protected void addBasicProperties(
- final ItemSelectionModel itemModel,
- final AuthoringKitWizard parent
- ) {
- final SimpleEditStep basicProperties = new SimpleEditStep(
- itemModel,
- parent,
- selectedLangParam,
- EDIT_SHEET_NAME
- );
-
- final BasicPageForm editBasicSheet = new GreyLiteraturePropertyForm(
- itemModel,
- this,
- selectedLangParam
- );
-
- basicProperties.add(
- EDIT_SHEET_NAME,
- new GlobalizedMessage(
- "publications.ui.greyliterature.edit_basic_sheet",
- SciPublicationsConstants.BUNDLE
- ),
- new WorkflowLockedComponentAccess(
- editBasicSheet,
- itemModel
- ),
- editBasicSheet.getSaveCancelSection().getCancelButton());
-
- basicProperties.setDisplayComponent(
- getGreyLiteraturePropertySheet(itemModel, selectedLangParam));
-
- getSegmentedPanel().addSegment(
- new Label(
- new GlobalizedMessage(
- "publications.ui.publication.basic_properties",
- SciPublicationsConstants.BUNDLE
- )
- ),
- basicProperties);
- }
-
-}
diff --git a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/GreyLiteraturePropertyForm.java b/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/GreyLiteraturePropertyForm.java
deleted file mode 100644
index 1511b6c..0000000
--- a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/GreyLiteraturePropertyForm.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.FormData;
-import com.arsdigita.bebop.FormProcessException;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.event.FormInitListener;
-import com.arsdigita.bebop.event.FormProcessListener;
-import com.arsdigita.bebop.event.FormSectionEvent;
-import com.arsdigita.bebop.event.FormSubmissionListener;
-import com.arsdigita.bebop.form.TextField;
-import com.arsdigita.bebop.parameters.IntegerParameter;
-import com.arsdigita.bebop.parameters.ParameterModel;
-import com.arsdigita.bebop.parameters.StringParameter;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.globalization.GlobalizedMessage;
-
-import org.libreccm.cdi.utils.CdiUtil;
-import org.scientificcms.publications.GreyLiterature;
-import org.scientificcms.publications.SciPublicationsConstants;
-import org.scientificcms.publications.contenttypes.GreyLiteratureItem;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class GreyLiteraturePropertyForm extends UnPublishedPropertyForm
- implements FormInitListener,
- FormProcessListener, FormSubmissionListener {
-
- public static final String ID = "GreyLiteratureEdit";
-
- private GreyLiteraturePropertiesStep step;
-
- public GreyLiteraturePropertyForm(
- final ItemSelectionModel itemModel,
- final StringParameter selectedLangParam
- ) {
- this(itemModel, null, selectedLangParam);
- }
-
- public GreyLiteraturePropertyForm(
- final ItemSelectionModel itemModel,
- final GreyLiteraturePropertiesStep step,
- final StringParameter selectedLangParam
- ) {
- super(itemModel, step, selectedLangParam);
- this.step = step;
- addSubmissionListener(this);
- }
-
- @Override
- protected void addWidgets() {
-
- super.addWidgets();
-
- final ParameterModel fromParam = new IntegerParameter(
- GreyLiteratureController.START_PAGE
- );
- final TextField pagesFrom = new TextField(fromParam);
- pagesFrom.setLabel(
- new GlobalizedMessage(
- "publications.ui.greyliterature.pages_from",
- SciPublicationsConstants.BUNDLE
- )
- );
- add(pagesFrom);
-
- final ParameterModel toParam = new IntegerParameter(
- GreyLiteratureController.END_PAGE);
- final TextField pagesTo = new TextField(toParam);
- pagesTo.setLabel(
- new GlobalizedMessage(
- "publications.ui.greyliterature.pages_to",
- SciPublicationsConstants.BUNDLE
- )
- );
- add(pagesTo);
- }
-
- @Override
- public void init(final FormSectionEvent event) throws FormProcessException {
- super.init(event);
-
- final FormData data = event.getFormData();
- final GreyLiteratureItem greyItem
- = (GreyLiteratureItem) initBasicWidgets(
- event);
- final GreyLiterature grey = greyItem.getPublication();
-
- data.put(
- GreyLiteratureController.START_PAGE, grey.getStartPage()
- );
- data.put(
- GreyLiteratureController.END_PAGE, grey.getEndPage()
- );
- }
-
- @Override
- public void process(final FormSectionEvent event)
- throws FormProcessException {
- super.process(event);
-
- final FormData formData = event.getFormData();
- final PageState state = event.getPageState();
- final GreyLiteratureItem greyItem
- = (GreyLiteratureItem) processBasicWidgets(
- event);
-
- if ((greyItem != null)
- && getSaveCancelSection().getSaveButton().isSelected(state)) {
-
- final Map data = new HashMap<>();
- data.put(
- GreyLiteratureController.START_PAGE,
- formData.get(GreyLiteratureController.START_PAGE)
- );
- data.put(
- GreyLiteratureController.END_PAGE,
- formData.get(GreyLiteratureController.END_PAGE)
- );
-
- final GreyLiteratureController controller = CdiUtil
- .createCdiUtil()
- .findBean(GreyLiteratureController.class);
- controller.saveGreyLiterature(
- greyItem.getPublication().getPublicationId(),
- data
- );
- }
- }
-
-}
diff --git a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/InProceedingsController.java b/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/InProceedingsController.java
deleted file mode 100644
index dad38ca..0000000
--- a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/InProceedingsController.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import org.scientificcms.publications.InProceedings;
-import org.scientificcms.publications.Proceedings;
-import org.scientificcms.publications.ProceedingsManager;
-import org.scientificcms.publications.PublicationRepository;
-
-import java.util.Map;
-
-import javax.enterprise.context.RequestScoped;
-import javax.inject.Inject;
-import javax.transaction.Transactional;
-
-/**
- *
- * @author Jens Pelzetter
- */
-@RequestScoped
-public class InProceedingsController {
-
- public static final String START_PAGE = "startPage";
- public static final String END_PAGE = "endPage";
-
- @Inject
- private ProceedingsManager proceedingsManager;
-
- @Inject
- private PublicationRepository publicationRepository;
-
- @Transactional(Transactional.TxType.REQUIRED)
- public void saveInProceedings(
- final long inProceedingsId,
- final Map data
- ) {
- final InProceedings inProceedings = publicationRepository
- .findByIdAndType(inProceedingsId, InProceedings.class)
- .orElseThrow(
- () -> new IllegalArgumentException(
- String.format(
- "No InProceedings publication with ID %d found.",
- inProceedingsId
- )
- )
- );
-
- if (data.containsKey(START_PAGE)) {
- inProceedings.setStartPage((Integer) data.get(START_PAGE));
- }
-
- if (data.containsKey(END_PAGE)) {
- inProceedings.setEndPage((Integer) data.get(END_PAGE));
- }
-
- publicationRepository.save(inProceedings);
- }
-
- public void setProceedings(
- final long inProceedingsId, final long proceedingsId
- ) {
- final InProceedings inProceedings = publicationRepository
- .findByIdAndType(inProceedingsId, InProceedings.class)
- .orElseThrow(
- () -> new IllegalArgumentException(
- String.format(
- "No InProceedings publication with ID %d found.",
- inProceedingsId
- )
- )
- );
-
- final Proceedings proccedings = publicationRepository
- .findByIdAndType(proceedingsId, Proceedings.class)
- .orElseThrow(
- () -> new IllegalArgumentException(
- String.format(
- "No Proceedings with ID %d found", proceedingsId
- )
- )
- );
-
- proceedingsManager.addPaperToCollectedVolume(inProceedings, proccedings);
- }
-
- public void unsetProcceedings(
- final long inProceedingsId, final long proceedingsId
- ) {
- final InProceedings inProceedings = publicationRepository
- .findByIdAndType(inProceedingsId, InProceedings.class)
- .orElseThrow(
- () -> new IllegalArgumentException(
- String.format(
- "No InProceedings publication with ID %d found.",
- inProceedingsId
- )
- )
- );
-
- final Proceedings proccedings = publicationRepository
- .findByIdAndType(proceedingsId, Proceedings.class)
- .orElseThrow(
- () -> new IllegalArgumentException(
- String.format(
- "No Proceedings with ID %d found", proceedingsId
- )
- )
- );
-
- proceedingsManager.removeArticleFromCollectedVolume(
- inProceedings, proccedings);
- }
-
-}
diff --git a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/InProceedingsCreateForm.java b/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/InProceedingsCreateForm.java
deleted file mode 100644
index f879e1a..0000000
--- a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/InProceedingsCreateForm.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.parameters.StringParameter;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.ui.authoring.CreationSelector;
-
-import org.scientificcms.publications.InProceedings;
-import org.scientificcms.publications.contenttypes.InProceedingsItem;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class InProceedingsCreateForm
- extends AbstractPublicationCreateForm {
-
- public InProceedingsCreateForm(final ItemSelectionModel itemModel,
- final CreationSelector creationSelector,
- final StringParameter selectedLanguageParam) {
- super(itemModel, creationSelector, selectedLanguageParam);
- }
-
- @Override
- protected InProceedings createPublication() {
- return new InProceedings();
- }
-
-}
diff --git a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/InProceedingsProceedingsForm.java b/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/InProceedingsProceedingsForm.java
deleted file mode 100644
index 51897c1..0000000
--- a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/InProceedingsProceedingsForm.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.FormData;
-import com.arsdigita.bebop.FormProcessException;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.event.FormInitListener;
-import com.arsdigita.bebop.event.FormProcessListener;
-import com.arsdigita.bebop.event.FormSectionEvent;
-import com.arsdigita.bebop.parameters.StringParameter;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.ui.authoring.BasicItemForm;
-import com.arsdigita.globalization.GlobalizedMessage;
-
-import org.libreccm.cdi.utils.CdiUtil;
-import org.scientificcms.publications.Proceedings;
-import org.scientificcms.publications.SciPublicationsConstants;
-import org.scientificcms.publications.contenttypes.InProceedingsItem;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class InProceedingsProceedingsForm
- extends BasicItemForm
- implements FormProcessListener, FormInitListener {
-
- private static final String PROCEEDINGS_SEARCH = "proceedings";
-
- private PublicationSearchWidget proceedingsSearch;
-
- public InProceedingsProceedingsForm(
- final ItemSelectionModel itemModel,
- final StringParameter selectedLangParam
- ) {
- super("InProceedingsProceedings", itemModel, selectedLangParam);
- }
-
- @Override
- protected void addWidgets() {
- proceedingsSearch = new PublicationSearchWidget(
- PROCEEDINGS_SEARCH, Proceedings.class
- );
- proceedingsSearch.setLabel(
- new GlobalizedMessage(
- "publications.ui.inProceedings.selectProceedings",
- SciPublicationsConstants.BUNDLE
- )
- );
- add(proceedingsSearch);
- }
-
- @Override
- public void init(final FormSectionEvent event) throws FormProcessException {
- final PageState state = event.getPageState();
-
- setVisible(state, true);
- }
-
- @Override
- public void process(final FormSectionEvent event)
- throws FormProcessException {
- final FormData data = event.getFormData();
- final PageState state = event.getPageState();
-
- final InProceedingsItem inProceedingsItem
- = (InProceedingsItem) getItemSelectionModel()
- .getSelectedItem(state);
-
- if (this.getSaveCancelSection().getSaveButton().isSelected(state)) {
- final Proceedings proceedings = (Proceedings) data
- .get(PROCEEDINGS_SEARCH);
-
- final InProceedingsController controller = CdiUtil
- .createCdiUtil()
- .findBean(InProceedingsController.class);
-
- controller.setProceedings(
- inProceedingsItem.getPublication().getPublicationId(),
- proceedings.getPublicationId()
- );
- }
-
- init(event);
- }
-
-}
diff --git a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/InProceedingsProceedingsSheet.java b/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/InProceedingsProceedingsSheet.java
deleted file mode 100644
index 45fa24e..0000000
--- a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/InProceedingsProceedingsSheet.java
+++ /dev/null
@@ -1,274 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.Component;
-import com.arsdigita.bebop.ControlLink;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.Link;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.Table;
-import com.arsdigita.bebop.Text;
-import com.arsdigita.bebop.event.TableActionEvent;
-import com.arsdigita.bebop.event.TableActionListener;
-import com.arsdigita.bebop.table.TableCellRenderer;
-import com.arsdigita.bebop.table.TableColumn;
-import com.arsdigita.bebop.table.TableColumnModel;
-import com.arsdigita.bebop.table.TableModel;
-import com.arsdigita.bebop.table.TableModelBuilder;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.dispatcher.Utilities;
-import com.arsdigita.globalization.GlobalizedMessage;
-import com.arsdigita.util.LockableImpl;
-
-import org.hibernate.secure.spi.PermissionCheckEntityInformation;
-import org.libreccm.cdi.utils.CdiUtil;
-import org.libreccm.security.PermissionChecker;
-import org.librecms.contentsection.privileges.ItemPrivileges;
-import org.scientificcms.publications.InProceedings;
-import org.scientificcms.publications.Proceedings;
-import org.scientificcms.publications.SciPublicationsConstants;
-import org.scientificcms.publications.contenttypes.InProceedingsItem;
-
-import java.math.BigDecimal;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class InProceedingsProceedingsSheet
- extends Table
- implements TableActionListener {
-
- private static final String TABLE_COL_EDIT = "table_col_edit";
-
- private static final String TABLE_COL_DEL = "table_col_del";
-
- private final ItemSelectionModel itemModel;
-
- public InProceedingsProceedingsSheet(final ItemSelectionModel itemModel) {
- super();
- this.itemModel = itemModel;
-
- setEmptyView(
- new Label(
- new GlobalizedMessage(
- "publications.ui.inProceedings.proceedings.none",
- SciPublicationsConstants.BUNDLE
- )
- )
- );
-
- final TableColumnModel columnModel = getColumnModel();
- columnModel.add(
- new TableColumn(
- 0,
- new Label(
- new GlobalizedMessage(
- "publications.ui.inProceedings.proceedings",
- SciPublicationsConstants.BUNDLE
- )
- ),
- TABLE_COL_EDIT
- )
- );
- columnModel.add(
- new TableColumn(
- 1,
- new Label(
- new GlobalizedMessage(
- "publications.ui.inProceedings.proceedings.remove",
- SciPublicationsConstants.BUNDLE
- )
- ),
- TABLE_COL_DEL
- )
- );
-
- setModelBuilder(new InProceedingsProceedingsSheetModelBuilder(
- itemModel));
- columnModel.get(0).setCellRenderer(new EditCellRenderer());
- columnModel.get(1).setCellRenderer(new DeleteCellRenderer());
-
- addTableActionListener(this);
- }
-
- @Override
- public void cellSelected(final TableActionEvent event) {
- PageState state = event.getPageState();
-
- final InProceedingsItem inProceedingsItem
- = (InProceedingsItem) itemModel.
- getSelectedItem(state);
- final InProceedings inProceedings = inProceedingsItem.getPublication();
-
- final TableColumn column = getColumnModel().get(event.getColumn());
-
- if (column.getHeaderKey().toString().equals(TABLE_COL_EDIT)) {
- // Nothing
- } else if (column.getHeaderKey().toString().equals(TABLE_COL_DEL)) {
- final InProceedingsController controller = CdiUtil
- .createCdiUtil()
- .findBean(InProceedingsController.class);
- controller.unsetProcceedings(
- inProceedings.getPublicationId(),
- inProceedings.getProceedings().getPublicationId()
- );
- }
- }
-
- @Override
- public void headSelected(final TableActionEvent event) {
- //Nothing to do
- }
-
- private class InProceedingsProceedingsSheetModelBuilder
- extends LockableImpl
- implements TableModelBuilder {
-
- private ItemSelectionModel itemModel;
-
- public InProceedingsProceedingsSheetModelBuilder(
- ItemSelectionModel itemModel) {
- this.itemModel = itemModel;
- }
-
- @Override
- public TableModel makeModel(final Table table, final PageState state) {
- table.getRowSelectionModel().clearSelection(state);
- final InProceedingsItem inProceedingsItem
- = (InProceedingsItem) itemModel.
- getSelectedItem(state);
- return new InProceedingsProceedingsSheetModel(
- table,
- state,
- inProceedingsItem.getPublication()
- );
- }
-
- }
-
- private class InProceedingsProceedingsSheetModel implements TableModel {
-
- private final Table table;
- private final Proceedings proceedings;
- private boolean done;
-
- public InProceedingsProceedingsSheetModel(
- final Table table,
- final PageState state,
- final InProceedings inProceedings
- ) {
- this.table = table;
- this.proceedings = inProceedings.getProceedings();
- if (proceedings == null) {
- done = false;
- } else {
- done = true;
- }
- }
-
- @Override
- public int getColumnCount() {
- return table.getColumnModel().size();
- }
-
- @Override
- public boolean nextRow() {
- boolean ret;
-
- if (done) {
- ret = true;
- done = false;
- } else {
- ret = false;
- }
-
- return ret;
- }
-
- @Override
- public Object getElementAt(final int columnIndex) {
- switch (columnIndex) {
- case 0:
- return proceedings.getTitle();
- case 1:
- return new Label(new GlobalizedMessage(
- "publications.ui.inProceedings.proceedings.remove"));
- default:
- return null;
- }
- }
-
- @Override
- public Object getKeyAt(final int columnIndex) {
- return proceedings.getPublicationId();
- }
-
- }
-
- private class EditCellRenderer
- extends LockableImpl
- implements TableCellRenderer {
-
- @Override
- public Component getComponent(
- final Table table,
- final PageState state,
- final Object value,
- final boolean isSelected,
- final Object key,
- final int row,
- final int column
- ) {
- return new Text((String) value);
- }
-
- }
-
- private class DeleteCellRenderer
- extends LockableImpl
- implements TableCellRenderer {
-
- @Override
- public Component getComponent(
- final Table table,
- final PageState state,
- final Object value,
- final boolean isSelected,
- final Object key,
- final int row,
- final int column
- ) {
- final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
- final PermissionChecker permissionChecker = cdiUtil.findBean(
- PermissionChecker.class
- );
-
- final InProceedingsItem inProceedingsItem
- = (InProceedingsItem) itemModel.
- getSelectedItem(state);
-
- final boolean canEdit = permissionChecker
- .isPermitted(ItemPrivileges.EDIT, inProceedingsItem);
-
- if (canEdit) {
- ControlLink link = new ControlLink((Component) value);
- link.setConfirmation(
- new GlobalizedMessage(
- "publications.ui.inProceedings.proceedings.confirm_remove",
- SciPublicationsConstants.BUNDLE
- )
- );
- return link;
- } else {
- return new Text("");
- }
- }
-
- }
-
-}
diff --git a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/InProceedingsProceedingsStep.java b/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/InProceedingsProceedingsStep.java
deleted file mode 100644
index 0f6b055..0000000
--- a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/InProceedingsProceedingsStep.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.parameters.StringParameter;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
-import com.arsdigita.cms.ui.authoring.BasicItemForm;
-import com.arsdigita.cms.ui.authoring.SimpleEditStep;
-import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
-import com.arsdigita.globalization.GlobalizedMessage;
-
-import org.scientificcms.publications.SciPublicationsConstants;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class InProceedingsProceedingsStep extends SimpleEditStep {
-
- private static final String ADD_PROCEEDINGS_STEP = "addProceedings";
-
- public InProceedingsProceedingsStep(
- final ItemSelectionModel itemModel,
- final AuthoringKitWizard parent,
- final StringParameter selectedLangParam
- ) {
- this(itemModel, parent, selectedLangParam, null);
- }
-
- public InProceedingsProceedingsStep(
- final ItemSelectionModel itemModel,
- final AuthoringKitWizard parent,
- final StringParameter selectedLangParam,
- final String prefix) {
- super(itemModel, parent, selectedLangParam, prefix);
-
- final BasicItemForm addProceedingsForm
- = new InProceedingsProceedingsForm(
- itemModel, selectedLangParam
- );
- add(
- ADD_PROCEEDINGS_STEP,
- new GlobalizedMessage(
- "publications.ui.inProceedings.addProceedings",
- SciPublicationsConstants.BUNDLE
- ),
- new WorkflowLockedComponentAccess(
- addProceedingsForm,
- itemModel
- ),
- addProceedingsForm.getSaveCancelSection().getCancelButton());
-
- final InProceedingsProceedingsSheet sheet
- = new InProceedingsProceedingsSheet(
- itemModel
- );
- setDisplayComponent(sheet);
- }
-
-}
diff --git a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/InProceedingsPropertiesStep.java b/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/InProceedingsPropertiesStep.java
deleted file mode 100644
index 28193f4..0000000
--- a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/InProceedingsPropertiesStep.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.Component;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.parameters.StringParameter;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
-import com.arsdigita.cms.ui.authoring.BasicPageForm;
-import com.arsdigita.cms.ui.authoring.SimpleEditStep;
-import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
-import com.arsdigita.globalization.GlobalizedMessage;
-import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
-
-import org.scientificcms.publications.SciPublicationsConstants;
-
-import static com.arsdigita.cms.contenttypes.ui.PublicationPropertiesStep.*;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class InProceedingsPropertiesStep
- extends PublicationPropertiesStep {
-
- private final ItemSelectionModel itemModel;
- private final StringParameter selectedLangParam;
-
- public InProceedingsPropertiesStep(
- final ItemSelectionModel itemModel,
- final AuthoringKitWizard parent,
- final StringParameter selectedLangParam
- ) {
- super(itemModel, parent, selectedLangParam);
- this.selectedLangParam = selectedLangParam;
- this.itemModel = itemModel;
- }
-
- public static Component getInProceedingsPropertySheet(
- final ItemSelectionModel itemModel,
- final StringParameter selectedLangParam
- ) {
- final DomainObjectPropertySheet sheet
- = (DomainObjectPropertySheet) PublicationWithPublisherPropertiesStep
- .getPublicationPropertySheet(
- itemModel, selectedLangParam
- );
-
- sheet.add(
- new GlobalizedMessage(
- "publications.ui.inproceedings.pages_from",
- SciPublicationsConstants.BUNDLE
- ),
- InProceedingsController.START_PAGE
- );
-
- sheet.add(
- new GlobalizedMessage(
- "publications.ui.inproceedings.pages_to",
- SciPublicationsConstants.BUNDLE
- ),
- InProceedingsController.END_PAGE);
-
- return sheet;
- }
-
- @Override
- protected void addBasicProperties(
- final ItemSelectionModel itemModel,
- final AuthoringKitWizard parent
- ) {
- final SimpleEditStep basicProperties = new SimpleEditStep(
- itemModel,
- parent,
- selectedLangParam,
- EDIT_SHEET_NAME
- );
-
- final BasicPageForm editBasicSheet = new InProceedingsPropertyForm(
- itemModel, this, selectedLangParam
- );
-
- basicProperties.add(
- EDIT_SHEET_NAME,
- new GlobalizedMessage(
- "publications.ui.inproceedings.edit_basic_sheet",
- SciPublicationsConstants.BUNDLE
- ),
- new WorkflowLockedComponentAccess(
- editBasicSheet, itemModel
- ),
- editBasicSheet.getSaveCancelSection().getCancelButton());
-
- basicProperties.setDisplayComponent(
- getInProceedingsPropertySheet(itemModel, selectedLangParam)
- );
-
- getSegmentedPanel().addSegment(
- new Label(
- new GlobalizedMessage(
- "publications.ui.publications.basic_properties",
- SciPublicationsConstants.BUNDLE
- )
- ),
- basicProperties);
- }
-
- @Override
- public void addSteps(
- final ItemSelectionModel itemModel, final AuthoringKitWizard parent
- ) {
- super.addSteps(itemModel, parent);
-
- addStep(
- new InProceedingsProceedingsStep(
- itemModel, parent, selectedLangParam
- ),
- new GlobalizedMessage(
- "publications.ui.inProceedings.proceedings",
- SciPublicationsConstants.BUNDLE
- )
- );
- }
-
-}
diff --git a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/InProceedingsPropertyForm.java b/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/InProceedingsPropertyForm.java
deleted file mode 100644
index 607e9e6..0000000
--- a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/InProceedingsPropertyForm.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.FormData;
-import com.arsdigita.bebop.FormProcessException;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.event.FormInitListener;
-import com.arsdigita.bebop.event.FormProcessListener;
-import com.arsdigita.bebop.event.FormSectionEvent;
-import com.arsdigita.bebop.event.FormSubmissionListener;
-import com.arsdigita.bebop.form.TextField;
-import com.arsdigita.bebop.parameters.IntegerParameter;
-import com.arsdigita.bebop.parameters.ParameterModel;
-import com.arsdigita.bebop.parameters.StringParameter;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.globalization.GlobalizedMessage;
-
-import org.libreccm.cdi.utils.CdiUtil;
-import org.scientificcms.publications.InProceedings;
-import org.scientificcms.publications.SciPublicationsConstants;
-import org.scientificcms.publications.contenttypes.InProceedingsItem;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class InProceedingsPropertyForm extends PublicationPropertyForm
- implements FormProcessListener, FormInitListener, FormSubmissionListener {
-
- public static final String ID = "InProceedingsEdit";
-
- private InProceedingsPropertiesStep step;
-
- public InProceedingsPropertyForm(
- final ItemSelectionModel itemModel,
- final StringParameter selectedLangParam
- ) {
- this(itemModel, null, selectedLangParam);
- }
-
- public InProceedingsPropertyForm(
- final ItemSelectionModel itemModel,
- final InProceedingsPropertiesStep step,
- final StringParameter selectedLangParam
- ) {
- super(itemModel, step, selectedLangParam);
- this.step = step;
- addSubmissionListener(this);
- }
-
- @Override
- protected void addWidgets() {
-
- super.addWidgets();
-
- final ParameterModel pagesFromParam = new IntegerParameter(
- InProceedingsController.START_PAGE);
- final TextField pagesFrom = new TextField(pagesFromParam);
- pagesFrom.setLabel(
- new GlobalizedMessage(
- "publications.ui.inproceedings.pages_from",
- SciPublicationsConstants.BUNDLE
- )
- );
- add(pagesFrom);
-
- ParameterModel pagesToParam = new IntegerParameter(
- InProceedingsController.END_PAGE
- );
- final TextField pagesTo = new TextField(pagesToParam);
- pagesTo.setLabel(
- new GlobalizedMessage(
- "publications.ui.inproceedings.pages_to",
- SciPublicationsConstants.BUNDLE
- )
- );
- add(pagesTo);
- }
-
- @Override
- public void init(final FormSectionEvent event) throws FormProcessException {
- super.init(event);
-
- final FormData data = event.getFormData();
- final InProceedingsItem inProceedingsItem = (InProceedingsItem) super
- .initBasicWidgets(event);
- final InProceedings inProceedings = inProceedingsItem.getPublication();
-
- data.put(
- InProceedingsController.START_PAGE, inProceedings.getStartPage()
- );
- data.put(
- InProceedingsController.END_PAGE, inProceedings.getEndPage()
- );
- }
-
- @Override
- public void process(final FormSectionEvent event)
- throws FormProcessException {
- super.process(event);
-
- final FormData formData = event.getFormData();
- final PageState state = event.getPageState();
- final InProceedingsItem inProceedingsItem = (InProceedingsItem) super
- .processBasicWidgets(event);
-
- if ((inProceedingsItem != null)
- && getSaveCancelSection().getSaveButton().isSelected(state)) {
-
- final Map data = new HashMap<>();
- data.put(
- InProceedingsController.START_PAGE,
- formData.get(InProceedingsController.START_PAGE)
- );
- data.put(
- InProceedingsController.END_PAGE,
- formData.get(InProceedingsController.END_PAGE)
- );
-
- final InProceedingsController controller = CdiUtil
- .createCdiUtil()
- .findBean(InProceedingsController.class);
-
- controller.saveInProceedings(
- inProceedingsItem.getPublication().getPublicationId(), data
- );
- }
- }
-
-}
diff --git a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/InternetArticleController.java b/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/InternetArticleController.java
deleted file mode 100644
index 849aa52..0000000
--- a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/InternetArticleController.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import org.librecms.assets.Organization;
-import org.librecms.contentsection.AssetRepository;
-import org.scientificcms.publications.InternetArticle;
-import org.scientificcms.publications.PublicationRepository;
-
-import java.time.LocalDate;
-import java.util.Map;
-
-import javax.enterprise.context.RequestScoped;
-import javax.inject.Inject;
-import javax.transaction.Transactional;
-
-/**
- *
- * @author Jens Pelzetter
- */
-@RequestScoped
-public class InternetArticleController {
-
- public static final String PLACE = "place";
-
- public static final String NUMBER = "number";
-
- public static final String NUMBER_OF_PAGES = "numberOfPages";
-
- public static final String EDITION = "edition";
-
- public static final String ISSN = "issn";
-
- public static final String LAST_ACCESSED = "lastAccessed";
-
- public static final String URL = "url";
-
- public static final String URN = "urn";
-
- public static final String DOI = "doi";
-
- @Inject
- private AssetRepository assetRepository;
-
- @Inject
- private PublicationRepository publicationRepository;
-
- @Transactional(Transactional.TxType.REQUIRED)
- public void saveInternetArticle(
- final long internetArticleId, final Map data
- ) {
- final InternetArticle internetArticle = publicationRepository
- .findByIdAndType(internetArticleId, InternetArticle.class)
- .orElseThrow(
- () -> new IllegalArgumentException(
- String.format(
- "No InternetArticle with ID %d found.",
- internetArticleId
- )
- )
- );
-
- if (data.containsKey(PLACE)) {
- internetArticle.setPlace((String) data.get(PLACE));
- }
-
- if (data.containsKey(NUMBER)) {
- internetArticle.setNumber((String) data.get(NUMBER));
- }
-
- if (data.containsKey(NUMBER_OF_PAGES)) {
- internetArticle.setNumberOfPages(
- (Integer) data.get(NUMBER_OF_PAGES)
- );
- }
-
- if (data.containsKey(EDITION)) {
- internetArticle.setEdition((String) data.get(EDITION));
- }
-
- if (data.containsKey(ISSN)) {
- internetArticle.setIssn((String) data.get(ISSN));
- }
-
- if (data.containsKey(LAST_ACCESSED)) {
- internetArticle.setLastAccessed((LocalDate) data.get(LAST_ACCESSED));
- }
-
- if (data.containsKey(URL)) {
- internetArticle.setUrl((String) data.get(URL));
- }
-
- if (data.containsKey(URN)) {
- internetArticle.setUrn((String) data.get(URN));
- }
-
- if (data.containsKey(DOI)) {
- internetArticle.setDoi((String) data.get(DOI));
- }
-
- publicationRepository.save(internetArticle);
- }
-
- @Transactional(Transactional.TxType.REQUIRED)
- public void setOrganization(
- final long internetArticleId,
- final long organizationId
- ) {
- final InternetArticle internetArticle = publicationRepository
- .findByIdAndType(internetArticleId, InternetArticle.class)
- .orElseThrow(
- () -> new IllegalArgumentException(
- String.format(
- "No InternetArticle with ID %d found.",
- internetArticleId
- )
- )
- );
-
- final Organization organization = assetRepository
- .findById(organizationId, Organization.class)
- .orElseThrow(
- () -> new IllegalArgumentException(
- String.format(
- "No Organization with ID %d found.", organizationId
- )
- )
- );
-
- internetArticle.setOrganization(organization);
- publicationRepository.save(internetArticle);
- }
-
- @Transactional(Transactional.TxType.REQUIRED)
- public void unsetOrganization(final long internetArticleId) {
- final InternetArticle internetArticle = publicationRepository
- .findByIdAndType(internetArticleId, InternetArticle.class)
- .orElseThrow(
- () -> new IllegalArgumentException(
- String.format(
- "No InternetArticle with ID %d found.",
- internetArticleId
- )
- )
- );
-
- internetArticle.setOrganization(null);
- }
-
-}
diff --git a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/InternetArticleCreateForm.java b/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/InternetArticleCreateForm.java
deleted file mode 100644
index 47f29e1..0000000
--- a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/InternetArticleCreateForm.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.parameters.StringParameter;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.ui.authoring.CreationSelector;
-
-import org.scientificcms.publications.InternetArticle;
-import org.scientificcms.publications.contenttypes.InternetArticleItem;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class InternetArticleCreateForm
- extends AbstractPublicationCreateForm {
-
- public InternetArticleCreateForm(
- final ItemSelectionModel itemModel,
- final CreationSelector creationSelector,
- final StringParameter selectedLanguageParam
- ) {
- super(itemModel, creationSelector, selectedLanguageParam);
- }
-
- @Override
- protected InternetArticle createPublication() {
- return new InternetArticle();
- }
-
-}
diff --git a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/InternetArticleOrganizationForm.java b/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/InternetArticleOrganizationForm.java
deleted file mode 100644
index b934949..0000000
--- a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/InternetArticleOrganizationForm.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.FormData;
-import com.arsdigita.bebop.FormProcessException;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.event.FormInitListener;
-import com.arsdigita.bebop.event.FormProcessListener;
-import com.arsdigita.bebop.event.FormSectionEvent;
-import com.arsdigita.bebop.parameters.StringParameter;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.ui.assets.AssetSearchWidget;
-import com.arsdigita.cms.ui.authoring.BasicItemForm;
-import com.arsdigita.globalization.GlobalizedMessage;
-
-import org.libreccm.cdi.utils.CdiUtil;
-import org.librecms.assets.Organization;
-import org.scientificcms.publications.SciPublicationsConstants;
-import org.scientificcms.publications.contenttypes.InternetArticleItem;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class InternetArticleOrganizationForm
- extends BasicItemForm
- implements FormProcessListener, FormInitListener {
-
- private static final String ORGA_SEARCH = "internetArticleOrga";
-
- private AssetSearchWidget orgaSearch;
-
- public InternetArticleOrganizationForm(
- final ItemSelectionModel itemModel,
- final StringParameter selectedLangParam
- ) {
- super("InternetArticleOrganizationForm", itemModel, selectedLangParam);
- }
-
- @Override
- public void addWidgets() {
- orgaSearch = new AssetSearchWidget(ORGA_SEARCH, Organization.class);
- orgaSearch.setLabel(
- new GlobalizedMessage(
- "publications.ui.internetarticle.select_organization",
- SciPublicationsConstants.BUNDLE
- )
- );
- add(orgaSearch);
- }
-
- @Override
- public void init(final FormSectionEvent event) throws FormProcessException {
- final PageState state = event.getPageState();
- setVisible(state, true);
- }
-
- @Override
- public void process(final FormSectionEvent event)
- throws FormProcessException {
- final FormData formData = event.getFormData();
- final PageState state = event.getPageState();
-
- final InternetArticleItem articleItem
- = (InternetArticleItem) getItemSelectionModel()
- .getSelectedItem(state);
-
- if (getSaveCancelSection().getSaveButton().isSelected(state)) {
- final Organization orga
- = (Organization) formData
- .get(ORGA_SEARCH);
- final InternetArticleController controller = CdiUtil
- .createCdiUtil()
- .findBean(InternetArticleController.class);
-
- controller.setOrganization(
- articleItem.getPublication().getPublicationId(),
- orga.getObjectId()
- );
- }
-
- init(event);
- }
-
-}
diff --git a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/InternetArticleOrganizationSheet.java b/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/InternetArticleOrganizationSheet.java
deleted file mode 100644
index c1743f1..0000000
--- a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/InternetArticleOrganizationSheet.java
+++ /dev/null
@@ -1,267 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.Component;
-import com.arsdigita.bebop.ControlLink;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.Table;
-import com.arsdigita.bebop.Text;
-import com.arsdigita.bebop.event.TableActionEvent;
-import com.arsdigita.bebop.event.TableActionListener;
-import com.arsdigita.bebop.table.TableCellRenderer;
-import com.arsdigita.bebop.table.TableColumn;
-import com.arsdigita.bebop.table.TableColumnModel;
-import com.arsdigita.bebop.table.TableModel;
-import com.arsdigita.bebop.table.TableModelBuilder;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.dispatcher.Utilities;
-import com.arsdigita.globalization.GlobalizedMessage;
-import com.arsdigita.util.LockableImpl;
-
-import org.libreccm.cdi.utils.CdiUtil;
-import org.libreccm.security.PermissionChecker;
-import org.librecms.assets.Organization;
-import org.librecms.contentsection.privileges.ItemPrivileges;
-import org.scientificcms.publications.InternetArticle;
-import org.scientificcms.publications.SciPublicationsConstants;
-import org.scientificcms.publications.contenttypes.InternetArticleItem;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class InternetArticleOrganizationSheet
- extends Table
- implements TableActionListener {
-
- private static final String TABLE_COL_EDIT = "table_col_edit";
-
- private static final String TABLE_COL_DEL = "table_col_del";
-
- private final ItemSelectionModel itemModel;
-
- public InternetArticleOrganizationSheet(final ItemSelectionModel itemModel) {
- super();
- this.itemModel = itemModel;
-
- setEmptyView(
- new Label(
- new GlobalizedMessage(
- "publications.ui.internetarticle.organization.none",
- SciPublicationsConstants.BUNDLE
- )
- )
- );
-
- final TableColumnModel columnModel = getColumnModel();
- columnModel.add(
- new TableColumn(
- 0,
- new Label(
- new GlobalizedMessage(
- "publications.ui.internetarticle.organization",
- SciPublicationsConstants.BUNDLE
- )
- ),
- TABLE_COL_EDIT
- )
- );
- columnModel.add(
- new TableColumn(
- 1,
- new Label(
- new GlobalizedMessage(
- "publications.ui.internetarticle.organization.remove",
- SciPublicationsConstants.BUNDLE
- )
- ),
- TABLE_COL_DEL));
-
- setModelBuilder(
- new InternetArticleOrganizationSheetModelBuilder(itemModel)
- );
- columnModel.get(0).setCellRenderer(new EditCellRenderer());
- columnModel.get(1).setCellRenderer(new DeleteCellRenderer());
-
- addTableActionListener(this);
- }
-
- @Override
- public void cellSelected(final TableActionEvent event) {
- final PageState state = event.getPageState();
-
- final InternetArticleItem articleItem = (InternetArticleItem) itemModel
- .getSelectedObject(state);
-
- final TableColumn column = getColumnModel().get(event.getColumn());
-
- if (column.getHeaderKey().toString().equals(TABLE_COL_EDIT)) {
- // Nothing
- } else if (column.getHeaderKey().toString().equals(TABLE_COL_DEL)) {
- final InternetArticleController controller = CdiUtil
- .createCdiUtil()
- .findBean(InternetArticleController.class);
- controller.unsetOrganization(
- articleItem.getPublication().getPublicationId()
- );
- }
- }
-
- @Override
- public void headSelected(final TableActionEvent event) {
- //Nothing to do
- }
-
- private class InternetArticleOrganizationSheetModelBuilder
- extends LockableImpl
- implements TableModelBuilder {
-
- private final ItemSelectionModel itemModel;
-
- public InternetArticleOrganizationSheetModelBuilder(
- final ItemSelectionModel itemModel
- ) {
- this.itemModel = itemModel;
- }
-
- @Override
- public TableModel makeModel(final Table table, final PageState state) {
- table.getRowSelectionModel().clearSelection(state);
- final InternetArticleItem articleItem
- = (InternetArticleItem) itemModel.
- getSelectedObject(state);
- return new InternetArticleOrganizationSheetModel(
- table, state, articleItem.getPublication()
- );
- }
-
- }
-
- private class InternetArticleOrganizationSheetModel
- implements TableModel {
-
- private final Table table;
-
- private final Organization orga;
-
- private boolean done;
-
- public InternetArticleOrganizationSheetModel(
- final Table table,
- final PageState state,
- final InternetArticle article
- ) {
- this.table = table;
- orga = article.getOrganization();
- done = orga != null;
- }
-
- @Override
- public int getColumnCount() {
- return table.getColumnModel().size();
- }
-
- @Override
- public boolean nextRow() {
- boolean ret;
-
- if (done) {
- ret = true;
- done = false;
- } else {
- ret = false;
- }
-
- return ret;
- }
-
- @Override
- public Object getElementAt(final int columnIndex) {
- switch (columnIndex) {
- case 0:
- return orga.getTitle();
- case 1:
- return new Label(
- new GlobalizedMessage(
- "publication.ui.internetarticle.organization.remove",
- SciPublicationsConstants.BUNDLE
- )
- );
- default:
- return null;
- }
- }
-
- @Override
- public Object getKeyAt(final int columnIndex) {
- return orga.getObjectId();
- }
-
- }
-
- private class EditCellRenderer
- extends LockableImpl
- implements TableCellRenderer {
-
- @Override
- public Component getComponent(
- final Table table,
- final PageState state,
- final Object value,
- final boolean isSelected,
- final Object key,
- final int row,
- final int column
- ) {
- return new Text((String) value);
- }
-
- }
-
- private class DeleteCellRenderer
- extends LockableImpl
- implements TableCellRenderer {
-
- @Override
- public Component getComponent(
- final Table table,
- final PageState state,
- final Object value,
- final boolean isSelected,
- final Object key,
- final int row,
- final int col
- ) {
- final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
- final PermissionChecker permissionChecker = cdiUtil.findBean(
- PermissionChecker.class
- );
-
- final InternetArticleItem articleItem
- = (InternetArticleItem) itemModel
- .getSelectedObject(state);
- final boolean canEdit = permissionChecker
- .isPermitted(ItemPrivileges.EDIT, articleItem);
-
- if (canEdit) {
- final ControlLink link = new ControlLink((Component) value);
- link.setConfirmation(
- new GlobalizedMessage(
- "publications.ui.internetarticle.organization.remove.confirm",
- SciPublicationsConstants.BUNDLE
- )
- );
- return link;
- } else {
- return new Text("");
- }
- }
-
- }
-
-}
diff --git a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/InternetArticleOrganizationStep.java b/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/InternetArticleOrganizationStep.java
deleted file mode 100644
index f71ee82..0000000
--- a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/InternetArticleOrganizationStep.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.parameters.StringParameter;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
-import com.arsdigita.cms.ui.authoring.BasicItemForm;
-import com.arsdigita.cms.ui.authoring.SimpleEditStep;
-import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
-import com.arsdigita.globalization.GlobalizedMessage;
-
-import org.scientificcms.publications.SciPublicationsConstants;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class InternetArticleOrganizationStep extends SimpleEditStep {
-
- private static final String SET_INTERNET_ARTICLE_ORGANIZATION_STEP
- = "setInternetArticleOrganizationStep";
-
- public InternetArticleOrganizationStep(
- final ItemSelectionModel itemModel,
- final AuthoringKitWizard parent,
- final StringParameter selectedLangParam
- ) {
- this(itemModel, parent, selectedLangParam, null);
- }
-
- public InternetArticleOrganizationStep(
- final ItemSelectionModel itemModel,
- final AuthoringKitWizard parent,
- final StringParameter selectedLangParam,
- final String prefix
- ) {
- super(itemModel, parent, selectedLangParam, prefix);
-
- final BasicItemForm setOrgaForm = new InternetArticleOrganizationForm(
- itemModel, selectedLangParam
- );
- add(
- SET_INTERNET_ARTICLE_ORGANIZATION_STEP,
- new GlobalizedMessage(
- "publications.ui.internetarticle.setOrganization",
- SciPublicationsConstants.BUNDLE
- ),
- new WorkflowLockedComponentAccess(setOrgaForm, itemModel),
- setOrgaForm.getSaveCancelSection().getCancelButton());
-
- final InternetArticleOrganizationSheet sheet
- = new InternetArticleOrganizationSheet(
- itemModel);
- setDisplayComponent(sheet);
- }
-
-}
diff --git a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/InternetArticlePropertiesStep.java b/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/InternetArticlePropertiesStep.java
deleted file mode 100644
index d5dd2c4..0000000
--- a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/InternetArticlePropertiesStep.java
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.Component;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.parameters.StringParameter;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
-import com.arsdigita.cms.ui.authoring.BasicPageForm;
-import com.arsdigita.cms.ui.authoring.SimpleEditStep;
-import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
-import com.arsdigita.globalization.GlobalizedMessage;
-import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
-
-import org.scientificcms.publications.SciPublicationsConstants;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class InternetArticlePropertiesStep extends PublicationPropertiesStep {
-
- private final StringParameter selectedLangParam;
-
- public InternetArticlePropertiesStep(
- final ItemSelectionModel itemModel,
- final AuthoringKitWizard parent,
- final StringParameter selectedLangParam
- ) {
- super(itemModel, parent, selectedLangParam);
- this.selectedLangParam = selectedLangParam;
- }
-
- public static Component getInternetArticlePropertySheet(
- final ItemSelectionModel itemModel,
- final StringParameter selectedLangParam
- ) {
- final DomainObjectPropertySheet sheet
- = (DomainObjectPropertySheet) PublicationPropertiesStep
- .getPublicationPropertySheet(itemModel, selectedLangParam);
-
- sheet.add(
- new GlobalizedMessage(
- "publications.ui.internetarticle.place",
- SciPublicationsConstants.BUNDLE
- ),
- InternetArticleController.PLACE
- );
-
- sheet.add(
- new GlobalizedMessage(
- "publications.ui.internetarticle.number",
- SciPublicationsConstants.BUNDLE
- ),
- InternetArticleController.NUMBER
- );
-
- sheet.add(
- new GlobalizedMessage(
- "publications.ui.internetarticle.number_of_pages",
- SciPublicationsConstants.BUNDLE
- ),
- InternetArticleController.NUMBER_OF_PAGES
- );
-
- sheet.add(
- new GlobalizedMessage(
- "publications.ui.internetarticle.edition",
- SciPublicationsConstants.BUNDLE
- ),
- InternetArticleController.EDITION
- );
-
- sheet.add(
- new GlobalizedMessage(
- "publications.ui.internetarticle.issn",
- SciPublicationsConstants.BUNDLE
- ),
- InternetArticleController.ISSN
- );
-
- sheet.add(
- new GlobalizedMessage(
- "publications.ui.internetarticle.lastAccessed",
- SciPublicationsConstants.BUNDLE
- ),
- InternetArticleController.LAST_ACCESSED
- );
-
- sheet.add(
- new GlobalizedMessage(
- "publications.ui.internetarticle.url",
- SciPublicationsConstants.BUNDLE
- ),
- InternetArticleController.URL
- );
-
- sheet.add(
- new GlobalizedMessage(
- "publications.ui.internetarticle.urn",
- SciPublicationsConstants.BUNDLE
- ),
- InternetArticleController.URN
- );
-
- sheet.add(
- new GlobalizedMessage(
- "publications.ui.internetarticle.doi",
- SciPublicationsConstants.BUNDLE
- ),
- InternetArticleController.DOI
- );
-
- return sheet;
- }
-
- @Override
- protected void addBasicProperties(
- final ItemSelectionModel itemModel, final AuthoringKitWizard parent
- ) {
- final SimpleEditStep basicProperties = new SimpleEditStep(
- itemModel,
- parent,
- selectedLangParam,
- EDIT_SHEET_NAME
- );
-
- final BasicPageForm editBasicSheet
- = new InternetArticlePropertyForm(
- itemModel,
- this,
- selectedLangParam
- );
-
- basicProperties.add(
- EDIT_SHEET_NAME,
- new GlobalizedMessage(
- "publications.ui.internetarticle.edit_basic_sheet",
- SciPublicationsConstants.BUNDLE
- ),
- new WorkflowLockedComponentAccess(editBasicSheet, itemModel),
- editBasicSheet.getSaveCancelSection().getCancelButton()
- );
-
- basicProperties.setDisplayComponent(
- getInternetArticlePropertySheet(itemModel, selectedLangParam));
-
- getSegmentedPanel().addSegment(
- new Label(
- new GlobalizedMessage(
- "publications.ui.publication.basic_properties",
- SciPublicationsConstants.BUNDLE
- )
- ),
- basicProperties
- );
- }
-
- @Override
- protected void addSteps(
- final ItemSelectionModel itemModel, final AuthoringKitWizard parent
- ) {
- super.addSteps(itemModel, parent);
-
- addStep(
- new InternetArticleOrganizationStep(
- itemModel, parent, selectedLangParam
- ),
- new GlobalizedMessage(
- "publications.ui.internetarticle.setOrganization",
- SciPublicationsConstants.BUNDLE
- )
- );
- }
-
-}
diff --git a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/InternetArticlePropertyForm.java b/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/InternetArticlePropertyForm.java
deleted file mode 100644
index a38aac7..0000000
--- a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/InternetArticlePropertyForm.java
+++ /dev/null
@@ -1,318 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.FormData;
-import com.arsdigita.bebop.FormProcessException;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.event.FormInitListener;
-import com.arsdigita.bebop.event.FormProcessListener;
-import com.arsdigita.bebop.event.FormSectionEvent;
-import com.arsdigita.bebop.event.FormSubmissionListener;
-import com.arsdigita.bebop.event.ParameterEvent;
-import com.arsdigita.bebop.event.ParameterListener;
-import com.arsdigita.bebop.form.TextField;
-import com.arsdigita.bebop.parameters.DateParameter;
-import com.arsdigita.bebop.parameters.IntegerParameter;
-import com.arsdigita.bebop.parameters.ParameterData;
-import com.arsdigita.bebop.parameters.ParameterModel;
-import com.arsdigita.bebop.parameters.StringParameter;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.globalization.GlobalizedMessage;
-
-import org.libreccm.cdi.utils.CdiUtil;
-import org.scientificcms.publications.InternetArticle;
-import org.scientificcms.publications.SciPublicationsConstants;
-import org.scientificcms.publications.contenttypes.InternetArticleItem;
-
-import java.time.ZoneId;
-import java.util.Calendar;
-import java.util.GregorianCalendar;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class InternetArticlePropertyForm
- extends PublicationPropertyForm
- implements FormInitListener, FormProcessListener, FormSubmissionListener {
-
- public static final String ID = "InternetArticleEdit";
-
- private final InternetArticlePropertiesStep step;
-
- private final StringParameter selectedLangParam;
-
- public InternetArticlePropertyForm(
- final ItemSelectionModel itemModel,
- final StringParameter selectedLangParam
- ) {
- this(itemModel, null, selectedLangParam);
- }
-
- public InternetArticlePropertyForm(
- final ItemSelectionModel itemModel,
- final InternetArticlePropertiesStep step,
- final StringParameter selectedLangParam
- ) {
- super(itemModel, step, selectedLangParam);
- this.step = step;
- this.selectedLangParam = selectedLangParam;
- addSubmissionListener(this);
- }
-
- @Override
- protected void addWidgets() {
- super.addWidgets();
-
- final ParameterModel placeParam = new StringParameter(
- InternetArticleController.PLACE
- );
- final TextField place = new TextField(placeParam);
- place.setLabel(
- new GlobalizedMessage(
- "publications.ui.internetarticle.place",
- SciPublicationsConstants.BUNDLE
- )
- );
- add(place);
-
- final ParameterModel numberParam = new StringParameter(
- InternetArticleController.NUMBER
- );
- final TextField number = new TextField(numberParam);
- number.setLabel(
- new GlobalizedMessage(
- "publications.ui.internetarticle.number",
- SciPublicationsConstants.BUNDLE
- )
- );
- add(number);
-
- final ParameterModel numberOfPagesParam = new IntegerParameter(
- InternetArticleController.NUMBER_OF_PAGES
- );
- final TextField numberOfPages = new TextField(numberOfPagesParam);
- numberOfPages.setLabel(
- new GlobalizedMessage(
- "publications.ui.internetarticle.number_of_pages",
- SciPublicationsConstants.BUNDLE
- )
- );
- add(numberOfPages);
-
- final ParameterModel editionParam = new StringParameter(
- InternetArticleController.EDITION
- );
- final TextField edition = new TextField(editionParam);
- edition.setLabel(
- new GlobalizedMessage(
- "publications.ui.internetarticle.edition",
- SciPublicationsConstants.BUNDLE
- )
- );
- add(edition);
-
- final ParameterModel issnParam = new StringParameter(
- InternetArticleController.ISSN
- );
- final TextField issn = new TextField(issnParam);
- issn.setLabel(
- new GlobalizedMessage(
- "publications.ui.internetarticle.issn",
- SciPublicationsConstants.BUNDLE
- )
- );
- issn.setMaxLength(9);
- issn.addValidationListener(new ParameterListener() {
-
- @Override
- public void validate(final ParameterEvent event)
- throws FormProcessException {
- final ParameterData data = event.getParameterData();
- String value = (String) data.getValue();
-
- if (value.isEmpty()) {
- return;
- }
-
- value = value.replace("-", "");
-
- if (value.length() != 8) {
- data.invalidate();
- data.addError(new GlobalizedMessage(
- "publications.ui.invalid_issn"));
- }
-
- try {
- Long num = Long.parseLong(value);
- } catch (NumberFormatException ex) {
- data.invalidate();
- data.addError(new GlobalizedMessage(
- "publications.ui.invalid_issn"));
- }
- }
-
- });
- add(issn);
-
- final Calendar today = new GregorianCalendar();
- final ParameterModel pubDateParam = new DateParameter(
- InternetArticleController.LAST_ACCESSED
- );
- final com.arsdigita.bebop.form.Date pubDate
- = new com.arsdigita.bebop.form.Date(
- pubDateParam
- );
- pubDate.setYearRange(1900, today.get(Calendar.YEAR) + 2);
- pubDate.setLabel(
- new GlobalizedMessage(
- "publications.ui.internetarticle.lastAccessed",
- SciPublicationsConstants.BUNDLE
- )
- );
- add(pubDate);
-
- ParameterModel urlModel = new StringParameter(
- InternetArticleController.URL
- );
- TextField url = new TextField(urlModel);
- url.setLabel(new GlobalizedMessage(
- "publications.ui.internetarticle.url"));
- add(url);
-
- final ParameterModel urnModel = new StringParameter(
- InternetArticleController.URN
- );
- final TextField urn = new TextField(urnModel);
- urn.setLabel(
- new GlobalizedMessage(
- "publications.ui.internetarticle.urn",
- SciPublicationsConstants.BUNDLE
- )
- );
- add(urn);
-
- final ParameterModel doiModel = new StringParameter(
- InternetArticleController.DOI
- );
- final TextField doi = new TextField(doiModel);
- doi.setLabel(
- new GlobalizedMessage(
- "publications.ui.internetarticle.doi",
- SciPublicationsConstants.BUNDLE
- )
- );
- add(doi);
- }
-
- @Override
- public void init(final FormSectionEvent event) throws FormProcessException {
- super.init(event);
-
- final FormData data = event.getFormData();
- final InternetArticleItem articleItem
- = (InternetArticleItem) initBasicWidgets(
- event);
- final InternetArticle article = articleItem.getPublication();
-
- data.put(InternetArticleController.PLACE, article.getPlace());
- data.put(InternetArticleController.NUMBER, article.getNumber());
- data.put(InternetArticleController.NUMBER_OF_PAGES, article
- .getNumberOfPages());
- data.put(InternetArticleController.EDITION, article.getEdition());
- data.put(InternetArticleController.ISSN, article.getIssn());
- data.put(
- InternetArticleController.LAST_ACCESSED,
- java.util.Date.from(
- article.getLastAccessed().atStartOfDay().atZone(
- ZoneId.systemDefault()
- ).toInstant()
- )
- );
- data.put(InternetArticleController.URL, article.getUrl());
- data.put(InternetArticleController.URN, article.getUrn());
- data.put(InternetArticleController.DOI, article.getDoi());
- }
-
- @Override
- public void process(final FormSectionEvent event)
- throws FormProcessException {
- super.process(event);
-
- final FormData formData = event.getFormData();
- final PageState state = event.getPageState();
-
- final InternetArticleItem articleItem
- = (InternetArticleItem) processBasicWidgets(
- event);
-
- if ((articleItem != null)
- && getSaveCancelSection().getSaveButton().isSelected(state)) {
- final Map data = new HashMap<>();
-
- data.put(
- InternetArticleController.PLACE,
- formData.get(InternetArticleController.PLACE
- )
- );
- data.put(
- InternetArticleController.NUMBER,
- formData.get(InternetArticleController.NUMBER
- )
- );
- data.put(
- InternetArticleController.NUMBER_OF_PAGES,
- formData.get(InternetArticleController.NUMBER_OF_PAGES
- )
- );
- data.put(
- InternetArticleController.EDITION,
- formData.get(InternetArticleController.EDITION
- )
- );
- data.put(
- InternetArticleController.ISSN,
- formData.get(InternetArticleController.ISSN
- )
- );
- final java.util.Date lastAccessed = (java.util.Date) formData.get(
- InternetArticleController.LAST_ACCESSED
- );
- data.put(
- InternetArticleController.LAST_ACCESSED,
- lastAccessed.toInstant().atZone(
- ZoneId.systemDefault()
- ).toLocalDate()
- );
- data.put(
- InternetArticleController.URL,
- formData.get(InternetArticleController.URL
- )
- );
- data.put(
- InternetArticleController.URN,
- formData.get(InternetArticleController.URN
- )
- );
- data.put(
- InternetArticleController.DOI,
- formData.get(InternetArticleController.DOI
- )
- );
-
- final InternetArticleController controller = CdiUtil
- .createCdiUtil()
- .findBean(InternetArticleController.class);
- controller.saveInternetArticle(
- articleItem.getPublication().getPublicationId(), data
- );
- }
- }
-
-}
diff --git a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/JournalSearchWidget.java b/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/JournalSearchWidget.java
deleted file mode 100644
index 1e15514..0000000
--- a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/JournalSearchWidget.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.form.Widget;
-import com.arsdigita.bebop.parameters.LongParameter;
-import com.arsdigita.cms.CMS;
-import com.arsdigita.xml.Element;
-
-import org.libreccm.cdi.utils.CdiUtil;
-
-import java.util.Map;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class JournalSearchWidget extends Widget {
-
- public JournalSearchWidget(final String name) {
- super(new LongParameter(name));
- }
-
- @Override
- public boolean isCompound() {
- return true;
- }
-
- @Override
- protected String getType() {
- return "journal-search-widget";
- }
-
- @Override
- public String getElementTag() {
- return "cms:journal-search-widget";
- }
-
- @Override
- public void generateWidget(
- final PageState state, final Element parent
- ) {
- final Element widget = parent.newChildElement(getElementTag(),
- CMS.CMS_XML_NS);
-
- widget.addAttribute("name", getName());
-
- final Long value = (Long) getValue(state);
- if (value != null) {
- final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
- final JournalSearchWidgetController controller = cdiUtil
- .findBean(JournalSearchWidgetController.class);
-
- final Map data = controller.getData(value);
-
- final Element selected = widget
- .newChildElement("cms:selected-journal", CMS.CMS_XML_NS);
- selected.addAttribute(
- "journalId",
- data.get(JournalSearchWidgetController.JOURNAL_ID)
- );
- selected.addAttribute(
- "title",
- data.get(JournalSearchWidgetController.TITLE)
- );
- selected.addAttribute(
- "symbol",
- data.get(JournalSearchWidgetController.SYMBOL)
- );
- selected.addAttribute(
- "issn",
- data.get(JournalSearchWidgetController.ISSN));
-
- exportAttributes(widget);
- }
- }
-
-}
diff --git a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/JournalSearchWidgetController.java b/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/JournalSearchWidgetController.java
deleted file mode 100644
index 3ea56be..0000000
--- a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/JournalSearchWidgetController.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import org.libreccm.l10n.GlobalizationHelper;
-import org.scientificcms.publications.Journal;
-import org.scientificcms.publications.JournalRepository;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.enterprise.context.RequestScoped;
-import javax.inject.Inject;
-import javax.transaction.Transactional;
-
-/**
- *
- * @author Jens Pelzetter
- */
-@RequestScoped
-public class JournalSearchWidgetController {
-
- protected static final String JOURNAL_ID = "journalId";
-
- protected static final String TITLE = "title";
-
- protected static final String SYMBOL = "symbol";
-
- protected static final String ISSN = "issn";
-
- @Inject
- private JournalRepository journalRepository;
-
- @Transactional(Transactional.TxType.REQUIRED)
- public Map getData(final long journalId) {
-
- final Journal journal = journalRepository
- .findById(journalId)
- .orElseThrow(
- () -> new IllegalArgumentException(
- String.format("No Journal with ID %d found.", journalId)
- )
- );
-
- final Map data = new HashMap<>();
-
- data.put(JOURNAL_ID, Long.toString(journal.getJournalId()));
- data.put(TITLE, journal.getTitle());
- data.put(SYMBOL, journal.getSymbol());
- data.put(ISSN, journal.getIssn());
-
- return data;
- }
-
-}
diff --git a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/MonographController.java b/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/MonographController.java
deleted file mode 100644
index 20d2683..0000000
--- a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/MonographController.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import org.scientificcms.publications.Monograph;
-import org.scientificcms.publications.PublicationRepository;
-
-import java.util.Map;
-
-import javax.enterprise.context.RequestScoped;
-import javax.inject.Inject;
-
-/**
- *
- * @author Jens Pelzetter
- */
-@RequestScoped
-public class MonographController {
-
- public static final String REVIEWED = "reviewed";
-
- @Inject
- private PublicationRepository publicationRepository;
-
- public void saveMonograph(
- final long monographId, final Map data
- ) {
- final Monograph monograph = publicationRepository
- .findByIdAndType(monographId, Monograph.class)
- .orElseThrow(
- () -> new IllegalArgumentException(
- String.format(
- "No Monograph with ID %d found.", monographId
- )
- )
- );
-
- if (data.containsKey(REVIEWED)) {
- monograph.setReviewed((Boolean) data.get(REVIEWED));
- }
-
- publicationRepository.save(monograph);
- }
-
-}
diff --git a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/MonographCreateForm.java b/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/MonographCreateForm.java
deleted file mode 100644
index d630a12..0000000
--- a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/MonographCreateForm.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.parameters.StringParameter;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.ui.authoring.CreationSelector;
-
-import org.scientificcms.publications.Monograph;
-import org.scientificcms.publications.contenttypes.MonographItem;
-
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class MonographCreateForm
- extends AbstractPublicationCreateForm {
-
- public MonographCreateForm(final ItemSelectionModel itemModel,
- final CreationSelector creationSelector,
- final StringParameter selectedLanguageParam) {
- super(itemModel, creationSelector, selectedLanguageParam);
- }
-
- @Override
- protected Monograph createPublication() {
- return new Monograph();
- }
-
-}
diff --git a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/MonographPropertiesStep.java b/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/MonographPropertiesStep.java
deleted file mode 100644
index db5d43e..0000000
--- a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/MonographPropertiesStep.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.Component;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.parameters.StringParameter;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
-import com.arsdigita.cms.ui.authoring.BasicPageForm;
-import com.arsdigita.cms.ui.authoring.SimpleEditStep;
-import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
-import com.arsdigita.domain.DomainService;
-import com.arsdigita.globalization.GlobalizedMessage;
-import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
-
-import org.scientificcms.publications.SciPublicationsConstants;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class MonographPropertiesStep
- extends PublicationWithPublisherPropertiesStep {
-
- private final StringParameter selectedLangParam;
-
- public MonographPropertiesStep(
- final ItemSelectionModel itemModel,
- final AuthoringKitWizard parent,
- final StringParameter selectedLangParam
- ) {
- super(itemModel, parent, selectedLangParam);
- this.selectedLangParam = selectedLangParam;
- }
-
- public static Component getMonographPropertySheet(
- final ItemSelectionModel itemModel,
- final StringParameter selectedLangParam
- ) {
- DomainObjectPropertySheet sheet
- = (DomainObjectPropertySheet) PublicationWithPublisherPropertiesStep
- .getPublicationWithPublisherPropertySheet(
- itemModel,
- selectedLangParam
- );
-
- sheet.add(
- new GlobalizedMessage(
- "publications.ui.monograph.reviewed",
- SciPublicationsConstants.BUNDLE
- ),
- MonographController.REVIEWED,
- new ReviewedFormatter()
- );
-
- return sheet;
- }
-
- @Override
- protected void addBasicProperties(
- final ItemSelectionModel itemModel, final AuthoringKitWizard parent
- ) {
- final SimpleEditStep basicProperties = new SimpleEditStep(
- itemModel, parent, selectedLangParam, EDIT_SHEET_NAME
- );
-
- final BasicPageForm editBasicSheet
- = new MonographPropertyForm(
- itemModel, this, selectedLangParam
- );
-
- basicProperties.add(
- EDIT_SHEET_NAME,
- new GlobalizedMessage(
- "publications.ui.monograph.edit_basic_sheet",
- SciPublicationsConstants.BUNDLE
- ),
- new WorkflowLockedComponentAccess(editBasicSheet, itemModel),
- editBasicSheet.getSaveCancelSection().getCancelButton()
- );
-
- basicProperties.setDisplayComponent(
- getMonographPropertySheet(itemModel, selectedLangParam)
- );
-
- getSegmentedPanel().addSegment(
- new Label(
- new GlobalizedMessage(
- "publications.ui.publication.basic_properties",
- SciPublicationsConstants.BUNDLE
- )
- ),
- basicProperties);
- }
-
- private static class ReviewedFormatter
- extends DomainService
- implements DomainObjectPropertySheet.AttributeFormatter {
-
- public ReviewedFormatter() {
- super();
- }
-
- @Override
- public String format(
- final Object obj, final String attribute, final PageState state
- ) {
- if ((get(obj, attribute) != null)
- && (get(obj, attribute) instanceof Boolean)
- && ((Boolean) get(obj, attribute) == true)) {
- return (String) new GlobalizedMessage(
- "publications.ui.monograph.reviewed.yes",
- SciPublicationsConstants.BUNDLE).localize();
- } else {
- return (String) new GlobalizedMessage(
- "publications.ui.monograph.reviewed.no",
- SciPublicationsConstants.BUNDLE).localize();
- }
- }
-
- }
-
-}
diff --git a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/MonographPropertyForm.java b/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/MonographPropertyForm.java
deleted file mode 100644
index f9b046c..0000000
--- a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/MonographPropertyForm.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.FormData;
-import com.arsdigita.bebop.FormProcessException;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.event.FormInitListener;
-import com.arsdigita.bebop.event.FormProcessListener;
-import com.arsdigita.bebop.event.FormSectionEvent;
-import com.arsdigita.bebop.event.FormSubmissionListener;
-import com.arsdigita.bebop.form.CheckboxGroup;
-import com.arsdigita.bebop.form.Option;
-import com.arsdigita.bebop.parameters.StringParameter;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.globalization.GlobalizedMessage;
-
-import org.libreccm.cdi.utils.CdiUtil;
-import org.scientificcms.publications.Monograph;
-import org.scientificcms.publications.SciPublicationsConstants;
-import org.scientificcms.publications.contenttypes.MonographItem;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class MonographPropertyForm extends PublicationWithPublisherPropertyForm
- implements FormProcessListener, FormInitListener, FormSubmissionListener {
-
- public static final String ID = "MonographEdit";
-
-
- private CheckboxGroup reviewed;
-
- public MonographPropertyForm(
- final ItemSelectionModel itemModel,
- final StringParameter selectedLangParam
- ) {
- this(itemModel, null, selectedLangParam);
- }
-
- public MonographPropertyForm(
- final ItemSelectionModel itemModel,
- final MonographPropertiesStep step,
- final StringParameter selectedLangParam
- ) {
- super(itemModel, step, selectedLangParam);
- addSubmissionListener(this);
- }
-
- @Override
- protected void addWidgets() {
-
- super.addWidgets();
-
- reviewed = new CheckboxGroup("reviewedGroup");
- reviewed.addOption(
- new Option(
- MonographController.REVIEWED,
- new Label(
- new GlobalizedMessage(
- "publications.ui.monograph.reviewed",
- SciPublicationsConstants.BUNDLE
- )
- )
- )
- );
- reviewed.setLabel(
- new GlobalizedMessage(
- "publications.ui.monograph.reviewed",
- SciPublicationsConstants.BUNDLE
- )
- );
- add(reviewed);
- }
-
- @Override
- public void init(final FormSectionEvent event) throws FormProcessException {
- super.init(event);
-
- final FormData data = event.getFormData();
- final MonographItem monographItem = (MonographItem) super
- .initBasicWidgets(event);
- final Monograph monograph = monographItem.getPublication();
-
- if ((monograph.getReviewed() != null) && (monograph.getReviewed())) {
- reviewed.setValue(
- event.getPageState(),
- new String[]{MonographController.REVIEWED}
- );
- } else {
- reviewed.setValue(event.getPageState(), null);
- }
-
- }
-
- @Override
- public void process(final FormSectionEvent event)
- throws FormProcessException {
- super.process(event);
-
- final PageState state = event.getPageState();
- final MonographItem monographItem = (MonographItem) super
- .processBasicWidgets(event);
-
- if ((monographItem != null)
- && getSaveCancelSection().getSaveButton().isSelected(state)) {
-
- final Map data = new HashMap<>();
- if (reviewed.getValue(event.getPageState()) == null) {
- data.put(MonographController.REVIEWED, false);
- } else {
- data.put(MonographController.REVIEWED, true);
- }
-
- final MonographController controller = CdiUtil
- .createCdiUtil()
- .findBean(MonographController.class);
- controller.saveMonograph(
- monographItem.getPublication().getPublicationId(),
- data
- );
- }
- }
-
-}
diff --git a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ProceedingsController.java b/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ProceedingsController.java
deleted file mode 100644
index 803950d..0000000
--- a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ProceedingsController.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import org.librecms.assets.Organization;
-import org.librecms.contentsection.AssetRepository;
-import org.scientificcms.publications.InProceedings;
-import org.scientificcms.publications.Proceedings;
-import org.scientificcms.publications.ProceedingsManager;
-import org.scientificcms.publications.PublicationRepository;
-
-import java.time.LocalDate;
-import java.util.Map;
-
-import javax.enterprise.context.RequestScoped;
-import javax.inject.Inject;
-
-/**
- *
- * @author Jens Pelzetter
- */
-@RequestScoped
-public class ProceedingsController {
-
- public static final String NAME_OF_CONFERENCE = "nameOfConference";
-
- public static final String PLACE_OF_CONFERENCE = "placeOfConference";
-
- public static final String START_DATE = "startDate";
-
- public static final String END_DATE = "endDate";
-
- @Inject
- private AssetRepository assetRepository;
-
- @Inject
- private ProceedingsManager proceedingsManager;
-
- @Inject
- private PublicationRepository publicationRepository;
-
- public void saveProceedings(
- final long proceedingsId, final Map data
- ) {
- final Proceedings proceedings = publicationRepository
- .findByIdAndType(proceedingsId, Proceedings.class)
- .orElseThrow(
- () -> new IllegalArgumentException(
- String.format(
- "No Procceedings with ID %d found.", proceedingsId
- )
- )
- );
-
- if (data.containsKey(NAME_OF_CONFERENCE)) {
- proceedings.setNameOfConference(
- (String) data.get(NAME_OF_CONFERENCE)
- );
-
- }
-
- if (data.containsKey(PLACE_OF_CONFERENCE)) {
- proceedings.setPlaceOfConference((String) data.get(
- PLACE_OF_CONFERENCE)
- );
- }
-
- if (data.containsKey(START_DATE)) {
- proceedings.setStartDate((LocalDate) data.get(START_DATE));
- }
-
- if (data.containsKey(END_DATE)) {
- proceedings.setStartDate((LocalDate) data.get(END_DATE));
- }
-
- publicationRepository.save(proceedings);
- }
-
- public InProceedings findPaper(final long paperId) {
- final InProceedings paper = publicationRepository
- .findByIdAndType(paperId, InProceedings.class)
- .orElseThrow(
- () -> new IllegalArgumentException(
- String.format(
- "No InProcceedings with ID %d found.", paperId
- )
- )
- );
-
- return paper;
- }
-
- public void addPaper(final long proceedingsId, final long paperId) {
- final Proceedings proceedings = publicationRepository
- .findByIdAndType(proceedingsId, Proceedings.class)
- .orElseThrow(
- () -> new IllegalArgumentException(
- String.format(
- "No Procceedings with ID %d found.", proceedingsId
- )
- )
- );
-
- final InProceedings paper = publicationRepository
- .findByIdAndType(paperId, InProceedings.class)
- .orElseThrow(
- () -> new IllegalArgumentException(
- String.format(
- "No InProcceedings with ID %d found.", paperId
- )
- )
- );
-
- proceedingsManager.addPaperToCollectedVolume(paper, proceedings);
- }
-
- public void removePaper(final long proceedingsId, final long paperId) {
- final Proceedings proceedings = publicationRepository
- .findByIdAndType(proceedingsId, Proceedings.class)
- .orElseThrow(
- () -> new IllegalArgumentException(
- String.format(
- "No Procceedings with ID %d found.", proceedingsId
- )
- )
- );
-
- final InProceedings paper = publicationRepository
- .findByIdAndType(paperId, InProceedings.class)
- .orElseThrow(
- () -> new IllegalArgumentException(
- String.format(
- "No InProcceedings with ID %d found.", paperId
- )
- )
- );
-
- proceedingsManager.removeArticleFromCollectedVolume(paper, proceedings);
- }
-
- public void setOrganizier(final long proceedingsId, final long organizerId) {
- final Proceedings proceedings = publicationRepository
- .findByIdAndType(proceedingsId, Proceedings.class)
- .orElseThrow(
- () -> new IllegalArgumentException(
- String.format(
- "No Procceedings with ID %d found.", proceedingsId
- )
- )
- );
-
- final Organization organizer = assetRepository
- .findById(organizerId, Organization.class)
- .orElseThrow(
- () -> new IllegalArgumentException(
- String.format(
- "No Organization with ID %d found.", organizerId
- )
- )
- );
-
- proceedings.setOrganizer(organizer);
- publicationRepository.save(proceedings);
- }
-
- public void unsetOrganizier(final long proceedingsId) {
- final Proceedings proceedings = publicationRepository
- .findByIdAndType(proceedingsId, Proceedings.class)
- .orElseThrow(
- () -> new IllegalArgumentException(
- String.format(
- "No Procceedings with ID %d found.", proceedingsId
- )
- )
- );
-
- proceedings.setOrganizer(null);
- publicationRepository.save(proceedings);
- }
-
-}
diff --git a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ProceedingsCreateForm.java b/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ProceedingsCreateForm.java
deleted file mode 100644
index aa2fbce..0000000
--- a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ProceedingsCreateForm.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.parameters.StringParameter;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.ui.authoring.CreationSelector;
-
-import org.scientificcms.publications.Proceedings;
-import org.scientificcms.publications.contenttypes.ProceedingsItem;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class ProceedingsCreateForm
- extends AbstractPublicationCreateForm{
-
- public ProceedingsCreateForm(final ItemSelectionModel itemModel,
- final CreationSelector creationSelector,
- final StringParameter selectedLanguageParam) {
- super(itemModel, creationSelector, selectedLanguageParam);
- }
-
- @Override
- protected Proceedings createPublication() {
- return new Proceedings();
- }
-
-}
diff --git a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ProceedingsOrganizerForm.java b/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ProceedingsOrganizerForm.java
deleted file mode 100644
index 13401fc..0000000
--- a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ProceedingsOrganizerForm.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.FormProcessException;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.event.FormInitListener;
-import com.arsdigita.bebop.event.FormProcessListener;
-import com.arsdigita.bebop.event.FormSectionEvent;
-import com.arsdigita.bebop.parameters.StringParameter;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.ui.assets.AssetSearchWidget;
-import com.arsdigita.cms.ui.authoring.BasicItemForm;
-import com.arsdigita.globalization.GlobalizedMessage;
-
-import org.libreccm.cdi.utils.CdiUtil;
-import org.librecms.assets.Organization;
-import org.scientificcms.publications.SciPublicationsConstants;
-import org.scientificcms.publications.contenttypes.ProceedingsItem;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class ProceedingsOrganizerForm
- extends BasicItemForm
- implements FormProcessListener, FormInitListener {
-
- private static final String ORGA_SEARCH = "conferenceOrganization";
-
- private AssetSearchWidget orgaSearch;
-
- private final ItemSelectionModel itemModel;
-
- public ProceedingsOrganizerForm(
- final ItemSelectionModel itemModel,
- final StringParameter selectedLangParam
- ) {
- super("ProceeingsOrganizerForm", itemModel, selectedLangParam);
- this.itemModel = itemModel;
- }
-
- @Override
- protected void addWidgets() {
- orgaSearch = new AssetSearchWidget(
- ORGA_SEARCH, Organization.class
- );
- orgaSearch.setLabel(
- new GlobalizedMessage(
- "publications.ui.proceedings.organizer",
- SciPublicationsConstants.BUNDLE
- )
- );
- add(orgaSearch);
- }
-
- @Override
- public void init(final FormSectionEvent event) throws FormProcessException {
- final PageState state = event.getPageState();
-
- setVisible(state, true);
- }
-
- @Override
- public void process(final FormSectionEvent event)
- throws FormProcessException {
- final PageState state = event.getPageState();
- final ProceedingsItem proceedingsItem = (ProceedingsItem) itemModel.
- getSelectedItem(state);
-
- if (getSaveCancelSection().getSaveButton().isSelected(state)) {
- final Organization organization = (Organization) orgaSearch
- .getValue(state);
- final ProceedingsController controller = CdiUtil
- .createCdiUtil()
- .findBean(ProceedingsController.class);
- controller.setOrganizier(
- proceedingsItem.getPublication().getPublicationId(),
- organization.getObjectId()
- );
- }
-
- init(event);
- }
-
-}
diff --git a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ProceedingsOrganizerSheet.java b/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ProceedingsOrganizerSheet.java
deleted file mode 100644
index 5044535..0000000
--- a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ProceedingsOrganizerSheet.java
+++ /dev/null
@@ -1,269 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.Component;
-import com.arsdigita.bebop.ControlLink;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.Table;
-import com.arsdigita.bebop.Text;
-import com.arsdigita.bebop.event.TableActionEvent;
-import com.arsdigita.bebop.event.TableActionListener;
-import com.arsdigita.bebop.table.TableCellRenderer;
-import com.arsdigita.bebop.table.TableColumn;
-import com.arsdigita.bebop.table.TableColumnModel;
-import com.arsdigita.bebop.table.TableModel;
-import com.arsdigita.bebop.table.TableModelBuilder;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.globalization.GlobalizedMessage;
-import com.arsdigita.util.LockableImpl;
-
-import org.libreccm.cdi.utils.CdiUtil;
-import org.libreccm.security.PermissionChecker;
-import org.librecms.assets.Organization;
-import org.librecms.contentsection.privileges.ItemPrivileges;
-import org.scientificcms.publications.Proceedings;
-import org.scientificcms.publications.SciPublicationsConstants;
-import org.scientificcms.publications.contenttypes.ProceedingsItem;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class ProceedingsOrganizerSheet
- extends Table
- implements TableActionListener {
-
- private static final String TABLE_COL_EDIT = "table_col_edit";
-
- private static final String TABLE_COL_DEL = "table_col_del";
-
- private final ItemSelectionModel itemModel;
-
- public ProceedingsOrganizerSheet(final ItemSelectionModel itemModel) {
- super();
-
- this.itemModel = itemModel;
-
- setEmptyView(
- new Label(
- new GlobalizedMessage(
- "publications.ui.proceedings.organizer.none",
- SciPublicationsConstants.BUNDLE
- )
- )
- );
-
- final TableColumnModel columnModel = getColumnModel();
- columnModel.add(
- new TableColumn(
- 0,
- new Label(
- new GlobalizedMessage(
- "publications.ui.proceedings.organizer",
- SciPublicationsConstants.BUNDLE
- )
- ),
- TABLE_COL_EDIT
- )
- );
- columnModel.add(
- new TableColumn(
- 1,
- new Label(
- new GlobalizedMessage(
- "publications.ui.proceedings.organizer.remove",
- SciPublicationsConstants.BUNDLE
- )
- ),
- TABLE_COL_DEL
- )
- );
-
- setModelBuilder(new ProceedingsOrganizerSheetModelBuilder(itemModel));
- columnModel.get(0).setCellRenderer(new EditCellRenderer());
- columnModel.get(1).setCellRenderer(new DeleteCellRenderer());
-
- addTableActionListener(this);
- }
-
- @Override
- public void cellSelected(final TableActionEvent event) {
- final PageState state = event.getPageState();
-
- final ProceedingsItem proceedingsItem = (ProceedingsItem) itemModel
- .getSelectedItem(state);
-
- final TableColumn column = getColumnModel().get(event.getColumn());
-
- if (column.getHeaderKey().toString().equals(TABLE_COL_EDIT)) {
- // Nothing
- } else if (column.getHeaderKey().toString().equals(TABLE_COL_DEL)) {
- final ProceedingsController controller = CdiUtil
- .createCdiUtil()
- .findBean(ProceedingsController.class);
- controller.unsetOrganizier(
- proceedingsItem.getPublication().getPublicationId()
- );
- }
- }
-
- @Override
- public void headSelected(final TableActionEvent event) {
- //Nothing to do
- }
-
- private class ProceedingsOrganizerSheetModelBuilder
- extends LockableImpl
- implements TableModelBuilder {
-
- private final ItemSelectionModel itemModel;
-
- public ProceedingsOrganizerSheetModelBuilder(
- final ItemSelectionModel itemModel
- ) {
- this.itemModel = itemModel;
- }
-
- @Override
- public final TableModel makeModel(
- final Table table, final PageState state
- ) {
- table.getRowSelectionModel().clearSelection(state);
- final ProceedingsItem proceedingsItem = (ProceedingsItem) itemModel
- .getSelectedItem(state);
- return new ProceedingsOrganizerSheetModel(
- table, state, proceedingsItem.getPublication()
- );
- }
-
- }
-
- private class ProceedingsOrganizerSheetModel implements TableModel {
-
- private final Table table;
-
- private final Organization organizer;
-
- private boolean done;
-
- public ProceedingsOrganizerSheetModel(
- final Table table,
- final PageState state,
- final Proceedings proceedings
- ) {
- this.table = table;
- organizer = proceedings.getOrganizer();
- done = organizer != null;
- }
-
- @Override
- public int getColumnCount() {
- return table.getColumnModel().size();
- }
-
- @Override
- public boolean nextRow() {
- boolean ret;
-
- if (done) {
- ret = true;
- done = false;
- } else {
- ret = false;
- }
-
- return ret;
- }
-
- @Override
- public Object getElementAt(final int columnIndex) {
- switch (columnIndex) {
- case 0:
- return organizer.getTitle();
- case 1:
- return new Label(
- new GlobalizedMessage(
- "publications.ui.proceedings.organizer.remove",
- SciPublicationsConstants.BUNDLE
- )
- );
- default:
- return null;
- }
- }
-
- @Override
- public Object getKeyAt(final int columnIndex) {
- return organizer.getObjectId();
- }
-
- }
-
- private class EditCellRenderer
- extends LockableImpl
- implements TableCellRenderer {
-
- @Override
- public final Component getComponent(
- final Table table,
- final PageState state,
- final Object value,
- final boolean isSelected,
- final Object key,
- final int row,
- final int column
- ) {
- return new Text((String) value);
- }
-
- }
-
- private class DeleteCellRenderer
- extends LockableImpl
- implements TableCellRenderer {
-
- @Override
- public Component getComponent(
- final Table table,
- final PageState state,
- final Object value,
- final boolean isSelected,
- final Object key,
- final int row,
- final int col
- ) {
- final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
-
- final PermissionChecker permissionChecker = cdiUtil
- .findBean(PermissionChecker.class);
-
- final ProceedingsItem proceedingsItem = (ProceedingsItem) itemModel
- .getSelectedItem(state);
-
- final boolean canEdit = permissionChecker.isPermitted(
- ItemPrivileges.DELETE, proceedingsItem
- );
-
- if (canEdit) {
- final ControlLink link = new ControlLink((Component) value);
- link.setConfirmation(
- new GlobalizedMessage(
- "publication.ui.proceedings.organizer.remove.confirm",
- SciPublicationsConstants.BUNDLE
- )
- );
- return link;
- } else {
- return new Text("");
- }
- }
-
- }
-
-
-}
diff --git a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ProceedingsOrganizerStep.java b/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ProceedingsOrganizerStep.java
deleted file mode 100644
index e173042..0000000
--- a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ProceedingsOrganizerStep.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.parameters.StringParameter;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
-import com.arsdigita.cms.ui.authoring.BasicItemForm;
-import com.arsdigita.cms.ui.authoring.SimpleEditStep;
-import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
-import com.arsdigita.globalization.GlobalizedMessage;
-
-import org.scientificcms.publications.SciPublicationsConstants;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class ProceedingsOrganizerStep extends SimpleEditStep {
-
- private static final String SET_PROCEEDINGS_ORGANIZER_STEP
- = "setProceedingsOrganizerStep";
-
- public ProceedingsOrganizerStep(
- final ItemSelectionModel itemModel,
- final AuthoringKitWizard parent,
- final StringParameter selectedLangParam
- ) {
- this(itemModel, parent, selectedLangParam, null);
- }
-
- public ProceedingsOrganizerStep(
- final ItemSelectionModel itemModel,
- final AuthoringKitWizard parent,
- final StringParameter selectedLangParam,
- final String prefix
- ) {
- super(itemModel, parent, selectedLangParam, prefix);
-
- final BasicItemForm setOrganizerForm = new ProceedingsOrganizerForm(
- itemModel, selectedLangParam
- );
- add(
- SET_PROCEEDINGS_ORGANIZER_STEP,
- new GlobalizedMessage(
- "publications.ui.proceedings.setOrganizer",
- SciPublicationsConstants.BUNDLE
- ),
- new WorkflowLockedComponentAccess(setOrganizerForm, itemModel),
- setOrganizerForm.getSaveCancelSection().getCancelButton());
-
- final ProceedingsOrganizerSheet sheet = new ProceedingsOrganizerSheet(
- itemModel
- );
- setDisplayComponent(sheet);
- }
-
-}
diff --git a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ProceedingsPapersAddForm.java b/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ProceedingsPapersAddForm.java
deleted file mode 100644
index 4fff112..0000000
--- a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ProceedingsPapersAddForm.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.FormData;
-import com.arsdigita.bebop.FormProcessException;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.event.FormInitListener;
-import com.arsdigita.bebop.event.FormProcessListener;
-import com.arsdigita.bebop.event.FormSectionEvent;
-import com.arsdigita.bebop.parameters.StringParameter;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.ui.authoring.BasicItemForm;
-import com.arsdigita.globalization.GlobalizedMessage;
-
-import org.libreccm.cdi.utils.CdiUtil;
-import org.scientificcms.publications.InProceedings;
-import org.scientificcms.publications.Proceedings;
-import org.scientificcms.publications.SciPublicationsConstants;
-import org.scientificcms.publications.contenttypes.ProceedingsItem;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class ProceedingsPapersAddForm extends BasicItemForm
- implements FormProcessListener,
- FormInitListener {
-
- private static final String PAPER_SEARCH = "papers";
-
- private PublicationSearchWidget paperSearch;
-
- public ProceedingsPapersAddForm(
- final ItemSelectionModel itemModel,
- final StringParameter selectedLangParam
- ) {
- super("PapersAddForm", itemModel, selectedLangParam);
- }
-
- @Override
- protected void addWidgets() {
- paperSearch = new PublicationSearchWidget(
- PAPER_SEARCH, InProceedings.class
- );
- paperSearch.setLabel(
- new GlobalizedMessage(
- "publications.ui.proceedings.select_paper",
- SciPublicationsConstants.BUNDLE
- )
- );
- add(paperSearch);
- }
-
- @Override
- public void init(final FormSectionEvent event) throws FormProcessException {
- PageState state = event.getPageState();
- setVisible(state, true);
- }
-
- @Override
- public void process(final FormSectionEvent event)
- throws FormProcessException {
- final FormData formData = event.getFormData();
- final PageState state = event.getPageState();
- final ProceedingsItem proceedingsItem
- = (ProceedingsItem) getItemSelectionModel().
- getSelectedObject(state);
- final Proceedings proceedings = proceedingsItem.getPublication();
-
- if (getSaveCancelSection().getSaveButton().isSelected(state)) {
- final InProceedings paper = (InProceedings) formData.get(
- PAPER_SEARCH
- );
-
- final ProceedingsController controller = CdiUtil
- .createCdiUtil()
- .findBean(ProceedingsController.class);
- controller.addPaper(
- proceedings.getPublicationId(), paper.getPublicationId()
- );
-
- }
-
- init(event);
- }
-
-}
diff --git a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ProceedingsPapersStep.java b/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ProceedingsPapersStep.java
deleted file mode 100644
index 55ab63f..0000000
--- a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ProceedingsPapersStep.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.parameters.StringParameter;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
-import com.arsdigita.cms.ui.authoring.BasicItemForm;
-import com.arsdigita.cms.ui.authoring.SimpleEditStep;
-import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
-import com.arsdigita.globalization.GlobalizedMessage;
-
-import org.scientificcms.publications.SciPublicationsConstants;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class ProceedingsPapersStep extends SimpleEditStep {
-
- private static final String ADD_PAPER_SHEET_NAME = "addPaper";
-
- public ProceedingsPapersStep(
- final ItemSelectionModel itemModel,
- final AuthoringKitWizard parent,
- final StringParameter selectedLangParam
- ) {
- this(itemModel, parent, selectedLangParam, null);
- }
-
- public ProceedingsPapersStep(
- final ItemSelectionModel itemModel,
- final AuthoringKitWizard parent,
- final StringParameter selectedLangParam,
- final String prefix
- ) {
- super(itemModel, parent, selectedLangParam, prefix);
-
- BasicItemForm addPaperSheet = new ProceedingsPapersAddForm(
- itemModel, selectedLangParam
- );
- add(
- ADD_PAPER_SHEET_NAME,
- new GlobalizedMessage(
- "publications.ui.proceedings.add_paper",
- SciPublicationsConstants.BUNDLE
- ),
- new WorkflowLockedComponentAccess(addPaperSheet, itemModel),
- addPaperSheet.getSaveCancelSection().getCancelButton());
-
- final ProceedingsPapersTable papersTable = new ProceedingsPapersTable(
- itemModel
- );
- setDisplayComponent(papersTable);
-
- }
-
-}
diff --git a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ProceedingsPapersTable.java b/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ProceedingsPapersTable.java
deleted file mode 100644
index 3520c91..0000000
--- a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ProceedingsPapersTable.java
+++ /dev/null
@@ -1,274 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.Component;
-import com.arsdigita.bebop.ControlLink;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.Table;
-import com.arsdigita.bebop.Text;
-import com.arsdigita.bebop.event.TableActionEvent;
-import com.arsdigita.bebop.event.TableActionListener;
-import com.arsdigita.bebop.table.TableCellRenderer;
-import com.arsdigita.bebop.table.TableColumn;
-import com.arsdigita.bebop.table.TableColumnModel;
-import com.arsdigita.bebop.table.TableModel;
-import com.arsdigita.bebop.table.TableModelBuilder;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.dispatcher.Utilities;
-import com.arsdigita.globalization.GlobalizedMessage;
-import com.arsdigita.util.LockableImpl;
-
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-import org.libreccm.cdi.utils.CdiUtil;
-import org.libreccm.security.PermissionChecker;
-import org.librecms.contentsection.privileges.ItemPrivileges;
-import org.scientificcms.publications.InProceedings;
-import org.scientificcms.publications.Proceedings;
-import org.scientificcms.publications.SciPublicationsConstants;
-import org.scientificcms.publications.contenttypes.ProceedingsItem;
-
-import java.util.Iterator;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class ProceedingsPapersTable
- extends Table
- implements TableActionListener {
-
- private final Logger LOGGER = LogManager.getLogger(
- ProceedingsPapersTable.class);
-
- private final String TABLE_COL_EDIT = "table_col_edit";
-
- private final String TABLE_COL_DEL = "table_col_del";
-
- private final String TABLE_COL_UP = "table_col_up";
-
- private final String TABLE_COL_DOWN = "table_col_down";
-
- private final ItemSelectionModel itemModel;
-
- public ProceedingsPapersTable(final ItemSelectionModel itemModel) {
- super();
- this.itemModel = itemModel;
-
- setEmptyView(
- new Label(
- new GlobalizedMessage(
- "publications.ui.procreedings.no_papers",
- SciPublicationsConstants.BUNDLE
- )
- )
- );
-
- TableColumnModel colModel = getColumnModel();
- colModel.add(
- new TableColumn(
- 0,
- new Label(new GlobalizedMessage(
- "publications.ui.proceedings.paper",
- SciPublicationsConstants.BUNDLE
- )
- ),
- TABLE_COL_EDIT));
- colModel.add(
- new TableColumn(
- 1,
- new Label(
- new GlobalizedMessage(
- "publications.ui.proceedings.paper.remove",
- SciPublicationsConstants.BUNDLE
- )
- ),
- TABLE_COL_DEL));
-
- setModelBuilder(
- new ProceedingsPapersTableModelBuilder(itemModel));
-
- colModel.get(0).setCellRenderer(new EditCellRenderer());
- colModel.get(1).setCellRenderer(new DeleteCellRenderer());
-
- addTableActionListener(this);
- }
-
- @Override
- public void cellSelected(final TableActionEvent event) {
- final PageState state = event.getPageState();
-
- final ProceedingsController controller = CdiUtil
- .createCdiUtil()
- .findBean(ProceedingsController.class);
-
- final InProceedings paper = controller
- .findPaper((Long) event.getRowKey());
-
- final ProceedingsItem proceedingsItem = (ProceedingsItem) itemModel
- .getSelectedItem(state);
- final Proceedings proceedings = proceedingsItem.getPublication();
-
- TableColumn column = getColumnModel().get(event.getColumn());
-
- if (column.getHeaderKey().toString().equals(TABLE_COL_EDIT)) {
- // Nothing
- } else if (column.getHeaderKey().toString().equals(TABLE_COL_DEL)) {
- controller.removePaper(
- proceedings.getPublicationId(),
- paper.getPublicationId()
- );
- }
- }
-
- @Override
- public void headSelected(TableActionEvent event) {
- //Noting to do
- }
-
- private class ProceedingsPapersTableModelBuilder
- extends LockableImpl
- implements TableModelBuilder {
-
- private final ItemSelectionModel itemModel;
-
- public ProceedingsPapersTableModelBuilder(
- final ItemSelectionModel itemModel
- ) {
- this.itemModel = itemModel;
- }
-
- @Override
- public TableModel makeModel(final Table table, final PageState state) {
- table.getRowSelectionModel().clearSelection(state);
- final ProceedingsItem proceedings = (ProceedingsItem) itemModel
- .getSelectedObject(state);
- return new ProceedingsPapersTableModel(
- table, state, proceedings.getPublication()
- );
- }
-
- }
-
- private class ProceedingsPapersTableModel implements TableModel {
-
- private final Table table;
-
- private final Iterator papers;
-
- private InProceedings paper;
-
- private ProceedingsPapersTableModel(
- final Table table,
- final PageState state,
- final Proceedings proceedings
- ) {
- this.table = table;
- papers = proceedings.getPapers().iterator();
- }
-
- @Override
- public int getColumnCount() {
- return table.getColumnModel().size();
- }
-
- @Override
- public boolean nextRow() {
- if (papers != null && papers.hasNext()) {
- paper = papers.next();
- return true;
- } else {
- return false;
- }
- }
-
- @Override
- public Object getElementAt(final int columnIndex) {
- switch (columnIndex) {
- case 0:
- return paper.getTitle();
- case 1:
- return new Label(
- new GlobalizedMessage(
- "publications.ui.proceedings.paper.remove",
- SciPublicationsConstants.BUNDLE
- )
- );
- default:
- return null;
- }
- }
-
- @Override
- public Object getKeyAt(final int columnIndex) {
- return paper.getPublicationId();
- }
-
- }
-
- private class EditCellRenderer
- extends LockableImpl
- implements TableCellRenderer {
-
- @Override
- public Component getComponent(
- final Table table,
- final PageState state,
- final Object value,
- final boolean isSelected,
- final Object key,
- final int row,
- final int col
- ) {
- return new Text((String) value);
- }
-
- }
-
- private class DeleteCellRenderer
- extends LockableImpl
- implements TableCellRenderer {
-
- @Override
- public Component getComponent(
- final Table table,
- final PageState state,
- final Object value,
- final boolean isSelected,
- final Object key,
- final int row,
- final int column
- ) {
- final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
- final PermissionChecker permissionChecker = cdiUtil
- .findBean(PermissionChecker.class);
-
- final ProceedingsItem proceedingsItem = (ProceedingsItem) itemModel
- .getSelectedItem(state);
-
- final boolean canEdit = permissionChecker
- .isPermitted(ItemPrivileges.EDIT, proceedingsItem
- );
-
- if (canEdit) {
- final ControlLink link = new ControlLink((Component) value);
- link.setConfirmation(
- new GlobalizedMessage(
- "publications.ui.proceedings.paper.confirm_remove",
- SciPublicationsConstants.BUNDLE
- )
- );
- return link;
- } else {
- return new Text("");
- }
- }
-
- }
-
-}
diff --git a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ProceedingsPropertiesStep.java b/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ProceedingsPropertiesStep.java
deleted file mode 100644
index d4cc2c9..0000000
--- a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ProceedingsPropertiesStep.java
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.Component;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.parameters.StringParameter;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
-import com.arsdigita.cms.ui.authoring.BasicPageForm;
-import com.arsdigita.cms.ui.authoring.SimpleEditStep;
-import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
-import com.arsdigita.globalization.GlobalizedMessage;
-import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
-
-import org.librecms.CmsConstants;
-import org.scientificcms.publications.Proceedings;
-import org.scientificcms.publications.SciPublicationsConstants;
-import org.scientificcms.publications.contenttypes.ProceedingsItem;
-
-import java.text.DateFormat;
-import java.time.LocalDate;
-import java.time.ZoneId;
-import java.util.Date;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class ProceedingsPropertiesStep
- extends PublicationWithPublisherPropertiesStep {
-
- private StringParameter selectedLangParam;
-
- public ProceedingsPropertiesStep(
- final ItemSelectionModel itemModel,
- final AuthoringKitWizard parent,
- final StringParameter selectedLangParam
- ) {
- super(itemModel, parent, selectedLangParam);
- this.selectedLangParam = selectedLangParam;
- }
-
- public static Component getProceedingsPropertySheet(
- final ItemSelectionModel itemModel,
- final StringParameter selectedLangParam
- ) {
- final DomainObjectPropertySheet sheet
- = (DomainObjectPropertySheet) getPublicationWithPublisherPropertySheet(
- itemModel, selectedLangParam
- );
-
- sheet.add(
- new GlobalizedMessage(
- "publications.ui.proceedings.name_of_conference",
- SciPublicationsConstants.BUNDLE
- ),
- ProceedingsController.NAME_OF_CONFERENCE);
-
- sheet.add(new GlobalizedMessage(
- "publications.ui.proceedings.place_of_conference",
- SciPublicationsConstants.BUNDLE
- ),
- ProceedingsController.PLACE_OF_CONFERENCE);
-
- sheet.add(
- new GlobalizedMessage(
- "publications.ui.proceedings.date_from_of_conference",
- SciPublicationsConstants.BUNDLE
- ),
- ProceedingsController.START_DATE,
- new DomainObjectPropertySheet.AttributeFormatter() {
-
- public String format(
- final Object item,
- final String attribute,
- final PageState state
- ) {
- final ProceedingsItem proceedingsItem = (ProceedingsItem) item;
- final Proceedings proceedings = proceedingsItem.getPublication();
- if (proceedings.getStartDate() != null) {
- final LocalDate startLocalDate = proceedings.getStartDate();
- final Date startDate = Date.from(
- startLocalDate
- .atStartOfDay()
- .atZone(ZoneId.systemDefault())
- .toInstant()
- );
- return DateFormat.getDateInstance(DateFormat.LONG)
- .format(startDate);
- } else {
- return (String) new GlobalizedMessage(
- "cms.ui.unknown",
- CmsConstants.CMS_BUNDLE
- ).localize();
- }
- }
-
- });
-
- sheet.add(
- new GlobalizedMessage(
- "publications.ui.proceedings.date_to_of_conference",
- SciPublicationsConstants.BUNDLE
- ),
- ProceedingsController.END_DATE,
- new DomainObjectPropertySheet.AttributeFormatter() {
-
- public String format(
- final Object item,
- final String attribute,
- final PageState state
- ) {
- final ProceedingsItem proceedingsItem = (ProceedingsItem) item;
- final Proceedings proceedings = proceedingsItem.getPublication();
- if (proceedings.getEndDate() != null) {
- final LocalDate endLocalDate = proceedings.getEndDate();
- final Date endDate = Date.from(
- endLocalDate
- .atStartOfDay()
- .atZone(ZoneId.systemDefault())
- .toInstant()
- );
-
- return DateFormat.getDateInstance(DateFormat.LONG)
- .format(endDate);
- } else {
- return (String) new GlobalizedMessage(
- "cms.ui.unknown",
- CmsConstants.CMS_BUNDLE
- ).localize();
- }
- }
-
- });
-
- return sheet;
- }
-
- @Override
- protected void addBasicProperties(
- final ItemSelectionModel itemModel,
- final AuthoringKitWizard parent) {
- final SimpleEditStep basicProperties = new SimpleEditStep(
- itemModel, parent, selectedLangParam, EDIT_SHEET_NAME);
-
- BasicPageForm editBasicSheet = new ProceedingsPropertyForm(
- itemModel, this, selectedLangParam
- );
-
- basicProperties.add(
- EDIT_SHEET_NAME,
- new GlobalizedMessage(
- "publications.ui.proceedings.edit_basic_sheet",
- SciPublicationsConstants.BUNDLE
- ),
- new WorkflowLockedComponentAccess(editBasicSheet, itemModel),
- editBasicSheet.getSaveCancelSection().getCancelButton());
-
- basicProperties.setDisplayComponent(
- getProceedingsPropertySheet(itemModel, selectedLangParam)
- );
-
- getSegmentedPanel().addSegment(
- new Label(
- new GlobalizedMessage(
- "publications.ui.proceedings.basic_properties",
- SciPublicationsConstants.BUNDLE
- )
- ),
- basicProperties);
- }
-
- @Override
- protected void addSteps(
- final ItemSelectionModel itemModel, final AuthoringKitWizard parent) {
- super.addSteps(itemModel, parent);
-
- addStep(
- new ProceedingsOrganizerStep(itemModel, parent, selectedLangParam),
- new GlobalizedMessage(
- "publications.ui.proceedings.organizer",
- SciPublicationsConstants.BUNDLE
- )
- );
-
- addStep(
- new ProceedingsPapersStep(itemModel, parent, selectedLangParam),
- new GlobalizedMessage(
- "publications.ui.proceedings.papers",
- SciPublicationsConstants.BUNDLE
- )
- );
- }
-
-}
diff --git a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ProceedingsPropertyForm.java b/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ProceedingsPropertyForm.java
deleted file mode 100644
index 9a69cfa..0000000
--- a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ProceedingsPropertyForm.java
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.FormData;
-import com.arsdigita.bebop.FormProcessException;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.event.FormInitListener;
-import com.arsdigita.bebop.event.FormProcessListener;
-import com.arsdigita.bebop.event.FormSectionEvent;
-import com.arsdigita.bebop.event.FormSubmissionListener;
-import com.arsdigita.bebop.form.Date;
-import com.arsdigita.bebop.form.TextField;
-import com.arsdigita.bebop.parameters.DateParameter;
-import com.arsdigita.bebop.parameters.NotEmptyValidationListener;
-import com.arsdigita.bebop.parameters.NotNullValidationListener;
-import com.arsdigita.bebop.parameters.ParameterModel;
-import com.arsdigita.bebop.parameters.StringParameter;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.globalization.GlobalizedMessage;
-
-import org.libreccm.cdi.utils.CdiUtil;
-import org.scientificcms.publications.Proceedings;
-import org.scientificcms.publications.SciPublicationsConstants;
-import org.scientificcms.publications.contenttypes.ProceedingsItem;
-
-import java.time.LocalDate;
-import java.time.ZoneId;
-import java.util.Calendar;
-import java.util.GregorianCalendar;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class ProceedingsPropertyForm
- extends PublicationWithPublisherPropertyForm
- implements FormProcessListener, FormInitListener, FormSubmissionListener {
-
- public static final String ID = "proceedingsEdit";
-
- public ProceedingsPropertyForm(
- final ItemSelectionModel itemModel,
- final StringParameter selectedLangParam
- ) {
- this(itemModel, null, selectedLangParam);
- }
-
- public ProceedingsPropertyForm(
- final ItemSelectionModel itemModel,
- final ProceedingsPropertiesStep step,
- final StringParameter selectedLangParam
- ) {
- super(itemModel, step, selectedLangParam);
- //m_step = step;
- addSubmissionListener(this);
- }
-
- @Override
- protected void addWidgets() {
-
- super.addWidgets();
-
- final ParameterModel nameOfConfParam = new StringParameter(
- ProceedingsController.NAME_OF_CONFERENCE
- );
- final TextField nameOfConf = new TextField(nameOfConfParam);
- nameOfConf.addValidationListener(new NotNullValidationListener());
- nameOfConf.addValidationListener(new NotEmptyValidationListener());
- nameOfConf.setLabel(
- new GlobalizedMessage(
- "publications.ui.proceedings.name_of_conference",
- SciPublicationsConstants.BUNDLE
- )
- );
- add(nameOfConf);
-
- final ParameterModel placeOfConfParam = new StringParameter(
- ProceedingsController.PLACE_OF_CONFERENCE);
- final TextField placeOfConf = new TextField(placeOfConfParam);
- placeOfConf.setLabel(
- new GlobalizedMessage(
- "publications.ui.proceedings.place_of_conference",
- SciPublicationsConstants.BUNDLE
- )
- );
- add(placeOfConf);
-
- final Calendar today = new GregorianCalendar();
- final ParameterModel dateFromParam = new DateParameter(
- ProceedingsController.START_DATE);
- final Date dateFrom = new Date(dateFromParam);
- dateFrom.setYearRange(1900, today.get(Calendar.YEAR) + 3);
-
- dateFrom.setLabel(
- new GlobalizedMessage(
- "publications.ui.proceedings.date_from_of_conference",
- SciPublicationsConstants.BUNDLE
- )
- );
- add(dateFrom);
-
- final ParameterModel dateToParam = new DateParameter(
- ProceedingsController.END_DATE
- );
- final Date dateTo = new Date(dateToParam);
- dateTo.setYearRange(1900, today.get(Calendar.YEAR) + 3);
-
- dateTo.setLabel(
- new GlobalizedMessage(
- "publications.ui.proceedings.date_to_of_conference",
- SciPublicationsConstants.BUNDLE
- )
- );
- add(dateTo);
- }
-
- @Override
- public void init(final FormSectionEvent event) throws FormProcessException {
-
- super.init(event);
-
- final FormData data = event.getFormData();
- final ProceedingsItem proceedingsItem = (ProceedingsItem) super
- .initBasicWidgets(event);
- final Proceedings proceedings = proceedingsItem.getPublication();
-
- data.put(
- ProceedingsController.NAME_OF_CONFERENCE,
- proceedings.getNameOfConference()
- );
- data.put(
- ProceedingsController.PLACE_OF_CONFERENCE,
- proceedings.getPlaceOfConference()
- );
- final LocalDate localStartDate = proceedings.getStartDate();
- final java.util.Date startDate = java.util.Date.from(
- localStartDate.atStartOfDay().atZone(
- ZoneId.systemDefault()
- ).toInstant());
- data.put(ProceedingsController.START_DATE, startDate);
- final LocalDate localEndDate = proceedings.getEndDate();
- final java.util.Date endDate = java.util.Date.from(
- localEndDate.atStartOfDay().atZone(
- ZoneId.systemDefault()
- ).toInstant());
- data.put(ProceedingsController.END_DATE, endDate);
- }
-
- @Override
- public void process(final FormSectionEvent event)
- throws FormProcessException {
- super.process(event);
-
- final FormData formData = event.getFormData();
- final PageState state = event.getPageState();
- final ProceedingsItem proceedingsItem = (ProceedingsItem) super
- .processBasicWidgets(event);
-
- if ((proceedingsItem != null)
- && getSaveCancelSection().getSaveButton().isSelected(state)) {
-
- final Map data = new HashMap<>();
- data.put(
- ProceedingsController.NAME_OF_CONFERENCE,
- formData.get(ProceedingsController.NAME_OF_CONFERENCE)
- );
- data.put(
- ProceedingsController.PLACE_OF_CONFERENCE,
- formData.get(ProceedingsController.PLACE_OF_CONFERENCE)
- );
-
- final java.util.Date startDate = (java.util.Date) formData
- .get(ProceedingsController.START_DATE);
- data.put(
- ProceedingsController.START_DATE,
- startDate.toInstant().atZone(
- ZoneId.systemDefault()
- ).toLocalDate()
- );
-
- final java.util.Date endDate = (java.util.Date) formData
- .get(ProceedingsController.END_DATE);
- data.put(
- ProceedingsController.END_DATE,
- endDate.toInstant().atZone(
- ZoneId.systemDefault()
- ).toLocalDate()
- );
-
- final ProceedingsController controller = CdiUtil
- .createCdiUtil()
- .findBean(ProceedingsController.class);
- controller.saveProceedings(
- proceedingsItem.getPublication().getPublicationId(), data
- );
- }
- }
-
-}
diff --git a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/PublicationAuthorAddForm.java b/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/PublicationAuthorAddForm.java
deleted file mode 100644
index 1a6816f..0000000
--- a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/PublicationAuthorAddForm.java
+++ /dev/null
@@ -1,281 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.FormData;
-import com.arsdigita.bebop.FormProcessException;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.Text;
-import com.arsdigita.bebop.event.FormInitListener;
-import com.arsdigita.bebop.event.FormProcessListener;
-import com.arsdigita.bebop.event.FormSectionEvent;
-import com.arsdigita.bebop.event.FormSubmissionListener;
-import com.arsdigita.bebop.form.CheckboxGroup;
-import com.arsdigita.bebop.form.Option;
-import com.arsdigita.bebop.parameters.StringParameter;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.ui.assets.AssetSearchWidget;
-import com.arsdigita.cms.ui.assets.ItemSearchWidget;
-import com.arsdigita.cms.ui.authoring.BasicItemForm;
-import com.arsdigita.cms.ui.authoring.SimpleEditStep;
-import com.arsdigita.globalization.GlobalizedMessage;
-
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-import org.libreccm.cdi.utils.CdiUtil;
-import org.librecms.assets.Person;
-import org.scientificcms.publications.Publication;
-import org.scientificcms.publications.SciPublicationsConfig;
-import org.scientificcms.publications.SciPublicationsConstants;
-import org.scientificcms.publications.contenttypes.PublicationItem;
-
-import java.util.Objects;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class PublicationAuthorAddForm
- extends BasicItemForm
- implements FormProcessListener, FormInitListener, FormSubmissionListener {
-
- private static final Logger LOGGER = LogManager.getLogger(
- PublicationAuthorAddForm.class
- );
-
- private final static String AUTHOR_SEARCH = "authors";
-
- private final static SciPublicationsConfig CONFIG = SciPublicationsConfig
- .getConfig();
-
- private PublicationPropertiesStep step;
-
- private AssetSearchWidget authorSearchWidget;
-
- private final ItemSelectionModel itemModel;
-
- private final SimpleEditStep editStep;
-
- private Text selectedAuthorLabel;
-
- private CheckboxGroup isEditor;
-
- public PublicationAuthorAddForm(
- final ItemSelectionModel itemModel,
- final SimpleEditStep editStep,
- final StringParameter selectedLanguageParam
- ) {
- super("AuthorsEntryForm", itemModel, selectedLanguageParam);
- this.itemModel = itemModel;
- this.editStep = editStep;
- addSubmissionListener(this);
- }
-
- @Override
- protected void addWidgets() {
-
- authorSearchWidget = new AssetSearchWidget(
- AUTHOR_SEARCH, Person.class
- );
- authorSearchWidget.setLabel(
- new GlobalizedMessage(
- "publications.ui.authors.selectAuthor",
- SciPublicationsConstants.BUNDLE
- )
- );
- add(authorSearchWidget);
-
- selectedAuthorLabel = new Text();
- add(selectedAuthorLabel);
-
- isEditor = new CheckboxGroup("isEditorGroup");
- isEditor.addOption(
- new Option(
- SciPublicationsController.AUTHORSHIP_IS_EDITOR,
- new Label(
- new GlobalizedMessage(
- "publications.ui.authors.author.is_editor",
- SciPublicationsConstants.BUNDLE
- )
- )
- )
- );
- add(isEditor);
- }
-
- @Override
- public void init(final FormSectionEvent event) throws FormProcessException {
-
- final FormData formData = event.getFormData();
- final PageState state = event.getPageState();
-
- final Person author;
- final Boolean editor;
-
- author = ((PublicationAuthorsPropertyStep) editStep).getSelectedAuthor();
- editor = ((PublicationAuthorsPropertyStep) editStep)
- .isSelectedAuthorEditor();
-
- if (author == null) {
- LOGGER.warn("No author selected.");
-
- authorSearchWidget.setVisible(state, true);
- selectedAuthorLabel.setVisible(state, false);
- } else {
- LOGGER.warn(
- String.format(
- "Author is here: %s", Objects.toString(author)
- )
- );
-
- formData.put(AUTHOR_SEARCH, author);
- if ((editor != null) && editor) {
- isEditor.setValue(
- state,
- new String[]{
- SciPublicationsController.AUTHORSHIP_IS_EDITOR
- }
- );
- } else {
- isEditor.setValue(state, null);
- }
-
- authorSearchWidget.setVisible(state, false);
- selectedAuthorLabel.setText(
- String.format("%s, %s",
- author.getPersonName().getSurname(),
- author.getPersonName().getGivenName()
- )
- );
- selectedAuthorLabel.setVisible(state, true);
- }
-
- setVisible(state, true);
- }
-
- @Override
- public void process(final FormSectionEvent event)
- throws FormProcessException {
-
- final FormData formData = event.getFormData();
- final PageState state = event.getPageState();
-
- final PublicationItem> item = (PublicationItem) itemModel
- .getSelectedItem(state);
- final Publication publication = item.getPublication();
-
- if (getSaveCancelSection().getSaveButton().isSelected(state)) {
-
- final Person author = ((PublicationAuthorsPropertyStep) editStep)
- .getSelectedAuthor();
-
- final Boolean editor;
- if (isEditor.getValue(state) == null) {
- editor = Boolean.FALSE;
- } else {
- editor = Boolean.TRUE;
- }
-
- final SciPublicationsController controller = CdiUtil
- .createCdiUtil()
- .findBean(SciPublicationsController.class);
- if (author == null) {
- final Person authorToAdd = (Person) formData.get(
- AUTHOR_SEARCH
- );
-
- controller.addAuthor(
- publication.getPublicationId(),
- authorToAdd.getObjectId(),
- editor
- );
- } else {
-
- controller.updateAuthorship(publication.getPublicationId(),
- author.getObjectId(),
- editor);
-
- ((PublicationAuthorsPropertyStep) editStep)
- .setSelectedAuthor(null);
- ((PublicationAuthorsPropertyStep) editStep)
- .setSelectedAuthorEditor(null);
-
- }
- }
-
- init(event);
- }
-
- @Override
- public void submitted(final FormSectionEvent fse) throws
- FormProcessException {
- if (getSaveCancelSection().getCancelButton()
- .isSelected(fse.getPageState())) {
- ((PublicationAuthorsPropertyStep) editStep)
- .setSelectedAuthor(null);
- ((PublicationAuthorsPropertyStep) editStep)
- .setSelectedAuthorEditor(null);
-
- init(fse);
- }
- }
-
- @Override
- public void validate(final FormSectionEvent event)
- throws FormProcessException {
-
- final PageState state = event.getPageState();
- final FormData formData = event.getFormData();
- boolean editing = false; //Are we editing the association
-
- if ((((PublicationAuthorsPropertyStep) editStep)
- .getSelectedAuthor() == null)
- && (formData.get(AUTHOR_SEARCH) == null)) {
- formData.addError(
- new GlobalizedMessage(
- "publications.ui.authors.selectAuthor.no_author_selected",
- SciPublicationsConstants.BUNDLE
- )
- );
- return;
- }
-
- final PublicationItem> item
- = (PublicationItem>) getItemSelectionModel()
- .getSelectedObject(state);
- final Person author;
- if (formData.get(AUTHOR_SEARCH) == null) {
- author = ((PublicationAuthorsPropertyStep) editStep)
- .getSelectedAuthor();
- editing = true;
- } else {
- author = (Person) formData.get(AUTHOR_SEARCH);
- }
-
- if (!editing) {
-
- final SciPublicationsController controller = CdiUtil
- .createCdiUtil()
- .findBean(SciPublicationsController.class);
-
- final boolean hasAuthor = controller.hasAuthor(
- item.getPublication().getPublicationId(),
- author.getObjectId()
- );
-
- if (hasAuthor) {
- formData.addError(
- new GlobalizedMessage(
- "publications.ui.authors.selectAuthor.already_added",
- SciPublicationsConstants.BUNDLE
- )
- );
- }
- }
- }
-
-}
diff --git a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/PublicationAuthorsPropertyStep.java b/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/PublicationAuthorsPropertyStep.java
deleted file mode 100644
index 0ad034c..0000000
--- a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/PublicationAuthorsPropertyStep.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.parameters.StringParameter;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
-import com.arsdigita.cms.ui.authoring.BasicItemForm;
-import com.arsdigita.cms.ui.authoring.SimpleEditStep;
-import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
-import com.arsdigita.globalization.GlobalizedMessage;
-
-import org.librecms.assets.Person;
-import org.scientificcms.publications.SciPublicationsConstants;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class PublicationAuthorsPropertyStep extends SimpleEditStep {
-
- public static final String ADD_AUTHOR_SHEET_NAME = "addAuthor";
-
- private Person selectedAuthor;
-
- private Boolean selectedAuthorEditor;
-
- public PublicationAuthorsPropertyStep(
- final ItemSelectionModel itemModel,
- final AuthoringKitWizard parent,
- final StringParameter selectedLanguageParam
- ) {
- this(itemModel, parent, selectedLanguageParam, null);
- }
-
- public PublicationAuthorsPropertyStep(
- final ItemSelectionModel itemModel,
- final AuthoringKitWizard authoringKitWizard,
- final StringParameter selectedLanguageParameter,
- final String prefix
- ) {
- super(itemModel, authoringKitWizard, selectedLanguageParameter, prefix);
-
- final BasicItemForm addAuthorSheet = new PublicationAuthorAddForm(
- itemModel, this, selectedLanguageParameter
- );
- add(ADD_AUTHOR_SHEET_NAME,
- new GlobalizedMessage(
- "publications.ui.authors.add_author",
- SciPublicationsConstants.BUNDLE
- ),
- new WorkflowLockedComponentAccess(addAuthorSheet, itemModel),
- addAuthorSheet.getSaveCancelSection().getCancelButton());
-
- final PublicationAuthorsTable authorsTable = new PublicationAuthorsTable(
- itemModel, this);
- setDisplayComponent(authorsTable);
- }
-
- protected Person getSelectedAuthor() {
- return selectedAuthor;
- }
-
- protected Boolean isSelectedAuthorEditor() {
- return selectedAuthorEditor;
- }
-
- protected void setSelectedAuthor(final Person selectedAuthor) {
- this.selectedAuthor = selectedAuthor;
- }
-
- protected void setSelectedAuthorEditor(final Boolean selectedAuthorEditor) {
- this.selectedAuthorEditor = selectedAuthorEditor;
- }
-
-
-
-}
diff --git a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/PublicationAuthorsTable.java b/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/PublicationAuthorsTable.java
deleted file mode 100644
index da9a22c..0000000
--- a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/PublicationAuthorsTable.java
+++ /dev/null
@@ -1,489 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.Component;
-import com.arsdigita.bebop.ControlLink;
-import com.arsdigita.bebop.FormProcessException;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.Table;
-import com.arsdigita.bebop.Text;
-import com.arsdigita.bebop.event.TableActionEvent;
-import com.arsdigita.bebop.event.TableActionListener;
-import com.arsdigita.bebop.table.TableCellRenderer;
-import com.arsdigita.bebop.table.TableColumn;
-import com.arsdigita.bebop.table.TableColumnModel;
-import com.arsdigita.bebop.table.TableModel;
-import com.arsdigita.bebop.table.TableModelBuilder;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.globalization.GlobalizedMessage;
-import com.arsdigita.util.LockableImpl;
-
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-import org.libreccm.cdi.utils.CdiUtil;
-import org.libreccm.security.PermissionChecker;
-import org.librecms.contentsection.privileges.ItemPrivileges;
-import org.scientificcms.publications.Authorship;
-import org.scientificcms.publications.SciPublicationsConstants;
-import org.scientificcms.publications.contenttypes.PublicationItem;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class PublicationAuthorsTable
- extends Table
- implements TableActionListener {
-
- private static final Logger LOGGER = LogManager.getLogger(
- PublicationAuthorsTable.class
- );
-
- private final String TABLE_COL_EDIT = "table_col_edit";
-
- private final String TABLE_COL_EDIT_ASSOC = "table_col_edit_assoc";
-
- private final String TABLE_COL_DEL = "table_col_del";
-
- private final String TABLE_COL_UP = "table_col_up";
-
- private final String TABLE_COL_DOWN = "table_col_down";
-
- public static final String SELECTED_PUBLICATION
- = "selected_publication_author_association_publication";
-
- public static final String SELECTED_AUTHOR
- = "selected_publication_author_association_author";
-
- private final ItemSelectionModel itemModel;
-
- private final PublicationAuthorsPropertyStep editStep;
-
- public PublicationAuthorsTable(
- final ItemSelectionModel itemModel,
- final PublicationAuthorsPropertyStep editStep
- ) {
- super();
- this.itemModel = itemModel;
- this.editStep = editStep;
-
- setEmptyView(
- new Label(
- new GlobalizedMessage(
- "publications.ui.authors.none",
- SciPublicationsConstants.BUNDLE
- )
- )
- );
-
- final TableColumnModel colModel = getColumnModel();
- colModel.add(
- new TableColumn(
- 0,
- new GlobalizedMessage(
- "publications.ui.authors.author.name",
- SciPublicationsConstants.BUNDLE
- ),
- TABLE_COL_EDIT
- )
- );
- colModel.add(
- new TableColumn(
- 1,
- new GlobalizedMessage(
- "publications.ui.authors.author.isEditor",
- SciPublicationsConstants.BUNDLE
- )
- )
- );
- colModel.add(
- new TableColumn(
- 2,
- new GlobalizedMessage(
- "publications.ui.authors.edit_assoc",
- SciPublicationsConstants.BUNDLE
- ),
- TABLE_COL_EDIT_ASSOC
- )
- );
- colModel.add(
- new TableColumn(
- 3,
- new GlobalizedMessage(
- "publications.ui.authors.author.delete",
- SciPublicationsConstants.BUNDLE
- ),
- TABLE_COL_DEL
- )
- );
- colModel.add(
- new TableColumn(
- 4,
- new GlobalizedMessage(
- "publications.ui.authors.author.up",
- SciPublicationsConstants.BUNDLE
- ),
- TABLE_COL_UP));
- colModel.add(
- new TableColumn(
- 5,
- new GlobalizedMessage(
- "publications.ui.authors.author.down",
- SciPublicationsConstants.BUNDLE
- ),
- TABLE_COL_DOWN
- )
- );
-
- setModelBuilder(
- new PublicationAuthorsTableModelBuilder(itemModel));
-
- colModel.get(0).setCellRenderer(new EditCellRenderer());
- colModel.get(2).setCellRenderer(new EditAssocCellRenderer());
- colModel.get(3).setCellRenderer(new DeleteCellRenderer());
- colModel.get(4).setCellRenderer(new UpCellRenderer());
- colModel.get(5).setCellRenderer(new DownCellRenderer());
-
- LOGGER.info("Adding table action listener...");
- addTableActionListener(this);
- }
-
- @Override
- public void cellSelected(final TableActionEvent event)
- throws FormProcessException {
-
- final PageState state = event.getPageState();
- final PublicationItem> selected = (PublicationItem>) itemModel
- .getSelectedItem(state);
- final SciPublicationsController controller = CdiUtil
- .createCdiUtil()
- .findBean(SciPublicationsController.class);
- final Authorship authorship = controller.findAuthorship(
- selected.getPublication().getPublicationId(),
- event.getRowKey()
- ).get();
-
- final TableColumn column = getColumnModel().get(event.getColumn());
-
- if (TABLE_COL_EDIT_ASSOC.equals(column.getHeaderKey())) {
- editStep.setSelectedAuthor(authorship.getAuthor());
- editStep.setSelectedAuthorEditor(authorship.isEditor());
-
- editStep.showComponent(state, "AuthorsEntryForm");
- } else if (TABLE_COL_DEL.equals(column.getHeaderKey())) {
- controller.removeAuthor(
- selected.getPublication().getPublicationId(),
- authorship.getAuthorshipId()
- );
- } else if (TABLE_COL_UP.equals(column.getHeaderKey())) {
- controller.swapWithPrevAuthorship(
- selected.getPublication().getPublicationId(),
- authorship.getAuthorshipId()
- );
- } else if (TABLE_COL_DOWN.equals(column.getHeaderKey())) {
- controller.swapWithNextAuthorship(
- selected.getPublication().getPublicationId(),
- authorship.getAuthorshipId()
- );
-
- }
- }
-
- @Override
- public void headSelected(final TableActionEvent event) {
-
- // Nothing
- }
-
- private class PublicationAuthorsTableModelBuilder
- extends LockableImpl
- implements TableModelBuilder {
-
- private ItemSelectionModel itemModel;
-
- public PublicationAuthorsTableModelBuilder(
- final ItemSelectionModel itemModel
- ) {
- this.itemModel = itemModel;
- }
-
- @Override
- public TableModel makeModel(final Table table, final PageState state) {
-
- table.getRowSelectionModel().clearSelection(state);
- final PublicationItem> publication = (PublicationItem) itemModel
- .getSelectedObject(state);
- return new PublicationAuthorsTableModel(table, state, publication);
- }
-
- }
-
- private class PublicationAuthorsTableModel implements TableModel {
-
- private static final int MAX_DESC_LENGTH = 25;
-
- private final Table table;
-
- private final Iterator