diff --git a/ccm-cms-relationattributeimporter/application.xml b/ccm-cms-relationattributeimporter/application.xml
deleted file mode 100644
index cdfdf4b58..000000000
--- a/ccm-cms-relationattributeimporter/application.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
- Tool to import RelationAttributes.
-
-
diff --git a/ccm-cms-relationattributeimporter/src/ccm-cms-relationattributeimporter.config b/ccm-cms-relationattributeimporter/src/ccm-cms-relationattributeimporter.config
deleted file mode 100644
index adfdba100..000000000
--- a/ccm-cms-relationattributeimporter/src/ccm-cms-relationattributeimporter.config
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
diff --git a/ccm-cms-relationattributeimporter/src/ccm-cms-relationattributeimporter.load b/ccm-cms-relationattributeimporter/src/ccm-cms-relationattributeimporter.load
deleted file mode 100644
index 3e6da3ee1..000000000
--- a/ccm-cms-relationattributeimporter/src/ccm-cms-relationattributeimporter.load
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ccm-cms-relationattributeimporter/src/com/arsdigita/cms/relationattributeimporter/Initializer.java b/ccm-cms-relationattributeimporter/src/com/arsdigita/cms/relationattributeimporter/Initializer.java
deleted file mode 100644
index 047290443..000000000
--- a/ccm-cms-relationattributeimporter/src/com/arsdigita/cms/relationattributeimporter/Initializer.java
+++ /dev/null
@@ -1,35 +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.relationattributeimporter;
-
-import com.arsdigita.runtime.CompoundInitializer;
-
-/**
- * Initializer for the ccm-cms-relationattributeimporter application.
- *
- * @author Jens Pelzetter
- */
-public class Initializer extends CompoundInitializer {
-
- public Initializer() {
- //Nothing yet.
- }
-
-}
diff --git a/ccm-cms-relationattributeimporter/src/com/arsdigita/cms/relationattributeimporter/Loader.java b/ccm-cms-relationattributeimporter/src/com/arsdigita/cms/relationattributeimporter/Loader.java
deleted file mode 100644
index 2481002f0..000000000
--- a/ccm-cms-relationattributeimporter/src/com/arsdigita/cms/relationattributeimporter/Loader.java
+++ /dev/null
@@ -1,36 +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.relationattributeimporter;
-
-import com.arsdigita.loader.PackageLoader;
-import com.arsdigita.runtime.ScriptContext;
-
-/**
- * Loader for the ccm-cms-relationattribute application.
- *
- * @author Jens Pelzetter
- */
-public class Loader extends PackageLoader {
-
- public void run(final ScriptContext ctx) {
- //Nothing yet.
- }
-
-}
diff --git a/ccm-cms-relationattributeimporter/src/com/arsdigita/cms/relationattributeimporter/RelAttrBean.java b/ccm-cms-relationattributeimporter/src/com/arsdigita/cms/relationattributeimporter/RelAttrBean.java
deleted file mode 100644
index 41ccb5cf8..000000000
--- a/ccm-cms-relationattributeimporter/src/com/arsdigita/cms/relationattributeimporter/RelAttrBean.java
+++ /dev/null
@@ -1,79 +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.relationattributeimporter;
-
-/**
- * A bean used to keep the information of {@link RelationAttribute} while
- * parsing the XML file.
- *
- * @author Jens Pelzetter
- */
-public class RelAttrBean {
-
- private String attribute;
- private String key;
- private String lang;
- private String name;
- private String description;
-
- public RelAttrBean() {
- }
-
- public String getAttribute() {
- return attribute;
- }
-
- public void setAttribute(String attribute) {
- this.attribute = attribute;
- }
-
- public String getKey() {
- return key;
- }
-
- public void setKey(String key) {
- this.key = key;
- }
-
- public String getLang() {
- return lang;
- }
-
- public void setLang(String lang) {
- this.lang = lang;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
-}
diff --git a/ccm-cms-relationattributeimporter/src/com/arsdigita/cms/relationattributeimporter/RelationAttributeImporter.java b/ccm-cms-relationattributeimporter/src/com/arsdigita/cms/relationattributeimporter/RelationAttributeImporter.java
deleted file mode 100644
index d98071cc2..000000000
--- a/ccm-cms-relationattributeimporter/src/com/arsdigita/cms/relationattributeimporter/RelationAttributeImporter.java
+++ /dev/null
@@ -1,211 +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.relationattributeimporter;
-
-import com.arsdigita.cms.RelationAttribute;
-import com.arsdigita.cms.RelationAttributeInterface;
-import com.arsdigita.london.util.Transaction;
-import com.arsdigita.packaging.Program;
-import java.io.File;
-import java.io.IOException;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
-import org.apache.commons.cli.CommandLine;
-import org.xml.sax.SAXException;
-
-/**
- *
- * A simple import tool for {@link RelationAttribute}s. This tool imports the
- * relation attributes from a simple XML file or from parameters at the
- * commandline. The XML file format:
- *
- *
- * <?xml version="1.0"?>
- * <relationAttributes>
- * <relationAttribute>
- * <attribute>...</attribute>
- * <key>...</key>
- * <lang>...</lang>
- * <name>...</name>
- * <description>...</description>
- * </relationAttribute>
- * ...
- * </relationAttributes>
- *
- *
- * The tool can be invoked using the ccm-run command. One parameter, the file
- * to import is needed. With tools-ng and ECDC, the line for calling the
- * RelationAttributeImporter would like the following:
- *
- *
- * With a XML file:
- *
- *
- * ant -Dccm.classname="com.arsdigita.cms.relationattributeimporter.RelationAttributeImporter" -Dccm.parameters="/path/to/relation/attribute/file.xml" ccm-run
- *
- *
- * With command line parameters:
- *
- *
- * ant -Dccm.classname="com.arsdigita.cms.relationattributeimporter.RelationAttributeImporter" -Dccm.parameters="attribute key lang name [description]" ccm-run
- *
- *
- * The description parameter is optional.
- *
- *
- * You have to add the RelationAttributeImporter to add to your
- * environment, of course.
- *
- *
- * @author Jens Pelzetter
- * @see RelationAttribute
- * @see RelationAttributeInterface
- */
-public class RelationAttributeImporter extends Program {
-
- public RelationAttributeImporter() {
- super("Relation Attribute Importer",
- "0.1.0",
- "FILE | ATTRIBUTE KEY LANG NAME [DESCRIPTION]");
- }
-
- public RelationAttributeImporter(boolean startup) {
- super("Relation Attribute Importer",
- "0.1.0",
- "FILE | ATTRIBUTE KEY LANG NAME [DESCRIPTION]", startup);
- }
-
- @Override
- protected void doRun(CommandLine cmdLine) {
-
- final String[] args;
- File relAttrFile;
- SAXParserFactory saxFactory;
- SAXParser saxParser = null;
- RelationAttributeParser parser;
- args = cmdLine.getArgs();
- if (args.length == 1) {
- System.out.printf("Using file %s.", args[0]);
- relAttrFile = new File(args[0]);
- if (!relAttrFile.exists()) {
- System.err.printf("ERROR: File %s does not exist.", args[0]);
- System.exit(-1);
- }
- if (!relAttrFile.isFile()) {
- System.err.printf("ERROR: Path %s does not point to a file.",
- args[0]);
- System.exit(-1);
- }
- saxFactory = SAXParserFactory.newInstance();
- try {
- saxParser = saxFactory.newSAXParser();
- } catch (ParserConfigurationException ex) {
- System.err.printf("Error creating SAXParser: %s",
- ex.getMessage());
- ex.printStackTrace();
- System.exit(-1);
- } catch (SAXException ex) {
- System.err.printf("Error creating SAXParser: %s",
- ex.getMessage());
- ex.printStackTrace();
- System.exit(-1);
- }
- parser = new RelationAttributeParser();
- try {
- saxParser.parse(relAttrFile, parser);
- } catch (SAXException ex) {
- System.err.printf("Error parsing file %s: %s",
- args[0],
- ex.getMessage());
- ex.printStackTrace();
- System.exit(-1);
- } catch (IOException ex) {
- System.err.printf("Error parsing file %s: %s",
- args[0], ex.getMessage());
- ex.printStackTrace();
- System.exit(-1);
- }
-
- System.out.println(
- "Parsed XML file successfully. Creating ACSObjects...");
- for (int i = 0; i < parser.getRelAttrs().size(); i++) {
- System.out.printf("%d of %d...", (i + 1), parser.getRelAttrs().
- size());
- createACSObject(parser.getRelAttrs().get(i));
- }
- } else if ((args.length == 4) || (args.length == 5)) {
- RelAttrBean relAttr;
-
- relAttr = new RelAttrBean();
- relAttr.setAttribute(args[0]);
- relAttr.setKey(args[1]);
- relAttr.setLang(args[2]);
- relAttr.setName(args[3]);
- if (args.length == 5) {
- relAttr.setDescription(args[4]);
- }
-
- createACSObject(relAttr);
- } else {
- help(System.err);
- System.exit(-1);
- }
- }
-
- /**
- * The method creates the {@link RelationAttribute} object from the data
- * retrieved from the XML file and stores the object in the database.
- *
- * @param relAttr
- * @param index
- */
- private void createACSObject(final RelAttrBean relAttr) {
-
- /*System.out.printf("\tattribute = %s\n", relAttr.getAttribute());
- System.out.printf("\tkey = %s\n", relAttr.getKey());
- System.out.printf("\tlang = %s\n", relAttr.getLang());
- System.out.printf("\tname = %s\n", relAttr.getName());
- System.out.printf("\tdescription = %s\n", relAttr.getDescription());*/
-
- Transaction transaction = new Transaction() {
-
- @Override
- public void doRun() {
- RelationAttribute attr;
- attr = new RelationAttribute();
- attr.setAttribute(relAttr.getAttribute());
- attr.setKey(relAttr.getKey());
- attr.setLanguage(relAttr.getLang());
- attr.setName(relAttr.getName());
- attr.setDescription(relAttr.getDescription());
- System.out.print("Saving...");
- attr.save();
- }
- };
- transaction.run();
- System.out.println("Done\n");
-
- }
-
- public final static void main(String[] args) {
- new RelationAttributeImporter().run(args);
- }
-}
diff --git a/ccm-cms-relationattributeimporter/src/com/arsdigita/cms/relationattributeimporter/RelationAttributeParser.java b/ccm-cms-relationattributeimporter/src/com/arsdigita/cms/relationattributeimporter/RelationAttributeParser.java
deleted file mode 100644
index f278a86db..000000000
--- a/ccm-cms-relationattributeimporter/src/com/arsdigita/cms/relationattributeimporter/RelationAttributeParser.java
+++ /dev/null
@@ -1,176 +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.relationattributeimporter;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.xml.sax.Attributes;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXParseException;
-import org.xml.sax.helpers.DefaultHandler;
-
-/**
- * Parser for the XML file. This parser uses the SAX-Parser from the Java
- * Standard API.
- *
- * @author Jens Pelzetter
- */
-public class RelationAttributeParser extends DefaultHandler {
-
- private RelAttrBean currentRelAttr;
- /**
- * A buffer
- */
- private StringBuilder buffer;
- private boolean relAttrOpen;
- private boolean attrOpen;
- private boolean keyOpen;
- private boolean langOpen;
- private boolean nameOpen;
- private boolean descOpen;
- private List relAttrs;
-
- public RelationAttributeParser() {
- relAttrs = new ArrayList();
- relAttrOpen = false;
- attrOpen = false;
- keyOpen = false;
- langOpen = false;
- nameOpen = false;
- descOpen = false;
- }
-
- @Override
- public void startDocument() throws SAXException {
- System.out.println("Relation attribute document begin...");
- }
-
- @Override
- public void endDocument() throws SAXException {
- System.out.println("Relation attribute document end.");
- }
-
- @Override
- public void startElement(String uri,
- String localName,
- String qName,
- Attributes attributes) throws SAXException {
- System.out.printf("DEBUG: uri = %s\n", uri);
- System.out.printf("DEBUG: localName = %s\n", localName);
- System.out.printf("DEBUG: qName = %s\n", qName);
- buffer = new StringBuilder();
- if ("relationAttributes".equals(qName)) {
- //Nothing to do
- } else if ("relationAttribute".equals(qName)) {
- relAttrOpen = true;
- currentRelAttr = new RelAttrBean();
- } else if ("attribute".equals(qName)) {
- attrOpen = true;
- } else if ("key".equals(qName)) {
- keyOpen = true;
- } else if ("lang".equals(qName)) {
- langOpen = true;
- } else if ("name".equals(qName)) {
- nameOpen = true;
- } else if ("description".equals(qName)) {
- descOpen = true;
- } else {
- System.err.printf(
- "Warning: Encountered unexpected element %s. Ignoring.\n",
- qName);
- }
- }
-
- @Override
- public void endElement(String uri,
- String localName,
- String qName) throws SAXException {
- if ("relationAttributes".equals(qName)) {
- //Nothing to do
- } else if ("relationAttribute".equals(qName)) {
- relAttrs.add(currentRelAttr);
- currentRelAttr = null;
- relAttrOpen = false;
- } else if ("attribute".equals(qName)) {
- System.out.printf("buffer = %s\n", buffer.toString());
- currentRelAttr.setAttribute(buffer.toString());
- attrOpen = false;
- } else if ("key".equals(qName)) {
- currentRelAttr.setKey(buffer.toString());
- keyOpen = false;
- } else if ("lang".equals(qName)) {
- currentRelAttr.setLang(buffer.toString());
- langOpen = false;
- } else if ("name".equals(qName)) {
- currentRelAttr.setName(buffer.toString());
- nameOpen = false;
- } else if ("description".equals(qName)) {
- currentRelAttr.setDescription(buffer.toString());
- descOpen = false;
- } else {
- System.err.printf(
- "Warning: Encountered unexpected element %s. Ignoring.\n",
- qName);
- }
- }
-
- @Override
- public void characters(char[] ch,
- int start,
- int length) throws SAXException {
- System.out.printf("Parsing characters %d to %d...\n", start, (start + length));
- for (int i = start; i < (start + length); i++) {
- char character;
- character = ch[i];
- buffer.append(character);
- }
- }
-
- @Override
- public void warning(SAXParseException ex) {
- System.err.println(saxMsg(ex));
- }
-
- @Override
- public void error(SAXParseException ex) {
- System.err.println(saxMsg(ex));
- }
-
- @Override
- public void fatalError(SAXParseException ex) {
- System.err.println(saxMsg(ex));
- }
-
- protected List getRelAttrs() {
- return relAttrs;
- }
-
- private String saxMsg(SAXParseException ex) {
- String msg;
-
- msg = String.format(
- "SAX parser reported an error at line %d, column %d: %s",
- ex.getLineNumber(),
- ex.getColumnNumber(),
- ex.getMessage());
-
- return msg;
- }
-}
diff --git a/ccm-cms-types-genericorganization/application.xml b/ccm-cms-types-genericorganization/application.xml
deleted file mode 100644
index f1a041067..000000000
--- a/ccm-cms-types-genericorganization/application.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Generic organization type for OpenCCM
-
-
-
diff --git a/ccm-cms-types-genericorganization/pdl/com/arsdigita/content-types/GenericOrganization.pdl b/ccm-cms-types-genericorganization/pdl/com/arsdigita/content-types/GenericOrganization.pdl
deleted file mode 100644
index a0c4f6846..000000000
--- a/ccm-cms-types-genericorganization/pdl/com/arsdigita/content-types/GenericOrganization.pdl
+++ /dev/null
@@ -1,35 +0,0 @@
-//
-// Copyright (C) 2009 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
-//
-//
-
-model com.arsdigita.cms.contenttypes;
-
-import com.arsdigita.cms.ContentItem;
-import com.arsdigita.cms.ContentPage;
-import com.arsdigita.cms.DomainObject;
-
-object type GenericOrganization extends ContentPage {
- String[0..1] organizationname = ct_genericorganizations.organizationname VARCHAR(512);
- String[0..1] organizationnameaddendum = ct_genericorganizations.organizationnameaddendum VARCHAR(512);
- String[0..1] organizationdescription = ct_genericorganizations.organizationdescription VARCHAR(2000);
-
- OrganizationRole[0..n] organizationroles = join ct_genericorganizations.organization_id to ct_organizationroles.owner_id;
- Orga2OrgaUnit[0..n] subunits = join ct_genericorganizations.organization_id to ct_orga2orgaunits.owner_id;
-
- reference key (ct_genericorganizations.organization_id);
-}
\ No newline at end of file
diff --git a/ccm-cms-types-genericorganization/pdl/com/arsdigita/content-types/Orga2OrgaUnit.pdl b/ccm-cms-types-genericorganization/pdl/com/arsdigita/content-types/Orga2OrgaUnit.pdl
deleted file mode 100644
index 94716f4d8..000000000
--- a/ccm-cms-types-genericorganization/pdl/com/arsdigita/content-types/Orga2OrgaUnit.pdl
+++ /dev/null
@@ -1,69 +0,0 @@
-//
-// Copyright (C) 2009 Center of Socialpolitics, 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
-
-model com.arsdigita.cms.contenttypes;
-
-import com.arsdigita.cms.ContentItem;
-import com.arsdigita.kernel.ACSObject;
-
-object type Orga2OrgaUnit extends ACSObject {
- OrganizationalUnit[0..1] targetItem = join ct_orga2orgaunits.target_item_id to ct_organizationalunits.organizationalunit_id;
-
- Integer[0..1] unitOrder = ct_orga2orgaunits.unit_order INTEGER;
-
- reference key(ct_orga2orgaunits.orga2orgaunit_id);
- aggressive load (unitOwner.id);
-}
-
-association {
- composite GenericOrganization[0..1] unitOwner = join ct_orga2orgaunits.owner_id to ct_genericorganizations.organization_id;
- composite Orga2OrgaUnit[0..n] units = join ct_genericorganizations.organization_id to ct_orga2orgaunits.owner_id;
-}
-
-query getReferingUnits {
- BigDecimal id;
-
- do {
- select u.organizationalunit_id from orga2orgaunits u where u.target_item_id = :itemID
- } map {
- id = u.orga2orgaunit_id;
- }
-}
-
-data operation swapOrga2OrgaUnitWithNextInGroup {
- do {
- update ct_orga2orgaunits
- set unit_order = CASE WHEN (unit_order = :unitOrder) THEN
- (:nextUnitOrder)
- ELSE
- (:unitOrder)
- END
- where (unit_order = :unitOrder or unit_order = :nextUnitOrder)
- and owner_id = :ownerID
- }
-}
-
-query allUnitsOrderForOrganization {
- Integer unitOrder;
-
- do {
- select u.unit_order from ct_orga2orgaunits u where u.owner_id = :ownerID
- }
- map {
- unitOrder = u.unit_order;
- }
-}
\ No newline at end of file
diff --git a/ccm-cms-types-genericorganization/pdl/com/arsdigita/content-types/OrganizationRole.pdl b/ccm-cms-types-genericorganization/pdl/com/arsdigita/content-types/OrganizationRole.pdl
deleted file mode 100644
index 5b0c12663..000000000
--- a/ccm-cms-types-genericorganization/pdl/com/arsdigita/content-types/OrganizationRole.pdl
+++ /dev/null
@@ -1,76 +0,0 @@
-//
-// Copyright (C) 2009 Center for Social Policy Reseearch, 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
-
-model com.arsdigita.cms.contenttypes;
-
-import com.arsdigita.cms.ContentItem;
-import com.arsdigita.kernel.ACSObject;
-import com.arsdigita.cms.contenttypes.GenericPerson;
-
-object type OrganizationRole extends ACSObject {
- String[1..1] roleName = ct_organizationroles.rolename VARCHAR(150);
- GenericPerson[0..1] targetItem = join ct_organizationroles.target_item_id to cms_persons.person_id;
-
- Integer[0..1] roleOrder = ct_organizationroles.role_order INTEGER;
-
- reference key(ct_organizationroles.role_id);
- aggressive load (roleOwner.id);
-}
-
-association {
- composite GenericOrganization[0..1] roleOwner = join ct_organizationroles.owner_id to ct_genericorganizations.organization_id;
- composite OrganizationRole[0..n] roles = join ct_genericorganizations.organization_id to ct_organizationroles.owner_id;
-}
-
-query getRefferingRoles {
- BigDecimal id;
-
- do {
- select r.role_id from ct_organizationroles r where r.target_item_id = :itemID
- } map {
- id = r.role_id;
- }
-}
-
-data operation swapOrganizationRoleWithNextInGroup {
- do {
- update ct_organizationroles
- set role_order = CASE WHEN (role_order = :roleOrder) THEN
- (:nextRoleOrder)
- ELSE
- (:roleOrder)
- END
- where (role_order = :roleOrder or role_order = :nextRoleOrder)
- and owner_id = :ownerID
- }
-}
-
-// and 2 = (select count(*) from ct_organizationroles r where r.role_id=r.role_id
-// and (role_order = :roleOrder or role_order = :nextRoleOrder)
- // and owner_id = :ownerID)
-
-
-query allRoleOrderForOrganization {
- Integer roleOrder;
-
- do {
- select r.role_order from ct_organizationroles r where r.owner_id = :ownerID
- }
- map {
- roleOrder = r.role_order;
- }
-}
diff --git a/ccm-cms-types-genericorganization/sql/ccm-cms-types-genericorganization/postgres-create.sql b/ccm-cms-types-genericorganization/sql/ccm-cms-types-genericorganization/postgres-create.sql
deleted file mode 100644
index a733590e2..000000000
--- a/ccm-cms-types-genericorganization/sql/ccm-cms-types-genericorganization/postgres-create.sql
+++ /dev/null
@@ -1,3 +0,0 @@
-begin;
-\i ddl/postgres/create.sql
-end;
\ No newline at end of file
diff --git a/ccm-cms-types-genericorganization/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/GenericOrganization.xml b/ccm-cms-types-genericorganization/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/GenericOrganization.xml
deleted file mode 100644
index 9b723b750..000000000
--- a/ccm-cms-types-genericorganization/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/GenericOrganization.xml
+++ /dev/null
@@ -1,45 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ccm-cms-types-genericorganization/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/GenericOrganization.xml b/ccm-cms-types-genericorganization/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/GenericOrganization.xml
deleted file mode 100644
index 92e53f858..000000000
--- a/ccm-cms-types-genericorganization/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/GenericOrganization.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ccm-cms-types-genericorganization/src/ccm-cms-types-genericorganization.config b/ccm-cms-types-genericorganization/src/ccm-cms-types-genericorganization.config
deleted file mode 100644
index b6865e594..000000000
--- a/ccm-cms-types-genericorganization/src/ccm-cms-types-genericorganization.config
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
\ No newline at end of file
diff --git a/ccm-cms-types-genericorganization/src/ccm-cms-types-genericorganization.load b/ccm-cms-types-genericorganization/src/ccm-cms-types-genericorganization.load
deleted file mode 100644
index 48f7c096d..000000000
--- a/ccm-cms-types-genericorganization/src/ccm-cms-types-genericorganization.load
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/GenericOrganization.java b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/GenericOrganization.java
deleted file mode 100644
index 44065a81f..000000000
--- a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/GenericOrganization.java
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- * Copyright (C) 2009 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;
-
-import com.arsdigita.cms.ContentPage;
-import com.arsdigita.domain.DataObjectNotFoundException;
-import com.arsdigita.persistence.DataObject;
-import com.arsdigita.persistence.OID;
-import java.math.BigDecimal;
-
-import org.apache.log4j.Logger;
-
-/**
- * This represents an organization. It is designed to be suitable
- * for most organizations. Currently, it offers the following properties:
- * - name of the organization
- * - an addendum for the name
- * - a short description of the organization.
- *
- * It is also possible to add roles to the organization, e.g. CEO, mayor or others.
- * The following features are planned to implement in one of the next commits:
- * - Adding OrganizationUnits
- *
- * The current version of this contenttype is modeled on base of the MultipartArticle
- * contenttype.
- *
- * @author Jens Pelzetter
- */
-public class GenericOrganization extends ContentPage {
-
- /**
- * The name of the organization (name can't be used as shorter name here
- * because name is already used in one of parent classes, and is used for
- * internal purposes also.
- */
- public static final String ORGANIZATIONNAME = "organizationname";
- /**
- * Addendum for the name of the organization.
- */
- public static final String ORGANIZATIONNAMEADDENDUM = "organizationnameaddendum";
- /**
- * A short description of the organization.
- */
- public static final String ORGANIZATIONDESCRIPTION = "organizationdescription";
- /**
- * Roles associated with the organization.
- */
- public static final String ROLES = "roles";
- /**
- * Type of this class (used for internal purposed).
- */
- public static String BASE_DATA_OBJECT_TYPE = "com.arsdigita.cms.contenttypes.GenericOrganization";
- //private static final GenericOrganizationConfig s_config = new GenericOrganizationConfig();
- private static final Logger s_log = Logger.getLogger(GenericOrganization.class);
-
- /**
- * Called when the class is loaded by the Java class loader.
- */
- /*static {
- s_config.load();
- }*/
-
- /**
- * Returns a possibly existing configuration object for the class.
- *
- * @return config object
- */
- /*public static final GenericOrganizationConfig getConfig() {
- return s_config;
- }*/
-
- /**
- * Default constructor. This creates a new (empty) organization
- */
- public GenericOrganization() {
- this(BASE_DATA_OBJECT_TYPE);
- }
-
- /**
- * Trys to find an organization in the database by its id.
- *
- * @param id ID of the object to (re-)create
- * @throws DataObjectNotFoundException if no object with the given id is found in the database.
- */
- public GenericOrganization(BigDecimal id) throws DataObjectNotFoundException {
- this(new OID(BASE_DATA_OBJECT_TYPE, id));
- }
-
- /**
- * Trys to find an organization in the database by its OID.
- *
- * @param id ID of the object to (re-)create
- * @throws DataObjectNotFoundException if no object with the given OID is found in the database.
- */
- public GenericOrganization(OID id) throws DataObjectNotFoundException {
- super(id);
- }
-
- /**
- * Create an new GenericOrganization object from a DataObject
- *
- * @param obj The data object
- */
- public GenericOrganization(DataObject obj) {
- super(obj);
- }
-
- /**
- * Not sure for what this constructor is.
- *
- * @param type The type of the object to create (?)
- */
- public GenericOrganization(String type) {
- super(type);
- }
-
-
- /* accessors *************************************************/
-
- /**
- * Gets the name of the organization.
- *
- * @return The name of the organization.
- */
- public String getOrganizationName() {
- return (String) get(ORGANIZATIONNAME);
- }
-
- /**
- * Sets the name of the organization.
- *
- * @param name The (new) name of the organization.
- */
- public void setOrganizationName(String name) {
- set(ORGANIZATIONNAME, name);
- }
-
- /**
- *
- * @return Addendum for the name of the organization.
- */
- public String getOrganizationNameAddendum() {
- return (String) get(ORGANIZATIONNAMEADDENDUM);
- }
-
- /**
- * Sets the the addenum property of the organization.
- *
- * @param addendum The new value for the addendum property.
- */
- public void setOrganizationNameAddendum(String addendum) {
- set(ORGANIZATIONNAMEADDENDUM, addendum);
- }
-
- /**
- *
- * @return Description of the organization, if any.
- */
- public String getOrganizationDescription() {
- return (String) get(ORGANIZATIONDESCRIPTION);
- }
-
- /**
- * Sets the description of the organization.
- *
- * @param description The (new) description.
- */
- public void setOrganizationDescription(String description) {
- set(ORGANIZATIONDESCRIPTION, description);
- }
-}
\ No newline at end of file
diff --git a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/GenericOrganizationConfig.java b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/GenericOrganizationConfig.java
deleted file mode 100644
index 3c8f42d50..000000000
--- a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/GenericOrganizationConfig.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (C) 2009 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;
-
-import com.arsdigita.runtime.AbstractConfig;
-
-/**
- * Configuration for GenericOrganization. Not used yet.
- *
- * @author Jens Pelzetter
- */
-public class GenericOrganizationConfig extends AbstractConfig {
-
-}
diff --git a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/GenericOrganizationGlobalizationUtil.java b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/GenericOrganizationGlobalizationUtil.java
deleted file mode 100644
index 9912b208c..000000000
--- a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/GenericOrganizationGlobalizationUtil.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package com.arsdigita.cms.contenttypes;
-
-import com.arsdigita.globalization.GlobalizedMessage;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class GenericOrganizationGlobalizationUtil {
-
- final public static String BUNDLE_NAME =
- "com.arsdigita.cms.contenttypes.GenericOrganizationResourceBundle";
-
- /**
- * This returns a globalized message using the type specific bundle,
- * BUNDLE_NAME
- */
- public static GlobalizedMessage globalize(String key) {
- return new GlobalizedMessage(key, BUNDLE_NAME);
- }
-
- /**
- * This returns a globalized message using the type specific bundle,
- * BUNDLE_NAME
- */
- public static GlobalizedMessage globalize(String key, Object[] args) {
- return new GlobalizedMessage(key, BUNDLE_NAME, args);
- }
-}
diff --git a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/GenericOrganizationInitializer.java b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/GenericOrganizationInitializer.java
deleted file mode 100644
index e27f5bc53..000000000
--- a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/GenericOrganizationInitializer.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright (C) 2009 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;
-
-import org.apache.log4j.Logger;
-import com.arsdigita.runtime.LegacyInitEvent;
-
-/**
- * Initializer of the GenericOrganization content type.
- *
- * @author Jens Pelzetter
- */
-public class GenericOrganizationInitializer extends ContentTypeInitializer {
-
- /*public final static String versionId =
- "$Id: GenericOrganizationInitializer.java 1 2009-04-30 09:32:55Z jensp $" +
- "$Author: jensp $" +
- "$DateTime: 2009/04/30 11:33:39 $";*/
- private static final Logger s_log = Logger.getLogger(GenericOrganizationInitializer.class);
-
- /**
- * Constructor. calls only the constructor of the parent class with name of
- * the pdl.mf file of the content type an the BASIC_DATA_OBJECT_TYPE.
- */
- public GenericOrganizationInitializer() {
- super("ccm-cms-types-genericorganization.pdl.mf",
- GenericOrganization.BASE_DATA_OBJECT_TYPE);
- }
-
- /**
- *
- * @return path of the traversal-adapter XML file.
- */
- @Override
- public String getTraversalXML() {
- return "/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/GenericOrganization.xml";
- }
-
- /**
- *
- * @return path of the XSL stylesheet file. The stylesheet is very generic, because this
- * contenttype will be used with the new mandalay theme only.
- */
- @Override
- public String[] getStylesheets() {
- return new String[] { "/static/content-types/com/arsdigita/cms/contenttypes/GenericOrganization.xsl" };
- }
-
- /**
- * Calls the init method of the parent class.
- *
- * @param evt The init event. LegacyInitEvent is marked deprecated. What should be used insted?
- */
- @Override
- public void init(LegacyInitEvent evt) {
- super.init(evt);
-
- /* MetadataProviderRegistry.registerAdapter(OrganizationRole.BASE_DATA_OBJECT_TYPE,
- new OrganizationRoleMetadataProvider());*/
- /*URLService.registerFinder(OrganizationRole.BASE_DATA_OBJECT_TYPE,
- new OrganizationRoleURLFinder());
-
- ContentSection.registerExtraXMLGenerator(GenericOrganization.class.getName(),
- new OrganizationRolesPanel());*/
- }
-}
\ No newline at end of file
diff --git a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/GenericOrganizationLoader.java b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/GenericOrganizationLoader.java
deleted file mode 100644
index d1c0edbbb..000000000
--- a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/GenericOrganizationLoader.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright (C) 2009 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;
-
-import org.apache.log4j.Logger;
-
-/**
- * Loader for the GenericOrganization content type.
- *
- * @author Jens Pelzetter
- */
-public class GenericOrganizationLoader extends AbstractContentTypeLoader {
-
- private static final Logger s_log = Logger.getLogger(GenericOrganizationLoader.class);
- private static final String[] TYPES = {
- "/WEB-INF/content-types/com/arsdigita/cms/contenttypes/GenericOrganization.xml"
- };
- //private ResourceParameter m_template;
-
- /**
- * Returns the value of the type string.
- *
- * @return The type string.
- */
- public String[] getTypes() {
- return TYPES;
- }
- /**
- * Constructor.
- */
- //public GenericOrganizationLoader() {
- // super();
- /*m_template = new ResourceParameter("com.arsdigita.cms.contenttypes.genericorganization.template",
- Parameter.REQUIRED,
- "/WEB-INF/content-types/com/arsdigita/cms/contenttypes/genericorganization-item.jsp");
- register(m_template);*/
- //}
- /**
- *
- * @param section
- * @param type
- * @param ld
- * @param wf
- */
- /*@Override
- protected void prepareSection(final ContentSection section,
- final ContentType type,
- final LifecycleDefinition ld,
- final WorkflowTemplate wf) {
- super.prepareSection(section, type, ld, wf);
-
- setDefaultTemplate("GenericOrganization-genericorganization-item",
- "genericorganization-item",
- (InputStream) get(m_template),
- section,
- type,
- ld,
- wf);
- }*/
-}
diff --git a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/GenericOrganizationResourceBundle.java b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/GenericOrganizationResourceBundle.java
deleted file mode 100644
index 5127d7e90..000000000
--- a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/GenericOrganizationResourceBundle.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package com.arsdigita.cms.contenttypes;
-
-import com.arsdigita.cms.CMSGlobalized;
-import com.arsdigita.globalization.ChainedResourceBundle;
-import java.util.PropertyResourceBundle;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class GenericOrganizationResourceBundle extends ChainedResourceBundle implements CMSGlobalized {
-
- public final static String GENERIC_ORGANIZATION_BUNDLE_NAME =
- "com.arsdigita.cms.contenttypes.GenericOrganizationResources";
-
- public GenericOrganizationResourceBundle() {
- super();
- addBundle((PropertyResourceBundle)getBundle(GENERIC_ORGANIZATION_BUNDLE_NAME));
- addBundle((PropertyResourceBundle)getBundle(BUNDLE_NAME));
- }
-
-}
diff --git a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/GenericOrganizationResources.properties b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/GenericOrganizationResources.properties
deleted file mode 100644
index bf8d265a7..000000000
--- a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/GenericOrganizationResources.properties
+++ /dev/null
@@ -1,15 +0,0 @@
-cms.contenttypes.ui.genericorganization.delete=Delete
-cms.contenttypes.ui.genericorganization.description=Description
-cms.contenttypes.ui.genericorganization.edit=Edit
-cms.contenttypes.ui.genericorganization.noorganizationalunitassociated=There are no organizational units for this organization.
-cms.contenttypes.ui.genericorganization.noRolesForThisOrga=There are no roles for this organization.
-cms.contenttypes.ui.genericorganization.organizationalunit=Organizational Unit
-cms.contenttypes.ui.genericorganization.organizationname=Name of Organization
-cms.contenttypes.ui.genericorganization.organizationnameaddendum=Addendum
-cms.contenttypes.ui.genericorganization.person=Person
-cms.contenttypes.ui.genericorganization.role=Role
-cms.contenttypes.ui.genericorganization.rolename=Name of role
-
-genericorganization.authoring.basic_properties.title=Basic properties
-genericorganization.authoring.roles.title=Roles
-genericorganization.authoring.units.title=Organizational Units
\ No newline at end of file
diff --git a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/GenericOrganizationResources_de.properties b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/GenericOrganizationResources_de.properties
deleted file mode 100644
index 7bc5e9ae5..000000000
--- a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/GenericOrganizationResources_de.properties
+++ /dev/null
@@ -1,15 +0,0 @@
-cms.contenttypes.ui.genericorganization.delete=L\u00F6schen
-cms.contenttypes.ui.genericorganization.description=Beschreibung
-cms.contenttypes.ui.genericorganization.edit=Bearbeiten
-cms.contenttypes.ui.genericorganization.noorganizationalunitassociated=F\u00FCr diese Organisation sind keine Organisationseiheiten definiert.
-cms.contenttypes.ui.genericorganization.noRolesForThisOrga=F\u00FCr diese Organisation sind keine Rollen definiert.
-cms.contenttypes.ui.genericorganization.organizationalunit=Organisationseinheit
-cms.contenttypes.ui.genericorganization.organizationname=Name der Organisation
-cms.contenttypes.ui.genericorganization.organizationnameaddendum=Namenszusatz
-cms.contenttypes.ui.genericorganization.person=Person
-cms.contenttypes.ui.genericorganization.role=Rolle
-cms.contenttypes.ui.genericorganization.rolename=Bezeichnung der Rolle
-
-genericorganization.authoring.basic_properties.title=Basiseigenschaften
-genericorganization.authoring.roles.title=Rollen
-genericorganization.authoring.units.title=Organisationseinheiten
\ No newline at end of file
diff --git a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/Orga2OrgaUnit.java b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/Orga2OrgaUnit.java
deleted file mode 100644
index 2be999c1c..000000000
--- a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/Orga2OrgaUnit.java
+++ /dev/null
@@ -1,363 +0,0 @@
-package com.arsdigita.cms.contenttypes;
-
-import com.arsdigita.cms.contenttypes.*;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.cms.ContentSection;
-import com.arsdigita.cms.dispatcher.ItemResolver;
-import com.arsdigita.domain.DomainObjectFactory;
-import com.arsdigita.kernel.ACSObject;
-import com.arsdigita.persistence.DataCollection;
-import com.arsdigita.persistence.DataObject;
-import com.arsdigita.persistence.DataOperation;
-import com.arsdigita.persistence.DataQuery;
-import com.arsdigita.persistence.Filter;
-import com.arsdigita.persistence.OID;
-import com.arsdigita.persistence.Session;
-import com.arsdigita.persistence.SessionManager;
-import com.arsdigita.util.Assert;
-import com.arsdigita.web.URL;
-import java.math.BigDecimal;
-import org.apache.log4j.Logger;
-
-/**
- * This class represents all relationship between an organization and an
- * organizational unit.
- *
- * @author Jens Pelzetter
- */
-public class Orga2OrgaUnit extends ACSObject {
-
- private final static Logger logger = Logger.getLogger(Orga2OrgaUnit.class);
-
- /**
- * Id for the targetItem property.
- */
- public final static String TARGETITEM = "targetItem";
-
- /**
- * Id for the unitOwner property.
- */
- public final static String UNITOWNER = "unitOwner";
-
- /**
- * Id for the unitOrder property.
- */
- public final static String UNITORDER = "unitOrder";
-
- /**
- * Object type
- */
- public final static String BASE_DATA_OBJECT_TYPE = "com.arsdigita.cms.contenttypes.Orga2OrgaUnit";
-
- /**
- * Constrcutor without parameters for creating an new Orga2OrgaUnit relation.
- */
- public Orga2OrgaUnit() {
- super(BASE_DATA_OBJECT_TYPE);
- }
-
- /**
- * Tries to find the Orga2OrgaUnit relation with the given {@code id} in the database.
- *
- * @param id Of an existing organization to organizational unit relation.
- */
- public Orga2OrgaUnit(BigDecimal id) {
- this(new OID(BASE_DATA_OBJECT_TYPE, id));
- }
-
- /**
- * Tries to find the Orga2OrgaUnit relation with the {@code id} in the database.
- *
- * @param id OID Of an existing organization to organizational unit relation.
- */
- public Orga2OrgaUnit(OID id) {
- super(id);
- }
-
- /**
- * Creates an new instance of this class from {@code obj}
- *
- * @param obj
- */
- public Orga2OrgaUnit(DataObject obj) {
- super(obj);
- }
-
- /**
- *
- * @param type Type of the object to create.
- */
- public Orga2OrgaUnit(String type) {
- super(type);
- }
-
- /**
- *
- * @return The GenericOrganization which is part of the relation.
- */
- public GenericOrganization getUnitOwner() {
- DataObject obj = (DataObject) get(UNITOWNER);
- if (obj == null) {
- return null;
- } else {
- return (GenericOrganization) DomainObjectFactory.newInstance(obj);
- }
- }
-
- /**
- * Sets the owing organization.
- *
- * @param orga The owning organization.
- */
- public void setUnitOwner(GenericOrganization orga) {
- Assert.exists(orga, GenericOrganization.class);
- logger.debug(String.format("Setting unit owner to %s", orga.getOrganizationName()));
- setAssociation(UNITOWNER, orga);
- }
-
- /**
- *
- * @return The OrganizationalUnit which is part of the relation.
- */
- public OrganizationalUnit getTargetItem() {
- DataObject object = (DataObject) get(TARGETITEM);
- return (OrganizationalUnit) DomainObjectFactory.newInstance(object);
- }
-
- /**
- * Sets the OrganizationalUnit
- *
- * @param unit
- */
- public void setTargetItem(OrganizationalUnit unit) {
- setAssociation(TARGETITEM, unit);
- }
-
- /**
- *
- * @return The order of the the relations.
- */
- public Integer getOrder() {
- return (Integer) get(UNITORDER);
- }
-
- /**
- * Sets the order.
- *
- * @param order
- */
- public void setOrder(Integer order) {
- Assert.exists(order);
- set(UNITORDER, order);
- }
-
- /**
- *
- * @param s Current PageState.
- * @return The URI of the targetItem.
- */
- public String getURI(PageState s) {
- OrganizationalUnit unit = getTargetItem();
-
- if(unit == null) {
- logger.error(getOID() + "is a link between an organization and an organizational unit, but the associated organizational unit is null");
- return "";
- }
-
- ContentSection section = unit.getContentSection();
- ItemResolver resolver = section.getItemResolver();
- String url = resolver.generateItemURL(s, unit, section, unit.getVersion());
-
- return URL.there(s.getRequest(), url).toString();
- }
-
- /**
- *
- * @param unit
- * @return All Orga2OrgaUnit relations for a specific OrganizationalUnit
- */
- public static DataCollection getReferingUnits(OrganizationalUnit unit) {
- Session session = SessionManager.getSession();
- DataCollection units = session.retrieve(BASE_DATA_OBJECT_TYPE);
- Filter filter = units.addInSubqueryFilter("id", "com.arsdigita.cms.contenttypes.getReferingUnits");
- filter.set("itemID", unit.getID());
-
- return units;
- }
-
- /**
- *
- * @param orga
- * @return All units associated with an GenericOrganization.
- */
- public static DataCollection getUnits(GenericOrganization orga) {
- Session session = SessionManager.getSession();
- DataCollection units = session.retrieve(BASE_DATA_OBJECT_TYPE);
- units.addEqualsFilter(UNITOWNER + ".id", orga.getID());
- units.addOrder(UNITORDER);
- return units;
- }
-
- /**
- * Swaps an Orga2OrgaUnit relation with the next one in the list.
- */
- public void swapWithNext() {
- swapWithNext("com.arsdigita.cms.contenttypes.allUnitsOrderForOrganization", "com.arsdigita.cms.contenttypes.swapOrga2OrgaUnitWithNextInGroup");
- }
-
- /**
- * Swaps an Orga2OrgaUnit relation with the previous one in the list.
- */
- public void swapWithPrevious() {
- swapWithPrevious("com.arsdigita.cms.contenttypes.allUnitsOrderForOrganization", "com.arsdigita.cms.contenttypes.swapOrga2OrgaUnitWithNextInGroup");
- }
-
- /**
- * Swaps an Orga2OrgaUnit relation with the next one in the list.
- *
- * @param queryName Query to use.
- * @param operationName Operation to use.
- */
- public void swapWithNext(String queryName, String operationName) {
- swapKeys(true, queryName, operationName);
- }
-
- /**
- * Swaps an Orga2OrgaUnit relation with the previous one in the list.
- *
- * @param queryName Query to use.
- * @param operationName Operation to use.
- */
- public void swapWithPrevious(String queryName, String operationName) {
- swapKeys(false, queryName, operationName);
- }
-
- /**
- *
- * @param queryName Name of the SwapQuery.
- * @return The query named with @queryName
- */
- protected DataQuery getSwapQuery(String queryName) {
- DataQuery query = SessionManager.getSession().retrieveQuery(queryName);
- query.setParameter("ownerID", getUnitOwner().getID());
- return query;
- }
-
- /**
- *
- * @param operationName Name of the operation.
- * @return Returns the DataOperation for swapping.
- */
- protected DataOperation getSwapOperation(String operationName) {
- DataOperation operation = SessionManager.getSession().retrieveDataOperation(operationName);
- operation.setParameter("ownerID", getUnitOwner().getID());
- return operation;
- }
-
- /**
- * The method which does the real swapping.
- *
- * @param swapNext If true, swap with next, if false, swap with previous
- * @param queryName Name of the DataQuery to use.
- * @param operationName Name of the DataOperation to use.
- */
- protected void swapKeys(boolean swapNext, String queryName, String operationName) {
-
- String methodName = null;
- if (swapNext) {
- methodName = "swapWithNext";
- } else {
- methodName = "swapWithPrevious";
- }
-
- Assert.isTrue(!isNew(), methodName + " cannot be called on an object that is new");
-
- Integer currentKey = (Integer) get(UNITORDER);
-
- if(currentKey == null) {
- alphabetize();
- return;
- }
-
- Assert.isTrue(currentKey != null, methodName + " cannot be " +
- "called on an object that is not currently in the " +
- "list");
-
- int key = currentKey.intValue();
-
- DataQuery query = getSwapQuery(queryName);
-
- int otherKey;
- if(swapNext) {
- otherKey = key + 1;
- query.addOrder("unitOrder ASC");
- query.addFilter(query.getFilterFactory().greaterThan("unitOrder", currentKey, true));
- } else {
- otherKey = key - 1;
- query.addOrder("unitOrder DESC");
- query.addFilter(query.getFilterFactory().lessThan("unitOrder", currentKey, true));
- }
-
- if(query.next()) {
- otherKey = ((Integer) query.get("unitOrder")).intValue();
- query.close();
- }
-
- DataOperation operation = getSwapOperation(operationName);
- operation.setParameter("unitOrder", new Integer(key));
- operation.setParameter("nextUnitOrder", new Integer(otherKey));
- operation.execute();
- }
-
- /**
- * Don't kwow what this is for, but it is needed for the swapping
- */
- protected void alphabetize() {
- Session session = SessionManager.getSession();
- DataCollection units = session.retrieve(BASE_DATA_OBJECT_TYPE);
- units.addEqualsFilter(UNITOWNER + ".id", getUnitOwner().getID());
- int sortkey = 0;
- while (units.next()) {
- sortkey++;
- Orga2OrgaUnit o2ou = new Orga2OrgaUnit(units.getDataObject());
- o2ou.setOrder(sortkey);
- o2ou.save();
- }
- }
-
- /**
- *
- * @return Maximum order index.
- */
- public int maxOrder() {
- GenericOrganization unitOwner = getUnitOwner();
- if (unitOwner == null) {
- return 0;
- }
-
- int returnOrder = 0;
- DataQuery query = SessionManager.getSession().retrieveQuery("com.arsdigita.cms.contenttypes.allUnitsOrderForOrganization");
- query.setParameter("ownerID", getUnitOwner().getID());
- query.addOrder("unitOrder DESC");
- if(query.next()) {
- Integer unitOrder = ((Integer) query.get("unitOrder"));
- query.close();
- if(unitOrder != null) {
- returnOrder = unitOrder.intValue();
- }
- }
-
- return returnOrder;
- }
-
- /**
- * Invoked before saving to the database.
- */
- @Override
- public void beforeSave() {
- super.beforeSave();
- if (getOrder() == null) {
- setOrder(maxOrder() + 1);
- }
- }
-}
diff --git a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/OrganizationRole.java b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/OrganizationRole.java
deleted file mode 100644
index 6e2702d50..000000000
--- a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/OrganizationRole.java
+++ /dev/null
@@ -1,397 +0,0 @@
-package com.arsdigita.cms.contenttypes;
-
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.cms.ContentSection;
-import com.arsdigita.cms.dispatcher.ItemResolver;
-import com.arsdigita.domain.DataObjectNotFoundException;
-import com.arsdigita.domain.DomainObjectFactory;
-import com.arsdigita.kernel.ACSObject;
-import com.arsdigita.persistence.DataCollection;
-import com.arsdigita.persistence.DataObject;
-import com.arsdigita.persistence.DataOperation;
-import com.arsdigita.persistence.DataQuery;
-import com.arsdigita.persistence.Filter;
-import com.arsdigita.persistence.OID;
-import com.arsdigita.persistence.Session;
-import com.arsdigita.persistence.SessionManager;
-import com.arsdigita.util.Assert;
-import com.arsdigita.web.URL;
-import java.math.BigDecimal;
-import org.apache.log4j.Logger;
-
-/**
- * This class represents an role in a organization. Examples for roles
- * are CEO, chairmen, mayor, speaker etc.
- *
- * @author Jens Pelzetter
- */
-public class OrganizationRole extends ACSObject {
-
- private static final Logger logger = Logger.getLogger(OrganizationRole.class);
- /**
- * PDL identifier of the name property of the role
- */
- public static final String ROLENAME = "roleName";
- /**
- * PDL identifier for the targetItem - the person assoicated with the role.
- */
- public static final String TARGETITEM = "targetItem";
- /**
- * PDL for identifier for the organization associated with this role.
- */
- public static final String ROLEOWNER = "roleOwner";
- /**
- * PDL id for the property for ordering the roles of an organization.
- */
- public static final String ORDER = "roleOrder";
- /**
- * Type of this object.
- */
- public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.cms.contenttypes.OrganizationRole";
-
- /**
- * Empty construtor creating a new role
- */
- public OrganizationRole() {
- this(BASE_DATA_OBJECT_TYPE);
- }
-
- /**
- * Tries to get the role with @id from the database.
- *
- * @param id
- * @throws com.arsdigita.domain.DataObjectNotFoundException
- */
- public OrganizationRole(BigDecimal id) throws DataObjectNotFoundException {
- this(new OID(BASE_DATA_OBJECT_TYPE, id));
- }
-
- /**
- * Tries to get the role with @id from the database.
- *
- * @param id
- * @throws com.arsdigita.domain.DataObjectNotFoundException
- */
- public OrganizationRole(OID id) throws DataObjectNotFoundException {
- super(id);
- }
-
- /**
- * Tries to find obj in the database.
- *
- * @param obj
- */
- public OrganizationRole(DataObject obj) {
- super(obj);
- }
-
- /**
- * Creates a new role.
- *
- * @param type
- */
- public OrganizationRole(String type) {
- super(type);
- }
-
- /**
- *
- * @return The name of the role.
- */
- public String getRolename() {
- return (String) get(ROLENAME);
- }
-
- /**
- * Sets the name of the role
- *
- * @param rolename
- */
- public void setRolename(String rolename) {
- set(ROLENAME, rolename);
- }
-
- /**
- *
- * @return The owning organization.
- */
- public GenericOrganization getRoleOwner() {
- DataObject obj = (DataObject) get(ROLEOWNER);
- if (obj == null) {
- return null;
- } else {
- return (GenericOrganization) DomainObjectFactory.newInstance(obj);
- }
- }
-
- /**
- * Sets the owing organization.
- *
- * @param orga
- */
- public void setRoleOwner(GenericOrganization orga) {
- Assert.exists(orga, GenericOrganization.class);
- logger.debug(String.format("Setting role owner to %s", orga.getOrganizationName()));
- setAssociation(ROLEOWNER, orga);
- }
-
- /**
- *
- * @return The person associated with the role.
- */
- public com.arsdigita.cms.contenttypes.GenericPerson getTargetItem() {
- DataObject object = (DataObject) get(TARGETITEM);
- return (com.arsdigita.cms.contenttypes.GenericPerson) DomainObjectFactory.newInstance(object);
- }
-
- /**
- * Sets the person associated with the role
- *
- * @param item
- */
- public void setTargetItem(com.arsdigita.cms.contenttypes.GenericPerson item) {
- setAssociation(TARGETITEM, item);
- }
-
- /**
- *
- * @return The order of the role.
- */
- public Integer getOrder() {
- return (Integer) get(ORDER);
- }
-
- /**
- * Sets the order of the role
- *
- * @param order
- */
- public void setOrder(Integer order) {
- Assert.exists(order);
- set(ORDER, order);
- }
-
- /*
- *
- * @param s Current PageState
- * @return The URI of the target item.
- */
- public String getURI(PageState s) {
- com.arsdigita.cms.contenttypes.GenericPerson item = getTargetItem();
-
- if (item == null) {
- logger.error(getOID() + " is a link between an organization and a person, but the associated person is null");
- return "";
- }
-
- ContentSection section = item.getContentSection();
- ItemResolver resolver = section.getItemResolver();
- String url = resolver.generateItemURL(s, item, section, item.getVersion());
-
- return URL.there(s.getRequest(), url).toString();
- }
-
- /**
- *
- * @param person
- * @return All roles a person is associated with.
- */
- public static DataCollection getReferingRoles(com.arsdigita.cms.contenttypes.GenericPerson person) {
- Session session = SessionManager.getSession();
- DataCollection roles = session.retrieve(BASE_DATA_OBJECT_TYPE);
- Filter filter = roles.addInSubqueryFilter("id", "com.arsdigita.cms.contenttypes.getRefferingRoles");
- filter.set("itemID", person.getID());
-
- return roles;
- }
-
- /**
- *
- * @param orga
- * @return all roles an organization is associated with.
- */
- public static DataCollection getRoles(GenericOrganization orga) {
- logger.debug("Getting roles for an organization...");
- Session session = SessionManager.getSession();
- DataCollection roles = session.retrieve(BASE_DATA_OBJECT_TYPE);
- roles.addEqualsFilter(ROLEOWNER + ".id", orga.getID());
- roles.addOrder(ORDER);
- return roles;
- }
-
- /**
- * Swaps an role with the next in the order.
- *
- * @throws java.lang.UnsupportedOperationException
- */
- public void swapWithNext() throws UnsupportedOperationException {
- swapWithNext("com.arsdigita.cms.contenttypes.allRoleOrderForOrganization", "com.arsdigita.cms.contenttypes.swapOrganizationRoleWithNextInGroup");
- }
-
- /**
- * Swaps a role with the previous in the order.
- *
- * @throws java.lang.UnsupportedOperationException
- */
- public void swapWithPrevious() throws UnsupportedOperationException {
- swapWithPrevious("com.arsdigita.cms.contenttypes.allRoleOrderForOrganization", "com.arsdigita.cms.contenttypes.swapOrganizationRoleWithNextInGroup");
- }
-
- /**
- * Swaps an role with the next in the order.
- *
- * @param queryName
- * @param operationName
- */
- public void swapWithNext(String queryName, String operationName) {
- swapKeys(true, queryName, operationName);
- }
-
- /**
- * Swaps a role with the previous in the order.
- *
- * @param queryName
- * @param operationName
- */
- public void swapWithPrevious(String queryName, String operationName) {
- swapKeys(false, queryName, operationName);
- }
-
- /**
- * Returns the query for swaping roles definied in the PDL.
- *
- * @param queryName
- * @return
- */
- protected DataQuery getSwapQuery(String queryName) {
- DataQuery query = SessionManager.getSession().retrieveQuery(queryName);
- query.setParameter("ownerID", getRoleOwner().getID());
- return query;
- }
-
- /**
- * Gets the PDL operation for swaping.
- *
- * @param operationName
- * @return
- */
- protected DataOperation getSwapOperation(String operationName) {
- DataOperation operation = SessionManager.getSession().retrieveDataOperation(operationName);
- operation.setParameter("ownerID", getRoleOwner().getID());
- return operation;
- }
-
- /**
- * Swaps the keys of two roles.
- *
- * @param swapNext
- * @param queryName
- * @param operationName
- */
- protected void swapKeys(boolean swapNext, String queryName, String operationName) {
- logger.info("this is swapKeys()...");
-
- String methodName = null;
- if (swapNext) {
- methodName = "swapWithNext";
- } else {
- methodName = "swapWithPrevious";
- }
-
- Assert.isTrue(!isNew(), methodName + "cannot be called on an object that is new");
-
- Integer currentKey = (Integer) get(ORDER);
- logger.info(String.format("currentKey = %s", currentKey.intValue()));
-
- if (currentKey == null) {
- alphabetize();
- return;
- }
-
- Assert.isTrue(currentKey != null, methodName + " cannot be "
- + "called on an object that is not currently in the "
- + "list");
-
- int key = currentKey.intValue();
- logger.info(String.format("key = %d", key));
-
- DataQuery query = getSwapQuery(queryName);
-
- int otherKey; // = key;
- if (swapNext) {
- otherKey = key + 1;
- query.addOrder("roleOrder ASC");
- query.addFilter(query.getFilterFactory().greaterThan("roleOrder", currentKey, true));
- } else {
- otherKey = key - 1;
- query.addOrder("roleOrder DESC");
- query.addFilter(query.getFilterFactory().lessThan("roleOrder", currentKey, true));
- }
-
- if (query.next()) {
- otherKey = ((Integer) query.get("roleOrder")).intValue();
- query.close();
- }
-
- logger.info(String.format("otherKey = %s", otherKey));
-
- DataOperation operation = getSwapOperation(operationName);
- //operation.setParameter("roleID", this.get(ID));
- operation.setParameter("roleOrder", new Integer(key));
- operation.setParameter("nextRoleOrder", new Integer(otherKey));
- logger.info(String.format("swapoperation = %s", operation.toString()));
- operation.execute();
- }
-
- /**
- *
- */
- protected void alphabetize() {
- Session session = SessionManager.getSession();
- DataCollection roles = session.retrieve(BASE_DATA_OBJECT_TYPE);
- roles.addEqualsFilter(ROLEOWNER + ".id", getRoleOwner().getID());
- roles.addOrder(ROLENAME);
- int sortkey = 0;
- while (roles.next()) {
- sortkey++;
- OrganizationRole role = new OrganizationRole(roles.getDataObject());
- role.setOrder(sortkey);
- role.save();
- }
- }
-
- /**
- *
- * @return
- */
- public int maxOrder() {
- GenericOrganization roleOwner = getRoleOwner();
- if (roleOwner == null) {
- return 0;
- }
- int returnOrder = 0;
- DataQuery query = SessionManager.getSession().retrieveQuery("com.arsdigita.cms.contenttypes.allRoleOrderForOrganization");
- query.setParameter("ownerID", getRoleOwner().getID());
- query.addOrder("roleOrder DESC");
- if (query.next()) {
- Integer roleOrder = ((Integer) query.get("roleOrder"));
- query.close();
- if (roleOrder != null) {
- returnOrder = roleOrder.intValue();
- }
- }
-
- return returnOrder;
- }
-
- /**
- * Called before the object is saved to the database.
- */
- @Override
- public void beforeSave() {
- super.beforeSave();
- if (getOrder() == null) {
- setOrder(maxOrder() + 1);
- }
- }
-}
diff --git a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationPropertiesStep.java b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationPropertiesStep.java
deleted file mode 100644
index a52141225..000000000
--- a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationPropertiesStep.java
+++ /dev/null
@@ -1,86 +0,0 @@
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.cms.ContentPage;
-import com.arsdigita.cms.ContentSection;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.GenericOrganization;
-import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
-import com.arsdigita.cms.ui.authoring.BasicPageForm;
-import com.arsdigita.cms.ui.authoring.SimpleEditStep;
-import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
-import com.arsdigita.domain.DomainObject;
-import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
-import com.arsdigita.cms.contenttypes.GenericOrganizationGlobalizationUtil;
-import com.arsdigita.bebop.Component;
-
-import com.arsdigita.cms.util.GlobalizationUtil;
-import java.text.DateFormat;
-import org.apache.log4j.Logger;
-
-/**
- * AuthoringStep for the basic properties of an organization (name, name addendum and
- * a short description).
- *
- * @author Jens Pelzetter
- */
-public class GenericOrganizationPropertiesStep extends SimpleEditStep {
-
- private static final Logger logger = Logger.getLogger(GenericOrganizationPropertiesStep.class);
-
- /**
- * Name of the this edit sheet (Don't know if this this really needed.
- * It has the same value in almost all PropertiesStep classes)
- */
- public static final String EDIT_SHEET_NAME = "edit";
-
- /**
- * Constructor for the PropertiesStep.
- *
- * @param itemModel
- * @param parent
- */
- public GenericOrganizationPropertiesStep(ItemSelectionModel itemModel, AuthoringKitWizard parent) {
- super(itemModel, parent);
-
- setDefaultEditKey(EDIT_SHEET_NAME);
- BasicPageForm editSheet;
-
- editSheet = new GenericOrganizationPropertyForm(itemModel, this);
- add(EDIT_SHEET_NAME, "Edit", new WorkflowLockedComponentAccess(editSheet, itemModel), editSheet.getSaveCancelSection().getCancelButton());
-
- setDisplayComponent(getGenericOrganizationPropertySheet(itemModel));
- }
-
- /**
- * Creates and returns the sheet for editing the basic properties
- * of an organization. (@see GenericOrganizationPropertyForm).
- *
- * @param itemModel
- * @return The sheet for editing the properties of the organization.
- */
- public static Component getGenericOrganizationPropertySheet(ItemSelectionModel itemModel) {
- DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(itemModel);
-
- sheet.add(GenericOrganizationGlobalizationUtil.globalize("cms.contenttypes.ui.genericorganization.organizationname"), GenericOrganization.ORGANIZATIONNAME);
- sheet.add(GenericOrganizationGlobalizationUtil.globalize("cms.contenttypes.ui.genericorganization.organizationnameaddendum"), GenericOrganization.ORGANIZATIONNAMEADDENDUM);
- sheet.add(GenericOrganizationGlobalizationUtil.globalize("cms.contenttypes.ui.genericorganization.description"), GenericOrganization.DESCRIPTION);
-
- if(!ContentSection.getConfig().getHideLaunchDate()) {
- sheet.add(GlobalizationUtil.globalize("cms.ui.authoring.page_launch_date"), ContentPage.LAUNCH_DATE, new DomainObjectPropertySheet.AttributeFormatter() {
-
- public String format(DomainObject obj, String attribute, PageState state) {
- ContentPage page = (ContentPage)obj;
- if(page.getLaunchDate() != null) {
- return DateFormat.getDateInstance(DateFormat.LONG).format(page.getLaunchDate());
- }
- else {
- return (String)GlobalizationUtil.globalize("cms.ui.unknown").localize();
- }
- }
- });
- }
-
- return sheet;
- }
-}
diff --git a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationPropertyForm.java b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationPropertyForm.java
deleted file mode 100644
index fc4739d8b..000000000
--- a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationPropertyForm.java
+++ /dev/null
@@ -1,132 +0,0 @@
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.FormProcessException;
-import com.arsdigita.cms.ui.authoring.BasicPageForm;
-import com.arsdigita.bebop.event.FormInitListener;
-import com.arsdigita.bebop.event.FormProcessListener;
-import com.arsdigita.bebop.event.FormSectionEvent;
-import com.arsdigita.bebop.event.FormSubmissionListener;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.GenericOrganization;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.parameters.NotNullValidationListener;
-import com.arsdigita.bebop.form.TextArea;
-import com.arsdigita.bebop.form.TextField;
-import com.arsdigita.bebop.FormData;
-import com.arsdigita.bebop.parameters.ParameterModel;
-import com.arsdigita.bebop.parameters.StringParameter;
-
-import com.arsdigita.cms.contenttypes.GenericOrganizationGlobalizationUtil;
-import org.apache.log4j.Logger;
-
-/**
- * Form for editing the basic properties of an organization.
- *
- * @author Jens Pelzetter
- */
-public class GenericOrganizationPropertyForm extends BasicPageForm implements FormProcessListener, FormInitListener, FormSubmissionListener {
-
- private static final Logger logger = Logger.getLogger(GenericOrganizationPropertyForm.class);
-
- private GenericOrganizationPropertiesStep m_step;
-
- /**
- * Organizationname.
- */
- public static final String ORGANIZATIONAME = GenericOrganization.ORGANIZATIONNAME;
- /**
- * Addedum
- */
- public static final String ORGANIZATIONNAMEADDENDUM = GenericOrganization.ORGANIZATIONNAMEADDENDUM;
- /**
- * Description
- */
- public static final String ORGANIZATIONDESCRIPTION = GenericOrganization.ORGANIZATIONDESCRIPTION;
-
- /**
- * ID of the form
- */
- public static final String ID = "GenericOrganization_edit";
-
- /**
- * Constrctor taking an ItemSelectionModel
- *
- * @param itemModel
- */
- public GenericOrganizationPropertyForm(ItemSelectionModel itemModel) {
- this(itemModel, null);
- }
-
- /**
- * Constrctor taking an ItemSelectionModel and an instance of GenericOrganizationPropertiesStep.
- *
- * @param itemModel
- * @param step
- */
- public GenericOrganizationPropertyForm(ItemSelectionModel itemModel, GenericOrganizationPropertiesStep step) {
- super(ID, itemModel);
- m_step = step;
- addSubmissionListener(this);
- }
-
- @Override
- public void addWidgets() {
- super.addWidgets();
-
- add(new Label(GenericOrganizationGlobalizationUtil.globalize("cms.contenttypes.ui.genericorganization.organizationname")));
- ParameterModel organizationNameParam = new StringParameter(ORGANIZATIONAME);
- TextField organizationName = new TextField(organizationNameParam);
- organizationName.addValidationListener(new NotNullValidationListener());
- add(organizationName);
-
- add(new Label(GenericOrganizationGlobalizationUtil.globalize("cms.contenttypes.ui.genericorganization.organizationnameaddendum")));
- TextField organizationNameAddendum = new TextField(ORGANIZATIONNAMEADDENDUM);
- add(organizationNameAddendum);
-
- add(new Label(GenericOrganizationGlobalizationUtil.globalize("cms.contenttypes.ui.genericorganzation.description")));
- TextArea description = new TextArea(ORGANIZATIONDESCRIPTION);
- description.setRows(5);
- description.setCols(30);
- add(description);
- }
-
- @Override
- public void init(FormSectionEvent e) throws FormProcessException {
- FormData data = e.getFormData();
- GenericOrganization orga = (GenericOrganization)super.initBasicWidgets(e);
-
- data.put(ORGANIZATIONAME, orga.getOrganizationName());
- data.put(ORGANIZATIONNAMEADDENDUM, orga.getOrganizationNameAddendum());
- data.put(ORGANIZATIONDESCRIPTION, orga.getDescription());
- }
-
- @Override
- public void process(FormSectionEvent e) throws FormProcessException {
- logger.error("proccessing...");
- FormData data = e.getFormData();
-
- GenericOrganization orga = (GenericOrganization)super.processBasicWidgets(e);
-
- if((orga != null)
- && (getSaveCancelSection().getSaveButton().isSelected(e.getPageState()))) {
- orga.setOrganizationName((String)data.get(ORGANIZATIONAME));
- orga.setOrganizationNameAddendum((String)data.get(ORGANIZATIONNAMEADDENDUM));
- orga.setDescription((String)data.get(ORGANIZATIONDESCRIPTION));
-
- logger.error("Saving new values of orga");
- orga.save();
- }
-
- if(m_step != null) {
- m_step.maybeForwardToNextStep(e.getPageState());
- }
- }
-
- public void submitted(FormSectionEvent e) throws FormProcessException {
- logger.error("submitted");
- if((m_step != null) &&
- (getSaveCancelSection().getCancelButton().isSelected(e.getPageState()))) {
- m_step.cancelStreamlinedCreation(e.getPageState());
- }
- }
-}
\ No newline at end of file
diff --git a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/Orga2OrgaUnitPropertiesStep.java b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/Orga2OrgaUnitPropertiesStep.java
deleted file mode 100644
index 70fca8ace..000000000
--- a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/Orga2OrgaUnitPropertiesStep.java
+++ /dev/null
@@ -1,102 +0,0 @@
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.Component;
-import com.arsdigita.bebop.Form;
-import com.arsdigita.bebop.FormSection;
-import com.arsdigita.bebop.Page;
-import com.arsdigita.bebop.SimpleContainer;
-import com.arsdigita.bebop.parameters.BigDecimalParameter;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
-import com.arsdigita.cms.ui.workflow.WorkflowLockedContainer;
-
-/**
- * PropertiesStep for adding organizational units to an organization.
- *
- * @author Jens Pelzetter
- */
-public class Orga2OrgaUnitPropertiesStep extends ResettableContainer {
-
- private AuthoringKitWizard m_parent;
- private ItemSelectionModel m_itemModel;
- private BigDecimalParameter m_o2ouParam = new BigDecimalParameter(("orga2orgaunit"));
- private Orga2OrgaUnitSelectionModel m_o2ouModel = new Orga2OrgaUnitSelectionModel(m_o2ouParam);
-
- /**
- * Creates a new instance of the PropertiesStep.
- *
- * @param itemModel ItemSelectionModel to use
- * @param parent Parent component.
- */
- public Orga2OrgaUnitPropertiesStep(ItemSelectionModel itemModel, AuthoringKitWizard parent) {
- this.m_itemModel = itemModel;
- this.m_parent = parent;
- setOrga2OrgaUnitSelectionModel();
- add(getDisplayComponent());
-
- Form form = new Form("orga2OrgaUnitEditForm");
- form.add(getEditSheet());
-
- WorkflowLockedContainer edit = new WorkflowLockedContainer(itemModel);
- edit.add(form);
- add(edit);
- }
-
- /**
- * Sets the custom SelectionModel to use.
- */
- protected void setOrga2OrgaUnitSelectionModel() {
- setOrga2OrgaUnitSelectionModel(new Orga2OrgaUnitSelectionModel(m_o2ouParam));
- }
-
- /**
- * Sets the custom SelectionModel to use.
- *
- * @param model The {@see Orga2OrgaUnitSelectionModel} instance to use.
- */
- protected void setOrga2OrgaUnitSelectionModel(Orga2OrgaUnitSelectionModel model) {
- this.m_o2ouModel = model;
- }
-
- /**
- * Gets the {@see Orga2OrgaUnitSelectionModel} used.
- * @return The Orga2OrgaUnitSelectionModel used.
- */
- protected Orga2OrgaUnitSelectionModel getOrga2OrgaUnitSelectionModel() {
- return this.m_o2ouModel;
- }
-
- /**
- *
- * @return
- */
- protected BigDecimalParameter getO2OUParam() {
- return this.m_o2ouParam;
- }
-
- /**
- * Returns the displaying component.
- *
- * @return The displying Component.
- */
- public Component getDisplayComponent() {
- SimpleContainer container = new SimpleContainer();
- container.add(new Orga2OrgaUnitTable(m_itemModel, m_o2ouModel));
- return container;
- }
-
- /**
- * Returns the edit sheet used.
- *
- * @return The edit sheet used.
- */
- public FormSection getEditSheet() {
- return new Orga2OrgaUnitPropertyForm(this.m_itemModel, this.m_o2ouModel);
- }
-
- @Override
- public void register(Page p) {
- super.register(p);
- p.addComponentStateParam(this, m_o2ouParam);
- }
-}
diff --git a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/Orga2OrgaUnitPropertyForm.java b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/Orga2OrgaUnitPropertyForm.java
deleted file mode 100644
index 6eb0cf104..000000000
--- a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/Orga2OrgaUnitPropertyForm.java
+++ /dev/null
@@ -1,220 +0,0 @@
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.ColumnPanel;
-import com.arsdigita.bebop.FormData;
-import com.arsdigita.bebop.FormProcessException;
-import com.arsdigita.bebop.FormSection;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.SaveCancelSection;
-import com.arsdigita.bebop.event.FormInitListener;
-import com.arsdigita.bebop.event.FormProcessListener;
-import com.arsdigita.bebop.event.FormSectionEvent;
-import com.arsdigita.bebop.event.FormSubmissionListener;
-import com.arsdigita.bebop.event.FormValidationListener;
-import com.arsdigita.bebop.event.PrintEvent;
-import com.arsdigita.bebop.event.PrintListener;
-import com.arsdigita.bebop.form.Submit;
-import com.arsdigita.cms.ContentType;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.GenericOrganization;
-import com.arsdigita.cms.contenttypes.GenericOrganizationGlobalizationUtil;
-import com.arsdigita.cms.contenttypes.Orga2OrgaUnit;
-import com.arsdigita.cms.contenttypes.OrganizationalUnit;
-import com.arsdigita.cms.ui.ItemSearchWidget;
-import com.arsdigita.util.Assert;
-import com.arsdigita.util.UncheckedWrapperException;
-import org.apache.log4j.Logger;
-
-/**
- * The form for adding, editing and removing associations between an organization
- * and an organizational unit.
- *
- * @author Jens Pelzetter
- */
-public class Orga2OrgaUnitPropertyForm extends FormSection implements FormInitListener, FormProcessListener, FormValidationListener, FormSubmissionListener {
-
- private final static Logger logger = Logger.getLogger(Orga2OrgaUnitPropertyForm.class);
- /**
- * ID String.
- */
- public final static String ID = "orga2orgaunit_edit";
- private ItemSelectionModel m_itemModel;
- private Orga2OrgaUnitSelectionModel m_o2ouModel;
- private ItemSearchWidget m_itemSearch;
- private SaveCancelSection m_saveCancelSection;
- private final String ITEM_SEARCH = "orga2OrgaUnit";
-
- /**
- * Creates the new form using the ItemSelectionModel and Orga2OrgaUnitSelectionModel proviveded.
- *
- * @param itemModel
- * @param o2ouModel
- */
- public Orga2OrgaUnitPropertyForm(ItemSelectionModel itemModel, Orga2OrgaUnitSelectionModel o2ouModel) {
- super(new ColumnPanel(2));
- this.m_itemModel = itemModel;
- this.m_o2ouModel = o2ouModel;
-
- addWidgets();
- addSaveCancelSection();
-
- addInitListener(this);
- addValidationListener(this);
- addProcessListener(this);
- addSubmissionListener(this);
- }
-
- /**
- * Creates the widgets for the form.
- */
- protected void addWidgets() {
- add(new Label(GenericOrganizationGlobalizationUtil.globalize("cms.contenttypes.ui.genericorganization.organizationalunit")));
- this.m_itemSearch = new ItemSearchWidget(ITEM_SEARCH, ContentType.findByAssociatedObjectType("com.arsdigita.cms.contenttypes.OrganizationalUnit"));
- add(this.m_itemSearch);
- }
-
- /**
- * Creates the section with the save and the cancel button.
- */
- public void addSaveCancelSection() {
- this.m_saveCancelSection = new SaveCancelSection();
- try {
- this.m_saveCancelSection.getCancelButton().addPrintListener(new PrintListener() {
-
- public void prepare(PrintEvent e) {
- Submit target = (Submit) e.getTarget();
- if (m_o2ouModel.isSelected(e.getPageState())) {
- target.setButtonLabel("Cancel");
- } else {
- target.setButtonLabel("Reset");
- }
- }
- });
-
- this.m_saveCancelSection.getSaveButton().addPrintListener(new PrintListener() {
-
- public void prepare(PrintEvent e) {
- Submit target = (Submit) e.getTarget();
- if (m_o2ouModel.isSelected(e.getPageState())) {
- target.setButtonLabel("Save");
- } else {
- target.setButtonLabel("Create");
- }
- }
- });
- } catch (Exception ex) {
- throw new UncheckedWrapperException("this cannot happen", ex);
- }
- add(m_saveCancelSection, ColumnPanel.FULL_WIDTH);
- }
-
- /**
- * Returns the SavaCancelSection of the form.
- *
- * @return The SavaCancelSection of the form.
- */
- public SaveCancelSection getSaveCancelSection() {
- return this.m_saveCancelSection;
- }
-
- /**
- * Returns the Orga2OrgaUnitSelectionModel used.
- *
- * @return The Orga2OrgaUnitSelectionModel used.
- */
- protected Orga2OrgaUnitSelectionModel getO2OUSelectionModel() {
- return this.m_o2ouModel;
- }
-
- /**
- * Returns the Organization of the assocication displayed by the form.
- *
- * @param s
- * @return The Organization of the assocication displayed by the form.
- */
- protected GenericOrganization getOrganization(PageState s) {
- return (GenericOrganization) m_itemModel.getSelectedItem(s);
- }
-
- /**
- * Creates a new Orga2OrgaUnit assoication form the values of the form.
- *
- * @param s
- * @return
- */
- protected Orga2OrgaUnit createOrga2OrgaUnit(PageState s) {
- GenericOrganization orga = this.getOrganization(s);
- Assert.exists(orga);
- Orga2OrgaUnit o2ou = new Orga2OrgaUnit();
- o2ou.setUnitOwner(orga);
- return o2ou;
- }
-
- /**
- * Sets the properties of an Orga2OrgaUnit instance.
- *
- * @param o2ou
- * @param e
- */
- protected void setOrga2OrgaUnitProperties(Orga2OrgaUnit o2ou, FormSectionEvent e) {
- PageState state = e.getPageState();
- FormData data = e.getFormData();
-
- o2ou.setTargetItem((OrganizationalUnit) data.get(ITEM_SEARCH));
-
- o2ou.save();
- }
-
- public void init(FormSectionEvent e) throws FormProcessException {
- FormData data = e.getFormData();
- PageState state = e.getPageState();
-
- setVisible(state, true);
-
- Orga2OrgaUnit o2ou;
- if (m_o2ouModel.isSelected(state)) {
- o2ou = m_o2ouModel.getSelectedO2OU(state);
- try {
- data.put(ITEM_SEARCH, o2ou.getTargetItem());
- } catch (IllegalStateException ex) {
- throw ex;
- }
- } else {
- data.put(ITEM_SEARCH, null);
- }
- }
-
- public void process(FormSectionEvent e) throws FormProcessException {
- PageState state = e.getPageState();
- Orga2OrgaUnit o2ou;
-
- if (this.getSaveCancelSection().getCancelButton().isSelected(state)) {
- this.m_o2ouModel.clearSelection(state);
- } else {
- if (this.m_o2ouModel.isSelected(state)) {
- o2ou = m_o2ouModel.getSelectedO2OU(state);
- } else {
- o2ou = createOrga2OrgaUnit(state);
- }
- setOrga2OrgaUnitProperties(o2ou, e);
- }
-
- m_o2ouModel.clearSelection(state);
- init(e);
- }
-
- public void validate(FormSectionEvent e) throws FormProcessException {
- if (e.getFormData().get(ITEM_SEARCH) == null) {
- throw new FormProcessException("OrganiztionalUnit selection is required");
- }
- }
-
- public void submitted(FormSectionEvent e) throws FormProcessException {
- if (this.m_saveCancelSection.getCancelButton().isSelected(e.getPageState())) {
- m_o2ouModel.clearSelection(e.getPageState());
- init(e);
- throw new FormProcessException("cancelled");
- }
- }
-}
\ No newline at end of file
diff --git a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/Orga2OrgaUnitSelectionModel.java b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/Orga2OrgaUnitSelectionModel.java
deleted file mode 100644
index 459a1b793..000000000
--- a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/Orga2OrgaUnitSelectionModel.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.parameters.BigDecimalParameter;
-import com.arsdigita.cms.contenttypes.Orga2OrgaUnit;
-import com.arsdigita.kernel.ui.ACSObjectSelectionModel;
-
-/**
- * The custom SelectionModel used by the {@see Orga2OrgaUnitPropertiesStep} and
- * {@see Orga2OrgaUnitPropertyForm}.
- *
- * @author Jens Pelzetter
- */
-public class Orga2OrgaUnitSelectionModel extends ACSObjectSelectionModel {
-
- /**
- * Creates an new instance.
- *
- * @param param The parameter to use.
- */
- public Orga2OrgaUnitSelectionModel(BigDecimalParameter param) {
- super(Orga2OrgaUnit.class.getName(), Orga2OrgaUnit.BASE_DATA_OBJECT_TYPE, param);
- }
-
- /**
- *
- * @param itemClass
- * @param objectType
- * @param param
- */
- public Orga2OrgaUnitSelectionModel(String itemClass, String objectType, BigDecimalParameter param) {
- super(itemClass, objectType, param);
- }
-
- /**
- *
- * @param s
- * @return
- */
- public Orga2OrgaUnit getSelectedO2OU(PageState s) {
- return (Orga2OrgaUnit) getSelectedObject(s);
- }
-}
diff --git a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/Orga2OrgaUnitTable.java b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/Orga2OrgaUnitTable.java
deleted file mode 100644
index edc209876..000000000
--- a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/Orga2OrgaUnitTable.java
+++ /dev/null
@@ -1,221 +0,0 @@
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.Component;
-import com.arsdigita.bebop.ControlLink;
-import com.arsdigita.bebop.ExternalLink;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.RequestLocal;
-import com.arsdigita.bebop.Table;
-import com.arsdigita.bebop.event.TableActionEvent;
-import com.arsdigita.bebop.event.TableActionListener;
-import com.arsdigita.bebop.table.TableCellRenderer;
-import com.arsdigita.bebop.table.TableColumn;
-import com.arsdigita.bebop.table.TableColumnModel;
-import com.arsdigita.cms.ContentItem;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.SecurityManager;
-import com.arsdigita.cms.contenttypes.GenericOrganizationGlobalizationUtil;
-import com.arsdigita.cms.contenttypes.Orga2OrgaUnit;
-import com.arsdigita.cms.dispatcher.Utilities;
-import com.arsdigita.domain.DataObjectNotFoundException;
-import com.arsdigita.domain.DomainObjectFactory;
-import com.arsdigita.persistence.OID;
-import com.arsdigita.util.Assert;
-import com.arsdigita.util.UncheckedWrapperException;
-import java.math.BigDecimal;
-import org.apache.log4j.Logger;
-
-/**
- * The table used by {@see Orga2OrgaUnitPropertyForm} for displying the existing
- * associations between an organization and an organizational unit.
- *
- * @author Jens Pelzetter
- */
-public class Orga2OrgaUnitTable extends Table {
-
- private final static Logger logger = Logger.getLogger(Orga2OrgaUnitTable.class);
- private Orga2OrgaUnitSelectionModel m_o2ouModel;
- private ItemSelectionModel m_itemModel;
- private TableColumn m_orgaUnitCol;
- private TableColumn m_moveUpCol;
- private TableColumn m_moveDownCol;
- private TableColumn m_editCol;
- private TableColumn m_delCol;
- private RequestLocal m_size;
- private RequestLocal m_editor;
- /**
- * ID String for the "edit" event.
- */
- protected final static String EDIT_EVENT = "Edit";
- /**
- * ID for the "delete" event.
- */
- protected final static String DELETE_EVENT = "Delete";
- /**
- * ID fpr the "up" event.
- */
- protected final static String UP_EVENT = "up";
- /**
- * ID for the "down" event.
- */
- protected final static String DOWN_EVENT = "down";
-
- /**
- * Creates an new table.
- *
- * @param itemModel
- * @param o2ouModel
- */
- public Orga2OrgaUnitTable(ItemSelectionModel itemModel, Orga2OrgaUnitSelectionModel o2ouModel) {
- super();
- this.m_itemModel = itemModel;
- this.m_o2ouModel = o2ouModel;
- addColumns();
-
- m_size = new RequestLocal();
- m_editor = new RequestLocal() {
-
- @Override
- public Object initialValue(PageState s) {
- SecurityManager sm = Utilities.getSecurityManager(s);
- ContentItem item = m_itemModel.getSelectedItem(s);
- Boolean val = new Boolean(sm.canAccess(s.getRequest(), SecurityManager.EDIT_ITEM, item));
- return val;
- }
- };
-
- Label empty = new Label(GenericOrganizationGlobalizationUtil.globalize("cms.contenttypes.ui.genericorganization.noorganizationalunitassociated"));
- setEmptyView(empty);
- addTableActionListener(new Orga2OrgaUnitTableActionListener());
- setRowSelectionModel(m_o2ouModel);
- setDefaultCellRenderer(new Orga2OrgaUnitTableRenderer());
- setModelBuilder(new Orga2OrgaUnitTableModelBuilder(itemModel));
- }
-
- /**
- * Adds the columns of the table.
- */
- public void addColumns() {
- TableColumnModel model = getColumnModel();
- int i = 0;
- this.m_orgaUnitCol = new TableColumn(i, GenericOrganizationGlobalizationUtil.globalize("cms.contenttypes.ui.genericorganization.organizationalunit").localize());
- this.m_editCol = new TableColumn(++i, GenericOrganizationGlobalizationUtil.globalize("cms.contenttypes.ui.genericorganization.edit").localize());
- this.m_delCol = new TableColumn(++i, GenericOrganizationGlobalizationUtil.globalize("cms.contenttypes.ui.genericorganization.delete").localize());
- this.m_moveUpCol = new TableColumn(++i, "");
- this.m_moveDownCol = new TableColumn(++i, "");
-
- model.add(this.m_orgaUnitCol);
- model.add(this.m_editCol);
- model.add(this.m_delCol);
- model.add(this.m_moveUpCol);
- model.add(this.m_moveDownCol);
- setColumnModel(model);
- }
-
- private class Orga2OrgaUnitTableRenderer implements TableCellRenderer {
-
- public Component getComponent(Table table, PageState state, Object value, boolean isSelected, Object key, int row, int column) {
- Orga2OrgaUnit o2ou = (Orga2OrgaUnit) value;
- boolean isFirst = (row == 0);
- if (m_size.get(state) == null) {
- m_size.set(state, new Long(((Orga2OrgaUnitTableModelBuilder.Orga2OrgaUnitTableModel) table.getTableModel(state)).size()));
- }
- boolean isLast = (row == ((Long) m_size.get(state)).intValue() - 1);
-
- String url = o2ou.getURI(state);
- if (column == m_orgaUnitCol.getModelIndex()) {
- ExternalLink extLink = new ExternalLink(o2ou.getTargetItem().getOrganizationalUnitName(), url);
- return extLink;
- } else if (column == m_editCol.getModelIndex()) {
- if (Boolean.TRUE.equals(m_editor.get(state))) {
- if (isSelected) {
- return new Label(EDIT_EVENT, Label.BOLD);
- } else {
- return new ControlLink(EDIT_EVENT);
- }
- } else {
- return new Label(EDIT_EVENT);
- }
- } else if (column == m_delCol.getModelIndex()) {
- if (Boolean.TRUE.equals(m_editor.get(state))) {
- return new ControlLink(DELETE_EVENT);
- } else {
- return new Label(DELETE_EVENT);
- }
- } else if (column == m_moveUpCol.getModelIndex()) {
- if (Boolean.TRUE.equals(m_editor.get(state)) && !isFirst) {
- Label downLabel = new Label(UP_EVENT);
- downLabel.setClassAttr("linkSort");
- return new ControlLink(downLabel);
- } else {
- return new Label("");
- }
- } else if (column == m_moveDownCol.getModelIndex()) {
- if (Boolean.TRUE.equals(m_editor.get(state)) && !isLast) {
- Label downLabel = new Label(DOWN_EVENT);
- downLabel.setClassAttr("linkSort");
- return new ControlLink(downLabel);
- } else {
- return new Label("");
- }
- } else {
- throw new UncheckedWrapperException("column out of bounds");
- }
- }
- }
-
- private class Orga2OrgaUnitTableActionListener implements TableActionListener {
-
- private Orga2OrgaUnit getOrga2OrgaUnit(TableActionEvent e) {
- Object o = e.getRowKey();
- BigDecimal id;
- if (o instanceof String) {
- id = new BigDecimal((String) o);
- } else {
- id = (BigDecimal) e.getRowKey();
- }
-
- Assert.exists(id);
- Orga2OrgaUnit o2ou;
- try {
- o2ou = (Orga2OrgaUnit) DomainObjectFactory.newInstance(new OID(Orga2OrgaUnit.BASE_DATA_OBJECT_TYPE, id));
- } catch (DataObjectNotFoundException ex) {
- throw new UncheckedWrapperException(ex);
- }
- return o2ou;
- }
-
- public void cellSelected(TableActionEvent e) {
- int col = e.getColumn().intValue();
- PageState state = e.getPageState();
- Orga2OrgaUnit o2ou = getOrga2OrgaUnit(e);
- Assert.exists(o2ou);
-
- if (col == m_editCol.getModelIndex()) {
- if (Boolean.TRUE.equals(m_editor.get(state))) {
- m_o2ouModel.setSelectedObject(state, o2ou);
- }
- } else if (col == m_delCol.getModelIndex()) {
- if (Boolean.TRUE.equals(m_editor.get(state))) {
- try {
- m_o2ouModel.clearSelection(state);
- o2ou.delete();
- } catch (Exception ex) {
- throw new UncheckedWrapperException(ex);
- }
- }
- } else if (col == m_moveUpCol.getModelIndex()) {
- m_o2ouModel.clearSelection(state);
- o2ou.swapWithPrevious();
- } else if (col == m_moveDownCol.getModelIndex()) {
- m_o2ouModel.clearSelection(state);
- o2ou.swapWithNext();
- }
-
- }
-
- public void headSelected(TableActionEvent e) {
- }
- }
-}
\ No newline at end of file
diff --git a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/Orga2OrgaUnitTableModelBuilder.java b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/Orga2OrgaUnitTableModelBuilder.java
deleted file mode 100644
index c241aee4b..000000000
--- a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/Orga2OrgaUnitTableModelBuilder.java
+++ /dev/null
@@ -1,107 +0,0 @@
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.Table;
-import com.arsdigita.bebop.table.TableModel;
-import com.arsdigita.bebop.table.TableModelBuilder;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.GenericOrganization;
-import com.arsdigita.cms.contenttypes.Orga2OrgaUnit;
-import com.arsdigita.domain.DomainObjectFactory;
-import com.arsdigita.persistence.DataCollection;
-import com.arsdigita.persistence.DataObject;
-import com.arsdigita.util.Assert;
-import com.arsdigita.util.LockableImpl;
-import org.apache.log4j.Logger;
-
-/**
- * ModelBuilder for the TableModel of the {@see Orga2OrgaUnitTable}.
- *
- * @author Jens Pelzetter
- */
-public class Orga2OrgaUnitTableModelBuilder extends LockableImpl implements TableModelBuilder {
-
- private final static Logger logger = Logger.getLogger(Orga2OrgaUnitTableModelBuilder.class);
- private ItemSelectionModel m_itemModel;
-
- /**
- * Creates an new TableModelBuilder.
- *
- * @param itemModel
- */
- public Orga2OrgaUnitTableModelBuilder(ItemSelectionModel itemModel) {
- this.m_itemModel = itemModel;
- }
-
- public TableModel makeModel(Table t, PageState s) {
- DataCollection units = getUnits(s);
-
- if (units.isEmpty()) {
- return Table.EMPTY_MODEL;
- } else {
- return new Orga2OrgaUnitTableModel(units);
- }
- }
-
- /**
- * Gets all organizational units associated with the selected organization.
- *
- * @param s
- * @return All organizational units associated with the selected organization.
- */
- public DataCollection getUnits(PageState s) {
- Assert.isTrue(this.m_itemModel.isSelected(s), "item selected");
- GenericOrganization orga = (GenericOrganization) this.m_itemModel.getSelectedItem(s);
- return Orga2OrgaUnit.getUnits(orga);
- }
-
- /**
- * The table model for the the {@see Orga2OrgaUnitTable}.
- */
- public static class Orga2OrgaUnitTableModel implements TableModel {
-
- Orga2OrgaUnit m_o2ou;
- DataCollection m_units;
-
- /**
- * Creates a new TableModel
- *
- * @param units The associations between an organization and some organizational units to display.
- */
- public Orga2OrgaUnitTableModel(DataCollection units) {
- m_units = units;
- m_o2ou = null;
- }
-
- public int getColumnCount() {
- return (int) m_units.size();
- }
-
- public boolean nextRow() {
- if (m_units.next()) {
- DataObject obj = m_units.getDataObject();
- m_o2ou = (Orga2OrgaUnit) DomainObjectFactory.newInstance(obj);
- return true;
- } else {
- return false;
- }
- }
-
- public Object getElementAt(int columnIndex) {
- return m_o2ou;
- }
-
- public Object getKeyAt(int columnIndex) {
- return m_o2ou.getID();
- }
-
- /**
- * Returns the number of associations displayed.
- *
- * @return The number of associations displayed.
- */
- public long size() {
- return m_units.size();
- }
- }
-}
\ No newline at end of file
diff --git a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/OrganizationRolePropertiesStep.java b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/OrganizationRolePropertiesStep.java
deleted file mode 100644
index ce96bfc78..000000000
--- a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/OrganizationRolePropertiesStep.java
+++ /dev/null
@@ -1,102 +0,0 @@
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.Component;
-import com.arsdigita.bebop.Form;
-import com.arsdigita.bebop.FormSection;
-import com.arsdigita.bebop.Page;
-import com.arsdigita.bebop.SimpleContainer;
-import com.arsdigita.bebop.parameters.BigDecimalParameter;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
-import com.arsdigita.cms.ui.workflow.WorkflowLockedContainer;
-
-/**
- * Authoring step for adding roles (e.g. chairmen) to an organization.
- *
- * @author Jens Pelzetter
- */
-public class OrganizationRolePropertiesStep extends ResettableContainer {
-
- private AuthoringKitWizard m_parent;
-
- private ItemSelectionModel m_itemModel;
- private BigDecimalParameter m_roleParam = new BigDecimalParameter("organizationrole");
- private OrganizationRoleSelectionModel m_roleModel = new OrganizationRoleSelectionModel(m_roleParam);
-
- /**
- * Constructor for creating an new instance of this authoring step.
- *
- * @param itemModel
- * @param parent
- */
- public OrganizationRolePropertiesStep(ItemSelectionModel itemModel, AuthoringKitWizard parent) {
- this.m_itemModel = itemModel;
- this.m_parent = parent;
- setOrganizationRoleSelectionModel();
- add(getDisplayComponent());
-
- Form form = new Form("organizationRoleEditForm");
- form.add(getEditSheet());
-
- WorkflowLockedContainer edit = new WorkflowLockedContainer(itemModel);
- edit.add(form);
- add(edit);
- }
-
- /**
- * Creates an new instance of OrganizationRoleSelectionModel and calls
- * setOrganizationRole(OrganizationRoleSelectionModel model) with the new
- * instance.
- */
- protected void setOrganizationRoleSelectionModel() {
- setOrganizationRoleSelectionModel(new OrganizationRoleSelectionModel(m_roleParam));
- }
-
- /**
- * Sets the OrganizationRoleSelectionModel.
- *
- * @param model
- */
- protected void setOrganizationRoleSelectionModel(OrganizationRoleSelectionModel model) {
- m_roleModel = model;
- }
-
- /**
- * @return The OrganizationRoleSelectionModel instance of this authoring step.
- */
- protected OrganizationRoleSelectionModel getOrganizationRoleSelectionModel() {
- return m_roleModel;
- }
-
- /**
- *
- * @return The value of the m_roleParam property.
- */
- protected BigDecimalParameter getRoleParam() {
- return this.m_roleParam;
- }
-
- /**
- *
- * @return The component displaying the authoring step
- */
- public Component getDisplayComponent() {
- SimpleContainer container = new SimpleContainer();
- container.add(new OrganizationRoleTable(m_itemModel, m_roleModel));
- return container;
- }
-
- /**
- *
- * @return The form for editing the roles of the organization
- */
- protected FormSection getEditSheet() {
- return new OrganizationRolePropertyForm(this.m_itemModel, this.m_roleModel);
- }
-
- @Override
- public void register(Page p) {
- super.register(p);
- p.addComponentStateParam(this, m_roleParam);
- }
-}
diff --git a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/OrganizationRolePropertyForm.java b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/OrganizationRolePropertyForm.java
deleted file mode 100644
index 8c85b40af..000000000
--- a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/OrganizationRolePropertyForm.java
+++ /dev/null
@@ -1,244 +0,0 @@
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.ColumnPanel;
-import com.arsdigita.bebop.FormData;
-import com.arsdigita.bebop.FormProcessException;
-import com.arsdigita.bebop.FormSection;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.SaveCancelSection;
-import com.arsdigita.bebop.event.FormInitListener;
-import com.arsdigita.bebop.event.FormProcessListener;
-import com.arsdigita.bebop.event.FormSectionEvent;
-import com.arsdigita.bebop.event.FormSubmissionListener;
-import com.arsdigita.bebop.event.FormValidationListener;
-import com.arsdigita.bebop.event.PrintEvent;
-import com.arsdigita.bebop.event.PrintListener;
-import com.arsdigita.bebop.form.Submit;
-import com.arsdigita.bebop.form.TextField;
-import com.arsdigita.bebop.parameters.NotNullValidationListener;
-import com.arsdigita.cms.ContentType;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.GenericOrganization;
-import com.arsdigita.cms.contenttypes.GenericOrganizationGlobalizationUtil;
-import com.arsdigita.cms.contenttypes.OrganizationRole;
-import com.arsdigita.cms.ui.ItemSearchWidget;
-import com.arsdigita.util.Assert;
-import com.arsdigita.util.UncheckedWrapperException;
-import org.apache.log4j.Logger;
-
-/**
- * Form for editing a role.
- *
- * @author Jens Pelzetter
- */
-public class OrganizationRolePropertyForm extends FormSection implements FormInitListener, FormProcessListener, FormValidationListener, FormSubmissionListener {
-
- /**
- * Logger for this class.
- */
- public final static Logger logger = Logger.getLogger(OrganizationRolePropertyForm.class);
- /**
- * ID of the form
- */
- public final static String ID = "organizationrole_edit";
- //public final static String SSL_PROTOCOL = "https://";
- //public final static String HTTP_PROTOCOL = "http://";
- private ItemSelectionModel m_itemModel;
- private OrganizationRoleSelectionModel m_roleModel;
- private TextField m_rolename;
- private ItemSearchWidget m_itemSearch;
- private SaveCancelSection m_saveCancelSection;
- private final String ITEM_SEARCH = "organizationRole";
-
- /**
- * Creates an new instance of the form.
- *
- * @param itemModel
- * @param roleModel
- */
- public OrganizationRolePropertyForm(ItemSelectionModel itemModel, OrganizationRoleSelectionModel roleModel) {
- super(new ColumnPanel(2));
- this.m_itemModel = itemModel;
- this.m_roleModel = roleModel;
-
- addWidgets();
- addSaveCancelSection();
-
- addInitListener(this);
- addValidationListener(this);
- addProcessListener(this);
- addSubmissionListener(this);
- }
-
- /**
- * Adds the widgets to the form. For choosing the associated person,
- * an ItemSearchWidget is used.
- */
- protected void addWidgets() {
- this.m_rolename = new TextField("rolename");
- this.m_rolename.addValidationListener(new NotNullValidationListener());
- add(new Label(GenericOrganizationGlobalizationUtil.globalize("cms.contenttypes.ui.genericorganization.rolename")));
- add(this.m_rolename);
-
- add(new Label(GenericOrganizationGlobalizationUtil.globalize("cms.contenttypes.ui.genericorganization.person")));
- /* Create the ItemSearchWidget. The ContentType.findByAssociatedObjecType
- * gets the ContentType of com.arsdigita.cms.contenttypes.GenericPerson and passes
- * it to the constructor of the ItemSearchWidget. The ItemSearchWidget will only
- * display object of type GenericPerson or derivated types.
- */
- this.m_itemSearch = new ItemSearchWidget(ITEM_SEARCH, ContentType.findByAssociatedObjectType("com.arsdigita.cms.contenttypes.GenericPerson"));
- add(this.m_itemSearch);
- }
-
- /**
- * Adds the Save and Cancel buttons.
- */
- public void addSaveCancelSection() {
- this.m_saveCancelSection = new SaveCancelSection();
- try {
- this.m_saveCancelSection.getCancelButton().addPrintListener(new PrintListener() {
-
- public void prepare(PrintEvent e) {
- Submit target = (Submit) e.getTarget();
- if (m_roleModel.isSelected(e.getPageState())) {
- target.setButtonLabel("Cancel");
- } else {
- target.setButtonLabel("Reset");
- }
- }
- });
-
- this.m_saveCancelSection.getSaveButton().addPrintListener(new PrintListener() {
-
- public void prepare(PrintEvent e) {
- Submit target = (Submit) e.getTarget();
- if (m_roleModel.isSelected(e.getPageState())) {
- target.setButtonLabel("Save");
- } else {
- target.setButtonLabel("Create");
- }
- }
- });
- } catch (Exception ex) {
- throw new UncheckedWrapperException("this cannot happen", ex);
- }
- add(m_saveCancelSection, ColumnPanel.FULL_WIDTH);
- }
-
- /**
- *
- * @return The section with the Save and Cancel buttons.
- */
- public SaveCancelSection getSaveCancelSection() {
- return this.m_saveCancelSection;
- }
-
- /**
- *
- * @return The RoleSelectionModel of the form.
- */
- protected OrganizationRoleSelectionModel getRoleSelectionModel() {
- return this.m_roleModel;
- }
-
- /*protected GenericPerson getPerson(PageState s) {
- return (GenericPerson) m_itemModel.getSelectedObject(s);
- }*/
- /**
- *
- * @param s
- * @return * The organization which roles are edited.
- */
- protected GenericOrganization getOrganization(PageState s) {
- return (GenericOrganization) m_itemModel.getSelectedObject(s);
- }
-
- /**
- * Creates a new OrganizationRole.
- *
- * @param s
- * @return Newly created OrganizationRole.
- */
- protected OrganizationRole createOrganizationRole(PageState s) {
- //GenericPerson person = this.getPerson(s);
- //Assert.exists(person);
- GenericOrganization orga = this.getOrganization(s);
- Assert.exists(orga);
- OrganizationRole role = new OrganizationRole();
- role.setRoleOwner(orga);
- return role;
- }
-
- /**
- * Sets the properties of an instance of OrganizationRole.
- *
- * @param role
- * @param e
- */
- protected void setOrganizationRoleProperties(OrganizationRole role, FormSectionEvent e) {
- PageState state = e.getPageState();
- FormData data = e.getFormData();
-
- role.setRolename((String) m_rolename.getValue(state));
- role.setTargetItem((com.arsdigita.cms.contenttypes.GenericPerson) data.get(ITEM_SEARCH));
-
- role.save();
- }
-
- public void init(FormSectionEvent e) throws FormProcessException {
- FormData data = e.getFormData();
- PageState state = e.getPageState();
-
- setVisible(state, true);
-
- OrganizationRole role;
- if (m_roleModel.isSelected(state)) {
- role = m_roleModel.getSelectedRole(state);
- try {
- m_rolename.setValue(state, role.getRolename());
- data.put(ITEM_SEARCH, role.getTargetItem());
- } catch (IllegalStateException ex) {
- logger.error(ex.getMessage());
- throw ex;
- }
- } else {
- m_rolename.setValue(state, null);
- data.put(ITEM_SEARCH, null);
- }
- }
-
- public void process(FormSectionEvent e) throws FormProcessException {
- PageState state = e.getPageState();
- OrganizationRole role;
-
- if (this.getSaveCancelSection().getCancelButton().isSelected(state)) {
- m_roleModel.clearSelection(state);
- } else {
- if (m_roleModel.isSelected(state)) {
- role = m_roleModel.getSelectedRole(state);
- } else {
- role = createOrganizationRole(state);
- }
- setOrganizationRoleProperties(role, e);
- }
-
- m_roleModel.clearSelection(state);
- init(e);
- }
-
- public void validate(FormSectionEvent e) throws FormProcessException {
- if (e.getFormData().get(ITEM_SEARCH) == null) {
- throw new FormProcessException("Person selection is required.");
- }
- }
-
- public void submitted(FormSectionEvent e) throws FormProcessException {
- if (this.m_saveCancelSection.getCancelButton().isSelected(e.getPageState())) {
- logger.debug("Cancel in submission listener");
- m_roleModel.clearSelection(e.getPageState());
- init(e);
- throw new FormProcessException("cancelled");
- }
- }
-}
\ No newline at end of file
diff --git a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/OrganizationRoleSelectionModel.java b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/OrganizationRoleSelectionModel.java
deleted file mode 100644
index dc7a44984..000000000
--- a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/OrganizationRoleSelectionModel.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.parameters.BigDecimalParameter;
-import com.arsdigita.kernel.ui.ACSObjectSelectionModel;
-import com.arsdigita.cms.contenttypes.OrganizationRole;
-
-/**
- * SelectionModel for OrganizationRole.
- *
- * @author Jens Pelzetter
- */
-public class OrganizationRoleSelectionModel extends ACSObjectSelectionModel {
-
- /**
- * Constructor taking a parameter.
- *
- * @param param
- */
- public OrganizationRoleSelectionModel(BigDecimalParameter param) {
- super(OrganizationRole.class.getName(), OrganizationRole.BASE_DATA_OBJECT_TYPE, param);
- }
-
- /**
- * Constructor taking an itemClass, an objectType and a parameter.
- *
- * @param itemClass
- * @param objectType
- * @param parameter
- */
- public OrganizationRoleSelectionModel(String itemClass, String objectType, BigDecimalParameter parameter) {
- super(itemClass, objectType, parameter);
- }
-
- /**
- *
- * @param state
- * @return The selected role.
- */
- public OrganizationRole getSelectedRole(PageState state) {
- return (OrganizationRole) getSelectedObject(state);
- }
-}
\ No newline at end of file
diff --git a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/OrganizationRoleTable.java b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/OrganizationRoleTable.java
deleted file mode 100644
index 1c6c98b1f..000000000
--- a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/OrganizationRoleTable.java
+++ /dev/null
@@ -1,233 +0,0 @@
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.Component;
-import com.arsdigita.bebop.ControlLink;
-import com.arsdigita.bebop.ExternalLink;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.RequestLocal;
-import com.arsdigita.bebop.Table;
-import com.arsdigita.bebop.event.TableActionEvent;
-import com.arsdigita.bebop.event.TableActionListener;
-import com.arsdigita.bebop.table.TableCellRenderer;
-import com.arsdigita.bebop.table.TableColumn;
-import com.arsdigita.bebop.table.TableColumnModel;
-import com.arsdigita.cms.ContentItem;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.SecurityManager;
-import com.arsdigita.cms.contenttypes.GenericOrganizationGlobalizationUtil;
-import com.arsdigita.cms.contenttypes.OrganizationRole;
-import com.arsdigita.cms.dispatcher.Utilities;
-import com.arsdigita.domain.DataObjectNotFoundException;
-import com.arsdigita.domain.DomainObjectFactory;
-import com.arsdigita.persistence.OID;
-import com.arsdigita.util.Assert;
-import com.arsdigita.util.UncheckedWrapperException;
-import java.math.BigDecimal;
-import org.apache.log4j.Logger;
-
-/**
- * Table for displaying the existings roles associated with an organization.
- *
- * @author Jens Pelzetter
- */
-public class OrganizationRoleTable extends Table {
-
- private final static Logger logger = Logger.getLogger(OrganizationRoleTable.class);
- private OrganizationRoleSelectionModel m_roleModel;
- private ItemSelectionModel m_itemModel;
- private TableColumn m_roleNameCol;
- private TableColumn m_personCol;
- private TableColumn m_moveUpCol;
- private TableColumn m_moveDownCol;
- private TableColumn m_editCol;
- private TableColumn m_delCol;
- private RequestLocal m_size;
- private RequestLocal m_editor;
- /**
- * Identifier for an Edit event.
- */
- protected final static String EDIT_EVENT = "Edit";
- /**
- * ID for an Delete event.
- */
- protected final static String DELETE_EVENT = "Delete";
- /**
- * ID for an Up event.
- */
- protected final static String UP_EVENT = "up";
- /**
- * ID for an down event.
- */
- protected final static String DOWN_EVENT = "down";
-
- /**
- * Constructor. Creates a new table a sets the column headers.
- *
- * @param itemModel
- * @param roleModel
- */
- public OrganizationRoleTable(ItemSelectionModel itemModel, OrganizationRoleSelectionModel roleModel) {
- super();
- this.m_itemModel = itemModel;
- this.m_roleModel = roleModel;
- addColumns();
-
- m_size = new RequestLocal();
- m_editor = new RequestLocal() {
-
- @Override
- public Object initialValue(PageState state) {
- SecurityManager sm = Utilities.getSecurityManager(state);
- ContentItem item = m_itemModel.getSelectedItem(state);
- Boolean val = new Boolean(sm.canAccess(state.getRequest(), SecurityManager.EDIT_ITEM, item));
- return val;
- }
- };
-
- Label empty = new Label(GenericOrganizationGlobalizationUtil.globalize("cms.contenttypes.ui.genericorganization.noRolesForThisOrga"));
- setEmptyView(empty);
- addTableActionListener(new OrganizationRoleTableActionListener());
- setRowSelectionModel(m_roleModel);
- setDefaultCellRenderer(new OrganizationRoleTableRenderer());
- setModelBuilder(new OrganizationRoleTableModelBuilder(itemModel));
- }
-
- /**
- * Called by the constructor to add the columns of the table.
- */
- protected void addColumns() {
- TableColumnModel model = getColumnModel();
- int i = 0;
- this.m_roleNameCol = new TableColumn(i, GenericOrganizationGlobalizationUtil.globalize("cms.contenttypes.ui.genericorganization.role").localize());
- this.m_personCol = new TableColumn(++i, GenericOrganizationGlobalizationUtil.globalize("cms.contenttypes.ui.genericorganization.person").localize());
- this.m_editCol = new TableColumn(++i, GenericOrganizationGlobalizationUtil.globalize("cms.contenttypes.ui.genericorganization.edit").localize());
- this.m_delCol = new TableColumn(++i, GenericOrganizationGlobalizationUtil.globalize("cms.contenttypes.ui.genericorganization.delete").localize());
- this.m_moveUpCol = new TableColumn(++i, "");
- this.m_moveDownCol = new TableColumn(++i, "");
-
- model.add(this.m_roleNameCol);
- model.add(this.m_personCol);
- model.add(this.m_editCol);
- model.add(this.m_delCol);
- model.add(this.m_moveUpCol);
- model.add(this.m_moveDownCol);
- setColumnModel(model);
- }
-
- private class OrganizationRoleTableRenderer implements TableCellRenderer {
-
- public Component getComponent(Table table, PageState state, Object value, boolean isSelected, Object key, int row, int column) {
- OrganizationRole role = (OrganizationRole) value;
- boolean isFirst = (row == 0);
- if (m_size.get(state) == null) {
- m_size.set(state, new Long(((OrganizationRoleTableModelBuilder.OrganizationRoleTableModel) table.getTableModel(state)).size()));
- }
- boolean isLast = (row == ((Long) m_size.get(state)).intValue() - 1);
-
- String url = role.getURI(state);
- if (column == m_roleNameCol.getModelIndex()) {
- ExternalLink extLink = new ExternalLink(role.getRolename(), url);
- return extLink;
- } else if (column == m_personCol.getModelIndex()) {
- ExternalLink extLink = new ExternalLink(role.getTargetItem().getTitle(), url);
- return extLink;
- } else if (column == m_editCol.getModelIndex()) {
- if (Boolean.TRUE.equals(m_editor.get(state))) {
- if (isSelected) {
- return new Label(EDIT_EVENT, Label.BOLD);
- } else {
- return new ControlLink(EDIT_EVENT);
- }
- } else {
- return new Label(EDIT_EVENT);
- }
- } else if (column == m_delCol.getModelIndex()) {
- if (Boolean.TRUE.equals(m_editor.get(state))) {
- return new ControlLink(DELETE_EVENT);
- } else {
- return new Label(DELETE_EVENT);
- }
- } else if (column == m_moveUpCol.getModelIndex()) {
- if (Boolean.TRUE.equals(m_editor.get(state)) && !isFirst) {
- Label downLabel = new Label(UP_EVENT);
- downLabel.setClassAttr("linkSort");
- return new ControlLink(downLabel);
- } else {
- return new Label("");
- }
- } else if (column == m_moveDownCol.getModelIndex()) {
- if (Boolean.TRUE.equals(m_editor.get(state)) && !isLast) {
- Label downLabel = new Label(DOWN_EVENT);
- downLabel.setClassAttr("linkSort");
- return new ControlLink(downLabel);
- } else {
- return new Label("");
- }
- } else {
- throw new UncheckedWrapperException("column out of bounds");
- }
- }
- }
-
- private class OrganizationRoleTableActionListener implements TableActionListener {
-
- private OrganizationRole getOrganizationRole(TableActionEvent e) {
- Object o = e.getRowKey();
- BigDecimal id;
- if(o instanceof String) {
- logger.debug("row key is a string: " + o);
- id = new BigDecimal((String)o);
- } else {
- id = (BigDecimal)e.getRowKey();
- }
-
- Assert.exists(id);
- OrganizationRole role;
- try {
- role = (OrganizationRole)DomainObjectFactory.newInstance(new OID(OrganizationRole.BASE_DATA_OBJECT_TYPE, id));
- } catch(DataObjectNotFoundException ex) {
- throw new UncheckedWrapperException(ex);
- }
- return role;
- }
-
- public void cellSelected(TableActionEvent e) {
- int col = e.getColumn().intValue();
- PageState state = e.getPageState();
- OrganizationRole role = getOrganizationRole(e);
- Assert.exists(role);
-
- /*if (col == m_roleNameCol.getModelIndex()) {
- //Nothing to do...
- } else*/
- if (col == m_editCol.getModelIndex()) {
- if(Boolean.TRUE.equals(m_editor.get(state))) {
- logger.debug("setting organizationRoleModel to: " + role.getRolename());
- m_roleModel.setSelectedObject(state, role);
- }
- } else if(col == m_delCol.getModelIndex()) {
- if(Boolean.TRUE.equals(m_editor.get(state))) {
- try {
- logger.debug("About to delete");
- m_roleModel.clearSelection(state);
- role.delete();
- } catch(Exception ex) {
- throw new UncheckedWrapperException(ex);
- }
- }
- } else if(col == m_moveUpCol.getModelIndex()) {
- m_roleModel.clearSelection(state);
- role.swapWithPrevious();
- } else if(col == m_moveDownCol.getModelIndex()) {
- m_roleModel.clearSelection(state);
- role.swapWithNext();
- }
- }
-
- public void headSelected(TableActionEvent e) {
- //Nothing
- }
-
- }
-}
diff --git a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/OrganizationRoleTableModelBuilder.java b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/OrganizationRoleTableModelBuilder.java
deleted file mode 100644
index f678bdea9..000000000
--- a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/OrganizationRoleTableModelBuilder.java
+++ /dev/null
@@ -1,107 +0,0 @@
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.Table;
-import com.arsdigita.bebop.table.TableModel;
-import com.arsdigita.bebop.table.TableModelBuilder;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.GenericOrganization;
-import com.arsdigita.cms.contenttypes.OrganizationRole;
-import com.arsdigita.domain.DomainObjectFactory;
-import com.arsdigita.persistence.DataCollection;
-import com.arsdigita.persistence.DataObject;
-import com.arsdigita.util.Assert;
-import com.arsdigita.util.LockableImpl;
-import org.apache.log4j.Logger;
-
-/**
- * TableModelBuilder for the OrganizationRoleTable.
- *
- * @author Jens Pelzetter
- */
-public class OrganizationRoleTableModelBuilder extends LockableImpl implements TableModelBuilder {
-
- private static final Logger logger = Logger.getLogger(OrganizationRoleTableModelBuilder.class);
-
- private ItemSelectionModel m_itemModel;
-
- /**
- * Constructor to create a new instance. Needs an ItemSelectionModel instance.
- *
- * @param itemModel
- */
- public OrganizationRoleTableModelBuilder(ItemSelectionModel itemModel) {
- this.m_itemModel = itemModel;
- }
-
- public TableModel makeModel(Table t, PageState s) {
- logger.debug("OrganizationRoleTableModelBuilder.makemodel()");
-
- DataCollection roles = getRoles(s);
-
- if(roles.isEmpty()) {
- return Table.EMPTY_MODEL;
- } else {
- return new OrganizationRoleTableModel(roles);
- }
- }
-
- /**
- *
- * @param s
- * @return
- */
- public DataCollection getRoles(PageState s) {
- Assert.isTrue(this.m_itemModel.isSelected(s), "item selected");
- GenericOrganization orga = (GenericOrganization) m_itemModel.getSelectedItem(s);
- return OrganizationRole.getRoles(orga);
- }
-
- /**
- * TableModel for the OrganizationRoleTable.
- */
- public static class OrganizationRoleTableModel implements TableModel {
-
- OrganizationRole m_role;
- DataCollection m_roles;
-
- /**
- *
- * @param roles
- */
- public OrganizationRoleTableModel(DataCollection roles) {
- m_roles = roles;
- m_role = null;
- }
-
- public int getColumnCount() {
- return (int)m_roles.size();
- }
-
- public boolean nextRow() {
- if (m_roles.next()) {
- DataObject obj = m_roles.getDataObject();
- m_role = (OrganizationRole)DomainObjectFactory.newInstance(obj);
- return true;
- } else {
- return false;
- }
- }
-
- public Object getElementAt(int columnIndex) {
- return m_role;
- }
-
- public Object getKeyAt(int columnIndex) {
- return m_role.getID();
- }
-
- /**
- *
- * @return Number of roles in the table.
- */
- public long size() {
- return m_roles.size();
- }
- }
-}
diff --git a/ccm-cms-types-genericorganization/web/static/content-types/com/arsdigita/cms/contenttypes/GenericOrganization.xsl b/ccm-cms-types-genericorganization/web/static/content-types/com/arsdigita/cms/contenttypes/GenericOrganization.xsl
deleted file mode 100644
index 77c764c26..000000000
--- a/ccm-cms-types-genericorganization/web/static/content-types/com/arsdigita/cms/contenttypes/GenericOrganization.xsl
+++ /dev/null
@@ -1,118 +0,0 @@
-
-]>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
- -
-
-
- /redirect?oid=
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
- -
-
-
- /redirect?oid=
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file