/** * Filters out selected values supplied in an update request. * * @param objectProps the properties filtered out from the update payload * @param partMeta metadata for the object to fill */ @Override public void filterReadOnlyPropertiesForPart( Map<String, Object> objectProps, ObjectPartType partMeta) { super.filterReadOnlyPropertiesForPart(objectProps, partMeta); String commonPartLabel = getServiceContext().getCommonPartLabel(); if (partMeta.getLabel().equalsIgnoreCase(commonPartLabel)) { objectProps.remove(AuthorityJAXBSchema.CSID); objectProps.remove(AuthorityJAXBSchema.SHORT_IDENTIFIER); objectProps.remove(AuthorityJAXBSchema.REF_NAME); } }
/* * Non standard injection of CSID into common part, since caller may access through * shortId, and not know the CSID. * @see org.collectionspace.services.nuxeo.client.java.RemoteDocumentModelHandlerImpl#extractPart(org.nuxeo.ecm.core.api.DocumentModel, java.lang.String, org.collectionspace.services.common.service.ObjectPartType) */ @Override protected Map<String, Object> extractPart( DocumentModel docModel, String schema, ObjectPartType partMeta) throws Exception { Map<String, Object> unQObjectProperties = super.extractPart(docModel, schema, partMeta); // Add the CSID to the common part if (partMeta.getLabel().equalsIgnoreCase(authorityCommonSchemaName)) { String csid = getCsid(docModel); // NuxeoUtils.extractId(docModel.getPathAsString()); unQObjectProperties.put("csid", csid); } return unQObjectProperties; }
/* * Handle read (GET) */ @Override protected Map<String, Object> extractPart( DocumentModel docModel, String schema, ObjectPartType partMeta, Map<String, Object> addToMap) throws Exception { Map<String, Object> result = null; MediaType mt = MediaType.valueOf( partMeta .getContent() .getContentType()); // FIXME: REM - This is no longer needed. Everything is POX if (mt.equals(MediaType.APPLICATION_XML_TYPE)) { Map<String, Object> unQObjectProperties = (addToMap != null) ? addToMap : (new HashMap<String, Object>()); unQObjectProperties.put( WorkflowJAXBSchema.WORKFLOW_LIFECYCLEPOLICY, docModel.getLifeCyclePolicy()); unQObjectProperties.put( WorkflowJAXBSchema.WORKFLOW_CURRENTLIFECYCLESTATE, docModel.getCurrentLifeCycleState()); result = unQObjectProperties; } // TODO: handle other media types return result; }