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:
6 * http://www.collectionspace.org
7 * http://wiki.collectionspace.org
9 * Copyright 2009 University of California at Berkeley
11 * Licensed under the Educational Community License (ECL), Version 2.0.
12 * You may not use this file except in compliance with this License.
14 * You may obtain a copy of the ECL 2.0 License at
16 * https://source.collectionspace.org/collection-space/LICENSE.txt
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.
24 package org.collectionspace.services.organization.nuxeo;
26 import java.util.Iterator;
27 import java.util.List;
29 import org.collectionspace.services.common.vocabulary.AuthorityJAXBSchema;
30 import org.collectionspace.services.common.document.DocumentWrapper;
31 import org.collectionspace.services.organization.OrgauthoritiesCommon;
32 import org.collectionspace.services.organization.OrgauthoritiesCommonList;
33 import org.collectionspace.services.organization.OrgauthoritiesCommonList.OrgauthorityListItem;
35 import org.collectionspace.services.common.vocabulary.nuxeo.AuthorityDocumentModelHandler;
36 import org.collectionspace.services.nuxeo.util.NuxeoUtils;
37 import org.nuxeo.ecm.core.api.DocumentModel;
38 import org.nuxeo.ecm.core.api.DocumentModelList;
39 //import org.slf4j.Logger;
40 //import org.slf4j.LoggerFactory;
43 * OrgAuthorityDocumentModelHandler
45 * $LastChangedRevision: $
48 public class OrgAuthorityDocumentModelHandler
49 extends AuthorityDocumentModelHandler<OrgauthoritiesCommon, OrgauthoritiesCommonList> {
51 //private final Logger logger = LoggerFactory.getLogger(OrgAuthorityDocumentModelHandler.class);
54 * @see org.collectionspace.services.nuxeo.client.java.DocumentModelHandler#extractCommonPartList(org.collectionspace.services.common.document.DocumentWrapper)
57 public OrgauthoritiesCommonList extractCommonPartList(DocumentWrapper<DocumentModelList> wrapDoc) throws Exception {
58 OrgauthoritiesCommonList coList = this.extractPagingInfo(new OrgauthoritiesCommonList(), wrapDoc);
59 List<OrgauthoritiesCommonList.OrgauthorityListItem> list = coList.getOrgauthorityListItem();
60 Iterator<DocumentModel> iter = wrapDoc.getWrappedObject().iterator();
61 String label = getServiceContext().getCommonPartLabel();
62 while(iter.hasNext()){
63 DocumentModel docModel = iter.next();
64 OrgauthorityListItem ilistItem = new OrgauthorityListItem();
65 ilistItem.setDisplayName((String) docModel.getProperty(label,
66 AuthorityJAXBSchema.DISPLAY_NAME));
67 ilistItem.setRefName((String) docModel.getProperty(label,
68 AuthorityJAXBSchema.REF_NAME));
69 ilistItem.setShortIdentifier((String) docModel.getProperty(label,
70 AuthorityJAXBSchema.SHORT_IDENTIFIER));
71 ilistItem.setVocabType((String) docModel.getProperty(label,
72 AuthorityJAXBSchema.VOCAB_TYPE));
73 String id = NuxeoUtils.extractId(docModel.getPathAsString());
74 ilistItem.setUri(getServiceContextPath() + id);
75 ilistItem.setCsid(id);
83 * getQProperty converts the given property to qualified schema property
88 public String getQProperty(String prop) {
89 return OrgAuthorityConstants.NUXEO_SCHEMA_NAME + ":" + prop;