Traversal Adapter für Personenmodul Contenttypen, noch nicht abschließend getestet
git-svn-id: https://svn.libreccm.org/ccm/trunk@230 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
5f1602a81e
commit
c4d1d91d5d
|
|
@ -28,5 +28,8 @@ object type GenericOrganization extends ContentPage {
|
|||
String[0..1] organizationnameaddendum = ct_genericorganizations.organizationnameaddendum VARCHAR(512);
|
||||
String[0..1] description = ct_genericorganizations.description VARCHAR(2000);
|
||||
|
||||
OrganizationRole[0..n] organizationroles = join ct_genericorganizations.organization_id to ct_organizationroles.owner_id;
|
||||
OrganizationalUnit[0..n] subunits = join ct_genericorganizations.organization_id to ct_orga2orgaunits.orga2orgaunit_id;
|
||||
|
||||
reference key (ct_genericorganizations.organization_id);
|
||||
}
|
||||
|
|
@ -57,8 +57,9 @@ public class GenericOrganizationInitializer extends ContentTypeInitializer {
|
|||
* @return path of the XSL stylesheet file. The stylesheet is very generic, because this
|
||||
* contenttype will be used with the new mandalay theme only.
|
||||
*/
|
||||
public String getStylesheet() {
|
||||
return "static/content-types/com/arsdigita/cms/contenttypes/GenericOrganization.xsl";
|
||||
@Override
|
||||
public String[] getStylesheets() {
|
||||
return new String[] { "/static/content-types/com/arsdigita/cms/contenttypes/GenericOrganization.xsl" };
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -27,11 +27,15 @@ object type OrganizationalUnit extends ContentPage {
|
|||
String[0..1] organizationalunitName = ct_organizationalunits.organizationalunit_name VARCHAR(512);
|
||||
String[0..1] organizationalunitDescription = ct_organizationalunits.organizationalunit_description VARCHAR(2048);
|
||||
|
||||
OrganizationalUnit subunits = join ct_organizationalunits.organizationalunit_id to ct_orgaunit2orgaunits.owner_id;
|
||||
Membership[0..n] memberships = join ct_organizationalunits.organizationalunit_id to ct_memberships.owner_id;
|
||||
|
||||
reference key (ct_organizationalunits.organizationalunit_id);
|
||||
//aggressive load (direction.id);
|
||||
//aggressive load (assistentDirection.id);
|
||||
}
|
||||
|
||||
|
||||
association {
|
||||
Person[0..1] direction = join ct_organizationalunits.direction_id to ct_persons.person_id;
|
||||
OrganizationalUnit[0..n] directedUnit = join ct_persons.person_id to ct_organizationalunits.direction_id;
|
||||
|
|
|
|||
|
|
@ -18,18 +18,13 @@
|
|||
*/
|
||||
package com.arsdigita.cms.contenttypes;
|
||||
|
||||
import com.arsdigita.bebop.Page;
|
||||
import com.arsdigita.bebop.PageState;
|
||||
import com.arsdigita.cms.CMS;
|
||||
import com.arsdigita.cms.ContentItem;
|
||||
import com.arsdigita.cms.ContentPage;
|
||||
import com.arsdigita.cms.ExtraXMLGenerator;
|
||||
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||
import com.arsdigita.domain.DomainObjectFactory;
|
||||
import com.arsdigita.persistence.DataCollection;
|
||||
import com.arsdigita.persistence.DataObject;
|
||||
import com.arsdigita.persistence.OID;
|
||||
import com.arsdigita.util.Assert;
|
||||
import com.arsdigita.xml.Element;
|
||||
import java.math.BigDecimal;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
|
|
@ -37,7 +32,7 @@ import org.apache.log4j.Logger;
|
|||
*
|
||||
* @author Jens Pelzetter <jens@jp-digital.de>
|
||||
*/
|
||||
public class OrganizationalUnit extends ContentPage implements ExtraXMLGenerator {
|
||||
public class OrganizationalUnit extends ContentPage{
|
||||
|
||||
private final static Logger logger = Logger.getLogger(OrganizationalUnit.class);
|
||||
|
||||
|
|
@ -45,13 +40,14 @@ public class OrganizationalUnit extends ContentPage implements ExtraXMLGenerator
|
|||
public final static String ORGANIZATIONALUNIT_DESCRIPTION = "organizationalunitDescription";
|
||||
|
||||
public final static String DIRECTION = "direction";
|
||||
public final static String ASSISTANT_DIRECTION = "assistentDirection";
|
||||
public final static String ASSISTENT_DIRECTION = "assistentDirection";
|
||||
|
||||
public final static String MEMBERSHIPS = "memberships";
|
||||
|
||||
public final static String BASE_DATA_OBJECT_TYPE = "com.arsdigita.cms.contenttypes.OrganizationalUnit";
|
||||
|
||||
public OrganizationalUnit() {
|
||||
super(BASE_DATA_OBJECT_TYPE);
|
||||
extraXMLGenerators.add(this);
|
||||
}
|
||||
|
||||
public OrganizationalUnit(BigDecimal id) throws DataObjectNotFoundException {
|
||||
|
|
@ -60,17 +56,14 @@ public class OrganizationalUnit extends ContentPage implements ExtraXMLGenerator
|
|||
|
||||
public OrganizationalUnit(OID id) throws DataObjectNotFoundException {
|
||||
super(id);
|
||||
extraXMLGenerators.add(this);
|
||||
}
|
||||
|
||||
public OrganizationalUnit(DataObject obj) {
|
||||
super(obj);
|
||||
extraXMLGenerators.add(this);
|
||||
}
|
||||
|
||||
public OrganizationalUnit(String type) {
|
||||
super(type);
|
||||
extraXMLGenerators.add(this);
|
||||
}
|
||||
|
||||
/* accessors ***************************************************/
|
||||
|
|
@ -106,7 +99,7 @@ public class OrganizationalUnit extends ContentPage implements ExtraXMLGenerator
|
|||
}
|
||||
|
||||
public Person getAssistentDirection() {
|
||||
DataObject dobj = (DataObject) get(ASSISTANT_DIRECTION);
|
||||
DataObject dobj = (DataObject) get(ASSISTENT_DIRECTION);
|
||||
if (dobj != null) {
|
||||
return (Person) DomainObjectFactory.newInstance(dobj);
|
||||
} else {
|
||||
|
|
@ -114,24 +107,31 @@ public class OrganizationalUnit extends ContentPage implements ExtraXMLGenerator
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public void setAssistentDirection(Person person) {
|
||||
Assert.exists(person, Person.class);
|
||||
setAssociation(ASSISTANT_DIRECTION, person);
|
||||
setAssociation(ASSISTENT_DIRECTION, person);
|
||||
}
|
||||
|
||||
/*public MembershipCollection getMemberships() {
|
||||
return new MembershipCollection ((DataCollection) get(MEMBERSHIPS));
|
||||
}*/
|
||||
|
||||
/*public void addMembership(Membership membership) {
|
||||
Assert.exists(membership, Membership.class);
|
||||
add(MEMBERSHIPS, membership);
|
||||
}*/
|
||||
|
||||
/*public void removeMembership(Membership membership) {
|
||||
Assert.exists(membership, Membership.class);
|
||||
remove(MEMBERSHIPS, membership);
|
||||
}*/
|
||||
|
||||
/*public boolean hasMemberships() {
|
||||
return !this.getMemberships().isEmpty();
|
||||
}*/
|
||||
|
||||
@Override
|
||||
public String getBaseDataObjectType() {
|
||||
return BASE_DATA_OBJECT_TYPE;
|
||||
}
|
||||
|
||||
public void generateXML(ContentItem item, Element element, PageState state) {
|
||||
Element members = element.newChildElement("cms:organizationalunitMembersPanel", CMS.CMS_XML_NS);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void addGlobalStateParams(Page p) {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,12 +33,13 @@ public class OrganizationalUnitInitializer extends ContentTypeInitializer {
|
|||
super("ccm-cms-types-organizationalunit.pdl.mf", OrganizationalUnit.BASE_DATA_OBJECT_TYPE);
|
||||
}
|
||||
|
||||
public String getStylesheet() {
|
||||
return "static/content-types/com/arsdigita/cms/contenttypes/OrganizationalUnit.xsl";
|
||||
@Override
|
||||
public String[] getStylesheets() {
|
||||
return new String[] { "/static/content-types/com/arsdigita/cms/contenttypes/OrganizationalUnit.xsl" };
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(LegacyInitEvent evt) {
|
||||
super.init(evt);
|
||||
public String getTraversalXML() {
|
||||
return "/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/OrganizationalUnit.xml";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -179,6 +179,12 @@ public class MembershipPropertyForm extends FormSection implements FormInitListe
|
|||
membership.setTo((Date) this.m_to.getValue(state));
|
||||
|
||||
membership.save();
|
||||
logger.debug("Adding membership to collection of orgaunit...");
|
||||
OrganizationalUnit orgaunit = this.getOrganizationalUnit(state);
|
||||
//orgaunit.addMembership(membership);
|
||||
logger.debug("saving orgaunit...");
|
||||
//this.getOrganizationalUnit(state).save();
|
||||
logger.debug("done.");
|
||||
}
|
||||
|
||||
public void init(FormSectionEvent e) throws FormProcessException {
|
||||
|
|
@ -212,6 +218,7 @@ public class MembershipPropertyForm extends FormSection implements FormInitListe
|
|||
} else {
|
||||
data.put(PERSON_SEARCH, null);
|
||||
}
|
||||
logger.debug("init listener finished.");
|
||||
}
|
||||
|
||||
public void process(FormSectionEvent e) throws FormProcessException {
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ public class MembershipTableModelBuilder extends LockableImpl implements TableMo
|
|||
Assert.isTrue(this.m_itemModel.isSelected(state), "item selected");
|
||||
OrganizationalUnit unit = (OrganizationalUnit) this.m_itemModel.getSelectedItem(state);
|
||||
return Membership.getMemberships(unit);
|
||||
//return unit.getMemberships();
|
||||
}
|
||||
|
||||
public static class MembershipTableModel implements TableModel {
|
||||
|
|
@ -62,6 +63,7 @@ public class MembershipTableModelBuilder extends LockableImpl implements TableMo
|
|||
if (m_memberships.next()) {
|
||||
DataObject obj = m_memberships.getDataObject();
|
||||
m_membership = (Membership) DomainObjectFactory.newInstance(obj);
|
||||
//m_membership = (Membership) m_memberships.getDataObject();
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -30,5 +30,7 @@ object type ResearchNetwork extends ContentPage {
|
|||
String[0..1] researchNetworkDescription = ct_researchnetworks.researchnetwork_description VARCHAR(4096);
|
||||
String[0..1] researchNetworkWebsite = ct_researchnetworks.researchnetwork_website VARCHAR(512);
|
||||
|
||||
ResearchNetworkMembership[0..n] memberships = join ct_researchnetworks.researchnetwork_id to ct_researchnetworkmemberships.owner_id;
|
||||
|
||||
reference key (ct_researchnetworks.researchnetwork_id);
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// Copyright (C) 2009 Center for Social Policy Reseearch, University of Bremen
|
||||
// Copyright (C) 2009 Center for Social Policy Research, 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
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<xrd:adapters xmlns:xrd="http://xmlns.redhat.com/schemas/waf/xml-renderer-rules"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://rhea.redhat.com/schemas/waf/xml-renderer-rules xml-renderer-rules.xsd">
|
||||
|
||||
<xrd:context name="com.arsdigita.cms.dispatcher.SimpleXMLGenerator">
|
||||
|
||||
<xrd:adapter objectType="com.arsdigita.cms.contenttypes.ResearchNetwork"
|
||||
extends="com.arsdigita.cms.ContentPage">
|
||||
<xrd:associations rule="include">
|
||||
<xrd:property name="/object/memberships"/>
|
||||
<xrd:property name="/object/memberships/targetItem"/>
|
||||
</xrd:associations>
|
||||
</xrd:adapter>
|
||||
|
||||
</xrd:context>
|
||||
|
||||
</xrd:adapters>
|
||||
|
|
@ -62,6 +62,11 @@ class ContentSectionContextBar extends WorkspaceContextBar {
|
|||
|
||||
if (CMS.getContext().hasContentItem()) {
|
||||
final ContentItem item = CMS.getContext().getContentItem();
|
||||
if (item == null) {
|
||||
s_log.warn("item is null");
|
||||
} else if(item.getContentType() == null) {
|
||||
s_log.warn("item.getContentType() returns null. item.class.getName(): " + item.getClass().getName());
|
||||
}
|
||||
isTemplate =
|
||||
item.getContentType().equals(ContentType.findByAssociatedObjectType(Template.BASE_DATA_OBJECT_TYPE));
|
||||
if (isTemplate) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue