List of usage examples for org.joda.time YearMonthDay fromDateFields
public static YearMonthDay fromDateFields(Date date)
java.util.Date
using exactly the same field values avoiding any time zone effects. From source file:net.sourceforge.fenixedu.applicationTier.Servico.administrativeOffice.gradeSubmission.CreateMarkSheetByTeacher.java
License:Open Source License
private static Grade getGrade(Attends attends, MarkSheetTeacherMarkBean markBean, Date evaluationDate, Date nowDate) {//w w w.java 2 s . com final String value; final FinalMark finalMark = attends.getFinalMark(); if (finalMark != null) { finalMark.setSubmitedMark(markBean.getGradeValue()); finalMark.setSubmitDateYearMonthDay(YearMonthDay.fromDateFields(evaluationDate)); finalMark.setWhenSubmitedYearMonthDay(YearMonthDay.fromDateFields(nowDate)); value = markBean.getGradeValue(); } else { value = GradeScale.NA; } return Grade.createGrade(value, attends.getEnrolment().getGradeScale()); }
From source file:net.sourceforge.fenixedu.applicationTier.Servico.manager.CreateStudentCurricularPlan.java
License:Open Source License
@Atomic public static void run(final Integer studentNumber, final DegreeType degreeType, final StudentCurricularPlanState studentCurricularPlanState, final String degreeCurricularPlanId, final Date startDate) throws FenixServiceException { check(RolePredicates.MANAGER_OR_OPERATOR_PREDICATE); final Registration registration = Registration.readStudentByNumberAndDegreeType(studentNumber, degreeType); if (registration == null) { throw new NonExistingServiceException("exception.student.does.not.exist"); }/*from ww w .j a v a2 s .c o m*/ final DegreeCurricularPlan degreeCurricularPlan = FenixFramework.getDomainObject(degreeCurricularPlanId); if (degreeCurricularPlan == null) { throw new NonExistingServiceException("exception.degree.curricular.plan.does.not.exist"); } StudentCurricularPlan.createWithEmptyStructure(registration, degreeCurricularPlan, YearMonthDay.fromDateFields(startDate)); }
From source file:net.sourceforge.fenixedu.applicationTier.Servico.manager.executionDegreesManagement.EditExecutionDegree.java
License:Open Source License
private static OccupationPeriod getOccupationPeriod(final Date startDate, final Date endDate) { OccupationPeriod occupationPeriod = OccupationPeriod .readOccupationPeriod(YearMonthDay.fromDateFields(startDate), YearMonthDay.fromDateFields(endDate)); if (occupationPeriod == null) { occupationPeriod = new OccupationPeriod(startDate, endDate); occupationPeriod.setNextPeriod(null); }//from ww w . j a v a 2 s. c om return occupationPeriod; }
From source file:net.sourceforge.fenixedu.applicationTier.Servico.person.function.ReadPersonFunctionsByPersonIDAndExecutionYearID.java
License:Open Source License
@Atomic public static List<PersonFunction> run(String personID, String executionYearID) throws FenixServiceException { check(RolePredicates.PERSON_PREDICATE); Person person = (Person) FenixFramework.getDomainObject(personID); List<PersonFunction> personFunctions = null; if (executionYearID != null) { ExecutionYear executionYear = FenixFramework.getDomainObject(executionYearID); Date beginDate = executionYear.getBeginDate(); Date endDate = executionYear.getEndDate(); personFunctions = person.getPersonFuntions(YearMonthDay.fromDateFields(beginDate), YearMonthDay.fromDateFields(endDate)); } else {/*from www. ja va 2s . c om*/ personFunctions = new ArrayList<PersonFunction>(person.getPersonFunctions()); } return personFunctions; }
From source file:net.sourceforge.fenixedu.dataTransferObject.externalServices.PersonInformationFromUniqueCardDTO.java
License:Open Source License
public void edit(Person person) throws ParseException { final String dateFormat = "dd MM yyyy"; if (!StringUtils.isEmpty(getGivenNames())) { person.setGivenNames(getGivenNames()); }//w w w . j av a 2 s . c o m if (!StringUtils.isEmpty(getFamilyNames())) { person.setFamilyNames(getFamilyNames()); } if (!StringUtils.isEmpty(getGender())) { person.setGender(getGender().equalsIgnoreCase("m") ? Gender.MALE : Gender.FEMALE); } if (getIdentificationDocumentExtraDigit() != null) { person.setIdentificationDocumentExtraDigit(getIdentificationDocumentExtraDigit().replaceAll("\\s", "")); //remove white spaces } if (getIdentificationDocumentSeriesNumber() != null) { person.setIdentificationDocumentSeriesNumber( getIdentificationDocumentSeriesNumber().replaceAll("\\s", "")); //remove white spaces } if (!StringUtils.isEmpty(getDocumentIdEmissionLocation())) { person.setEmissionLocationOfDocumentId(getDocumentIdEmissionLocation()); } if (!StringUtils.isEmpty(getDocumentIdEmissionDate())) { person.setEmissionDateOfDocumentIdYearMonthDay( YearMonthDay.fromDateFields(DateFormatUtil.parse(dateFormat, getDocumentIdEmissionDate()))); } if (!StringUtils.isEmpty(getDocumentIdExpirationDate())) { person.setExpirationDateOfDocumentIdYearMonthDay( YearMonthDay.fromDateFields(DateFormatUtil.parse(dateFormat, getDocumentIdExpirationDate()))); } if (!StringUtils.isEmpty(getFiscalNumber())) { person.setSocialSecurityNumber(getFiscalNumber()); } if (!StringUtils.isEmpty(getBirthDate())) { person.setDateOfBirthYearMonthDay( YearMonthDay.fromDateFields(DateFormatUtil.parse(dateFormat, getBirthDate()))); } if (!StringUtils.isEmpty(getNationality())) { person.setNationality(Country.readByThreeLetterCode(getNationality())); } if (!StringUtils.isEmpty(getMotherName())) { person.setNameOfMother(getMotherName()); } if (!StringUtils.isEmpty(getFatherName())) { person.setNameOfFather(getFatherName()); } if (getPhoto() != null) { person.setPersonalPhoto( new Photograph(PhotoType.INSTITUTIONAL, ContentType.JPG, new ByteArray(getPhoto()))); } final PhysicalAddressData physicalAddress = new PhysicalAddressData(); physicalAddress.setAddress(getAddress()); physicalAddress.setAreaCode(getPostalCode()); physicalAddress.setAreaOfAreaCode(getPostalArea()); physicalAddress.setArea(getLocality()); physicalAddress.setParishOfResidence(getParish()); physicalAddress.setDistrictSubdivisionOfResidence(getMunicipality()); physicalAddress.setDistrictOfResidence(getDistrict()); physicalAddress.setCountryOfResidence(Country.readByTwoLetterCode(getCountry())); if (!physicalAddress.isEmpty()) { person.setDefaultPhysicalAddressData(physicalAddress, true); } }
From source file:net.sourceforge.fenixedu.domain.CurricularCourseScope.java
License:Open Source License
public boolean intersects(final Date begin, final Date end) { return intersects(YearMonthDay.fromDateFields(begin), YearMonthDay.fromDateFields(end)); }
From source file:net.sourceforge.fenixedu.domain.EnrolmentEvaluation.java
License:Open Source License
public void edit(Person responsibleFor, Grade grade, Date availableDate, Date examDate) { if (responsibleFor == null) { throw new DomainException("error.enrolmentEvaluation.invalid.parameters"); }//from w w w . j a va 2 s . c o m if (examDate != null) { if (!grade.isNotEvaluated()) { checkRegistrationState(); } setExamDateYearMonthDay(YearMonthDay.fromDateFields(examDate)); } else if (grade.isEmpty()) { setExamDateYearMonthDay(null); } else { setExamDateYearMonthDay(YearMonthDay.fromDateFields(availableDate)); } setGrade(grade); setGradeAvailableDateYearMonthDay(YearMonthDay.fromDateFields(availableDate)); setPersonResponsibleForGrade(responsibleFor); generateCheckSum(); }
From source file:net.sourceforge.fenixedu.domain.ExecutionDegree.java
License:Open Source License
private boolean checkOccupationPeriod(Date evaluationDate, ExecutionSemester executionSemester, MarkSheetType markSheetType) {/*from ww w.j a v a 2 s . c om*/ OccupationPeriod occupationPeriod = getOccupationPeriodFor(executionSemester, markSheetType); return evaluationDate != null && occupationPeriod != null && occupationPeriod.nestedOccupationPeriodsContainsDay(YearMonthDay.fromDateFields(evaluationDate)); }
From source file:net.sourceforge.fenixedu.domain.ExecutionSemester.java
License:Open Source License
public boolean containsDay(final Date day) { return containsDay(YearMonthDay.fromDateFields(day)); }
From source file:net.sourceforge.fenixedu.domain.ExecutionSemester.java
License:Open Source License
public boolean isInTimePeriod(final Date begin, final Date end) { return isInTimePeriod(YearMonthDay.fromDateFields(begin), YearMonthDay.fromDateFields(end)); }