All forms for SciProject migrated
parent
9e3dfc8265
commit
55e3fda082
|
|
@ -20,7 +20,7 @@
|
|||
<groupId>org.scientificcms</groupId>
|
||||
<artifactId>sci-types-project</artifactId>
|
||||
|
||||
<name>sci-types-project</name>
|
||||
<name>ScientificCMS SciProject Content Type</name>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
|
|
|||
|
|
@ -44,11 +44,11 @@ class SciProjectController {
|
|||
public static final String CONTACT_TYPE = "contactType";
|
||||
|
||||
public static final String CONTACT_ID = "contactId";
|
||||
|
||||
|
||||
public static final String SPONSOR_ID = "sponsorId";
|
||||
|
||||
|
||||
public static final String SPONSOR_NAME = "name";
|
||||
|
||||
|
||||
public static final String SPONSOR_FUNDING_CODE = "fundingCode";
|
||||
|
||||
@Inject
|
||||
|
|
@ -204,7 +204,7 @@ class SciProjectController {
|
|||
}
|
||||
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
public void swapWithPreviousContact(final long projectId,
|
||||
public void swapWithPreviousContact(final long projectId,
|
||||
final long contactId) {
|
||||
|
||||
final SciProject project = projectRepository
|
||||
|
|
@ -240,7 +240,7 @@ class SciProjectController {
|
|||
}
|
||||
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
public void swapWithNextContact(final long projectId,
|
||||
public void swapWithNextContact(final long projectId,
|
||||
final long contactId) {
|
||||
|
||||
final SciProject project = projectRepository
|
||||
|
|
@ -318,12 +318,12 @@ class SciProjectController {
|
|||
|
||||
projectRepository.save(project);
|
||||
}
|
||||
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
public Optional<Sponsoring> findSponsoring(final long projectId,
|
||||
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
public Optional<Sponsoring> findSponsoring(final long projectId,
|
||||
final Object key) {
|
||||
|
||||
final SciProject project = projectRepository
|
||||
|
||||
final SciProject project = projectRepository
|
||||
.findById(projectId, SciProject.class)
|
||||
.orElseThrow(
|
||||
() -> new IllegalArgumentException(
|
||||
|
|
@ -332,18 +332,18 @@ class SciProjectController {
|
|||
);
|
||||
|
||||
final long sponsoringId = (long) key;
|
||||
|
||||
|
||||
return project
|
||||
.getSponsoring()
|
||||
.stream()
|
||||
.filter(sponsoring -> sponsoring.getSponsoringId() == sponsoringId)
|
||||
.findAny();
|
||||
}
|
||||
|
||||
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
public List<Map<String, Object>> getSponsors(final long forProjectId) {
|
||||
|
||||
final SciProject project = projectRepository
|
||||
|
||||
final SciProject project = projectRepository
|
||||
.findById(forProjectId, SciProject.class)
|
||||
.orElseThrow(
|
||||
() -> new IllegalArgumentException(
|
||||
|
|
@ -357,16 +357,16 @@ class SciProjectController {
|
|||
.map(this::buildSponsorEntry)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
private Map<String, Object> buildSponsorEntry(final Sponsoring sponsoring) {
|
||||
|
||||
|
||||
Objects.requireNonNull(sponsoring);
|
||||
|
||||
|
||||
final Map<String, Object> result = new HashMap<>();
|
||||
result.put(SPONSOR_ID, sponsoring.getSponsoringId());
|
||||
result.put(SPONSOR_NAME, sponsoring.getSponsor().getName());
|
||||
result.put(SPONSOR_FUNDING_CODE, sponsoring.getFundingCode());
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
@ -462,7 +462,7 @@ class SciProjectController {
|
|||
projectRepository.save(project);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
public void swapWithPrevSponsoring(final long projectId,
|
||||
final long sponsoringId) {
|
||||
|
|
@ -473,27 +473,27 @@ class SciProjectController {
|
|||
String.format("No SciProject with ID %d found.",
|
||||
projectId))
|
||||
);
|
||||
|
||||
|
||||
final List<Sponsoring> sponsoringList = project.getSponsoring();
|
||||
Sponsoring sponsoring = null;
|
||||
int index = -1;
|
||||
for (int i = 0; i < sponsoringList.size(); i++) {
|
||||
|
||||
|
||||
if (sponsoringList.get(i).getSponsoringId() == sponsoringId) {
|
||||
sponsoring = sponsoringList.get(i);
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (index > 0 && sponsoring != null) {
|
||||
final long order = sponsoring.getOrder();
|
||||
final Sponsoring prevSponsoring = sponsoringList.get(index - 1);
|
||||
final long prevOrder = prevSponsoring.getOrder();
|
||||
|
||||
|
||||
sponsoring.setOrder(prevOrder);
|
||||
prevSponsoring.setOrder(order);
|
||||
|
||||
|
||||
projectRepository.save(project);
|
||||
}
|
||||
}
|
||||
|
|
@ -508,31 +508,62 @@ class SciProjectController {
|
|||
String.format("No SciProject with ID %d found.",
|
||||
projectId))
|
||||
);
|
||||
|
||||
final List<Sponsoring> sponsoringList = project.getSponsoring();
|
||||
|
||||
final List<Sponsoring> sponsoringList = project.getSponsoring();
|
||||
Sponsoring sponsoring = null;
|
||||
int index = -1;
|
||||
for (int i = 0; i < sponsoringList.size(); i++) {
|
||||
|
||||
|
||||
if (sponsoringList.get(i).getSponsoringId() == sponsoringId) {
|
||||
sponsoring = sponsoringList.get(i);
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (index > 0 && sponsoring != null) {
|
||||
final long order = sponsoring.getOrder();
|
||||
final Sponsoring nextSponsoring = sponsoringList.get(index + 1);
|
||||
final long nextOrder = nextSponsoring.getOrder();
|
||||
|
||||
|
||||
sponsoring.setOrder(nextOrder);
|
||||
nextSponsoring.setOrder(order);
|
||||
|
||||
|
||||
projectRepository.save(project);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
public void updateFundingData(final long projectId,
|
||||
final Locale locale,
|
||||
final Map<String, Object> data) {
|
||||
|
||||
final SciProject project = projectRepository
|
||||
.findById(projectId, SciProject.class)
|
||||
.orElseThrow(
|
||||
() -> new IllegalArgumentException(
|
||||
String.format("No SciProject with ID %d found.",
|
||||
projectId))
|
||||
);
|
||||
|
||||
final SciProjectConfig config = confManager
|
||||
.findConfiguration(SciProjectConfig.class);
|
||||
|
||||
if (config.isEnableFunding()) {
|
||||
final String funding = (String) data
|
||||
.get(SciProjectUiConstants.FUNDING);
|
||||
project.getFunding().addValue(locale, funding);
|
||||
}
|
||||
|
||||
if (config.isEnableFundingVolume()) {
|
||||
final String volume = (String) data
|
||||
.get(SciProjectUiConstants.FUNDING_VOLUME);
|
||||
project.getFundingVolume().addValue(locale, volume);
|
||||
}
|
||||
|
||||
projectRepository.save(project);
|
||||
}
|
||||
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
public void save(final long projectId,
|
||||
final Locale selectedLocale,
|
||||
|
|
|
|||
|
|
@ -64,7 +64,9 @@ public class SciProjectDescriptionStep extends SimpleEditStep {
|
|||
}
|
||||
|
||||
if (config.isEnableFunding()) {
|
||||
addStep(new SciProjectFundingStep(itemModel, parent),
|
||||
addStep(new SciProjectFundingStep(itemModel,
|
||||
parent,
|
||||
selectedLanguageParam),
|
||||
"sciproject.ui.steps.funding.title");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,159 @@
|
|||
/* ;
|
||||
* Copyright (c) 2013 Jens Pelzetter
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
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.form.TextArea;
|
||||
import com.arsdigita.bebop.form.TextField;
|
||||
import com.arsdigita.bebop.parameters.ParameterModel;
|
||||
import com.arsdigita.bebop.parameters.StringInRangeValidationListener;
|
||||
import com.arsdigita.bebop.parameters.StringParameter;
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
|
||||
import com.arsdigita.cms.ui.CMSDHTMLEditor;
|
||||
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||
import com.arsdigita.cms.ui.authoring.SelectedLanguageUtil;
|
||||
import com.arsdigita.globalization.GlobalizedMessage;
|
||||
|
||||
import org.libreccm.cdi.utils.CdiUtil;
|
||||
import org.scientificcms.contenttypes.sciproject.SciProject;
|
||||
import org.scientificcms.contenttypes.sciproject.SciProjectConfig;
|
||||
import org.scientificcms.contenttypes.sciproject.SciProjectConstants;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Jens Pelzetter <jens@jp-digital.de>
|
||||
*/
|
||||
public class SciProjectFundingEditForm
|
||||
extends BasicItemForm
|
||||
implements FormProcessListener, FormInitListener {
|
||||
|
||||
private final static SciProjectConfig CONFIG = SciProjectConfig.getConfig();
|
||||
|
||||
private final StringParameter selectedLanguageParam;
|
||||
|
||||
public SciProjectFundingEditForm(
|
||||
final ItemSelectionModel itemModel,
|
||||
final StringParameter selectedLanguageParam) {
|
||||
|
||||
super("SciProjectFundingForm", itemModel, selectedLanguageParam);
|
||||
this.selectedLanguageParam = selectedLanguageParam;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addWidgets() {
|
||||
|
||||
if (CONFIG.isEnableFunding()) {
|
||||
final ParameterModel fundingParam = new StringParameter(
|
||||
SciProjectUiConstants.FUNDING);
|
||||
final TextArea funding;
|
||||
if (CONFIG.isEnableFundingDhtml()) {
|
||||
funding = new CMSDHTMLEditor(fundingParam);
|
||||
} else {
|
||||
funding = new TextArea(fundingParam);
|
||||
}
|
||||
funding.setLabel(new GlobalizedMessage(
|
||||
"sciproject.ui.funding",
|
||||
SciProjectConstants.SCI_PROJECT_BUNDLE));
|
||||
funding.setCols(75);
|
||||
funding.setRows(8);
|
||||
add(funding);
|
||||
}
|
||||
|
||||
if (CONFIG.isEnableFundingVolume()) {
|
||||
final ParameterModel fundingVolumeParam = new StringParameter(
|
||||
SciProjectUiConstants.FUNDING_VOLUME);
|
||||
final TextField fundingVolume = new TextField(fundingVolumeParam);
|
||||
fundingVolume.addValidationListener(
|
||||
new StringInRangeValidationListener(
|
||||
0,
|
||||
CONFIG.getFundingVolumeLength()));
|
||||
fundingVolume.setLabel(new GlobalizedMessage(
|
||||
"sciproject.ui.funding.volume",
|
||||
SciProjectConstants.SCI_PROJECT_BUNDLE));
|
||||
add(fundingVolume);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(final FormSectionEvent event) throws FormProcessException {
|
||||
final PageState state = event.getPageState();
|
||||
final FormData data = event.getFormData();
|
||||
final Locale locale = SelectedLanguageUtil
|
||||
.selectedLocale(state, selectedLanguageParam);
|
||||
final SciProject project = (SciProject) getItemSelectionModel()
|
||||
.getSelectedObject(state);
|
||||
|
||||
if (CONFIG.isEnableFunding()) {
|
||||
data.put(SciProjectUiConstants.FUNDING,
|
||||
project.getFunding().getValue(locale));
|
||||
}
|
||||
|
||||
if (CONFIG.isEnableFundingVolume()) {
|
||||
data.put(SciProjectUiConstants.FUNDING_VOLUME,
|
||||
project.getFundingVolume().getValue(locale));
|
||||
}
|
||||
|
||||
setVisible(state, true);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(final FormSectionEvent event) throws
|
||||
FormProcessException {
|
||||
final PageState state = event.getPageState();
|
||||
final FormData formData = event.getFormData();
|
||||
final Locale locale = SelectedLanguageUtil
|
||||
.selectedLocale(state, selectedLanguageParam);
|
||||
final SciProject project = (SciProject) getItemSelectionModel()
|
||||
.getSelectedObject(state);
|
||||
|
||||
if ((project != null)
|
||||
&& getSaveCancelSection().getSaveButton().isSelected(state)) {
|
||||
|
||||
final Map<String, Object> data = new HashMap<>();
|
||||
|
||||
if (CONFIG.isEnableFunding()) {
|
||||
data.put(SciProjectUiConstants.FUNDING,
|
||||
formData.get(SciProjectUiConstants.FUNDING));
|
||||
}
|
||||
if (CONFIG.isEnableFundingVolume()) {
|
||||
data.put(SciProjectUiConstants.FUNDING_VOLUME,
|
||||
formData.get(SciProjectUiConstants.FUNDING_VOLUME));
|
||||
}
|
||||
|
||||
final SciProjectController controller = CdiUtil
|
||||
.createCdiUtil()
|
||||
.findBean(SciProjectController.class);
|
||||
controller.updateFundingData(project.getObjectId(), locale, data);
|
||||
}
|
||||
|
||||
init(event);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,83 @@
|
|||
package com.arsdigita.cms.contenttypes.ui;
|
||||
|
||||
import com.arsdigita.bebop.Component;
|
||||
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 com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
|
||||
|
||||
import org.scientificcms.contenttypes.sciproject.SciProjectConfig;
|
||||
import org.scientificcms.contenttypes.sciproject.SciProjectConstants;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Jens Pelzetter <jens@jp-digital.de>
|
||||
* @version $Id: SciProjectFundingStep.java 2334 2013-10-03 07:51:31Z jensp $
|
||||
*/
|
||||
public class SciProjectFundingStep extends SimpleEditStep {
|
||||
|
||||
private static final String EDIT_PROJECT_FUNDING_SHEET_NAME
|
||||
= "editProjectFunding";
|
||||
|
||||
private static final String UPLOAD_PROJECT_FUNDING_SHEET_NAME
|
||||
= "uploadProjectFunding";
|
||||
|
||||
public SciProjectFundingStep(final ItemSelectionModel itemModel,
|
||||
final AuthoringKitWizard parent,
|
||||
final StringParameter selectedLanguageParam) {
|
||||
this(itemModel, parent, selectedLanguageParam, null);
|
||||
}
|
||||
|
||||
public SciProjectFundingStep(final ItemSelectionModel itemModel,
|
||||
final AuthoringKitWizard parent,
|
||||
final StringParameter selectedLanguageParam,
|
||||
final String prefix) {
|
||||
super(itemModel, parent, selectedLanguageParam, prefix);
|
||||
|
||||
final BasicItemForm editFundingForm = new SciProjectFundingEditForm(
|
||||
itemModel, selectedLanguageParam);
|
||||
add(EDIT_PROJECT_FUNDING_SHEET_NAME,
|
||||
new GlobalizedMessage("sciproject.ui.funding.edit",
|
||||
SciProjectConstants.SCI_PROJECT_BUNDLE),
|
||||
new WorkflowLockedComponentAccess(editFundingForm, itemModel),
|
||||
editFundingForm.getSaveCancelSection().getCancelButton());
|
||||
|
||||
final SciProjectFundingUploadForm uploadFundingForm
|
||||
= new SciProjectFundingUploadForm(
|
||||
itemModel, selectedLanguageParam);
|
||||
add(UPLOAD_PROJECT_FUNDING_SHEET_NAME,
|
||||
new GlobalizedMessage("sciproject.ui.funding.upload",
|
||||
SciProjectConstants.SCI_PROJECT_BUNDLE),
|
||||
new WorkflowLockedComponentAccess(uploadFundingForm, itemModel),
|
||||
uploadFundingForm.getSaveCancelSection().getCancelButton());
|
||||
|
||||
setDisplayComponent(getSciProjectEditFundingSheet(itemModel));
|
||||
}
|
||||
|
||||
public static Component getSciProjectEditFundingSheet(
|
||||
final ItemSelectionModel itemModel) {
|
||||
final DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(
|
||||
itemModel);
|
||||
|
||||
if (SciProjectConfig.getConfig().isEnableFunding()) {
|
||||
sheet.add(
|
||||
new GlobalizedMessage("sciproject.ui.funding",
|
||||
SciProjectConstants.SCI_PROJECT_BUNDLE),
|
||||
SciProjectUiConstants.FUNDING);
|
||||
}
|
||||
if (SciProjectConfig.getConfig().isEnableFundingVolume()) {
|
||||
sheet.add(
|
||||
new GlobalizedMessage("sciproject.ui.funding.volume",
|
||||
SciProjectConstants.SCI_PROJECT_BUNDLE),
|
||||
SciProjectUiConstants.FUNDING_VOLUME);
|
||||
}
|
||||
|
||||
return sheet;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
package com.arsdigita.cms.contenttypes.ui;
|
||||
|
||||
import com.arsdigita.bebop.PageState;
|
||||
import com.arsdigita.bebop.parameters.StringParameter;
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
import com.arsdigita.cms.ui.authoring.SelectedLanguageUtil;
|
||||
import com.arsdigita.cms.ui.contenttypes.AbstractTextUploadForm;
|
||||
import com.arsdigita.globalization.GlobalizedMessage;
|
||||
|
||||
import org.libreccm.cdi.utils.CdiUtil;
|
||||
import org.scientificcms.contenttypes.sciproject.SciProject;
|
||||
import org.scientificcms.contenttypes.sciproject.SciProjectConstants;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Jens Pelzetter <jens@jp-digital.de>
|
||||
* @version $Id: SciProjectFundingUploadForm.java 2334 2013-10-03 07:51:31Z
|
||||
* jensp $
|
||||
*/
|
||||
public class SciProjectFundingUploadForm extends AbstractTextUploadForm {
|
||||
|
||||
private final StringParameter selectedLanguageParam;
|
||||
|
||||
public SciProjectFundingUploadForm(
|
||||
final ItemSelectionModel itemModel,
|
||||
final StringParameter selectedLanguageParam) {
|
||||
|
||||
super(itemModel);
|
||||
this.selectedLanguageParam = selectedLanguageParam;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GlobalizedMessage getLabelText() {
|
||||
return new GlobalizedMessage("sciproject.ui.funding.upload",
|
||||
SciProjectConstants.SCI_PROJECT_BUNDLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GlobalizedMessage getMimeTypeLabel() {
|
||||
return new GlobalizedMessage("sciproject.ui.funding.upload.mimetype",
|
||||
SciProjectConstants.SCI_PROJECT_BUNDLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setText(final ItemSelectionModel itemModel,
|
||||
final PageState state,
|
||||
final String text) {
|
||||
|
||||
final SciProject project = (SciProject) itemModel.getSelectedObject(
|
||||
state);
|
||||
final Locale locale = SelectedLanguageUtil
|
||||
.selectedLocale(state,
|
||||
selectedLanguageParam);
|
||||
|
||||
final Map<String, Object> data = new HashMap<>();
|
||||
data.put(SciProjectUiConstants.FUNDING, text);
|
||||
CdiUtil
|
||||
.createCdiUtil()
|
||||
.findBean(SciProjectController.class)
|
||||
.updateFundingData(project.getObjectId(), locale, data);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -21,6 +21,10 @@ public final class SciProjectUiConstants {
|
|||
|
||||
public static final String EDIT_DESC_TEXT_SHEET_NAME = "editProjectDescText";
|
||||
|
||||
public static final String FUNDING = "funding";
|
||||
|
||||
public static final String FUNDING_VOLUME = "fundingVolume";
|
||||
|
||||
public static final String FUNDING_CODE = "fundingCode";
|
||||
|
||||
public static final String END = "end";
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ import javax.persistence.Entity;
|
|||
|
||||
import org.hibernate.envers.Audited;
|
||||
import org.libreccm.l10n.LocalizedString;
|
||||
import org.librecms.assets.Organization;
|
||||
import org.librecms.contentsection.ContentItem;
|
||||
import org.librecms.contenttypes.AuthoringKit;
|
||||
import org.librecms.contenttypes.AuthoringStep;
|
||||
|
|
|
|||
|
|
@ -20,13 +20,22 @@ public class SciProjectConfig {
|
|||
@Setting
|
||||
private String contactTypesBundleName
|
||||
= "org.scientificcms.contenttypes.sciproject.DefaultContactTypes";
|
||||
|
||||
|
||||
@Setting
|
||||
private boolean enableSponsor = true;
|
||||
|
||||
|
||||
@Setting
|
||||
private boolean enableFunding = true;
|
||||
|
||||
@Setting
|
||||
private boolean enableFundingDhtml = true;
|
||||
|
||||
@Setting
|
||||
private boolean enableFundingVolume = true;
|
||||
|
||||
@Setting
|
||||
private int fundingVolumeLength = 128;
|
||||
|
||||
public static SciProjectConfig getConfig() {
|
||||
final ConfigurationManager confManager = CdiUtil.createCdiUtil()
|
||||
.findBean(ConfigurationManager.class);
|
||||
|
|
@ -60,6 +69,30 @@ public class SciProjectConfig {
|
|||
public void setEnableFunding(final boolean enableFunding) {
|
||||
this.enableFunding = enableFunding;
|
||||
}
|
||||
|
||||
public boolean isEnableFundingDhtml() {
|
||||
return enableFundingDhtml;
|
||||
}
|
||||
|
||||
public void setEnableFundingDhtml(boolean enableFundingDhtml) {
|
||||
this.enableFundingDhtml = enableFundingDhtml;
|
||||
}
|
||||
|
||||
public boolean isEnableFundingVolume() {
|
||||
return enableFundingVolume;
|
||||
}
|
||||
|
||||
public void setEnableFundingVolume(final boolean enableFundingVolume) {
|
||||
this.enableFundingVolume = enableFundingVolume;
|
||||
}
|
||||
|
||||
public int getFundingVolumeLength() {
|
||||
return fundingVolumeLength;
|
||||
}
|
||||
|
||||
public void setFundingVolumeLength(final int fundingVolumeLength) {
|
||||
this.fundingVolumeLength = fundingVolumeLength;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -5,25 +5,24 @@
|
|||
*/
|
||||
package org.scientificcms.contenttypes.sciproject;
|
||||
|
||||
import nl.jqno.equalsverifier.Warning;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
import org.libreccm.categorization.Category;
|
||||
import org.libreccm.core.CcmObject;
|
||||
import org.libreccm.l10n.LocalizedString;
|
||||
import org.libreccm.security.Group;
|
||||
import org.libreccm.security.Role;
|
||||
import org.libreccm.security.SecurityEntitiesPrefabProvider;
|
||||
import org.libreccm.security.User;
|
||||
import org.libreccm.tests.categories.UnitTest;
|
||||
import org.libreccm.testutils.EqualsVerifier;
|
||||
import org.libreccm.workflow.Workflow;
|
||||
import org.librecms.assets.ContactableEntity;
|
||||
import org.librecms.assets.Organization;
|
||||
import org.librecms.assets.Person;
|
||||
import org.librecms.assets.PostalAddress;
|
||||
import org.librecms.contentsection.AttachmentList;
|
||||
import org.librecms.contentsection.ContentItem;
|
||||
import org.librecms.contentsection.ContentSection;
|
||||
import org.librecms.contentsection.ContentType;
|
||||
import org.librecms.contentsection.ItemAttachment;
|
||||
import org.librecms.lifecycle.Lifecycle;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
|
@ -151,18 +150,6 @@ public class EqualsAndHashCodeTest extends EqualsVerifier {
|
|||
|
||||
verifier.withPrefabValues(ContentItem.class, item1, item2);
|
||||
|
||||
final AttachmentList attachmentList1 = new AttachmentList();
|
||||
attachmentList1.setListId(701);
|
||||
attachmentList1.setName("list1");
|
||||
|
||||
final AttachmentList attachmentList2 = new AttachmentList();
|
||||
attachmentList2.setListId(702);
|
||||
attachmentList2.setName("list2");
|
||||
|
||||
verifier.withPrefabValues(AttachmentList.class,
|
||||
attachmentList1,
|
||||
attachmentList2);
|
||||
|
||||
final Lifecycle lifecycle1 = new Lifecycle();
|
||||
lifecycle1.setLifecycleId(801);
|
||||
lifecycle1.setStarted(true);
|
||||
|
|
@ -206,6 +193,28 @@ public class EqualsAndHashCodeTest extends EqualsVerifier {
|
|||
category2.setName("category2");
|
||||
|
||||
verifier.withPrefabValues(Category.class, category1, category2);
|
||||
|
||||
final Organization organization1 = new Organization();
|
||||
organization1.setName("orga1");
|
||||
|
||||
final Organization organization2 = new Organization();
|
||||
organization1.setName("orga2");
|
||||
|
||||
verifier.withPrefabValues(Organization.class,
|
||||
organization1,
|
||||
organization2);
|
||||
|
||||
final ItemAttachment<?> itemAttachment1 = new ItemAttachment<>();
|
||||
itemAttachment1.setUuid("927ac9de-029d-4233-9015-1135eb861c34");
|
||||
|
||||
final ItemAttachment<?> itemAttachment2 = new ItemAttachment<>();
|
||||
itemAttachment2.setUuid("d1bd98a1-75c2-4e61-8f9f-2e2eadd30812");
|
||||
|
||||
verifier.withPrefabValues(ItemAttachment.class,
|
||||
itemAttachment1,
|
||||
itemAttachment2);
|
||||
|
||||
verifier.suppress(Warning.REFERENCE_EQUALITY);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue