*/
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;
}