/** * Converts manifest annotations to manifest model. * @param manifestAnnotations annotations * @param knowledgeNamespace knowledgeNamespace * @return model */ protected ManifestModel toManifestModel(Manifest[] manifestAnnotations, KnowledgeNamespace knowledgeNamespace) { if (manifestAnnotations == null || manifestAnnotations.length == 0) { return null; } Manifest manifestAnnotation = manifestAnnotations[0]; ManifestModel manifestModel = new V1ManifestModel(knowledgeNamespace.uri()); Container[] container = manifestAnnotation.container(); if (container != null && container.length > 0) { manifestModel.setContainer(toContainerModel(container[0], knowledgeNamespace)); } manifestModel.setResources(toResourcesModel(manifestAnnotation.resources(), knowledgeNamespace)); return manifestModel; }
/** * Converts resource annotations to resources model. * @param resourceAnnotations resourceAnnotations * @param knowledgeNamespace knowledgeNamespace * @return model */ protected ResourcesModel toResourcesModel(Resource[] resourceAnnotations, KnowledgeNamespace knowledgeNamespace) { if (resourceAnnotations == null || resourceAnnotations.length == 0) { return null; } ResourcesModel resourcesModel = new V1ResourcesModel(knowledgeNamespace.uri()); for (Resource resourceAnnotation : resourceAnnotations) { ResourceModel resourceModel = new V1ResourceModel(knowledgeNamespace.uri()); String location = resourceAnnotation.location(); if (!UNDEFINED.equals(location)) { resourceModel.setLocation(location); } String type = resourceAnnotation.type(); if (!UNDEFINED.equals(type)) { resourceModel.setType(ResourceType.valueOf(type)); } ResourceDetailModel resourceDetailModel = toResourceDetailModel(resourceAnnotation.detail(), knowledgeNamespace); if (resourceDetailModel != null) { resourceModel.setDetail(resourceDetailModel); } resourcesModel.addResource(resourceModel); } return resourcesModel; }
/** * Converts resource annotations to resources model. * @param resourceAnnotations resourceAnnotations * @param knowledgeNamespace knowledgeNamespace * @return model */ protected ResourcesModel toResourcesModel(Resource[] resourceAnnotations, KnowledgeNamespace knowledgeNamespace) { if (resourceAnnotations == null || resourceAnnotations.length == 0) { return null; } ResourcesModel resourcesModel = new V1ResourcesModel(knowledgeNamespace.uri()); for (Resource resourceAnnotation : resourceAnnotations) { ResourceModel resourceModel = new V1ResourceModel(knowledgeNamespace.uri()); String location = resourceAnnotation.location(); if (!UNDEFINED.equals(location)) { resourceModel.setLocation(location); } String type = resourceAnnotation.type(); if (!UNDEFINED.equals(type)) { resourceModel.setType(ResourceType.valueOf(type)); } ResourceDetailModel resourceDetailModel = toResourceDetailModel(resourceAnnotation.detail(), knowledgeNamespace); if (resourceDetailModel != null) { resourceModel.setDetail(resourceDetailModel); } resourcesModel.addResource(resourceModel); } return resourcesModel; }
/** * Converts manifest annotations to manifest model. * @param manifestAnnotations annotations * @param knowledgeNamespace knowledgeNamespace * @return model */ protected ManifestModel toManifestModel(Manifest[] manifestAnnotations, KnowledgeNamespace knowledgeNamespace) { if (manifestAnnotations == null || manifestAnnotations.length == 0) { return null; } Manifest manifestAnnotation = manifestAnnotations[0]; ManifestModel manifestModel = new V1ManifestModel(knowledgeNamespace.uri()); Container[] container = manifestAnnotation.container(); if (container != null && container.length > 0) { manifestModel.setContainer(toContainerModel(container[0], knowledgeNamespace)); } manifestModel.setResources(toResourcesModel(manifestAnnotation.resources(), knowledgeNamespace)); return manifestModel; }