- ExtraXMLGenerator von SciMember in ccm-cms verlegt, wird jetzt für alle von GenericPerson abgeleiteten Type verwendet
- Übersetzungsfehler in GenericPersonCreate behoben git-svn-id: https://svn.libreccm.org/ccm/trunk@1605 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
1430a1b1bb
commit
41b3d7316c
|
|
@ -20,8 +20,10 @@ package com.arsdigita.cms.contenttypes;
|
||||||
|
|
||||||
import com.arsdigita.cms.ContentPage;
|
import com.arsdigita.cms.ContentPage;
|
||||||
import com.arsdigita.cms.ContentType;
|
import com.arsdigita.cms.ContentType;
|
||||||
|
import com.arsdigita.cms.ExtraXMLGenerator;
|
||||||
import com.arsdigita.cms.LanguageInvariantContentItem;
|
import com.arsdigita.cms.LanguageInvariantContentItem;
|
||||||
import com.arsdigita.cms.RelationAttributeInterface;
|
import com.arsdigita.cms.RelationAttributeInterface;
|
||||||
|
import com.arsdigita.cms.contenttypes.ui.GenericPersonExtraXmlGenerator;
|
||||||
import com.arsdigita.domain.DataObjectNotFoundException;
|
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||||
import com.arsdigita.domain.DomainObjectFactory;
|
import com.arsdigita.domain.DomainObjectFactory;
|
||||||
import com.arsdigita.persistence.DataObject;
|
import com.arsdigita.persistence.DataObject;
|
||||||
|
|
@ -29,6 +31,7 @@ import com.arsdigita.persistence.OID;
|
||||||
import com.arsdigita.util.Assert;
|
import com.arsdigita.util.Assert;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -60,7 +63,6 @@ public class GenericPerson extends ContentPage implements
|
||||||
*/
|
*/
|
||||||
public static final String BASE_DATA_OBJECT_TYPE =
|
public static final String BASE_DATA_OBJECT_TYPE =
|
||||||
"com.arsdigita.cms.contenttypes.GenericPerson";
|
"com.arsdigita.cms.contenttypes.GenericPerson";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default constructor. This creates a new (empty) GenericPerson.
|
* Default constructor. This creates a new (empty) GenericPerson.
|
||||||
|
|
@ -75,17 +77,17 @@ public class GenericPerson extends ContentPage implements
|
||||||
}
|
}
|
||||||
|
|
||||||
public GenericPerson(OID id) throws DataObjectNotFoundException {
|
public GenericPerson(OID id) throws DataObjectNotFoundException {
|
||||||
super(id);
|
super(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public GenericPerson(DataObject obj) {
|
public GenericPerson(DataObject obj) {
|
||||||
super(obj);
|
super(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
public GenericPerson(String type) {
|
public GenericPerson(String type) {
|
||||||
super(type);
|
super(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
public GenericPersonBundle getGenericPersonBundle() {
|
public GenericPersonBundle getGenericPersonBundle() {
|
||||||
return (GenericPersonBundle) getContentBundle();
|
return (GenericPersonBundle) getContentBundle();
|
||||||
}
|
}
|
||||||
|
|
@ -330,7 +332,24 @@ public class GenericPerson extends ContentPage implements
|
||||||
return getFullName();
|
return getFullName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isLanguageInvariant() {
|
public boolean isLanguageInvariant() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ExtraXMLGenerator> getExtraXMLGenerators() {
|
||||||
|
final List<ExtraXMLGenerator> generators = super.
|
||||||
|
getExtraListXMLGenerators();
|
||||||
|
generators.add(new GenericPersonExtraXmlGenerator());
|
||||||
|
return generators;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ExtraXMLGenerator> getExtraListXMLGenerators() {
|
||||||
|
final List<ExtraXMLGenerator> generators = super.
|
||||||
|
getExtraListXMLGenerators();
|
||||||
|
generators.add(new GenericPersonExtraXmlGenerator());
|
||||||
|
return generators;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@ import com.arsdigita.bebop.PageState;
|
||||||
import com.arsdigita.bebop.event.FormSectionEvent;
|
import com.arsdigita.bebop.event.FormSectionEvent;
|
||||||
import com.arsdigita.bebop.parameters.DateParameter;
|
import com.arsdigita.bebop.parameters.DateParameter;
|
||||||
import com.arsdigita.bebop.parameters.ParameterModel;
|
import com.arsdigita.bebop.parameters.ParameterModel;
|
||||||
import com.arsdigita.bebop.util.GlobalizationUtil;
|
|
||||||
import com.arsdigita.cms.ContentPage;
|
import com.arsdigita.cms.ContentPage;
|
||||||
import com.arsdigita.cms.ContentSection;
|
import com.arsdigita.cms.ContentSection;
|
||||||
import com.arsdigita.cms.ContentType;
|
import com.arsdigita.cms.ContentType;
|
||||||
|
|
@ -24,6 +23,7 @@ import com.arsdigita.cms.ui.authoring.ApplyWorkflowFormSection;
|
||||||
import com.arsdigita.cms.ui.authoring.CreationSelector;
|
import com.arsdigita.cms.ui.authoring.CreationSelector;
|
||||||
import com.arsdigita.cms.ui.authoring.LanguageWidget;
|
import com.arsdigita.cms.ui.authoring.LanguageWidget;
|
||||||
import com.arsdigita.cms.ui.authoring.PageCreate;
|
import com.arsdigita.cms.ui.authoring.PageCreate;
|
||||||
|
import com.arsdigita.cms.util.GlobalizationUtil;
|
||||||
import com.arsdigita.util.Assert;
|
import com.arsdigita.util.Assert;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
|
@ -48,8 +48,7 @@ public class GenericPersonCreate extends PageCreate {
|
||||||
ContentType type = getItemSelectionModel().getContentType();
|
ContentType type = getItemSelectionModel().getContentType();
|
||||||
m_workflowSection = new ApplyWorkflowFormSection(type);
|
m_workflowSection = new ApplyWorkflowFormSection(type);
|
||||||
add(m_workflowSection, ColumnPanel.INSERT);
|
add(m_workflowSection, ColumnPanel.INSERT);
|
||||||
add(new Label(GlobalizationUtil.globalize(
|
add(new Label(GlobalizationUtil.globalize("cms.ui.authoring.content_type")));
|
||||||
"cms.ui.authoring.content_type")));
|
|
||||||
add(new Label(type.getLabel()));
|
add(new Label(type.getLabel()));
|
||||||
add(new Label(GlobalizationUtil.globalize("cms.ui.language.field")));
|
add(new Label(GlobalizationUtil.globalize("cms.ui.language.field")));
|
||||||
add(new LanguageWidget(LANGUAGE));
|
add(new LanguageWidget(LANGUAGE));
|
||||||
|
|
|
||||||
|
|
@ -53,20 +53,5 @@ public class SciMember extends GenericPerson {
|
||||||
|
|
||||||
public SciMember(final String type) {
|
public SciMember(final String type) {
|
||||||
super(type);
|
super(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<ExtraXMLGenerator> getExtraXMLGenerators() {
|
|
||||||
final List<ExtraXMLGenerator> generators = super.getExtraListXMLGenerators();
|
|
||||||
generators.add(new SciMemberExtraXmlGenerator());
|
|
||||||
return generators;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<ExtraXMLGenerator> getExtraListXMLGenerators() {
|
|
||||||
final List<ExtraXMLGenerator> generators = super.getExtraListXMLGenerators();
|
|
||||||
generators.add(new SciMemberExtraXmlGenerator());
|
|
||||||
return generators;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,62 +0,0 @@
|
||||||
package com.arsdigita.cms.contenttypes;
|
|
||||||
|
|
||||||
import com.arsdigita.bebop.Page;
|
|
||||||
import com.arsdigita.bebop.PageState;
|
|
||||||
import com.arsdigita.cms.ContentItem;
|
|
||||||
import com.arsdigita.cms.ExtraXMLGenerator;
|
|
||||||
import com.arsdigita.cms.dispatcher.SimpleXMLGenerator;
|
|
||||||
import com.arsdigita.cms.dispatcher.XMLGenerator;
|
|
||||||
import com.arsdigita.xml.Element;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Jens Pelzetter
|
|
||||||
* @version $Id$
|
|
||||||
*/
|
|
||||||
public class SciMemberExtraXmlGenerator implements ExtraXMLGenerator {
|
|
||||||
|
|
||||||
public void generateXML(final ContentItem item,
|
|
||||||
final Element element,
|
|
||||||
final PageState state) {
|
|
||||||
if (!(item instanceof SciMember)) {
|
|
||||||
throw new IllegalArgumentException(
|
|
||||||
"The SciMemberExtraXmlGenerator can only process "
|
|
||||||
+ "instances of SciMember");
|
|
||||||
}
|
|
||||||
|
|
||||||
final SciMember member = (SciMember) item;
|
|
||||||
final GenericPersonContactCollection contacts = member.getContacts();
|
|
||||||
|
|
||||||
final Element contactsElem = element.newChildElement("contacts");
|
|
||||||
while (contacts.next()) {
|
|
||||||
generateContactXml(contactsElem, contacts.getContact(), state);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addGlobalStateParams(final Page page) {
|
|
||||||
//Nothing for now
|
|
||||||
}
|
|
||||||
|
|
||||||
private void generateContactXml(final Element contactsElem,
|
|
||||||
final GenericContact contact,
|
|
||||||
final PageState state) {
|
|
||||||
final XmlGenerator generator = new XmlGenerator(contact);
|
|
||||||
generator.setItemElemName("contact", "");
|
|
||||||
generator.addItemAttribute("contactType", contact.getContactType());
|
|
||||||
generator.generateXML(state, contactsElem, "");
|
|
||||||
}
|
|
||||||
|
|
||||||
private class XmlGenerator extends SimpleXMLGenerator {
|
|
||||||
|
|
||||||
private ContentItem item;
|
|
||||||
|
|
||||||
public XmlGenerator(final ContentItem item) {
|
|
||||||
this.item = item;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ContentItem getContentItem(final PageState state) {
|
|
||||||
return item;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue