Example usage for java.time LocalDateTime now

List of usage examples for java.time LocalDateTime now

Introduction

In this page you can find the example usage for java.time LocalDateTime now.

Prototype

public static LocalDateTime now() 

Source Link

Document

Obtains the current date-time from the system clock in the default time-zone.

Usage

From source file:ch.wisv.areafiftylan.products.model.Order.java

public Order(User user) {
    this.user = user;
    status = OrderStatus.CREATING;//w w  w . j a  v a 2 s.c om
    creationDateTime = LocalDateTime.now();
    this.tickets = new HashSet<>();
}

From source file:br.ufac.sion.service.retorno.ArquivoRetornoBradescoService.java

public ArquivoRetornoDetalhe carregar(String fileName, InputStream inputstream) throws ArquivoRetornoException {
    try {//  w  w w .  j a  va2s  .c  om
        ArquivoRetornoBradesco arquivoRetorno = criarArquivoRetorno(fileName, inputstream);
        this.ard = new ArquivoRetornoDetalhe();
        this.ar = new ArquivoRetorno();

        this.ar.setNome(fileName);
        this.ar.setDataUpload(LocalDateTime.now());
        this.ar.setArquivo(IOUtils.toByteArray(inputstream));
        this.ar = em.merge(ar);

        carregarMensagens(arquivoRetorno);

        carregarTitulos(arquivoRetorno);

        return ard;

    } catch (Exception e) {
        e.printStackTrace();
        throw new ArquivoRetornoException("Erro ao processar o arquivo de retorno: " + e.getMessage());
    }

}

From source file:org.wallride.service.SignupService.java

public boolean validateInvitation(UserInvitation invitation) {
    if (invitation == null) {
        return false;
    }/*from   ww w .  j  ava2s .  c o  m*/
    if (invitation.isAccepted()) {
        return false;
    }
    LocalDateTime now = LocalDateTime.now();
    if (now.isAfter(invitation.getExpiredAt())) {
        return false;
    }
    return true;
}

From source file:org.jbb.system.impl.install.InstallationFileManager.java

public void createInstallationFile(InstallationData installationData) {
    Parameters params = new Parameters();
    File installFile = getInstallFile();
    try {/*from w w  w . j  a  v  a  2s  .  c  o m*/
        FileUtils.touch(installFile);
    } catch (IOException e) {
        throw new IllegalStateException(e);
    }
    FileBasedConfigurationBuilder<FileBasedConfiguration> builder = new FileBasedConfigurationBuilder<FileBasedConfiguration>(
            PropertiesConfiguration.class).configure(params.fileBased().setFile(installFile));
    builder.setAutoSave(true);

    try {
        FileBasedConfiguration configuration = builder.getConfiguration();
        configuration.addProperty("installationId", UUID.randomUUID().toString());
        configuration.addProperty("installationVersion", jbbMetaData.jbbVersion());
        configuration.addProperty("installationDate", LocalDateTime.now().toString());
        configuration.addProperty("boardFounderUsername", installationData.getAdminUsername());
        builder.save();
    } catch (ConfigurationException e) {
        throw new IllegalStateException(e);
    }
}

From source file:br.ufac.sion.service.retorno.ArquivoRetornoCaixaService.java

public ArquivoRetornoDetalhe carregar(String fileName, InputStream inputstream) throws ArquivoRetornoException {
    try {//from  www. j  a  va  2s  .  c  o  m
        ArquivoRetornoCaixa arquivoRetorno = criarArquivoRetorno(fileName, inputstream);
        this.ard = new ArquivoRetornoDetalhe();
        this.ar = new ArquivoRetorno();

        this.ar.setNome(fileName);
        this.ar.setDataUpload(LocalDateTime.now());
        this.ar.setNumero(arquivoRetorno.getCabecalhoLote().getNumeroRetorno());
        this.ar.setArquivo(IOUtils.toByteArray(inputstream));
        this.ar = em.merge(ar);

        carregarMensagens(arquivoRetorno);

        carregarTitulos(arquivoRetorno);

        return ard;

    } catch (Exception e) {
        e.printStackTrace();
        throw new ArquivoRetornoException("Erro ao processar o arquivo de retorno: " + e.getMessage());
    }

}

From source file:com.qq.tars.service.PatchService.java

@Transactional(rollbackFor = Exception.class)
public ServerPatch addServerPatch(String application, String moduleName, String tgz, String comment) {
    String md5 = md5(tgz);/*from   w w  w  . ja  v  a2  s .  co m*/
    Preconditions.checkNotNull(md5);

    ServerPatch patch = new ServerPatch();
    patch.setServer(String.format("%s.%s", application, moduleName));
    patch.setTgz(FilenameUtils.getName(tgz));
    patch.setMd5(md5);
    patch.setUpdateText(comment);
    patch.setPosttime(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));

    patchMapper.insertServerPatch(patch);
    log.info("id={}, server={}, tgz={}, md5={}, update_text={}", patch.getId(), patch.getServer(),
            patch.getTgz(), patch.getMd5(), patch.getUpdateText());
    return patch;
}

From source file:org.cyberjos.jcconf2016.node.CloudNodeMessage.java

/**
 * Constructor with the given builder./*from   w  w  w  .j  av a  2  s .co  m*/
 *
 * @param builder the builder
 */
@SuppressWarnings("synthetic-access")
private CloudNodeMessage(final Builder builder) {
    this.sender = builder.sender;
    this.receiver = builder.receiver;
    this.content = builder.content;
    this.creationTime = LocalDateTime.now();
}

From source file:name.nirav.mp.service.analytics.EntityExtractionService.java

public EntityExtractionService(OpenCalaisConfig config, PredictionDB db) {
    this.config = config;
    this.calaisConfig = new CalaisConfig();
    this.calaisConfig.set(CalaisConfig.ConnParam.READ_TIMEOUT, config.readTimeout);
    this.calaisConfig.set(CalaisConfig.ConnParam.CONNECT_TIMEOUT, config.readTimeout);
    this.db = db;
    this.client = new CalaisRestClient(config.licenseKey);
    this.rateLimiter = RateLimiter.create(4);
    Timer timer = new Timer("Calais-ban-reset");
    timer.scheduleAtFixedRate(new TimerTask() {
        public void run() {
            LocalDateTime now = LocalDateTime.now();
            if (now.getHour() >= 23) {
                LOG.info("It is close to midnight {}, resetting callCount", now.getHour());
                callCount = 0;/*from   w  ww.j  a va 2s. co m*/
            }
        }
    }, 1000, TimeUnit.MINUTES.toMillis(30));
}

From source file:ca.qhrtech.entities.BGLUser.java

public BGLUser(String username, String avatarPath, String email, String password) {
    //Testing constructor, will be removed in production
    this.username = username;
    this.avatarPath = avatarPath;
    this.email = email;
    this.joinDate = LocalDateTime.now();
    this.password = new BCryptPasswordEncoder().encode(password);
}

From source file:Comitter.java

private String processCharacter(char[] rowChars, int charactersOffset) {
    int[][] matrix = new int[8][6];
    int weeksCount = 6;
    int weekDaysCount = 7;
    int totalDays = weeksCount * weekDaysCount;
    int charHeight = 8;
    int subDays;//from   w w  w .j  av a 2s. com
    String dateAsString, output = "";
    int counter = 0;

    int i = 0;
    for (char myChar : rowChars) {

        for (int bit = 0; bit < 8; bit++) {
            if ((myChar & (1L << bit)) != 0) {
                matrix[bit][i] = 1;
            } else {
                matrix[bit][i] = 0;
            }
        }
        i++;
        //System.out.println();
    }

    for (int asd = 0; asd < totalDays; asd++) {
        dateAsString = LocalDateTime.now().minusDays(totalDays - asd + 4 + 21 + 6 * 7 * charactersOffset)
                .toString();
        if (matrix[asd % weekDaysCount][asd / (weeksCount + 1)] == 1) {
            output += "GIT_AUTHOR_DATE=" + dateAsString + " GIT_COMMITTER_DATE=" + dateAsString
                    + " git commit --allow-empty -m \"ceva\" > /dev/null \n";
        }
        System.out.println("a[" + asd % weekDaysCount + "," + asd / (weeksCount + 1) + "]="
                + matrix[asd % weekDaysCount][asd / (weeksCount + 1)]);
    }
    return output;
}