Methods

  1. Model

    The constructor creates a new Model object.

    public Model (String host,
                          String port)
    

    Parameters:

    • host - the location of KCM ComposerUI

    • port - the port that KCM ComposerUI listens to

  2. Letterbook

    Lists the models in a letterbook.

    public boolean Letterbook (String letterbook)
                throws Exception
    

    Parameters:

    • letterbook - the entry point of a Letterbook

      Returns:

      false if the function failed. In that case the Info file contains XML error data. If the function succeeds it returns true, and the Info file contains a list of Master Templates.

  3. List

    This method has been deprecated.

    Lists the Master Templates that the user, as indicated by the current set of properties, is allowed to access.

    public boolean List ()
                throws Exception
      public boolean List (String pattern)
                throws Exception
    

    Parameters:

    • pattern (optional) - the pattern to be passed to the ListModels exit point script.

      Returns:

      false if the function failed. In that case the Info file contains XML error data. If the function succeeds it returns true, and the Info file contains a list of Master Templates.

  4. Start

    The RunModel functionality is split in two method calls: Start and Continue. Start is always called first. Depending on the outcome of the previous call, zero or more Continue calls are needed.

    public int Start (String model,
                        String result,
                        String keys,
                        String extras)
                throws Exception
    
      public int Start (String model,
                        String result,
                        String keys,
                        String extras,
                        String preCMD,
                        String postCMD,
                        String onSuccessCMD,
                        String onFailureCMD)
                throws Exception
    

    Parameters:

    • Master Template: The Master Template to run, given as a rep:/ URI or a Letterbook URI.

    • Result: The URI of the file of the result. By default, this URI is a location relative to the user of the Java API itself. In that case, the API retrieves the document from KCM Core and stores it at this location. We recommend that the user ensures that the API is able to write at this location. Also, see the DocumentOnServer flag for alternative use.

      The value passed here can be retrieved as the DocumentURI property.

    • Keys: The keys string, in KCM Core format. There is no keys file support. A special "*DataURI" value refers to the XML file as indicated by the DataURI property. For Master Templates that need access to an XML file either this key and DataURI must be specified, or the actual path, relative to IKCM Core.

    • Extras: The extras string, in KCM Core format. There is no extras file support.

    • PreCMD: AS/400 only. The Pre command is executed after the library list is set.

      We recommend that the API user is aware that this Pre command is executed when the Master Template needs to get data from the database. If the Master Template is set up in such a way that interact statements follow on this data access, the pre command is executed the first time the data is accessed and every time the Continue call is called.

    • OnSuccessCMD - AS/400 only. The OnSuccess command is executed if the model is completed successfully.

    • OnFailureCMD - AS/400 only. The OnFailure command is executed if the model failed.

    • PostCMD - AS/400 only. The Post command is executed at the end of the run (after OnSuccess or OnFailure).

      We recommend that the API user is aware that this Post command is executed after every run of the Master Template. This means that the Post command is executed for the Start call and all of its Continue calls.

    Returns:

    • An enumeration type that indicates what this call returns. See the Types section.

  5. Continue

    If Start(), or another Continue() call is returned ModelResultInteract, and the user is prompted to provide answers to the interact questions, Continue() can be called to continue Master Template execution.

    public int Continue (String response,
                           String submission)
                    throws Exception
    

    Parameters:

    • Response: Contains a reference to a file with the answers to an KCM Master Template interact that is returned earlier.

    • Submission: The Submission parameter indicates what the user presses in the INTERACT screen. The possible values of this parameter are passed in the XML File that holds the INTERACT questions, which is element button.

    • Finish: This is called after a ModelResultReady result is returned to indicate that the user accepts the Master Template. KCM Core may use this as a clean-up signal. It is not mandatory that users call Finish.

      Calling Finish clears the session id.

      public boolean Finish ()
                      throws Exception
      
  6. Upload

    This method sends the file indicated by the filename argument to KCM Core. The file is stored under an automatically generated unique name in the session directory on the server. The server-side name is returned as the return value of this call as a "file:<name>" URI. The name is a relative path with respect to the session directory on the server. If the call fails, an empty string is returned and the info file contains additional error data.

    The stored files at least remain present at the server until Finish is called.

    Upload only works as long as a session id is present, such as between calls of Start and Finish.

    public String Upload (String filename)
                    throws Exception
    

    Parameters:

    • filename - name of the file to upload

      Returns:

      Local name on the server, empty string on error.