private static Resource convertToPojoResource(Resource resource, boolean includeDescendants) {
    Resource pojoResource = new Resource(resource.getId());
    pojoResource.setUuid(resource.getUuid());
    pojoResource.setResourceKey(resource.getResourceKey());
    pojoResource.setResourceType(resource.getResourceType());
    pojoResource.setMtime(resource.getMtime());
    pojoResource.setInventoryStatus(resource.getInventoryStatus());
    Configuration pcCopy = resource.getPluginConfiguration();
    if (pcCopy != null) {
      pcCopy = pcCopy.deepCopy();
    }
    pojoResource.setPluginConfiguration(pcCopy);
    pojoResource.setName(resource.getName());
    pojoResource.setDescription(resource.getDescription());
    pojoResource.setLocation(resource.getLocation());
    pojoResource.setVersion(resource.getVersion());

    if (resource.getParentResource() != null) {
      pojoResource.setParentResource(convertToPojoResource(resource.getParentResource(), false));
    }
    if (includeDescendants) {
      for (Resource childResource : resource.getChildResources()) {
        if (isVisibleInInventory(childResource)) {
          pojoResource.addChildResource(convertToPojoResource(childResource, true));
        }
      }
    }
    return pojoResource;
  }
Ejemplo n.º 2
0
 public String getDescription() {
   return resource.getDescription();
 }