コード例 #1
0
ファイル: Candidacy.java プロジェクト: afesteves/fenix
 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;
 }
コード例 #2
0
 public InquiryGlobalComment(ExecutionCourse executionCourse, ExecutionDegree executionDegree) {
   super();
   setRootDomainObject(Bennu.getInstance());
   setExecutionCourse(executionCourse);
   setExecutionDegree(executionDegree);
   setCommentOnTeacher(false);
 }
コード例 #3
0
 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();
 }
コード例 #4
0
 public InquiryGlobalComment(Person teacher, ExecutionSemester executionSemester) {
   super();
   setRootDomainObject(Bennu.getInstance());
   setTeacher(teacher);
   setExecutionSemester(executionSemester);
   setCommentOnTeacher(true);
 }
コード例 #5
0
ファイル: Country.java プロジェクト: FenixEdu/organization
 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);
 }
コード例 #6
0
ファイル: ExecutionDegree.java プロジェクト: afesteves/fenix
  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;
  }
コード例 #7
0
 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;
 }
コード例 #8
0
  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;
  }
コード例 #9
0
 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");
     }
   }
 }
コード例 #10
0
ファイル: ExecutionDegree.java プロジェクト: afesteves/fenix
  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;
  }
コード例 #11
0
 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;
 }
コード例 #12
0
ファイル: Candidacy.java プロジェクト: afesteves/fenix
 public static Candidacy readByCandidacyNumber(Integer candidacyNumber) {
   for (Candidacy candidacy : Bennu.getInstance().getCandidaciesSet()) {
     if (candidacy.getNumber().equals(candidacyNumber)) {
       return candidacy;
     }
   }
   return null;
 }
コード例 #13
0
 public TutorshipSummaryPeriod(
     ExecutionSemester executionSemester, LocalDate beginDate, LocalDate endDate) {
   super();
   setRootDomainObject(Bennu.getInstance());
   setExecutionSemester(executionSemester);
   setBeginDate(beginDate);
   setEndDate(endDate);
 }
コード例 #14
0
 protected ExternalEnrolment() {
   super();
   setRootDomainObject(Bennu.getInstance());
   setCreationDateDateTime(new DateTime());
   if (AccessControl.getPerson() != null) {
     setCreatedBy(AccessControl.getPerson().getUsername());
   }
 }
コード例 #15
0
ファイル: Country.java プロジェクト: FenixEdu/organization
 public static Country findByAcronym(String acronym) {
   for (Country country : Bennu.getInstance().getCountriesSet()) {
     if (country.getAcronym().equalsIgnoreCase(acronym)) {
       return country;
     }
   }
   return null;
 }
コード例 #16
0
ファイル: Country.java プロジェクト: FenixEdu/organization
 public static Country findByIso3166alpha3Code(String code) {
   for (Country country : Bennu.getInstance().getCountriesSet()) {
     if (country.getIso3166alpha3Code().equalsIgnoreCase(code)) {
       return country;
     }
   }
   return null;
 }
コード例 #17
0
ファイル: TestLogged.java プロジェクト: pedrosan7os/bennu
 @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));
 }
コード例 #18
0
 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");
     }
   }
 }
コード例 #19
0
ファイル: Candidacy.java プロジェクト: afesteves/fenix
 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;
 }
コード例 #20
0
  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;
  }
コード例 #21
0
 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;
 }
コード例 #22
0
 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();
  }
コード例 #24
0
ファイル: Country.java プロジェクト: FenixEdu/organization
 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;
 }
コード例 #25
0
ファイル: ExecutionDegree.java プロジェクト: afesteves/fenix
  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;
  }
コード例 #26
0
 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;
 }
コード例 #27
0
 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;
 }
コード例 #28
0
ファイル: RequestMapping.java プロジェクト: Kayvlim/fenix
  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);
  }
コード例 #29
0
  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());
              }
            });
  }
コード例 #30
0
  @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);
  }