Exemplo n.º 1
0
  public static final void get(IData pipeline) throws ServiceException {
    // --- <<IS-START(get)>> ---
    // @subtype unknown
    // @sigtype java 3.5
    // [i] record:0:optional $bizdoc
    // [i] - field:0:required InternalID
    // [i] field:0:optional $part
    // [o] object:0:optional $content
    // [o] field:0:optional $content.type
    IDataCursor cursor = pipeline.getCursor();

    try {
      IData bizdoc = IDataUtil.getIData(cursor, "$bizdoc");
      String partName = IDataUtil.getString(cursor, "$part");

      if (bizdoc != null) {
        ContentPart part = new ContentPart(bizdoc, partName);
        java.io.InputStream content = part.getContent();

        if (content != null) {
          IDataUtil.put(cursor, "$content", content);
          IDataUtil.put(cursor, "$content.type", part.getMimeType());
        }
      }
    } finally {
      cursor.destroy();
    }
    // --- <<IS-END>> ---

  }
Exemplo n.º 2
0
  public static final void process(IData pipeline) throws ServiceException {
    // --- <<IS-START(process)>> ---
    // @subtype unknown
    // @sigtype java 3.5
    // [i] field:0:required $file
    // [i] field:0:optional $mode {&quot;read&quot;,&quot;append&quot;,&quot;write&quot;}
    // [i] field:0:required $service
    // [i] record:0:optional $pipeline
    // [i] field:0:optional $service.input
    // [o] record:0:optional $pipeline
    IDataCursor cursor = pipeline.getCursor();

    try {
      String file = IDataUtil.getString(cursor, "$file");
      String mode = IDataUtil.getString(cursor, "$mode");
      String service = IDataUtil.getString(cursor, "$service");
      String input = IDataUtil.getString(cursor, "$service.input");
      IData scope = IDataUtil.getIData(cursor, "$pipeline");
      boolean scoped = scope != null;

      scope = process(file, mode, service, input, scoped ? scope : pipeline);

      if (scoped) IDataUtil.put(cursor, "$pipeline", scope);
    } finally {
      cursor.destroy();
    }
    // --- <<IS-END>> ---

  }
Exemplo n.º 3
0
  public static final void merge(IData pipeline) throws ServiceException {
    // --- <<IS-START(merge)>> ---
    // @subtype unknown
    // @sigtype java 3.5
    // [i] record:0:optional $document
    IDataCursor cursor = pipeline.getCursor();

    try {
      merge(pipeline, IDataUtil.getIData(cursor, "$document"));
    } finally {
      cursor.destroy();
    }
    // --- <<IS-END>> ---

  }
Exemplo n.º 4
0
 protected IData extractIData(IData data, String key, boolean mandatory, IData defaultValue)
     throws ServiceOutputException {
   IDataCursor cur = data.getCursor();
   try {
     IData result = IDataUtil.getIData(cur, key);
     if (result == null) {
       result = defaultValue;
     }
     if (mandatory && result == null) {
       throw new ServiceOutputException(this, String.format("missing required IData in %s", key));
     }
     return result;
   } finally {
     cur.destroy();
   }
 }
Exemplo n.º 5
0
  public static final void remove(IData pipeline) throws ServiceException {
    // --- <<IS-START(remove)>> ---
    // @subtype unknown
    // @sigtype java 3.5
    // [i] record:0:optional $bizdoc
    // [i] - field:0:required InternalID
    // [i] field:0:optional $part
    IDataCursor cursor = pipeline.getCursor();

    try {
      IData bizdoc = IDataUtil.getIData(cursor, "$bizdoc");
      String partName = IDataUtil.getString(cursor, "$part");

      remove(bizdoc, partName);
    } finally {
      cursor.destroy();
    }
    // --- <<IS-END>> ---

  }