Package org.rhq.core.domain.content

Examples of org.rhq.core.domain.content.PackageVersion


        // The following code is completely unnecessary as the package version ids are already
        // stored in session.
        ContentUIManagerLocal contentUIManager = LookupUtil.getContentUIManager();
        int[] packagesVersionsIdsToDeploy = new int[packageIds.length];
        for (int iterator = 0; iterator < packageIds.length; iterator++) {
            PackageVersion packageVersion = contentUIManager.getPackageVersion(packageIds[iterator]);
            packagesVersionsIdsToDeploy[iterator] = packageVersion.getId();
        }

        Subject subject = EnterpriseFacesContextUtility.getSubject();
        Resource resource = EnterpriseFacesContextUtility.getResource();
View Full Code Here


            ContentUIManagerLocal contentUIManager = LookupUtil.getContentUIManager();

            StringBuffer sb = new StringBuffer("Packages: ");
            int counter = 0;
            for (int pkgId : packageIds) {
                PackageVersion packageVersion = contentUIManager.getPackageVersion(pkgId);
                Package generalPackage = packageVersion.getGeneralPackage();

                String version = packageVersion.getDisplayVersion() != null ? packageVersion.getDisplayVersion()
                    : packageVersion.getVersion();

                String packageToAppend = generalPackage.getName() + " " + version;

                // Don't generate notes that would fail our own validation
                if (sb.toString().length() + packageToAppend.length() > 508) {
View Full Code Here

            List<InstalledPackage> installedPackages = getPackagesToDelete();

            StringBuffer sb = new StringBuffer("Packages: ");
            int counter = 0;
            for (InstalledPackage installedPackage : installedPackages) {
                PackageVersion packageVersion = installedPackage.getPackageVersion();
                Package generalPackage = packageVersion.getGeneralPackage();

                String version = packageVersion.getDisplayVersion() != null ? packageVersion.getDisplayVersion()
                    : packageVersion.getVersion();

                String packageToAppend = generalPackage.getName() + " " + version;

                // Don't generate notes that would fail our own validation
                if (sb.toString().length() + packageToAppend.length() > 508) {
View Full Code Here

    }

    public PackageVersion getPackageVersion(int packageVersionId) {
        Query q = entityManager.createNamedQuery(PackageVersion.QUERY_FIND_BY_ID);
        q.setParameter("id", packageVersionId);
        PackageVersion pv = (PackageVersion) q.getSingleResult();
        return pv;
    }
View Full Code Here

        // default to no required architecture
        architectureId = (null != architectureId) ? architectureId : contentManager.getNoArchitecture().getId();

        // Create/locate package and package version
        PackageVersion packageVersion = null;
        if (packageUploadDetails == null) {
            packageVersion = contentManager.createPackageVersionWithDisplayVersion(user, packageName,
                newPackageType.getId(), packageVersionNumber, null, architectureId, packageBitStream);
        } else {
            packageVersion = contentManager.getUploadedPackageVersion(user, packageName, newPackageType.getId(),
View Full Code Here

            throw new PermissionException("User [" + subject.getName()
                + "] does not have permission to create a child resource for resource [" + parentResource + "]");
        }

        ResourceType newResourceType = entityManager.find(ResourceType.class, newResourceTypeId);
        PackageVersion packageVersion = entityManager.find(PackageVersion.class, packageVersionId);

        if (!newResourceType.isCreatable()
            || (newResourceType.getCreationDataType() != ResourceCreationDataType.CONTENT)) {
            throw new RuntimeException("Cannot create " + newResourceType + " child Resource under parent "
                + parentResource + ", since the " + newResourceType
View Full Code Here

            return null;
        } else if (results.size() == 1) {
            return results.get(0);
        }
       
        PackageVersion latest = results.get(0);
        String packageTypeName = latest.getGeneralPackage().getPackageType().getName();

        Comparator<PackageVersion> versionComparator = null;
        try {
            PackageTypeBehavior behavior = ContentManagerHelper.getPackageTypeBehavior(packageTypeName);
            versionComparator = behavior.getPackageVersionComparator(packageTypeName);
        } catch (Exception e) {
            log.error("Could not get the package type behavior for package type '" + packageTypeName + "'. This should not happen.", e);
        }
       
        if (versionComparator == null) {
            versionComparator = PackageVersion.DEFAULT_COMPARATOR;
        }
       
        Iterator<PackageVersion> it = results.iterator();
        it.next(); //skip the first element, we don't have to compare it with itself
        while(it.hasNext()) {
            PackageVersion current = it.next();
            if (versionComparator.compare(latest, current) < 0) {
                latest = current;
            }
        }
       
View Full Code Here

            // Automatically associate all of the content source's package versions with this repo,
            // but *skip* over the ones that are already linked to this repo from a previous association.
            q.setParameter("id", contentSource.getId());
            List<PackageVersionContentSource> pvcss = q.getResultList();
            for (PackageVersionContentSource pvcs : pvcss) {
                PackageVersion packageVersion = pvcs.getPackageVersionContentSourcePK().getPackageVersion();
                // Only add it if it's not already associated with this repo.
                if (!alreadyAssociatedPackageVersions.contains(packageVersion)) {
                    RepoPackageVersion mapping = new RepoPackageVersion(repo, packageVersion);
                    entityManager.persist(mapping);
                }
View Full Code Here

        }
               
        Repo repo = entityManager.find(Repo.class, repoId);

        for (int packageVersionId : packageVersionIds) {
            PackageVersion packageVersion = entityManager.find(PackageVersion.class, packageVersionId);

            RepoPackageVersion mapping = new RepoPackageVersion(repo, packageVersion);
            entityManager.persist(mapping);
        }
    }
View Full Code Here

        }

        //check that the provided package version actually belongs to the repo
        Repo repo = entityManager.find(Repo.class, repoId);

        PackageVersion pv = entityManager.find(PackageVersion.class, packageVersionId);
        if (pv == null || !pv.getRepos().contains(repo)) {
            throw new IllegalArgumentException("The package version with id " + packageVersionId
                + " does not belong to the repo with id " + repoId + " or does not exist.");
        }

        ByteArrayOutputStream out = new ByteArrayOutputStream();
View Full Code Here

TOP

Related Classes of org.rhq.core.domain.content.PackageVersion

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.