]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CSPACE-5492: Added code that places a refname in the collection space core schema...
authorRichard Millet <remillet@berkeley.edu>
Sat, 1 Sep 2012 00:35:54 +0000 (17:35 -0700)
committerRichard Millet <remillet@berkeley.edu>
Sat, 1 Sep 2012 00:35:54 +0000 (17:35 -0700)
12 files changed:
services/authority/jaxb/src/main/java/org/collectionspace/services/common/vocabulary/AuthorityItemJAXBSchema.java
services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/AuthorityResource.java
services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/nuxeo/AuthorityDocumentModelHandler.java
services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/nuxeo/AuthorityItemDocumentModelHandler.java
services/common-api/src/main/java/org/collectionspace/services/common/api/RefName.java
services/common/src/main/cspace/config/services/tenants/tenant-bindings-proto.xml
services/common/src/main/java/org/collectionspace/services/common/document/AbstractDocumentHandlerImpl.java
services/common/src/main/java/org/collectionspace/services/common/storage/jpa/JpaDocumentHandler.java
services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/DocHandlerBase.java
services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/DocumentModelHandler.java
services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/RemoteDocumentModelHandlerImpl.java
services/config/src/main/resources/service.xsd

index b2f9caa9b3f05e48655aca4c8cbe3c671c713f1d..e48c29eac0023de95a67c6e9d4002a11604eea60 100644 (file)
@@ -28,7 +28,7 @@ package org.collectionspace.services.common.vocabulary;
  */\r
 public interface AuthorityItemJAXBSchema {\r
 \r
-    final static String IN_AUTHORITY = "inAuthority";\r
+    final static String IN_AUTHORITY = "inAuthority"; // REM - Is this a CSID? Or a refname? Either?\r
     final static String REF_NAME = "refName";\r
     final static String ORDER = "order";\r
     final static String SHORT_IDENTIFIER = "shortIdentifier";\r
index 0d22a5bfd733f20b8da4a96c3a299b259387829e..1852ce0f482531810b6127588b233b1c90c9b834 100644 (file)
@@ -254,7 +254,7 @@ public abstract class AuthorityResource<AuthCommon, AuthItemHandler>
 
     protected String buildAuthorityRefNameBase(
             ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx, String shortIdentifier) {
-        RefName.Authority authority = RefName.buildAuthority(ctx.getTenantName(),
+        RefName.Authority authority = RefName.Authority.buildAuthority(ctx.getTenantName(),
                 ctx.getServiceName(), shortIdentifier, null);
         return authority.toString();
     }
index 28953ba353466190e089b3962bbe7dae47469409..d611aa0a1feca4f3f4709b02fe5eece33608c46b 100644 (file)
@@ -28,6 +28,7 @@ import java.util.Map;
 import org.collectionspace.services.client.PoxPayloadIn;
 import org.collectionspace.services.client.PoxPayloadOut;
 import org.collectionspace.services.common.api.RefName;
+import org.collectionspace.services.common.api.RefName.Authority;
 import org.collectionspace.services.common.api.Tools;
 import org.collectionspace.services.common.context.MultipartServiceContext;
 import org.collectionspace.services.common.context.ServiceContext;
@@ -40,6 +41,8 @@ import org.collectionspace.services.nuxeo.client.java.RepositoryJavaClientImpl;
 import org.nuxeo.ecm.core.api.ClientException;
 import org.nuxeo.ecm.core.api.DocumentModel;
 import org.nuxeo.ecm.core.api.repository.RepositoryInstance;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * AuthorityDocumentModelHandler
@@ -50,6 +53,7 @@ import org.nuxeo.ecm.core.api.repository.RepositoryInstance;
 public abstract class AuthorityDocumentModelHandler<AuthCommon>
         extends DocHandlerBase<AuthCommon> {
 
+    private final Logger logger = LoggerFactory.getLogger(AuthorityDocumentModelHandler.class);        
     private String authorityCommonSchemaName;
 
     public AuthorityDocumentModelHandler(String authorityCommonSchemaName) {
@@ -112,17 +116,42 @@ public abstract class AuthorityDocumentModelHandler<AuthCommon>
      */
     protected void updateRefnameForAuthority(DocumentWrapper<DocumentModel> wrapDoc, String schemaName) throws Exception {
         DocumentModel docModel = wrapDoc.getWrappedObject();
-        String shortIdentifier = (String) docModel.getProperty(schemaName, AuthorityJAXBSchema.SHORT_IDENTIFIER);
-        String displayName = (String) docModel.getProperty(schemaName, AuthorityJAXBSchema.DISPLAY_NAME);
-        MultipartServiceContext ctx = (MultipartServiceContext) getServiceContext();
-        RefName.Authority authority = RefName.buildAuthority(ctx.getTenantName(),
-                ctx.getServiceName(),
-                shortIdentifier,
-                displayName);
+        RefName.Authority authority = (Authority) getRefName(getServiceContext(), docModel);
         String refName = authority.toString();
         docModel.setProperty(schemaName, AuthorityJAXBSchema.REF_NAME, refName);
     }
-
+    
+    @Override
+    public RefName.RefNameInterface getRefName(ServiceContext ctx,
+               DocumentModel docModel) {
+       RefName.RefNameInterface refname = null;
+
+       try {
+               String shortIdentifier = (String) docModel.getProperty(authorityCommonSchemaName, AuthorityJAXBSchema.SHORT_IDENTIFIER);
+               String displayName = (String) docModel.getProperty(authorityCommonSchemaName, AuthorityJAXBSchema.DISPLAY_NAME);
+               RefName.Authority authority = RefName.Authority.buildAuthority(ctx.getTenantName(),
+                       ctx.getServiceName(),
+                       shortIdentifier,
+                       displayName);
+       } catch (Exception e) {
+               logger.error(e.getMessage(), e);
+       }
+       
+       return refname;
+    }
+    
+    @Override
+    protected String getRefnameDisplayName(DocumentWrapper<DocumentModel> docWrapper) {
+       String result = null;
+       
+       DocumentModel docModel = docWrapper.getWrappedObject();
+       ServiceContext ctx = this.getServiceContext();
+       RefName.Authority refname = (RefName.Authority)getRefName(ctx, docModel);
+       result = refname.getDisplayName();
+       
+       return result;
+    }    
+    
     public String getShortIdentifier(String authCSID, String schemaName) throws Exception {
         String shortIdentifier = null;
         RepositoryInstance repoSession = null;
index 2202b1603f8dc79b29468dcd11a31263623ad447..7f3db3f3e1473314d5559dfb5e812a5d370b3ae4 100644 (file)
@@ -37,6 +37,7 @@ import org.collectionspace.services.common.context.ServiceContext;
 import org.collectionspace.services.common.document.DocumentException;
 import org.collectionspace.services.common.document.DocumentFilter;
 import org.collectionspace.services.common.document.DocumentWrapper;
+import org.collectionspace.services.common.document.DocumentWrapperImpl;
 import org.collectionspace.services.common.vocabulary.AuthorityJAXBSchema;
 import org.collectionspace.services.common.vocabulary.AuthorityItemJAXBSchema;
 import org.collectionspace.services.common.vocabulary.RefNameServiceUtils;
@@ -95,6 +96,54 @@ public abstract class AuthorityItemDocumentModelHandler<AICommon>
         this.authorityItemCommonSchemaName = authorityItemCommonSchemaName;
     }
 
+    @Override
+    protected String getRefnameDisplayName(DocumentWrapper<DocumentModel> docWrapper) {
+       String result = null;
+       
+       DocumentModel docModel = docWrapper.getWrappedObject();
+       ServiceContext ctx = this.getServiceContext();
+       RefName.AuthorityItem refname = (RefName.AuthorityItem)getRefName(ctx, docModel);
+       result = refname.getDisplayName();
+       
+       return result;
+    }
+    
+    /*
+     * Before calling this method, be sure that the 'this.handleCreate()' was called and was successful.
+     * (non-Javadoc)
+     * @see org.collectionspace.services.nuxeo.client.java.DocumentModelHandler#getRefName(org.collectionspace.services.common.context.ServiceContext, org.nuxeo.ecm.core.api.DocumentModel)
+     */
+    @Override
+    public RefName.RefNameInterface getRefName(ServiceContext ctx,
+               DocumentModel docModel) {
+       RefName.RefNameInterface refname = null;
+       
+       try {
+               String shortIdentifier = (String) docModel.getProperty(authorityItemCommonSchemaName, AuthorityItemJAXBSchema.SHORT_IDENTIFIER);
+               if (Tools.isEmpty(shortIdentifier)) {
+                   throw new Exception("The shortIdentifier for this authority term was empty or not set.");
+               }
+               
+               String displayName = getPrimaryDisplayName(docModel, authorityItemCommonSchemaName,
+                           getItemTermInfoGroupXPathBase(), AuthorityItemJAXBSchema.TERM_DISPLAY_NAME);
+               if (Tools.isEmpty(displayName)) {
+                   throw new Exception("The displayName for this authority term was empty or not set.");
+               }
+               
+               String authorityRefBaseName = getAuthorityRefNameBase();
+               if (Tools.isEmpty(authorityRefBaseName)) {
+                   throw new Exception("Could not create the refName for this authority term, because the refName for its authority parent was empty.");
+               }
+               
+               RefName.Authority parentsRefName = RefName.Authority.parse(authorityRefBaseName);
+               refname = RefName.buildAuthorityItem(parentsRefName, shortIdentifier, displayName);
+       } catch (Exception e) {
+               logger.error(e.getMessage(), e);
+       }
+
+        return refname;
+    }
+    
     public void setInAuthority(String inAuthority) {
         this.inAuthority = inAuthority;
     }
@@ -365,17 +414,9 @@ public abstract class AuthorityItemDocumentModelHandler<AICommon>
             String schemaName,
             String authorityRefBaseName) throws Exception {
         DocumentModel docModel = wrapDoc.getWrappedObject();
-        String shortIdentifier = (String) docModel.getProperty(schemaName, AuthorityItemJAXBSchema.SHORT_IDENTIFIER);
-        String displayName = getPrimaryDisplayName(docModel, authorityItemCommonSchemaName,
-                    getItemTermInfoGroupXPathBase(), AuthorityItemJAXBSchema.TERM_DISPLAY_NAME);
-        
-        if (Tools.isEmpty(authorityRefBaseName)) {
-            throw new Exception("Could not create the refName for this authority term, because the refName for its authority parent was empty.");
-        }
-        
-        RefName.Authority authority = RefName.Authority.parse(authorityRefBaseName);
-        String refName = RefName.buildAuthorityItem(authority, shortIdentifier, displayName).toString();
-        docModel.setProperty(schemaName, AuthorityItemJAXBSchema.REF_NAME, refName);
+        RefName.RefNameInterface refname = getRefName(this.getServiceContext(), docModel);
+        String refNameStr = refname.toString();
+        docModel.setProperty(schemaName, AuthorityItemJAXBSchema.REF_NAME, refNameStr);
     }
 
     /**
index 053d9bb4c2080206cacdfab260a0c28192ae521b..b0a72c4fe3f1c1f02ac67c57716aa76faec69058 100644 (file)
@@ -51,8 +51,12 @@ public class RefName {
     public static final String URN_PREFIX = "urn:cspace:";\r
     public static final String URN_NAME_PREFIX = "urn:cspace:name";\r
     public static final String REFNAME = "refName";\r
+    \r
+    public static interface RefNameInterface {\r
+       public String toString();\r
+    }\r
 \r
-    public static class Authority {\r
+    public static class Authority implements RefNameInterface {\r
 \r
         public String tenantName = "";\r
         public String resource = "";\r
@@ -71,6 +75,10 @@ public class RefName {
             return authority;\r
         }\r
 \r
+        public String getDisplayName() {\r
+               return this.getDisplayName();\r
+        }\r
+        \r
         public String getShortIdentifier() {\r
             return this.shortIdentifier;\r
         }\r
@@ -111,7 +119,7 @@ public class RefName {
         }\r
     }\r
 \r
-    public static class AuthorityItem {\r
+    public static class AuthorityItem implements RefNameInterface {\r
 \r
         public Authority inAuthority;\r
         public String shortIdentifier = "";\r
@@ -129,6 +137,10 @@ public class RefName {
             return authorityItem;\r
         }\r
 \r
+        public String getDisplayName() {\r
+               return this.displayName;\r
+        }\r
+        \r
         public String getParentShortIdentifier() {\r
             return this.inAuthority.shortIdentifier;\r
         }\r
@@ -171,10 +183,10 @@ public class RefName {
         }\r
     }\r
 \r
-    public static AuthorityItem buildAuthorityItem(String tenantName, String serviceName, String authorityShortIdentifier,\r
-            String itemShortIdentifier, String itemDisplayName) {\r
-        Authority authority = Authority.buildAuthority(tenantName, serviceName, authorityShortIdentifier, "");\r
-        return buildAuthorityItem(authority, itemShortIdentifier, itemDisplayName);\r
+    public static AuthorityItem buildAuthorityItem(String tenantName, String serviceName, String authorityShortID,\r
+            String itemShortID, String itemDisplayName) {\r
+        Authority authority = Authority.buildAuthority(tenantName, serviceName, authorityShortID, "");\r
+        return buildAuthorityItem(authority, itemShortID, itemDisplayName);\r
     }\r
 \r
     public static AuthorityItem buildAuthorityItem(String authorityRefName, String itemShortID, String itemDisplayName) {\r
@@ -183,10 +195,10 @@ public class RefName {
         return item;\r
     }\r
 \r
-    public static AuthorityItem buildAuthorityItem(Authority authority, String itemShortIdentifier, String itemDisplayName) {\r
+    public static AuthorityItem buildAuthorityItem(Authority authority, String itemShortID, String itemDisplayName) {\r
         AuthorityItem item = new AuthorityItem();\r
         item.inAuthority = authority;\r
-        item.shortIdentifier = itemShortIdentifier;\r
+        item.shortIdentifier = itemShortID;\r
         item.displayName = itemDisplayName;\r
         return item;\r
     }\r
index e377c5d95897aaf2d55358d6826e23f66252467c..d3f151e0ffc5a34e1b47049a420bfa6e5846385e 100644 (file)
             <service:documentHandler xmlns:service="http://collectionspace.org/services/config/service">org.collectionspace.services.collectionobject.nuxeo.CollectionObjectDocumentModelHandler</service:documentHandler>
             <service:DocHandlerParams xmlns:service="http://collectionspace.org/services/config/service">
                 <service:params>
+                       <service:SupportsHierarchy>false</service:SupportsHierarchy>
+                       <service:RefnameDisplayNameField>
+                        <service:ListResultField>
+                            <service:element>objectNumber</service:element>
+                            <service:xpath>objectNumber</service:xpath>
+                        </service:ListResultField>
+                       </service:RefnameDisplayNameField>
                     <service:ListResultsFields>
                         <service:ListResultField>
                             <service:element>objectNumber</service:element>
             <service:DocHandlerParams xmlns:service="http://collectionspace.org/services/config/service">
                 <service:params>
                        <service:SupportsHierarchy>true</service:SupportsHierarchy>
+                       <service:RefnameDisplayNameField>
+                        <service:ListResultField>
+                            <service:element>order</service:element>
+                            <service:xpath>order</service:xpath>
+                        </service:ListResultField>
+                       </service:RefnameDisplayNameField>
                     <service:ListResultsFields>
                         <!-- Omit the standard AuthorityItem fields (they are handled by the code) -->
                         <service:ListResultField>
index 0b9edbaef05e823f36a698329a4efe9488acfa78..e130ac95cc37a55711bbc6a2e504e768d34145aa 100644 (file)
@@ -28,6 +28,8 @@ import java.util.List;
 import java.util.Map;
 
 import java.util.StringTokenizer;
+
+import org.collectionspace.services.common.api.RefName;
 import org.collectionspace.services.common.context.ServiceContext;
 import org.collectionspace.services.common.query.QueryContext;
 
@@ -66,6 +68,13 @@ public abstract class AbstractDocumentHandlerImpl<T, TL, WT, WTL>
        // Empty constructor
     }
 
+    abstract protected String getRefnameDisplayName(DocumentWrapper<WT> docWrapper);
+    
+    /*
+     * Should return a reference name for the wrapper object
+     */
+    abstract public RefName.RefNameInterface getRefName(DocumentWrapper<WT> docWrapper, String tenantName, String serviceName);
+    
     /* (non-Javadoc)
      * @see org.collectionspace.services.common.document.DocumentHandler#getServiceContext()
      */
index cc495124d86e2bc3e978d1ddf00952d8d8a5913c..49e4f91556f04ac0d41b04f6b55adfb82923e939 100644 (file)
@@ -2,6 +2,7 @@ package org.collectionspace.services.common.storage.jpa;
 \r
 import java.util.List;\r
 \r
+import org.collectionspace.services.common.api.RefName;\r
 import org.collectionspace.services.common.document.AbstractDocumentHandlerImpl;\r
 import org.collectionspace.services.common.document.DocumentFilter;\r
 import org.collectionspace.services.common.document.DocumentWrapper;\r
@@ -13,6 +14,19 @@ import org.nuxeo.ecm.core.api.DocumentModel;
 public abstract class JpaDocumentHandler<T, TL, WT, WLT>\r
        extends AbstractDocumentHandlerImpl<T, TL, WT, WLT>{\r
 \r
+       @Override\r
+       protected String getRefnameDisplayName(DocumentWrapper<WT> wrapDoc) {\r
+               return ""; // Empty string since we don't yet support this feature in JPA documents\r
+       }\r
+       \r
+       @Override\r
+       public RefName.RefNameInterface getRefName(DocumentWrapper<WT> docWrapper, String tenantName, String serviceName) {\r
+               //\r
+               // Not implemented\r
+               //\r
+               return null;\r
+       }\r
+       \r
     /**\r
      * Extract paging info.\r
      *\r
index b6a3154686057249e755a0289d1f64ac55717ff8..abf6e796db90ae25891b009d6aec21377048ffaf 100644 (file)
@@ -157,7 +157,7 @@ public abstract class DocHandlerBase<T> extends RemoteDocumentModelHandlerImpl<T
                return result;\r
        }\r
        \r
-       protected static String getUpdatedAtAsString(DocumentModel docModel) throws Exception {\r
+       public static String getUpdatedAtAsString(DocumentModel docModel) throws Exception {\r
                        GregorianCalendar cal = (GregorianCalendar)\r
                                                                docModel.getProperty(CollectionSpaceClient.COLLECTIONSPACE_CORE_SCHEMA,\r
                                                                                CollectionSpaceClient.COLLECTIONSPACE_CORE_UPDATED_AT);\r
@@ -176,7 +176,7 @@ public abstract class DocHandlerBase<T> extends RemoteDocumentModelHandlerImpl<T
        \r
        AbstractServiceContextImpl sc = (AbstractServiceContextImpl)getServiceContext();\r
        MultivaluedMap<String, String> queryParams = getServiceContext().getQueryParams();\r
-       markRtSbj = queryParams.getFirst(IQueryManager.MARK_RELATED_TO_CSID_AS_SUBJECT);\r
+       markRtSbj = queryParams.getFirst(IQueryManager.MARK_RELATED_TO_CSID_AS_SUBJECT);  // REM - We need to document what this query param is for -i.e., what's its purpose?\r
        if(markRtSbj!=null && markRtSbj.isEmpty())\r
                markRtSbj = null;\r
   \r
@@ -244,13 +244,7 @@ public abstract class DocHandlerBase<T> extends RemoteDocumentModelHandlerImpl<T
                                        if (schema == null || schema.trim().isEmpty()) {\r
                                                schema = commonSchema;\r
                                        }\r
-                                       Object value = getListResultValue(docModel, schema, field);\r
-                                       if (value != null && value instanceof String) {\r
-                                               String strValue = (String) value;\r
-                                               if (strValue.trim().isEmpty() == true) {\r
-                                                       value = null;\r
-                                               }\r
-                                       }\r
+                                       Object value = getStringValue(docModel, schema, field);\r
                                        if (value != null) {\r
                                                item.put(field.getElement(), value);\r
                                        }\r
index 537f234eec0ed39ecb4e03f0ac86575a134b9519..e0b92cd1f0a268e1aae795c4de4b0f5b40e5b341 100644 (file)
@@ -41,6 +41,7 @@ import org.collectionspace.services.common.context.ServiceContext;
 import org.collectionspace.services.common.document.AbstractMultipartDocumentHandlerImpl;
 import org.collectionspace.services.common.document.DocumentFilter;
 import org.collectionspace.services.common.document.DocumentWrapper;
+import org.collectionspace.services.common.document.DocumentWrapperImpl;
 import org.collectionspace.services.nuxeo.util.NuxeoUtils;
 import org.collectionspace.services.common.query.QueryContext;
 import org.collectionspace.services.common.repository.RepositoryClient;
@@ -300,13 +301,32 @@ public abstract class DocumentModelHandler<T, TL>
     abstract public AuthorityRefList getAuthorityRefs(String csid,
                List<AuthRefConfigInfo> authRefsInfo) throws PropertyException;    
 
+    /*
+     * Subclasses should override this method if they need to customize their refname generation
+     */
+    public RefName.RefNameInterface getRefName(ServiceContext ctx,
+               DocumentModel docModel) {
+       return getRefName(new DocumentWrapperImpl<DocumentModel>(docModel), ctx.getTenantName(), ctx.getServiceName());
+    }
+    
+    @Override
+       public RefName.RefNameInterface getRefName(DocumentWrapper<DocumentModel> docWrapper,
+                       String tenantName, String serviceName) {
+       DocumentModel docModel = docWrapper.getWrappedObject();
+       String csid = docModel.getName();
+       String refnameDisplayName = this.getRefnameDisplayName(docWrapper);
+       RefName.RefNameInterface refname = RefName.Authority.buildAuthority(tenantName, serviceName,
+                       csid, refnameDisplayName);
+       return refname;
+       }
+
     private void handleCoreValues(DocumentWrapper<DocumentModel> docWrapper, 
                Action action)  throws ClientException {
        DocumentModel documentModel = docWrapper.getWrappedObject();
         String now = GregorianCalendarDateTimeUtils.timestampUTC();
        ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = getServiceContext();
        String userId = ctx.getUserId();
-       if(action==Action.CREATE) {
+       if (action == Action.CREATE) {
             //
             // Add the tenant ID value to the new entity
             //
@@ -321,9 +341,7 @@ public abstract class DocumentModelHandler<T, TL>
             //
             // Add the resource's refname
             //
-            String csid = documentModel.getName();
-            String refname = RefName.Authority.buildAuthority(ctx.getTenantName(), ctx.getServiceName(),
-                       csid, "" /*authorityDisplayName*/).toString();
+            String refname = getRefName(ctx, documentModel).toString();
             documentModel.setProperty(CollectionSpaceClient.COLLECTIONSPACE_CORE_SCHEMA,
                        CollectionSpaceClient.COLLECTIONSPACE_CORE_REFNAME, refname);            
                //
index 6f6a1e3c6bfe47e1a75dba8b9d0e4ce632b2f9d3..ba58abf3035edebe535088746aef8588eae16bf7 100644 (file)
@@ -135,6 +135,35 @@ public abstract class   RemoteDocumentModelHandlerImpl<T, TL>
                                + sb.getName());
        }
     
+    @Override
+    protected String getRefnameDisplayName(DocumentWrapper<DocumentModel> docWrapper) {
+       return getRefnameDisplayName(docWrapper.getWrappedObject());
+    }
+       
+       private String getRefnameDisplayName(DocumentModel docModel) {
+               String result = null;
+               
+       DocHandlerParams.Params params = null;
+       try {
+                       params = getDocHandlerParams();
+                       ListResultField field = params.getRefnameDisplayNameField();
+                       
+                       String schema = field.getSchema();
+                       if (schema == null || schema.trim().isEmpty()) {
+                               schema = getServiceContext().getCommonPartLabel();
+                       }
+                       
+                       result = getStringValue(docModel, schema, field);
+               } catch (Exception e) {
+                       // TODO Auto-generated catch block
+                       if (logger.isWarnEnabled()) {
+                               logger.warn(String.format("Call failed to getRefnameDisplayName() for class %s", this.getClass().getName()));
+                       }
+               }
+               
+               return result;
+       }
+       
     @Override
     public boolean supportsHierarchy() {
        boolean result = false;
@@ -806,8 +835,22 @@ public abstract class   RemoteDocumentModelHandlerImpl<T, TL>
                
                return result;
        }
-   
        
+       protected String getStringValue(DocumentModel docModel,
+                       String schema, ListResultField field) {
+               String result = null;
+               
+               Object value = getListResultValue(docModel, schema, field);
+               if (value != null && value instanceof String) {
+                       String strValue = (String) value;
+                       if (strValue.trim().isEmpty() == false) {
+                               result = strValue;
+                       }
+               }
+               
+               return result;
+       }
+   
     protected void removeFromList(List<RelationsCommonList.RelationListItem> list, RelationsCommonList.RelationListItem item) {
         list.remove(item);
     }
index 45cc840967700c02491f9107d49a12eaa2f76d34..09895ae19fa6fc58528360b61f96cb62ffddb411 100644 (file)
                 <xs:complexType>
                     <xs:sequence>
                         <xs:element name="SchemaName" type="xs:string" minOccurs="0" maxOccurs="1"/>
+                        <xs:element name="RefnameDisplayNameField" type="ListResultField" minOccurs="0" maxOccurs="1"/>  <!-- Should rename 'ListResultField' to a more generic name -->
                         <xs:element name="SupportsHierarchy" type="xs:boolean" minOccurs="0" maxOccurs="1" default="false"/>
                         <xs:element name="DublinCoreTitle" type="xs:string" minOccurs="0" maxOccurs="1"/>
                         <xs:element name="SummaryFields" type="xs:string" minOccurs="0" maxOccurs="1"/>