public final Integer createCandidacyNumber() { if (Bennu.getInstance().getCandidaciesSet().size() == 0) { return Integer.valueOf(1); } Candidacy candidacy = Collections.max(Bennu.getInstance().getCandidaciesSet(), new BeanComparator("number")); return candidacy.getNumber() + 1; }
public InquiryGlobalComment(ExecutionCourse executionCourse, ExecutionDegree executionDegree) { super(); setRootDomainObject(Bennu.getInstance()); setExecutionCourse(executionCourse); setExecutionDegree(executionDegree); setCommentOnTeacher(false); }
public static pt.ist.fenixframework.dml.runtime.DirectRelation< org.fenixedu.bennu.core.domain.Bennu, org.fenixedu.academic.domain.phd.candidacy.PhdCandidacyRefereeLetter> getRelationPhdCandidacyRefereeLetterRootDomainObject() { return org.fenixedu.bennu.core.domain.Bennu .getRelationPhdCandidacyRefereeLetterRootDomainObject(); }
public InquiryGlobalComment(Person teacher, ExecutionSemester executionSemester) { super(); setRootDomainObject(Bennu.getInstance()); setTeacher(teacher); setExecutionSemester(executionSemester); setCommentOnTeacher(true); }
public Country( Planet parent, String iso3166alpha2Code, String iso3166alpha3Code, Integer iso3166numericCode, LocalizedString name, LocalizedString nationality, Class<AddressPrinter> iAddressPrinter) { super(); setBennu(Bennu.getInstance()); setUnit( Unit.create( parent.getUnit(), name, iso3166alpha3Code, getPartyType("País", COUNTRY_PARTYTYPE_NAME), getOrCreateAccountabilityType(), new LocalDate(), null, null)); setIso3166alpha2Code(iso3166alpha2Code); setIAddressPrinter(iAddressPrinter); setIso3166alpha3Code(iso3166alpha3Code); setIso3166numericCode(iso3166numericCode); setNationality(nationality); }
public static List<ExecutionDegree> getAllByExecutionCourseAndTeacher( ExecutionCourse executionCourse, Person person) { List<ExecutionDegree> result = new ArrayList<ExecutionDegree>(); for (ExecutionDegree executionDegree : Bennu.getInstance().getExecutionDegreesSet()) { boolean matchExecutionCourse = false; for (CurricularCourse curricularCourse : executionDegree.getDegreeCurricularPlan().getCurricularCoursesSet()) { if (curricularCourse.getAssociatedExecutionCoursesSet().contains(executionCourse)) { matchExecutionCourse = true; break; } } if (!matchExecutionCourse) { continue; } // if teacher is not a coordinator of the executionDegree if (executionDegree.getCoordinatorByTeacher(person) == null) { continue; } result.add(executionDegree); } return result; }
public static Set<AcademicServiceRequest> getAcademicServiceRequests( Party party, Integer year, AcademicServiceRequestSituationType situation, Interval interval) { Set<AcademicServiceRequest> serviceRequests = new HashSet<AcademicServiceRequest>(); Set<AcademicProgram> programs = getProgramsForOperation(party, AcademicOperationType.SERVICE_REQUESTS); Collection<AcademicServiceRequest> possible = null; if (year != null) { possible = AcademicServiceRequestYear.getAcademicServiceRequests(year); } else { possible = Bennu.getInstance().getAcademicServiceRequestsSet(); } for (AcademicServiceRequest request : possible) { if (!programs.contains(request.getAcademicProgram())) { continue; } if (situation != null && !request.getAcademicServiceRequestSituationType().equals(situation)) { continue; } if (interval != null && !interval.contains(request.getActiveSituationDate())) { continue; } serviceRequests.add(request); } return serviceRequests; }
private static Map<PhdProgramFocusArea, Set<PhdProgramPublicCandidacyHashCode>> getApplicants( final List<PhdProgramPublicCandidacyHashCode> unfocusAreaCandidates) { final Map<PhdProgramFocusArea, Set<PhdProgramPublicCandidacyHashCode>> candidates = new TreeMap<PhdProgramFocusArea, Set<PhdProgramPublicCandidacyHashCode>>( PhdProgramFocusArea.COMPARATOR_BY_NAME); for (final PublicCandidacyHashCode hashCode : Bennu.getInstance().getCandidacyHashCodesSet()) { if (hashCode.isFromPhdProgram() && hashCode.hasCandidacyProcess()) { final PhdProgramPublicCandidacyHashCode phdHashCode = (PhdProgramPublicCandidacyHashCode) hashCode; if (phdHashCode.getIndividualProgramProcess().getExecutionYear() != ExecutionYear.readCurrentExecutionYear()) { continue; } if (!PhdIndividualProgramCollaborationType.EPFL.equals( phdHashCode.getIndividualProgramProcess().getCollaborationType())) { continue; } if (!PhdIndividualProgramProcessState.CANDIDACY.equals( phdHashCode.getIndividualProgramProcess().getActiveState())) { continue; } // if (phdHashCode.getPhdProgramCandidacyProcess().isValidatedByCandidate()) // { addCandidate(unfocusAreaCandidates, candidates, phdHashCode); // } } } return candidates; }
private void checkForEqualFocusArea(final MultiLanguageString name) { for (final PhdProgramFocusArea focusArea : Bennu.getInstance().getPhdProgramFocusAreasSet()) { if (focusArea != this && focusArea.getName().equalInAnyLanguage(name)) { throw new DomainException("error.PhdProgramFocusArea.found.area.with.same.name"); } } }
public static List<ExecutionDegree> getAllByDegreeAndCurricularStage( Degree degree, CurricularStage stage) { List<ExecutionDegree> result = new ArrayList<ExecutionDegree>(); if (degree == null) { return result; } if (stage == null) { return result; } for (ExecutionDegree executionDegree : Bennu.getInstance().getExecutionDegreesSet()) { if (!degree.equals(executionDegree.getDegreeCurricularPlan().getDegree())) { continue; } if (!stage.equals(executionDegree.getDegreeCurricularPlan().getCurricularStage())) { continue; } result.add(executionDegree); } return result; }
private List<SelectItem> readAllowedDepartmentUnits() { final List<SelectItem> result = new ArrayList<SelectItem>(); for (final Department department : Bennu.getInstance().getDepartmentsSet()) { if (department.getCompetenceCourseMembersGroup() != null && department.getCompetenceCourseMembersGroup().isMember(getUserView())) { DepartmentUnit departmentUnit = department.getDepartmentUnit(); result.add(new SelectItem(departmentUnit.getExternalId(), departmentUnit.getName())); } } Collections.sort(result, new BeanComparator("label")); if (result.size() == 1) { Department personDepartment = getPersonDepartment(); if (personDepartment != null && !result .get(0) .getValue() .equals(personDepartment.getDepartmentUnit().getExternalId())) { result.add( 0, new SelectItem( personDepartment.getDepartmentUnit().getExternalId(), personDepartment.getName())); } } return result; }
public static Candidacy readByCandidacyNumber(Integer candidacyNumber) { for (Candidacy candidacy : Bennu.getInstance().getCandidaciesSet()) { if (candidacy.getNumber().equals(candidacyNumber)) { return candidacy; } } return null; }
public TutorshipSummaryPeriod( ExecutionSemester executionSemester, LocalDate beginDate, LocalDate endDate) { super(); setRootDomainObject(Bennu.getInstance()); setExecutionSemester(executionSemester); setBeginDate(beginDate); setEndDate(endDate); }
protected ExternalEnrolment() { super(); setRootDomainObject(Bennu.getInstance()); setCreationDateDateTime(new DateTime()); if (AccessControl.getPerson() != null) { setCreatedBy(AccessControl.getPerson().getUsername()); } }
public static Country findByAcronym(String acronym) { for (Country country : Bennu.getInstance().getCountriesSet()) { if (country.getAcronym().equalsIgnoreCase(acronym)) { return country; } } return null; }
public static Country findByIso3166alpha3Code(String code) { for (Country country : Bennu.getInstance().getCountriesSet()) { if (country.getIso3166alpha3Code().equalsIgnoreCase(code)) { return country; } } return null; }
@Test @Atomic(mode = TxMode.READ) public void membership() { assertEquals( Group.logged().getMembers().collect(Collectors.toSet()), Bennu.getInstance().getUserSet()); assertTrue(Group.logged().isMember(user1)); assertFalse(Group.logged().isMember(null)); }
private void checkIfCanCreate(final DateTime start, final DateTime end) { for (final CandidacyPeriod period : Bennu.getInstance().getCandidacyPeriodsSet()) { if (!period.equals(this) && period.isEpflCandidacyPeriod() && period.intercept(start, end)) { throw new DomainException( "error.EPFLInstitutionPhdCandidacyPeriod.already.contains.candidacyPeriod.in.given.dates"); } } }
public static Set<Candidacy> readCandidaciesBetween(final Integer from, final Integer to) { final Set<Candidacy> result = new HashSet<Candidacy>(); for (final Candidacy candidacy : Bennu.getInstance().getCandidaciesSet()) { if (candidacy.getNumber() >= from && candidacy.getNumber() <= to) { result.add(candidacy); } } return result; }
public static EPFLPhdCandidacyPeriod readEPFLPhdCandidacyPeriodForDateTime(final DateTime date) { for (final CandidacyPeriod period : Bennu.getInstance().getCandidacyPeriodsSet()) { if (period.isEpflCandidacyPeriod() && period.contains(date)) { return (EPFLPhdCandidacyPeriod) period; } } return null; }
public static StudentTeacherInquiryTemplate getCurrentTemplate() { final Collection<InquiryTemplate> inquiryTemplates = Bennu.getInstance().getInquiryTemplatesSet(); for (final InquiryTemplate inquiryTemplate : inquiryTemplates) { if (inquiryTemplate instanceof StudentTeacherInquiryTemplate && inquiryTemplate.isOpen()) { return (StudentTeacherInquiryTemplate) inquiryTemplate; } } return null; }
public static CurricularCourseInquiryTemplate getCurrentTemplate() { final Collection<InquiryTemplate> inquiryTemplates = Bennu.getInstance().getInquiryTemplatesSet(); for (final InquiryTemplate inquiryTemplate : inquiryTemplates) { if (inquiryTemplate instanceof CurricularCourseInquiryTemplate && inquiryTemplate.isOpen()) { return (CurricularCourseInquiryTemplate) inquiryTemplate; } } return null; }
public static void init() { for (final DegreeCurricularPlan degreeCurricularPlan : Bennu.getInstance().getDegreeCurricularPlansSet()) { deleteMaximumNumberOfCreditsForEnrolmentPeriod(degreeCurricularPlan); createEnrolmentPeriodRestrictions(degreeCurricularPlan); } EnrolmentPeriodRestrictionsExecutorLogic.configure(); }
public static Country findByName(String name) { for (Country country : Bennu.getInstance().getCountriesSet()) { for (Locale locale : country.getName().getLocales()) { if (country.getName().getContent(locale).equalsIgnoreCase(name)) { return country; } } } return null; }
public static List<ExecutionDegree> getAllByDegree(final Degree degree) { List<ExecutionDegree> result = new ArrayList<ExecutionDegree>(); for (ExecutionDegree executionDegree : Bennu.getInstance().getExecutionDegreesSet()) { if (executionDegree.getDegree() == degree) { result.add(executionDegree); } } return result; }
private List<SelectItem> readDepartmentUnits() { final List<SelectItem> result = new ArrayList<SelectItem>(); for (final Object departmentObject : Bennu.getInstance().getDepartmentsSet()) { DepartmentUnit departmentUnit = ((Department) departmentObject).getDepartmentUnit(); result.add(new SelectItem(departmentUnit.getExternalId(), departmentUnit.getName())); } Collections.sort(result, new BeanComparator("label")); result.add( 0, new SelectItem(this.NO_SELECTION_STRING, BundleUtil.getString(Bundle.BOLONHA, "choose"))); return result; }
public static CurricularCourseInquiryTemplate getTemplateByExecutionPeriod( ExecutionSemester executionSemester) { final Collection<InquiryTemplate> inquiryTemplates = Bennu.getInstance().getInquiryTemplatesSet(); for (final InquiryTemplate inquiryTemplate : inquiryTemplates) { if (inquiryTemplate instanceof CurricularCourseInquiryTemplate && executionSemester == inquiryTemplate.getExecutionPeriod()) { return (CurricularCourseInquiryTemplate) inquiryTemplate; } } return null; }
public static RequestMapping createOrRetrieveRequestMapping(String path, String... parameters) { for (RequestMapping requestMapping : Bennu.getInstance().getRequestMappingsSet()) { if (requestMapping.getPath().equals(path)) { if (Arrays.equals(requestMapping.getParameters().split("&"), parameters)) { return requestMapping; } } } return new RequestMapping(path, parameters); }
public static PhdProgramFocusArea readPhdProgramFocusAreaByName(final String name) { return (PhdProgramFocusArea) CollectionUtils.find( Bennu.getInstance().getPhdProgramFocusAreasSet(), new Predicate() { @Override public boolean evaluate(Object arg0) { return name.equals(((PhdProgramFocusArea) arg0).getName().getContent()); } }); }
@GET @Produces(JSON_UTF8) @Path("suppliers") public String suppliers( @QueryParam("userID") String userID, @QueryParam("access_token") String access_token) { checkToken(access_token); Set<Supplier> suppliers = Bennu.getInstance().getSuppliersSet(); JsonArray toReturn = new JsonArray(); for (Supplier supplier : suppliers) { if (supplier != null) { JsonObject obj = new JsonObject(); obj.addProperty("supplierID", supplier.getExternalId()); obj.addProperty("fiscalID", supplier.getFiscalIdentificationCode()); obj.addProperty("name", supplier.getName()); obj.addProperty("shortName", supplier.getAbbreviatedName()); obj.addProperty("limit", supplier.getSupplierLimit().toFormatString()); JsonArray contacts = new JsonArray(); for (SupplierContact contact : supplier.getSupplierContactSet()) { JsonObject contactObj = new JsonObject(); if (contact.getAddress() != null) { JsonObject addressObj = new JsonObject(); addressObj.addProperty("line1", contact.getAddress().getLine1()); addressObj.addProperty("line2", contact.getAddress().getLine2()); addressObj.addProperty("country", contact.getAddress().getCountry()); contactObj.add("address", addressObj); } contactObj.addProperty("phone", contact.getPhone()); contactObj.addProperty("fax", contact.getFax()); contactObj.addProperty("email", contact.getEmail()); contacts.add(contactObj); } obj.add("contacts", contacts); obj.addProperty("totalAllocated", supplier.getTotalAllocated().toFormatString()); JsonArray byCpv = new JsonArray(); for (CPVReference cpv : supplier.getAllocationsByCPVReference().keySet()) { if (cpv != null) { JsonObject cpvObj = new JsonObject(); cpvObj.addProperty("cpvCode", cpv.getCode()); cpvObj.addProperty("cpvDescription", cpv.getDescription()); cpvObj.addProperty("totalAllocated", supplier.getTotalAllocated(cpv).toFormatString()); byCpv.add(cpvObj); ; } } obj.add("allocationsByCPV", byCpv); toReturn.add(obj); } } return gson.toJson(toReturn); }