/** * Gets the relation list item, looking up the subject and object documents, and getting summary * info via the objectName and objectNumber properties in tenant-bindings. * * @param ctx the ctx * @param sbt the ServiceBindingType of Relations service * @param tReader the tenant-bindings reader, for looking up docnumber and docname * @param docModel the doc model * @param serviceContextPath the service context path * @return the relation list item, with nested subject and object summary info. * @throws Exception the exception */ private RelationListItem getRelationListItem( ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx, ServiceBindingType sbt, TenantBindingConfigReaderImpl tReader, DocumentModel docModel, String serviceContextPath) throws Exception { RelationListItem relationListItem = new RelationListItem(); String id = getCsid(docModel); relationListItem.setCsid(id); relationListItem.setSubjectCsid( (String) docModel.getProperty(ctx.getCommonPartLabel(), RelationJAXBSchema.DOCUMENT_ID_1)); String predicate = (String) docModel.getProperty(ctx.getCommonPartLabel(), RelationJAXBSchema.RELATIONSHIP_TYPE); relationListItem.setRelationshipType(predicate); relationListItem.setPredicate(predicate); // predicate is new name for relationshipType. relationListItem.setPredicateDisplayName( (String) docModel.getProperty( ctx.getCommonPartLabel(), RelationJAXBSchema.RELATIONSHIP_TYPE_DISPLAYNAME)); relationListItem.setObjectCsid( (String) docModel.getProperty(ctx.getCommonPartLabel(), RelationJAXBSchema.DOCUMENT_ID_2)); relationListItem.setUri(serviceContextPath + id); // Now fill in summary info for the related docs: subject and object. String subjectCsid = relationListItem.getSubjectCsid(); String documentType = (String) docModel.getProperty(ctx.getCommonPartLabel(), RelationJAXBSchema.DOCUMENT_TYPE_1); RelationsDocListItem subject = createRelationsDocListItem(ctx, sbt, subjectCsid, tReader, documentType); // Object o1 = docModel.getProperty(ctx.getCommonPartLabel(), "subject"); // Object o2 = docModel.getProperty(ctx.getCommonPartLabel(), "object"); String subjectUri = (String) docModel.getProperty(ctx.getCommonPartLabel(), RelationJAXBSchema.subjectUri); subject.setUri(subjectUri); relationListItem.setSubject(subject); String objectCsid = relationListItem.getObjectCsid(); String documentType2 = (String) docModel.getProperty(ctx.getCommonPartLabel(), RelationJAXBSchema.DOCUMENT_TYPE_2); RelationsDocListItem object = createRelationsDocListItem(ctx, sbt, objectCsid, tReader, documentType2); String objectUri = (String) docModel.getProperty(ctx.getCommonPartLabel(), RelationJAXBSchema.objectUri); object.setUri(objectUri); relationListItem.setObject(object); return relationListItem; }