]> git.aero2k.de Git - tmp/jakarta-migration.git/blob
a15c7fb477799b18caf25b812c3ecedfec9aeb34
[tmp/jakarta-migration.git] /
1 /**
2  *  This document is a part of the source code and related artifacts
3  *  for CollectionSpace, an open source collections management system
4  *  for museums and related institutions:
5
6  *  http://www.collectionspace.org
7  *  http://wiki.collectionspace.org
8
9  *  Copyright 2009 University of California at Berkeley
10
11  *  Licensed under the Educational Community License (ECL), Version 2.0.
12  *  You may not use this file except in compliance with this License.
13
14  *  You may obtain a copy of the ECL 2.0 License at
15
16  *  https://source.collectionspace.org/collection-space/LICENSE.txt
17
18  *  Unless required by applicable law or agreed to in writing, software
19  *  distributed under the License is distributed on an "AS IS" BASIS,
20  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21  *  See the License for the specific language governing permissions and
22  *  limitations under the License.
23  */
24 package org.collectionspace.services.relation.nuxeo;
25
26 import java.util.HashMap;
27 import java.util.Iterator;
28 import java.net.HttpURLConnection;
29
30 import org.collectionspace.services.client.PoxPayloadIn;
31 import org.collectionspace.services.client.PoxPayloadOut;
32 import org.collectionspace.services.common.NuxeoBasedResource;
33 import org.collectionspace.services.common.ServiceException;
34 import org.collectionspace.services.common.ServiceMain;
35 import org.collectionspace.services.common.api.Tools;
36 import org.collectionspace.services.common.config.TenantBindingConfigReaderImpl;
37 import org.collectionspace.services.common.context.ServiceBindingUtils;
38 import org.collectionspace.services.common.document.DocumentNotFoundException;
39 import org.collectionspace.services.common.document.DocumentWrapper;
40 import org.collectionspace.services.common.document.InvalidDocumentException;
41 import org.collectionspace.services.common.relation.RelationJAXBSchema;
42 import org.collectionspace.services.common.relation.nuxeo.RelationConstants;
43 import org.collectionspace.services.common.context.ServiceContext;
44 import org.collectionspace.services.lifecycle.TransitionDef;
45 import org.collectionspace.services.nuxeo.util.NuxeoUtils;
46 import org.collectionspace.services.relation.RelationsCommon;
47 import org.collectionspace.services.relation.RelationsCommonList;
48 import org.collectionspace.services.relation.RelationsCommonList.RelationListItem;
49 import org.collectionspace.services.relation.RelationsDocListItem;
50 import org.collectionspace.services.client.CollectionSpaceClient;
51 import org.collectionspace.services.client.workflow.WorkflowClient;
52 import org.collectionspace.services.config.service.ServiceBindingType;
53 import org.collectionspace.services.nuxeo.client.java.RemoteDocumentModelHandlerImpl;
54 import org.collectionspace.services.nuxeo.client.java.CoreSessionInterface;
55 import org.collectionspace.services.nuxeo.client.java.RepositoryClientImpl;
56
57 import org.nuxeo.ecm.core.api.ClientException;
58 import org.nuxeo.ecm.core.api.DocumentModel;
59 import org.nuxeo.ecm.core.api.DocumentModelList;
60 import org.nuxeo.ecm.core.api.model.PropertyException;
61
62 import org.slf4j.Logger;
63 import org.slf4j.LoggerFactory;
64
65 /**
66  * RelationDocumentModelHandler
67  *
68  * $LastChangedRevision: $
69  * $LastChangedDate: $
70  */
71 public class RelationDocumentModelHandler
72         extends RemoteDocumentModelHandlerImpl<RelationsCommon, RelationsCommonList> {
73
74     private final Logger logger = LoggerFactory.getLogger(RelationDocumentModelHandler.class);
75     /**
76      * relation is used to stash JAXB object to use when handle is called
77      * for Action.CREATE, Action.UPDATE or Action.GET
78      */
79     private RelationsCommon relation;
80     /**
81      * relationList is stashed when handle is called
82      * for ACTION.GET_ALL
83      */
84     private RelationsCommonList relationList;
85     
86     private static final String ERROR_TERMS_IN_WORKFLOWSTATE = "Cannot modify a relationship if either end is in the workflow state: ";
87
88     
89     private boolean subjectOrObjectInWorkflowState(DocumentWrapper<DocumentModel> wrapDoc, String workflowState) throws ServiceException {
90         boolean result = false;
91         DocumentModel relationDocModel = wrapDoc.getWrappedObject();
92         String errMsg = ERROR_TERMS_IN_WORKFLOWSTATE + workflowState;
93                         
94         CoreSessionInterface repoSession = this.getRepositorySession();
95         try {
96                         DocumentModel subjectDocModel = getSubjectOrObjectDocModel(repoSession, relationDocModel, SUBJ_DOC_MODEL);
97                         DocumentModel objectDocModel = getSubjectOrObjectDocModel(repoSession, relationDocModel, OBJ_DOC_MODEL);
98                         if (subjectDocModel.getCurrentLifeCycleState().equalsIgnoreCase(workflowState) ||
99                                         objectDocModel.getCurrentLifeCycleState().equalsIgnoreCase(workflowState)) {
100                                 result = true;
101                         }
102                 } catch (Exception e) {
103                         if (logger.isInfoEnabled() == true) {
104                                 logger.info(errMsg, e);
105                         }
106                 }
107                 
108         return result;
109     }
110     
111         @Override
112         /*
113          * Until we rework the RepositoryClient to handle the workflow transition (just like it does for 'create', 'get', 'update', and 'delete', this method will only check to see if the transition is allowed.  Until then,
114          * the WorkflowDocumentModelHandler class does the actual workflow transition.
115          * 
116          * @see org.collectionspace.services.nuxeo.client.java.RemoteDocumentModelHandlerImpl#handleWorkflowTransition(org.collectionspace.services.common.document.DocumentWrapper, org.collectionspace.services.lifecycle.TransitionDef)
117          */
118         public void handleWorkflowTransition(ServiceContext ctx, DocumentWrapper<DocumentModel> wrapDoc, TransitionDef transitionDef)
119                         throws Exception {              
120                 if (subjectOrObjectInWorkflowState(wrapDoc, WorkflowClient.WORKFLOWSTATE_LOCKED) == true) {
121                 throw new ServiceException(HttpURLConnection.HTTP_FORBIDDEN,
122                     "Cannot change a relationship if either end of it is in the workflow state: " + WorkflowClient.WORKFLOWSTATE_LOCKED);
123                 }
124         }
125
126     @Override
127     public void handleCreate(DocumentWrapper<DocumentModel> wrapDoc) throws Exception {
128         // Merge in the data from the payload
129         super.handleCreate(wrapDoc);
130
131         // And take care of ensuring all the values for the relation info are correct 
132         populateSubjectAndObjectValues(wrapDoc);
133         
134         // Neither the subject nor the object can be locked
135         String workflowState = WorkflowClient.WORKFLOWSTATE_LOCKED;
136         if (subjectOrObjectInWorkflowState(wrapDoc, workflowState) == true) {
137                 throw new ServiceException(HttpURLConnection.HTTP_FORBIDDEN,
138                     "Cannot create a relationship if either end is in the workflow state: " + workflowState);
139         }
140     }
141
142     @Override
143     public void handleUpdate(DocumentWrapper<DocumentModel> wrapDoc) throws Exception {
144         // Merge in the data from the payload
145         super.handleUpdate(wrapDoc);
146         
147         // And take care of ensuring all the values for the relation info are correct 
148         populateSubjectAndObjectValues(wrapDoc);
149     }
150     
151     @Override
152     public boolean handleDelete(DocumentWrapper<DocumentModel> wrapDoc) throws Exception {
153         boolean result = true;
154         
155         String workflowState = WorkflowClient.WORKFLOWSTATE_LOCKED;
156         // Neither the subject nor the object can be locked
157         if (subjectOrObjectInWorkflowState(wrapDoc, workflowState) == false) {
158                 super.handleDelete(wrapDoc);
159         } else {
160                 throw new ServiceException(HttpURLConnection.HTTP_FORBIDDEN,
161                     "Cannot delete a relationship if either end is in the workflow state: " + workflowState);
162         }
163         
164         return result;
165     }
166     
167     private void populateSubjectAndObjectValues(DocumentWrapper<DocumentModel> wrapDoc) throws Exception {
168         // Obtain document models for the subject and object of the relation, so that
169         // we ensure we have value docType, URI info. If the docModels support refNames, 
170         // we will also set those.
171         // Note that this introduces another caching problem... 
172         DocumentModel relationDocModel = wrapDoc.getWrappedObject();
173         CoreSessionInterface repoSession = this.getRepositorySession();
174         
175         DocumentModel subjectDocModel = getSubjectOrObjectDocModel(repoSession, relationDocModel, SUBJ_DOC_MODEL);
176         DocumentModel objectDocModel = getSubjectOrObjectDocModel(repoSession, relationDocModel, OBJ_DOC_MODEL);
177
178         // Use values from the subject and object document models to populate the
179         // relevant fields of the relation's own document model.
180         if (subjectDocModel != null) {
181             populateSubjectOrObjectValues(relationDocModel, subjectDocModel, SUBJ_DOC_MODEL);
182         }
183         if (objectDocModel != null) {
184             populateSubjectOrObjectValues(relationDocModel, objectDocModel, OBJ_DOC_MODEL);
185         }
186     }
187
188     @Override
189     public RelationsCommon getCommonPart() {
190         return relation;
191     }
192
193     @Override
194     public void setCommonPart(RelationsCommon theRelation) {
195         this.relation = theRelation;
196     }
197
198     /**get associated Relation (for index/GET_ALL)
199      */
200     @Override
201     public RelationsCommonList getCommonPartList() {
202         return relationList;
203     }
204
205     @Override
206     public void setCommonPartList(RelationsCommonList theRelationList) {
207         this.relationList = theRelationList;
208     }
209
210     @Override
211     public RelationsCommon extractCommonPart(DocumentWrapper<DocumentModel> wrapDoc)
212             throws Exception {
213         throw new UnsupportedOperationException();
214     }
215
216     @Override
217     public void fillCommonPart(RelationsCommon theRelation, DocumentWrapper<DocumentModel> wrapDoc) throws Exception {
218         throw new UnsupportedOperationException();
219     }
220
221     @Override
222     public RelationsCommonList extractCommonPartList(DocumentWrapper<DocumentModelList> wrapDoc) throws Exception {
223         RelationsCommonList relList = this.extractPagingInfo(new RelationsCommonList(), wrapDoc);
224         relList.setFieldsReturned("subjectCsid|relationshipType|predicateDisplayName|relationshipMetaType|objectCsid|uri|csid|subject|object");
225         ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = getServiceContext();
226         String serviceContextPath = getServiceContextPath();
227
228         TenantBindingConfigReaderImpl tReader = ServiceMain.getInstance().getTenantBindingConfigReader();
229         String serviceName = getServiceContext().getServiceName().toLowerCase();
230         ServiceBindingType sbt = tReader.getServiceBinding(ctx.getTenantId(), serviceName);
231
232         Iterator<DocumentModel> iter = wrapDoc.getWrappedObject().iterator();
233         while (iter.hasNext()) {
234             DocumentModel docModel = iter.next();
235             RelationListItem relListItem = getRelationListItem(ctx, sbt, tReader, docModel, serviceContextPath);
236             relList.getRelationListItem().add(relListItem);
237         }
238         return relList;
239     }
240
241     /** Gets the relation list item, looking up the subject and object documents, and getting summary
242      *  info via the objectName and objectNumber properties in tenant-bindings.
243      * @param ctx the ctx
244      * @param sbt the ServiceBindingType of Relations service
245      * @param tReader the tenant-bindings reader, for looking up docnumber and docname
246      * @param docModel the doc model
247      * @param serviceContextPath the service context path
248      * @return the relation list item, with nested subject and object summary info.
249      * @throws Exception the exception
250      */
251     private RelationListItem getRelationListItem(ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx,
252             ServiceBindingType sbt,
253             TenantBindingConfigReaderImpl tReader,
254             DocumentModel docModel,
255             String serviceContextPath) throws Exception {
256         RelationListItem relationListItem = new RelationListItem();
257         String id = getCsid(docModel);
258         relationListItem.setCsid(id);
259
260         relationListItem.setSubjectCsid((String) docModel.getProperty(ctx.getCommonPartLabel(), 
261                                                                                                         RelationJAXBSchema.SUBJECT_CSID));
262
263         String predicate = (String) docModel.getProperty(ctx.getCommonPartLabel(), 
264                                                                                                         RelationJAXBSchema.RELATIONSHIP_TYPE);
265         relationListItem.setRelationshipType(predicate);
266         relationListItem.setPredicate(predicate); //predicate is new name for relationshipType.
267         relationListItem.setPredicateDisplayName((String) docModel.getProperty(ctx.getCommonPartLabel(), 
268                                                                                                         RelationJAXBSchema.RELATIONSHIP_TYPE_DISPLAYNAME));
269
270         relationListItem.setRelationshipMetaType((String) docModel.getProperty(ctx.getCommonPartLabel(), 
271                                                                                                         RelationJAXBSchema.RELATIONSHIP_META_TYPE));
272         relationListItem.setObjectCsid((String) docModel.getProperty(ctx.getCommonPartLabel(), 
273                                                                                                         RelationJAXBSchema.OBJECT_CSID));
274
275         relationListItem.setUri(serviceContextPath + id);
276
277         //Now fill in summary info for the related docs: subject and object.
278         String subjectCsid = relationListItem.getSubjectCsid();
279         String subjectDocumentType = (String) docModel.getProperty(ctx.getCommonPartLabel(), 
280                                                                                                         RelationJAXBSchema.SUBJECT_DOCTYPE);
281         RelationsDocListItem subject = createRelationsDocListItem(ctx, sbt, subjectCsid, tReader, subjectDocumentType);
282
283         String subjectUri = (String) docModel.getProperty(ctx.getCommonPartLabel(), 
284                                                                                                         RelationJAXBSchema.SUBJECT_URI);
285         subject.setUri(subjectUri);
286         String subjectRefName = (String) docModel.getProperty(ctx.getCommonPartLabel(), 
287                                                                                                         RelationJAXBSchema.SUBJECT_REFNAME);
288         subject.setRefName(subjectRefName);
289         relationListItem.setSubject(subject);
290
291         String objectCsid = relationListItem.getObjectCsid();
292         String objectDocumentType = (String) docModel.getProperty(ctx.getCommonPartLabel(), 
293                                                                                                         RelationJAXBSchema.OBJECT_DOCTYPE);
294         RelationsDocListItem object = createRelationsDocListItem(ctx, sbt, objectCsid, tReader, objectDocumentType);
295
296         String objectUri = (String) docModel.getProperty(ctx.getCommonPartLabel(), 
297                                                                                                         RelationJAXBSchema.OBJECT_URI);
298         object.setUri(objectUri);
299         String objectRefName = (String) docModel.getProperty(ctx.getCommonPartLabel(), 
300                                                                                                         RelationJAXBSchema.OBJECT_REFNAME);
301         object.setRefName(objectRefName);
302         relationListItem.setObject(object);
303
304         return relationListItem;
305     }
306
307     // DocumentModel itemDocModel = docModelFromCSID(ctx, itemCsid);
308     protected RelationsDocListItem createRelationsDocListItem(
309                 ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx,
310             ServiceBindingType sbt,
311             String itemCsid,
312             TenantBindingConfigReaderImpl tReader,
313             String documentType) throws Exception {
314         RelationsDocListItem item = new RelationsDocListItem();
315         item.setDocumentType(documentType);//this one comes from the record, as subjectDocumentType, objectDocumentType.
316         item.setCsid(itemCsid);
317
318         DocumentModel itemDocModel = NuxeoUtils.getDocFromCsid(ctx, this.getRepositorySession(), itemCsid);    //null if not found.
319         if (itemDocModel != null) {
320             String itemDocType = itemDocModel.getDocumentType().getName();
321             itemDocType = ServiceBindingUtils.getUnqualifiedTenantDocType(itemDocType);
322             if (Tools.isBlank(documentType)) {
323                 item.setDocumentType(itemDocType);
324             }
325
326             //TODO: ensure that itemDocType is really the entry point, i.e. servicename==doctype
327             //ServiceBindingType itemSbt2 = tReader.getServiceBinding(ctx.getTenantId(), itemDocType);
328             String propName = "ERROR-FINDING-PROP-VALUE";
329             ServiceBindingType itemSbt = tReader.getServiceBindingForDocType(ctx.getTenantId(), itemDocType);
330             try {
331                 propName = ServiceBindingUtils.getPropertyValue(itemSbt, ServiceBindingUtils.OBJ_NAME_PROP);
332                 String itemDocname = ServiceBindingUtils.getMappedFieldInDoc(itemSbt, ServiceBindingUtils.OBJ_NAME_PROP, itemDocModel);
333                 if (propName == null || itemDocname == null) {
334                 } else {
335                     item.setName(itemDocname);
336                 }
337             } catch (Throwable t) {
338                 logger.error("====Error finding objectNameProperty: " + itemDocModel + " field " + ServiceBindingUtils.OBJ_NAME_PROP + "=" + propName
339                         + " not found in itemDocType: " + itemDocType + " inner: " + t.getMessage());
340             }
341             propName = "ERROR-FINDING-PROP-VALUE";
342             try {
343                 propName = ServiceBindingUtils.getPropertyValue(itemSbt, ServiceBindingUtils.OBJ_NUMBER_PROP);
344                 String itemDocnumber = ServiceBindingUtils.getMappedFieldInDoc(itemSbt, ServiceBindingUtils.OBJ_NUMBER_PROP, itemDocModel);
345
346                 if (propName == null || itemDocnumber == null) {
347                 } else {
348                     item.setNumber(itemDocnumber);
349                 }
350             } catch (Throwable t) {
351                 logger.error("====Error finding objectNumberProperty: " + ServiceBindingUtils.OBJ_NUMBER_PROP + "=" + propName
352                         + " not found in itemDocType: " + itemDocType + " inner: " + t.getMessage());
353             }
354         } else {
355             item.setError("INVALID: related object is absent");
356             // Laramie20110510 CSPACE-3739  throw the exception for 3739, otherwise, don't throw it.
357             //throw new Exception("INVALID: related object is absent "+itemCsid);
358         }
359         return item;
360     }
361
362     @Override
363     public String getQProperty(String prop) {
364         return "/" + RelationConstants.NUXEO_SCHEMA_ROOT_ELEMENT + "/" + prop;
365     }
366
367     private final boolean SUBJ_DOC_MODEL = true;
368     private final boolean OBJ_DOC_MODEL = false;
369     
370     private DocumentModel getSubjectOrObjectDocModel(
371                 CoreSessionInterface repoSession,
372                 DocumentModel relationDocModel,
373                 boolean fSubject) throws Exception {
374         ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = this.getServiceContext();
375         
376         // Get the document model for the object of the relation.
377         String commonPartLabel = ctx.getCommonPartLabel();
378         String csid = "";
379         String refName = "";
380         DocumentModel docModel = null;
381         // FIXME: Currently assumes that the object CSID is valid if present
382         // in the incoming payload.
383         try {
384             csid = (String) relationDocModel.getProperty(commonPartLabel, 
385                         (fSubject?RelationJAXBSchema.SUBJECT_CSID:RelationJAXBSchema.OBJECT_CSID));
386         } catch (PropertyException pe) {
387             // Per CSPACE-4468, ignore any property exception here.
388             // The objectCsid and/or subjectCsid field in a relation record
389             // can now be null (missing), because a refName value can be
390             // provided as an alternate identifier.
391         }
392         if (Tools.notBlank(csid)) {
393                 RepositoryClientImpl nuxeoRepoClient = (RepositoryClientImpl)getRepositoryClient(ctx);
394             DocumentWrapper<DocumentModel> docWrapper = nuxeoRepoClient.getDocFromCsid(ctx, repoSession, csid);
395             docModel = docWrapper.getWrappedObject();
396         } else { //  if (Tools.isBlank(objectCsid)) {
397             try {
398                 refName = (String) relationDocModel.getProperty(commonPartLabel, 
399                                 (fSubject?RelationJAXBSchema.SUBJECT_REFNAME:RelationJAXBSchema.OBJECT_REFNAME));
400                 docModel = NuxeoBasedResource.getDocModelForRefName(repoSession, refName, ctx.getResourceMap());
401             } catch (Exception e) {
402                 throw new InvalidDocumentException(
403                         "Relation record must have a CSID or refName to identify the object of the relation.", e);
404             }
405         }
406         if(docModel==null) {
407                 throw new DocumentNotFoundException("RelationDMH.getSubjectOrObjectDocModel could not find doc with CSID: "
408                                         +csid+" and/or refName: "+refName );
409         }
410         return docModel;
411     }
412     
413     private void populateSubjectOrObjectValues(
414                 DocumentModel relationDocModel, 
415                 DocumentModel subjectOrObjectDocModel,
416                 boolean fSubject ) {
417         ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = this.getServiceContext();
418         
419         HashMap<String,Object> properties = new HashMap<String,Object>();
420         try {
421                 String doctype = subjectOrObjectDocModel.getDocumentType().getName();
422             doctype = ServiceBindingUtils.getUnqualifiedTenantDocType(doctype);
423                 properties.put((fSubject?RelationJAXBSchema.SUBJECT_DOCTYPE:RelationJAXBSchema.OBJECT_DOCTYPE),
424                                                         doctype);
425         
426                 String csid = (String) subjectOrObjectDocModel.getName();
427                 properties.put((fSubject?RelationJAXBSchema.SUBJECT_CSID:RelationJAXBSchema.OBJECT_CSID),
428                                                         csid);
429         
430                 String uri = (String) subjectOrObjectDocModel.getProperty(CollectionSpaceClient.COLLECTIONSPACE_CORE_SCHEMA,
431                                 CollectionSpaceClient.COLLECTIONSPACE_CORE_URI);
432                 properties.put((fSubject?RelationJAXBSchema.SUBJECT_URI:RelationJAXBSchema.OBJECT_URI),
433                                                         uri);
434                 
435                 /*
436                 String common_schema = getCommonSchemaNameForDocType(doctype);
437                 
438                 if(common_schema!=null) {
439                         String refname = (String)subjectOrObjectDocModel.getProperty(common_schema, 
440                                                                                                                         RefName.REFNAME );
441                     properties.put((fSubject?RelationJAXBSchema.SUBJECT_REFNAME:RelationJAXBSchema.OBJECT_REFNAME),
442                                 refname);
443                 }
444                 */
445                 String refname = (String) 
446                                 subjectOrObjectDocModel.getProperty(
447                                                 CollectionSpaceClient.COLLECTIONSPACE_CORE_SCHEMA,
448                                                 CollectionSpaceClient.COLLECTIONSPACE_CORE_REFNAME);
449             properties.put((fSubject?
450                                                 RelationJAXBSchema.SUBJECT_REFNAME
451                                                 :RelationJAXBSchema.OBJECT_REFNAME),
452                                         refname);
453         } catch (ClientException ce) {
454             throw new RuntimeException(
455                     "populateSubjectOrObjectValues: Problem fetching field " + ce.getLocalizedMessage());
456         }
457
458         // FIXME: Call below is based solely on Nuxeo API docs; have not yet verified that it correctly updates existing
459         // property values in the target document model.
460         try {
461                 relationDocModel.setProperties(ctx.getCommonPartLabel(), properties);
462         } catch (ClientException ce) {
463             throw new RuntimeException(
464                     "populateSubjectValues: Problem setting fields " + ce.getLocalizedMessage());
465         }
466     }
467     
468     /*
469     private String getCommonSchemaNameForDocType(String docType) {
470         String common_schema = null;
471         if(docType!=null) {
472                 // HACK - Use startsWith to allow for extension of schemas.
473                 if(docType.startsWith("Person"))
474                         common_schema = PersonAuthorityClient.SERVICE_ITEM_COMMON_PART_NAME;
475                 else if(docType.startsWith("Citation"))
476                         common_schema = CitationAuthorityClient.SERVICE_ITEM_COMMON_PART_NAME;
477                 else if(docType.startsWith("Organization"))
478                         common_schema = OrgAuthorityClient.SERVICE_ITEM_COMMON_PART_NAME;
479                 else if(docType.startsWith("Locationitem"))
480                         common_schema = LocationAuthorityClient.SERVICE_ITEM_COMMON_PART_NAME;
481                 else if(docType.startsWith("Taxon"))
482                         common_schema = TaxonomyAuthorityClient.SERVICE_ITEM_COMMON_PART_NAME;
483                 else if(docType.startsWith("Placeitem"))
484                         common_schema = PlaceAuthorityClient.SERVICE_ITEM_COMMON_PART_NAME;
485                 else if(docType.startsWith("Conceptitem"))
486                         common_schema = ConceptAuthorityClient.SERVICE_ITEM_COMMON_PART_NAME;
487                 //else leave it null.
488         }
489         return common_schema;
490     }
491     */
492
493 }