ccm-sci-publications: It is now possible to add multiple organizers to a proceedings
git-svn-id: https://svn.libreccm.org/ccm/trunk@3461 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
d023ece326
commit
d3d0fc2b82
|
|
@ -45,6 +45,11 @@ div.portal-grid-row div.portal-col-50 {
|
||||||
width: 50%;
|
width: 50%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
div.portal-workspace-columns div.portal-col-75,
|
||||||
|
div.portal-grid-row div.portal-col-75 {
|
||||||
|
width: 75%;
|
||||||
|
}
|
||||||
|
|
||||||
div.portal-workspace-columns div.portal-col-100,
|
div.portal-workspace-columns div.portal-col-100,
|
||||||
div.portal-grid-row div.portal-col-100 {
|
div.portal-grid-row div.portal-col-100 {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
|
||||||
|
|
@ -31,8 +31,9 @@ import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Content type of proceedings. Provides attributes for storing the data of the conference (name, date, place,
|
* Content type of proceedings. Provides attributes for storing the data of the
|
||||||
* organizer) and for linking the papers (objects of the content type {@link InProceedings} to a proceedings object.
|
* conference (name, date, place, organizer) and for linking the papers (objects
|
||||||
|
* of the content type {@link InProceedings} to a proceedings object.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @author Jens Pelzetter
|
* @author Jens Pelzetter
|
||||||
|
|
@ -46,9 +47,10 @@ public class Proceedings extends PublicationWithPublisher {
|
||||||
public static final String DATE_TO_OF_CONFERENCE = "dateToOfConference";
|
public static final String DATE_TO_OF_CONFERENCE = "dateToOfConference";
|
||||||
public static final String PAPERS = "papers";
|
public static final String PAPERS = "papers";
|
||||||
public static final String PAPER_ORDER = "paperOrder";
|
public static final String PAPER_ORDER = "paperOrder";
|
||||||
public static final String BASE_DATA_OBJECT_TYPE =
|
public static final String BASE_DATA_OBJECT_TYPE
|
||||||
"com.arsdigita.cms.contenttypes.Proceedings";
|
= "com.arsdigita.cms.contenttypes.Proceedings";
|
||||||
private static final ProceedingsConfig PROCEEDINGS_CONFIG = new ProceedingsConfig();
|
private static final ProceedingsConfig PROCEEDINGS_CONFIG
|
||||||
|
= new ProceedingsConfig();
|
||||||
|
|
||||||
public Proceedings() {
|
public Proceedings() {
|
||||||
super(BASE_DATA_OBJECT_TYPE);
|
super(BASE_DATA_OBJECT_TYPE);
|
||||||
|
|
@ -78,62 +80,6 @@ public class Proceedings extends PublicationWithPublisher {
|
||||||
return (ProceedingsBundle) getContentBundle();
|
return (ProceedingsBundle) getContentBundle();
|
||||||
}
|
}
|
||||||
|
|
||||||
public GenericOrganizationalUnit getOrganizerOfConference() {
|
|
||||||
/*DataCollection collection;
|
|
||||||
|
|
||||||
collection = (DataCollection) get(ORGANIZER_OF_CONFERENCE);
|
|
||||||
|
|
||||||
if (0 == collection.size()) {
|
|
||||||
return null;
|
|
||||||
} else {
|
|
||||||
DataObject dobj;
|
|
||||||
|
|
||||||
collection.next();
|
|
||||||
dobj = collection.getDataObject();
|
|
||||||
collection.close();
|
|
||||||
|
|
||||||
return (GenericOrganizationalUnit) DomainObjectFactory.newInstance(
|
|
||||||
dobj);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
final GenericOrganizationalUnitBundle bundle = getProceedingsBundle().getOrganizerOfConference();
|
|
||||||
|
|
||||||
if (bundle == null) {
|
|
||||||
return null;
|
|
||||||
} else {
|
|
||||||
return (GenericOrganizationalUnit) bundle.getPrimaryInstance();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public GenericOrganizationalUnit getOrganizerOfConference(
|
|
||||||
final String language) {
|
|
||||||
final GenericOrganizationalUnitBundle bundle = getProceedingsBundle().getOrganizerOfConference();
|
|
||||||
|
|
||||||
if (bundle == null) {
|
|
||||||
return null;
|
|
||||||
} else {
|
|
||||||
return (GenericOrganizationalUnit) bundle.getInstance(language);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOrganizerOfConference(GenericOrganizationalUnit organizer) {
|
|
||||||
/*GenericOrganizationalUnit oldOrga;
|
|
||||||
|
|
||||||
oldOrga = getOrganizerOfConference();
|
|
||||||
if (oldOrga != null) {
|
|
||||||
remove(ORGANIZER_OF_CONFERENCE, oldOrga);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (null != organizer) {
|
|
||||||
Assert.exists(organizer, GenericOrganizationalUnit.class);
|
|
||||||
DataObject link = add(ORGANIZER_OF_CONFERENCE, organizer);
|
|
||||||
link.set("organizerOrder", 1);
|
|
||||||
link.save();
|
|
||||||
} */
|
|
||||||
|
|
||||||
getProceedingsBundle().setOrganizerOfConference(organizer);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getNameOfConference() {
|
public String getNameOfConference() {
|
||||||
return (String) get(NAME_OF_CONFERENCE);
|
return (String) get(NAME_OF_CONFERENCE);
|
||||||
}
|
}
|
||||||
|
|
@ -166,26 +112,31 @@ public class Proceedings extends PublicationWithPublisher {
|
||||||
set(DATE_TO_OF_CONFERENCE, dateTo);
|
set(DATE_TO_OF_CONFERENCE, dateTo);
|
||||||
}
|
}
|
||||||
|
|
||||||
public InProceedingsCollection getPapers() {
|
public ProceedingsOrganizerCollection getOrganizers() {
|
||||||
//return new InProceedingsCollection((DataCollection) get(PAPERS));
|
return getProceedingsBundle().getOrganizersOfConference();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addOrganizer(final GenericOrganizationalUnit organizer) {
|
||||||
|
getProceedingsBundle().addOrganizerOfConference(organizer);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeOrganizer(final GenericOrganizationalUnit organizer) {
|
||||||
|
getProceedingsBundle().removeOrganizer(organizer);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasOrganizers() {
|
||||||
|
return !getOrganizers().isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
public InProceedingsCollection getPapers() {
|
||||||
return getProceedingsBundle().getPapers();
|
return getProceedingsBundle().getPapers();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addPaper(InProceedings paper) {
|
public void addPaper(InProceedings paper) {
|
||||||
/*Assert.exists(paper, InProceedings.class);
|
|
||||||
|
|
||||||
DataObject link = add(PAPERS, paper);
|
|
||||||
|
|
||||||
link.set(PAPER_ORDER, Integer.valueOf((int) getPapers().size()));*/
|
|
||||||
|
|
||||||
getProceedingsBundle().addPaper(paper);
|
getProceedingsBundle().addPaper(paper);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removePaper(InProceedings paper) {
|
public void removePaper(InProceedings paper) {
|
||||||
/*Assert.exists(paper, InProceedings.class);
|
|
||||||
remove(PAPERS, paper);*/
|
|
||||||
|
|
||||||
getProceedingsBundle().removePaper(paper);
|
getProceedingsBundle().removePaper(paper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -202,8 +153,10 @@ public class Proceedings extends PublicationWithPublisher {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ExtraXMLGenerator> getExtraListXMLGenerators() {
|
public List<ExtraXMLGenerator> getExtraListXMLGenerators() {
|
||||||
final List<ExtraXMLGenerator> generators = super.getExtraListXMLGenerators();
|
final List<ExtraXMLGenerator> generators = super
|
||||||
|
.getExtraListXMLGenerators();
|
||||||
generators.add(new ProceedingsExtraXmlGenerator());
|
generators.add(new ProceedingsExtraXmlGenerator());
|
||||||
return generators;
|
return generators;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,8 +38,8 @@ import java.math.BigDecimal;
|
||||||
*/
|
*/
|
||||||
public class ProceedingsBundle extends PublicationWithPublisherBundle {
|
public class ProceedingsBundle extends PublicationWithPublisherBundle {
|
||||||
|
|
||||||
public static final String BASE_DATA_OBJECT_TYPE =
|
public static final String BASE_DATA_OBJECT_TYPE
|
||||||
"com.arsdigita.cms.contenttypes.ProceedingsBundle";
|
= "com.arsdigita.cms.contenttypes.ProceedingsBundle";
|
||||||
public static final String ORGANIZER_OF_CONFERENCE = "organizerOfConference";
|
public static final String ORGANIZER_OF_CONFERENCE = "organizerOfConference";
|
||||||
public static final String PAPERS = "papers";
|
public static final String PAPERS = "papers";
|
||||||
public static final String PAPER_ORDER = "paperOrder";
|
public static final String PAPER_ORDER = "paperOrder";
|
||||||
|
|
@ -80,12 +80,12 @@ public class ProceedingsBundle extends PublicationWithPublisherBundle {
|
||||||
final String attribute = property.getName();
|
final String attribute = property.getName();
|
||||||
|
|
||||||
if (copier.getCopyType() == ItemCopier.VERSION_COPY) {
|
if (copier.getCopyType() == ItemCopier.VERSION_COPY) {
|
||||||
final ProceedingsBundle proceedingsBundle =
|
final ProceedingsBundle proceedingsBundle
|
||||||
(ProceedingsBundle) source;
|
= (ProceedingsBundle) source;
|
||||||
|
|
||||||
if (PAPERS.equals(attribute)) {
|
if (PAPERS.equals(attribute)) {
|
||||||
final DataCollection papers =
|
final DataCollection papers = (DataCollection) proceedingsBundle
|
||||||
(DataCollection) proceedingsBundle.get(
|
.get(
|
||||||
PAPERS);
|
PAPERS);
|
||||||
|
|
||||||
while (papers.next()) {
|
while (papers.next()) {
|
||||||
|
|
@ -94,8 +94,9 @@ public class ProceedingsBundle extends PublicationWithPublisherBundle {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} else if (ORGANIZER_OF_CONFERENCE.equals(attribute)) {
|
} else if (ORGANIZER_OF_CONFERENCE.equals(attribute)) {
|
||||||
final DataCollection organizers =
|
final DataCollection organizers
|
||||||
(DataCollection) proceedingsBundle.get(
|
= (DataCollection) proceedingsBundle
|
||||||
|
.get(
|
||||||
ORGANIZER_OF_CONFERENCE);
|
ORGANIZER_OF_CONFERENCE);
|
||||||
|
|
||||||
while (organizers.next()) {
|
while (organizers.next()) {
|
||||||
|
|
@ -112,9 +113,9 @@ public class ProceedingsBundle extends PublicationWithPublisherBundle {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createPaperAssoc(final DataCollection papers) {
|
private void createPaperAssoc(final DataCollection papers) {
|
||||||
final InProceedingsBundle draftPaper =
|
final InProceedingsBundle draftPaper
|
||||||
(InProceedingsBundle) DomainObjectFactory.
|
= (InProceedingsBundle) DomainObjectFactory
|
||||||
newInstance(papers.getDataObject());
|
.newInstance(papers.getDataObject());
|
||||||
final InProceedingsBundle livePaper = (InProceedingsBundle) draftPaper.
|
final InProceedingsBundle livePaper = (InProceedingsBundle) draftPaper.
|
||||||
getLiveVersion();
|
getLiveVersion();
|
||||||
|
|
||||||
|
|
@ -128,12 +129,12 @@ public class ProceedingsBundle extends PublicationWithPublisherBundle {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createOrganizerAssoc(final DataCollection organizers) {
|
private void createOrganizerAssoc(final DataCollection organizers) {
|
||||||
final GenericOrganizationalUnitBundle draftOrganizer =
|
final GenericOrganizationalUnitBundle draftOrganizer
|
||||||
(GenericOrganizationalUnitBundle) DomainObjectFactory.
|
= (GenericOrganizationalUnitBundle) DomainObjectFactory
|
||||||
newInstance(organizers.getDataObject());
|
.newInstance(organizers.getDataObject());
|
||||||
final GenericOrganizationalUnitBundle liveOrganizer =
|
final GenericOrganizationalUnitBundle liveOrganizer
|
||||||
(GenericOrganizationalUnitBundle) draftOrganizer.
|
= (GenericOrganizationalUnitBundle) draftOrganizer
|
||||||
getLiveVersion();
|
.getLiveVersion();
|
||||||
|
|
||||||
if (liveOrganizer != null) {
|
if (liveOrganizer != null) {
|
||||||
final DataObject link = add(ORGANIZER_OF_CONFERENCE, liveOrganizer);
|
final DataObject link = add(ORGANIZER_OF_CONFERENCE, liveOrganizer);
|
||||||
|
|
@ -153,10 +154,10 @@ public class ProceedingsBundle extends PublicationWithPublisherBundle {
|
||||||
if (copier.getCopyType() == ItemCopier.VERSION_COPY) {
|
if (copier.getCopyType() == ItemCopier.VERSION_COPY) {
|
||||||
if (("proceedingsOfConference".equals(attribute))
|
if (("proceedingsOfConference".equals(attribute))
|
||||||
&& (source instanceof GenericOrganizationalUnitBundle)) {
|
&& (source instanceof GenericOrganizationalUnitBundle)) {
|
||||||
final GenericOrganizationalUnitBundle orgaunitBundle =
|
final GenericOrganizationalUnitBundle orgaunitBundle
|
||||||
(GenericOrganizationalUnitBundle) source;
|
= (GenericOrganizationalUnitBundle) source;
|
||||||
final DataCollection proceedings =
|
final DataCollection proceedings
|
||||||
(DataCollection) orgaunitBundle.get(
|
= (DataCollection) orgaunitBundle.get(
|
||||||
"proceedingsOfConference");
|
"proceedingsOfConference");
|
||||||
|
|
||||||
while (proceedings.next()) {
|
while (proceedings.next()) {
|
||||||
|
|
@ -179,17 +180,23 @@ public class ProceedingsBundle extends PublicationWithPublisherBundle {
|
||||||
private void createProceedingsAssoc(
|
private void createProceedingsAssoc(
|
||||||
final DataCollection proceedings,
|
final DataCollection proceedings,
|
||||||
final GenericOrganizationalUnitBundle orgaunit) {
|
final GenericOrganizationalUnitBundle orgaunit) {
|
||||||
final ProceedingsBundle draftProceedigns = (ProceedingsBundle) DomainObjectFactory.newInstance(proceedings.getDataObject());
|
final ProceedingsBundle draftProceedigns
|
||||||
final ProceedingsBundle liveProceedings = (ProceedingsBundle) draftProceedigns.getLiveVersion();
|
= (ProceedingsBundle) DomainObjectFactory
|
||||||
|
.newInstance(proceedings.getDataObject());
|
||||||
|
final ProceedingsBundle liveProceedings
|
||||||
|
= (ProceedingsBundle) draftProceedigns
|
||||||
|
.getLiveVersion();
|
||||||
|
|
||||||
if (liveProceedings != null) {
|
if (liveProceedings != null) {
|
||||||
final DataObject link = orgaunit.add("proceedingsOfConference", liveProceedings);
|
final DataObject link = orgaunit.add("proceedingsOfConference",
|
||||||
|
liveProceedings);
|
||||||
|
|
||||||
link.set("organizerOrder", 1);
|
link.set("organizerOrder", 1);
|
||||||
|
|
||||||
link.save();
|
link.save();
|
||||||
|
|
||||||
XMLDeliveryCache.getInstance().removeFromCache(liveProceedings.getOID());
|
XMLDeliveryCache.getInstance().removeFromCache(liveProceedings
|
||||||
|
.getOID());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -210,41 +217,68 @@ public class ProceedingsBundle extends PublicationWithPublisherBundle {
|
||||||
public void removePaper(final InProceedings paper) {
|
public void removePaper(final InProceedings paper) {
|
||||||
Assert.exists(paper, InProceedings.class);
|
Assert.exists(paper, InProceedings.class);
|
||||||
|
|
||||||
remove(PAPERS, paper);
|
remove(PAPERS, paper.getInProceedingsBundle());
|
||||||
}
|
}
|
||||||
|
|
||||||
public GenericOrganizationalUnitBundle getOrganizerOfConference() {
|
public ProceedingsOrganizerCollection getOrganizersOfConference() {
|
||||||
DataCollection collection;
|
return new ProceedingsOrganizerCollection((DataCollection) get(
|
||||||
|
ORGANIZER_OF_CONFERENCE));
|
||||||
collection = (DataCollection) get(ORGANIZER_OF_CONFERENCE);
|
|
||||||
|
|
||||||
if (0 == collection.size()) {
|
|
||||||
return null;
|
|
||||||
} else {
|
|
||||||
DataObject dobj;
|
|
||||||
|
|
||||||
collection.next();
|
|
||||||
dobj = collection.getDataObject();
|
|
||||||
collection.close();
|
|
||||||
|
|
||||||
return (GenericOrganizationalUnitBundle) DomainObjectFactory.newInstance(
|
|
||||||
dobj);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOrganizerOfConference(GenericOrganizationalUnit organizer) {
|
public void addOrganizerOfConference(
|
||||||
final GenericOrganizationalUnitBundle oldOrga = getOrganizerOfConference();
|
final GenericOrganizationalUnit organizer) {
|
||||||
|
|
||||||
if (oldOrga != null) {
|
|
||||||
remove(ORGANIZER_OF_CONFERENCE, oldOrga);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (null != organizer) {
|
|
||||||
Assert.exists(organizer, GenericOrganizationalUnit.class);
|
Assert.exists(organizer, GenericOrganizationalUnit.class);
|
||||||
DataObject link = add(ORGANIZER_OF_CONFERENCE,
|
|
||||||
organizer.getGenericOrganizationalUnitBundle());
|
final DataObject link = add(ORGANIZER_OF_CONFERENCE,
|
||||||
link.set("organizerOrder", 1);
|
organizer
|
||||||
|
.getGenericOrganizationalUnitBundle());
|
||||||
|
link.set("organizerOrder",
|
||||||
|
Integer.valueOf((int) getOrganizersOfConference().size()));
|
||||||
|
|
||||||
link.save();
|
link.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void removeOrganizer(final GenericOrganizationalUnit organizer) {
|
||||||
|
Assert.exists(organizer, GenericOrganizationalUnit.class);
|
||||||
|
|
||||||
|
remove(ORGANIZER_OF_CONFERENCE, organizer.getGenericOrganizationalUnitBundle());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// public GenericOrganizationalUnitBundle getOrganizerOfConference() {
|
||||||
|
// DataCollection collection;
|
||||||
|
//
|
||||||
|
// collection = (DataCollection) get(ORGANIZER_OF_CONFERENCE);
|
||||||
|
//
|
||||||
|
// if (0 == collection.size()) {
|
||||||
|
// return null;
|
||||||
|
// } else {
|
||||||
|
// DataObject dobj;
|
||||||
|
//
|
||||||
|
// collection.next();
|
||||||
|
// dobj = collection.getDataObject();
|
||||||
|
// collection.close();
|
||||||
|
//
|
||||||
|
// return (GenericOrganizationalUnitBundle) DomainObjectFactory
|
||||||
|
// .newInstance(
|
||||||
|
// dobj);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void setOrganizerOfConference(GenericOrganizationalUnit organizer) {
|
||||||
|
// final GenericOrganizationalUnitBundle oldOrga
|
||||||
|
// = getOrganizerOfConference();
|
||||||
|
//
|
||||||
|
// if (oldOrga != null) {
|
||||||
|
// remove(ORGANIZER_OF_CONFERENCE, oldOrga);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (null != organizer) {
|
||||||
|
// Assert.exists(organizer, GenericOrganizationalUnit.class);
|
||||||
|
// DataObject link = add(ORGANIZER_OF_CONFERENCE,
|
||||||
|
// organizer.getGenericOrganizationalUnitBundle());
|
||||||
|
// link.set("organizerOrder", 1);
|
||||||
|
// link.save();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,146 @@
|
||||||
|
package com.arsdigita.cms.contenttypes;
|
||||||
|
|
||||||
|
import com.arsdigita.cms.ContentBundle;
|
||||||
|
import com.arsdigita.domain.DomainCollection;
|
||||||
|
import com.arsdigita.domain.DomainObjectFactory;
|
||||||
|
import com.arsdigita.persistence.DataCollection;
|
||||||
|
import com.arsdigita.persistence.DataObject;
|
||||||
|
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*/
|
||||||
|
public class ProceedingsOrganizerCollection extends DomainCollection {
|
||||||
|
|
||||||
|
public static final String LINKORDER = "link.organizerOrder";
|
||||||
|
public static final String ORDER = "organizerOrder";
|
||||||
|
private static final Logger s_log =
|
||||||
|
Logger.getLogger(ProceedingsOrganizerCollection.class);
|
||||||
|
|
||||||
|
public ProceedingsOrganizerCollection(final DataCollection dataCollection) {
|
||||||
|
super(dataCollection);
|
||||||
|
|
||||||
|
m_dataCollection.addOrder(LINKORDER);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getOrganizerOrder() {
|
||||||
|
return (Integer) m_dataCollection.get(LINKORDER);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOrganizerOrder(final Integer order) {
|
||||||
|
final DataObject link = (DataObject) get("link");
|
||||||
|
|
||||||
|
link.set(ORDER, order);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void swapWithNext(final GenericOrganizationalUnit organizer) {
|
||||||
|
int currentPosition = 0;
|
||||||
|
int currentIndex = 0;
|
||||||
|
int nextIndex = 0;
|
||||||
|
|
||||||
|
while (this.next()) {
|
||||||
|
currentPosition = this.getPosition();
|
||||||
|
currentIndex = this.getOrganizerOrder();
|
||||||
|
s_log.debug(String.format("Position: %d(%d)/%d", currentPosition,
|
||||||
|
currentIndex, this.size()));
|
||||||
|
s_log.debug(String.format("getOrganizerOrder(): %d",
|
||||||
|
getOrganizerOrder()));
|
||||||
|
if (this.getOrganizer().equals(organizer)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (currentPosition == 0) {
|
||||||
|
throw new IllegalArgumentException(
|
||||||
|
String.format(
|
||||||
|
"The provided article is not "
|
||||||
|
+ "part of this collection."));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.next()) {
|
||||||
|
nextIndex = this.getOrganizerOrder();
|
||||||
|
} else {
|
||||||
|
throw new IllegalArgumentException(
|
||||||
|
"The provided organizer is the last "
|
||||||
|
+ "in the collection, so there is no next object "
|
||||||
|
+ "to swap with.");
|
||||||
|
}
|
||||||
|
|
||||||
|
this.rewind();
|
||||||
|
|
||||||
|
while (this.getPosition() != currentPosition) {
|
||||||
|
this.next();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setOrganizerOrder(nextIndex);
|
||||||
|
this.next();
|
||||||
|
this.setOrganizerOrder(currentIndex);
|
||||||
|
this.rewind();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void swapWithPrevious(final GenericOrganizationalUnit organizer) {
|
||||||
|
int previousPosition = 0;
|
||||||
|
int previousIndex = 0;
|
||||||
|
int currentPosition = 0;
|
||||||
|
int currentIndex = 0;
|
||||||
|
|
||||||
|
s_log.debug("Searching organizer...");
|
||||||
|
this.rewind();
|
||||||
|
while (this.next()) {
|
||||||
|
currentPosition = this.getPosition();
|
||||||
|
currentIndex = this.getOrganizerOrder();
|
||||||
|
s_log.debug(String.format("Position: %d(%d)/%d", currentPosition,
|
||||||
|
currentIndex, this.size()));
|
||||||
|
s_log.debug(String.format("getOrganizerOrder(): %d",
|
||||||
|
getOrganizerOrder()));
|
||||||
|
if (this.getOrganizer().equals(organizer)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
previousPosition = currentPosition;
|
||||||
|
previousIndex = currentIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (currentPosition == 0) {
|
||||||
|
throw new IllegalArgumentException(
|
||||||
|
String.format(
|
||||||
|
"The provided organizer is not "
|
||||||
|
+ "part of this collection."));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (previousPosition == 0) {
|
||||||
|
throw new IllegalArgumentException(
|
||||||
|
String.format(
|
||||||
|
"The provided organizer is the first one in this "
|
||||||
|
+ "collection, so there is no previous one to switch "
|
||||||
|
+ "with."));
|
||||||
|
}
|
||||||
|
|
||||||
|
this.rewind();
|
||||||
|
while (this.getPosition() != previousPosition) {
|
||||||
|
this.next();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setOrganizerOrder(currentIndex);
|
||||||
|
this.next();
|
||||||
|
this.setOrganizerOrder(previousIndex);
|
||||||
|
this.rewind();
|
||||||
|
}
|
||||||
|
|
||||||
|
public GenericOrganizationalUnit getOrganizer() {
|
||||||
|
final ContentBundle bundle = (ContentBundle) DomainObjectFactory
|
||||||
|
.newInstance(m_dataCollection.getDataObject());
|
||||||
|
|
||||||
|
return (GenericOrganizationalUnit) bundle.getPrimaryInstance();
|
||||||
|
}
|
||||||
|
|
||||||
|
public GenericOrganizationalUnit getOrganizer(final String language) {
|
||||||
|
final ContentBundle bundle = (ContentBundle) DomainObjectFactory
|
||||||
|
.newInstance(m_dataCollection.getDataObject());
|
||||||
|
|
||||||
|
return (GenericOrganizationalUnit) bundle.getInstance(language);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -290,7 +290,7 @@ publications.ui.expertise.setOrganization=Set organization
|
||||||
publications.ui.expertise.setOrderer=Set orderer
|
publications.ui.expertise.setOrderer=Set orderer
|
||||||
publications.ui.proceedings.organizer=Organizer of conference
|
publications.ui.proceedings.organizer=Organizer of conference
|
||||||
publications.ui.proceedings.organizer.none=No organizer associated
|
publications.ui.proceedings.organizer.none=No organizer associated
|
||||||
publications.ui.proceedings.organizer.remove=Remove
|
publications.ui.proceedings.organizer.remove=\u2716
|
||||||
publications.ui.proceedings.organizer.remove.confirm=Do you really want to remove this association?
|
publications.ui.proceedings.organizer.remove.confirm=Do you really want to remove this association?
|
||||||
publications.ui.proceedings.setOrganizer=Set organizer of conference
|
publications.ui.proceedings.setOrganizer=Set organizer of conference
|
||||||
publications.ui.unpublished.setOrganization=Set organization
|
publications.ui.unpublished.setOrganization=Set organization
|
||||||
|
|
@ -438,3 +438,6 @@ cms.contenttypes.workingpaper.type_label=Publication - Working Paper-
|
||||||
cms.contenttypes.sciauthor.basic_properties.description=Input screen for an atuhor's basic properties as name, christian name, professional titel, etc
|
cms.contenttypes.sciauthor.basic_properties.description=Input screen for an atuhor's basic properties as name, christian name, professional titel, etc
|
||||||
cms.contenttypes.sciauthor.authoring.contact_properties.description=Contact Properties
|
cms.contenttypes.sciauthor.authoring.contact_properties.description=Contact Properties
|
||||||
cms.contenttypes.sciauthor.authoring.contact_properties.title=Contact Properties
|
cms.contenttypes.sciauthor.authoring.contact_properties.title=Contact Properties
|
||||||
|
publications.ui.proceedings.select_organizer.already_added=The selected organization has already been added as organizer.
|
||||||
|
publications.ui.proceedings.organizer.up=\u2b06
|
||||||
|
publications.ui.proceedings.organizer.down=\u2b07
|
||||||
|
|
|
||||||
|
|
@ -289,7 +289,7 @@ publications.ui.expertise.setOrganization=Organisation zuweisen
|
||||||
publications.ui.expertise.setOrderer=Auftraggeber zuweisen
|
publications.ui.expertise.setOrderer=Auftraggeber zuweisen
|
||||||
publications.ui.proceedings.organizer=Veranstalter der Konferenz
|
publications.ui.proceedings.organizer=Veranstalter der Konferenz
|
||||||
publications.ui.proceedings.organizer.none=Kein Veranstalter zugewiesen
|
publications.ui.proceedings.organizer.none=Kein Veranstalter zugewiesen
|
||||||
publications.ui.proceedings.organizer.remove=Entfernen
|
publications.ui.proceedings.organizer.remove=\u2716
|
||||||
publications.ui.proceedings.organizer.remove.confirm=Wollen Sie diese Verkn\u00fcpfung wirklich entfernen?
|
publications.ui.proceedings.organizer.remove.confirm=Wollen Sie diese Verkn\u00fcpfung wirklich entfernen?
|
||||||
publications.ui.proceedings.setOrganizer=Veranstalter der Konferenz zuweisen
|
publications.ui.proceedings.setOrganizer=Veranstalter der Konferenz zuweisen
|
||||||
publications.ui.unpublished.setOrganization=Organisation zuweisen
|
publications.ui.unpublished.setOrganization=Organisation zuweisen
|
||||||
|
|
@ -415,7 +415,7 @@ publications.ui.publication.first_published=Erste Ver\u00f6ffentlichung
|
||||||
publications.ui.publication.language=Sprache der Publikation
|
publications.ui.publication.language=Sprache der Publikation
|
||||||
publications.ui.series.number=Band der Reihe
|
publications.ui.series.number=Band der Reihe
|
||||||
person.ui.publications.header=Publikationen mit {0} als Autorin/Autor
|
person.ui.publications.header=Publikationen mit {0} als Autorin/Autor
|
||||||
person.ui.publications.header.alias_of=\ (Alias von {0})
|
person.ui.publications.header.alias_of=(Alias von {0})
|
||||||
cms.contenttypes.articleincollectedvolume.type_label=Publikation - Sammelbandbeitrag
|
cms.contenttypes.articleincollectedvolume.type_label=Publikation - Sammelbandbeitrag
|
||||||
cms.contenttypes.articleinjournal.type_label=Publikation - Zeitschriftenbeitrag
|
cms.contenttypes.articleinjournal.type_label=Publikation - Zeitschriftenbeitrag
|
||||||
cms.contenttypes.collectedvolume.type_label=Publikation - Sammelband
|
cms.contenttypes.collectedvolume.type_label=Publikation - Sammelband
|
||||||
|
|
@ -437,3 +437,6 @@ cms.contenttypes.workingpaper.type_label=Publikation - Arbeitspapier
|
||||||
cms.contenttypes.sciauthor.basic_properties.description=Input screen for an atuhor's basic properties as name, christian name, professional titel, etc
|
cms.contenttypes.sciauthor.basic_properties.description=Input screen for an atuhor's basic properties as name, christian name, professional titel, etc
|
||||||
cms.contenttypes.sciauthor.authoring.contact_properties.description=Kontaktangaben
|
cms.contenttypes.sciauthor.authoring.contact_properties.description=Kontaktangaben
|
||||||
cms.contenttypes.sciauthor.authoring.contact_properties.title=Kontaktangaben
|
cms.contenttypes.sciauthor.authoring.contact_properties.title=Kontaktangaben
|
||||||
|
publications.ui.proceedings.select_organizer.already_added=Die ausgew\u00e4hlte Organisation wurde bereits als Veranstalter hinzugef\u00fcgt.
|
||||||
|
publications.ui.proceedings.organizer.up=\u2b06
|
||||||
|
publications.ui.proceedings.organizer.down=\u2b07
|
||||||
|
|
|
||||||
|
|
@ -20,51 +20,54 @@ package com.arsdigita.cms.contenttypes.ui;
|
||||||
|
|
||||||
import com.arsdigita.bebop.FormData;
|
import com.arsdigita.bebop.FormData;
|
||||||
import com.arsdigita.bebop.FormProcessException;
|
import com.arsdigita.bebop.FormProcessException;
|
||||||
import com.arsdigita.bebop.Label;
|
|
||||||
import com.arsdigita.bebop.PageState;
|
import com.arsdigita.bebop.PageState;
|
||||||
import com.arsdigita.bebop.event.FormInitListener;
|
import com.arsdigita.bebop.event.FormInitListener;
|
||||||
import com.arsdigita.bebop.event.FormProcessListener;
|
import com.arsdigita.bebop.event.FormProcessListener;
|
||||||
import com.arsdigita.bebop.event.FormSectionEvent;
|
import com.arsdigita.bebop.event.FormSectionEvent;
|
||||||
import com.arsdigita.cms.ContentType;
|
import com.arsdigita.cms.ContentType;
|
||||||
import com.arsdigita.cms.Folder;
|
|
||||||
import com.arsdigita.cms.ItemSelectionModel;
|
import com.arsdigita.cms.ItemSelectionModel;
|
||||||
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit;
|
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit;
|
||||||
import com.arsdigita.cms.contenttypes.Proceedings;
|
import com.arsdigita.cms.contenttypes.Proceedings;
|
||||||
|
import com.arsdigita.cms.contenttypes.ProceedingsOrganizerCollection;
|
||||||
import com.arsdigita.cms.contenttypes.PublicationsConfig;
|
import com.arsdigita.cms.contenttypes.PublicationsConfig;
|
||||||
import com.arsdigita.cms.ui.ItemSearchWidget;
|
import com.arsdigita.cms.ui.ItemSearchWidget;
|
||||||
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||||
import com.arsdigita.kernel.Kernel;
|
import com.arsdigita.kernel.Kernel;
|
||||||
import java.math.BigDecimal;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Jens Pelzetter
|
* @author Jens Pelzetter
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
public class ProceedingsOrganizerForm
|
public class ProceedingsOrganizerAddForm
|
||||||
extends BasicItemForm
|
extends BasicItemForm
|
||||||
implements FormProcessListener,
|
implements FormProcessListener,
|
||||||
FormInitListener {
|
FormInitListener {
|
||||||
|
|
||||||
private ItemSearchWidget itemSearch;
|
private ItemSearchWidget itemSearch;
|
||||||
private final String ITEM_SEARCH = "departmentOrga";
|
private final String ITEM_SEARCH = "departmentOrga";
|
||||||
|
private ItemSelectionModel itemModel;
|
||||||
private final static PublicationsConfig config = new PublicationsConfig();
|
private final static PublicationsConfig config = new PublicationsConfig();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
config.load();
|
config.load();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProceedingsOrganizerForm(final ItemSelectionModel itemModel) {
|
public ProceedingsOrganizerAddForm(final ItemSelectionModel itemModel) {
|
||||||
super("ProceedingsOrganizerForm", itemModel);
|
super("ProceedingsOrganizerForm", itemModel);
|
||||||
|
this.itemModel = itemModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void addWidgets() {
|
protected void addWidgets() {
|
||||||
|
|
||||||
itemSearch = new ItemSearchWidget(ITEM_SEARCH,
|
itemSearch = new ItemSearchWidget(ITEM_SEARCH,
|
||||||
ContentType.findByAssociatedObjectType(
|
ContentType
|
||||||
GenericOrganizationalUnit.class.getName()));
|
.findByAssociatedObjectType(
|
||||||
itemSearch.setDefaultCreationFolder(config.getDefaultOrganizationsFolder());
|
GenericOrganizationalUnit.class
|
||||||
|
.getName()));
|
||||||
|
itemSearch.setDefaultCreationFolder(config
|
||||||
|
.getDefaultOrganizationsFolder());
|
||||||
itemSearch.setEditAfterCreate(false);
|
itemSearch.setEditAfterCreate(false);
|
||||||
itemSearch.setLabel(PublicationGlobalizationUtil.globalize(
|
itemSearch.setLabel(PublicationGlobalizationUtil.globalize(
|
||||||
"publications.ui.proceedings.organizer"));
|
"publications.ui.proceedings.organizer"));
|
||||||
|
|
@ -86,13 +89,14 @@ public class ProceedingsOrganizerForm
|
||||||
getSelectedObject(state);
|
getSelectedObject(state);
|
||||||
|
|
||||||
if (this.getSaveCancelSection().getSaveButton().isSelected(state)) {
|
if (this.getSaveCancelSection().getSaveButton().isSelected(state)) {
|
||||||
GenericOrganizationalUnit organizer =
|
GenericOrganizationalUnit organizer
|
||||||
(GenericOrganizationalUnit) data.get(
|
= (GenericOrganizationalUnit) data
|
||||||
|
.get(
|
||||||
ITEM_SEARCH);
|
ITEM_SEARCH);
|
||||||
organizer = (GenericOrganizationalUnit) organizer.getContentBundle().
|
organizer = (GenericOrganizationalUnit) organizer.getContentBundle()
|
||||||
getInstance(proceedings.getLanguage());
|
.getInstance(proceedings.getLanguage());
|
||||||
|
|
||||||
proceedings.setOrganizerOfConference(organizer);
|
proceedings.addOrganizer(organizer);
|
||||||
itemSearch.publishCreatedItem(data, organizer);
|
itemSearch.publishCreatedItem(data, organizer);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -113,8 +117,10 @@ public class ProceedingsOrganizerForm
|
||||||
|
|
||||||
Proceedings proceedings = (Proceedings) getItemSelectionModel().
|
Proceedings proceedings = (Proceedings) getItemSelectionModel().
|
||||||
getSelectedObject(state);
|
getSelectedObject(state);
|
||||||
GenericOrganizationalUnit organizer = (GenericOrganizationalUnit) data.get(ITEM_SEARCH);
|
GenericOrganizationalUnit organizer = (GenericOrganizationalUnit) data
|
||||||
if (!(organizer.getContentBundle().hasInstance(proceedings.getLanguage(),
|
.get(ITEM_SEARCH);
|
||||||
|
if (!(organizer.getContentBundle()
|
||||||
|
.hasInstance(proceedings.getLanguage(),
|
||||||
Kernel.getConfig().
|
Kernel.getConfig().
|
||||||
languageIndependentItems()))) {
|
languageIndependentItems()))) {
|
||||||
data.addError(
|
data.addError(
|
||||||
|
|
@ -122,6 +128,19 @@ public class ProceedingsOrganizerForm
|
||||||
"publications.ui.proceedings.organizer.no_suitable_language_variant"));
|
"publications.ui.proceedings.organizer.no_suitable_language_variant"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
organizer = (GenericOrganizationalUnit) organizer.getContentBundle()
|
||||||
|
.getInstance(proceedings.getLanguage());
|
||||||
|
ProceedingsOrganizerCollection organizers = proceedings.getOrganizers();
|
||||||
|
organizers.addFilter(String.format("id = %s",
|
||||||
|
organizer
|
||||||
|
.getContentBundle()
|
||||||
|
.getID()
|
||||||
|
.toString()));
|
||||||
|
if (organizers.size() > 0) {
|
||||||
|
data.addError(PublicationGlobalizationUtil.globalize(
|
||||||
|
"publications.ui.proceedings.select_organizer.already_added"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -42,14 +42,14 @@ public class ProceedingsOrganizerStep extends SimpleEditStep {
|
||||||
final String prefix) {
|
final String prefix) {
|
||||||
super(itemModel, parent, prefix);
|
super(itemModel, parent, prefix);
|
||||||
|
|
||||||
BasicItemForm setOrganizerForm = new ProceedingsOrganizerForm(itemModel);
|
BasicItemForm setOrganizerForm = new ProceedingsOrganizerAddForm(itemModel);
|
||||||
add(SET_PROCEEDINGS_ORGANIZER_STEP,
|
add(SET_PROCEEDINGS_ORGANIZER_STEP,
|
||||||
PublicationGlobalizationUtil.globalize(
|
PublicationGlobalizationUtil.globalize(
|
||||||
"publications.ui.proceedings.setOrganizer"),
|
"publications.ui.proceedings.setOrganizer"),
|
||||||
new WorkflowLockedComponentAccess(setOrganizerForm, itemModel),
|
new WorkflowLockedComponentAccess(setOrganizerForm, itemModel),
|
||||||
setOrganizerForm.getSaveCancelSection().getCancelButton());
|
setOrganizerForm.getSaveCancelSection().getCancelButton());
|
||||||
|
|
||||||
ProceedingsOrganizerSheet sheet = new ProceedingsOrganizerSheet(
|
ProceedingsOrganizerTable sheet = new ProceedingsOrganizerTable(
|
||||||
itemModel);
|
itemModel);
|
||||||
setDisplayComponent(sheet);
|
setDisplayComponent(sheet);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,25 +36,29 @@ import com.arsdigita.cms.ContentSection;
|
||||||
import com.arsdigita.cms.ItemSelectionModel;
|
import com.arsdigita.cms.ItemSelectionModel;
|
||||||
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit;
|
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit;
|
||||||
import com.arsdigita.cms.contenttypes.Proceedings;
|
import com.arsdigita.cms.contenttypes.Proceedings;
|
||||||
|
import com.arsdigita.cms.contenttypes.ProceedingsOrganizerCollection;
|
||||||
import com.arsdigita.cms.dispatcher.ItemResolver;
|
import com.arsdigita.cms.dispatcher.ItemResolver;
|
||||||
import com.arsdigita.cms.dispatcher.Utilities;
|
import com.arsdigita.cms.dispatcher.Utilities;
|
||||||
import com.arsdigita.dispatcher.ObjectNotFoundException;
|
import com.arsdigita.dispatcher.ObjectNotFoundException;
|
||||||
import com.arsdigita.util.LockableImpl;
|
import com.arsdigita.util.LockableImpl;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Jens Pelzetter
|
* @author Jens Pelzetter
|
||||||
*/
|
*/
|
||||||
public class ProceedingsOrganizerSheet
|
public class ProceedingsOrganizerTable
|
||||||
extends Table
|
extends Table
|
||||||
implements TableActionListener {
|
implements TableActionListener {
|
||||||
|
|
||||||
private final String TABLE_COL_EDIT = "table_col_edit";
|
private final String TABLE_COL_EDIT = "table_col_edit";
|
||||||
private final String TABLE_COL_DEL = "table_col_del";
|
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 ItemSelectionModel itemModel;
|
private ItemSelectionModel itemModel;
|
||||||
|
|
||||||
public ProceedingsOrganizerSheet(final ItemSelectionModel itemModel) {
|
public ProceedingsOrganizerTable(final ItemSelectionModel itemModel) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
this.itemModel = itemModel;
|
this.itemModel = itemModel;
|
||||||
|
|
@ -73,21 +77,33 @@ public class ProceedingsOrganizerSheet
|
||||||
new Label(PublicationGlobalizationUtil.globalize(
|
new Label(PublicationGlobalizationUtil.globalize(
|
||||||
"publications.ui.proceedings.organizer.remove")),
|
"publications.ui.proceedings.organizer.remove")),
|
||||||
TABLE_COL_DEL));
|
TABLE_COL_DEL));
|
||||||
|
columnModel.add(new TableColumn(
|
||||||
|
2,
|
||||||
|
new Label(PublicationGlobalizationUtil.globalize(
|
||||||
|
"publications.ui.proceedings.organizer.up")),
|
||||||
|
TABLE_COL_UP));
|
||||||
|
columnModel.add(new TableColumn(
|
||||||
|
3,
|
||||||
|
new Label(PublicationGlobalizationUtil.globalize(
|
||||||
|
"publications.ui.proceedings.organizer.down")),
|
||||||
|
TABLE_COL_DOWN));
|
||||||
|
|
||||||
setModelBuilder(new ProceedingsOrganizerSheetModelBuilder(itemModel));
|
setModelBuilder(new ProceedingsOrganizerTableModelBuilder(itemModel));
|
||||||
columnModel.get(0).setCellRenderer(new EditCellRenderer());
|
columnModel.get(0).setCellRenderer(new EditCellRenderer());
|
||||||
columnModel.get(1).setCellRenderer(new DeleteCellRenderer());
|
columnModel.get(1).setCellRenderer(new DeleteCellRenderer());
|
||||||
|
columnModel.get(2).setCellRenderer(new UpCellRenderer());
|
||||||
|
columnModel.get(3).setCellRenderer(new DownCellRenderer());
|
||||||
|
|
||||||
addTableActionListener(this);
|
addTableActionListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ProceedingsOrganizerSheetModelBuilder
|
private class ProceedingsOrganizerTableModelBuilder
|
||||||
extends LockableImpl
|
extends LockableImpl
|
||||||
implements TableModelBuilder {
|
implements TableModelBuilder {
|
||||||
|
|
||||||
private ItemSelectionModel itemModel;
|
private ItemSelectionModel itemModel;
|
||||||
|
|
||||||
public ProceedingsOrganizerSheetModelBuilder(
|
public ProceedingsOrganizerTableModelBuilder(
|
||||||
final ItemSelectionModel itemModel) {
|
final ItemSelectionModel itemModel) {
|
||||||
this.itemModel = itemModel;
|
this.itemModel = itemModel;
|
||||||
}
|
}
|
||||||
|
|
@ -97,26 +113,22 @@ public class ProceedingsOrganizerSheet
|
||||||
table.getRowSelectionModel().clearSelection(state);
|
table.getRowSelectionModel().clearSelection(state);
|
||||||
Proceedings proceedings = (Proceedings) itemModel.getSelectedObject(
|
Proceedings proceedings = (Proceedings) itemModel.getSelectedObject(
|
||||||
state);
|
state);
|
||||||
return new ProceedingsOrganizerSheetModel(table, state, proceedings);
|
return new ProceedingsOrganizerTableModel(table, state, proceedings);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ProceedingsOrganizerSheetModel implements TableModel {
|
}
|
||||||
|
|
||||||
|
private class ProceedingsOrganizerTableModel implements TableModel {
|
||||||
|
|
||||||
private Table table;
|
private Table table;
|
||||||
|
private ProceedingsOrganizerCollection organizers;
|
||||||
private GenericOrganizationalUnit organizer;
|
private GenericOrganizationalUnit organizer;
|
||||||
private boolean done;
|
|
||||||
|
|
||||||
public ProceedingsOrganizerSheetModel(final Table table,
|
public ProceedingsOrganizerTableModel(final Table table,
|
||||||
final PageState state,
|
final PageState state,
|
||||||
final Proceedings proceedings) {
|
final Proceedings proceedings) {
|
||||||
this.table = table;
|
this.table = table;
|
||||||
organizer = proceedings.getOrganizerOfConference();
|
organizers = proceedings.getOrganizers();
|
||||||
if (organizer == null) {
|
|
||||||
done = false;
|
|
||||||
} else {
|
|
||||||
done = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -128,13 +140,12 @@ public class ProceedingsOrganizerSheet
|
||||||
public boolean nextRow() {
|
public boolean nextRow() {
|
||||||
boolean ret;
|
boolean ret;
|
||||||
|
|
||||||
if (done) {
|
if ((organizers != null) && organizers.next()) {
|
||||||
|
organizer = organizers.getOrganizer();
|
||||||
ret = true;
|
ret = true;
|
||||||
done = false;
|
|
||||||
} else {
|
} else {
|
||||||
ret = false;
|
ret = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -146,6 +157,12 @@ public class ProceedingsOrganizerSheet
|
||||||
case 1:
|
case 1:
|
||||||
return new Label(PublicationGlobalizationUtil.globalize(
|
return new Label(PublicationGlobalizationUtil.globalize(
|
||||||
"publications.ui.proceedings.organizer.remove"));
|
"publications.ui.proceedings.organizer.remove"));
|
||||||
|
case 2:
|
||||||
|
return new Label(PublicationGlobalizationUtil.globalize(
|
||||||
|
"publications.ui.proceedings.organizer.up"));
|
||||||
|
case 3:
|
||||||
|
return new Label(PublicationGlobalizationUtil.globalize(
|
||||||
|
"publications.ui.proceedings.organizer.down"));
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
@ -155,6 +172,7 @@ public class ProceedingsOrganizerSheet
|
||||||
public Object getKeyAt(final int columnIndex) {
|
public Object getKeyAt(final int columnIndex) {
|
||||||
return organizer.getID();
|
return organizer.getID();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class EditCellRenderer
|
private class EditCellRenderer
|
||||||
|
|
@ -169,8 +187,8 @@ public class ProceedingsOrganizerSheet
|
||||||
Object key,
|
Object key,
|
||||||
int row,
|
int row,
|
||||||
int column) {
|
int column) {
|
||||||
com.arsdigita.cms.SecurityManager securityManager =
|
com.arsdigita.cms.SecurityManager securityManager = CMS
|
||||||
CMS.getSecurityManager(state);
|
.getSecurityManager(state);
|
||||||
Proceedings proceedings = (Proceedings) itemModel.getSelectedObject(
|
Proceedings proceedings = (Proceedings) itemModel.getSelectedObject(
|
||||||
state);
|
state);
|
||||||
|
|
||||||
|
|
@ -188,12 +206,12 @@ public class ProceedingsOrganizerSheet
|
||||||
|
|
||||||
ContentSection section = organizer.getContentSection();//CMS.getContext().getContentSection();
|
ContentSection section = organizer.getContentSection();//CMS.getContext().getContentSection();
|
||||||
ItemResolver resolver = section.getItemResolver();
|
ItemResolver resolver = section.getItemResolver();
|
||||||
Link link =
|
Link link = new Link(value.toString(),
|
||||||
new Link(value.toString(),
|
|
||||||
resolver.generateItemURL(state,
|
resolver.generateItemURL(state,
|
||||||
organizer,
|
organizer,
|
||||||
section,
|
section,
|
||||||
organizer.getVersion()));
|
organizer
|
||||||
|
.getVersion()));
|
||||||
|
|
||||||
return link;
|
return link;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -209,6 +227,7 @@ public class ProceedingsOrganizerSheet
|
||||||
return label;
|
return label;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class DeleteCellRenderer
|
private class DeleteCellRenderer
|
||||||
|
|
@ -223,8 +242,8 @@ public class ProceedingsOrganizerSheet
|
||||||
Object key,
|
Object key,
|
||||||
int row,
|
int row,
|
||||||
int col) {
|
int col) {
|
||||||
com.arsdigita.cms.SecurityManager securityManager =
|
com.arsdigita.cms.SecurityManager securityManager = Utilities
|
||||||
Utilities.getSecurityManager(state);
|
.getSecurityManager(state);
|
||||||
Proceedings proceedings = (Proceedings) itemModel.getSelectedObject(
|
Proceedings proceedings = (Proceedings) itemModel.getSelectedObject(
|
||||||
state);
|
state);
|
||||||
|
|
||||||
|
|
@ -242,20 +261,87 @@ public class ProceedingsOrganizerSheet
|
||||||
return new Label("");
|
return new Label("");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private class UpCellRenderer
|
||||||
|
extends LockableImpl
|
||||||
|
implements TableCellRenderer {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Component getComponent(Table table,
|
||||||
|
PageState state,
|
||||||
|
Object value,
|
||||||
|
boolean isSelected,
|
||||||
|
Object key,
|
||||||
|
int row,
|
||||||
|
int col) {
|
||||||
|
if (0 == row) {
|
||||||
|
Label label = new Label();
|
||||||
|
return label;
|
||||||
|
} else {
|
||||||
|
ControlLink link = new ControlLink((Label) value);
|
||||||
|
return link;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private class DownCellRenderer
|
||||||
|
extends LockableImpl
|
||||||
|
implements TableCellRenderer {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Component getComponent(
|
||||||
|
Table table,
|
||||||
|
PageState state,
|
||||||
|
Object value,
|
||||||
|
boolean isSelected,
|
||||||
|
Object key,
|
||||||
|
int row,
|
||||||
|
int col) {
|
||||||
|
|
||||||
|
Proceedings proceedings = (Proceedings) itemModel
|
||||||
|
.getSelectedObject(state);
|
||||||
|
ProceedingsOrganizerCollection organizers = proceedings
|
||||||
|
.getOrganizers();
|
||||||
|
|
||||||
|
if ((organizers.size() - 1) == row) {
|
||||||
|
Label label = new Label();
|
||||||
|
return label;
|
||||||
|
} else {
|
||||||
|
ControlLink link = new ControlLink((Label) value);
|
||||||
|
return link;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void cellSelected(final TableActionEvent event) {
|
public void cellSelected(final TableActionEvent event) {
|
||||||
PageState state = event.getPageState();
|
PageState state = event.getPageState();
|
||||||
|
|
||||||
Proceedings proceedings = (Proceedings) itemModel.getSelectedObject(
|
final GenericOrganizationalUnit organizer
|
||||||
|
= new GenericOrganizationalUnit(
|
||||||
|
new BigDecimal(event.getRowKey().toString()));
|
||||||
|
|
||||||
|
final Proceedings proceedings = (Proceedings) itemModel
|
||||||
|
.getSelectedObject(
|
||||||
state);
|
state);
|
||||||
|
|
||||||
TableColumn column = getColumnModel().get(event.getColumn().intValue());
|
final ProceedingsOrganizerCollection organizers = proceedings
|
||||||
|
.getOrganizers();
|
||||||
|
|
||||||
|
final TableColumn column = getColumnModel().get(event.getColumn()
|
||||||
|
.intValue());
|
||||||
|
|
||||||
if (column.getHeaderKey().toString().equals(TABLE_COL_EDIT)) {
|
if (column.getHeaderKey().toString().equals(TABLE_COL_EDIT)) {
|
||||||
} else if (column.getHeaderKey().toString().equals(TABLE_COL_DEL)) {
|
} else if (column.getHeaderKey().toString().equals(TABLE_COL_DEL)) {
|
||||||
proceedings.setOrganizerOfConference(null);
|
proceedings.removeOrganizer(organizer);
|
||||||
|
} else if (column.getHeaderKey().toString().equals(TABLE_COL_UP)) {
|
||||||
|
organizers.swapWithPrevious(organizer);
|
||||||
|
} else if (column.getHeaderKey().toString().equals(TABLE_COL_DOWN)) {
|
||||||
|
organizers.swapWithNext(organizer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -263,4 +349,5 @@ public class ProceedingsOrganizerSheet
|
||||||
public void headSelected(final TableActionEvent event) {
|
public void headSelected(final TableActionEvent event) {
|
||||||
//Nothing to do.
|
//Nothing to do.
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -67,7 +67,8 @@ public class ProceedingsPapersAddForm
|
||||||
ITEM_SEARCH,
|
ITEM_SEARCH,
|
||||||
ContentType.findByAssociatedObjectType(
|
ContentType.findByAssociatedObjectType(
|
||||||
InProceedings.class.getName()));
|
InProceedings.class.getName()));
|
||||||
m_itemSearch.setDefaultCreationFolder(config.getDefaultInProceedingsFolder());
|
m_itemSearch.setDefaultCreationFolder(config
|
||||||
|
.getDefaultInProceedingsFolder());
|
||||||
m_itemSearch.setLabel(PublicationGlobalizationUtil.globalize(
|
m_itemSearch.setLabel(PublicationGlobalizationUtil.globalize(
|
||||||
"publications.ui.proceedings.select_paper"));
|
"publications.ui.proceedings.select_paper"));
|
||||||
add(m_itemSearch);
|
add(m_itemSearch);
|
||||||
|
|
@ -91,7 +92,8 @@ public class ProceedingsPapersAddForm
|
||||||
if (!(this.getSaveCancelSection().getCancelButton().
|
if (!(this.getSaveCancelSection().getCancelButton().
|
||||||
isSelected(state))) {
|
isSelected(state))) {
|
||||||
InProceedings paper = (InProceedings) data.get(ITEM_SEARCH);
|
InProceedings paper = (InProceedings) data.get(ITEM_SEARCH);
|
||||||
paper = (InProceedings) paper.getContentBundle().getInstance(proceedings.
|
paper = (InProceedings) paper.getContentBundle().getInstance(
|
||||||
|
proceedings.
|
||||||
getLanguage());
|
getLanguage());
|
||||||
|
|
||||||
proceedings.addPaper(paper);
|
proceedings.addPaper(paper);
|
||||||
|
|
@ -125,10 +127,11 @@ public class ProceedingsPapersAddForm
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
paper = (InProceedings) paper.getContentBundle().getInstance(proceedings.
|
paper = (InProceedings) paper.getContentBundle().getInstance(proceedings
|
||||||
getLanguage());
|
.getLanguage());
|
||||||
InProceedingsCollection papers = proceedings.getPapers();
|
InProceedingsCollection papers = proceedings.getPapers();
|
||||||
papers.addFilter(String.format("id = %s", paper.getID().toString()));
|
papers.addFilter(String.format("id = %s", paper.getContentBundle()
|
||||||
|
.getID().toString()));
|
||||||
if (papers.size() > 0) {
|
if (papers.size() > 0) {
|
||||||
data.addError(
|
data.addError(
|
||||||
PublicationGlobalizationUtil.globalize(
|
PublicationGlobalizationUtil.globalize(
|
||||||
|
|
@ -136,4 +139,5 @@ public class ProceedingsPapersAddForm
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue