Examples of CreateResourceHistory


Examples of org.rhq.core.domain.resource.CreateResourceHistory

        executeInTransaction(false, new TransactionCallback() {
            @Override
            public void execute() throws Exception {
                Resource serverResource = getEntityManager().find(Resource.class, serverResourceId);
                CreateResourceHistory createResourceHistory = new CreateResourceHistory(serverResource, serviceType1,
                    subjectManager.getOverlord().getName(), new Configuration());
                createResourceHistory.setCreatedResourceName(userSuppliedResourceName);
                createResourceHistory.setNewResourceKey(newResourceKey);
                createResourceHistory.setStatus(SUCCESS);
                getEntityManager().persist(createResourceHistory);
                serverResource.addCreateChildResourceHistory(createResourceHistory);
                getEntityManager().flush();
            }
        });
View Full Code Here

Examples of org.rhq.core.domain.resource.CreateResourceHistory

                if (storageNode != null) {
                    storageNode.setResource(null);
                }
                for (Iterator<CreateResourceHistory> historyIterator = res.getCreateChildResourceRequests().iterator(); historyIterator
                    .hasNext();) {
                    CreateResourceHistory history = historyIterator.next();
                    historyIterator.remove();
                    em.remove(history);
                }
                if (LOG.isDebugEnabled()) {
                    LOG.debug("Deleting resource " + res);
View Full Code Here

Examples of org.rhq.core.domain.resource.CreateResourceHistory

        if (resourceType.isCreatable()) {
            // If a newly discovered resource is of a creatable type, search for a matching CreateResourceHistory.
            // If it exists, then this resource comes from the resource creation process and we must give it the name
            // initially supplied by the user.
            CreateResourceHistory matchingHistory = findMatchingCreateResourceHistory(parentId,
                resource.getResourceKey());
            if (matchingHistory != null) {
                String userSuppliedResourceName = matchingHistory.getCreatedResourceName();
                if (!isBlank(userSuppliedResourceName) && !userSuppliedResourceName.equals(resource.getName())) {
                    resource.setName(userSuppliedResourceName);
                }
            }
        }
View Full Code Here

Examples of org.rhq.core.domain.resource.CreateResourceHistory

                DESC)));
        query.setParameter("parentResourceId", parentId);
        query.setParameter("newResourceKey", resourceKey);
        Iterator iterator = query.getResultList().iterator();
        if (iterator.hasNext()) {
            CreateResourceHistory next = (CreateResourceHistory) iterator.next();
            if (next.getStatus() == SUCCESS) {
                return next;
            }
        }
        return null;
    }
View Full Code Here

Examples of org.rhq.core.domain.resource.CreateResourceHistory

    public Object getAsObject(FacesContext facesContext, UIComponent uiComponent, String string) {
        int historyId = Integer.parseInt(string);

        ResourceFactoryManagerLocal resourceFactoryManager = LookupUtil.getResourceFactoryManager();
        CreateResourceHistory historyItem = resourceFactoryManager.getCreateHistoryItem(historyId);

        return historyItem;
    }
View Full Code Here

Examples of org.rhq.core.domain.resource.CreateResourceHistory

        return historyItem;
    }

    public String getAsString(FacesContext facesContext, UIComponent uiComponent, Object object) {
        CreateResourceHistory history = (CreateResourceHistory) object;
        return Integer.toString(history.getId());
    }
View Full Code Here

Examples of org.rhq.core.domain.resource.CreateResourceHistory

        if (LOG.isDebugEnabled()) {
            LOG.debug("Received call to complete create resource: " + response);
        }

        // Load the persisted history entry
        CreateResourceHistory history = entityManager.find(CreateResourceHistory.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.setNewResourceKey(response.getResourceKey());
        history.setErrorMessage(response.getErrorMessage());
        history.setStatus(response.getStatus());

        // The configuration may now have error messages in it, so merge with the persisted one
        if (response.getResourceConfiguration() != null) {
            entityManager.merge(response.getResourceConfiguration());
        }
View Full Code Here

Examples of org.rhq.core.domain.resource.CreateResourceHistory

        // CreateResourceHistory.configuration is one-to-one, so make sure to clone the config, zeroing out all id's.
        Configuration configurationClone = (configuration != null) ? configuration.deepCopy(false) : null;

        // Persist and establish relationships
        CreateResourceHistory history = new CreateResourceHistory(parentResource, resourceType, user.getName(),
            configurationClone);
        history.setCreatedResourceName(createResourceName);
        history.setStatus(CreateResourceStatus.IN_PROGRESS);

        entityManager.persist(history);
        parentResource.addCreateChildResourceHistory(history);

        // Caller will need this
View Full Code Here

Examples of org.rhq.core.domain.resource.CreateResourceHistory

        // Persist and establish relationships
        // TODO: Note, InstalledPackage is set to null because it doesn't really make sense. An InstalledPackage
        // represents a backing package relationship between a Resource and a PackageVersion, not its parent.
        // I think it should probably be removed from the history entity. -jshaughn 9/1/09.
        CreateResourceHistory history = new CreateResourceHistory(parentResource, resourceType, user.getName(),
            (InstalledPackage) null);
        history.setCreatedResourceName(createResourceName);
        history.setConfiguration(deploymentTimeConfiguration);
        history.setStatus(CreateResourceStatus.IN_PROGRESS);

        entityManager.persist(history);
        parentResource.addCreateChildResourceHistory(history);

        // Caller will need this
View Full Code Here

Examples of org.rhq.core.domain.resource.CreateResourceHistory

    public CreateResourceHistory getCreateHistoryItem(int historyItemId) {
        Query query = entityManager.createNamedQuery(CreateResourceHistory.QUERY_FIND_BY_ID);
        query.setParameter("id", historyItemId);

        CreateResourceHistory history = (CreateResourceHistory) query.getSingleResult();

        return history;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.