- Problem bei Publizieren bei Contact behoben

- Verschiedene Formatierungen


git-svn-id: https://svn.libreccm.org/ccm/trunk@593 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2010-10-29 16:42:14 +00:00
parent a27fff3a5f
commit 17c35737f9
21 changed files with 466 additions and 363 deletions

View File

@ -46,7 +46,7 @@ object type GenericContactEntry extends ContentItem {
association { association {
GenericPerson[0..1] person = join cms_contacts.contact_id GenericPerson[0..n] person = join cms_contacts.contact_id
to cms_person_contact_map.contact_id, to cms_person_contact_map.contact_id,
join cms_person_contact_map.person_id join cms_person_contact_map.person_id
to cms_persons.person_id; to cms_persons.person_id;

View File

@ -20,12 +20,12 @@
model com.arsdigita.cms.contenttypes; model com.arsdigita.cms.contenttypes;
import com.arsdigita.cms.ContentPage; import com.arsdigita.cms.*;
import com.arsdigita.domain.*;
import com.arsdigita.kernel.ACSObject;
// PDL definition for a commons base type for organizations, departments, projects etc. // PDL definition for a commons base type for organizations, departments, projects etc.
object type GenericOrganizationalUnit extends ContentPage { object type GenericOrganizationalUnit extends ContentPage {
//String[0..1] orgaunit_name = cms_organizationalunits.name VARCHAR(256);
String[0..1] addendum = cms_organizationalunits.addendum VARCHAR(512); String[0..1] addendum = cms_organizationalunits.addendum VARCHAR(512);
reference key (cms_organizationalunits.organizationalunit_id); reference key (cms_organizationalunits.organizationalunit_id);
@ -34,7 +34,7 @@ object type GenericOrganizationalUnit extends ContentPage {
// Link for contact points. // Link for contact points.
association { association {
GenericOrganizationalUnit[0..1] organizationalunit = join cms_contacts.contact_id GenericOrganizationalUnit[0..n] organizationalunit = join cms_contacts.contact_id
to cms_organizationalunits_contact_map.contact_id, to cms_organizationalunits_contact_map.contact_id,
join cms_organizationalunits_contact_map.organizationalunit_id join cms_organizationalunits_contact_map.organizationalunit_id
to cms_organizationalunits.organizationalunit_id; to cms_organizationalunits.organizationalunit_id;
@ -64,6 +64,15 @@ association {
to cms_persons.person_id; to cms_persons.person_id;
// Additional attributes for the association // Additional attributes for the association
String role_name = cms_organizationalunits_person_map.role_name VARCHAR(100); String[0..1] role_name = cms_organizationalunits_person_map.role_name VARCHAR(100);
} }
//object type GenericOrganizationalUnitPersonAssociation extends ACSObject {
//
// GenericPerson[0..1] person = join cms_organizationalunit_person_assoc.person_id
// to cms_persons.person_id;
// String[0..1] roleName = cms_organizationalunit_person_assoc.role_name VARCHAR(100);
//
// reference key (cms_organizationalunit_person_assoc.assoc_id);
//}

View File

@ -30,30 +30,30 @@ import com.arsdigita.util.Assert;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.StringTokenizer; import java.util.StringTokenizer;
/** /**
* This content type represents an basic contact * This content type represents an basic contact
* *
*/ */
public class GenericContact extends ContentPage implements RelationAttributeInterface { public class GenericContact extends ContentPage implements
RelationAttributeInterface {
/** PDL property names */ /** PDL property names */
public static final String PERSON = "person"; public static final String PERSON = "person";
// public static final String CONTACT_TYPE = ""; // public static final String CONTACT_TYPE = "";
public static final String ADDRESS = "address"; public static final String ADDRESS = "address";
public static final String CONTACT_ENTRIES = "contactentries"; public static final String CONTACT_ENTRIES = "contactentries";
private static final String RELATION_ATTRIBUTES =
private static final String RELATION_ATTRIBUTES = "GenericContactType;GenericContactEntryType"; "GenericContactType;GenericContactEntryType";
// Config // Config
private static final GenericContactConfig s_config = new GenericContactConfig(); private static final GenericContactConfig s_config =
new GenericContactConfig();
static { static {
s_config.load(); s_config.load();
} }
/** Data object type for tihs domain object */ /** Data object type for tihs domain object */
public static final String BASE_DATA_OBJECT_TYPE public static final String BASE_DATA_OBJECT_TYPE =
= "com.arsdigita.cms.contenttypes.GenericContact"; "com.arsdigita.cms.contenttypes.GenericContact";
public GenericContact() { public GenericContact() {
super(BASE_DATA_OBJECT_TYPE); super(BASE_DATA_OBJECT_TYPE);
@ -75,6 +75,7 @@ public class GenericContact extends ContentPage implements RelationAttributeInte
public GenericContact(String type) { public GenericContact(String type) {
super(type); super(type);
//unsetPerson();
} }
@Override @Override
@ -91,18 +92,41 @@ public class GenericContact extends ContentPage implements RelationAttributeInte
return s_config; return s_config;
} }
/////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////
// accessors // accessors
// Get the person for this contact // Get the person for this contact
public GenericPerson getPerson() { public GenericPerson getPerson() {
return (GenericPerson) DomainObjectFactory.newInstance((DataObject)get(PERSON)); DataCollection collection;
collection = (DataCollection) get(PERSON);
if (collection.size() == 0) {
return null;
} else {
DataObject dobj;
collection.next();
dobj = collection.getDataObject();
return (GenericPerson) DomainObjectFactory.newInstance(dobj);
}
//return (GenericPerson) DomainObjectFactory.newInstance((DataObject)get(PERSON));
} }
// Set the person for this contact // Set the person for this contact
public void setPerson(GenericPerson person) { public void setPerson(GenericPerson person) {
set(PERSON, person); //set(PERSON, person);
if (getPerson() != null) {
unsetPerson();
}
if (person != null) {
Assert.exists(person, GenericPerson.class);
DataObject link = add(PERSON, person);
link.set(GenericPerson.CONTACTS_ORDER,
new BigDecimal(person.getContacts().size()));
link.save();
}
} }
// // Get the type for this contact // // Get the type for this contact
@ -114,15 +138,20 @@ public class GenericContact extends ContentPage implements RelationAttributeInte
// public void setContactType(String type) { // public void setContactType(String type) {
// set(CONTACT_TYPE, type); // set(CONTACT_TYPE, type);
// } // }
// Unset the address for this contact // Unset the address for this contact
public void unsetPerson() { public void unsetPerson() {
set(PERSON, null); //set(PERSON, null);
GenericPerson oldPerson;
oldPerson = getPerson();
if (oldPerson != null) {
remove(PERSON, oldPerson);
}
} }
// Get the address for this contact // Get the address for this contact
public GenericAddress getAddress() { public GenericAddress getAddress() {
return (GenericAddress)DomainObjectFactory.newInstance((DataObject)get(ADDRESS)); return (GenericAddress) DomainObjectFactory.newInstance((DataObject) get(
ADDRESS));
} }
// Set the address for this contact // Set the address for this contact
@ -137,7 +166,8 @@ public class GenericContact extends ContentPage implements RelationAttributeInte
// Get all contact entries for this contact, p. ex. phone number, type of contact etc. // Get all contact entries for this contact, p. ex. phone number, type of contact etc.
public GenericContactEntryCollection getContactEntries() { public GenericContactEntryCollection getContactEntries() {
return new GenericContactEntryCollection ((DataCollection) get(CONTACT_ENTRIES)); return new GenericContactEntryCollection((DataCollection) get(
CONTACT_ENTRIES));
} }
// Add a contact entry for this contact // Add a contact entry for this contact

View File

@ -41,7 +41,8 @@ import org.apache.log4j.Logger;
*/ */
public class GenericOrganizationalUnit extends ContentPage { public class GenericOrganizationalUnit extends ContentPage {
private static final Logger logger = Logger.getLogger(GenericOrganizationalUnit.class); private static final Logger logger = Logger.getLogger(
GenericOrganizationalUnit.class);
//public final static String ORGAUNIT_NAME = "ORGAUNIT_NAME"; //public final static String ORGAUNIT_NAME = "ORGAUNIT_NAME";
public final static String ADDENDUM = "addendum"; public final static String ADDENDUM = "addendum";
public final static String CONTACTS = "contacts"; public final static String CONTACTS = "contacts";
@ -90,11 +91,12 @@ public class GenericOrganizationalUnit extends ContentPage {
public void addContact(GenericContact contact, String contactType) { public void addContact(GenericContact contact, String contactType) {
Assert.exists(contact, GenericContact.class); Assert.exists(contact, GenericContact.class);
logger.debug(String.format("Adding contact of type \"%s\"...", contactType)); logger.debug(String.format("Adding contact of type \"%s\"...",
contactType));
DataObject link = add(CONTACTS, contact); DataObject link = add(CONTACTS, contact);
link.set(CONTACT_TYPE, contactType); link.set(CONTACT_TYPE, contactType);
link.set(CONTACT_ORDER, Integer.valueOf((int)getContacts().size())); link.set(CONTACT_ORDER, Integer.valueOf((int) getContacts().size()));
link.save(); link.save();
} }
@ -108,8 +110,9 @@ public class GenericOrganizationalUnit extends ContentPage {
} }
public GenericOrganizationalUnitPersonCollection getPersons() { public GenericOrganizationalUnitPersonCollection getPersons() {
return new GenericOrganizationalUnitPersonCollection((DataCollection) get( DataCollection dataColl = (DataCollection) get(PERSONS);
PERSONS)); logger.debug(String.format("GenericOrganizationalUnitPersonCollection size = %d", dataColl.size()));
return new GenericOrganizationalUnitPersonCollection(dataColl);
} }
public void addPerson(GenericPerson person, String role) { public void addPerson(GenericPerson person, String role) {
@ -122,6 +125,7 @@ public class GenericOrganizationalUnit extends ContentPage {
} }
public void removePerson(GenericPerson person) { public void removePerson(GenericPerson person) {
logger.debug("Removing person association...");
Assert.exists(person, GenericPerson.class); Assert.exists(person, GenericPerson.class);
remove(PERSONS, person); remove(PERSONS, person);
} }

View File

@ -20,7 +20,6 @@ package com.arsdigita.cms.contenttypes;
import com.arsdigita.domain.DomainCollection; import com.arsdigita.domain.DomainCollection;
import com.arsdigita.persistence.DataCollection; import com.arsdigita.persistence.DataCollection;
import java.math.BigDecimal;
/** /**
* Collection class for the GenericOrganizationalUnit -> Person relation. * Collection class for the GenericOrganizationalUnit -> Person relation.
@ -36,6 +35,7 @@ public class GenericOrganizationalUnitPersonCollection extends DomainCollection
super(dataCollection); super(dataCollection);
} }
/** /**
* Gets the name of the role of this orgaunit-person link * Gets the name of the role of this orgaunit-person link
*/ */

View File

@ -74,6 +74,7 @@ public class GenericPerson extends ContentPage implements RelationAttributeInter
public GenericPerson(String type) { public GenericPerson(String type) {
super(type); super(type);
//set(CONTACTS, null);
} }
@Override @Override

View File

@ -13,12 +13,10 @@ import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
import com.arsdigita.cms.ui.authoring.BasicPageForm; import com.arsdigita.cms.ui.authoring.BasicPageForm;
import com.arsdigita.cms.ui.authoring.SimpleEditStep; import com.arsdigita.cms.ui.authoring.SimpleEditStep;
import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess; import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
import com.arsdigita.bebop.Component; import com.arsdigita.bebop.Component;
import com.arsdigita.bebop.Label; import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.PageState;
import com.arsdigita.cms.contenttypes.GenericContact; import com.arsdigita.cms.contenttypes.GenericContact;
import com.arsdigita.cms.contenttypes.GenericPerson;
import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil; import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil;
/** /**
@ -63,12 +61,15 @@ public class GenericContactPersonPropertiesStep extends SimpleEditStep {
} }
public static Component getPersonPropertySheet(ItemSelectionModel itemModel) { public static Component getPersonPropertySheet(ItemSelectionModel itemModel) {
DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(itemModel); /*DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(itemModel);
sheet.add((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.person.surname").localize(), "person." + GenericPerson.SURNAME); sheet.add(ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.person.surname"), "person." + GenericPerson.SURNAME);
sheet.add((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.person.givenname").localize(), "person." + GenericPerson.GIVENNAME); sheet.add(ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.person.givenname"), "person." + GenericPerson.GIVENNAME);
sheet.add((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.person.titlepre").localize(), "person." + GenericPerson.TITLEPRE); sheet.add(ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.person.titlepre"), "person." + GenericPerson.TITLEPRE);
sheet.add((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.person.titlepost").localize(), "person." + GenericPerson.TITLEPOST); sheet.add(ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.person.titlepost"), "person." + GenericPerson.TITLEPOST);*/
GenericContactPersonSheet sheet = new GenericContactPersonSheet(
itemModel);
return sheet; return sheet;
} }

View File

@ -22,6 +22,7 @@ package com.arsdigita.cms.contenttypes.ui;
import com.arsdigita.bebop.Component; import com.arsdigita.bebop.Component;
import com.arsdigita.bebop.ControlLink; import com.arsdigita.bebop.ControlLink;
import com.arsdigita.bebop.Label; import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.Link;
import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.Table; import com.arsdigita.bebop.Table;
import com.arsdigita.bebop.event.TableActionEvent; import com.arsdigita.bebop.event.TableActionEvent;
@ -31,14 +32,18 @@ import com.arsdigita.bebop.table.TableColumn;
import com.arsdigita.bebop.table.TableColumnModel; import com.arsdigita.bebop.table.TableColumnModel;
import com.arsdigita.bebop.table.TableModel; import com.arsdigita.bebop.table.TableModel;
import com.arsdigita.bebop.table.TableModelBuilder; import com.arsdigita.bebop.table.TableModelBuilder;
import com.arsdigita.bebop.util.GlobalizationUtil; import com.arsdigita.cms.CMS;
import com.arsdigita.cms.ContentItem;
import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.RelationAttributeCollection; import com.arsdigita.cms.RelationAttributeCollection;
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit; import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit;
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitPersonCollection; import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitPersonCollection;
import com.arsdigita.cms.contenttypes.GenericPerson; import com.arsdigita.cms.contenttypes.GenericPerson;
import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil; import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil;
import com.arsdigita.cms.dispatcher.ItemResolver;
import com.arsdigita.cms.dispatcher.Utilities; import com.arsdigita.cms.dispatcher.Utilities;
import com.arsdigita.domain.DataObjectNotFoundException;
import com.arsdigita.util.LockableImpl; import com.arsdigita.util.LockableImpl;
import java.math.BigDecimal; import java.math.BigDecimal;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
@ -78,13 +83,16 @@ public class GenericOrganizationalUnitPersonsTable extends Table implements
new TableColumn( new TableColumn(
2, 2,
ContenttypesGlobalizationUtil.globalize( ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.genericorgaunit.persons.delete").localize())); "cms.contenttypes.ui.genericorgaunit.persons.delete").localize(),
TABLE_COL_DEL));
setModelBuilder( setModelBuilder(
new GenericOrganizationalUnitTableModelBuilder(itemModel)); new GenericOrganizationalUnitTableModelBuilder(itemModel));
tabModel.get(0).setCellRenderer(new EditCellRenderer()); tabModel.get(0).setCellRenderer(new EditCellRenderer());
tabModel.get(2).setCellRenderer(new DeleteCellRenderer()); tabModel.get(2).setCellRenderer(new DeleteCellRenderer());
addTableActionListener(this);
} }
private class GenericOrganizationalUnitTableModelBuilder private class GenericOrganizationalUnitTableModelBuilder
@ -121,6 +129,8 @@ public class GenericOrganizationalUnitPersonsTable extends Table implements
GenericOrganizationalUnit orgaunit) { GenericOrganizationalUnit orgaunit) {
m_table = table; m_table = table;
m_personsCollection = orgaunit.getPersons(); m_personsCollection = orgaunit.getPersons();
s_log.debug(String.format("m_personsCollection.size() = %d", m_personsCollection.
size()));
} }
public int getColumnCount() { public int getColumnCount() {
@ -152,10 +162,12 @@ public class GenericOrganizationalUnitPersonsTable extends Table implements
if (role.next()) { if (role.next()) {
return role.getName(); return role.getName();
} else { } else {
return ContenttypesGlobalizationUtil.globalize("cms.ui.unknownRole"); return ContenttypesGlobalizationUtil.globalize(
"cms.ui.unknownRole");
} }
case 2: case 2:
return ContenttypesGlobalizationUtil.globalize("cms.ui.delete").localize(); return ContenttypesGlobalizationUtil.globalize(
"cms.ui.delete").localize();
default: default:
return null; return null;
} }
@ -177,7 +189,7 @@ public class GenericOrganizationalUnitPersonsTable extends Table implements
Object key, Object key,
int row, int row,
int col) { int col) {
/*com.arsdigita.cms.SecurityManager securityManager = Utilities. com.arsdigita.cms.SecurityManager securityManager = Utilities.
getSecurityManager(state); getSecurityManager(state);
GenericOrganizationalUnit orgaunit = (GenericOrganizationalUnit) m_itemModel. GenericOrganizationalUnit orgaunit = (GenericOrganizationalUnit) m_itemModel.
getSelectedObject( getSelectedObject(
@ -187,11 +199,27 @@ public class GenericOrganizationalUnitPersonsTable extends Table implements
com.arsdigita.cms.SecurityManager.EDIT_ITEM, com.arsdigita.cms.SecurityManager.EDIT_ITEM,
orgaunit); orgaunit);
if (canEdit) { if (canEdit) {
ControlLink link = new ControlLink(value.toString()); GenericPerson person;
return link; try {
} else {*/ person = new GenericPerson((BigDecimal) key);
} catch (DataObjectNotFoundException ex) {
s_log.warn(String.format("No object with key '%s' found.",
key),
ex);
return new Label(value.toString()); return new Label(value.toString());
// } }
ContentSection section = CMS.getContext().getContentSection();
ItemResolver resolver = section.getItemResolver();
Link link = new Link(value.toString(),
resolver.generateItemURL(state,
person,
section,
person.getVersion()));
return link;
} else {
return new Label(value.toString());
}
} }
} }
@ -230,7 +258,11 @@ public class GenericOrganizationalUnitPersonsTable extends Table implements
@Override @Override
public void cellSelected(TableActionEvent event) { public void cellSelected(TableActionEvent event) {
s_log.debug("Cell selected.");
PageState state = event.getPageState(); PageState state = event.getPageState();
s_log.debug(String.format("RowKey = %s", event.getRowKey().toString()));
s_log.debug(String.format("Selected column: %d", event.getColumn().
intValue()));
GenericPerson person = new GenericPerson(new BigDecimal(event.getRowKey(). GenericPerson person = new GenericPerson(new BigDecimal(event.getRowKey().
toString())); toString()));
@ -240,20 +272,26 @@ public class GenericOrganizationalUnitPersonsTable extends Table implements
TableColumn col = getColumnModel().get(event.getColumn().intValue()); TableColumn col = getColumnModel().get(event.getColumn().intValue());
if (col.getHeaderKey().toString().equals(TABLE_COL_EDIT)) {
}
if (col.getHeaderKey().toString().equals(TABLE_COL_DEL)) {
if (col.getHeaderKey().toString().equals(TABLE_COL_EDIT)) {
} else if (col.getHeaderKey().toString().equals(TABLE_COL_DEL)) {
s_log.debug("Removing person assoc...");
orga.removePerson(person); orga.removePerson(person);
} }
} }
@Override @Override
public void headSelected(TableActionEvent event) { public void headSelected(TableActionEvent event) {
throw new UnsupportedOperationException("Not supported yet."); throw new UnsupportedOperationException("Not supported yet.");
} }
protected String getRoleAttributeName() { protected String getRoleAttributeName() {
return "GenericOrganizationalUnitRole"; return "GenericOrganizationalUnitRole";
} }
} }

View File

@ -72,8 +72,8 @@ public abstract class DomainObjectTraversal {
private Set m_visited = new HashSet(); private Set m_visited = new HashSet();
private static Map s_adapters = new HashMap(); private static Map s_adapters = new HashMap();
private static final Logger s_log = Logger.getLogger(DomainObjectTraversal.class); private static final Logger s_log = Logger.getLogger(
DomainObjectTraversal.class);
public final static String LINK_NAME = "link"; public final static String LINK_NAME = "link";
/** /**
@ -90,16 +90,13 @@ public abstract class DomainObjectTraversal {
Assert.exists(adapter, Assert.exists(adapter,
"The DomainObjectTraversalAdapter is null for context '" "The DomainObjectTraversalAdapter is null for context '"
+ context + "' and object type '" + type); + context + "' and object type '" + type);
Assert.exists(type, "The ObjectType for context '" + context + Assert.exists(type, "The ObjectType for context '" + context
"' and adapter '" + adapter + "' is null"); + "' and adapter '" + adapter + "' is null");
Assert.exists(context, String.class); Assert.exists(context, String.class);
if (s_log.isDebugEnabled()) { if (s_log.isDebugEnabled()) {
s_log.debug("Registering adapter " + s_log.debug("Registering adapter " + adapter.getClass()
adapter.getClass() + + " for object type " + type.getQualifiedName()
" for object type " + + " in context " + context);
type.getQualifiedName() +
" in context " +
context);
} }
s_adapters.put(new AdapterKey(type, context), adapter); s_adapters.put(new AdapterKey(type, context), adapter);
} }
@ -117,11 +114,8 @@ public abstract class DomainObjectTraversal {
Assert.exists(context, String.class); Assert.exists(context, String.class);
if (s_log.isDebugEnabled()) { if (s_log.isDebugEnabled()) {
s_log.debug("Removing adapter " + s_log.debug("Removing adapter " + " for object type " + type.
" for object type " + getQualifiedName() + " in context " + context);
type.getQualifiedName() +
" in context " +
context);
} }
s_adapters.remove(new AdapterKey(type, context)); s_adapters.remove(new AdapterKey(type, context));
@ -163,20 +157,19 @@ public abstract class DomainObjectTraversal {
* @param type the object type to lookup * @param type the object type to lookup
* @param context the adapter context * @param context the adapter context
*/ */
public static DomainObjectTraversalAdapter lookupAdapter(final ObjectType type, public static DomainObjectTraversalAdapter lookupAdapter(
final ObjectType type,
final String context) { final String context) {
Assert.exists(type, ObjectType.class); Assert.exists(type, ObjectType.class);
Assert.exists(context, String.class); Assert.exists(context, String.class);
if (s_log.isDebugEnabled()) { if (s_log.isDebugEnabled()) {
s_log.debug("lookupAdapter for type " + s_log.debug("lookupAdapter for type " + type.getQualifiedName()
type.getQualifiedName() + + " in context " + context);
" in context " +
context);
} }
return (DomainObjectTraversalAdapter)s_adapters return (DomainObjectTraversalAdapter) s_adapters.get(
.get(new AdapterKey(type, context)); new AdapterKey(type, context));
} }
/** /**
@ -193,21 +186,19 @@ public abstract class DomainObjectTraversal {
Assert.exists(type, ObjectType.class); Assert.exists(type, ObjectType.class);
Assert.exists(context, String.class); Assert.exists(context, String.class);
if (s_log.isDebugEnabled()) { if (s_log.isDebugEnabled()) {
s_log.debug("findAdapter for type " + s_log.debug("findAdapter for type " + type.getQualifiedName()
type.getQualifiedName() + + " in context " + context);
" in context " +
context);
StringBuffer buf = new StringBuffer(); StringBuffer buf = new StringBuffer();
buf.append( "Adapters contain:\n" ); buf.append("Adapters contain:\n");
Iterator keys = s_adapters.keySet().iterator(); Iterator keys = s_adapters.keySet().iterator();
while( keys.hasNext() ) { while (keys.hasNext()) {
Object key = keys.next(); Object key = keys.next();
buf.append( key.toString() ).append( ": " ); buf.append(key.toString()).append(": ");
buf.append( s_adapters.get( key ).toString() ).append( '\n' ); buf.append(s_adapters.get(key).toString()).append('\n');
} }
s_log.debug( buf.toString() ); s_log.debug(buf.toString());
} }
DomainObjectTraversalAdapter adapter = null; DomainObjectTraversalAdapter adapter = null;
ObjectType tmpType = type; ObjectType tmpType = type;
@ -216,10 +207,8 @@ public abstract class DomainObjectTraversal {
tmpType = tmpType.getSupertype(); tmpType = tmpType.getSupertype();
} }
if (adapter == null) { if (adapter == null) {
s_log.warn("Could not find adapter for object type " + s_log.warn("Could not find adapter for object type " + type.
type.getQualifiedName() + getQualifiedName() + " in context " + context);
" in context " +
context);
} }
return adapter; return adapter;
} }
@ -233,13 +222,12 @@ public abstract class DomainObjectTraversal {
*/ */
public void walk(final DomainObject obj, public void walk(final DomainObject obj,
final String context) { final String context) {
final DomainObjectTraversalAdapter adapter = findAdapter(obj.getObjectType(), final DomainObjectTraversalAdapter adapter = findAdapter(obj.
getObjectType(),
context); context);
if (adapter == null) { if (adapter == null) {
final String errorMsg = "No adapter for object " + final String errorMsg = "No adapter for object " + obj.getOID()
obj.getOID() + + " in context " + context;
" in context " +
context;
s_log.error(errorMsg); s_log.error(errorMsg);
throw new IllegalArgumentException(errorMsg); throw new IllegalArgumentException(errorMsg);
} }
@ -259,12 +247,12 @@ public abstract class DomainObjectTraversal {
// ContentBundle instead of the content item. To get the corresponding // ContentBundle instead of the content item. To get the corresponding
// content item during XML generation, I have to test for ContentBundle and // content item during XML generation, I have to test for ContentBundle and
// negotiate the language version. This is not possible in com.arsdigita.ccm. // negotiate the language version. This is not possible in com.arsdigita.ccm.
protected void walk(final DomainObjectTraversalAdapter adapter, protected void walk(final DomainObjectTraversalAdapter adapter,
final DomainObject obj, final DomainObject obj,
final String path, final String path,
final String context, final String context,
final DomainObject linkObject) { final DomainObject linkObject) {
s_log.debug(String.format("Walking with path %s and context %s...", path, context));
OID oid = obj.getOID(); OID oid = obj.getOID();
OID linkOid = null; OID linkOid = null;
if (linkObject != null) { if (linkObject != null) {
@ -295,7 +283,7 @@ public abstract class DomainObjectTraversal {
ObjectType type = obj.getObjectType(); ObjectType type = obj.getObjectType();
// Test all properties against the traversal xml // Test all properties against the traversal xml
for (Iterator i = type.getProperties(); i.hasNext(); ) { for (Iterator i = type.getProperties(); i.hasNext();) {
Property prop = (Property) i.next(); Property prop = (Property) i.next();
String propName = prop.getName(); String propName = prop.getName();
@ -303,20 +291,19 @@ public abstract class DomainObjectTraversal {
appendToPath(path, prop.getName()), appendToPath(path, prop.getName()),
prop, prop,
context)) { context)) {
if( s_log.isDebugEnabled() ) { if (s_log.isDebugEnabled()) {
s_log.debug( "Not processing " + s_log.debug("Not processing " + appendToPath(path, prop.
appendToPath( path, prop.getName() ) + getName()) + " in object " + oid + " and context "
" in object " + oid + " and context " + + context + " with adapter " + adapter.getClass().
context + " with adapter " + getName());
adapter.getClass().getName() );
} }
continue; continue;
} }
Object propValue = obj.get(propName); Object propValue = obj.get(propName);
if (propValue == null) { if (propValue == null) {
if( s_log.isDebugEnabled() ) { if (s_log.isDebugEnabled()) {
s_log.debug( "Object " + oid.toString() + " doesn't " + s_log.debug("Object " + oid.toString() + " doesn't "
"contain property " + propName ); + "contain property " + propName);
} }
continue; continue;
} }
@ -326,14 +313,14 @@ public abstract class DomainObjectTraversal {
// Property is a DataObject, so start recursion // Property is a DataObject, so start recursion
} else if (propValue instanceof DataObject) { } else if (propValue instanceof DataObject) {
if( s_log.isDebugEnabled() ) { if (s_log.isDebugEnabled()) {
s_log.debug( prop.getName() + " is a DataObject" ); s_log.debug(prop.getName() + " is a DataObject");
} }
beginRole(obj, path, prop); beginRole(obj, path, prop);
walk(adapter, walk(adapter,
DomainObjectFactory.newInstance((DataObject)propValue), DomainObjectFactory.newInstance((DataObject) propValue),
appendToPath(path, propName), appendToPath(path, propName),
context, context,
null); null);
@ -345,8 +332,8 @@ public abstract class DomainObjectTraversal {
// see #25808 - this hack prevents the content field of cms_files // see #25808 - this hack prevents the content field of cms_files
// (which is a blob) from being queried when all we need is a // (which is a blob) from being queried when all we need is a
// list of the files on an item.. // list of the files on an item..
if (prop.getName().equals("fileAttachments") && if (prop.getName().equals("fileAttachments") && !Domain.
!Domain.getConfig().queryBlobContentForFileAttachments()) { getConfig().queryBlobContentForFileAttachments()) {
// make true a config // make true a config
DataQuery fileAttachmentsQuery = DataQuery fileAttachmentsQuery =
SessionManager.getSession().retrieveQuery( SessionManager.getSession().retrieveQuery(
@ -358,11 +345,10 @@ public abstract class DomainObjectTraversal {
DataCollection files = new DataQueryDataCollectionAdapter( DataCollection files = new DataQueryDataCollectionAdapter(
fileAttachmentsQuery, "file"); fileAttachmentsQuery, "file");
while(files.next()) { while (files.next()) {
DataObject file = files.getDataObject(); DataObject file = files.getDataObject();
walk(adapter, walk(adapter,
DomainObjectFactory.newInstance DomainObjectFactory.newInstance(file),
(file),
appendToPath(path, propName), appendToPath(path, propName),
context, context,
null); null);
@ -370,23 +356,25 @@ public abstract class DomainObjectTraversal {
} else { } else {
if( s_log.isDebugEnabled() ) { if (s_log.isDebugEnabled()) {
s_log.debug( prop.getName() + " is a DataAssociation" ); s_log.debug(prop.getName() + " is a DataAssociation");
} }
beginAssociation(obj, path, prop); beginAssociation(obj, path, prop);
DataAssociationCursor daCursor = DataAssociationCursor daCursor =
((DataAssociation)propValue).getDataAssociationCursor(); ((DataAssociation) propValue).
getDataAssociationCursor();
while (daCursor.next()) { while (daCursor.next()) {
s_log.debug("Processing data assoication cursor...");
DataObject link = daCursor.getLink(); DataObject link = daCursor.getLink();
DomainObject linkObj = null; DomainObject linkObj = null;
if (link != null) { if (link != null) {
linkObj = new LinkDomainObject(link); linkObj = new LinkDomainObject(link);
} }
walk(adapter, walk(adapter,
DomainObjectFactory.newInstance DomainObjectFactory.newInstance(daCursor.
(daCursor.getDataObject()), getDataObject()),
appendToPath(path, propName), appendToPath(path, propName),
context, context,
linkObj); linkObj);
@ -402,13 +390,13 @@ public abstract class DomainObjectTraversal {
endObject(obj, path); endObject(obj, path);
} }
/** /**
* Method called when the processing of an object * Method called when the processing of an object
* starts * starts
*/ */
protected abstract void beginObject(DomainObject obj, protected abstract void beginObject(DomainObject obj,
String path); String path);
/** /**
* Method called when the procesing of an object * Method called when the procesing of an object
* completes * completes
@ -420,12 +408,17 @@ public abstract class DomainObjectTraversal {
* Method called when the processing of a Link Object * Method called when the processing of a Link Object
* starts * starts
*/ */
protected void beginLink(DomainObject obj, String path) {} protected void beginLink(DomainObject obj, String path) {
s_log.debug(String.format("Starting link with path = %s", path));
}
/** /**
* Method called when the procesing of a Link Object * Method called when the procesing of a Link Object
* completes * completes
*/ */
protected void endLink(DomainObject obj, String path) {} protected void endLink(DomainObject obj, String path) {
s_log.debug(String.format("Finished link with path = %s", path));
}
/** /**
* Method called when a previously visited object * Method called when a previously visited object
@ -473,7 +466,6 @@ public abstract class DomainObjectTraversal {
String path, String path,
Property property); Property property);
protected String appendToPath(String path, protected String appendToPath(String path,
String name) { String name) {
if (path.endsWith("/" + name)) { if (path.endsWith("/" + name)) {
@ -507,8 +499,8 @@ public abstract class DomainObjectTraversal {
} }
} }
protected static class AdapterKey { protected static class AdapterKey {
private final ObjectType m_type; private final ObjectType m_type;
private final String m_context; private final String m_context;
@ -522,9 +514,8 @@ public abstract class DomainObjectTraversal {
public boolean equals(Object o) { public boolean equals(Object o) {
if (o instanceof AdapterKey) { if (o instanceof AdapterKey) {
AdapterKey k = (AdapterKey)o; AdapterKey k = (AdapterKey) o;
return k.m_type.equals(m_type) && return k.m_type.equals(m_type) && k.m_context.equals(m_context);
k.m_context.equals(m_context);
} else { } else {
return false; return false;
} }
@ -544,9 +535,9 @@ public abstract class DomainObjectTraversal {
* but we don't have any other domain object to use. * but we don't have any other domain object to use.
*/ */
private class LinkDomainObject extends DomainObject { private class LinkDomainObject extends DomainObject {
LinkDomainObject(DataObject object) { LinkDomainObject(DataObject object) {
super(object); super(object);
} }
} }
} }

View File

@ -218,6 +218,7 @@ public class DomainObjectXMLRenderer extends DomainObjectTraversal {
return XML.format(value); return XML.format(value);
} }
@Override
protected void walk(DomainObject obj, protected void walk(DomainObject obj,
String context, String context,
DomainObjectTraversalAdapter adapter) { DomainObjectTraversalAdapter adapter) {

View File

@ -425,10 +425,13 @@ class DataObjectImpl implements DataObject {
getSession().m_beforeFP.fireNow(new BeforeSaveEvent(this)); getSession().m_beforeFP.fireNow(new BeforeSaveEvent(this));
if (!getSsn().isFlushed(this)) { if (!getSsn().isFlushed(this)) {
s_log.debug("Flushing...");
getSsn().flush(); getSsn().flush();
s_log.debug("Checking flushing...");
assertFlushed(); assertFlushed();
} else { } else {
// with no changes on the object fire after save directly // with no changes on the object fire after save directly
s_log.debug("Direct save...");
getSession().m_afterFP.fireNow(new AfterSaveEvent(this)); getSession().m_afterFP.fireNow(new AfterSaveEvent(this));
} }
} catch (ProtoException pe) { } catch (ProtoException pe) {
@ -441,6 +444,7 @@ class DataObjectImpl implements DataObject {
for (Iterator it = getObjectType().getProperties(); for (Iterator it = getObjectType().getProperties();
it.hasNext(); ) { it.hasNext(); ) {
Property p = (Property) it.next(); Property p = (Property) it.next();
s_log.debug(String.format("Asserting that property '%s' is flushed...", p.getName()));
if (!getSsn().isFlushed(this, C.prop(m_ssn.getRoot(), p))) { if (!getSsn().isFlushed(this, C.prop(m_ssn.getRoot(), p))) {
// use m_ssn to generate the exception // use m_ssn to generate the exception
getSsn().assertFlushed(this); getSsn().assertFlushed(this);

View File

@ -8,7 +8,7 @@
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR sA PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
@ -18,6 +18,7 @@
*/ */
package com.redhat.persistence; package com.redhat.persistence;
import com.arsdigita.persistence.DataObject;
import com.arsdigita.util.UncheckedWrapperException; import com.arsdigita.util.UncheckedWrapperException;
import com.redhat.persistence.metadata.Adapter; import com.redhat.persistence.metadata.Adapter;
import com.redhat.persistence.metadata.ObjectType; import com.redhat.persistence.metadata.ObjectType;
@ -77,12 +78,8 @@ class Expander extends Event.Switch {
final void expand(Event ev) { final void expand(Event ev) {
try { try {
Session.trace(ev.getName(), new Object[]{ev}); Session.trace(ev.getName(), new Object[]{ev});
try {
ev.dispatch(this); ev.dispatch(this);
} catch (DuplicateObjectException ex) {
s_log.warn("Duplicate object exception: ", ex);
s_log.warn("This is maybe an error, but not in all cases.");
}
} catch (RuntimeException re) { } catch (RuntimeException re) {
if (re instanceof ProtoException) { if (re instanceof ProtoException) {
ProtoException pe = (ProtoException) re; ProtoException pe = (ProtoException) re;
@ -117,14 +114,17 @@ class Expander extends Event.Switch {
ObjectData od = m_ssn.getObjectData(obj); ObjectData od = m_ssn.getObjectData(obj);
if (od == null) { if (od == null) {
od = new ObjectData(m_ssn, obj, od.INFANTILE); od = new ObjectData(m_ssn, obj, ObjectData.INFANTILE);
} else if (!od.isDeleted()) { } else if (!od.isDeleted()) {
od.dump(); //od.dump();
ProtoException pe = new DuplicateObjectException(obj); //ProtoException pe = new DuplicateObjectException(obj);
pe.setInternal(false); //pe.setInternal(false);
throw pe; //throw pe;
s_log.warn("Duplicate object: " + ((DataObject) od.getObject()).
getOID());
return;
} else { } else {
od.setState(od.INFANTILE); od.setState(ObjectData.INFANTILE);
} }
Adapter a = m_ssn.getAdapter(obj); Adapter a = m_ssn.getAdapter(obj);

View File

@ -24,6 +24,7 @@ import java.util.Collection;
import java.util.Iterator; import java.util.Iterator;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import org.apache.log4j.Logger;
/** /**
* PropertyData * PropertyData
@ -34,6 +35,8 @@ import java.util.List;
class PropertyData { class PropertyData {
private final static Logger s_log = Logger.getLogger(PropertyData.class);
final private ObjectData m_odata; final private ObjectData m_odata;
final private Property m_prop; final private Property m_prop;
private Object m_value; private Object m_value;
@ -92,6 +95,10 @@ class PropertyData {
(getObject(), getProperty()); (getObject(), getProperty());
return evs.size() == 0; return evs.size() == 0;
} else { } else {
if (getSession().getEventStream().getLastEvent(getObject(), getProperty()) != null) {
//s_log.error(String.format("Last event is not null, property '%s' is not flushed. Last event is: '%s'",
// getProperty().getName(), getSession().getEventStream().getLastEvent(getObject(), getProperty()).getName()));
}
return getSession().getEventStream().getLastEvent return getSession().getEventStream().getLastEvent
(getObject(), getProperty()) == null; (getObject(), getProperty()) == null;
} }

View File

@ -202,7 +202,7 @@
</xrd:adapter> </xrd:adapter>
<!-- Adds several image assets --> <!-- Adds several image assets -->
<xrd:adapter objectType="com.arsdigita.cms.Article"> <xrd:adapter objectType="com.arsdigita.cms.contenttypes.GenericArticle">
<xrd:attributes rule="exclude"> <xrd:attributes rule="exclude">
<xrd:property name="/object/id"/> <xrd:property name="/object/id"/>
<xrd:property name="/object/defaultDomainClass"/> <xrd:property name="/object/defaultDomainClass"/>

View File

@ -298,5 +298,6 @@ public class DataCollectionRenderer extends LockableImpl {
DataObject dobj, DataObject dobj,
ACSObject obj, ACSObject obj,
int index) { int index) {
} }
} }

View File

@ -15,10 +15,11 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
package com.arsdigita.london.navigation.cms; package com.arsdigita.london.navigation.cms;
import com.arsdigita.cms.ContentItem; import com.arsdigita.cms.ContentItem;
import com.arsdigita.cms.ContentItemXMLRenderer;
import com.arsdigita.cms.dispatcher.SimpleXMLGenerator;
import com.arsdigita.domain.DomainObjectFactory; import com.arsdigita.domain.DomainObjectFactory;
import com.arsdigita.kernel.ACSObject; import com.arsdigita.kernel.ACSObject;
import com.arsdigita.london.navigation.DataCollectionRenderer; import com.arsdigita.london.navigation.DataCollectionRenderer;
@ -39,16 +40,24 @@ public class CMSDataCollectionRenderer extends DataCollectionRenderer {
obj = (ACSObject) DomainObjectFactory.newInstance(dobj); obj = (ACSObject) DomainObjectFactory.newInstance(dobj);
} }
if (obj instanceof ContentItem) { if (obj instanceof ContentItem) {
OID oid = ( (ContentItem) obj).getDraftVersion().getOID(); OID oid = ((ContentItem) obj).getDraftVersion().getOID();
return Navigation.redirectURL(oid); return Navigation.redirectURL(oid);
} }
return super.getStableURL(dobj, obj); return super.getStableURL(dobj, obj);
} }
@Override
protected void generateItemXML(Element item, protected void generateItemXML(Element item,
DataObject dobj, DataObject dobj,
ACSObject obj, ACSObject obj,
int index) { int index) {
if (obj != null) {
ContentItemXMLRenderer renderer = new ContentItemXMLRenderer(item);
renderer.setRevisitFullObject(false);
renderer.setWrapAttributes(true);
renderer.setWrapRoot(false);
renderer.setWrapObjects(false);
renderer.walk(obj, SimpleXMLGenerator.ADAPTER_CONTEXT);
}
} }
} }

View File

@ -8,13 +8,21 @@
The default properties for BaseContact are left as is and are inherited from ContentPage The default properties for BaseContact are left as is and are inherited from ContentPage
--> -->
<xrd:context name="com.arsdigita.cms.dispatcher.SimpleXMLGenerator"> <xrd:context name="com.arsdigita.cms.dispatcher.SimpleXMLGenerator">
<xrd:adapter objectType="com.arsdigita.cms.contenttypes.SciOrganization" extends="com.arsdigita.cms.ContentPage"> <xrd:adapter objectType="com.arsdigita.cms.contenttypes.SciOrganization"
extends="com.arsdigita.cms.ContentPage">
<xrd:associations rule="include"> <xrd:associations rule="include">
<xrd:property name="/object/addendum"/> <xrd:property name="/object/addendum"/>
<xrd:property name="/object/contacts"/> <xrd:property name="/object/contacts"/>
<xrd:property name="/object/orgaunit_children"/> <xrd:property name="/object/contacts/person"/>
<xrd:property name="/object/contacts/address"/>
<xrd:property name="/object/contacts/contactentries"/>
<xrd:property name="/object/contacts/person"/>
<xrd:property name="/object/departments"/>
<xrd:property name="/object/departments/persons"/>
<xrd:property name="/object/projects"/>
<xrd:property name="/object/persons"/> <xrd:property name="/object/persons"/>
</xrd:associations> </xrd:associations>
</xrd:adapter> </xrd:adapter>
</xrd:context> </xrd:context>
</xrd:adapters> </xrd:adapters>

View File

@ -12,7 +12,6 @@
<xrd:associations rule="include"> <xrd:associations rule="include">
<xrd:property name="/object/addendum"/> <xrd:property name="/object/addendum"/>
<xrd:property name="/object/contacts"/> <xrd:property name="/object/contacts"/>
<xrd:property name="/object/orgaunit_children"/>
<xrd:property name="/object/persons"/> <xrd:property name="/object/persons"/>
</xrd:associations> </xrd:associations>
</xrd:adapter> </xrd:adapter>

View File

@ -26,8 +26,18 @@ package com.arsdigita.cms.contenttypes;
*/ */
public class SciOrganizationLoader extends AbstractContentTypeLoader { public class SciOrganizationLoader extends AbstractContentTypeLoader {
public SciOrganizationLoader() {
super();
/* Template.create("SciOrganization Description Only",
"Display only the description of a SciOrganization",
"/WEB-INF/content-types/com/arsdigita/cms/contenttypes/"
+ "SciOrganizationDescription.jsp");*/
}
private static final String[] TYPES = { private static final String[] TYPES = {
"/WEB-INF/content-types/com/arsdigita/cms/contenttypes/SciOrganization.xml" "/WEB-INF/content-types/com/arsdigita/cms/contenttypes/"
+ "SciOrganization.xml"
}; };
@Override @Override

View File

@ -15,7 +15,6 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
package com.arsdigita.aplaws; package com.arsdigita.aplaws;
import com.arsdigita.london.navigation.Navigation; import com.arsdigita.london.navigation.Navigation;
@ -66,12 +65,10 @@ import java.util.Set;
public class Loader extends PackageLoader { public class Loader extends PackageLoader {
private static final Logger s_log = Logger.getLogger(Loader.class); private static final Logger s_log = Logger.getLogger(Loader.class);
private static final String[] categoryFiles = new String[]{
private static final String[] categoryFiles = new String[] { "WEB-INF/aplaws/zes-nav-domain-1.00.xml",
"WEB-INF/aplaws/zes-nav-domain-1.00.xml" "WEB-INF/aplaws/zes-nav-hierarchy-1.00.xml"
, "WEB-INF/aplaws/zes-nav-hierarchy-1.00.xml"
}; };
private StringParameter m_navigationDomain; private StringParameter m_navigationDomain;
// private StringParameter m_servicesDomain; // private StringParameter m_servicesDomain;
// private StringParameter m_interactionDomain; // private StringParameter m_interactionDomain;
@ -125,23 +122,21 @@ public class Loader extends PackageLoader {
} }
public void run(final ScriptContext ctx) { public void run(final ScriptContext ctx) {
String[] files = categoryFiles; String[] files = categoryFiles;
final Parser parser = new Parser(); final Parser parser = new Parser();
for (int i = 0 ; i < files.length ; i++) { for (int i = 0; i < files.length; i++) {
final String file = files[i]; final String file = files[i];
if (s_log.isInfoEnabled()) { if (s_log.isInfoEnabled()) {
s_log.info("Process " + file); s_log.info("Process " + file);
} }
parser.parse(Thread.currentThread().getContextClassLoader parser.parse(Thread.currentThread().getContextClassLoader().
().getResourceAsStream getResourceAsStream(file));
(file));
} }
String navigationKey = (String)get(m_navigationDomain); String navigationKey = (String) get(m_navigationDomain);
registerDomain(navigationKey, "/navigation/", null); registerDomain(navigationKey, "/navigation/", null);
registerDomain(navigationKey, "/content/", null); registerDomain(navigationKey, "/content/", null);
registerDomain(navigationKey, "/portal/", null); registerDomain(navigationKey, "/portal/", null);
@ -175,10 +170,10 @@ public class Loader extends PackageLoader {
registerNavigationTemplates(); registerNavigationTemplates();
// Switch /portal/ to use 1 column layout for funky aplaws stuff. // Switch /portal/ to use 1 column layout for funky aplaws stuff.
Workspace portal = (Workspace)Application Workspace portal = (Workspace) Application.retrieveApplicationForPath(
.retrieveApplicationForPath("/portal/"); "/portal/");
portal.setDefaultLayout(PageLayout portal.setDefaultLayout(PageLayout.findLayoutByFormat(
.findLayoutByFormat(PageLayout.FORMAT_ONE_COLUMN)); PageLayout.FORMAT_ONE_COLUMN));
} }
// public void registerServicesTemplate(String appURL) { // public void registerServicesTemplate(String appURL) {
@ -197,7 +192,6 @@ public class Loader extends PackageLoader {
// Template.DEFAULT_DISPATCHER_CONTEXT, // Template.DEFAULT_DISPATCHER_CONTEXT,
// Template.DEFAULT_USE_CONTEXT ); // Template.DEFAULT_USE_CONTEXT );
// } // }
/** /**
* Use Package com.arsdigita.london.navigation to add additional * Use Package com.arsdigita.london.navigation to add additional
* templates (JSP page - index page) for use in navigation. * templates (JSP page - index page) for use in navigation.
@ -208,7 +202,7 @@ public class Loader extends PackageLoader {
*/ */
public void registerNavigationTemplates() { public void registerNavigationTemplates() {
Template template ; Template template;
/* In navigation werden bereits Grund-Templates erstellt. /* In navigation werden bereits Grund-Templates erstellt.
*/ */
@ -237,6 +231,17 @@ public class Loader extends PackageLoader {
"ZeS Welcome Page for navigation", "ZeS Welcome Page for navigation",
"/packages/navigation/templates/zes-welcome.jsp"); "/packages/navigation/templates/zes-welcome.jsp");
template = Template.create(
"ZeS Project List",
"List of SciProjects",
"/packages/navigation/templates/zes-project-list.jsp");
template = Template.create(
"SciOrganization Description Only",
"Display only the description of a SciOrganization",
"/packages/navigation/templates/" +
"SciOrganizationDescription.jsp");
} }
/** /**
@ -247,20 +252,17 @@ public class Loader extends PackageLoader {
* delivered. * delivered.
*/ */
// -- public void registerDefaultNavigationDomain() { // -- public void registerDefaultNavigationDomain() {
// -- private StringParameter m_customNavKey; // -- private StringParameter m_customNavKey;
// -- private URLParameter m_customNavDomainURL; // -- private URLParameter m_customNavDomainURL;
// -- private StringParameter m_customNavPath; // -- private StringParameter m_customNavPath;
// -- private StringParameter m_customNavUseContext; // -- private StringParameter m_customNavUseContext;
// -- private StringParameter m_customNavTitle; // -- private StringParameter m_customNavTitle;
// -- private StringParameter m_customNavDesc; // -- private StringParameter m_customNavDesc;
// -- m_customNavKey = new StringParameter( // -- m_customNavKey = new StringParameter(
// -- "com.arsdigita.aplaws.custom_nav_key", // -- "com.arsdigita.aplaws.custom_nav_key",
// -- Parameter.REQUIRED, // -- Parameter.REQUIRED,
// -- "APLAWS-NAVIGATION"); // -- "APLAWS-NAVIGATION");
/* Zugriff auf Website wird nicht benötigt, aber der Parameter bei Einrichtung
/* Zugriff auf Website wird nicht benötigt, aber der Parameter bei Einrichtung
* der Kategorien. Funktion URL prüft auf korrekte Syntax, nicht auf Existenz * der Kategorien. Funktion URL prüft auf korrekte Syntax, nicht auf Existenz
*/ */
// -- try { // -- try {
@ -272,60 +274,44 @@ public class Loader extends PackageLoader {
// -- } catch (MalformedURLException ex) { // -- } catch (MalformedURLException ex) {
// -- throw new UncheckedWrapperException("Cannot parse url", ex); // -- throw new UncheckedWrapperException("Cannot parse url", ex);
// -- } // -- }
// -- m_customNavPath = new StringParameter( // -- m_customNavPath = new StringParameter(
// -- "com.arsdigita.aplaws.custom_nav_path", // -- "com.arsdigita.aplaws.custom_nav_path",
// -- Parameter.REQUIRED, // -- Parameter.REQUIRED,
// -- "local"); // -- "local");
// -- m_customNavUseContext = new StringParameter( // -- m_customNavUseContext = new StringParameter(
// -- "com.arsdigita.aplaws.custom_nav_use_context", // -- "com.arsdigita.aplaws.custom_nav_use_context",
// -- Parameter.REQUIRED, // -- Parameter.REQUIRED,
// -- "local"); // -- "local");
// -- m_customNavTitle = new StringParameter( // -- m_customNavTitle = new StringParameter(
// -- "com.arsdigita.aplaws.custom_nav_title", // -- "com.arsdigita.aplaws.custom_nav_title",
// -- Parameter.REQUIRED, // -- Parameter.REQUIRED,
// -- "APLAWS Custom Navigation"); // -- "APLAWS Custom Navigation");
// -- m_customNavDesc = new StringParameter( // -- m_customNavDesc = new StringParameter(
// -- "com.arsdigita.aplaws.custom_nav_desc", // -- "com.arsdigita.aplaws.custom_nav_desc",
// -- Parameter.REQUIRED, // -- Parameter.REQUIRED,
// -- "Installation specific navigation tree"); // -- "Installation specific navigation tree");
// -- register(m_customNavDesc); // -- register(m_customNavDesc);
// -- register(m_customNavDomainURL); // -- register(m_customNavDomainURL);
// -- register(m_customNavKey); // -- register(m_customNavKey);
// -- register(m_customNavPath); // -- register(m_customNavPath);
// -- register(m_customNavTitle); // -- register(m_customNavTitle);
// -- register(m_customNavUseContext); // -- register(m_customNavUseContext);
// -- String customNavPath = (String)get(m_customNavPath); // -- String customNavPath = (String)get(m_customNavPath);
// -- String customNavTitle = (String)get(m_customNavTitle); // -- String customNavTitle = (String)get(m_customNavTitle);
// Package com.arsdigita.web // Package com.arsdigita.web
// Application.createApplication(Navigation.BASE_DATA_OBJECT_TYPE, // Application.createApplication(Navigation.BASE_DATA_OBJECT_TYPE,
// customNavPath, // customNavPath,
// customNavTitle, // customNavTitle,
// null); // null);
// -- String customNavDesc = (String)get(m_customNavDesc); // -- String customNavDesc = (String)get(m_customNavDesc);
// -- String customNavKey = (String)get(m_customNavKey); // -- String customNavKey = (String)get(m_customNavKey);
// -- String customNavUseContext = (String)get(m_customNavUseContext); // -- String customNavUseContext = (String)get(m_customNavUseContext);
// -- URL customNavDomainURL = (URL)get(m_customNavDomainURL); // -- URL customNavDomainURL = (URL)get(m_customNavDomainURL);
// -- Domain.create(customNavKey, customNavDomainURL, // -- Domain.create(customNavKey, customNavDomainURL,
// -- customNavTitle, customNavDesc, "1.0.0", new Date()); // -- customNavTitle, customNavDesc, "1.0.0", new Date());
// registerDomain(customNavKey, '/'+customNavPath+'/', null); // registerDomain(customNavKey, '/'+customNavPath+'/', null);
// -- registerDomain(customNavKey, "/content/", customNavUseContext); // -- registerDomain(customNavKey, "/content/", customNavUseContext);
// -- } // -- }
/** /**
* Use Package com.arsdigita.london.terms to register a Domain for * Use Package com.arsdigita.london.terms to register a Domain for
* Categorisation * Categorisation
@ -334,42 +320,46 @@ public class Loader extends PackageLoader {
String appURL, String appURL,
String context) { String context) {
if (s_log.isDebugEnabled()) { if (s_log.isDebugEnabled()) {
s_log.debug("Mapping domain " + domainKey + s_log.debug("Mapping domain " + domainKey + " to app " + appURL
" to app " + appURL + + " in context " + context);
" in context " + context);
} }
Domain domain = Domain.retrieve(domainKey); // package com.arsdigita.london.terms Domain domain = Domain.retrieve(domainKey); // package com.arsdigita.london.terms
Application app = Application.retrieveApplicationForPath(appURL); Application app = Application.retrieveApplicationForPath(appURL);
domain.setAsRootForObject(app, context); domain.setAsRootForObject(app, context);
if (app instanceof ContentSection) { if (app instanceof ContentSection) {
RoleCollection coll = ((ContentSection) app).getStaffGroup().getOrderedRoles(); RoleCollection coll = ((ContentSection) app).getStaffGroup().
getOrderedRoles();
Set adminRoles = new HashSet(); Set adminRoles = new HashSet();
Set categorizeRoles = new HashSet(); Set categorizeRoles = new HashSet();
while (coll.next()) { while (coll.next()) {
Role role = coll.getRole(); Role role = coll.getRole();
final DataQuery privs = RoleFactory.getRolePrivileges final DataQuery privs = RoleFactory.getRolePrivileges(
(app.getID(), role.getGroup().getID()); app.getID(), role.getGroup().getID());
while (privs.next()) { while (privs.next()) {
String priv = (String) privs.get(RoleFactory.PRIVILEGE); String priv = (String) privs.get(RoleFactory.PRIVILEGE);
if (priv.equals(SecurityManager.CMS_CATEGORY_ADMIN)) { if (priv.equals(SecurityManager.CMS_CATEGORY_ADMIN)) {
adminRoles.add(role); adminRoles.add(role);
} else if (priv.equals(SecurityManager.CMS_CATEGORIZE_ITEMS)) { } else if (priv.equals(
SecurityManager.CMS_CATEGORIZE_ITEMS)) {
categorizeRoles.add(role); categorizeRoles.add(role);
} }
} }
} }
RootCategoryCollection catCollection = Category.getRootCategories(((ContentSection) app)); RootCategoryCollection catCollection = Category.getRootCategories(
((ContentSection) app));
while (catCollection.next()) { while (catCollection.next()) {
Iterator adminIter = adminRoles.iterator(); Iterator adminIter = adminRoles.iterator();
while (adminIter.hasNext()) { while (adminIter.hasNext()) {
((Role) adminIter.next()).grantPermission(catCollection.getCategory(), ((Role) adminIter.next()).grantPermission(catCollection.
getCategory(),
PrivilegeDescriptor.ADMIN); PrivilegeDescriptor.ADMIN);
} }
Iterator categorizeIter = categorizeRoles.iterator(); Iterator categorizeIter = categorizeRoles.iterator();
while (categorizeIter.hasNext()) { while (categorizeIter.hasNext()) {
((Role) categorizeIter.next()).grantPermission(catCollection.getCategory(), ((Role) categorizeIter.next()).grantPermission(catCollection.
getCategory(),
Category.MAP_DESCRIPTOR); Category.MAP_DESCRIPTOR);
} }
} }