List of usage examples for java.time Month DECEMBER
Month DECEMBER
To view the source code for java.time Month DECEMBER.
Click Source Link
From source file:com.ewerk.prototype.api.PersonControllerIntegTest.java
@BeforeMethod public void setup() { personRepository.deleteAll();//from w w w . ja v a2 s.c o m Person john = new Person(); john.setLastName("Smith"); john.setFirstName("John"); john.setBirthday(LocalDate.of(2000, Month.DECEMBER, 10)); personRepository.save(john); Person peggy = new Person(); peggy.setLastName("Mullen"); peggy.setFirstName("Peggy"); peggy.setBirthday(LocalDate.of(1957, Month.APRIL, 16)); personRepository.save(peggy); }
From source file:com.chadekin.jadys.syntax.SqlNativeQuerySectionDetailedITest.java
@Test public void shouldBuildAllSqlQuerySection() { // Arrange/* w w w .java 2s. c o m*/ Calendar calendar = Calendar.getInstance(); LocalDate localDate = LocalDate.of(2016, Month.DECEMBER, 14); Date date = Date.from(localDate.atStartOfDay(ZoneId.systemDefault()).toInstant()); String internalSql = DynamicSqlFactory.newQuery().select("cus.Id_").count("*", "cus.numberOfLocation") .from("dct_customer").as("cus").join("dct_location", "loc").on("loc.customerId").equal("cus.id_") .where("cus.companyId").equal(142576).and("cus.customerId").equal(1258).and("cus.customerName") .like("BSD GmbH").and("zipCode").like(StringUtils.EMPTY).and("cus.city").like("Paris") .and("country").like(null).and("cus.externalId").like("456753").and("cus.customerType") .like(CustomerType.KEY_ACCOUNT).and("cus.modifiedDate").greaterThanOrEqual("2016-10-14") .and("cus.modifiedDate").lessThanOrEqual(date).and("cus.modifiedByUserId") .in(Lists.newArrayList(125, 36, 587)).groupBy("loc.customerId").having("COUNT(loc.customerId)") .equal(2).orderBy("cus.externalId").asc().build(); // Act String sql = DynamicSqlFactory.newQuery().select().count().from(internalSql).as("subQuery").build(); // Assert assertThatSelect(sql); assertThatFrom(sql); assertThatJoin(sql); assertThatWhere(sql); assertThatAnd(sql); assertThatGroupBy(sql); assertThatHaving(sql); assertThatOrderBy(sql); assertThatAll(sql); }
From source file:fi.luontola.cqrshotel.JsonSerializationTest.java
private static Object randomValue(Class<?> type) { ThreadLocalRandom random = ThreadLocalRandom.current(); if (type == UUID.class) { return UUID.randomUUID(); }//from ww w.jav a 2 s.c o m if (type == LocalDate.class) { return LocalDate.of(random.nextInt(2000, 2100), random.nextInt(Month.JANUARY.getValue(), Month.DECEMBER.getValue() + 1), random.nextInt(1, Month.FEBRUARY.minLength() + 1)); } if (type == Money.class) { return Money.of(random.nextDouble(0, 1000), pickRandom(Monetary.getCurrencies())); } if (type == Instant.class) { return Instant.ofEpochMilli(random.nextLong()); } if (type == String.class) { return RandomStringUtils.randomAlphanumeric(random.nextInt(10)); } if (type == int.class) { return random.nextInt(); } throw new IllegalArgumentException("Unsupported type: " + type); }
From source file:se.backede.jeconomix.forms.report.SingleTransactionReport.java
private DefaultCategoryDataset createDataset(TransactionReportDto reports) { String lineTitle = "Kronor"; Map<Month, BigDecimal> sums = new HashMap<>(); List<Month> monthList = new LinkedList<>(Arrays.asList(Month.values())); monthList.forEach((month) -> {/*from w w w .j a v a 2 s . c o m*/ sums.put(month, BigDecimal.valueOf(0)); }); reports.getTransctions().forEach((TransactionDto transaction) -> { monthList.stream().filter((month) -> (transaction.getBudgetMonth().equals(month))) .forEachOrdered((month) -> { BigDecimal currentSum = sums.get(month); if (transaction.getSum() != null) { double abs = Math.abs(transaction.getSum().doubleValue()); BigDecimal newSum = currentSum.add(BigDecimal.valueOf(abs)); sums.put(month, newSum); } }); }); DefaultCategoryDataset dataset = new DefaultCategoryDataset(); dataset.addValue(sums.get(Month.JANUARY), lineTitle, "Jan"); dataset.addValue(sums.get(Month.FEBRUARY), lineTitle, "Feb"); dataset.addValue(sums.get(Month.MARCH), lineTitle, "Mar"); dataset.addValue(sums.get(Month.APRIL), lineTitle, "Apr"); dataset.addValue(sums.get(Month.MAY), lineTitle, "May"); dataset.addValue(sums.get(Month.JUNE), lineTitle, "Jun"); dataset.addValue(sums.get(Month.JULY), lineTitle, "Jul"); dataset.addValue(sums.get(Month.AUGUST), lineTitle, "Aug"); dataset.addValue(sums.get(Month.SEPTEMBER), lineTitle, "Sep"); dataset.addValue(sums.get(Month.OCTOBER), lineTitle, "Oct"); dataset.addValue(sums.get(Month.NOVEMBER), lineTitle, "Nov"); dataset.addValue(sums.get(Month.DECEMBER), lineTitle, "Dec"); return dataset; }
From source file:com.gnadenheimer.mg3.utils.Utils.java
public static LocalDate finPeriodoFiscal() { return LocalDate.of(App.periodoFiscal, Month.DECEMBER, 31); }
From source file:org.openlmis.fulfillment.web.ProofOfDeliveryControllerIntegrationTest.java
/** * Prepare the test environment.//from w w w . j av a 2 s . c o m */ @Before public void setUp() { this.setUpBootstrapData(); OrderableDto product = new OrderableDto(); product.setId(UUID.randomUUID()); FacilityDto facility = new FacilityDto(); facility.setId(UUID.randomUUID()); facility.setCode("facilityCode"); facility.setName("facilityName"); facility.setDescription("facilityDescription"); facility.setActive(true); facility.setEnabled(true); SupervisoryNodeDto supervisoryNode = new SupervisoryNodeDto(); supervisoryNode.setId(UUID.randomUUID()); supervisoryNode.setCode("NodeCode"); supervisoryNode.setName("NodeName"); supervisoryNode.setFacility(facility); ProgramDto program = new ProgramDto(); program.setId(UUID.randomUUID()); program.setCode("programCode"); ProcessingPeriodDto period = new ProcessingPeriodDto(); period.setId(UUID.randomUUID()); period.setProcessingSchedule(new ProcessingScheduleDto()); period.setName("periodName"); period.setStartDate(LocalDate.of(2015, Month.JANUARY, 1)); period.setEndDate(LocalDate.of(2015, Month.DECEMBER, 31)); Order order = new Order(); order.setId(UUID.randomUUID()); order.setExternalId(UUID.randomUUID()); order.setProgramId(program.getId()); order.setFacilityId(facility.getId()); order.setProcessingPeriodId(period.getId()); order.setEmergency(false); order.setStatus(OrderStatus.SHIPPED); order.setCreatedDate(ZonedDateTime.now()); order.setCreatedById(UUID.randomUUID()); order.setOrderCode("O1"); order.setProgramId(program.getId()); order.setQuotedCost(new BigDecimal(100)); order.setSupplyingFacilityId(facility.getId()); order.setRequestingFacilityId(facility.getId()); order.setReceivingFacilityId(facility.getId()); given(orderRepository.findOne(order.getId())).willReturn(order); given(orderRepository.exists(order.getId())).willReturn(true); OrderLineItem orderLineItem = new OrderLineItem(); orderLineItem.setId(UUID.randomUUID()); orderLineItem.setOrderableId(product.getId()); orderLineItem.setOrderedQuantity(100L); orderLineItem.setFilledQuantity(100L); orderLineItem.setApprovedQuantity(0L); orderLineItem.setPacksToShip(100L); proofOfDeliveryLineItem.setId(UUID.randomUUID()); proofOfDeliveryLineItem.setOrderLineItem(orderLineItem); proofOfDeliveryLineItem.setQuantityShipped(100L); proofOfDeliveryLineItem.setQuantityReturned(100L); proofOfDeliveryLineItem.setQuantityReceived(100L); proofOfDeliveryLineItem.setReplacedProductCode("replaced product code"); proofOfDeliveryLineItem.setNotes("Notes"); proofOfDelivery.setId(UUID.randomUUID()); proofOfDelivery.setOrder(order); proofOfDelivery.setDeliveredBy("delivered by"); proofOfDelivery.setReceivedBy("received by"); proofOfDelivery.setReceivedDate(ZonedDateTime.now()); proofOfDelivery.setProofOfDeliveryLineItems(new ArrayList<>()); proofOfDelivery.getProofOfDeliveryLineItems().add(proofOfDeliveryLineItem); proofOfDeliveryDto = ProofOfDeliveryDto.newInstance(proofOfDelivery, exporter); given(proofOfDeliveryRepository.findOne(proofOfDelivery.getId())).willReturn(proofOfDelivery); given(proofOfDeliveryRepository.findOne(proofOfDeliveryId)).willReturn(null); given(proofOfDeliveryRepository.exists(proofOfDelivery.getId())).willReturn(true); given(proofOfDeliveryRepository.save(any(ProofOfDelivery.class))) .willAnswer(new SaveAnswer<ProofOfDelivery>()); }
From source file:org.silverpeas.core.calendar.Recurrence.java
private Temporal computeDateForYearlyFrequencyFrom(final Temporal source, DayOfWeekOccurrence dayOfWeek) { final int lastDayOfYear = 31; Temporal current = source;// w ww . jav a 2 s . co m if (dayOfWeek.nth() > 1) { current = current.with(ChronoField.ALIGNED_WEEK_OF_YEAR, dayOfWeek.nth()); } else if (dayOfWeek.nth() < 0) { current = current.with(MonthDay.of(Month.DECEMBER, lastDayOfYear)) .plus(dayOfWeek.nth(), ChronoUnit.WEEKS).with(dayOfWeek.dayOfWeek()); } return current; }