Package org.rhq.core.domain.content

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


        String advisoryType = "BugFix Advisory";
        String synopsis = "synopsis to test advisory creation";

        int id1 = advManager.createAdvisory(overlord, advisory, advisoryType, synopsis).getId();

        Advisory advobject = advManager.getAdvisoryByName(advisory);

        assert advobject != null;
        assert id1 == advobject.getId();
        advManager.deleteAdvisoryByAdvId(overlord, advobject.getId());
        advobject = advManager.getAdvisoryByName(advobject.getAdvisory());
        assert advobject == null;

    }
View Full Code Here


        String advisory = "RHBA-2009:1202-4";
        String advisoryType = "BugFix Advisory";
        String synopsis = "synopsis to test advisory creation";

        Advisory advobject = new Advisory(advisory, advisoryType, synopsis);
        entityManager.persist(advobject);
        int id1 = advobject.getId();
        entityManager.flush();

        CVE cve = advManager.createCVE(overlord, "CAN-2009:1203");
        AdvisoryCVE advisory_cve = advManager.createAdvisoryCVE(overlord, advobject, cve);

        PageList<AdvisoryCVE> cvelist = advManager.getAdvisoryCVEByAdvId(overlord, id1, PageControl
            .getUnlimitedInstance());

        assert cvelist != null;
        assert cvelist.size() != 0;
        advManager.deleteAdvisoryCVE(overlord, id1);
        advManager.deleteCVE(overlord, cve.getId());
        advManager.deleteAdvisoryByAdvId(overlord, advobject.getId());
        advobject = advManager.getAdvisoryByName(advobject.getAdvisory());
        assert advobject == null;

    }
View Full Code Here

        String advisory = "RHBA-2009:1202-4";
        String advisoryType = "BugFix Advisory";
        String synopsis = "synopsis to test advisory creation";

        Advisory advobject = advManager.createAdvisory(overlord, advisory, advisoryType, synopsis); //new Advisory(advisory, advisoryType, synopsis);
        int id1 = advobject.getId();

        ResourceType resourceType1 = new ResourceType("platform-" + System.currentTimeMillis(), "TestPlugin",
            ResourceCategory.PLATFORM, null);
        em.persist(resourceType1);
        em.flush();
View Full Code Here

    @RequiredPermission(Permission.MANAGE_INVENTORY)
    public Advisory createAdvisory(Subject user, String advisory, String advisoryType, String synopsis)
        throws AdvisoryException {

        Advisory adv = new Advisory(advisory, advisoryType, synopsis);

        validateAdvisory(adv);
        entityManager.persist(adv);

        return adv;
View Full Code Here

        RepoManagerLocal repoManager = LookupUtil.getRepoManagerLocal();
        Subject overlord = LookupUtil.getSubjectManager().getOverlord();
        List<AdvisoryDetails> newDetails = report.getAdvisory();
        for (AdvisoryDetails detail : newDetails) {
            try {
                Advisory newAdv = advManager.getAdvisoryByName(detail.getAdvisory());
                if (newAdv == null) {
                    // Advisory does not exist, create a new one
                    log.debug("Attempting to create new advisory based off of: " + detail);
                    newAdv = advManager.createAdvisory(overlord, detail.getAdvisory(), detail.getAdvisory_type(),
                        detail.getSynopsis());
                    newAdv.setAdvisory_name(detail.getAdvisory_name());
                    newAdv.setAdvisory_rel(detail.getAdvisory_rel());
                    newAdv.setDescription(detail.getDescription());
                    newAdv.setSolution(detail.getSolution());
                    newAdv.setIssue_date(detail.getIssue_date());
                    newAdv.setUpdate_date(detail.getUpdate_date());
                    newAdv.setTopic(detail.getTopic());
                    entityManager.flush();
                    entityManager.persist(newAdv);
                }

                Repo repo = repoManager.getRepo(overlord, report.getRepoId());
                RepoAdvisory repoAdv = new RepoAdvisory(repo, newAdv);
                log.debug("Created new mapping of RepoAdvisory repoId = " + repo.getId() + ", distId = "
                    + newAdv.getId());
                entityManager.flush();
                entityManager.persist(repoAdv);
                // persist pkgs associated with an errata
                List<AdvisoryPackageDetails> pkgs = detail.getPkgs();

                Query q = entityManager.createNamedQuery(PackageVersion.QUERY_FIND_PACKAGEVERSION_BY_FILENAME);
                for (AdvisoryPackageDetails pkg : pkgs) {
                    try {
                        q.setParameter("rpmName", pkg.getRpmFilename());
                        PackageVersion pExisting = (PackageVersion) q.getSingleResult();
                        AdvisoryPackage apkg = advManager.findAdvisoryPackage(overlord, newAdv.getId(), pExisting
                            .getId());
                        if (apkg == null) {
                            apkg = new AdvisoryPackage(newAdv, pExisting);
                            entityManager.persist(apkg);
                            entityManager.flush();
                        }
                    } catch (NoResultException nre) {
                        log.info("Advisory has package thats not yet in the db [" + pkg.getRpmFilename()
                            + "] - Processing rest");
                    }
                }
                //persist cves associated with an errata
                List<AdvisoryCVEDetails> cves = detail.getCVEs();
                log.debug("list of CVEs " + cves);
                if (cves != null && cves.size() > 0) {
                    for (AdvisoryCVEDetails cve : cves) {
                        AdvisoryCVE acve = new AdvisoryCVE(newAdv, advManager.createCVE(overlord, cve.getName()));
                        entityManager.persist(acve);
                        entityManager.flush();
                    }
                }

                List<AdvisoryBugDetails> abugs = detail.getBugs();
                log.debug("list of Bugs " + abugs);
                if (abugs != null && abugs.size() > 0) {
                    for (AdvisoryBugDetails abug : abugs) {
                        AdvisoryBuglist abuglist = advManager.getAdvisoryBuglist(overlord, newAdv.getId(), abug
                            .getBugInfo());
                        if (abuglist == null) {
                            abuglist = new AdvisoryBuglist(newAdv, abug.getBugInfo());
                            entityManager.persist(abuglist);
                            entityManager.flush();
View Full Code Here

        AdvisoryManagerLocal advManager = LookupUtil.getAdvisoryManagerLocal();
        Subject overlord = LookupUtil.getSubjectManager().getOverlord();

        // remove all advisories that are no longer available on the remote repository
        for (AdvisoryDetails advDetails : report.getDeletedAdvisorys()) {
            Advisory nukeAdv = advManager.getAdvisoryByName(advDetails.getAdvisory());
            advManager.deleteAdvisoryCVE(overlord, nukeAdv.getId());
            advManager.deleteAdvisoryPackage(overlord, nukeAdv.getId());
            advManager.deleteAdvisoryBugList(overlord, nukeAdv.getId());
            advManager.deleteAdvisoryByAdvId(overlord, nukeAdv.getId());

            progress.append("Removed advisory & advisory cves for: " + advDetails.getAdvisory());
            syncResults.setResults(progress.toString());
            syncResults = repoManager.mergeRepoSyncResults(syncResults);
        }
View Full Code Here

TOP

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

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.