Package eu.scape_project.planning.exception

Examples of eu.scape_project.planning.exception.PlanningException


    public void deleteCriteriaHierarchy(int hierarchyId) throws PlanningException {
        CriteriaHierarchy criteriaHierarchy = em.find(CriteriaHierarchy.class, hierarchyId);

        if (criteriaHierarchy == null) {
            log.error("Could not find criteria hiearachy [{}].", hierarchyId);
            throw new PlanningException("Could not find criteria hiearachy [" + hierarchyId + "]");
        }

        em.remove(criteriaHierarchy);
        log.info("Deleted CriteriaHierarchy with id [{}]", hierarchyId);
View Full Code Here


            jhoveElement.addAttribute("encoding", "base64");
            try {
                jhoveElement.setText(encodeBase64(jhoveXML.getBytes(PlanXMLConstants.ENCODING)));
            } catch (UnsupportedEncodingException e) {
                log.error("Error writing JHOVE info {}.", e.getMessage());
                throw new PlanningException("Error writing JHOVE info.", e);
            }
        }
        return jhoveElement;
    }
View Full Code Here

            fitsElement.addAttribute("encoding", "base64");
            try {
                fitsElement.setText(encodeBase64(fitsInfo.getBytes(PlanXMLConstants.ENCODING)));
            } catch (UnsupportedEncodingException e) {
                log.error("Error writing fits info {}.", e.getMessage());
                throw new PlanningException("Error writing fits info.", e);
            }
        }
        return fitsElement;
    }
View Full Code Here

                            preservationActionPlanElement = doc.getRootElement();
                            parent.add(preservationActionPlanElement);
                        }
                    } catch (UnsupportedEncodingException e) {
                        log.error("Error parsing preservation action plan {}.", e.getMessage());
                        throw new PlanningException("Error parsing preservation action plan.", e);
                    } catch (DocumentException e) {
                        log.error("Error parsing preservation action plan {}.", e.getMessage());
                        throw new PlanningException("Error parsing preservation action plan.", e);
                    }
                }
            }
        }
View Full Code Here

            Element root = qldGen.getQldNode().getRootElement();
            Element schema = qualityLevelDescription.addElement("schema", "http://purl.oclc.org/dsdl/schematron");
            schema.addAttribute("xmlns", "http://purl.oclc.org/dsdl/schematron");
            schema.add(root.element("pattern").detach());
        } catch (ParserException e) {
            throw new PlanningException("Error parsing collection profile", e);
        } catch (TavernaParserException e) {
            throw new PlanningException("Error parsing executable plan", e);
        }

        return doc;
    }
View Full Code Here

                Long.class);
        q.setParameter("user", user.getUsername());
        q.setParameter("propid", plan.getPlanProperties().getId());
        Long planCount = q.getSingleResult();
        if (planCount != 1) {
            throw new PlanningException("This plan has not been loaded before, reload is not possible.");
        }

        Plan reloadedPlan = em.find(Plan.class, plan.getId());
        this.initializePlan(reloadedPlan);
        log.info("Plan " + reloadedPlan.getPlanProperties().getName() + " reloaded!");
View Full Code Here

                .createQuery("update PlanProperties pp set pp.openHandle = 1, pp.openedByUser = :user where (pp.openHandle is null or pp.openHandle = 0) and pp.id = :propid");
            q.setParameter("user", user.getUsername());
            q.setParameter("propid", propertyId);
            int num = q.executeUpdate();
            if (num < 1) {
                throw new PlanningException("The plan has been loaded by another user. Please choose another plan.");
            }
            // and add it to the list of loaded plans, so we can unlock it in
            // any case
            sessionPlans.add(propertyId);
        }
        // then load the plan
        Object result = em.createQuery("select p.id from Plan p where p.planProperties.id = " + propertyId)
            .getSingleResult();
        if (result != null) {
            Plan plan = loadPlan((Integer) result);
            plan.setReadOnly(readOnly);
            log.info("Plan {} : {} loaded.", propertyId, plan.getPlanProperties().getName());
            return plan;
        } else {
            throw new PlanningException("An unexpected error has occured while loading the plan.");
        }
    }
View Full Code Here

     * @throws PlanningException
     *             if the plan could not be deleted
     */
    public void deletePlan(Plan plan) throws PlanningException {
        if (plan.isReadOnly()) {
            throw new PlanningException("Plans opened in read only mode cannot be deleted!");
        }
        log.info("Deleting plan {} with pid {}", plan.getPlanProperties().getName(), plan.getPlanProperties().getId());
        List<DigitalObject> digitalObjects = plan.getDigitalObjects();
        try {
            em.remove(em.merge(plan));
            em.flush();
            for (DigitalObject obj : digitalObjects) {
                bytestreamManager.delete(obj.getPid());
            }
        } catch (StorageException e) {
            throw e;
        } catch (Exception e) {
            throw new PlanningException("Failed to delete plan: " + plan.getPlanProperties().getName() + " with id: "
                + plan.getPlanProperties().getId(), e);
        }

    }
View Full Code Here

TOP

Related Classes of eu.scape_project.planning.exception.PlanningException

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.