Organizationen (speziell Projekte) können jetzt nach den Mitgliedern gefiltert werden (Ticket #1678).
git-svn-id: https://svn.libreccm.org/ccm/trunk@2157 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
c3ade037a9
commit
0dab49e03b
|
|
@ -27,6 +27,8 @@ import com.arsdigita.kernel.ACSObject;
|
||||||
object type GenericOrganizationalUnit extends ContentPage {
|
object type GenericOrganizationalUnit extends ContentPage {
|
||||||
String[0..1] addendum = cms_organizationalunits.addendum VARCHAR(512);
|
String[0..1] addendum = cms_organizationalunits.addendum VARCHAR(512);
|
||||||
|
|
||||||
|
String[0..1] personsStr = cms_organizationalunits.personsstr CLOB;
|
||||||
|
|
||||||
reference key (cms_organizationalunits.organizationalunit_id);
|
reference key (cms_organizationalunits.organizationalunit_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
--
|
||||||
|
-- Copyright (C) 2013 Jens Pelzetter All Rights Reserved.
|
||||||
|
--
|
||||||
|
-- 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
|
||||||
|
--
|
||||||
|
-- $Id$
|
||||||
|
|
||||||
|
-- adds to personsstr column (used for filtering organization by their members)
|
||||||
|
|
||||||
|
ALTER TABLE cms_organizationalunits ADD COLUMN personsstr TEXT;
|
||||||
|
|
@ -24,5 +24,6 @@
|
||||||
begin;
|
begin;
|
||||||
|
|
||||||
\i ../default/upgrade/6.6.7-6.6.8/rename_workspace_to_contentcenter.sql
|
\i ../default/upgrade/6.6.7-6.6.8/rename_workspace_to_contentcenter.sql
|
||||||
|
\i ../default/upgrade/6.6.7-6.6.8/add_personsstr_column.sql
|
||||||
|
|
||||||
commit;
|
commit;
|
||||||
|
|
@ -64,6 +64,9 @@
|
||||||
</version>
|
</version>
|
||||||
<version from="6.6.7" to="6.6.8">
|
<version from="6.6.7" to="6.6.8">
|
||||||
<!-- Rename com.arsdigita.cms.Workspace to com.arsdigita.cms.ContentCenter -->
|
<!-- Rename com.arsdigita.cms.Workspace to com.arsdigita.cms.ContentCenter -->
|
||||||
|
<!-- Add column to GenericOrganizationalUnit for filtering -->
|
||||||
<script sql="ccm-cms/upgrade/::database::-6.6.7-6.6.8.sql"/>
|
<script sql="ccm-cms/upgrade/::database::-6.6.7-6.6.8.sql"/>
|
||||||
|
<!-- Fill the personsstr column -->
|
||||||
|
<script class="com.arsdigita.cms.upgrade.PersonsStrColumn"/>
|
||||||
</version>
|
</version>
|
||||||
</upgrade>
|
</upgrade>
|
||||||
|
|
|
||||||
|
|
@ -96,14 +96,14 @@ public final class ContentSectionSetup {
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
public static ContentSection setupContentSectionAppInstance(String name,
|
public static ContentSection setupContentSectionAppInstance(String name,
|
||||||
List defaultRoles,
|
List defaultRoles,
|
||||||
List defaultWorkflows,
|
List defaultWorkflows,
|
||||||
Boolean isPubliclyViewable,
|
Boolean isPubliclyViewable,
|
||||||
String itemResolverClassName,
|
String itemResolverClassName,
|
||||||
String templateResolverClassName,
|
String templateResolverClassName,
|
||||||
List sectionContentTypes,
|
List sectionContentTypes,
|
||||||
Boolean useSectionCategories,
|
Boolean useSectionCategories,
|
||||||
List categoryFileList) {
|
List categoryFileList) {
|
||||||
|
|
||||||
s_log.info("Creating content section on /" + name);
|
s_log.info("Creating content section on /" + name);
|
||||||
|
|
||||||
|
|
@ -179,18 +179,18 @@ public final class ContentSectionSetup {
|
||||||
s_log.info("Granting privilege cms_" + priv);
|
s_log.info("Granting privilege cms_" + priv);
|
||||||
|
|
||||||
role.grantPermission(m_section,
|
role.grantPermission(m_section,
|
||||||
PrivilegeDescriptor.get("cms_" + priv));
|
PrivilegeDescriptor.get("cms_" + priv));
|
||||||
|
|
||||||
if (priv.equals(SecurityManager.CATEGORY_ADMIN)
|
if (priv.equals(SecurityManager.CATEGORY_ADMIN)
|
||||||
|| priv.equals(SecurityManager.CATEGORIZE_ITEMS)) {
|
|| priv.equals(SecurityManager.CATEGORIZE_ITEMS)) {
|
||||||
RootCategoryCollection coll = Category.getRootCategories(m_section);
|
RootCategoryCollection coll = Category.getRootCategories(m_section);
|
||||||
while (coll.next()) {
|
while (coll.next()) {
|
||||||
if (priv.equals(SecurityManager.CATEGORY_ADMIN)) {
|
if (priv.equals(SecurityManager.CATEGORY_ADMIN)) {
|
||||||
role.grantPermission(coll.getCategory(),
|
role.grantPermission(coll.getCategory(),
|
||||||
PrivilegeDescriptor.ADMIN);
|
PrivilegeDescriptor.ADMIN);
|
||||||
} else {
|
} else {
|
||||||
role.grantPermission(coll.getCategory(),
|
role.grantPermission(coll.getCategory(),
|
||||||
Category.MAP_DESCRIPTOR);
|
Category.MAP_DESCRIPTOR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -201,11 +201,11 @@ public final class ContentSectionSetup {
|
||||||
// FIXME: String for Site-wide Admininistrators is hardcoded because
|
// FIXME: String for Site-wide Admininistrators is hardcoded because
|
||||||
// this group in inserted via sql-command during setup
|
// this group in inserted via sql-command during setup
|
||||||
partyColl.filter("Site-wide Administrators");
|
partyColl.filter("Site-wide Administrators");
|
||||||
if(partyColl.next()) {
|
if (partyColl.next()) {
|
||||||
role.add(partyColl.getParty());
|
role.add(partyColl.getParty());
|
||||||
}
|
}
|
||||||
partyColl.close();
|
partyColl.close();
|
||||||
|
|
||||||
return role;
|
return role;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -225,10 +225,10 @@ public final class ContentSectionSetup {
|
||||||
|
|
||||||
// XXX Shouldn't read permission granted depending on pub=true?
|
// XXX Shouldn't read permission granted depending on pub=true?
|
||||||
viewers.grantPermission(m_section,
|
viewers.grantPermission(m_section,
|
||||||
PrivilegeDescriptor.get("cms_read_item"));
|
PrivilegeDescriptor.get("cms_read_item"));
|
||||||
|
|
||||||
String email = Boolean.TRUE.equals(pub) ? "public@nullhost"
|
String email = Boolean.TRUE.equals(pub) ? "public@nullhost"
|
||||||
: "registered@nullhost";
|
: "registered@nullhost";
|
||||||
|
|
||||||
Party viewer = retrieveParty(email);
|
Party viewer = retrieveParty(email);
|
||||||
if (viewer == null) {
|
if (viewer == null) {
|
||||||
|
|
@ -268,27 +268,27 @@ public final class ContentSectionSetup {
|
||||||
* @param templateResolverClassName
|
* @param templateResolverClassName
|
||||||
*/
|
*/
|
||||||
public void registerResolvers(String itemResolverClassName,
|
public void registerResolvers(String itemResolverClassName,
|
||||||
String templateResolverClassName) {
|
String templateResolverClassName) {
|
||||||
|
|
||||||
if (itemResolverClassName != null
|
if (itemResolverClassName != null
|
||||||
&& itemResolverClassName.length() > 0) {
|
&& itemResolverClassName.length() > 0) {
|
||||||
m_section.setItemResolverClass(itemResolverClassName);
|
m_section.setItemResolverClass(itemResolverClassName);
|
||||||
s_log.info("Registering " + itemResolverClassName
|
s_log.info("Registering " + itemResolverClassName
|
||||||
+ " as the item resolver class");
|
+ " as the item resolver class");
|
||||||
} else {
|
} else {
|
||||||
m_section.setItemResolverClass(ContentSection.getConfig().getDefaultItemResolverClass().getName());
|
m_section.setItemResolverClass(ContentSection.getConfig().getDefaultItemResolverClass().getName());
|
||||||
s_log.info("Registering " + itemResolverClassName
|
s_log.info("Registering " + itemResolverClassName
|
||||||
+ " as the item resolver class");
|
+ " as the item resolver class");
|
||||||
}
|
}
|
||||||
if (templateResolverClassName != null
|
if (templateResolverClassName != null
|
||||||
&& templateResolverClassName.length() > 0) {
|
&& templateResolverClassName.length() > 0) {
|
||||||
m_section.setTemplateResolverClass(templateResolverClassName);
|
m_section.setTemplateResolverClass(templateResolverClassName);
|
||||||
s_log.info("Registering " + templateResolverClassName
|
s_log.info("Registering " + templateResolverClassName
|
||||||
+ " as the template resolver class");
|
+ " as the template resolver class");
|
||||||
} else {
|
} else {
|
||||||
m_section.setTemplateResolverClass(ContentSection.getConfig().getDefaultTemplateResolverClass().getName());
|
m_section.setTemplateResolverClass(ContentSection.getConfig().getDefaultTemplateResolverClass().getName());
|
||||||
s_log.info("Registering " + templateResolverClassName
|
s_log.info("Registering " + templateResolverClassName
|
||||||
+ " as the template resolver class");
|
+ " as the template resolver class");
|
||||||
}
|
}
|
||||||
|
|
||||||
m_section.save();
|
m_section.save();
|
||||||
|
|
@ -392,14 +392,14 @@ public final class ContentSectionSetup {
|
||||||
|
|
||||||
// Save workflow
|
// Save workflow
|
||||||
wf.save();
|
wf.save();
|
||||||
|
|
||||||
// Add Workflow to current section
|
// Add Workflow to current section
|
||||||
m_section.addWorkflowTemplate(wf);
|
m_section.addWorkflowTemplate(wf);
|
||||||
m_section.save();
|
m_section.save();
|
||||||
|
|
||||||
// If this workflow should be the default or is the first one
|
// If this workflow should be the default or is the first one
|
||||||
// save it for easy access in registerContentType
|
// save it for easy access in registerContentType
|
||||||
if(m_wf == null || (workflow.containsKey("isDefault") && workflow.get("isDefault").equals("true"))) {
|
if (m_wf == null || (workflow.containsKey("isDefault") && workflow.get("isDefault").equals("true"))) {
|
||||||
m_section.setDefaultWorkflowTemplate(wf);
|
m_section.setDefaultWorkflowTemplate(wf);
|
||||||
m_wf = wf;
|
m_wf = wf;
|
||||||
}
|
}
|
||||||
|
|
@ -469,12 +469,12 @@ public final class ContentSectionSetup {
|
||||||
m_section.addContentType(type);
|
m_section.addContentType(type);
|
||||||
|
|
||||||
s_log.info("Setting the default lifecycle for "
|
s_log.info("Setting the default lifecycle for "
|
||||||
+ name + " to " + m_lcd.getLabel());
|
+ name + " to " + m_lcd.getLabel());
|
||||||
ContentTypeLifecycleDefinition.updateLifecycleDefinition(m_section, type, m_lcd);
|
ContentTypeLifecycleDefinition.updateLifecycleDefinition(m_section, type, m_lcd);
|
||||||
m_lcd.save();
|
m_lcd.save();
|
||||||
|
|
||||||
s_log.info("Setting the default workflow template for " + name
|
s_log.info("Setting the default workflow template for " + name
|
||||||
+ " to " + m_wf.getLabel());
|
+ " to " + m_wf.getLabel());
|
||||||
ContentTypeWorkflowTemplate.updateWorkflowTemplate(m_section, type, m_wf);
|
ContentTypeWorkflowTemplate.updateWorkflowTemplate(m_section, type, m_wf);
|
||||||
m_wf.save();
|
m_wf.save();
|
||||||
|
|
||||||
|
|
@ -643,7 +643,7 @@ public final class ContentSectionSetup {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void startElement(String uri, String local,
|
public void startElement(String uri, String local,
|
||||||
String qName, Attributes attrs) {
|
String qName, Attributes attrs) {
|
||||||
if ("categories".equals(qName)) {
|
if ("categories".equals(qName)) {
|
||||||
String name = attrs.getValue("name");
|
String name = attrs.getValue("name");
|
||||||
if (name == null) {
|
if (name == null) {
|
||||||
|
|
@ -653,7 +653,7 @@ public final class ContentSectionSetup {
|
||||||
String context = attrs.getValue("context");
|
String context = attrs.getValue("context");
|
||||||
|
|
||||||
Category root = Category.getRootForObject(m_section,
|
Category root = Category.getRootForObject(m_section,
|
||||||
context);
|
context);
|
||||||
if (root == null) {
|
if (root == null) {
|
||||||
root = new Category();
|
root = new Category();
|
||||||
}
|
}
|
||||||
|
|
@ -662,8 +662,8 @@ public final class ContentSectionSetup {
|
||||||
|
|
||||||
if (root.isNew()) {
|
if (root.isNew()) {
|
||||||
Category.setRootForObject(m_section,
|
Category.setRootForObject(m_section,
|
||||||
root,
|
root,
|
||||||
context);
|
context);
|
||||||
}
|
}
|
||||||
m_cats.push(root);
|
m_cats.push(root);
|
||||||
PermissionService.setContext(root, m_section);
|
PermissionService.setContext(root, m_section);
|
||||||
|
|
@ -705,5 +705,6 @@ public final class ContentSectionSetup {
|
||||||
m_cats.pop();
|
m_cats.pop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} // END private class CategoryHandler
|
} // END private class CategoryHandler
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,7 @@ public class GenericOrganizationalUnit extends ContentPage {
|
||||||
public final static String ADDENDUM = "addendum";
|
public final static String ADDENDUM = "addendum";
|
||||||
public final static String CONTACTS = "contacts";
|
public final static String CONTACTS = "contacts";
|
||||||
public final static String PERSONS = "persons";
|
public final static String PERSONS = "persons";
|
||||||
|
protected final static String PERSONS_STR = "personsStr";
|
||||||
public final static String SUPERIOR_ORGAUNITS = "superiorOrgaunits";
|
public final static String SUPERIOR_ORGAUNITS = "superiorOrgaunits";
|
||||||
public final static String SUBORDINATE_ORGAUNITS = "subordinateOrgaunits";
|
public final static String SUBORDINATE_ORGAUNITS = "subordinateOrgaunits";
|
||||||
public final static String BASE_DATA_OBJECT_TYPE =
|
public final static String BASE_DATA_OBJECT_TYPE =
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ package com.arsdigita.cms.contenttypes;
|
||||||
import com.arsdigita.cms.ContentBundle;
|
import com.arsdigita.cms.ContentBundle;
|
||||||
import com.arsdigita.cms.ContentItem;
|
import com.arsdigita.cms.ContentItem;
|
||||||
import com.arsdigita.cms.CustomCopy;
|
import com.arsdigita.cms.CustomCopy;
|
||||||
|
import com.arsdigita.cms.ItemCollection;
|
||||||
import com.arsdigita.cms.ItemCopier;
|
import com.arsdigita.cms.ItemCopier;
|
||||||
import com.arsdigita.domain.DataObjectNotFoundException;
|
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||||
import com.arsdigita.domain.DomainObjectFactory;
|
import com.arsdigita.domain.DomainObjectFactory;
|
||||||
|
|
@ -74,18 +75,45 @@ public class GenericOrganizationalUnitBundle extends ContentBundle {
|
||||||
link.set(GenericOrganizationalUnitPersonCollection.PERSON_ROLE, role);
|
link.set(GenericOrganizationalUnitPersonCollection.PERSON_ROLE, role);
|
||||||
link.set(GenericOrganizationalUnitPersonCollection.STATUS, status);
|
link.set(GenericOrganizationalUnitPersonCollection.STATUS, status);
|
||||||
link.save();
|
link.save();
|
||||||
|
|
||||||
|
updatePersonsStr();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removePerson(final GenericPerson person) {
|
public void removePerson(final GenericPerson person) {
|
||||||
Assert.exists(person, GenericPerson.class);
|
Assert.exists(person, GenericPerson.class);
|
||||||
|
|
||||||
remove(PERSONS, person.getContentBundle());
|
remove(PERSONS, person.getContentBundle());
|
||||||
|
|
||||||
|
updatePersonsStr();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasPersons() {
|
public boolean hasPersons() {
|
||||||
return !getPersons().isEmpty();
|
return !getPersons().isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void updatePersonsStr() {
|
||||||
|
final GenericOrganizationalUnitPersonCollection persons = getPersons();
|
||||||
|
final StringBuilder builder = new StringBuilder();
|
||||||
|
while(persons.next()) {
|
||||||
|
if (builder.length() > 0) {
|
||||||
|
builder.append("; ");
|
||||||
|
}
|
||||||
|
builder.append(persons.getSurname());
|
||||||
|
builder.append(", ");
|
||||||
|
builder.append(persons.getGivenName());
|
||||||
|
}
|
||||||
|
|
||||||
|
final String personsStr = builder.toString();
|
||||||
|
|
||||||
|
final ItemCollection instances = getInstances();
|
||||||
|
|
||||||
|
GenericOrganizationalUnit orgaunit;
|
||||||
|
while(instances.next()) {
|
||||||
|
orgaunit = (GenericOrganizationalUnit) instances.getDomainObject();
|
||||||
|
orgaunit.set(GenericOrganizationalUnit.PERSONS_STR, personsStr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public GenericOrganizationalUnitContactCollection getContacts() {
|
public GenericOrganizationalUnitContactCollection getContacts() {
|
||||||
return new GenericOrganizationalUnitContactCollection((DataCollection) get(
|
return new GenericOrganizationalUnitContactCollection((DataCollection) get(
|
||||||
CONTACTS));
|
CONTACTS));
|
||||||
|
|
|
||||||
|
|
@ -18,27 +18,20 @@
|
||||||
*/
|
*/
|
||||||
package com.arsdigita.cms.upgrade;
|
package com.arsdigita.cms.upgrade;
|
||||||
|
|
||||||
import com.arsdigita.cms.ContentSection;
|
|
||||||
import com.arsdigita.cms.ContentType;
|
import com.arsdigita.cms.ContentType;
|
||||||
import com.arsdigita.cms.ContentTypeCollection;
|
import com.arsdigita.cms.ContentTypeCollection;
|
||||||
import com.arsdigita.cms.ContentTypeLifecycleDefinition;
|
|
||||||
import com.arsdigita.cms.ContentTypeWorkflowTemplate;
|
|
||||||
import com.arsdigita.cms.contenttypes.XMLContentTypeHandler;
|
import com.arsdigita.cms.contenttypes.XMLContentTypeHandler;
|
||||||
import com.arsdigita.cms.lifecycle.LifecycleDefinition;
|
|
||||||
import com.arsdigita.kernel.Kernel;
|
import com.arsdigita.kernel.Kernel;
|
||||||
import com.arsdigita.kernel.KernelExcursion;
|
import com.arsdigita.kernel.KernelExcursion;
|
||||||
import org.apache.commons.cli.CommandLine;
|
|
||||||
import org.apache.log4j.Logger;
|
|
||||||
|
|
||||||
import com.arsdigita.util.cmd.Program;
|
|
||||||
import com.arsdigita.persistence.Session;
|
import com.arsdigita.persistence.Session;
|
||||||
import com.arsdigita.persistence.SessionManager;
|
import com.arsdigita.persistence.SessionManager;
|
||||||
import com.arsdigita.persistence.TransactionContext;
|
import com.arsdigita.persistence.TransactionContext;
|
||||||
import com.arsdigita.workflow.simple.WorkflowTemplate;
|
import com.arsdigita.util.cmd.Program;
|
||||||
import com.arsdigita.xml.XML;
|
import com.arsdigita.xml.XML;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
|
import org.apache.commons.cli.CommandLine;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,86 @@
|
||||||
|
package com.arsdigita.cms.upgrade;
|
||||||
|
|
||||||
|
import com.arsdigita.cms.ItemCollection;
|
||||||
|
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit;
|
||||||
|
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitBundle;
|
||||||
|
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitPersonCollection;
|
||||||
|
import com.arsdigita.domain.DomainObjectFactory;
|
||||||
|
import com.arsdigita.kernel.Kernel;
|
||||||
|
import com.arsdigita.kernel.KernelExcursion;
|
||||||
|
import com.arsdigita.persistence.DataCollection;
|
||||||
|
import com.arsdigita.persistence.DataObject;
|
||||||
|
import com.arsdigita.persistence.Session;
|
||||||
|
import com.arsdigita.persistence.SessionManager;
|
||||||
|
import com.arsdigita.persistence.TransactionContext;
|
||||||
|
import com.arsdigita.util.cmd.Program;
|
||||||
|
import org.apache.commons.cli.CommandLine;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter <jens@jp-digital.de>
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class PersonsStrColumn extends Program {
|
||||||
|
|
||||||
|
public PersonsStrColumn() {
|
||||||
|
super("PersonsStrColumn", "1.0.0", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final void main(final String[] args) {
|
||||||
|
new PersonsStrColumn().run(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void doRun(final CommandLine cmdLine) {
|
||||||
|
|
||||||
|
new KernelExcursion() {
|
||||||
|
@Override
|
||||||
|
protected void excurse() {
|
||||||
|
setEffectiveParty(Kernel.getSystemParty());
|
||||||
|
|
||||||
|
final Session session = SessionManager.getSession();
|
||||||
|
final TransactionContext transactionContext = session.getTransactionContext();
|
||||||
|
|
||||||
|
transactionContext.beginTxn();
|
||||||
|
|
||||||
|
final DataCollection orgaUnitBundles = session.retrieve(
|
||||||
|
GenericOrganizationalUnitBundle.BASE_DATA_OBJECT_TYPE);
|
||||||
|
while (orgaUnitBundles.next()) {
|
||||||
|
createPersonsStr(orgaUnitBundles.getDataObject());
|
||||||
|
}
|
||||||
|
|
||||||
|
transactionContext.commitTxn();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}.run();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void createPersonsStr(final DataObject dobj) {
|
||||||
|
final GenericOrganizationalUnitBundle orgaunitBundle =
|
||||||
|
(GenericOrganizationalUnitBundle) DomainObjectFactory.newInstance(dobj);
|
||||||
|
final GenericOrganizationalUnitPersonCollection persons = orgaunitBundle.getPersons();
|
||||||
|
final StringBuilder builder = new StringBuilder();
|
||||||
|
|
||||||
|
while (persons.next()) {
|
||||||
|
if (builder.length() > 0) {
|
||||||
|
builder.append("; ");
|
||||||
|
}
|
||||||
|
builder.append(persons.getSurname());
|
||||||
|
builder.append(", ");
|
||||||
|
builder.append(persons.getGivenName());
|
||||||
|
}
|
||||||
|
|
||||||
|
final String personsStr = builder.toString();
|
||||||
|
|
||||||
|
final ItemCollection instances = orgaunitBundle.getInstances();
|
||||||
|
|
||||||
|
GenericOrganizationalUnit instance;
|
||||||
|
while (instances.next()) {
|
||||||
|
instance = (GenericOrganizationalUnit) instances.getDomainObject();
|
||||||
|
instance.set("personsStr", personsStr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue