IDegreeCurricularPlan degreeCurricularPlan = (IDegreeCurricularPlan) suportePersistente .getIPersistentDegreeCurricularPlan().readByOID(DegreeCurricularPlan.class,degreeCurricularPlanID);  if (degreeCurricularPlan == null) { throw new FenixServiceException("error.impossibleEditDegreeInfo"); }   executionDegrees = degreeCurricularPlan.getExecutionDegrees();  if (executionDegrees == null) { throw new FenixServiceException("error.impossibleEditDegreeInfo"); }   Collections.sort(executionDegrees, new Comparator() { public int compare(Object o1, Object o2) { return ((IExecutionDegree) o1).getExecutionYear().getBeginDate().compareTo( ((IExecutionDegree) o1).getExecutionYear().getBeginDate()); } });     IDegree degree = degreeCurricularPlan.getDegree(); if (degree == null) { throw new FenixServiceException("error.impossibleEditDegreeInfo"); }   IPersistentDegreeInfo persistentDegreeInfo = suportePersistente.getIPersistentDegreeInfo(); degreeInfo = (IDegreeInfo) persistentDegreeInfo.readByOID(DegreeInfo.class, infoDegreeInfoId, true);   IExecutionDegree executionDegree = getActiveExecutionDegree(executionDegrees); if (executionDegree == null) { throw new FenixServiceException("error.impossibleEditDegreeInfo"); }    if (degreeInfo == null || (!verifyExecutionYear(degreeInfo.getLastModificationDate(), executionDegree.getExecutionYear()))) { degreeInfo = DomainFactory.makeDegreeInfo();   degreeInfo.setDegree(degree); }   degreeInfo.setDescription(infoDegreeInfo.getDescription()); degreeInfo.setObjectives(infoDegreeInfo.getObjectives()); degreeInfo.setHistory(infoDegreeInfo.getHistory()); degreeInfo.setProfessionalExits(infoDegreeInfo.getProfessionalExits()); degreeInfo.setAdditionalInfo(infoDegreeInfo.getAdditionalInfo()); degreeInfo.setLinks(infoDegreeInfo.getLinks()); degreeInfo.setTestIngression(infoDegreeInfo.getTestIngression()); degreeInfo.setDriftsInitial(infoDegreeInfo.getDriftsInitial()); degreeInfo.setDriftsFirst(infoDegreeInfo.getDriftsFirst()); degreeInfo.setDriftsSecond(infoDegreeInfo.getDriftsSecond()); degreeInfo.setClassifications(infoDegreeInfo.getClassifications()); degreeInfo.setMarkMin(infoDegreeInfo.getMarkMin()); degreeInfo.setMarkMax(infoDegreeInfo.getMarkMax()); degreeInfo.setMarkAverage(infoDegreeInfo.getMarkAverage());   degreeInfo.setDescriptionEn(infoDegreeInfo.getDescriptionEn()); degreeInfo.setObjectivesEn(infoDegreeInfo.getObjectivesEn()); degreeInfo.setHistoryEn(infoDegreeInfo.getHistoryEn()); degreeInfo.setProfessionalExitsEn(infoDegreeInfo.getProfessionalExitsEn()); degreeInfo.setAdditionalInfoEn(infoDegreeInfo.getAdditionalInfoEn()); degreeInfo.setLinksEn(infoDegreeInfo.getLinksEn()); degreeInfo.setTestIngressionEn(infoDegreeInfo.getTestIngressionEn()); degreeInfo.setClassificationsEn(infoDegreeInfo.getClassificationsEn());   degreeInfo.setLastModificationDate(new Timestamp(Calendar.getInstance().getTimeInMillis()));  } catch (ExcepcaoPersistencia e) { e.printStackTrace(); throw new FenixServiceException(e);
if (degreeCurricularPlanID == null) { throw new FenixServiceException("error.impossibleEditDegreeInfo");
    public InfoDegreeInfo run(Integer degreeCurricularPlanID, Integer infoDegreeInfoId,            InfoDegreeInfo infoDegreeInfo) throws FenixServiceException {        IDegreeInfo degreeInfo = null;        List executionDegrees = null;        try {            ISuportePersistente suportePersistente = PersistenceSupportFactory.getDefaultPersistenceSupport();            if (degreeCurricularPlanID == null || infoDegreeInfoId == null || infoDegreeInfo == null) {                throw new FenixServiceException("error.impossibleEditDegreeInfo");            }            // degree curricular plan            IDegreeCurricularPlan degreeCurricularPlan = (IDegreeCurricularPlan) suportePersistente                    .getIPersistentDegreeCurricularPlan().readByOID(DegreeCurricularPlan.class,degreeCurricularPlanID);            if (degreeCurricularPlan == null) {                throw new FenixServiceException("error.impossibleEditDegreeInfo");            }            // and correspondent execution degrees			executionDegrees = degreeCurricularPlan.getExecutionDegrees();			if (executionDegrees == null) {				throw new FenixServiceException("error.impossibleEditDegreeInfo");	        }            // sort them by begin date            Collections.sort(executionDegrees, new Comparator() {                public int compare(Object o1, Object o2) {                    return ((IExecutionDegree) o1).getExecutionYear().getBeginDate().compareTo(                            ((IExecutionDegree) o1).getExecutionYear().getBeginDate());                }            });                       //Degree            IDegree degree = degreeCurricularPlan.getDegree();            if (degree == null) {                throw new FenixServiceException("error.impossibleEditDegreeInfo");            }            //DegreeInfo            IPersistentDegreeInfo persistentDegreeInfo = suportePersistente.getIPersistentDegreeInfo();            degreeInfo = (IDegreeInfo) persistentDegreeInfo.readByOID(DegreeInfo.class, infoDegreeInfoId, true);            //decide which is the execution year which we want to edit            IExecutionDegree executionDegree = getActiveExecutionDegree(executionDegrees);            if (executionDegree == null) {                throw new FenixServiceException("error.impossibleEditDegreeInfo");            }                        //verify if the record found is in this execution period or if is new in database 			//if it isn't, is necessary to create a new record            if (degreeInfo == null || (!verifyExecutionYear(degreeInfo.getLastModificationDate(), executionDegree.getExecutionYear()))) {                degreeInfo = DomainFactory.makeDegreeInfo();                //associate the degree                degreeInfo.setDegree(degree);            }            //update information that it will be displayed in degree site.            degreeInfo.setDescription(infoDegreeInfo.getDescription());            degreeInfo.setObjectives(infoDegreeInfo.getObjectives());            degreeInfo.setHistory(infoDegreeInfo.getHistory());            degreeInfo.setProfessionalExits(infoDegreeInfo.getProfessionalExits());            degreeInfo.setAdditionalInfo(infoDegreeInfo.getAdditionalInfo());            degreeInfo.setLinks(infoDegreeInfo.getLinks());            degreeInfo.setTestIngression(infoDegreeInfo.getTestIngression());            degreeInfo.setDriftsInitial(infoDegreeInfo.getDriftsInitial());            degreeInfo.setDriftsFirst(infoDegreeInfo.getDriftsFirst());            degreeInfo.setDriftsSecond(infoDegreeInfo.getDriftsSecond());            degreeInfo.setClassifications(infoDegreeInfo.getClassifications());            degreeInfo.setMarkMin(infoDegreeInfo.getMarkMin());            degreeInfo.setMarkMax(infoDegreeInfo.getMarkMax());            degreeInfo.setMarkAverage(infoDegreeInfo.getMarkAverage());            //update information in english that it will be displayed in degree site.            degreeInfo.setDescriptionEn(infoDegreeInfo.getDescriptionEn());            degreeInfo.setObjectivesEn(infoDegreeInfo.getObjectivesEn());            degreeInfo.setHistoryEn(infoDegreeInfo.getHistoryEn());            degreeInfo.setProfessionalExitsEn(infoDegreeInfo.getProfessionalExitsEn());            degreeInfo.setAdditionalInfoEn(infoDegreeInfo.getAdditionalInfoEn());            degreeInfo.setLinksEn(infoDegreeInfo.getLinksEn());            degreeInfo.setTestIngressionEn(infoDegreeInfo.getTestIngressionEn());            degreeInfo.setClassificationsEn(infoDegreeInfo.getClassificationsEn());            //update last modification date            degreeInfo.setLastModificationDate(new Timestamp(Calendar.getInstance().getTimeInMillis()));        } catch (ExcepcaoPersistencia e) {            e.printStackTrace();            throw new FenixServiceException(e);        }        return InfoDegreeInfoWithDegree.newInfoFromDomain(degreeInfo);    }