private void updateInventoryStatus(Resource resource, InventoryStatus newStatus, long now) { resource.setInventoryStatus(newStatus); resource.setItime(now); resource.setAgentSynchronizationNeeded(); }
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) public void completeDeleteResourceRequest(DeleteResourceResponse response) { if (LOG.isDebugEnabled()) { LOG.debug("Received call to complete delete resource: " + response); } // Load the persisted history entry DeleteResourceHistory history = entityManager.find(DeleteResourceHistory.class, response.getRequestId()); // There is some inconsistency if we're completing a request that was not in the database if (history == null) { LOG.error("Attempting to complete a request that was not found in the database: " + response.getRequestId()); return; } // Update the history entry history.setErrorMessage(response.getErrorMessage()); history.setStatus(response.getStatus()); // If successful mark resource as deleted and uninventory children if (response.getStatus() == DeleteResourceStatus.SUCCESS) { Resource resource = history.getResource(); // get doomed children Set<Resource> children = resource.getChildResources(); // set the resource deleted and update the db in case it matters to the child operations resource.setInventoryStatus(InventoryStatus.DELETED); //resource.setParentResource(null); can't null this out since the query DeleteResourceHistory.QUERY_FIND_BY_PARENT_RESOURCE_ID needs it resource.setItime(System.currentTimeMillis()); entityManager.merge(resource); // uninventory the children of the deleted resource (see rhq-2378) uninventoryChildren(children); } }
platform.setModifiedBy(caller.getName()); platform.setDescription(type.getDescription() + ". Created via REST-api"); platform.setItime(System.currentTimeMillis());
resource.setItime(System.currentTimeMillis()); resource.setModifiedBy(overlord.getName());
resource.setItime(System.currentTimeMillis()); try { this.resourceManager.createResource(creator, resource, parentResource.getId());