existingResource.setDescription(description); logMessage.append("description, ");
res.setParentResource(parent); res.setInventoryStatus(InventoryStatus.COMMITTED); res.setDescription(resType.getDescription() + ". Created via REST-api");
platform.setInventoryStatus(InventoryStatus.COMMITTED); platform.setModifiedBy(caller.getName()); platform.setDescription(type.getDescription() + ". Created via REST-api"); platform.setItime(System.currentTimeMillis());
res.setParentResource(parent); res.setInventoryStatus(InventoryStatus.COMMITTED); res.setDescription(resType.getDescription() + ". Created via REST-api");
in.setDescription(resourceWithType.getDescription()); in.setLocation(resourceWithType.getLocation()); Resource out = resMgr.updateResource(caller,in);
static Resource createNewResource(DiscoveredResourceDetails details) { // Use a CopyOnWriteArraySet for childResources to allow the field to be concurrently accessed safely // (i.e. to avoid ConcurrentModificationExceptions). Set<Resource> childResources = new CopyOnWriteArraySet<Resource>(); Resource resource = new Resource(childResources); resource.setUuid(UUID.randomUUID().toString()); resource.setResourceKey(details.getResourceKey()); resource.setName(details.getResourceName()); resource.setVersion(details.getResourceVersion()); resource.setDescription(details.getResourceDescription()); resource.setResourceType(details.getResourceType()); Configuration pluginConfiguration = details.getPluginConfiguration(); ConfigurationUtility.normalizeConfiguration(details.getPluginConfiguration(), details.getResourceType() .getPluginConfigurationDefinition(), false, false); resource.setPluginConfiguration(pluginConfiguration); return resource; }
@Override public Resource updateResource(Subject user, Resource resource) { Resource persistedResource = entityManager.find(Resource.class, resource.getId()); if (persistedResource == null) { throw new ResourceNotFoundException(resource.getId()); } if (!authorizationManager.hasResourcePermission(user, Permission.MODIFY_RESOURCE, resource.getId())) { throw new PermissionException("You do not have permission to modify Resource with id " + resource.getId() + "."); } /*if (getResourceByParentAndKey(user, resource.getParentResource(), resource.getResourceKey()) != null) * { throw new ResourceAlreadyExistsException("Resource with key '" + resource.getName() + "' already * exists");}*/ // On name change make sure we update the ancestry as the name is part of the ancestry string if (!persistedResource.getName().equals(resource.getName())) { persistedResource.setName(resource.getName()); updateAncestry(persistedResource); } persistedResource.setLocation(resource.getLocation()); persistedResource.setDescription(resource.getDescription()); persistedResource.setAgentSynchronizationNeeded(); persistedResource.setModifiedBy(user.getName()); return entityManager.merge(persistedResource); }
+ updatedResource.getDescription() + "' (as reported by agent)..."); existingResource.setDescription(updatedResource.getDescription());
resource.setDescription(description); logMessage.append("description, "); ret.setUpgradedResourceDescription(resource.getDescription());
public void updateResource(Resource resource) { if (getNewResourceKey() != null) { resource.setResourceKey(getNewResourceKey()); } if (getNewName() != null) { resource.setName(getNewName()); } if (getNewDescription() != null) { resource.setDescription(getNewDescription()); } if (getNewPluginConfiguration() != null) { resource.setPluginConfiguration(getNewPluginConfiguration()); } if (getNewVersion() != null) { resource.setVersion(getNewVersion()); } }
private void cleanoutResource(Resource resource) { resource.setAncestry(null); resource.setAlertDefinitions(Collections.EMPTY_SET); resource.setLocation(null); resource.setDescription(null); resource.setAutoGroupBackingGroups(Collections.EMPTY_LIST); resource.setExplicitGroups(Collections.EMPTY_SET); resource.setCreateChildResourceRequests(Collections.EMPTY_LIST); resource.setDeleteResourceRequests(Collections.EMPTY_LIST); resource.setImplicitGroups(Collections.EMPTY_SET); resource.setInstalledPackageHistory(Collections.EMPTY_LIST); resource.setInstalledPackages(Collections.EMPTY_SET); resource.setPluginConfigurationUpdates(Collections.EMPTY_LIST); resource.setResourceConfigurationUpdates(Collections.EMPTY_LIST); if (resource.getPluginConfiguration()!=null) { resource.getPluginConfiguration().cleanoutRawConfiguration(); } }
resource.setInstalledPackages(Collections.EMPTY_SET); resource.setInstalledPackageHistory(Collections.EMPTY_LIST); resource.setDescription(null); resource.setImplicitGroups(Collections.EMPTY_SET); resource.setExplicitGroups(Collections.EMPTY_SET);
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; }