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 {
|
||||
|
||||
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_keyName = "";
|
||||
private String m_relationAttribute = "";
|
||||
|
|
@ -51,7 +52,8 @@ public class ContentItemXMLRenderer extends DomainObjectXMLRenderer {
|
|||
|
||||
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);
|
||||
|
|
@ -70,7 +72,8 @@ public class ContentItemXMLRenderer extends DomainObjectXMLRenderer {
|
|||
super.handleAttribute(obj, path, property);
|
||||
|
||||
Element element = newElement(m_element, "country");
|
||||
element.setText(GenericAddress.getCountryNameFromIsoCode(((GenericAddress) obj).getIsoCountryCode()));
|
||||
element.setText(GenericAddress.getCountryNameFromIsoCode(((GenericAddress) obj).
|
||||
getIsoCountryCode()));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -81,10 +84,13 @@ public class ContentItemXMLRenderer extends DomainObjectXMLRenderer {
|
|||
|
||||
// The RelationAttribute is part of this domain object as field
|
||||
if (obj instanceof RelationAttributeInterface
|
||||
&& ((RelationAttributeInterface) obj).hasRelationAttributeProperty(propertyName)) {
|
||||
&& ((RelationAttributeInterface) obj).
|
||||
hasRelationAttributeProperty(propertyName)) {
|
||||
|
||||
RelationAttributeInterface relationAttributeObject = (RelationAttributeInterface) obj;
|
||||
key = relationAttributeObject.getRelationAttributeKey(propertyName);
|
||||
RelationAttributeInterface relationAttributeObject =
|
||||
(RelationAttributeInterface) obj;
|
||||
key = relationAttributeObject.getRelationAttributeKey(
|
||||
propertyName);
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -98,12 +104,20 @@ public class ContentItemXMLRenderer extends DomainObjectXMLRenderer {
|
|||
// Replace value of the property defined in RELATION_ATTRIBUTES string
|
||||
// of the primary domain object with the localized String.
|
||||
if (!key.isEmpty()) {
|
||||
logger.debug(String.format("Getting relation attribute value for key '%s' of relation attribute '%s'", key, m_relationAttribute));
|
||||
RelationAttributeCollection relationAttributeCollection = new RelationAttributeCollection(m_relationAttribute, key);
|
||||
relationAttributeCollection.addLanguageFilter(DispatcherHelper.getNegotiatedLocale().getLanguage());
|
||||
logger.debug(String.format(
|
||||
"Getting relation attribute value for key '%s' of relation attribute '%s'",
|
||||
key, m_relationAttribute));
|
||||
RelationAttributeCollection relationAttributeCollection =
|
||||
new RelationAttributeCollection(
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -112,25 +126,31 @@ public class ContentItemXMLRenderer extends DomainObjectXMLRenderer {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void beginAssociation(DomainObject obj, String path, Property property) {
|
||||
protected void beginAssociation(DomainObject obj, String path,
|
||||
Property property) {
|
||||
super.beginAssociation(obj, path, property);
|
||||
|
||||
String propertyName = property.getName();
|
||||
|
||||
if (obj instanceof RelationAttributeInterface
|
||||
&& ((RelationAttributeInterface) obj).hasRelationAttributeProperty(propertyName)) {
|
||||
&& ((RelationAttributeInterface) obj).hasRelationAttributeProperty(
|
||||
propertyName)) {
|
||||
|
||||
RelationAttributeInterface relationAttributeObject = (RelationAttributeInterface) obj;
|
||||
RelationAttributeInterface relationAttributeObject =
|
||||
(RelationAttributeInterface) obj;
|
||||
|
||||
m_propertyName = propertyName;
|
||||
m_keyName = relationAttributeObject.getRelationAttributeKeyName(propertyName);
|
||||
m_relationAttribute = relationAttributeObject.getRelationAttributeName(propertyName);
|
||||
m_keyName = relationAttributeObject.getRelationAttributeKeyName(
|
||||
propertyName);
|
||||
m_relationAttribute = relationAttributeObject.
|
||||
getRelationAttributeName(propertyName);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void endAssociation(DomainObject obj, String path, Property property) {
|
||||
protected void endAssociation(DomainObject obj, String path,
|
||||
Property property) {
|
||||
|
||||
m_propertyName = "";
|
||||
m_keyName = "";
|
||||
|
|
|
|||
|
|
@ -211,7 +211,7 @@ public class GenericPersonContactTable extends Table implements
|
|||
lang).getName();
|
||||
|
||||
// Close collection to prevent open ResultSet
|
||||
contacttypes.close();
|
||||
//contacttypes.close();
|
||||
|
||||
return name;
|
||||
case 1:
|
||||
|
|
|
|||
|
|
@ -251,7 +251,7 @@ public class ConfigRegistry {
|
|||
* @param context a subclass of {@link
|
||||
* 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>
|
||||
**/
|
||||
public boolean isConfigured(Class context) {
|
||||
|
|
@ -337,7 +337,7 @@ public class ConfigRegistry {
|
|||
String storage = attrs.getValue(uri, "storage");
|
||||
// XXX: Is there a better way to handle errors that
|
||||
// includes line number information?
|
||||
if (klass == null || storage == null) {
|
||||
if ((klass == null) || (storage == null)) {
|
||||
throw new IllegalArgumentException(
|
||||
"class and storage attributes are required");
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue