Ejemplo n.º 1
0
  /**
   * Set crudFlagArray arraylist based on crudFlag content string
   *
   * @throws MOException
   */
  private void setCrudFlagArray() throws MOException {

    String crudFlagContent = super.getCrudFlags();
    // Create array representation of split ratio crudFlags indexed by dt
    try {
      crudFlagArray = new ArrayList<CrudFlag>();

      if (crudFlagContent != null) {
        // if CrudFlag content exists populate crudFlagArray arraylist from string
        String[] contentArray = crudFlagContent.split(",");
        // For each value separated by a comma, add it to content array
        for (int i = 0; i < contentArray.length; i++) {
          crudFlagArray.add(CrudFlag.valueOf(contentArray[i].trim()));
        }
      }
    } catch (Exception ex) {
      throw new MOException(
          ex,
          "Invalid CrudFlag content string. Should be a comma separated string of String date values.");
    }
  }
Ejemplo n.º 2
0
  /** Sets the value of the modStamp property. */
  public void setCrudFlag(int offset, CrudFlag value) throws MOException {

    // CrudFlag -- if no crudFlagArray list has been created, add one
    if (crudFlagArray == null) {
      setCrudFlagArray();
    }
    try {
      // add CrudFlag to array at offset
      crudFlagArray.add(offset, value);
      // Create content string based on crudFlagArray list, by removing "[", "]" characters and
      // spaces between commas.
      String crudFlagContent = crudFlagArray.toString().replaceAll("(\\[|\\]|\\s)", "");
      setCrudFlags(crudFlagContent);
    } catch (Exception ex) {
      throw new MOException(
          ex,
          "Error adding new split ratio CRUDFlag "
              + value.toString()
              + " at offset "
              + offset
              + ". Must add ratio's in order.");
    }
  }