Package org.rhq.core.domain.resource

Examples of org.rhq.core.domain.resource.Resource.addChildResource()


            pojoResource.setParentResource(convertToPojoResource(resource.getParentResource(), false));
        }
        if (includeDescendants) {
            for (Resource childResource : resource.getChildResources()) {
                if (isVisibleInInventory(childResource)) {
                    pojoResource.addChildResource(convertToPojoResource(childResource, true));
                }
            }
        }
        return pojoResource;
    }
View Full Code Here


                    existingResource.getParentResource().removeChildResource(existingResource);
                }
                if (updatedParent != Resource.ROOT) {
                    // get attached entity for parent so we can add the child
                    updatedParent = entityManager.find(Resource.class, updatedParent.getId());
                    updatedParent.addChildResource(existingResource);
                } else {
                    existingResource.setParentResource(Resource.ROOT);
                }

            } else {
View Full Code Here

                result.add(resource); // the platform, make sure we have this
                continue;
            }
            Resource parent = resourceMap.get(resource.getParentResource().getId());
            if (null != parent) {
                parent.addChildResource(resource);
            } else {
                result.add(resource);
            }
        }
View Full Code Here

        if (parent != Resource.ROOT) {
            // Only set the relationships if this is not a root resource.
            // The cardinal rule is to add the relationship in both directions,
            // so the parent will have direct access to this child after the method returns.
            resource.setParentResource(parent);
            parent.addChildResource(resource);
        }

        entityManager.persist(resource);
        LOG.debug("********* resource persisted ************");
        // Execute sub-methods as overlord to bypass additional security checks.
View Full Code Here

        Resource parent = agentSideResource.getParentResource();
        if (parent != null && parent != Resource.ROOT) {
            parent = fakePersist(agentSideResource.getParentResource(), requiredInventoryStatus, inProgressUUIds);
            persisted.setParentResource(parent);
            parent.addChildResource(persisted);
        } else {
            persisted.setParentResource(parent);
        }

        if (added) {
View Full Code Here

        Resource parent = agentSideResource.getParentResource();
        if (parent != null && parent != Resource.ROOT) {
            parent = fakePersist(agentSideResource.getParentResource(), statusJudge, inProgressUUIds);
            persisted.setParentResource(parent);
            parent.addChildResource(persisted);
        } else {
            persisted.setParentResource(parent);
        }

        //persist the children
View Full Code Here

            TEST_TOP_LEVEL_SERVER_TYPE);
        Resource service = new Resource();
        service.setResourceType(testServiceType);
        Resource topLevelServer = new Resource();
        topLevelServer.setResourceType(TEST_TOP_LEVEL_SERVER_TYPE);
        topLevelServer.addChildResource(service);
        Resource platform = new Resource();
        platform.setResourceType(TEST_PLATFORM_TYPE);
        platform.addChildResource(topLevelServer);
        assertSame(topLevelServer, getBaseServerOrService(service));
    }
View Full Code Here

        Resource topLevelServer = new Resource();
        topLevelServer.setResourceType(TEST_TOP_LEVEL_SERVER_TYPE);
        topLevelServer.addChildResource(service);
        Resource platform = new Resource();
        platform.setResourceType(TEST_PLATFORM_TYPE);
        platform.addChildResource(topLevelServer);
        assertSame(topLevelServer, getBaseServerOrService(service));
    }

}
View Full Code Here

                if (res.getParentResource() == Resource.ROOT) {
                    platform = persisted;
                } else {
                    Resource parent = simulatedInventory.get(res.getParentResource().getUuid().hashCode());
                    if (parent != null) {
                        parent.addChildResource(persisted);
                    }
                }
            }
            for (Resource child : res.getChildResources()) {
                persistInSimulatedInventory(child);
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.