Example usage for java.time ZoneId systemDefault

List of usage examples for java.time ZoneId systemDefault

Introduction

In this page you can find the example usage for java.time ZoneId systemDefault.

Prototype

public static ZoneId systemDefault() 

Source Link

Document

Gets the system default time-zone.

Usage

From source file:org.eclipse.hawkbit.mgmt.rest.resource.MgmtTargetMapper.java

static void addPollStatus(final Target target, final MgmtTarget targetRest) {
    final PollStatus pollStatus = target.getPollStatus();
    if (pollStatus != null) {
        final MgmtPollStatus pollStatusRest = new MgmtPollStatus();
        pollStatusRest.setLastRequestAt(
                Date.from(pollStatus.getLastPollDate().atZone(ZoneId.systemDefault()).toInstant()).getTime());
        pollStatusRest.setNextExpectedRequestAt(
                Date.from(pollStatus.getNextPollDate().atZone(ZoneId.systemDefault()).toInstant()).getTime());
        pollStatusRest.setOverdue(pollStatus.isOverdue());
        targetRest.setPollStatus(pollStatusRest);
    }//from  w w w .  j  a v  a2  s .  c om
}

From source file:com.hotelbeds.hotelapimodel.auto.util.AssignUtils.java

public static LocalDate getLocalDate(final Date date) {
    return date != null ? date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate() : null;
}

From source file:at.becast.youploader.youtube.GuiUploadEvent.java

@Override
public void onInit() {
    this.starttime = System.currentTimeMillis();
    this.lastdata = 0;
    this.lasttime = this.starttime;
    this.lastdb = this.starttime;
    Date in = new Date(this.starttime);
    LocalDateTime ldt = LocalDateTime.ofInstant(in.toInstant(), ZoneId.systemDefault());
    Date out = Date.from(ldt.atZone(ZoneId.systemDefault()).toInstant());
    DateFormat formatter = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT,
            Locale.getDefault());
    frame.getlblStart().setText(formatter.format(out));
    frame.getProgressBar().setString("0,00 %");
    frame.getProgressBar().setValue(0);/* w  w  w .jav  a  2s. co  m*/
    frame.getProgressBar().revalidate();
    frame.getBtnCancel().setEnabled(true);
    frame.getBtnEdit().setEnabled(true);
    frame.getBtnDelete().setEnabled(false);
    frame.revalidate();
    frame.repaint();
}

From source file:de.adorsys.multibanking.hbci.model.HbciMapping.java

public static List<StandingOrder> createStandingOrders(GVRDauerList gvrDauerList) {
    GVRDauerList.Dauer[] lines = gvrDauerList.getEntries();
    List<StandingOrder> standingOrders = new ArrayList<>();

    for (int i = 0; i < lines.length; ++i) {
        GVRDauerList.Dauer line = lines[i];
        StandingOrder auftrag = new StandingOrder();

        if (line.firstdate != null) {
            auftrag.setFirstExecutionDate(
                    line.firstdate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate());
        }/*from   w  w  w.  j  a v a 2s  . com*/
        if (line.lastdate != null) {
            auftrag.setLastExecutionDate(
                    line.lastdate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate());
        }
        auftrag.setAmount(line.value.getBigDecimalValue());
        auftrag.setOrderId(line.orderid);
        auftrag.setOtherAccount(toBankAccount(line.other));
        auftrag.setUsage(getUsage(Arrays.asList(line.usage)));
        auftrag.setExecutionDay(line.execday);

        Cycle cycle = null;
        if (!StringUtils.endsWithIgnoreCase("M", line.timeunit)) {
            cycle = Cycle.WEEKLY;
        } else {
            switch (line.turnus) {
            case 1:
                cycle = Cycle.MONTHLY;
                break;
            case 2:
                cycle = Cycle.TWO_MONTHLY;
                break;
            case 3:
                cycle = Cycle.QUARTERLY;
                break;
            case 6:
                cycle = Cycle.HALF_YEARLY;
                break;
            case 12:
                cycle = Cycle.YEARLY;
                break;
            }
        }
        auftrag.setCycle(cycle);

        standingOrders.add(auftrag);
    }
    return standingOrders;

}

From source file:it.tidalwave.accounting.importer.ibiz.impl.ConfigurationDecorator.java

@Nonnull
public LocalDateTime getDateTime(final @Nonnull String key) {
    return LocalDateTime.ofInstant(((Date) delegate.getProperty(key)).toInstant(), ZoneId.systemDefault());
}

From source file:alfio.util.TemplateResourceTest.java

private Pair<ZonedDateTime, ZonedDateTime> getDates() {
    ZonedDateTime eventBegin = ZonedDateTime.now().plusDays(1);
    ZonedDateTime eventEnd = ZonedDateTime.now().plusDays(3);
    ZonedDateTime validityStart = ZonedDateTime.now().plusDays(2);

    when(event.getBegin()).thenReturn(eventBegin);
    when(event.getZoneId()).thenReturn(ZoneId.systemDefault());
    when(event.getEnd()).thenReturn(eventEnd);
    when(ticketCategory.getTicketValidityStart(eq(ZoneId.systemDefault()))).thenReturn(validityStart);
    when(ticket.ticketCode(anyString())).thenReturn("abcd");
    return Pair.of(validityStart, eventEnd);
}

From source file:org.wallride.web.support.AtomFeedView.java

@SuppressWarnings("unchecked")
@Override//from   w w w  .  ja va  2  s  . c  o  m
protected List<Entry> buildFeedEntries(Map<String, Object> model, HttpServletRequest request,
        HttpServletResponse response) throws Exception {
    Set<Article> articles = (Set<Article>) model.get("articles");
    List<Entry> entries = new ArrayList<>(articles.size());
    for (Article article : articles) {
        Entry entry = new Entry();
        entry.setTitle(article.getTitle());
        entry.setPublished(Date.from(article.getDate().atZone(ZoneId.systemDefault()).toInstant()));
        Content content = new Content();
        content.setValue(article.getBody());
        entry.setSummary(content);

        Link link = new Link();
        link.setHref(link(article));
        List<Link> links = new ArrayList<Link>();
        links.add(link);
        entry.setAlternateLinks(links);
        entries.add(entry);
    }
    return entries;
}

From source file:com.otway.picasasync.syncutil.ImageSync.java

public boolean newerThan(LocalDateTime threshold) throws ServiceException {
    boolean localFileExists = localFile.exists();

    if (localFileExists) {
        LocalDateTime localTimeStamp = getTimeFromMS(localFile.lastModified());

        // There's a local file. See if it's newer
        if (localTimeStamp.isAfter(threshold))
            return true;
    }//from   w  w w . j a  va 2s .c  o m

    if (remotePhoto != null) {
        LocalDateTime remoteTimeStamp = LocalDateTime.ofInstant(remotePhoto.getTimestamp().toInstant(),
                ZoneId.systemDefault());

        // There's a remote file. See if it's newer
        if (remoteTimeStamp.isAfter(threshold))
            return true;
    }

    return false;
}

From source file:org.ojbc.util.model.rapback.IdentificationResultSearchRequest.java

public LocalDate getReportedDateStartLocalDate() {
    return getReportedDateStartDate() == null ? null
            : reportedDateStartDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
}

From source file:org.primeframework.mvc.parameter.convert.converters.ZonedDateTimeConverterTest.java

@Test
public void toStrings() {
    GlobalConverter converter = new ZonedDateTimeConverter(new MockConfiguration());
    String str = converter.convertToString(ZonedDateTime.class, null, "testExpr", null);
    assertNull(str);/*from   w  w  w.  j  a va  2  s .  com*/

    str = converter.convertToString(ZonedDateTime.class, MapBuilder.asMap("dateTimeFormat", "MM-dd-yyyy"),
            "testExpr", ZonedDateTime.of(2008, 7, 8, 1, 1, 1, 0, ZoneId.systemDefault()));
    assertEquals(str, "07-08-2008");
}