Retrieving Case Model Database Scripts

The BusinessDataServicesAdminService provides the operations that enable you to manually execute the case model database scripts.

The following diagram shows an example of the calls to the BusinessDataServicesAdminService to do this.

The following step-by-step descriptions correspond to the numbered steps above. Note that the descriptions are from a web service operation point of view, and provide an example of performing the operations using the web service API (SOAP).

Procedure

  1. Find out the case models that are deployed in TIBCO ActiveMatrix BPM by calling getCaseModelBasicInfo. If you do not specify an application name, all case models are returned.
    Note: You can bypass this step by using getCaseModel. If you do not specify an application name when executing getCaseModel, all the database scripts for TIBCO ActiveMatrix BPM are retrieved.

    The response returns information about the deployed case models. For example, case model ID and major version number.

    // Step 1 : Get a list of the case models available
    <soapenv:Body>
          <api:GetCaseModelBasicInfoRequest>
          </api:GetCaseModelBasicInfoRequest>
    </soapenv:Body>
    <SOAP-ENV:Body>
          <GetCaseModelBasicInfoResponse xmlns="http://api.bds.tibco.com">
             <caseModel xmlns="">
                <caseModelID>3</caseModelID>
                <appName>com.example.gddemo-2</appName>
                <majorVersion>2</majorVersion>
             </caseModel>
             <caseModel xmlns="">
                <caseModelID>4</caseModelID>
                <appName>com.example.xyzinsuranceBDSProject-1</appName>
                <majorVersion>1</majorVersion>
             </caseModel>
             <caseModel xmlns="">
                <caseModelID>5</caseModelID>
                <appName>com.example.claimmodel-1</appName>
                <majorVersion>1</majorVersion>
             </caseModel>
          </GetCaseModelBasicInfoResponse>
    </SOAP-ENV:Body>
  2. Use getCaseModel to retrieve the database scripts. Specify the name of the application whose scripts you want to retrieve. If you do not specify an application name, all the database scripts for TIBCO ActiveMatrix BPM are retrieved.

    The response returns:

    • the case model details. For example, appName, caseModelID and currentVersion.
    • the version number of the currently installed case model. If a case model is installed, it means all the database scripts have been run and case data may exist.
    • The last time the case model has been updated and the date and time that this occurred. After initial deployment, it shows the deployment time.
    • The CREATE database script. If the application has been updated, the UPDATE database script is also returned. If the case model is in the INSTALLED state, the DROP script is also returned.
    • Whether or not the case model is frozen and the operation details. For example, who performed the operation, when and why.
    • The case model’s state.
      // Step 2: Retrieve the database scripts
      <soapenv:Body>
            <api:GetCaseModelRequest>
               <appName>com.example.claimmodel-1</appName>
            </api:GetCaseModelRequest>
      </soapenv:Body>
      <SOAP-ENV:Body>
            <GetCaseModelResponse xmlns="http://api.bds.tibco.com">
               <caseModel xmlns="">
                  <caseModelID>1</caseModelID>
                  <appName>com.example.claimmodel-1</appName>
                  <currentVersion>1.0.0</currentVersion>
                  <datetimeDeploymentUpdated>2013-11-19T10:57:26.977Z</datetimeDeploymentUpdated>
                  <createScript>---------------------------------------- TIBCO HEADER ----------------------------------------
      -- BOM Name           : ClaimModel.bom
      -- BOM Namespace      : com.example.claimbom
      -- Namespace Tag      : CLAIMBOM
      -- BOM Major Version  : 1
      -- Table Mappings     : (BOM Class -> DB Table)
      --    com.example.claimbom.Claim                         BDS_1_CLAIMBOM_CLAIM
      --    com.example.claimbom.Person                        BDS_1_CLAIMBOM_PERSON
      --    com.example.claimbom.Policy                        BDS_1_CLAIMBOM_POLICY
      --    com.example.claimbom.Claimant                      BDS_1_CLAIMBOM_CLAIMANT
      --    com.example.claimbom.IncidentDetails               BDS_1_CLAIMBOM_INCIDENTDETAILS
      --    com.example.claimbom.CustomerNotes                 BDS_1_CLAIMBOM_CUSTOMERNOTES
      ----------------------------------------------------------------------------------------------
      create table [BDS_1_CLAIMBOM_CLAIMANT] ([BDS_ID] numeric(19,0) not null, [DTYPE] nvarchar(255) not null, [BDS_VERSION] numeric(19,0) null, [PARTY] nvarchar(255) null, [BDS_OWNER_ID] numeric(19,0) null, [CLAIM_CLAIMANTS_BDSID] numeric(19,0) null, [CLAIM_CLAIMANTS_IDX] int null, primary key ([BDS_ID]));
      .
      .
      .
      </createScript>
                  <frozenDetails isFrozen="false"/>
                  <state>PENDING_DBA_ACTION_TO_INSTALL</state>
               </caseModel>
            </GetCaseModelResponse>
      </SOAP-ENV:Body>
  3. (Optional) Use updateDBScripts to make any required changes to the database scripts.
    Note: Although editing the scripts is possible, TIBCO does not recommend this unless it is essential and there are only a few changes that you are allowed to make. See updateDBScripts .

    The response indicates success by returning the updateDBScriptsResponse.

    // Step 3: Update the database scripts
    <soapenv:Body>
          <api:UpdateDBScriptsRequest>
             <caseModelID>1</caseModelID>
    <updateScript>---------------------------------------- TIBCO HEADER ----------------------------------------
    -- BOM Name           : ClaimModel.bom
    -- BOM Namespace      : com.example.claimbom
    -- Namespace Tag      : CLAIMBOM
    -- BOM Major Version  : 1
    -- Table Mappings     : (BOM Class -> DB Table)
    --    com.example.claimbom.Claim                         BDS_1_CLAIMBOM_CLAIM
    --    com.example.claimbom.Person                        BDS_1_CLAIMBOM_PERSON
    --    com.example.claimbom.Policy                        BDS_1_CLAIMBOM_POLICY
    --    com.example.claimbom.Claimant                      BDS_1_CLAIMBOM_CLAIMANT
    --    com.example.claimbom.IncidentDetails               BDS_1_CLAIMBOM_INCIDENTDETAILS
    --    com.example.claimbom.CustomerNotes                 BDS_1_CLAIMBOM_CUSTOMERNOTES
    ----------------------------------------------------------------------------------------------
    alter table [BDS_1_CLAIMBOM_CLAIM] add [ATTRIBUTE1] nvarchar(400);</updateScript>
             <operationDetails >
             </operationDetails>
          </api:UpdateDBScriptsRequest>
    </soapenv:Body>
    <SOAP-ENV:Body>
          <UpdateDBScriptsResponse xmlns="http://api.bds.tibco.com"/>
    </SOAP-ENV:Body>
  4. Once you have verified your database scripts, you must manually execute them on your database to generate the case model database schema. Once the case model database schema has been generated, you must notify TIBCO ActiveMatrix BPM using notifyDDLExecution.

    The request must specify the caseModelID and a database script action. The database script actions specify which script has been executed. For example, UPDATE_SCRIPT_EXECUTED or DROP_SCRIPT_EXECUTED. The case model must be in the correct state for the database script action you want to perform. The following table describes the case model states and the database script actions you can perform.

    Case Model State Database Script Actions
    INITIAL None
    PENDING_DBA_TO_INSTALL
    • CREATE_SCRIPT_EXECUTED
    • UPDATE_SCRIPT_EXECUTED
    INSTALLED
    • FREEZE_CASE_DATA_MODEL
    • UNFREEZE_CASE_DATA_MODEL
    PENDING_DBA_UNINSTALL DROP_SCRIPT_EXECUTED
    FAILED_TO_UNINSTALL CLEANUP_COMPLETE
    DELETED None

    TIBCO ActiveMatrix BPM validates that the scripts have been run or provide the operation details about why the update was performed.

    The response indicates success by returning the notifyDDLExecutionResponse.

    // Step 4: Notify TIBCO ActiveMatrix BPM that the database scripts have been executed
    <soapenv:Body>
          <api:NotifyDDLExecutionRequest>
             <caseModelID>1</caseModelID>
             <databaseScriptAction>CREATE_SCRIPT_EXECUTED</databaseScriptAction>
          </api:NotifyDDLExecutionRequest>
    </soapenv:Body>
    <SOAP-ENV:Body>
          <NotifyDDLExecutionResponse xmlns="http://api.bds.tibco.com"/>
    </SOAP-ENV:Body>
  5. You can freeze case data models so that no further changes can be made to it. In other words, the case model cannot be upgraded or undeployed. This prevents another database administrator making any further changes to the case data model. To do this, use notifyDDLExecution.

    The response indicates success by returning the notifyDDLExecutionResponse.

    // Step 5: Notify TIBCO ActiveMatrix BPM that the Database
    <soapenv:Body>
          <api:NotifyDDLExecutionRequest>
             <caseModelID>1</caseModelID>
             <databaseScriptAction>FREEZE_CASE_DATA_MODEL</databaseScriptAction>
          </api:NotifyDDLExecutionRequest>
    </soapenv:Body>
    <SOAP-ENV:Body>
          <NotifyDDLExecutionResponse xmlns="http://api.bds.tibco.com"/>
    </SOAP-ENV:Body>