Пример #1
0
 public void setLastUpdateFromString(String lastUpdateString) {
   if (lastUpdateString == null || lastUpdateString.isEmpty()) {
     lastUpdate = null;
     return;
   }
   try {
     lastUpdate = TextUtils.FULLDATE.parse(lastUpdateString);
   } catch (ParseException e) {
     throw new BIGSException("error parsing date " + lastUpdateString);
   }
 }
Пример #2
0
  /**
   * Fills a Put object leaving it ready to persist this schedule item into the underlying storage
   *
   * @param put the Put object to fill in
   * @return the same object filled in
   */
  public Put fillPutObject(Put put) {

    if (this.preparedTask != null) {
      TaskHelper.toPutObject(this.preparedTask, put, "scheduling", "task.class", "task.object");
    }

    if (this.preparedTaskContainer != null) {
      this.preparedTaskContainer.toPutObject(
          put, "scheduling", "task.container.class", "task.container.object");
    }

    if (this.getProcessState() != null) {
      this.getProcessState().toPutObject(put, "content", "class", "data");
    }

    put.add("bigs", "status", Bytes.toBytes(this.getStatusAsString()));
    put.add(
        "scheduling", "parents", Bytes.toBytes(Text.collate(this.parentsRowkeys.toArray(), " ")));

    put.add("scheduling", "method", Bytes.toBytes(this.getMethodName()));

    lastUpdate = new Date(Core.getTime());

    put.add("bigs", "lastupdate", Bytes.toBytes(TextUtils.FULLDATE.format(this.lastUpdate)));

    if (this.elapsedTime != null) {
      put.add("bigs", "elapsedtime", Bytes.toBytes(this.elapsedTime.toString()));
    }

    if (this.tags != null) {
      for (String k : this.tags.keySet()) {
        String v = this.tags.get(k);
        if (v != null && !v.isEmpty()) {
          put.add("tags", k, Bytes.toBytes(v));
        }
      }
    }
    return put;
  }