GenericOrganization:

- Zusätzlich Spalte in der Tabelle der Rollen für die verlinkte Person
- Up- und Down-Links in der Tabelle funktionieren jetzt, die Rollen lassen sich darüber ordnen

OrganizationalUnit:
- Setup für OrganizationalUnit, erste Klassen. UI fehlt noch.




git-svn-id: https://svn.libreccm.org/ccm/trunk@195 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2009-06-15 13:41:32 +00:00
parent c2e48682b3
commit c99939ff5e
13 changed files with 316 additions and 22 deletions

View File

@ -47,20 +47,22 @@ query getRefferingRoles {
data operation swapOrganizationRoleWithNextInGroup {
do {
update organizationroles
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 (select owner_id from ct_organizationroles where organizationrole_id=role_id) = :roleID
and 2 = (select count(*) from ct_organizationroles r where r.role_id=r.organizationrole_id
and (role_order = :roleOrder or role_order = :nextRoleOrder)
and owner_id = :ownerID)
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;

View File

@ -234,7 +234,7 @@ public class OrganizationRole extends ACSObject {
* @throws java.lang.UnsupportedOperationException
*/
public void swapWithPrevious() throws UnsupportedOperationException {
swapWithNext("com.arsdigita.cms.contenttypes.allRoleOrderForOrganization", "com.arsdigita.cms.contenttypes.swapOrganizationRoleWithNextInGroup");
swapWithPrevious("com.arsdigita.cms.contenttypes.allRoleOrderForOrganization", "com.arsdigita.cms.contenttypes.swapOrganizationRoleWithNextInGroup");
}
/**
@ -289,6 +289,8 @@ public class OrganizationRole extends ACSObject {
* @param operationName
*/
protected void swapKeys(boolean swapNext, String queryName, String operationName) {
logger.info("this is swapKeys()...");
String methodName = null;
if (swapNext) {
methodName = "swapWithNext";
@ -299,6 +301,7 @@ public class OrganizationRole extends ACSObject {
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();
@ -310,11 +313,11 @@ public class OrganizationRole extends ACSObject {
"list");
int key = currentKey.intValue();
logger.info(String.format("key = %d", key));
DataQuery query = getSwapQuery(queryName);
int otherKey = key;
int otherKey; // = key;
if (swapNext) {
otherKey = key + 1;
query.addOrder("roleOrder ASC");
@ -330,9 +333,13 @@ public class OrganizationRole extends ACSObject {
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();
}

View File

@ -36,6 +36,7 @@ public class OrganizationRoleTable extends Table {
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;
@ -97,17 +98,19 @@ public class OrganizationRoleTable extends Table {
protected void addColumns() {
TableColumnModel model = getColumnModel();
int i = 0;
m_roleNameCol = new TableColumn(i, "Role");
m_editCol = new TableColumn(++i, "Edit");
m_delCol = new TableColumn(++i, "Delete");
m_moveUpCol = new TableColumn(++i, "");
m_moveDownCol = new TableColumn(++i, "");
this.m_roleNameCol = new TableColumn(i, "Role");
this.m_personCol = new TableColumn(++i, "Person");
this.m_editCol = new TableColumn(++i, "Edit");
this.m_delCol = new TableColumn(++i, "Delete");
this.m_moveUpCol = new TableColumn(++i, "");
this.m_moveDownCol = new TableColumn(++i, "");
model.add(m_roleNameCol);
model.add(m_editCol);
model.add(m_delCol);
model.add(m_moveUpCol);
model.add(m_moveDownCol);
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);
}
@ -125,6 +128,9 @@ public class OrganizationRoleTable extends Table {
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) {
@ -142,8 +148,8 @@ public class OrganizationRoleTable extends Table {
return new Label(DELETE_EVENT);
}
} else if (column == m_moveUpCol.getModelIndex()) {
if (Boolean.TRUE.equals(m_editor.get(state)) && !isLast) {
Label downLabel = new Label(DOWN_EVENT);
if (Boolean.TRUE.equals(m_editor.get(state)) && !isFirst) {
Label downLabel = new Label(UP_EVENT);
downLabel.setClassAttr("linkSort");
return new ControlLink(downLabel);
} else {
@ -191,9 +197,10 @@ public class OrganizationRoleTable extends Table {
OrganizationRole role = getOrganizationRole(e);
Assert.exists(role);
if (col == m_roleNameCol.getModelIndex()) {
/*if (col == m_roleNameCol.getModelIndex()) {
//Nothing to do...
} else if (col == m_editCol.getModelIndex()) {
} 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);

View File

@ -0,0 +1,25 @@
<?xml version="1.0"?>
<ccm:application xmlns:ccm="http://ccm.redhat.com/ccm-project"
name="ccm-cms-types-organizationalunit"
prettyName="Red Hat CCM Content Types"
version="6.6.0"
release="1"
webapp="ROOT">
<ccm:dependencies>
<ccm:requires name="ccm-core" version="6.6.0" relation="ge"/>
<ccm:requires name="ccm-cms" version="6.6.0" relation="ge"/>
<ccm:requires name="ccm-cms-types-person" version="6.6.0" relation="ge"/>
<ccm:requires name="ccm-cms-types-article" version="6.6.0" requires="ge"/>
</ccm:dependencies>
<ccm:directories>
<ccm:directory name="pdl"/>
<ccm:directory name="sql"/>
<ccm:directory name="src"/>
</ccm:directories>
<ccm:contacts>
<ccm:contact uri="mailto:ccm@barkhof.uni-bremen.de" type="support"/>
</ccm:contacts>
<ccm:description>
Content type for representing organizational units.
</ccm:description>
</ccm:application>

View File

@ -0,0 +1,31 @@
//
// 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 OrganizationalUnit extends ContentPage {
String[0..1] organizationalunitName = ct_organizationalunits.organizationalunit_name VARCHAR(512);
String[0..1] organizationalunitDescription = ct_organizationalunits.organizationalunit_description VARCHAR(2048);
reference key (ct_organizationalunits.organizationalunit_id);
}

View File

@ -0,0 +1,3 @@
begin;
\i ddl/postgres/create.sql
end;

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<ctd:content-types xmlns:ctd="http://xmlns.redhat.com/cms/content-types"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.redhat.com/cms/content-types content-types.xsd">
<ctd:content-type label="OrganizationalUnit"
description="Organizational Unit"
objectType="com.arsdigita.cms.contenttypes.OrganizationalUnit"
classname="com.arsdigita.cms.contenttypes.OrganizationalUnit">
<ctd:authoring-kit createComponent="com.arsdigita.cms.ui.authoring.PageCreate">
<ctd:authoring-step labelKey="organizationalunit.authoring.basic_properties.title"
labelBundle="com.arsdigita.cms.contenttypes.OrganizationalUnitResources"
descriptionKey="organizationalunit.authoring.basic_properties.description"
descriptionBundle="com.arsdigita.cms.contenttypes.OrganizationalUnitResources"
component="com.arsdigita.cms.contenttypes.ui.OrganizationalUnitPropertiesStep"
ordering="1"/>
</ctd:authoring-kit>
</ctd:content-type>
</ctd:content-types>

View File

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<registry>
</registry>

View File

@ -0,0 +1,18 @@
<load>
<requires>
<table name="inits" />
<table name="acs_objects" />
<table name="cms_items" />
<table name="ct_genericorganizations" />
<table name="ct_persons" />
<initializer class="com.arsdigita.cms.Initializer" />
</requires>
<provides>
<table name="ct_organizationalunits" />
<initializer class="com.arsdigita.cms.contenttypes.OrganizationalUnitInitializer"/>
</provides>
<scripts>
<schema directory="ccm-cms-types-organizationalunit" />
<data class="com.arsdigita.cms.contenttypes.OrganizationalUnitLoader" />
</scripts>
</load>

View File

@ -0,0 +1,74 @@
/*
* 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;
/**
*
* @author Jens Pelzetter <jens@jp-digital.de>
*/
public class OrganizationalUnit extends ContentPage {
public final static String ORGANIZATIONALUNIT_NAME = "organizationalunitname";
public final static String ORGANIZATIONAL_DESCRIPTION = "description";
public final static String BASE_DATA_OBJECT_TYPE = "com.arsdigita.cms.contenttypes.OrganizationalUnit";
public OrganizationalUnit() {
super(BASE_DATA_OBJECT_TYPE);
}
public OrganizationalUnit(BigDecimal id) throws DataObjectNotFoundException {
this(new OID(BASE_DATA_OBJECT_TYPE, id));
}
public OrganizationalUnit(OID id) throws DataObjectNotFoundException {
super(id);
}
public OrganizationalUnit(DataObject obj) {
super(obj);
}
public OrganizationalUnit(String type) {
super(type);
}
/* accessors ***************************************************/
public String getOrganizationalUnitName() {
return (String)get(ORGANIZATIONALUNIT_NAME);
}
public void setOrganizationalUnitName(String name) {
set(ORGANIZATIONALUNIT_NAME, name);
}
public String getOrganizationalUnitDescription() {
return (String) get(ORGANIZATIONAL_DESCRIPTION);
}
public void setOrganizationalUnitDescription(String description) {
set(ORGANIZATIONAL_DESCRIPTION, description);
}
}

View File

@ -0,0 +1,44 @@
/*
* 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.LegacyInitEvent;
import org.apache.log4j.Logger;
/**
*
* @author Jens Pelzetter <jens@jp-digital.de>
*/
public class OrganizationalUnitInitializer extends ContentTypeInitializer {
private final static Logger logger = Logger.getLogger(OrganizationalUnitInitializer.class);
public OrganizationalUnitInitializer() {
super("ccm-cms-types-organizationalunit.pdl.mf", OrganizationalUnit.BASE_DATA_OBJECT_TYPE);
}
public String getStylesheet() {
return "static/content-types/com/arsdigita/cms/contenttypes/OrganizationalUnit.xml";
}
@Override
public void init(LegacyInitEvent evt) {
super.init(evt);
}
}

View File

@ -0,0 +1,21 @@
package com.arsdigita.cms.contenttypes;
import org.apache.log4j.Logger;
/**
*
* @author Jens Pelzetter <jens@jp-digital.de>
*/
public class OrganizationalUnitLoader extends AbstractContentTypeLoader {
private final static Logger logger = Logger.getLogger(OrganizationalUnitLoader.class);
private final static String[] TYPES = {"/WEB-INF/content-types/com/arsdigita/cms/contentypes/OrganizationalUnit.xml"};
public String[] getTypes() {
return TYPES;
}
public OrganizationalUnitLoader() {
super();
}
}

View File

@ -0,0 +1,33 @@
<!DOCTYPE stylesheet [
<!ENTITY nbsp "&#160;" ><!-- no-break space = non-breaking space, U+00A0 ISOnum -->
]>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:cms="http://www.arsdigita/com/cms/1.0"
version="1.0">
<xsl:template match="cms:item[objectType='com.arsdigita.cms.contenttypes.OrganizationalUnit']"
mode="cms:CT_graphics"
name="cms:CT_graphics_com_arsdigita_cms_contenttypes_OrganizationalUnit">
<p>
<xsl:value-of select="./name" />
<xsl:value-of select="./description" />
</p>
</xsl:template>
<xsl:template match="cms:item[objectType='com.arsdigita.cms.contenttypes.OrganizationalUnit']"
mode="cms:CT_text"
name="cms:CT_text_com_arsdigita_cms_contenttypes_OrganizationalUnit">
<p>
<xsl:value-of select="./name" />
<xsl:value-of select="./description" />
</p>
</xsl:template>
</xsl:stylesheet>