Package org.rhq.core.domain.bundle

Examples of org.rhq.core.domain.bundle.BundleGroup


        });
    }

    @Override
    public BundleGroup copyValues(Record from) {
        BundleGroup to = new BundleGroup();

        to.setId(from.getAttributeAsInt(FIELD_ID));
        to.setName(from.getAttributeAsString(FIELD_NAME));
        to.setDescription(from.getAttributeAsString(FIELD_DESCRIPTION));

        Record[] bundleRecords = from.getAttributeAsRecordArray(FIELD_BUNDLES);
        Set<Bundle> bundles = new BundlesDataSource().buildDataObjects(bundleRecords);
        to.setBundles(bundles);

        return to;
    }
View Full Code Here


                BundleGroupsDataSource ds = (BundleGroupsDataSource) getDataSource();
                final ArrayList<String> doomedNames = new ArrayList<String>(selections.length);
                int[] doomedIds = new int[selections.length];
                int i = 0;
                for (ListGridRecord selection : selections) {
                    BundleGroup object = ds.copyValues(selection);
                    doomedNames.add(object.getName());
                    doomedIds[i++] = object.getId();
                }

                BundleGWTServiceAsync bundleManager = GWTServiceLookup.getBundleService();
                bundleManager.deleteBundleGroups(doomedIds, new AsyncCallback<Void>() {
                    public void onFailure(Throwable caught) {
View Full Code Here

        return tab;
    }

    @Override
    protected Record createNewRecord() {
        BundleGroup bundleGroup = new BundleGroup();
        Record bundleGroupRecord = BundleGroupsDataSource.getInstance().copyValues(bundleGroup);
        return bundleGroupRecord;
    }
View Full Code Here

                    response.setStatus(DSResponse.STATUS_FAILURE);
                    processResponse(request.getRequestId(), response);
                }

                public void onSuccess(final PageList<Bundle> result) {
                    BundleGroup unassignedBundleGroup = new BundleGroup();
                    unassignedBundleGroup.setId(0); // ID=0 is an indicator we use to denote the unassigned group
                    unassignedBundleGroup.setName(MSG.view_bundle_tree_unassigned_name());
                    unassignedBundleGroup.setDescription(MSG.view_bundle_tree_unassigned_desc());

                    // Because findBundleGroupsByCriteria would not have given us all unassigned bundles, we used
                    // findBundlesByCriteria. But we need to organize our tree structure with groups at the top, so
                    // we need to put our results aggregated in groups.
                    HashMap<Integer, BundleGroup> visibleBundleGroups = new HashMap<Integer, BundleGroup>();
                    for (Bundle bundle : result) {
                        Set<BundleGroup> bundleBundleGroups = bundle.getBundleGroups();
                        if (bundleBundleGroups == null || bundleBundleGroups.isEmpty()) {
                            unassignedBundleGroup.addBundle(bundle);
                        } else {
                            for (BundleGroup bundleBundleGroup : bundleBundleGroups) {
                                BundleGroup theGroup = visibleBundleGroups.get(bundleBundleGroup.getId());
                                if (theGroup == null) {
                                    visibleBundleGroups.put(bundleBundleGroup.getId(), bundleBundleGroup);
                                    theGroup = bundleBundleGroup;
                                }
                                theGroup.addBundle(bundle);
                            }
                        }
                    }

                    final ArrayList<BundleGroup> allVisibleBundleGroups = new ArrayList<BundleGroup>(visibleBundleGroups.values());
View Full Code Here

            // the resultant item is a direct node to build
            records.add(copyValuesForKnownBundle(item, bundleGroupId, bundleId));

            // now build the children of the node
            if (item instanceof BundleGroup) {
                BundleGroup bundleGroup = (BundleGroup) item;
                Set<Bundle> bundles = bundleGroup.getBundles();
                if (bundles != null) {
                    for (Bundle bundle : bundles) {
                        records.add(copyValuesForKnownBundle(bundle, bundleGroup.getId(), bundle.getId()));
                        // while we are here, automatically add the two direct children - the versions and destinations folders
                        TreeNode versionNode = new TreeNode(MSG.view_bundle_versions());
                        versionNode.setID(bundleGroup.getId() + "_" + bundle.getId() + "_versions");
                        versionNode.setParentID(bundleGroup.getId() + "_" + bundle.getId());
                        versionNode.setName(MSG.view_bundle_versions());
                        records.add(versionNode);

                        TreeNode deploymentsNode = new TreeNode(MSG.view_bundle_destinations());
                        deploymentsNode.setID(bundleGroup.getId() + "_" + bundle.getId() + "_destinations");
                        deploymentsNode.setParentID(bundleGroup.getId() + "_" + bundle.getId());
                        deploymentsNode.setName(MSG.view_bundle_destinations());
                        records.add(deploymentsNode);
                    }
                }
View Full Code Here

        String parentID;
        TreeNode node = new TreeNode();
        String sortValue = "";

        if (from instanceof BundleGroup) {
            BundleGroup bundleGroup = (BundleGroup) from;
            node.setIsFolder(true);
            node.setIcon("subsystems/bundle/BundleGroup_16.png");
            node.setID(String.valueOf(bundleGroup.getId()));
            node.setName(StringUtility.escapeHtml(bundleGroup.getName()));

            if (bundleGroup.getId() == 0) {
                node.setEnabled(false);
                sortValue = "\uFFFDZZZZ"; // always show this as the last folder node in the tree
            } else{
                sortValue = bundleGroup.getName();
            }
        } else if (from instanceof Bundle) {
            Bundle bundle = (Bundle) from;
            node.setIsFolder(true);
            node.setIcon("subsystems/bundle/Bundle_16.png");
View Full Code Here

        // create role and bundle group, then assign them together
        // then delete BG and verify role still exists
        getTransactionManager().begin();
        EntityManager em = getEntityManager();
        try {
            BundleGroup bg = createBundleGroup(em);
            Role role = createRole(em);
            bg.addRole(role);
            em.persist(bg);
            em.persist(role);
            em.remove(bg);
            this.assertNotNull("Role previously assigned to BundleGroups must exist after BG was deleted", em.find(Role.class, role.getId()));      
View Full Code Here

            getTransactionManager().rollback();
        }
    }

    private BundleGroup createBundleGroup(EntityManager em) {
        BundleGroup bg = new BundleGroup("test-group");
        em.persist(bg);
        return bg;
    }
View Full Code Here

TOP

Related Classes of org.rhq.core.domain.bundle.BundleGroup

Copyright © 2018 www.massapicom. 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.