graduationType);
description);
    public InfoGuide run(String graduationType, InfoExecutionDegree infoExecutionDegree, Integer number,            String requesterType, Integer contributorNumber, String contributorName,            String contributorAddress) throws FenixServiceException {        ISuportePersistente sp = null;        IContributor contributor = null;        IMasterDegreeCandidate masterDegreeCandidate = null;        IGuide guide = new Guide();        InfoGuide infoGuide = new InfoGuideWithPersonAndExecutionDegreeAndContributor();        // Read the Contributor        try {            sp = PersistenceSupportFactory.getDefaultPersistenceSupport();            contributor = sp.getIPersistentContributor().readByContributorNumber(contributorNumber);            if ((contributor == null)                    && ((contributorAddress == null) || (contributorAddress.length() == 0)                            || (contributorName.length() == 0) || (contributorName == null))) {                throw new NonExistingContributorServiceException();            }            if ((contributor == null) && (contributorAddress != null)                    && (contributorAddress.length() != 0) && (contributorName.length() != 0)                    && (contributorName != null)) {                // Create the Contributor                contributor = new Contributor();                sp.getIPersistentContributor().simpleLockWrite(contributor);                contributor.setContributorNumber(contributorNumber);                contributor.setContributorAddress(contributorAddress);                contributor.setContributorName(contributorName);            }        } catch (ExcepcaoPersistencia ex) {            FenixServiceException newEx = new FenixServiceException("Persistence layer error", ex);            throw newEx;        }        Integer year = null;        Calendar calendar = Calendar.getInstance();        year = new Integer(calendar.get(Calendar.YEAR));        IExecutionDegree executionDegree = null;        try {            executionDegree = (IExecutionDegree) sp.getIPersistentExecutionDegree().readByOID(                    ExecutionDegree.class, infoExecutionDegree.getIdInternal());        } catch (ExcepcaoPersistencia ex) {            FenixServiceException newEx = new FenixServiceException("Persistence layer error", ex);            throw newEx;        }        // Check if the Requester is a Candidate        if (requesterType.equals(GuideRequester.CANDIDATE.name())) {            try {                masterDegreeCandidate = sp.getIPersistentMasterDegreeCandidate()                        .readByNumberAndExecutionDegreeAndSpecialization(number, executionDegree,                                Specialization.valueOf(graduationType));            } catch (ExcepcaoPersistencia ex) {                FenixServiceException newEx = new FenixServiceException("Persistence layer error", ex);                throw newEx;            }            // Check if the Candidate Exists            if (masterDegreeCandidate == null)                throw new NonExistingServiceException("O Candidato", null);            // Get the price for the Candidate Application            IPrice price = null;            try {                price = sp.getIPersistentPrice().readByGraduationTypeAndDocumentTypeAndDescription(                        GraduationType.MASTER_DEGREE, DocumentType.APPLICATION_EMOLUMENT,                        graduationType);            } catch (ExcepcaoPersistencia ex) {                FenixServiceException newEx = new FenixServiceException("Persistence layer error");                newEx.fillInStackTrace();                throw newEx;            }            if (price == null) {                throw new FenixServiceException("Unkown Application Price");            }            guide.setContributor(contributor);            guide.setPerson(masterDegreeCandidate.getPerson());            guide.setYear(year);            guide.setTotal(price.getPrice());            guide.setCreationDate(calendar.getTime());            guide.setVersion(new Integer(1));            guide.setExecutionDegree(executionDegree);            infoGuide = InfoGuideWithPersonAndExecutionDegreeAndContributor.newInfoFromDomain(guide);            InfoGuideEntry infoGuideEntry = new InfoGuideEntry();            infoGuideEntry.setDescription(price.getDescription());            infoGuideEntry.setDocumentType(price.getDocumentType());            infoGuideEntry.setGraduationType(price.getGraduationType());            infoGuideEntry.setInfoGuide(infoGuide);            infoGuideEntry.setPrice(price.getPrice());            infoGuideEntry.setQuantity(new Integer(1));            List infoGuideEntries = new ArrayList();            infoGuideEntries.add(infoGuideEntry);            infoGuide.setInfoGuideEntries(infoGuideEntries);            infoGuide.setGuideRequester(GuideRequester.CANDIDATE);        }        if (requesterType.equals(GuideRequester.STUDENT.name())) {            IStudent student = null;            try {                student = sp.getIPersistentStudent().readStudentByNumberAndDegreeType(number,                        DegreeType.MASTER_DEGREE);                if (student == null)                    throw new NonExistingServiceException("O Aluno", null);                List studentCurricularPlanList = sp.getIStudentCurricularPlanPersistente()                        .readAllByStudentAndDegreeCurricularPlan(student,                                executionDegree.getDegreeCurricularPlan());                // check if student curricular plan contains selected execution                // degree                if (studentCurricularPlanList.isEmpty()) {                    throw new NonExistingServiceException("O Aluno", null);                }            } catch (ExcepcaoPersistencia ex) {                FenixServiceException newEx = new FenixServiceException("Persistence layer error");                newEx.fillInStackTrace();                throw newEx;            }            // Check if the Candidate Exists            if (student == null)                throw new NonExistingServiceException("O Aluno", null);            guide.setContributor(contributor);            guide.setPerson(student.getPerson());            guide.setYear(year);            guide.setCreationDate(calendar.getTime());            guide.setVersion(new Integer(1));            guide.setExecutionDegree(executionDegree);            infoGuide = InfoGuideWithPersonAndExecutionDegreeAndContributor.newInfoFromDomain(guide);            infoGuide.setInfoGuideEntries(new ArrayList());            infoGuide.setGuideRequester(GuideRequester.STUDENT);        }        return infoGuide;    }