Formatierungen
git-svn-id: https://svn.libreccm.org/ccm/trunk@1056 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
481d877ad9
commit
ff1f223578
|
|
@ -27,7 +27,8 @@ import org.apache.log4j.Logger;
|
||||||
*/
|
*/
|
||||||
public class ContentItemXMLRenderer extends DomainObjectXMLRenderer {
|
public class ContentItemXMLRenderer extends DomainObjectXMLRenderer {
|
||||||
|
|
||||||
private static final Logger logger = Logger.getLogger(ContentItemXMLRenderer.class);
|
private static final Logger logger =
|
||||||
|
Logger.getLogger(ContentItemXMLRenderer.class);
|
||||||
private String m_propertyName = "";
|
private String m_propertyName = "";
|
||||||
private String m_keyName = "";
|
private String m_keyName = "";
|
||||||
private String m_relationAttribute = "";
|
private String m_relationAttribute = "";
|
||||||
|
|
@ -42,16 +43,17 @@ public class ContentItemXMLRenderer extends DomainObjectXMLRenderer {
|
||||||
// Otherwise this methd will do nothing.
|
// Otherwise this methd will do nothing.
|
||||||
@Override
|
@Override
|
||||||
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) {
|
||||||
|
|
||||||
DomainObject nObj = obj;
|
DomainObject nObj = obj;
|
||||||
|
|
||||||
if (nObj instanceof ContentBundle) {
|
if (nObj instanceof ContentBundle) {
|
||||||
|
|
||||||
nObj = ((ContentBundle) obj).negotiate(DispatcherHelper.getRequest().getLocales());
|
nObj = ((ContentBundle) obj).negotiate(DispatcherHelper.getRequest().
|
||||||
|
getLocales());
|
||||||
}
|
}
|
||||||
|
|
||||||
super.walk(adapter, nObj, path, context, linkObject);
|
super.walk(adapter, nObj, path, context, linkObject);
|
||||||
|
|
@ -59,8 +61,8 @@ public class ContentItemXMLRenderer extends DomainObjectXMLRenderer {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void handleAttribute(DomainObject obj,
|
protected void handleAttribute(DomainObject obj,
|
||||||
String path,
|
String path,
|
||||||
Property property) {
|
Property property) {
|
||||||
|
|
||||||
String propertyName = property.getName();
|
String propertyName = property.getName();
|
||||||
|
|
||||||
|
|
@ -70,7 +72,8 @@ public class ContentItemXMLRenderer extends DomainObjectXMLRenderer {
|
||||||
super.handleAttribute(obj, path, property);
|
super.handleAttribute(obj, path, property);
|
||||||
|
|
||||||
Element element = newElement(m_element, "country");
|
Element element = newElement(m_element, "country");
|
||||||
element.setText(GenericAddress.getCountryNameFromIsoCode(((GenericAddress) obj).getIsoCountryCode()));
|
element.setText(GenericAddress.getCountryNameFromIsoCode(((GenericAddress) obj).
|
||||||
|
getIsoCountryCode()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -81,16 +84,19 @@ public class ContentItemXMLRenderer extends DomainObjectXMLRenderer {
|
||||||
|
|
||||||
// The RelationAttribute is part of this domain object as field
|
// The RelationAttribute is part of this domain object as field
|
||||||
if (obj instanceof RelationAttributeInterface
|
if (obj instanceof RelationAttributeInterface
|
||||||
&& ((RelationAttributeInterface) obj).hasRelationAttributeProperty(propertyName)) {
|
&& ((RelationAttributeInterface) obj).
|
||||||
|
hasRelationAttributeProperty(propertyName)) {
|
||||||
|
|
||||||
RelationAttributeInterface relationAttributeObject = (RelationAttributeInterface) obj;
|
RelationAttributeInterface relationAttributeObject =
|
||||||
key = relationAttributeObject.getRelationAttributeKey(propertyName);
|
(RelationAttributeInterface) obj;
|
||||||
|
key = relationAttributeObject.getRelationAttributeKey(
|
||||||
|
propertyName);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// This RelationAttribute is part of an n:m association as link attribute
|
// This RelationAttribute is part of an n:m association as link attribute
|
||||||
if (obj instanceof LinkDomainObject
|
if (obj instanceof LinkDomainObject
|
||||||
&& propertyName.equals(m_keyName)) {
|
&& propertyName.equals(m_keyName)) {
|
||||||
key = (String) ((LinkDomainObject) obj).get(m_keyName);
|
key = (String) ((LinkDomainObject) obj).get(m_keyName);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -98,12 +104,20 @@ public class ContentItemXMLRenderer extends DomainObjectXMLRenderer {
|
||||||
// Replace value of the property defined in RELATION_ATTRIBUTES string
|
// Replace value of the property defined in RELATION_ATTRIBUTES string
|
||||||
// of the primary domain object with the localized String.
|
// of the primary domain object with the localized String.
|
||||||
if (!key.isEmpty()) {
|
if (!key.isEmpty()) {
|
||||||
logger.debug(String.format("Getting relation attribute value for key '%s' of relation attribute '%s'", key, m_relationAttribute));
|
logger.debug(String.format(
|
||||||
RelationAttributeCollection relationAttributeCollection = new RelationAttributeCollection(m_relationAttribute, key);
|
"Getting relation attribute value for key '%s' of relation attribute '%s'",
|
||||||
relationAttributeCollection.addLanguageFilter(DispatcherHelper.getNegotiatedLocale().getLanguage());
|
key, m_relationAttribute));
|
||||||
Element element = newElement(m_element, m_keyName);
|
RelationAttributeCollection relationAttributeCollection =
|
||||||
element.setText(relationAttributeCollection.getName());
|
new RelationAttributeCollection(
|
||||||
relationAttributeCollection.close();
|
m_relationAttribute, key);
|
||||||
|
relationAttributeCollection.addLanguageFilter(DispatcherHelper.
|
||||||
|
getNegotiatedLocale().getLanguage());
|
||||||
|
if (relationAttributeCollection.size() > 0) {
|
||||||
|
relationAttributeCollection.next();
|
||||||
|
Element element = newElement(m_element, m_keyName);
|
||||||
|
element.setText(relationAttributeCollection.getName());
|
||||||
|
relationAttributeCollection.close();
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -112,25 +126,31 @@ public class ContentItemXMLRenderer extends DomainObjectXMLRenderer {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void beginAssociation(DomainObject obj, String path, Property property) {
|
protected void beginAssociation(DomainObject obj, String path,
|
||||||
|
Property property) {
|
||||||
super.beginAssociation(obj, path, property);
|
super.beginAssociation(obj, path, property);
|
||||||
|
|
||||||
String propertyName = property.getName();
|
String propertyName = property.getName();
|
||||||
|
|
||||||
if (obj instanceof RelationAttributeInterface
|
if (obj instanceof RelationAttributeInterface
|
||||||
&& ((RelationAttributeInterface) obj).hasRelationAttributeProperty(propertyName)) {
|
&& ((RelationAttributeInterface) obj).hasRelationAttributeProperty(
|
||||||
|
propertyName)) {
|
||||||
|
|
||||||
RelationAttributeInterface relationAttributeObject = (RelationAttributeInterface) obj;
|
RelationAttributeInterface relationAttributeObject =
|
||||||
|
(RelationAttributeInterface) obj;
|
||||||
|
|
||||||
m_propertyName = propertyName;
|
m_propertyName = propertyName;
|
||||||
m_keyName = relationAttributeObject.getRelationAttributeKeyName(propertyName);
|
m_keyName = relationAttributeObject.getRelationAttributeKeyName(
|
||||||
m_relationAttribute = relationAttributeObject.getRelationAttributeName(propertyName);
|
propertyName);
|
||||||
|
m_relationAttribute = relationAttributeObject.
|
||||||
|
getRelationAttributeName(propertyName);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void endAssociation(DomainObject obj, String path, Property property) {
|
protected void endAssociation(DomainObject obj, String path,
|
||||||
|
Property property) {
|
||||||
|
|
||||||
m_propertyName = "";
|
m_propertyName = "";
|
||||||
m_keyName = "";
|
m_keyName = "";
|
||||||
|
|
|
||||||
|
|
@ -211,7 +211,7 @@ public class GenericPersonContactTable extends Table implements
|
||||||
lang).getName();
|
lang).getName();
|
||||||
|
|
||||||
// Close collection to prevent open ResultSet
|
// Close collection to prevent open ResultSet
|
||||||
contacttypes.close();
|
//contacttypes.close();
|
||||||
|
|
||||||
return name;
|
return name;
|
||||||
case 1:
|
case 1:
|
||||||
|
|
|
||||||
|
|
@ -251,7 +251,7 @@ public class ConfigRegistry {
|
||||||
* @param context a subclass of {@link
|
* @param context a subclass of {@link
|
||||||
* com.arsdigita.runtime.AbstractConfig}
|
* com.arsdigita.runtime.AbstractConfig}
|
||||||
*
|
*
|
||||||
* @return true iff this ConfigRegistry contains a mapping for
|
* @return true if this ConfigRegistry contains a mapping for
|
||||||
* <code>context</code>
|
* <code>context</code>
|
||||||
**/
|
**/
|
||||||
public boolean isConfigured(Class context) {
|
public boolean isConfigured(Class context) {
|
||||||
|
|
@ -337,7 +337,7 @@ public class ConfigRegistry {
|
||||||
String storage = attrs.getValue(uri, "storage");
|
String storage = attrs.getValue(uri, "storage");
|
||||||
// XXX: Is there a better way to handle errors that
|
// XXX: Is there a better way to handle errors that
|
||||||
// includes line number information?
|
// includes line number information?
|
||||||
if (klass == null || storage == null) {
|
if ((klass == null) || (storage == null)) {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"class and storage attributes are required");
|
"class and storage attributes are required");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue