/**
  * Check all date/time fiels validity?
  *
  * @return true if valid, false otherwise.
  */
 private boolean isDateValid() {
   boolean valid = dateTimeStart.withSecondOfMinute(0).isBefore(dateTimeEnd.withSecondOfMinute(0));
   if (cbAllDay.isChecked()) {
     LocalDate start = dateTimeStart.toLocalDate();
     LocalDate end = dateTimeEnd.toLocalDate();
     valid = start.isBefore(end) || start.isEqual(end);
   }
   return valid;
 }
  @Test(groups = "fast")
  public void testJson() throws Exception {
    final String accountId = UUID.randomUUID().toString();
    final String bundleId = UUID.randomUUID().toString();
    final String subscriptionId = UUID.randomUUID().toString();
    final String externalKey = UUID.randomUUID().toString();
    final DateTime requestedDate = DefaultClock.toUTCDateTime(new DateTime(DateTimeZone.UTC));
    final DateTime effectiveDate = DefaultClock.toUTCDateTime(new DateTime(DateTimeZone.UTC));
    final UUID eventId = UUID.randomUUID();
    final List<AuditLogJson> auditLogs = createAuditLogsJson(clock.getUTCNow());
    final EventSubscriptionJson newEvent =
        new EventSubscriptionJson(
            eventId.toString(),
            BillingPeriod.NO_BILLING_PERIOD.toString(),
            requestedDate.toLocalDate(),
            effectiveDate.toLocalDate(),
            UUID.randomUUID().toString(),
            UUID.randomUUID().toString(),
            SubscriptionBaseTransitionType.CREATE.toString(),
            false,
            true,
            UUID.randomUUID().toString(),
            UUID.randomUUID().toString(),
            PhaseType.DISCOUNT.toString(),
            auditLogs);

    final PhasePriceOverrideJson priceOverride =
        new PhasePriceOverrideJson("bar", null, BigDecimal.TEN, BigDecimal.ONE);

    final SubscriptionJson entitlementJsonWithEvents =
        new SubscriptionJson(
            accountId,
            bundleId,
            subscriptionId,
            externalKey,
            new LocalDate(),
            UUID.randomUUID().toString(),
            UUID.randomUUID().toString(),
            UUID.randomUUID().toString(),
            UUID.randomUUID().toString(),
            UUID.randomUUID().toString(),
            UUID.randomUUID().toString(),
            UUID.randomUUID().toString(),
            new LocalDate(),
            new LocalDate(),
            new LocalDate(),
            new LocalDate(),
            ImmutableList.<EventSubscriptionJson>of(newEvent),
            ImmutableList.of(priceOverride),
            null);

    final String asJson = mapper.writeValueAsString(entitlementJsonWithEvents);

    final SubscriptionJson fromJson = mapper.readValue(asJson, SubscriptionJson.class);
    Assert.assertEquals(fromJson, entitlementJsonWithEvents);
  }
Beispiel #3
0
  @Test
  public void totalDosesWhenEndTimeIsNull() {
    DateTime now = new DateTime(2011, 10, 3, 10, 0, 0, 0);
    final DateTime dosageStartTime = now.minusDays(1);
    Dosage dosage =
        new Dosage(
            new DosageResponse(
                "dosage_id",
                new Time(dosageStartTime.getHourOfDay(), dosageStartTime.getMinuteOfHour()),
                dosageStartTime.toLocalDate(),
                null,
                null,
                null));

    assertEquals(2, dosage.getDosesBetween(dosageStartTime.toLocalDate(), now));
  }
  @Override
  public Object adapt(Object value, Map<String, Object> context) {

    if (value == null || !(value instanceof String)) {
      return value;
    }

    String format = this.get("format", DEFAULT_FORMAT);

    DateTimeFormatter fmt = DateTimeFormat.forPattern(format);
    DateTime dt;
    try {
      dt = fmt.parseDateTime((String) value);
    } catch (Exception e) {
      throw new IllegalArgumentException("Invalid value: " + value, e);
    }

    String type = this.get("type", null);

    if ("LocalDate".equals(type)) {
      return dt.toLocalDate();
    }
    if ("LocalTime".equals(type)) {
      return dt.toLocalTime();
    }
    if ("LocalDateTime".equals(type)) {
      return dt.toLocalDateTime();
    }
    return dt;
  }
 @Override
 public LocalDate deserialize(JsonParser jp, DeserializationContext ctxt)
     throws IOException, JsonProcessingException {
   // We'll accept either long (timestamp) or array:
   if (jp.isExpectedStartArrayToken()) {
     jp.nextToken(); // VALUE_NUMBER_INT
     int year = jp.getIntValue();
     jp.nextToken(); // VALUE_NUMBER_INT
     int month = jp.getIntValue();
     jp.nextToken(); // VALUE_NUMBER_INT
     int day = jp.getIntValue();
     if (jp.nextToken() != JsonToken.END_ARRAY) {
       throw ctxt.wrongTokenException(jp, JsonToken.END_ARRAY, "after LocalDate ints");
     }
     return new LocalDate(year, month, day);
   }
   switch (jp.getCurrentToken()) {
     case VALUE_NUMBER_INT:
       return new LocalDate(jp.getLongValue());
     case VALUE_STRING:
       DateTime local = parseLocal(jp);
       if (local == null) {
         return null;
       }
       return local.toLocalDate();
   }
   throw ctxt.wrongTokenException(
       jp, JsonToken.START_ARRAY, "expected JSON Array, String or Number");
 }
  public List<String> getDepartmentsForPrincipalInRoles(
      String principalId, List<String> roleIds, DateTime asOfDate, boolean isActiveOnly) {
    Set<String> departments = new HashSet<String>();

    Map<String, String> qualifiers = new HashMap<String, String>();
    qualifiers.put(KPMERoleMemberAttribute.WORK_AREA.getRoleMemberAttributeName(), "%");
    qualifiers.put(KPMERoleMemberAttribute.LOCATION.getRoleMemberAttributeName(), "%");
    qualifiers.put(KPMERoleMemberAttribute.DEPARTMENT.getRoleMemberAttributeName(), "%");
    qualifiers.put(KPMERoleMemberAttribute.GROUP_KEY_CODE.getRoleMemberAttributeName(), "%");
    List<Map<String, String>> roleQualifiers =
        getRoleQualifiers(principalId, roleIds, qualifiers, asOfDate, isActiveOnly);

    for (Map<String, String> roleQualifier : roleQualifiers) {
      String department =
          MapUtils.getString(
              roleQualifier, KPMERoleMemberAttribute.DEPARTMENT.getRoleMemberAttributeName());
      String groupKeyCode =
          MapUtils.getString(
              roleQualifier, KPMERoleMemberAttribute.GROUP_KEY_CODE.getRoleMemberAttributeName());
      if (department != null && groupKeyCode != null) {
        departments.add(groupKeyCode + "|" + department);
      }
    }

    List<String> locations =
        getLocationsForPrincipalInRoles(principalId, roleIds, asOfDate, isActiveOnly);
    departments.addAll(
        getDepartmentService().getDepartmentValuesWithLocations(locations, asOfDate.toLocalDate()));

    return new ArrayList<String>(departments);
  }
  @Test
  public void testWithConversion() throws IOException {

    DateTime today = new DateTime();

    Map<String, Object> resultMap =
        (Map<String, Object>)
            ControllerUtil.sendAndReceive(
                controller,
                "remoteProviderSimple",
                "method14",
                a(
                    ISODateTimeFormat.dateTime().print(today),
                    "normalParameter",
                    ISODateTimeFormat.date().print(today),
                    "99.9%"),
                Map.class);

    assertThat(resultMap.get("endDate")).isEqualTo(today.getMillis());
    ObjectMapper mapper = new ObjectMapper();

    List<Object> expectedValue =
        mapper.readValue(mapper.writeValueAsString(today.toLocalDate()), List.class);
    Object actualValue = resultMap.get("jodaLocalDate");

    assertThat((List<Object>) resultMap.get("jodaLocalDate")).isEqualTo(expectedValue);
    assertThat(resultMap.get("percent")).isEqualTo(0.999);
    assertThat(resultMap.get("normalParameter")).isEqualTo("normalParameter");
    assertThat(resultMap.get("remoteAddr")).isEqualTo("127.0.0.1");
  }
Beispiel #8
0
  @Test
  public void shouldIncludeBothFromAndToDate_WhenGettingNumberOfDoses() {
    DateTime now = new DateTime(2011, 10, 3, 10, 0, 0, 0);
    final DateTime dosageStartTime = now.minusWeeks(1);
    final DateTime dosageEndTime = now.plusDays(1);
    Dosage dosage =
        new Dosage(
            new DosageResponse(
                "dosage_id",
                new Time(dosageStartTime.getHourOfDay(), dosageStartTime.getMinuteOfHour()),
                dosageStartTime.toLocalDate(),
                dosageEndTime.toLocalDate(),
                null,
                null));

    assertEquals(8, dosage.getDosesBetween(now.minusWeeks(1).toLocalDate(), now));
  }
Beispiel #9
0
  @Test
  public void totalDosesWhenDosageStartDateEqualsDosageEndDate() {
    DateTime now = new DateTime(2011, 10, 2, 10, 0, 0, 0);
    final DateTime dosageStartTime = now;
    final DateTime dosageEndTime = dosageStartTime;
    Dosage dosage =
        new Dosage(
            new DosageResponse(
                "dosage_id",
                new Time(dosageStartTime.getHourOfDay(), dosageStartTime.getMinuteOfHour()),
                dosageStartTime.toLocalDate(),
                dosageEndTime.toLocalDate(),
                null,
                null));

    assertEquals(1, dosage.getDosesBetween(dosageStartTime.toLocalDate(), dosageEndTime));
  }
Beispiel #10
0
  @Test
  public void calculateNextConfirmedAppointmentDate() {
    mockCurrentDate(dayBeforeYesterday);
    assertEquals(yesterday.toLocalDate(), clinicVisits.nextConfirmedAppointmentDate());

    mockCurrentDate(yesterday);
    assertEquals(yesterday.toLocalDate(), clinicVisits.nextConfirmedAppointmentDate());

    mockCurrentDate(today);
    assertEquals(today.toLocalDate(), clinicVisits.nextConfirmedAppointmentDate());

    mockCurrentDate(tomorrow);
    assertNull(clinicVisits.nextConfirmedAppointmentDate());

    mockCurrentDate(dayAfterTomorrow);
    assertNull(clinicVisits.nextConfirmedAppointmentDate());
  }
  @Test
  public void getAbsoluteDatesMessageProgramTest() {
    String campaignName = "Absolute Dates Message Program";

    AbsoluteCampaign campaign =
        (AbsoluteCampaign) campaignRecordService.findByName(campaignName).toCampaign();
    assertNotNull(campaign);
    assertEquals(campaignName, campaign.getName());
    List<AbsoluteCampaignMessage> messages = campaign.getMessages();
    assertEquals(2, messages.size());
    DateTime firstDate = new DateTime(2013, 6, 15, 0, 0, 0, 0);
    DateTime secondDate = new DateTime(2013, 6, 22, 0, 0, 0, 0);
    assertMessageWithAbsoluteSchedule(
        messages.get(0), "First", new String[] {"IVR", "SMS"}, "random-1", firstDate.toLocalDate());
    assertMessageWithAbsoluteSchedule(
        messages.get(1), "Second", new String[] {"IVR"}, "random-2", secondDate.toLocalDate());
  }
  /** Assembles all the needed <code>TimeSeries</code>. */
  protected TimeSeriesCollection getDataset(Iteration iteration) {
    TimeSeriesCollection chartDataset = new TimeSeriesCollection();

    List<IterationHistoryEntry> iterationEntries =
        iterationHistoryEntryBusiness.getHistoryEntriesForIteration(iteration);

    LocalDate yesterday = new LocalDate().minusDays(1);
    LocalDate today = new LocalDate();
    IterationHistoryEntry yesterdayEntry = getHistoryEntryForDate(iterationEntries, yesterday);
    IterationHistoryEntry todayEntry = getHistoryEntryForDate(iterationEntries, today);
    DateTime iterationStartDate = new DateTime(iteration.getStartDate());
    DateTime iterationEndDate = new DateTime(iteration.getEndDate());

    chartDataset.addSeries(
        getBurndownTimeSeries(
            iterationEntries,
            new LocalDate(iteration.getStartDate()),
            determineEndDate(new LocalDate(iteration.getEndDate()))));

    chartDataset.addSeries(getCurrentDayTimeSeries(yesterdayEntry, todayEntry));

    chartDataset.addSeries(
        getScopingTimeSeries(
            iterationEntries, iterationStartDate.toLocalDate(), iterationEndDate.toLocalDate()));

    chartDataset.addSeries(
        getReferenceVelocityTimeSeries(
            iterationStartDate,
            iterationEndDate,
            new ExactEstimate(todayEntry.getOriginalEstimateSum())));

    TimeSeries predictedVelocity =
        getPredictedVelocityTimeSeries(
            iterationStartDate.toLocalDate(),
            iterationEndDate.toLocalDate(),
            yesterdayEntry,
            todayEntry);
    if (predictedVelocity != null) {
      chartDataset.addSeries(predictedVelocity);
    }

    return chartDataset;
  }
  public void print(ApplicationsPrinter printer) {

    LocalDate local = date.toLocalDate();

    String localString = local.toString();

    printer.print(localString);

    jobseekerInfo.print(printer);
  }
Beispiel #14
0
  public int gap(TimeId start) {
    Days days = Days.daysBetween(start.getDateTime().toLocalDate(), dateTime.toLocalDate());

    return days.getDays() * 288 + timeId - start.getTimeId();

    //        if(a >= 0) {
    //            return (a * 288) + timeId - start.getTimeId();
    //        } else {
    //            return (a * 288) + timeId - start.getTimeId();
    //        }
  }
  @Override
  public List<Long> getWorkAreasForPrincipalInRoles(
      String principalId, List<String> roleIds, DateTime asOfDate, boolean isActiveOnly) {
    Set<Long> workAreas = new HashSet<Long>();

    // iterate through the role ids getting the work areas for each one
    for (String roleId : roleIds) {
      // get the role for the role id from the role service
      Role role = getRoleService().getRole(roleId);
      if (role != null) {
        String roleName = role.getName();
        String namespaceCode = role.getNamespaceCode();

        Map<String, String> qualifiers = new HashMap<String, String>();
        // empty qualifier map will match any attribute in the predicate query, i.e. will work like
        // wildcarded entries
        List<Map<String, String>> roleQualifiers = new ArrayList<Map<String, String>>();
        List<RoleMember> principalAndGroupRoleMembers =
            getRoleMembers(namespaceCode, roleName, qualifiers, asOfDate, isActiveOnly);
        for (RoleMember roleMember : principalAndGroupRoleMembers) {
          // check for principals or groups
          if (MemberType.PRINCIPAL.equals(roleMember.getType())) {
            if (roleMember.getMemberId().equals(principalId)) {
              roleQualifiers.add(roleMember.getAttributes());
            }
          } else if (MemberType.GROUP.equals(roleMember.getType())) {
            // query the helper to see if the principal is a member of this nested member group
            Group nestedGroup = getGroupService().getGroup(roleMember.getMemberId());
            if (getRoleServiceHelper()
                .isMemberOfGroup(principalId, nestedGroup, asOfDate, isActiveOnly)) {
              roleQualifiers.add(roleMember.getAttributes());
            }
          }
        }

        for (Map<String, String> roleQualifier : roleQualifiers) {
          Long workArea =
              MapUtils.getLong(
                  roleQualifier, KPMERoleMemberAttribute.WORK_AREA.getRoleMemberAttributeName());
          if (workArea != null) {
            workAreas.add(workArea);
          }
        }
      }
    }

    List<String> departments =
        getDepartmentsForPrincipalInRoles(principalId, roleIds, asOfDate, isActiveOnly);
    workAreas.addAll(
        getWorkAreaService().getWorkAreasForDepartments(departments, asOfDate.toLocalDate()));

    return new ArrayList<Long>(workAreas);
  }
Beispiel #16
0
 private static Object parseDateTime(DateTime val, String toClass) {
   switch (toClass) {
     case "org.joda.time.DateTime":
       return val;
     case "java.util.Date":
       return val.toDate();
     case "org.joda.time.LocalDate":
       return val.toLocalDate();
     case "org.motechproject.commons.date.model.Time":
       return new Time(val.getHourOfDay(), val.getMinuteOfHour());
     default:
       return null;
   }
 }
  @Override
  public void scheduleDayOfWeekJob(
      String subject,
      Map<Object, Object> parameters,
      DateTime start,
      DateTime end,
      List<Object> days,
      DateTime time,
      Boolean ignorePastFiresAtStart) {
    MotechEvent motechEvent = new MotechEvent(subject, createMotechEventParameters(parameters));
    Time jobTime = new Time(time.getHourOfDay(), time.getMinuteOfHour());
    List<DayOfWeek> jobDayOfWeeks = createDayOfWeeks(days);

    DayOfWeekSchedulableJob job =
        new DayOfWeekSchedulableJob(
            motechEvent,
            start.toLocalDate(),
            end.toLocalDate(),
            jobDayOfWeeks,
            jobTime,
            ignorePastFiresAtStart);

    scheduler.scheduleDayOfWeekJob(job);
  }
Beispiel #18
0
 private Broadcast broadcastFrom(WsProgramme programme) {
   if (!Strings.isNullOrEmpty(programme.getFirstTxDate())
       && !Strings.isNullOrEmpty(programme.getProgDuration())) {
     DateTime start = dayFormatter.parseDateTime(programme.getFirstTxDate());
     if (start.isAfter(BBC_FOUNDED)) {
       Broadcast broadcast =
           new Broadcast(
               BBC_WORLD_SERVICE_URI,
               start,
               standardSeconds(parseInt(programme.getProgDuration())));
       broadcast.setScheduleDate(start.toLocalDate());
       return broadcast;
     }
   }
   return null;
 }
  /**
   * @param detail
   * @param dayLabel
   * @return
   */
  private boolean checkLabelExistsHashTagDetailStatGraph(
      final List<HashTagDetailStats> detail, final DateTime dayLabel) {
    boolean existLabel = false;

    if (detail.size() > 0) {
      for (HashTagDetailStats hashTagDetailStats : detail) {

        final int detailStat =
            hashTagDetailStats.getDateValue().toLocalDate().compareTo(dayLabel.toLocalDate());
        // Values:  0 = Exist 1 = No exists
        if (detailStat == 0) {
          existLabel = true;
        }
      }
    }
    return existLabel;
  }
Beispiel #20
0
  @Test(groups = "slow")
  public void testAddCreditToInvoice() throws Exception {
    final InvoiceJson invoice = getInvoicesForAccount(accountJson.getAccountId()).get(1);

    final DateTime effectiveDate = clock.getUTCNow();
    final BigDecimal creditAmount = BigDecimal.ONE;
    final CreditJson objFromJson =
        createCreditForInvoice(
            accountJson.getAccountId(),
            invoice.getInvoiceId(),
            creditAmount,
            clock.getUTCNow(),
            effectiveDate);

    // We can't just compare the object via .equals() due e.g. to the invoice id
    assertEquals(objFromJson.getAccountId(), accountJson.getAccountId());
    assertEquals(objFromJson.getCreditAmount().compareTo(creditAmount), 0);
    assertEquals(objFromJson.getEffectiveDate().compareTo(effectiveDate.toLocalDate()), 0);
  }
Beispiel #21
0
  public void updateUserLocationAndIncreaseDailySentCount(
      Long userId, DateTime photoDate, Location location, City city) {
    UserDetails userDetails = getUserDetails(userId);
    userDetails.setLastSentTime(photoDate);
    userDetails.setLastLocationTime(photoDate);
    userDetails.setLocation(location);
    userDetails.setCurrentCity(city);
    userDetails.setLastInteractionTime(photoDate);
    userDetails.setComeBackReminderTime(null);

    Long currentCount =
        statisticsService.incrementUserDailySentPhotoCount(userId, photoDate.toLocalDate());

    if (currentCount >= userDetails.getSendLimitPerDay()) {
      userDetails.setSendAllowedTime(photoDate.withTimeAtStartOfDay().plusDays(1));
    }

    userDetailsRepository.save(userDetails);
  }
  @Test
  public void shouldScheduleWeeklyAdherenceTrendJob_StartDateIsBeforeToday() {
    DateTime now = DateUtil.now();
    LocalDate today = now.toLocalDate();

    Patient patient =
        PatientBuilder.startRecording()
            .withDefaults()
            .withId("patientId")
            .withCallPreference(CallPreference.DailyPillReminder)
            .build();
    treatmentAdvice.getDrugDosages().get(0).setStartDate(today.minusMonths(2));

    schedulerService.scheduleJobForAdherenceTrendFeedbackForDailyPillReminder(
        patient, treatmentAdvice);
    ArgumentCaptor<CronSchedulableJob> jobCaptor =
        ArgumentCaptor.forClass(CronSchedulableJob.class);
    verify(motechSchedulerService).safeScheduleJob(jobCaptor.capture());
    assertEquals(today, DateUtil.newDate(jobCaptor.getValue().getStartTime()));
  }
  public List<String> getDepartmentsForPrincipalInRole(
      String principalId,
      String namespaceCode,
      String roleName,
      DateTime asOfDate,
      boolean isActiveOnly) {
    List<String> departments = new ArrayList<String>();
    Role role = getRoleService().getRoleByNamespaceCodeAndName(namespaceCode, roleName);
    if (role != null) {
      departments =
          getDepartmentsForPrincipalInRoles(
              principalId, Collections.singletonList(role.getId()), asOfDate, isActiveOnly);
    }

    // TODO:
    // Do we want to pass groupKeyCode instead of location to speed up the performance?
    List<String> locations =
        getLocationsForPrincipalInRole(
            principalId, namespaceCode, roleName, asOfDate, isActiveOnly);
    departments.addAll(
        getDepartmentService().getDepartmentValuesWithLocations(locations, asOfDate.toLocalDate()));

    return new ArrayList<String>(departments);
  }
  public boolean hasDateOf(DateTime newDate) {

    return (date.toLocalDate().equals(newDate.toLocalDate()));
  }
 /** Tests that format produces 'today' for identical {@link LocalDate} objects. */
 public void testFormatLocalDate_today() {
   assertEquals("today", mFormatter.format(mNow.toLocalDate(), mNow.toLocalDate()));
 }
 public void createTreatmentAdvice() {
   PatientDataService patientDataService = new PatientDataService(webDriver);
   TestTreatmentAdvice treatmentAdvice = setUpTreatmentAdviceOn(registrationTime.toLocalDate());
   patientDataService.setupRegimenWithDependents(treatmentAdvice, patient, clinician);
 }
Beispiel #27
0
 public Double getAge(DateTime birthdate) {
   return new Double(
           Days.daysBetween(birthdate.toLocalDate(), new DateTime().toLocalDate()).getDays())
       / 365;
 }
 @Override
 public LocalDate convert(DateTime source) {
   return source.toLocalDate();
 }
  public static void main(String[] args) {
    AngleValue longitude = new AngleValue(18.45631, AngleUnit.DEGREE);
    AngleValue latitude = new AngleValue(54.384251, AngleUnit.DEGREE);
    LengthValue altitude = new LengthValue(36.0, LengthUnit.METER);
    SolarPositionCalculator solarCalculator =
        new SolarPositionCalculator(longitude, latitude, altitude);
    DateTime datetime = new DateTime(2014, 8, 11, 0, 0, 1, DateTimeZone.UTC);

    System.out.println(
        "Topocentric zenith angle: "
            + solarCalculator
                .getSolarPosition()
                .forDateTime(datetime)
                .topocentric()
                .inHorizontalCoordiantes()
                .zenith()
                .inDegrees());
    System.out.println(
        "Topocentric elevation angle : "
            + solarCalculator
                .getSolarPosition()
                .forDateTime(datetime)
                .topocentric()
                .inHorizontalCoordiantes()
                .altitude());
    System.out.println(
        "Topocentric azimuth angle (eastward from north) [0 to 360 degrees]: "
            + solarCalculator
                .getSolarPosition()
                .forDateTime(datetime)
                .topocentric()
                .inHorizontalCoordiantes()
                .azimuth()
                .eastwardFromNorth());
    System.out.println(
        "Topocentric azimuth angle (westward from south) [-180 to 180 degrees]: "
            + solarCalculator
                .getSolarPosition()
                .forDateTime(datetime)
                .topocentric()
                .inHorizontalCoordiantes()
                .azimuth()
                .westwardFromSouth());
    System.out.println(
        "Surface incidence angle: " + solarCalculator.surfaceIncidenceAngle(datetime));

    System.out.println(
        "Local sunrise time (+/- 30 seconds) [fractional hour]: "
            + solarCalculator
                .getLocalSolarTime()
                .forLocalDate(datetime.toLocalDate())
                .sunriseTime()
                .asFractionalHourOfDay());
    System.out.println(
        "Local sunrise time (+/- 30 seconds) [datetime]: "
            + solarCalculator
                .getLocalSolarTime()
                .forLocalDate(datetime.toLocalDate())
                .sunriseTime()
                .asDateTime());
    System.out.println(
        "Local sun transit time (or solar noon): "
            + solarCalculator
                .getLocalSolarTime()
                .forDateTime(datetime)
                .suntransitTime()
                .asFractionalHourOfDay());
    System.out.println(
        "Local sunset time (+/- 30 seconds) [fractional hour]: "
            + solarCalculator
                .getLocalSolarTime()
                .forDateTime(datetime)
                .sunsetTime()
                .asFractionalHourOfDay());
    System.out.println(
        "Local sunset time (+/- 30 seconds) [datetime]: "
            + solarCalculator.getLocalSolarTime().forDateTime(datetime).sunsetTime().asDateTime());

    System.out.println(
        "Topocentric sunrise altitude: "
            + solarCalculator
                .getSolarPosition()
                .atSunrise(datetime.toLocalDate())
                .topocentric()
                .inHorizontalCoordiantes()
                .altitude());
    System.out.println(
        "Topocentric sunrise azimuth angle: "
            + solarCalculator
                .getSolarPosition()
                .atSunrise(datetime.toLocalDate())
                .topocentric()
                .inHorizontalCoordiantes()
                .azimuth()
                .eastwardFromNorth());

    System.out.println(
        "Topocentric sunset altitude: "
            + solarCalculator
                .getSolarPosition()
                .atSunset(datetime.toLocalDate())
                .topocentric()
                .inHorizontalCoordiantes()
                .altitude());
    System.out.println(
        "Topocentric sunset azimuth angle: "
            + solarCalculator
                .getSolarPosition()
                .atSunset(datetime.toLocalDate())
                .topocentric()
                .inHorizontalCoordiantes()
                .azimuth()
                .eastwardFromNorth());
  }