
package com.smartgwt.client.docs;

/**
 * <h3>Server-Side Process Execution</h3>
 * <b>Server-Side Process Execution</b> <P> {@link
 * com.smartgwt.client.docs.serverds.OperationBinding#process OperationBinding.process} allows a
 * declarative {@link com.smartgwt.client.util.workflow.Process} workflow to execute server-side
 * as an alternative to {@link com.smartgwt.client.docs.serverds.OperationBinding#script
 * OperationBinding.script} or a {@link com.smartgwt.client.docs.serverds.ServerObject DMI}.  The
 * workflow is defined in the same XML format used by the {@link
 * com.smartgwt.client.tools.WorkflowEditor}, making it visually editable by non-programmers. <P>
 * <b>When to Use Each Approach</b> <table border=1 cellpadding=4> <tr><th>Approach</th><th>Best
 * For</th><th>Editable?</th></tr> <tr><td><code>process</code></td>     <td>Multi-step
 * declarative logic: validate, branch, CRUD     across DataSources, send email</td>     <td>Yes
 * (WorkflowEditor)</td></tr> <tr><td><code>script</code></td>     <td>Imperative logic: complex
 * calculations, string     manipulation, calling Java APIs directly</td>     <td>Code
 * only</td></tr> <tr><td>DMI (serverObject)</td>     <td>Heavy Java logic: third-party library
 * integration,     complex transactions, performance-critical paths</td>     <td>Code
 * only</td></tr> </table> <P> <b>Input State</b> <P> The process receives automatic input state
 * from the DSRequest: <ul> <li><code>criteria</code>: Request criteria</li>
 * <li><code>values</code>: Request values (add/update)</li> <li><code>oldValues</code>: Previous
 * values (update)</li> <li><code>operationType</code>: "fetch", "add", "update", or    
 * "remove"</li> <li><code>dsName</code>: DataSource ID</li> <li><code>operationId</code>: The
 * operationBinding's     operationId</li> <li><code>auth.userId</code>: Authenticated user ID
 * (from     <code>DSRequest.getUserId()</code>)</li> <li><code>auth.roles</code>: User roles
 * (from     <code>DSRequest.getUserRoles()</code>)</li> </ul> These are available in {@link
 * com.smartgwt.client.docs.TaskInputExpression TaskInputExpressions} as <code>$criteria</code>,
 * <code>$values</code>, etc. <P> <b>ServerDynamicCriteria in Process Workflows</b> <P> {@link
 * com.smartgwt.client.util.workflow.DecisionTask} and {@link
 * com.smartgwt.client.util.workflow.MultiDecisionTask} criteria support the full
 * ServerDynamicCriteria syntax, including: <ul> <li><b>Authentication context</b>:    
 * <code>auth.userId</code>,     <code>auth.roles</code></li> <li><b>Request context</b>:    
 * <code>context.operationType</code>,     <code>context.operationId</code></li> <li><b>Relational
 * FK references</b>: dotted     <code><i>RelatedDS</i>.<i>fieldName</i></code>     references are
 * resolved automatically via the     foreign key chain defined in the DataSource.     For
 * example, if an Order DS has     <code>foreignKey="Customer.customerId"</code>,     a criterion
 * with     <code>fieldName="Customer.creditStatus"</code>     fetches the related Customer record
 * and checks     its <code>creditStatus</code> field</li> <li><b>Aggregation shorthand</b>:    
 * <code><i>ChildDS</i>.#count</code> and     <code><i>ChildDS</i>.<i>field</i>.#sum</code>    
 * compute aggregates over related child records.     For example, if an Order DS has child
 * LineItem     records linked by FK,     <code>LineItem.#count</code> resolves to the     number
 * of line items and     <code>LineItem.amount.#sum</code> resolves to     their total amount</li>
 * </ul> <P> <b>Output / Response</b> <P> The process produces a DSResponse via precedence: <ol>
 * <li>If <code>process.state.dsResponse</code> is set &rarr;     used directly</li> <li>Else,
 * output of last {@link com.smartgwt.client.util.workflow.DSRequestTask} that ran &rarr;     its
 * dsResponse.data</li> <li>Else &rarr; empty STATUS_SUCCESS</li> </ol> <P> <b>Error Handling</b>
 * <P> If any task fails and has no {@link
 * com.smartgwt.client.util.workflow.DSRequestTask#getFailureElement
 * DSRequestTask.failureElement}, the process aborts immediately and returns STATUS_FAILURE.  If
 * the operation participates in a transaction ({@link
 * com.smartgwt.client.data.OperationBinding#getAutoJoinTransactions
 * OperationBinding.autoJoinTransactions}), the transaction rolls back.  When
 * <code>autoJoinTransactions</code> is enabled, all {@link
 * com.smartgwt.client.util.workflow.DSRequestTask DS*Tasks} in the process (including {@link
 * com.smartgwt.client.util.workflow.DSAddTask}, {@link
 * com.smartgwt.client.util.workflow.DSUpdateTask}, {@link
 * com.smartgwt.client.util.workflow.DSRemoveTask}, and DefaultOperationTask) share the same
 * database connection, so they commit or roll back as a unit. <P> <b>Server-Side Task
 * Compatibility</b> <P> Compatible server-side tasks: DefaultOperationTask, {@link
 * com.smartgwt.client.util.workflow.DecisionTask}, {@link
 * com.smartgwt.client.util.workflow.MultiDecisionTask}, {@link
 * com.smartgwt.client.util.workflow.ScriptTask}, {@link
 * com.smartgwt.client.util.workflow.DSFetchTask}, {@link
 * com.smartgwt.client.util.workflow.DSAddTask}, {@link
 * com.smartgwt.client.util.workflow.DSUpdateTask}, {@link
 * com.smartgwt.client.util.workflow.DSRemoveTask}, {@link
 * com.smartgwt.client.util.workflow.StartProcessTask}, {@link
 * com.smartgwt.client.util.workflow.EndProcessTask}, {@link
 * com.smartgwt.client.util.workflow.StateTask}. <P> UI tasks (FormSetValuesTask, ShowHideTask,
 * GridFetchDataTask, etc.) are NOT available and will log a warning if encountered. <P>
 * <b>Performance</b> <P> Process execution uses server-side JavaScript context pooling.  First
 * invocation per pool slot incurs module loading overhead; subsequent invocations reuse the
 * pre-loaded context with near-zero overhead beyond the actual DataSource operations. <P>
 * <b>Example</b> <P> An Order DataSource with a foreign key to a Customer DataSource.  On add,
 * the process checks whether the customer's credit is approved (SDC relational FK reference) and
 * rejects if not.  If approved, a {@link com.smartgwt.client.util.workflow.ScriptTask} sets the
 * status and a DefaultOperationTask persists the record.
     * @see com.smartgwt.client.docs.serverds.OperationBinding#process
     * @see com.smartgwt.client.docs.serverds.OperationBinding#dataSources
     * @see com.smartgwt.client.docs.serverds.OperationBinding#contextFiles
     * @see com.smartgwt.client.docs.serverds.OperationBinding#script
     * @see com.smartgwt.client.util.workflow.DecisionTask
     * @see com.smartgwt.client.util.workflow.MultiDecisionTask
     * @see com.smartgwt.client.util.workflow.DSRequestTask
 * @see com.smartgwt.client.util.workflow.DSRequestTask
 * @see com.smartgwt.client.util.workflow.DSFetchTask
 * @see com.smartgwt.client.util.workflow.DSAddTask
 * @see com.smartgwt.client.util.workflow.DSUpdateTask
 * @see com.smartgwt.client.util.workflow.DSRemoveTask
 * @see com.smartgwt.client.util.workflow.ScriptTask
 * @see com.smartgwt.client.util.workflow.DecisionTask
 * @see com.smartgwt.client.util.workflow.MultiDecisionTask
 * @see com.smartgwt.client.util.workflow.StateTask
 * @see com.smartgwt.client.util.workflow.StartProcessTask
 * @see com.smartgwt.client.util.workflow.EndProcessTask
 * @see com.smartgwt.client.docs.serverds.OperationBinding#process
 * @see com.smartgwt.client.util.workflow.Process#getDataSources
 * @see com.smartgwt.client.util.workflow.ScriptTask#getLanguage
 * @see com.smartgwt.client.util.workflow.ScriptTask#getDataSources
 * @see com.smartgwt.client.tools.WorkflowEditor#getShowServerTasksOnly
 */
public interface ServerProcess {
}
