Assoziation zwischen GenericOrganizationalUnit und GenericPerson ist jetzt unabhängig von der Sprache der Items.

git-svn-id: https://svn.libreccm.org/ccm/trunk@1480 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2012-01-30 13:52:00 +00:00
parent b1aa546295
commit 050cd8bb3c
20 changed files with 299 additions and 415 deletions

View File

@ -30,6 +30,10 @@ object type GenericOrganizationalUnit extends ContentPage {
reference key (cms_organizationalunits.organizationalunit_id);
}
object type GenericOrganizationalUnitBundle extends ContentBundle {
reference key (cms_orgaunit_bundles.bundle_id);
}
// Link for contact points.
association {
@ -52,15 +56,15 @@ association {
// Links a organization with persons.
association {
GenericOrganizationalUnit[0..n] organizationalunit = join cms_persons.person_id
GenericOrganizationalUnitBundle[0..n] organizationalunits = join cms_bundles.bundle_id
to cms_organizationalunits_person_map.person_id,
join cms_organizationalunits_person_map.organizationalunit_id
to cms_organizationalunits.organizationalunit_id;
to cms_bundles.bundle_id;
GenericPerson[0..n] persons = join cms_organizationalunits.organizationalunit_id
GenericPersonBundle[0..n] persons = join cms_bundles.bundle_id
to cms_organizationalunits_person_map.organizationalunit_id,
join cms_organizationalunits_person_map.person_id
to cms_persons.person_id;
to cms_bundles.bundle_id;
// Additional attributes for the association
String[0..1] role_name = cms_organizationalunits_person_map.role_name VARCHAR(100);

View File

@ -20,6 +20,7 @@
model com.arsdigita.cms.contenttypes;
import com.arsdigita.cms.ContentPage;
import com.arsdigita.cms.ContentBundle;
object type GenericPerson extends ContentPage {
String[0..1] surname = cms_persons.surname VARCHAR(512);
@ -37,3 +38,7 @@ object type GenericPerson extends ContentPage {
reference key (cms_persons.person_id);
}
object type GenericPersonBundle extends ContentBundle {
reference key (cms_person_bundles.bundle_id);
}

View File

@ -0,0 +1,13 @@
CREATE TABLE cms_publish_lock (
lock_id integer NOT NULL,
locked_oid character varying(2048),
lock_timestamp timestamp with time zone,
action character varying(256)
);
ALTER TABLE ONLY cms_publish_lock
ADD CONSTRAINT cms_publis_loc_lock_id_p_8n7d0 PRIMARY KEY (lock_id);
-- ALTER TABLE public.cms_publish_lock OWNER TO ccm;

View File

@ -12,7 +12,7 @@
classname= "com.arsdigita.cms.contenttypes.GenericOrganizationalUnit"
mode="hidden">
<ctd:authoring-kit createComponent="com.arsdigita.cms.ui.authoring.PageCreate">
<ctd:authoring-kit createComponent="com.arsdigita.cms.contenttypes.ui.GenericOrganizationalUnitCreate">
<ctd:authoring-step
labelKey="cms.contenttypes.shared.basic_properties.title"

View File

@ -19,13 +19,11 @@
*/
package com.arsdigita.cms.contenttypes;
import com.arsdigita.cms.ContentBundle;
import com.arsdigita.cms.ContentPage;
import com.arsdigita.cms.contenttypes.ui.GenericOrganizationalUnitSubordinateOrgaUnitAddForm;
import com.arsdigita.cms.contenttypes.ui.GenericOrganizationalUnitSubordinateOrgaUnitsTable;
import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
import com.arsdigita.domain.DataObjectNotFoundException;
import com.arsdigita.kernel.Kernel;
import com.arsdigita.persistence.DataCollection;
import com.arsdigita.persistence.DataObject;
import com.arsdigita.persistence.OID;
@ -79,6 +77,10 @@ public class GenericOrganizationalUnit extends ContentPage {
super(type);
}
public GenericOrganizationalUnitBundle getGenericOrganizationalUnitBundle() {
return (GenericOrganizationalUnitBundle) getContentBundle();
}
public String getAddendum() {
return (String) get(ADDENDUM);
}
@ -117,7 +119,7 @@ public class GenericOrganizationalUnit extends ContentPage {
}
public GenericOrganizationalUnitPersonCollection getPersons() {
DataCollection dataColl = (DataCollection) get(PERSONS);
DataCollection dataColl = (DataCollection) getContentBundle().get(PERSONS);
logger.debug(String.format(
"GenericOrganizationalUnitPersonCollection size = %d", dataColl.
size()));
@ -127,12 +129,14 @@ public class GenericOrganizationalUnit extends ContentPage {
public void addPerson(final GenericPerson person,
final String role,
final String status) {
Assert.exists(person, GenericPerson.class);
getGenericOrganizationalUnitBundle().addPerson(person, role, status);
GenericPerson personToLink = person;
//Assert.exists(person, GenericPerson.class);
final ContentBundle bundle = person.getContentBundle();
if ((bundle != null) && (bundle.hasInstance(this.getLanguage(), Kernel.
//GenericPerson personToLink = person;
//final ContentBundle bundle = person.getContentBundle();
/*if ((bundle != null) && (bundle.hasInstance(this.getLanguage(), Kernel.
getConfig().
languageIndependentItems()))) {
personToLink =
@ -141,21 +145,25 @@ public class GenericOrganizationalUnit extends ContentPage {
Assert.exists(personToLink, GenericPerson.class);
final DataObject link = add(PERSONS, personToLink);
final DataObject link = add(PERSONS, personToLink);*/
link.set(GenericOrganizationalUnitPersonCollection.PERSON_ROLE, role);
link.set(GenericOrganizationalUnitPersonCollection.STATUS, status);
link.save();
//final DataObject link = getContentBundle().add(PERSONS, bundle);
//link.set(GenericOrganizationalUnitPersonCollection.PERSON_ROLE, role);
//link.set(GenericOrganizationalUnitPersonCollection.STATUS, status);
//link.save();
}
public void removePerson(final GenericPerson person) {
logger.debug("Removing person association...");
Assert.exists(person, GenericPerson.class);
remove(PERSONS, person);
//Assert.exists(person, GenericPerson.class);
//remove(PERSONS, person.getContentBundle());
getGenericOrganizationalUnitBundle().removePerson(person);
}
public boolean hasPersons() {
return !this.getPersons().isEmpty();
//return !this.getPersons().isEmpty();
return getGenericOrganizationalUnitBundle().hasPersons();
}
public GenericOrganizationalUnitSuperiorCollection getSuperiorOrgaUnits() {

View File

@ -0,0 +1,80 @@
package com.arsdigita.cms.contenttypes;
import com.arsdigita.cms.ContentBundle;
import com.arsdigita.cms.ContentItem;
import com.arsdigita.domain.DataObjectNotFoundException;
import com.arsdigita.persistence.DataCollection;
import com.arsdigita.persistence.DataObject;
import com.arsdigita.persistence.OID;
import com.arsdigita.util.Assert;
import java.math.BigDecimal;
/**
*
* @author Jens Pelzetter
* @version $Id$
*/
public class GenericOrganizationalUnitBundle extends ContentBundle {
public static final String BASE_DATA_OBJECT_TYPE =
"com.arsdigita.cms.contenttypes.GenericOrganizationalUnitBundle";
public static final String PERSONS = "persons";
public static final String ORGAUNITS = "organizationalunits";
public GenericOrganizationalUnitBundle(final ContentItem primary) {
super(BASE_DATA_OBJECT_TYPE);
Assert.exists(primary, ContentItem.class);
setDefaultLanguage(primary.getLanguage());
setContentType(primary.getContentType());
addInstance(primary);
super.setName(primary.getName());
}
public GenericOrganizationalUnitBundle(final OID oid)
throws DataObjectNotFoundException {
super(oid);
}
public GenericOrganizationalUnitBundle(final BigDecimal id)
throws DataObjectNotFoundException {
super(new OID(BASE_DATA_OBJECT_TYPE, id));
}
public GenericOrganizationalUnitBundle(final DataObject dobj) {
super(dobj);
}
public GenericOrganizationalUnitBundle(final String type) {
super(type);
}
public GenericOrganizationalUnitPersonCollection getPersons() {
return new GenericOrganizationalUnitPersonCollection((DataCollection) get(
PERSONS));
}
public void addPerson(final GenericPerson person,
final String role,
final String status) {
Assert.exists(person, GenericPerson.class);
final DataObject link = add(PERSONS, person.getGenericPersonBundle());
link.set(GenericOrganizationalUnitPersonCollection.PERSON_ROLE, role);
link.set(GenericOrganizationalUnitPersonCollection.STATUS, status);
link.save();
}
public void removePerson(final GenericPerson person) {
Assert.exists(person, GenericPerson.class);
remove(PERSONS, person.getContentBundle());
}
public boolean hasPersons() {
return !getPersons().isEmpty();
}
}

View File

@ -18,6 +18,7 @@
*/
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;
@ -40,8 +41,7 @@ public class GenericOrganizationalUnitPersonCollection extends DomainCollection
public GenericOrganizationalUnitPersonCollection(
DataCollection dataCollection) {
super(dataCollection);
dataCollection.addOrder(
"surname asc, givenname asc, titlepre asc, titlepost asc");
dataCollection.addOrder("name asc");
}
/**
@ -69,8 +69,10 @@ public class GenericOrganizationalUnitPersonCollection extends DomainCollection
}
public GenericPerson getPerson() {
return (GenericPerson) DomainObjectFactory.newInstance(m_dataCollection.
getDataObject());
/*return (GenericPerson) DomainObjectFactory.newInstance(m_dataCollection.
getDataObject());*/
final ContentBundle bundle = (ContentBundle) DomainObjectFactory.newInstance(m_dataCollection.getDataObject());
return (GenericPerson) bundle.getPrimaryInstance();
}
public OID getOID() {
@ -78,42 +80,44 @@ public class GenericOrganizationalUnitPersonCollection extends DomainCollection
}
public String getSurname() {
return (String) m_dataCollection.getDataObject().get(
GenericPerson.SURNAME);
/*return (String) m_dataCollection.getDataObject().get(
GenericPerson.SURNAME);*/
return getPerson().getSurname();
}
public String getGivenName() {
return (String) m_dataCollection.getDataObject().get(
GenericPerson.GIVENNAME);
/*return (String) m_dataCollection.getDataObject().get(
GenericPerson.GIVENNAME);*/
return getPerson().getGivenName();
}
public String getTitlePre() {
return (String) m_dataCollection.getDataObject().get(
GenericPerson.TITLEPRE);
/*return (String) m_dataCollection.getDataObject().get(
GenericPerson.TITLEPRE);*/
return getPerson().getTitlePre();
}
public String getTitlePost() {
return (String) m_dataCollection.getDataObject().get(
GenericPerson.TITLEPOST);
/*return (String) m_dataCollection.getDataObject().get(
GenericPerson.TITLEPOST);*/
return getPerson().getTitlePost();
}
public Date getBirthdate() {
return (Date) m_dataCollection.getDataObject().get(
GenericPerson.BIRTHDATE);
/*return (Date) m_dataCollection.getDataObject().get(
GenericPerson.BIRTHDATE);*/
return getPerson().getBirthdate();
}
public String getGender() {
return (String) m_dataCollection.getDataObject().get(
GenericPerson.GENDER);
/*return (String) m_dataCollection.getDataObject().get(
GenericPerson.GENDER);*/
return getPerson().getGender();
}
public DataCollection getContacts() {
return (DataCollection) m_dataCollection.getDataObject().get(
GenericPerson.CONTACTS);
}
public DataObject getAlias() {
return (DataObject) m_dataCollection.getDataObject().get(
GenericPerson.ALIAS);
public GenericPerson getAlias() {
/*return (DataObject) m_dataCollection.getDataObject().get(
GenericPerson.ALIAS);*/
return getPerson().getAlias();
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2010 Sören Bernstein, for the Center of Social Politics of the University of Bremen
* Copyright (C) 2010 Sören Bernstein
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
@ -83,6 +83,10 @@ public class GenericPerson extends ContentPage implements
super(type);
}
public GenericPersonBundle getGenericPersonBundle() {
return (GenericPersonBundle) getContentBundle();
}
@Override
public void beforeSave() {
super.beforeSave();

View File

@ -0,0 +1,50 @@
package com.arsdigita.cms.contenttypes;
import com.arsdigita.cms.ContentBundle;
import com.arsdigita.cms.ContentItem;
import com.arsdigita.domain.DataObjectNotFoundException;
import com.arsdigita.persistence.DataObject;
import com.arsdigita.persistence.OID;
import com.arsdigita.util.Assert;
import java.math.BigDecimal;
/**
*
* @author Jens Pelzetter
* @version $Id$
*/
public class GenericPersonBundle extends ContentBundle {
public final static String BASE_DATA_OBJECT_TYPE = "com.arsdigita.cms.contenttypes.GenericPersonBundle";
public GenericPersonBundle(final ContentItem primary) {
super(BASE_DATA_OBJECT_TYPE);
Assert.exists(primary, ContentItem.class);
setDefaultLanguage(primary.getLanguage());
setContentType(primary.getContentType());
addInstance(primary);
super.setName(primary.getName());
}
public GenericPersonBundle(final OID oid) throws DataObjectNotFoundException {
super(oid);
}
public GenericPersonBundle(final BigDecimal id) throws DataObjectNotFoundException {
super(new OID(BASE_DATA_OBJECT_TYPE, id));
}
public GenericPersonBundle(final DataObject dobj) {
super(dobj);
}
public GenericPersonBundle(final String type) {
super(type);
}
}

View File

@ -0,0 +1,54 @@
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.FormSectionEvent;
import com.arsdigita.cms.ContentPage;
import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.Folder;
import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitBundle;
import com.arsdigita.cms.ui.authoring.CreationSelector;
import com.arsdigita.cms.ui.authoring.PageCreate;
import java.util.Date;
/**
*
* @author Jens Pelzetter
* @version $Id$
*/
public class GenericOrganizationalUnitCreate extends PageCreate {
public GenericOrganizationalUnitCreate(final ItemSelectionModel itemModel,
final CreationSelector parent) {
super(itemModel, parent);
}
@Override
public void process(final FormSectionEvent fse) throws FormProcessException {
final FormData data = fse.getFormData();
final PageState state = fse.getPageState();
final ContentSection section = m_parent.getContentSection(state);
final Folder folder = m_parent.getFolder(state);
final ContentPage item = createContentPage(state);
item.setLanguage((String) data.get(LANGUAGE));
item.setName((String) data.get(NAME));
item.setTitle((String) data.get(TITLE));
if (!ContentSection.getConfig().getHideLaunchDate()) {
item.setLaunchDate((Date) data.get(LAUNCH_DATE));
}
final GenericOrganizationalUnitBundle bundle = new GenericOrganizationalUnitBundle(
item);
bundle.setParent(folder);
bundle.setContentSection(section);
bundle.save();
m_workflowSection.applyWorkflow(state, item);
m_parent.editItem(state, item);
}
}

View File

@ -1,345 +0,0 @@
/*
* Copyright (c) 2010 Jens Pelzetter,
* for the Center of Social Politics of the University of Bremen
*
* 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.PageState;
import com.arsdigita.cms.ContentItem;
import com.arsdigita.cms.contenttypes.GenericAddress;
import com.arsdigita.cms.contenttypes.GenericContact;
import com.arsdigita.cms.contenttypes.GenericContactEntry;
import com.arsdigita.cms.contenttypes.GenericContactEntryCollection;
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit;
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitContactCollection;
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitPersonCollection;
import com.arsdigita.cms.contenttypes.GenericPerson;
import com.arsdigita.cms.contenttypes.GenericPersonContactCollection;
import com.arsdigita.cms.dispatcher.SimpleXMLGenerator;
import com.arsdigita.xml.Element;
import org.apache.log4j.Logger;
/**
*
* @author Jens Pelzetter
*
* @deprecated Replaced with {@link GenericOrgaUnitExtraXmlGenerator}.
*/
@Deprecated
public class GenericOrganizationalUnitPanel extends CompoundContentItemPanel {
private final static Logger logger =
Logger.getLogger(GenericOrganizationalUnit.class);
public static final String SHOW_CONTACTS = "contacts";
public static final String SHOW_MEMBERS = "members";
private boolean displayContacts = true;
private boolean displayMembers = true;
@Override
protected String getDefaultShowParam() {
return SHOW_CONTACTS;
}
@Override
protected Class<? extends ContentItem> getAllowedClass() {
return GenericOrganizationalUnit.class;
}
public boolean isDisplayContacts() {
return displayContacts;
}
public void setDisplayContacts(boolean displayContacts) {
this.displayContacts = displayContacts;
}
public boolean isDisplayMembers() {
return displayMembers;
}
public void setDisplayMembers(boolean displayMembers) {
this.displayMembers = displayMembers;
}
protected void generateContactsXML(GenericOrganizationalUnit orga,
Element parent, PageState state) {
long start = System.currentTimeMillis();
GenericOrganizationalUnitContactCollection contacts;
contacts = orga.getContacts();
long pageNumber = getPageNumber(state);
long pageCount = getPageCount(contacts.size());
long begin = getPaginatorBegin(pageNumber);
long count = getPaginatorCount(begin, contacts.size());
long end = getPaginatorEnd(begin, count);
pageNumber = normalizePageNumber(pageCount, pageNumber);
createPaginatorElement(parent, pageNumber, pageCount, begin, end,
count, contacts.size());
contacts.setRange((int) begin + 1, (int) end + 1);
Element contactsElem = parent.newChildElement("contacts");
while (contacts.next()) {
GenericContact contact;
contact = contacts.getContact();
generateGenericContactXML(contact,
contactsElem,
state,
Integer.toString(
contacts.getContactOrder()),
true);
}
System.out.printf("Generated Contacts XML in %d ms.\n", System.
currentTimeMillis() - start);
}
protected void generateMembersXML(GenericOrganizationalUnit orga,
Element parent,
PageState state) {
GenericOrganizationalUnitPersonCollection persons;
persons = orga.getPersons();
long pageNumber = getPageNumber(state);
Element personsElem = parent.newChildElement("members");
long pageCount = getPageCount(persons.size());
long begin = getPaginatorBegin(pageNumber);
long count = getPaginatorCount(begin, persons.size());
long end = getPaginatorEnd(begin, persons.size());
pageNumber = normalizePageNumber(pageCount, pageNumber);
createPaginatorElement(parent, pageNumber, pageCount, begin, end,
count, persons.size());
persons.setRange((int) begin + 1, (int) end + 1);
while (persons.next()) {
Element personElem = personsElem.newChildElement("member");
//Element title = personElem.newChildElement("title");
//title.setText(person.getTitle());
if ((persons.getTitlePre() != null)
&& !persons.getTitlePre().isEmpty()) {
Element titlePre = personElem.newChildElement("titlePre");
titlePre.setText(persons.getTitlePre());
}
Element surname = personElem.newChildElement("surname");
surname.setText(persons.getSurname());
Element givenName = personElem.newChildElement("givenname");
givenName.setText(persons.getGivenName());
if ((persons.getTitlePost() != null)
&& !persons.getTitlePost().isEmpty()) {
Element titlePost = personElem.newChildElement("titlePost");
titlePost.setText(persons.getTitlePost());
}
GenericPersonContactCollection contacts =
new GenericPersonContactCollection(
persons.getContacts());
if ((contacts != null) && (contacts.size() > 0)) {
Element contactsElem =
personElem.newChildElement("contacts");
while (contacts.next()) {
generateContactXML(contacts.getContactType(),
contacts.getPerson(),
contacts.getContactEntries(),
contacts.getAddress(),
contactsElem,
state,
contacts.getContactOrder(),
false);
}
}
}
}
protected void generateContactXML(
final String contactType,
final GenericPerson person,
final GenericContactEntryCollection contactEntries,
final GenericAddress address,
final Element parent,
final PageState state,
final String order,
final boolean withPerson) {
Element contactElem = parent.newChildElement("contact");
contactElem.addAttribute("order", order);
//Element title = contactElem.newChildElement("title");
//title.setText(contact.getTitle());
Element typeElem = contactElem.newChildElement("type");
typeElem.setText(contactType);
if (withPerson) {
if (person != null) {
Element personElem = contactElem.newChildElement("person");
if ((person.getTitlePre() != null) && !person.getTitlePre().
isEmpty()) {
Element titlePre =
personElem.newChildElement("titlePre");
titlePre.setText(person.getTitlePre());
}
Element givenName = contactElem.newChildElement("givenname");
givenName.setText(person.getGivenName());
Element surname = contactElem.newChildElement("surname");
surname.setText(person.getSurname());
if ((person.getTitlePost() != null)
&& !person.getTitlePost().isEmpty()) {
Element titlePost = contactElem.newChildElement(
"titlePost");
titlePost.setText(person.getTitlePost());
}
}
}
if ((contactEntries != null)
&& (contactEntries.size() > 0)) {
Element contactEntriesElem =
contactElem.newChildElement("contactEntries");
while (contactEntries.next()) {
GenericContactEntry contactEntry =
contactEntries.getContactEntry();
Element contactEntryElem =
contactEntriesElem.newChildElement(
"contactEntry");
contactEntryElem.addAttribute("key",
contactEntry.getKey());
Element valueElem = contactEntryElem.newChildElement(
"value");
valueElem.setText(contactEntry.getValue());
if ((contactEntry.getDescription() != null)
&& !contactEntry.getDescription().isEmpty()) {
Element descElem = contactEntryElem.newChildElement(
"description");
descElem.setText(contactEntry.getDescription());
}
}
}
if (address != null) {
Element addressElem = contactElem.newChildElement(
"address");
Element postalCode = addressElem.newChildElement(
"postalCode");
postalCode.setText(address.getPostalCode());
Element city = addressElem.newChildElement("city");
city.setText(address.getCity());
Element data = addressElem.newChildElement("address");
data.setText(address.getAddress());
Element country = addressElem.newChildElement("country");
country.setText(address.getIsoCountryCode());
Element theState = addressElem.newChildElement("state");
theState.setText(address.getState());
}
}
protected void generateGenericContactXML(final GenericContact contact,
final Element parent,
final PageState state,
final String order,
final boolean withPerson) {
ContactXmlLGenerator generator = new ContactXmlLGenerator(contact);
generator.generateXML(state, parent, order);
}
protected void generateAvailableDataXml(final GenericOrganizationalUnit orga,
final Element element,
final PageState state) {
if ((orga.getContacts() != null)
&& (orga.getContacts().size() > 0)
&& displayMembers) {
element.newChildElement("contacts");
}
if ((orga.getPersons() != null)
&& (orga.getPersons().size() > 0)
&& displayMembers) {
element.newChildElement("members");
}
}
protected void generateDataXml(final GenericOrganizationalUnit orga,
final Element element,
final PageState state) {
String show = getShowParam(state);
if (SHOW_CONTACTS.equals(show)) {
generateContactsXML(orga, element, state);
} else if (SHOW_MEMBERS.equals(show)) {
generateMembersXML(orga, element, state);
}
}
@Override
public void generateXML(ContentItem item,
Element element,
PageState state) {
Element content = generateBaseXML(item, element, state);
GenericOrganizationalUnit orga = (GenericOrganizationalUnit) item;
Element availableData = content.newChildElement("availableData");
if (!isShowOnlyDefault()) {
generateAvailableDataXml(orga, availableData, state);
}
generateDataXml(orga, content, state);
/*if ((orga.getContacts() != null)
&& (orga.getContacts().size() > 0)
&& displayMembers) {
availableData.newChildElement("contacts");
}
if ((orga.getPersons() != null)
&& (orga.getPersons().size() > 0)
&& displayMembers) {
availableData.newChildElement("members");
}
String show = getShowParam(state);
if (SHOW_CONTACTS.equals(show)) {
generateContactsXML(orga, content, state);
} else if (SHOW_MEMBERS.equals(show)) {
generateMembersXML(orga, content, state);
}*/
}
private class ContactXmlLGenerator extends SimpleXMLGenerator {
private GenericContact contact;
public ContactXmlLGenerator(final GenericContact contact) {
super();
this.contact = contact;
}
@Override
protected ContentItem getContentItem(PageState state) {
return contact;
}
}
}

View File

@ -32,6 +32,7 @@ import com.arsdigita.bebop.form.SingleSelect;
import com.arsdigita.bebop.parameters.NotNullValidationListener;
import com.arsdigita.bebop.parameters.ParameterModel;
import com.arsdigita.bebop.parameters.StringParameter;
import com.arsdigita.cms.ContentBundle;
import com.arsdigita.cms.ContentType;
import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.RelationAttribute;
@ -178,8 +179,6 @@ public class GenericOrganizationalUnitPersonAddForm
if (person == null) {
GenericPerson personToAdd =
(GenericPerson) data.get(ITEM_SEARCH);
personToAdd.getContentBundle().getInstance(orga.getLanguage());
logger.debug(String.format("Adding person %s",
personToAdd.getFullName()));
@ -246,7 +245,7 @@ public class GenericOrganizationalUnitPersonAddForm
GenericPerson person = (GenericPerson) data.get(ITEM_SEARCH);
if (!(person.getContentBundle().hasInstance(orga.getLanguage(),
/*if (!(person.getContentBundle().hasInstance(orga.getLanguage(),
Kernel.getConfig().
languageIndependentItems()))) {
data.addError(
@ -254,15 +253,21 @@ public class GenericOrganizationalUnitPersonAddForm
"cms.contenttypes.ui.genericorgaunit.person.no_suitable_language_variant"));
return;
}
}*/
person = (GenericPerson) person.getContentBundle().getInstance(orga.
final ContentBundle bundle = person.getContentBundle();
final GenericOrganizationalUnitPersonCollection persons =
orga.getPersons();
persons.addFilter(String.format("id = %s",
bundle.getID().toString()));
/*person = (GenericPerson) person.getContentBundle().getInstance(orga.
getLanguage());
GenericOrganizationalUnitPersonCollection persons =
orga.getPersons();
persons.addFilter(String.format("id = %s",
person.getID().toString()));
person.getID().toString()));*/
if (persons.size() > 0) {
data.addError(
ContenttypesGlobalizationUtil.globalize(

View File

@ -49,7 +49,7 @@ import java.math.BigDecimal;
import org.apache.log4j.Logger;
/**
* Table for showing the persons associated with an organization.
* Table for showing the persons associated with an organisation.
*
* @author Jens Pelzetter
*/
@ -247,9 +247,8 @@ public class GenericOrganizationalUnitPersonsTable extends Table implements
ContentSection section = CMS.getContext().getContentSection();
ItemResolver resolver = section.getItemResolver();
Link link =
new Link(String.format("%s (%s)",
value.toString(),
person.getLanguage()),
new Link(String.format("%s",
value.toString()),
resolver.generateItemURL(state,
person,
section,
@ -267,7 +266,7 @@ public class GenericOrganizationalUnitPersonsTable extends Table implements
return new Label(value.toString());
}
Label label = new Label(String.format("%s (%s)",
Label label = new Label(String.format("%s",
value.toString(),
person.getLanguage()));

View File

@ -20,6 +20,7 @@ import com.arsdigita.cms.ContentType;
import com.arsdigita.cms.Folder;
import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.contenttypes.GenericPerson;
import com.arsdigita.cms.contenttypes.GenericPersonBundle;
import com.arsdigita.cms.ui.authoring.ApplyWorkflowFormSection;
import com.arsdigita.cms.ui.authoring.CreationSelector;
import com.arsdigita.cms.ui.authoring.LanguageWidget;
@ -100,7 +101,7 @@ public class GenericPersonCreate extends PageCreate {
item.setLaunchDate((Date) data.get(LAUNCH_DATE));
}
final ContentBundle bundle = new ContentBundle(item);
final GenericPersonBundle bundle = new GenericPersonBundle(item);
bundle.setParent(folder);
bundle.setContentSection(m_parent.getContentSection(state));
bundle.save();

View File

@ -15,6 +15,7 @@ import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.ContentType;
import com.arsdigita.cms.Folder;
import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitBundle;
import com.arsdigita.cms.contenttypes.Publisher;
import com.arsdigita.cms.ui.authoring.ApplyWorkflowFormSection;
import com.arsdigita.cms.ui.authoring.CreationSelector;
@ -55,7 +56,8 @@ public class PublisherCreate extends PageCreate {
add(new Label(GlobalizationUtil.globalize(
"cms.ui.authoring.page_launch_date")));
ParameterModel launchDateParam = new DateParameter(LAUNCH_DATE);
com.arsdigita.bebop.form.Date launchDate = new com.arsdigita.bebop.form.Date(
com.arsdigita.bebop.form.Date launchDate =
new com.arsdigita.bebop.form.Date(
launchDateParam);
if (ContentSection.getConfig().getRequireLaunchDate()) {
launchDate.addValidationListener(
@ -92,7 +94,9 @@ public class PublisherCreate extends PageCreate {
item.setLaunchDate((Date) data.get(LAUNCH_DATE));
}
final ContentBundle bundle = new ContentBundle(item);
final GenericOrganizationalUnitBundle bundle =
new GenericOrganizationalUnitBundle(
item);
bundle.setParent(folder);
bundle.setContentSection(section);
bundle.save();

View File

@ -10,7 +10,7 @@
objectType="com.arsdigita.cms.contenttypes.SciDepartment"
classname="com.arsdigita.cms.contenttypes.SciDepartment">
<ctd:authoring-kit createComponent="com.arsdigita.cms.ui.authoring.PageCreate">
<ctd:authoring-kit createComponent="com.arsdigita.cms.contenttypes.ui.GenericOrganizationalUnitCreate">
<ctd:authoring-step
labelKey="sciorganization.ui.department_properties.title"

View File

@ -126,8 +126,7 @@ public class SciDepartmentSummaryTab implements GenericOrgaUnitTab {
getPersons();
heads.addFilter(roleFilter.toString());
heads.addFilter(statusFilter.toString());
heads.addOrder("surname");
heads.addOrder("givenname");
heads.addOrder("name");
while (heads.next()) {
generateHeadXml(heads.getPerson(), headsElem, state);

View File

@ -10,7 +10,7 @@
objectType="com.arsdigita.cms.contenttypes.SciInstitute"
classname="com.arsdigita.cms.contenttypes.SciInstitute">
<ctd:authoring-kit createComponent="com.arsdigita.cms.ui.authoring.PageCreate">
<ctd:authoring-kit createComponent="com.arsdigita.cms.contenttypes.ui.GenericOrganizationalUnitCreate">
<ctd:authoring-step
labelKey="sciorganization.ui.institute_properties.title"

View File

@ -126,8 +126,7 @@ public class SciInstituteSummaryTab implements GenericOrgaUnitTab {
getPersons();
heads.addFilter(roleFilter.toString());
heads.addFilter(statusFilter.toString());
heads.addOrder("surname");
heads.addOrder("givenname");
heads.addOrder("name");
while (heads.next()) {
generateMemberXml(heads.getPerson(), headsElem, state);

View File

@ -10,7 +10,7 @@
objectType="com.arsdigita.cms.contenttypes.SciProject"
classname="com.arsdigita.cms.contenttypes.SciProject">
<ctd:authoring-kit createComponent="com.arsdigita.cms.ui.authoring.PageCreate">
<ctd:authoring-kit createComponent="com.arsdigita.cms.contenttypes.ui.GenericOrganizationalUnitCreate">
<ctd:authoring-step
labelKey="sciorganization.ui.project_properties.title"