diff --git a/ccm-cms/pdl/com/arsdigita/content-types/GenericOrganizationalUnit.pdl b/ccm-cms/pdl/com/arsdigita/content-types/GenericOrganizationalUnit.pdl index d2230b69f..51243b127 100644 --- a/ccm-cms/pdl/com/arsdigita/content-types/GenericOrganizationalUnit.pdl +++ b/ccm-cms/pdl/com/arsdigita/content-types/GenericOrganizationalUnit.pdl @@ -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 - to cms_organizationalunits_person_map.person_id, - join cms_organizationalunits_person_map.organizationalunit_id - to cms_organizationalunits.organizationalunit_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_bundles.bundle_id; - GenericPerson[0..n] persons = join cms_organizationalunits.organizationalunit_id - to cms_organizationalunits_person_map.organizationalunit_id, - join cms_organizationalunits_person_map.person_id - to cms_persons.person_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_bundles.bundle_id; // Additional attributes for the association String[0..1] role_name = cms_organizationalunits_person_map.role_name VARCHAR(100); diff --git a/ccm-cms/pdl/com/arsdigita/content-types/GenericPerson.pdl b/ccm-cms/pdl/com/arsdigita/content-types/GenericPerson.pdl index 0cd5d5c43..0aca6d0ad 100644 --- a/ccm-cms/pdl/com/arsdigita/content-types/GenericPerson.pdl +++ b/ccm-cms/pdl/com/arsdigita/content-types/GenericPerson.pdl @@ -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); +} diff --git a/ccm-cms/sql/ccm-cms/default/upgrade/6.6.3-6.6.4/create_publish_lock.sql b/ccm-cms/sql/ccm-cms/default/upgrade/6.6.3-6.6.4/create_publish_lock.sql new file mode 100644 index 000000000..87c33fba0 --- /dev/null +++ b/ccm-cms/sql/ccm-cms/default/upgrade/6.6.3-6.6.4/create_publish_lock.sql @@ -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; + + + diff --git a/ccm-cms/src/WEB-INF/content-types/GenericOrganizationalUnit.xml b/ccm-cms/src/WEB-INF/content-types/GenericOrganizationalUnit.xml index d26634bfe..0cd889cbd 100644 --- a/ccm-cms/src/WEB-INF/content-types/GenericOrganizationalUnit.xml +++ b/ccm-cms/src/WEB-INF/content-types/GenericOrganizationalUnit.xml @@ -12,7 +12,7 @@ classname= "com.arsdigita.cms.contenttypes.GenericOrganizationalUnit" mode="hidden"> - + 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; - } - } -} diff --git a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitPersonAddForm.java b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitPersonAddForm.java index ff70c1707..ec72e24c2 100644 --- a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitPersonAddForm.java +++ b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitPersonAddForm.java @@ -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( diff --git a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitPersonsTable.java b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitPersonsTable.java index 7e542c7e1..919644a32 100644 --- a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitPersonsTable.java +++ b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitPersonsTable.java @@ -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())); diff --git a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonCreate.java b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonCreate.java index 55e882077..0eedbfc12 100644 --- a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonCreate.java +++ b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonCreate.java @@ -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(); diff --git a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublisherCreate.java b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublisherCreate.java index 1534fd27e..1d33afee1 100644 --- a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublisherCreate.java +++ b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublisherCreate.java @@ -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(); diff --git a/ccm-sci-types-department/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/SciDepartment.xml b/ccm-sci-types-department/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/SciDepartment.xml index cdafaa5bb..aca8470b3 100644 --- a/ccm-sci-types-department/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/SciDepartment.xml +++ b/ccm-sci-types-department/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/SciDepartment.xml @@ -10,7 +10,7 @@ objectType="com.arsdigita.cms.contenttypes.SciDepartment" classname="com.arsdigita.cms.contenttypes.SciDepartment"> - + - + - +