Esempio n. 1
0
  private BornTransmissionLog prepareLog() {
    BornTransmissionLog log = new BornTransmissionLog();
    log.setFilename(filenameStart);
    log.setSubmitDateTime(new Date());
    logDao.persist(log);

    return log;
  }
Esempio n. 2
0
 private String getFileSuffix(Integer logId) {
   long num = logDao.getSeqNoToday(filenameStart, logId);
   String tmp = String.valueOf(num);
   while (tmp.length() < 3) {
     tmp = "0" + tmp;
   }
   return tmp;
 }
Esempio n. 3
0
  private void uploadToBorn(
      Integer demographicNo, Integer rourkeFdid, Integer nddsFdid, Integer report18mFdid) {
    byte[] born18mXml = generateXml(demographicNo, rourkeFdid, nddsFdid, report18mFdid);
    if (born18mXml == null) return;

    BornTransmissionLog log = prepareLog();

    SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
    String dt = sdf.format(new Date());
    String filename = filenameStart + "_" + dt + "_" + getFileSuffix(log.getId()) + ".xml";

    boolean uploadOk = uploadToBORN(born18mXml, filename);
    if (uploadOk) recordFormSent(demographicNo, rourkeFdid, nddsFdid, report18mFdid);

    // update log filename and status (success=true/false)
    log.setFilename(filename);
    log.setSuccess(uploadOk);
    logDao.merge(log);

    logger.info("Uploaded [" + filename + "]");
    return;
  }