org.joda.time.LocalDate Java Examples
The following examples show how to use
org.joda.time.LocalDate.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TurnoverAggregationRepository_IntegTest.java From estatio with Apache License 2.0 | 6 votes |
@Test public void findByTurnoverReportingConfig_works() throws Exception { final TurnoverReportingConfig config = TurnoverReportingConfig_enum.OxfTopModel001GbPrelim .findUsing(serviceRegistry2); final LocalDate date = new LocalDate(2019, 1, 1); final LocalDate date2 = new LocalDate(2019, 2, 1); final Currency euro = Currency_enum.EUR.findUsing(serviceRegistry2); // when turnoverAggregationRepository .findOrCreate(config, date, euro); turnoverAggregationRepository .findOrCreate(config, date2, euro); // then assertThat(turnoverAggregationRepository.findByTurnoverReportingConfig(config)).hasSize(2); }
Example #2
Source File: DocumentTemplate.java From estatio with Apache License 2.0 | 6 votes |
private DocumentTemplate( final DocumentType type, final LocalDate date, final String atPath, final String fileSuffix, final boolean previewOnly, final String nameText) { super(type, atPath); this.typeCopy = type; this.atPathCopy = atPath; this.date = date; this.fileSuffix = stripLeadingDotAndLowerCase(fileSuffix); this.previewOnly = previewOnly; this.nameText = nameText; }
Example #3
Source File: AbstractClinicServiceTests.java From DevOps-for-Web-Development with MIT License | 6 votes |
@Test @Transactional public void shouldInsertPetIntoDatabaseAndGenerateId() { Owner owner6 = this.clinicService.findOwnerById(6); int found = owner6.getPets().size(); Pet pet = new Pet(); pet.setName("bowser"); Collection<PetType> types = this.clinicService.findPetTypes(); pet.setType(EntityUtils.getById(types, PetType.class, 2)); pet.setBirthDate(new LocalDate()); owner6.addPet(pet); assertThat(owner6.getPets().size()).isEqualTo(found + 1); this.clinicService.savePet(pet); this.clinicService.saveOwner(owner6); owner6 = this.clinicService.findOwnerById(6); assertThat(owner6.getPets().size()).isEqualTo(found + 1); // checks that id has been generated assertThat(pet.getId()).isNotNull(); }
Example #4
Source File: InvoiceForLeaseRepository.java From estatio with Apache License 2.0 | 6 votes |
public InvoiceForLease findOrCreateMatchingInvoice( final ApplicationTenancy applicationTenancy, final Party seller, final Party buyer, final PaymentMethod paymentMethod, final Lease lease, final InvoiceStatus invoiceStatus, final LocalDate dueDate, final String interactionId) { final List<InvoiceForLease> invoices = findMatchingInvoices( seller, buyer, paymentMethod, lease, invoiceStatus, dueDate); if (invoices == null || invoices.size() == 0) { return newInvoice(applicationTenancy, seller, buyer, paymentMethod, settingsService.systemCurrency(), dueDate, lease, interactionId); } return invoices.get(0); }
Example #5
Source File: DateTimeFunctions.java From jasperreports with GNU Lesser General Public License v3.0 | 6 votes |
/** * Returns the number of days between two dates. */ @Function("DAYS") @FunctionParameters({ @FunctionParameter("startDate"), @FunctionParameter("endDate")}) public Integer DAYS(Object startDate, Object endDate){ Date startDateObj = convertDateObject(startDate); if(startDateObj==null) { logCannotConvertToDate(); return null; } Date endDateObj = convertDateObject(endDate); if(endDateObj==null){ logCannotConvertToDate(); return null; } else{ LocalDate dt1=new LocalDate(startDateObj); LocalDate dt2=new LocalDate(endDateObj); return Days.daysBetween(dt1, dt2).getDays(); } }
Example #6
Source File: TurnoverAggregationService_Test.java From estatio with Apache License 2.0 | 6 votes |
@Test public void isComparableToDate_works() throws Exception { //given TurnoverAggregationService service = new TurnoverAggregationService(); final LocalDate aggregationDate = new LocalDate(2019, 2, 1); // when, then assertThat(service.isComparableToDate(aggregationDate, 2, 2, false, false)).isTrue(); assertThat(service.isComparableToDate(aggregationDate, 3, 2, false, false)).isTrue(); assertThat(service.isComparableToDate(aggregationDate, 1, 2, false, false)).isFalse(); assertThat(service.isComparableToDate(aggregationDate, 2, 1, false, false)).isFalse(); assertThat(service.isComparableToDate(aggregationDate, 2, 2, true, false)).isFalse(); assertThat(service.isComparableToDate(aggregationDate, 2, 2, false, true)).isFalse(); assertThat(service.isComparableToDate(aggregationDate, 0, 2, false, true)).isFalse(); assertThat(service.isComparableToDate(aggregationDate, null, 2, false, true)).isFalse(); assertThat(service.isComparableToDate(aggregationDate, 0, null, false, true)).isFalse(); }
Example #7
Source File: DocFragments_for_Invoicing_Test.java From estatio with Apache License 2.0 | 6 votes |
@Ignore // in EST-1197 @Test public void adjustment_and_chargeGroupOfS_and_dueDate_after_startDate() throws Exception { // given final LocalDate itemDueDate = new LocalDate(2017, 3, 1); item.setAdjustment(true); chargeGroup.setReference("S"); item.setDueDate(itemDueDate); item.setStartDate(itemDueDate.minusDays(1)); item.setEffectiveStartDate(new LocalDate(2017, 4, 1)); item.setEffectiveEndDate(new LocalDate(2017, 10, 15)); // when final String rendered = freeMarkerService.render(templateName, templateText, vm); // then Assertions.assertThat(rendered) .isEqualTo("Conguaglio: Charge description dal 01-04-2017 al 15-10-2017"); }
Example #8
Source File: FixedAssetRole_Test.java From estatio with Apache License 2.0 | 6 votes |
@SuppressWarnings("unchecked") @Override protected List<List<FixedAssetRole>> orderedTuples() { return listOf( listOf( newFixedAssetRole(null, null, null, null), newFixedAssetRole(asset1, null, null, null), newFixedAssetRole(asset1, null, null, null), newFixedAssetRole(asset2, null, null, null)) ,listOf( newFixedAssetRole(asset1, new LocalDate(2012,4,2), null, null), newFixedAssetRole(asset1, new LocalDate(2012,3,1), null, null), newFixedAssetRole(asset1, new LocalDate(2012,3,1), null, null), newFixedAssetRole(asset1, null, null, null)) ,listOf( newFixedAssetRole(asset1, new LocalDate(2012,4,2), null, null), newFixedAssetRole(asset1, new LocalDate(2012,4,2), FixedAssetRoleTypeEnum.ASSET_MANAGER, null), newFixedAssetRole(asset1, new LocalDate(2012,4,2), FixedAssetRoleTypeEnum.ASSET_MANAGER, null), newFixedAssetRole(asset1, new LocalDate(2012,4,2), FixedAssetRoleTypeEnum.PROPERTY_CONTACT, null)) ,listOf( newFixedAssetRole(asset1, new LocalDate(2012,4,2), FixedAssetRoleTypeEnum.ASSET_MANAGER, null), newFixedAssetRole(asset1, new LocalDate(2012,4,2), FixedAssetRoleTypeEnum.ASSET_MANAGER, party1), newFixedAssetRole(asset1, new LocalDate(2012,4,2), FixedAssetRoleTypeEnum.ASSET_MANAGER, party1), newFixedAssetRole(asset1, new LocalDate(2012,4,2), FixedAssetRoleTypeEnum.ASSET_MANAGER, party2)) ); }
Example #9
Source File: Order_2_IntegTest.java From estatio with Apache License 2.0 | 6 votes |
@Before public void setupData() { runFixtureScript(new FixtureScript() { @Override protected void execute(final FixtureScript.ExecutionContext executionContext) { // taken from the DocumentTypesAndTemplatesSeedService (not run in integ tests by default) final LocalDate templateDate = ld(2012,1,1); executionContext.executeChildren(this, new DocumentTypesAndTemplatesForCapexFixture(templateDate), new IncomingChargesFraXlsxFixture()); executionContext.executeChildren(this, Order_enum.fakeOrder2Pdf, Person_enum.JonathanIncomingInvoiceManagerGb); } }); order = Order_enum.fakeOrder2Pdf.findUsing(serviceRegistry); ((Organisation) order.getSeller()).setChamberOfCommerceCode("Code"); }
Example #10
Source File: PublicPresentationSeminarProcess.java From fenixedu-academic with GNU Lesser General Public License v3.0 | 6 votes |
@Override public LocalDate getPresentationRequestDate() { if (super.getPresentationRequestDate() != null) { return super.getPresentationRequestDate(); } if (!getIndividualProgramProcess().getStudyPlan().isExempted()) { if (getIndividualProgramProcess().getRegistration().isConcluded()) { return getIndividualProgramProcess().getRegistration().getConclusionDate().toLocalDate(); } } if (getPresentationDate() != null) { return getPresentationDate().minusMonths(1); } return getIndividualProgramProcess().getWhenStartedStudies(); }
Example #11
Source File: InnerPainter.java From NCalendar with Apache License 2.0 | 5 votes |
public InnerPainter(Context context, ICalendar calendar) { this.mAttrs = calendar.getAttrs(); this.mContext = context; this.mCalendar = calendar; mTextPaint = new Paint(); mTextPaint.setAntiAlias(true); mTextPaint.setTextAlign(Paint.Align.CENTER); mPointList = new ArrayList<>(); mHolidayList = new ArrayList<>(); mWorkdayList = new ArrayList<>(); mReplaceLunarStrMap = new HashMap<>(); mReplaceLunarColorMap = new HashMap<>(); mStretchStrMap = new HashMap<>(); mDefaultCheckedBackground = ContextCompat.getDrawable(context, mAttrs.defaultCheckedBackground); mTodayCheckedBackground = ContextCompat.getDrawable(context, mAttrs.todayCheckedBackground); mDefaultCheckedPoint = ContextCompat.getDrawable(context, mAttrs.defaultCheckedPoint); mDefaultUnCheckedPoint = ContextCompat.getDrawable(context, mAttrs.defaultUnCheckedPoint); mTodayCheckedPoint = ContextCompat.getDrawable(context, mAttrs.todayCheckedPoint); mTodayUnCheckedPoint = ContextCompat.getDrawable(context, mAttrs.todayUnCheckedPoint); List<String> holidayList = CalendarUtil.getHolidayList(); for (int i = 0; i < holidayList.size(); i++) { mHolidayList.add(new LocalDate(holidayList.get(i))); } List<String> workdayList = CalendarUtil.getWorkdayList(); for (int i = 0; i < workdayList.size(); i++) { mWorkdayList.add(new LocalDate(workdayList.get(i))); } }
Example #12
Source File: FragmentCalendarMonthBase.java From CalendarPicker with MIT License | 5 votes |
public static FragmentCalendarMonthBase newInstance(LocalDate localDate, CalendarDay daySelected, FragmentCalendarMonthBase.DayInMonthOnClickListener dayInMonthOnClickListener) { FragmentCalendarMonthBase f = new FragmentCalendarMonthBase(); f.calendarMonth = MyConfig.getMonthIncludeThisDay(localDate); f.daySelected.copy(daySelected); f.dayInMonthOnClickListener = dayInMonthOnClickListener; return f; }
Example #13
Source File: BudgetMenu.java From estatio with Apache License 2.0 | 5 votes |
@Action(semantics = SemanticsOf.NON_IDEMPOTENT) public Budget newBudget( final Property property, final int year) { Budget budget = budgetRepository.newBudget(property, new LocalDate(year, 1, 1), new LocalDate(year, 12, 31)); budget.findOrCreatePartitioningForBudgeting(); return budget; }
Example #14
Source File: TurnoverReportingConfig_Test.java From estatio with Apache License 2.0 | 5 votes |
@Test public void getEndDate() { // given TurnoverReportingConfig config = new TurnoverReportingConfig(); config.setStartDate(new LocalDate(2018,1,1)); final Occupancy occupancy = new Occupancy(); final Lease lease = new LeaseForTesting(); occupancy.setLease(lease); config.setOccupancy(occupancy); // when, then Assertions.assertThat(config.getEndDate()).isNull(); // and when final LocalDate leaseEndDate = new LocalDate(2019, 1, 31); lease.setEndDate(leaseEndDate); // then Assertions.assertThat(config.getEndDate()).isNull(); // and when final LocalDate leaseTenancyEndDate = new LocalDate(2019, 2, 1); lease.setTenancyEndDate(leaseTenancyEndDate); // then Assertions.assertThat(config.getEndDate()).isEqualTo(leaseTenancyEndDate); // and when final LocalDate occupancyEndDate = new LocalDate(2019, 2, 2); occupancy.setEndDate(occupancyEndDate); // then Assertions.assertThat(config.getEndDate()).isEqualTo(occupancyEndDate); }
Example #15
Source File: LeaseInvoicingSettingsService_Test.java From estatio with Apache License 2.0 | 5 votes |
@Ignore // Dan will fix up, he says @Test public void whenNull() { context.checking(new Expectations() { { oneOf(mockApplicationSettingsService).find(LeaseInvoicingSettingKey.epochDate); will(returnValue(null)); } }); final LocalDate fetchEpochDate = estatioSettingsService.fetchEpochDate(); assertThat(fetchEpochDate).isNull(); }
Example #16
Source File: ConversionUtilities.java From fenixedu-academic with GNU Lesser General Public License v3.0 | 5 votes |
static public LocalDate parseDate(String value) { if (StringUtils.isEmpty(value)) { return null; } if (value.length() < 2) { return null; } LocalDate result = null; String normalizedValue = value; if (value.length() == "dMMyyyy".length()) { normalizedValue = "0".concat(value); } for (String pattern : CORRECT_DATE_PATTERNS) { try { result = DateTimeFormat.forPattern(pattern).parseDateTime(normalizedValue).toLocalDate(); } catch (IllegalArgumentException e) { continue; } if (result.isAfter(DateTimeFormat.forPattern("yyyy").parseDateTime("1920").toLocalDate()) && result.isBefore(DateTimeFormat.forPattern("yyy").parseDateTime("2020").toLocalDate())) { return result; } } throw new IncorrectDateFormatException(value); }
Example #17
Source File: InvoiceItem_Test.java From estatio with Apache License 2.0 | 5 votes |
@Test public void change_tax_resets_taxrate_and_recalculates() throws Exception { // given final BigDecimal percentageNewRate = new BigDecimal("10.0"); final TaxRate newRate = new TaxRate(); newRate.setPercentage(percentageNewRate); Tax newTax = new Tax(){ @Override public TaxRate taxRateFor(final LocalDate date) { return newRate; } }; invoiceItem.setTaxRate(taxRate); assertThat(invoiceItem.getTaxRate()).isEqualTo(taxRate); assertThat(invoiceItem.getGrossAmount()).isEqualTo(new BigDecimal("1175.00")); // when invoiceItem.changeTax(newTax); // then assertThat(invoiceItem.getTaxRate()).isEqualTo(newRate); assertThat(invoiceItem.getGrossAmount()).isEqualTo(new BigDecimal("1100.00")); assertThat(invoiceItem.getVatAmount()).isEqualTo(new BigDecimal("100.00")); }
Example #18
Source File: WhereParser.java From sql4es with Apache License 2.0 | 5 votes |
/** * Extracts the literal value from an expression (if expression is supported) * @param expression * @param state * @return a Long, Boolean, Double or String object */ private Object getLiteralValue(Expression expression, QueryState state){ if(expression instanceof LongLiteral) return ((LongLiteral)expression).getValue(); else if(expression instanceof BooleanLiteral) return ((BooleanLiteral)expression).getValue(); else if(expression instanceof DoubleLiteral) return ((DoubleLiteral)expression).getValue(); else if(expression instanceof StringLiteral) return ((StringLiteral)expression).getValue(); else if(expression instanceof ArithmeticUnaryExpression){ ArithmeticUnaryExpression unaryExp = (ArithmeticUnaryExpression)expression; Sign sign = unaryExp.getSign(); Number num = (Number)getLiteralValue(unaryExp.getValue(), state); if(sign == Sign.MINUS){ if(num instanceof Long) return -1*num.longValue(); else if(num instanceof Double) return -1*num.doubleValue(); else { state.addException("Unsupported numeric literal expression encountered : "+num.getClass()); return null; } } return num; } else if(expression instanceof FunctionCall){ FunctionCall fc = (FunctionCall)expression; if(fc.getName().toString().equals("now")) return new Date(); else state.addException("Function '"+fc.getName()+"' is not supported"); }else if(expression instanceof CurrentTime){ CurrentTime ct = (CurrentTime)expression; if(ct.getType() == CurrentTime.Type.DATE) return new LocalDate().toDate(); else if(ct.getType() == CurrentTime.Type.TIME) return new Date(new LocalTime(DateTimeZone.UTC).getMillisOfDay()); else if(ct.getType() == CurrentTime.Type.TIMESTAMP) return new Date(); else if(ct.getType() == CurrentTime.Type.LOCALTIME) return new Date(new LocalTime(DateTimeZone.UTC).getMillisOfDay()); else if(ct.getType() == CurrentTime.Type.LOCALTIMESTAMP) return new Date(); else state.addException("CurrentTime function '"+ct.getType()+"' is not supported"); }else state.addException("Literal type "+expression.getClass().getSimpleName()+" is not supported"); return null; }
Example #19
Source File: CommonObjectBuilderImpl.java From freehealth-connector with GNU Affero General Public License v3.0 | 5 votes |
public TherapeuticLink createTherapeuticLink(DateTime startDate, DateTime endDate, Patient patient, String hcpType, String therLinkType, String comment, HcParty concernedHcp) throws TechnicalConnectorException { TherapeuticLink therLink = new TherapeuticLink(patient, concernedHcp, comment); therLink.setType(therLinkType); if (startDate != null) { therLink.setStartDate(new LocalDate(startDate)); } if (endDate != null) { therLink.setEndDate(new LocalDate(endDate)); } therLink.setComment(comment); return therLink; }
Example #20
Source File: FuncTest.java From actframework with Apache License 2.0 | 5 votes |
@Test public void testToday() { Func.Today func = new Func.Today(); Object obj = func.apply(); yes(obj instanceof LocalDate); LocalDate funcToday = (LocalDate) obj; eq(LocalDate.now(), funcToday); }
Example #21
Source File: FakeApi.java From openapi-generator with Apache License 2.0 | 5 votes |
/** * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 * * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 * */ @POST @Path("/fake") @Consumes({ "application/x-www-form-urlencoded" }) @ApiOperation(value = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트", tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid username supplied"), @ApiResponse(code = 404, message = "User not found") }) public void testEndpointParameters(@Multipart(value = "number") BigDecimal number, @Multipart(value = "double") Double _double, @Multipart(value = "pattern_without_delimiter") String patternWithoutDelimiter, @Multipart(value = "byte") byte[] _byte, @Multipart(value = "integer", required = false) Integer integer, @Multipart(value = "int32", required = false) Integer int32, @Multipart(value = "int64", required = false) Long int64, @Multipart(value = "float", required = false) Float _float, @Multipart(value = "string", required = false) String string, @Multipart(value = "binary" , required = false) Attachment binaryDetail, @Multipart(value = "date", required = false) LocalDate date, @Multipart(value = "dateTime", required = false) Date dateTime, @Multipart(value = "password", required = false) String password, @Multipart(value = "callback", required = false) String paramCallback);
Example #22
Source File: YouTubeSubscriptionServiceImpl.java From JuniperBot with GNU General Public License v3.0 | 5 votes |
@Override public void subscribe(YouTubeChannel channel) { LocalDate now = LocalDate.now(); LocalDate expiredAt = channel.getExpiresAt() != null ? LocalDate.fromDateFields(channel.getExpiresAt()) : LocalDate.now(); if (now.isBefore(expiredAt)) { return; } HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); MultiValueMap<String, String> map = new LinkedMultiValueMap<>(); map.add("hub.callback", String.format("%s/api/public/youtube/callback/publish?secret=%s&channel=%s", commonProperties.getBranding().getWebsiteUrl(), apiProperties.getYouTube().getPubSubSecret(), CommonUtils.urlEncode(channel.getChannelId()))); map.add("hub.topic", CHANNEL_RSS_ENDPOINT + channel.getChannelId()); map.add("hub.mode", "subscribe"); map.add("hub.verify", "async"); map.add("hub.verify_token", apiProperties.getYouTube().getPubSubSecret()); HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<>(map, headers); ResponseEntity<String> response = restTemplate.postForEntity(PUSH_ENDPOINT, request, String.class); if (!response.getStatusCode().is2xxSuccessful()) { throw new IllegalStateException("Could not subscribe to " + channel.getChannelId()); } }
Example #23
Source File: Lease_IntegTest.java From estatio with Apache License 2.0 | 5 votes |
@Test public void happyCase() throws Exception { // given final String newReference = "OXF-MEDIA-001"; final Lease lease = Lease_enum.OxfTopModel001Gb.findUsing(serviceRegistry); final Party newParty = OrganisationAndComms_enum.MediaXGb.findUsing(serviceRegistry); final LocalDate newStartDate = VT.ld(2014, 1, 1); // when Lease newLease = lease.assign( newReference, newReference, newParty, newStartDate); // then assertThat(newLease.getReference()).isEqualTo(newReference); assertThat(newLease.getName()).isEqualTo(newReference); assertThat(newLease.getStartDate()).isEqualTo(lease.getStartDate()); assertThat(newLease.getEndDate()).isEqualTo(lease.getEndDate()); assertThat(newLease.getTenancyStartDate()).isEqualTo(newStartDate); assertThat(newLease.getTenancyEndDate()).isNull(); assertThat(newLease.getPrimaryParty()).isEqualTo(lease.getPrimaryParty()); assertThat(newLease.getSecondaryParty()).isEqualTo(newParty); assertThat(newLease.getItems().size()).isEqualTo(lease.getItems().size()); assertThat(lease.getTenancyEndDate()).isEqualTo(newStartDate.minusDays(1)); }
Example #24
Source File: LeaseStatusService_Test.java From estatio with Apache License 2.0 | 5 votes |
@Test public void suspended() { tester( LeaseStatus.SUSPENDED, new LocalDate(2014, 1, 1), new LocalDate(2015, 3, 31), testItem(null, LeaseItemStatus.SUSPENDED)); tester( LeaseStatus.SUSPENDED, new LocalDate(2014, 1, 1), new LocalDate(2015, 3, 31), testItem(null, LeaseItemStatus.SUSPENDED), testItem(null, LeaseItemStatus.SUSPENDED)); }
Example #25
Source File: IncomingInvoiceQueryHelperRepository_IntegTest.java From estatio with Apache License 2.0 | 5 votes |
@Test public void find_by_reported_date_works() throws Exception { // given final IncomingInvoice invoice1 = createIncomingInvoice(); final IncomingInvoiceItem item1OnInv1 = incomingInvoiceItemRepository .addItem(invoice1, IncomingInvoiceType.CAPEX, null, null, null, null, null, null, null, null, null, null, null); final IncomingInvoiceItem item2OnInv1 = incomingInvoiceItemRepository .addItem(invoice1, IncomingInvoiceType.CAPEX, null, null, null, null, null, null, null, null, null, null, null); final IncomingInvoiceItem item3OnInv1 = incomingInvoiceItemRepository .addItem(invoice1, IncomingInvoiceType.CAPEX, null, null, null, null, null, null, null, null, null, null, null); final IncomingInvoice invoice2 = createIncomingInvoice(); final IncomingInvoiceItem item1OnInv2 = incomingInvoiceItemRepository .addItem(invoice2, IncomingInvoiceType.CAPEX, null, null, null, null, null, null, null, null, null, null, null); // when, then assertThat(incomingInvoiceQueryHelperRepo.findByInvoiceItemReportedDate(null)).hasSize(4); // and when final LocalDate reportedDate = new LocalDate(2020, 1, 1); item1OnInv1.setReportedDate(reportedDate); // then assertThat(incomingInvoiceQueryHelperRepo.findByInvoiceItemReportedDate(reportedDate)).hasSize(1); assertThat(incomingInvoiceQueryHelperRepo.findByInvoiceItemReportedDate(null)).hasSize(3); }
Example #26
Source File: EventNotificationTask.java From fenixedu-academic with GNU Lesser General Public License v3.0 | 5 votes |
private void process(final Party party, final DateTime now, final LocalDate afterTomorrow, final LocalDate yesterday) { try { FenixFramework.atomic(() -> { if (party.isPerson()) { final Person person = (Person) party; final User user = person.getUser(); if (user != null) { final Locale locale = getLocale(person); final String message = person.getEventsSet().stream() .flatMap(e -> generateNotifications(e, now, afterTomorrow, yesterday, locale)) .reduce("", String::concat); if (!message.isEmpty()) { Message.fromSystem() .preferredLocale(locale) .to(Group.users(person.getUser())) .template("event.notifications") .parameter("notificationMessage", message) .and() .wrapped() .send(); } } } }); } catch (final Throwable t) { taskLog("Unable to process party: %s - %s%n", party.getExternalId(), t.getMessage()); } }
Example #27
Source File: BudgetRepository_IntegTest.java From estatio with Apache License 2.0 | 5 votes |
@Test public void wrongBudgetDates() { // given final Property property = Property_enum.OxfGb.findUsing(serviceRegistry); // when final String reason = budgetRepository .validateNewBudget(property, new LocalDate(2010, 1, 3), new LocalDate(2010, 1, 1)); // then assertThat(reason).isEqualTo("End date can not be before start date"); }
Example #28
Source File: LeaseAmendment.java From estatio with Apache License 2.0 | 5 votes |
@Programmatic public LocalDate getEffectiveEndDate(){ final Optional<LocalDate> max = Lists.newArrayList(getItems()).stream() .map(ai -> ai.getEndDate()) .max(LocalDate::compareTo); if (max.isPresent()) { return max.get(); } else { // only when there are no items return null; } }
Example #29
Source File: MainActivity.java From googlecalendar with Apache License 2.0 | 5 votes |
@Override public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId()==R.id.action_favorite){ final LocalDate localDate=LocalDate.now(); final LinearLayoutManager linearLayoutManager= (LinearLayoutManager) mNestedView.getLayoutManager(); mNestedView.stopScroll(); if (indextrack.containsKey(new LocalDate(localDate.getYear(),localDate.getMonthOfYear(),localDate.getDayOfMonth()))){ final Integer val=indextrack.get(new LocalDate(localDate.getYear(),localDate.getMonthOfYear(),localDate.getDayOfMonth())); if (isAppBarExpanded()){ calendarView.setCurrentmonth(new LocalDate()); expandedfirst=val; topspace=20; linearLayoutManager.scrollToPositionWithOffset(val,20); EventBus.getDefault().post(new MonthChange(localDate,0)); month=localDate.getDayOfMonth(); lastdate=localDate; } else { calendarView.setCurrentmonth(new LocalDate()); expandedfirst=val; topspace=20; linearLayoutManager.scrollToPositionWithOffset(val,20); EventBus.getDefault().post(new MonthChange(localDate,0)); month=localDate.getDayOfMonth(); lastdate=localDate; } } } return super.onOptionsItemSelected(item); }
Example #30
Source File: InvoiceServiceMenu.java From estatio with Apache License 2.0 | 5 votes |
public String validateCalculate( final Lease lease, final InvoiceRunType runType, final List<LeaseItemType> leaseItemTypes, final LocalDate dueDate, final LocalDate startDate, final LocalDate endDate) { return doValidateCalculate(startDate, endDate); }