Class LocalTriggerManager.ScriptServerBean

  • All Implemented Interfaces:
    mks.ci.server.engine.IScriptServerBean, mks.frame.triggers.ScriptExposableBean
    Enclosing class:
    LocalTriggerManager

    public static class LocalTriggerManager.ScriptServerBean
    extends LocalTriggerManager.ScriptIMBaseBean
    implements mks.frame.triggers.ScriptExposableBean, mks.ci.server.engine.IScriptServerBean
    The imServerBean.

    Allows top level access to arbitrary issues.

    • Constructor Detail

      • ScriptServerBean

        public ScriptServerBean​(int userId,
                                java.sql.Connection c,
                                mks.ci.common.CISignature sig)
    • Method Detail

      • getConnection

        public java.sql.Connection getConnection()
        Specified by:
        getConnection in interface mks.ci.server.engine.IScriptServerBean
      • isScheduledTrigger

        public boolean isScheduledTrigger()
        Was the ultimate cause of this trigger running due to an end user, or a scheduled trigger?

        Why is this method required? At first glance, you might think you can just ask the environment bean to retrieve the event name, which indicates either an issue changed trigger, or a scheduled trigger. However, a scheduled trigger may make a modification to an issue, in which case an issue changed trigger will run. Sometimes it is necessary to know not that its an issue changed trigger, but whether the ultimate reason for this trigger is not an end user action, but a scheduled trigger.

      • isNodeOperation

        public boolean isNodeOperation()
        Was this trigger caused by an normal edit/create issue gesture, or was it created by a node operation in the document model? The document model will cause multiple issues to be modified for each end-user gesture. Note that triggers can cause normal issue edit operations to be performed, but if the originating operation was a node operation, then this will still be true.
      • isBatchEditItemsOperation

        public boolean isBatchEditItemsOperation()
        Was this trigger caused by batch edit items operation or a single item edit operation?
        Returns:
        true if this trigger is caused by batch item edit operation, otherwise false.
      • getProjectIDToIssueID

        public java.util.Map<java.lang.Integer,​java.lang.Integer> getProjectIDToIssueID()
        Returns:
        projectIDToIssueID Map of project-id to project-backing-issue-id
      • commit

        public void commit()
                    throws mks.frame.triggers.TriggerException,
                           java.sql.SQLException,
                           mks.ci.exception.CIException
        Commit the current list of modified issues. This may only be called from a scheduled trigger. If you are processing large numbers of issues, where each issue is independent of each other, and where the processing time is potentially large, then other users will be unable to edit the already fetched issues, until either your scheduled trigger completes or you invoke this method. Other users will either receive a message The issue was changed by another user after you began your edit, or will simply block waiting for your completion, depending on the database. The commit will cause all pre-triggers to immediately run, then perform a database commit; then run all the post-triggers before this function will complete. Note that if any pre trigger fails by throwing an exception, this function will fail as well, and the commit will not happen.
        Throws:
        mks.frame.triggers.TriggerException - if invoked from a non-scheduled trigger.
        java.sql.SQLException
        mks.ci.exception.CIException
      • getReturnValue

        public java.util.Map<java.lang.String,​java.lang.Object> getReturnValue()
        Get the map of return values that the IM trigger script has set
        Returns:
        Map of key-value pairs that the IM trigger has set as trigger return values
      • setInvocationArguments

        public void setInvocationArguments​(java.util.Map<java.lang.String,​java.lang.Object> invocationArguments)
        Set the trigger invocation arguments. Invocation arguments are a map of key-value pairs that the trigger script can access.
        Parameters:
        invocationArguments - Map of trigger invocation arguments
      • setReturnValue

        public void setReturnValue​(ScriptParametersBean returnValue)
                            throws mks.frame.triggers.TriggerException
        Set the trigger return values that can be used by the callers (usually SI scripts).
        Parameters:
        returnValue - an instance of ScriptParametersBean with return values set on the instance
        Throws:
        mks.frame.triggers.TriggerException
      • getInvocationArguments

        public ScriptParametersBean getInvocationArguments()
        Create an instance of ScriptParametersBean containing invocation arguments passed to this trigger. These arguments are different than the trigger static configuration arguments and unlike static parameters set by the administrator when the trigger was created, these arguments can vary with each invocation of the trigger script.
        Returns:
        an instance of ScriptParametersBean containing the invocation arguments that the trigger was invoked with.
      • getTransactionContext

        public java.util.Map<java.lang.String,​java.lang.String> getTransactionContext()
                                                                                     throws mks.frame.triggers.TriggerException
        Returns a map that can be used for the duration of the transaction by all trigger API clients. Any client can read or write lookup values using this map. One possible use is to communicate between scripts involved in the same transaction.
        Returns:
        Map<String, String>
        Throws:
        mks.frame.triggers.TriggerException
      • setExitCode

        public void setExitCode​(int exitCode)
        Set the script exit code. Exit code 0 indicated successful completion any other exit code indicates an error. If no exit code is set, it is assumed that the script executed successfully.
        Parameters:
        exitCode - script exit code
      • getExitCode

        public int getExitCode()
        Get the script exit code
        Returns:
        the exit code set by the trigger script
      • getReturnValueBean

        public ScriptParametersBean getReturnValueBean()
        Get an instance of the parametersBean on which to set the trigger return values. Return values are used by the callers of this trigger (usually SI trigger scripts). Note, if no return values are set, and the callers expect them, the callers will get exceptions when they attempt to read the return values.
        Returns:
        an instance of ScriptParametersBean on which to set the trigger return values.
      • getIssueBean

        public LocalTriggerManager.ScriptIssueBean getIssueBean​(int i)
                                                         throws mks.frame.triggers.TriggerException
        Retrieve an arbitrary issue, using the issue number.
        Returns:
        an imIssueBean object for the issue.
        Throws:
        mks.frame.triggers.TriggerException
      • getIssueBean

        public LocalTriggerManager.ScriptIssueBean getIssueBean​(int id,
                                                                java.lang.Object[] fields)
                                                         throws mks.frame.triggers.TriggerException
        Retrieve an issue bean. For performance purposes, exactly the list of fields specified is retrieved. There are no permissions checks made.

        The resulting bean will retrieve only the specified fields. The result of retrieving any other field is undefined. Issue information retrieved via this method, or the getIssueBean method are not cached, and always go to the database to retrieve the information. This call will retrieve all the information for all the fields in one database SELECT statement.

        Arrays in javascript may be specified with values inside square brackets ([]). Example:

         var sb = bsf.lookupBean("imServerBean");
         var state = sb.getStateFieldBean();
         var assigneduser = sb.getAssignedUserFieldBean();
         var bean = sb.getIssueBean(100, [ state, assigneduser, "Due Date" ]);
         
        Parameters:
        id - The issue id number
        fields - An array of fields. Each entry in the array can be either the name of a field as a string, or a field bean, which allows retrieving internal fields without knowing their names which may have been changed at a particular site.
        Throws:
        mks.frame.triggers.TriggerException -
        • If the issue does not exist
        • If any field is not found
      • getIssueBeans

        public LocalTriggerManager.ScriptIssueBean[] getIssueBeans​(int[] ids,
                                                                   java.lang.Object[] fields)
                                                            throws mks.frame.triggers.TriggerException
        Retrieve an array of issue beans. For performance purposes, exactly the list of fields specified is retrieved. There are no permissions checks made.

        The resulting beans will retrieve only the specified fields. The result of retrieving any other field is undefined. Issue information retrieved via this method, or the getIssueBean method are not cached, and always go to the database to retrieve the information. This call will retrieve all the information for all the fields in one database SELECT statement.

        Arrays in javascript may be specified with values inside square brackets ([]). Example:

         var sb = bsf.lookupBean("imServerBean");
         var state = sb.getStateFieldBean();
         var assigneduser = sb.getAssignedUserFieldBean();
         var beans = sb.getIssueBeans([ 100, childID, parentID, 200 ],
             [ state, assigneduser, "Due Date" ]);
         
        Parameters:
        ids - An integer array of issue id numbers
        fields - An array of fields. Each entry in the array can be either the name of a field as a string, or a field bean, which allows retrieving internal fields without knowing their names which may have been changed at a particular site.
        Returns:
        An array of ScriptIssueBean objects representing requested issues. Note that the array returned is not guaranteed to be in the same order in which it was requested. Also, if the ids parameter contains duplicate issue IDs, the return value will only contain one ScriptIssueBean object per issue ID.
        Throws:
        mks.frame.triggers.TriggerException -
        • If any issue does not exist
        • If any field is not found
      • getIssueDeltaBean

        public LocalTriggerManager.ScriptIssueDeltaBean getIssueDeltaBean​(int i)
                                                                   throws mks.frame.triggers.TriggerException
        Retrieve an arbitrary issue, using the issue number. This version retrieves the issue for modification.

        You may only invoke this method during an issue edit pre trigger, or during a scheduled trigger. It may not be called from any other trigger type.

        Specified by:
        getIssueDeltaBean in interface mks.ci.server.engine.IScriptServerBean
        Returns:
        an imIssueDeltaBean object for the issue.
        Throws:
        mks.frame.triggers.TriggerException -
        • If called from the post trigger
        • If the requested issue has already been obtained in this transaction, and has already run its pre event triggger.
        • If this is not a scheduled trigger, or an issue edit trigger.
        • If the requested issue is a shared item in the document model.
      • addIssueDeltaBean

        public void addIssueDeltaBean​(int issueID)
                               throws mks.frame.triggers.TriggerException
        Description copied from interface: mks.ci.server.engine.IScriptServerBean
        Add the IssueDeltaBean to the ScriptServerBean if it is not already there.
        Specified by:
        addIssueDeltaBean in interface mks.ci.server.engine.IScriptServerBean
        Throws:
        mks.frame.triggers.TriggerException
      • getNewSecondaryIssuesInThread

        public java.util.List<java.lang.Integer> getNewSecondaryIssuesInThread()
      • postNewIssue

        public LocalTriggerManager.ScriptIssueDeltaBean postNewIssue​(java.lang.String type)
                                                              throws mks.frame.triggers.TriggerException
        Create a new issue. Must be given the issue type.
        Returns:
        an imIssueDeltaBean object that can be updated to fill in the various fields for the new issue. Certain fields must be filled in for a valid issue.
        Throws:
        mks.frame.triggers.TriggerException -
        • If called from test result change trigger
        • If called from the post trigger
        • If called recursively: you are not permitted to create a new issue from the pre event trigger of an issue that is itself being created from a pre event trigger. The purpose of this restriction is to avoid scripting errors which cause recursive issue creation which would effectively bring down the server.
      • getInitialState

        public java.lang.String getInitialState​(java.lang.String type)
                                         throws mks.frame.triggers.TriggerException
        Given a type name, return the initial state. If the initial state is not specified, then the string "Unspecified" is returned.
        Throws:
        mks.frame.triggers.TriggerException
      • addModifiedTypeForIssueID

        public void addModifiedTypeForIssueID​(int typeID,
                                              int issueID)
        Description copied from interface: mks.ci.server.engine.IScriptServerBean
        Add the itemID to a map that will be used to update the field cache for IBPL fields.
        Specified by:
        addModifiedTypeForIssueID in interface mks.ci.server.engine.IScriptServerBean
      • getIssueDeltaBeans

        public java.util.Collection<mks.ci.server.engine.IScriptIssueDeltaBean> getIssueDeltaBeans()
        Description copied from interface: mks.ci.server.engine.IScriptServerBean
        Get all the IssueDeltaBeans available in the Server Bean
        Specified by:
        getIssueDeltaBeans in interface mks.ci.server.engine.IScriptServerBean
      • getUsers

        public java.lang.String[] getUsers()
        Return an array of all the user names in the system.
      • getGroups

        public java.lang.String[] getGroups()
        Return an array of all the group names in the system.
      • getDynamicGroups

        public java.lang.String[] getDynamicGroups()
        Return an array of all the dynamic group names in the system.
      • getProjects

        public java.lang.String[] getProjects()
        Return an array of all the project names in the system.
      • getProjectIssue

        public int getProjectIssue​(java.lang.String projectName)
                            throws mks.frame.triggers.TriggerException
        Retrieves the issue that backs the specified project
        Parameters:
        projectName - The name of the project.
        Returns:
        The id of the issue that backs the project or -1 if there is no issue backing the project
        Throws:
        mks.frame.triggers.TriggerException - if the project cannot be found
      • getStates

        public java.lang.String[] getStates()
        Return an array of all the state names in the system.
      • getTypes

        public java.lang.String[] getTypes()
        Return an array of all the type names in the system.
      • getFields

        public java.lang.String[] getFields()
        Return an array of all the field names in the system.
        Returns:
        An array of all item and test result field names.
      • getQueries

        public LocalTriggerManager.ScriptQueryBean[] getQueries()
                                                         throws mks.frame.triggers.TriggerException
        Return an array of all the queries accessible by this user. Each entry in the list is a imQueryBean
        Throws:
        mks.frame.triggers.TriggerException
      • getQuery

        public LocalTriggerManager.ScriptQueryBean getQuery​(java.lang.String name)
                                                     throws mks.frame.triggers.TriggerException
        Retrieve the imQueryBean for a named query.
        Returns:
        the appropriate query bean
        Throws:
        mks.frame.triggers.TriggerException - if the named query is not found
      • getQuery

        public LocalTriggerManager.ScriptQueryBean getQuery​(java.lang.String user,
                                                            java.lang.String name)
                                                     throws mks.frame.triggers.TriggerException
        Retrieve the imQueryBean for a named query as the specified user.
        Returns:
        the appropriate query bean
        Throws:
        mks.frame.triggers.TriggerException - if the named query is not found
      • getChangePackageTypeBean

        public LocalTriggerManager.ScriptChangePackageTypeBean getChangePackageTypeBean​(java.lang.String name)
                                                                                 throws mks.frame.triggers.TriggerException
        Retrieve the imChangePackageBean for the named change package type.
        Parameters:
        name - The real name of the change package type.
        Returns:
        The appropriate change package type bean.
        Throws:
        mks.frame.triggers.TriggerException - If the named change package type does not exist.
      • getAgentBean

        public LocalTriggerManager.ScriptAgentBean getAgentBean​(java.lang.String agentHostname,
                                                                int agentPort,
                                                                java.lang.String agentUser,
                                                                java.lang.String agentPassword)
                                                         throws mks.frame.triggers.TriggerException
        Retrieve an imAgentBean that provides access to services on the specified Agent.
        Parameters:
        agentHostname - The DNS hostname or IP address of the Agent.
        agentPort - The TCP/IP port number of the Agent.
        agentUser - The username to connect to the Agent.
        agentPassword - The password to connect to the Agent.
        Returns:
        The appropriate Agent bean.
        Throws:
        mks.frame.triggers.TriggerException - Reserved exception.
        Since:
        Integrity Solution 2009
      • getFieldBean

        public LocalTriggerManager.ScriptFieldBean getFieldBean​(java.lang.String field)
                                                         throws mks.frame.triggers.TriggerException
        Retrieve an imFieldBean that describes the specified field.
        Returns:
        the appropriate field bean.
        Throws:
        mks.frame.triggers.TriggerException - if the named field does not exist.
      • getModifiedDateFieldBean

        public LocalTriggerManager.ScriptFieldBean getModifiedDateFieldBean()
                                                                     throws mks.frame.triggers.TriggerException
        Retrieve a imFieldBean for the Modified Date field.
        Throws:
        mks.frame.triggers.TriggerException
      • getCreatedDateFieldBean

        public LocalTriggerManager.ScriptFieldBean getCreatedDateFieldBean()
                                                                    throws mks.frame.triggers.TriggerException
        Retrieve a imFieldBean for the Created Date field.
        Throws:
        mks.frame.triggers.TriggerException
      • getCreatedUserFieldBean

        public LocalTriggerManager.ScriptFieldBean getCreatedUserFieldBean()
                                                                    throws mks.frame.triggers.TriggerException
        Retrieve a imFieldBean for the Created User field.
        Throws:
        mks.frame.triggers.TriggerException
      • getModifiedUserFieldBean

        public LocalTriggerManager.ScriptFieldBean getModifiedUserFieldBean()
                                                                     throws mks.frame.triggers.TriggerException
        Retrieve a imFieldBean for the Modified User field.
        Throws:
        mks.frame.triggers.TriggerException
      • getIDFieldBean

        public LocalTriggerManager.ScriptFieldBean getIDFieldBean()
                                                           throws mks.frame.triggers.TriggerException
        Retrieve a imFieldBean for the ID field.
        Throws:
        mks.frame.triggers.TriggerException
      • getAssignedGroupFieldBean

        public LocalTriggerManager.ScriptFieldBean getAssignedGroupFieldBean()
                                                                      throws mks.frame.triggers.TriggerException
        Retrieve a imFieldBean for the Assigned Group field.
        Throws:
        mks.frame.triggers.TriggerException
      • getAssignedUserFieldBean

        public LocalTriggerManager.ScriptFieldBean getAssignedUserFieldBean()
                                                                     throws mks.frame.triggers.TriggerException
        Retrieve a imFieldBean for the Assigned User field.
        Throws:
        mks.frame.triggers.TriggerException
      • getProjectFieldBean

        public LocalTriggerManager.ScriptFieldBean getProjectFieldBean()
                                                                throws mks.frame.triggers.TriggerException
        Retrieve a imFieldBean for the Project field.
        Throws:
        mks.frame.triggers.TriggerException
      • getStateFieldBean

        public LocalTriggerManager.ScriptFieldBean getStateFieldBean()
                                                              throws mks.frame.triggers.TriggerException
        Retrieve a imFieldBean for the State field.
        Throws:
        mks.frame.triggers.TriggerException
      • getSynopsisFieldBean

        public LocalTriggerManager.ScriptFieldBean getSynopsisFieldBean()
                                                                 throws mks.frame.triggers.TriggerException
        Retrieve a imFieldBean for the Synopsis field.
        Throws:
        mks.frame.triggers.TriggerException
      • getTypeFieldBean

        public LocalTriggerManager.ScriptFieldBean getTypeFieldBean()
                                                             throws mks.frame.triggers.TriggerException
        Retrieve a imFieldBean for the Type field.
        Throws:
        mks.frame.triggers.TriggerException
      • getForwardRelationshipsFieldBean

        public LocalTriggerManager.ScriptFieldBean getForwardRelationshipsFieldBean()
                                                                             throws mks.frame.triggers.TriggerException
        Retrieve a imFieldBean for the Forward Relationships field.
        Throws:
        mks.frame.triggers.TriggerException
      • getBackwardRelationshipsFieldBean

        public LocalTriggerManager.ScriptFieldBean getBackwardRelationshipsFieldBean()
                                                                              throws mks.frame.triggers.TriggerException
        Retrieve a imFieldBean for the Backward Relationships field.
        Throws:
        mks.frame.triggers.TriggerException
      • getAttachmentsFieldBean

        public LocalTriggerManager.ScriptFieldBean getAttachmentsFieldBean()
                                                                    throws mks.frame.triggers.TriggerException
        Retrieve a imFieldBean for the Attachments field.
        Throws:
        mks.frame.triggers.TriggerException
      • getContainsFieldBean

        public LocalTriggerManager.ScriptFieldBean getContainsFieldBean()
                                                                 throws mks.frame.triggers.TriggerException
        Retrieve a imFieldBean for the Contains field.
        Throws:
        mks.frame.triggers.TriggerException
      • getContainedByFieldBean

        public LocalTriggerManager.ScriptFieldBean getContainedByFieldBean()
                                                                    throws mks.frame.triggers.TriggerException
        Retrieve a imFieldBean for the Contained By field.
        Throws:
        mks.frame.triggers.TriggerException
      • getReferencesFieldBean

        public LocalTriggerManager.ScriptFieldBean getReferencesFieldBean()
                                                                   throws mks.frame.triggers.TriggerException
        Retrieve a imFieldBean for the References field.
        Throws:
        mks.frame.triggers.TriggerException
      • getReferencedByFieldBean

        public LocalTriggerManager.ScriptFieldBean getReferencedByFieldBean()
                                                                     throws mks.frame.triggers.TriggerException
        Retrieve a imFieldBean for the Referenced By field.
        Throws:
        mks.frame.triggers.TriggerException
      • getReferenceModeFieldBean

        public LocalTriggerManager.ScriptFieldBean getReferenceModeFieldBean()
                                                                      throws mks.frame.triggers.TriggerException
        Retrieve a imFieldBean for the Reference Mode field.
        Throws:
        mks.frame.triggers.TriggerException
      • getRootIDFieldBean

        public LocalTriggerManager.ScriptFieldBean getRootIDFieldBean()
                                                               throws mks.frame.triggers.TriggerException
        Retrieve a imFieldBean for the Root ID field.
        Throws:
        mks.frame.triggers.TriggerException
      • getInputRevisionDateFieldBean

        public LocalTriggerManager.ScriptFieldBean getInputRevisionDateFieldBean()
                                                                          throws mks.frame.triggers.TriggerException
        Retrieve a imFieldBean for the Item Significant Edit Date field. Use the getItemSignificantEditDateField() call, this is for backwards compatibility only.
        Throws:
        mks.frame.triggers.TriggerException
      • getItemSignificantEditDateField

        public LocalTriggerManager.ScriptFieldBean getItemSignificantEditDateField()
                                                                            throws mks.frame.triggers.TriggerException
        Retrieve a imFieldBean for the Item Significant Edit Date field. This field was previously known as Input Revision Date.
        Throws:
        mks.frame.triggers.TriggerException
      • getDocumentIDFieldBean

        public LocalTriggerManager.ScriptFieldBean getDocumentIDFieldBean()
                                                                   throws mks.frame.triggers.TriggerException
        Retrieve a imFieldBean for the Document ID field.
        Throws:
        mks.frame.triggers.TriggerException
      • getDocumentNameFieldBean

        public LocalTriggerManager.ScriptFieldBean getDocumentNameFieldBean()
                                                                     throws mks.frame.triggers.TriggerException
        Retrieve a imFieldBean for the Document Name field.
        Throws:
        mks.frame.triggers.TriggerException
      • getReferencedTypeFieldBean

        public LocalTriggerManager.ScriptFieldBean getReferencedTypeFieldBean()
                                                                       throws mks.frame.triggers.TriggerException
        Retrieve a imFieldBean for the Referenced Type field.
        Throws:
        mks.frame.triggers.TriggerException
      • getTestsFieldBean

        public LocalTriggerManager.ScriptFieldBean getTestsFieldBean()
                                                              throws mks.frame.triggers.TriggerException
        Retrieve a imFieldBean for the Tests field.
        Throws:
        mks.frame.triggers.TriggerException
      • getTestsForFieldBean

        public LocalTriggerManager.ScriptFieldBean getTestsForFieldBean()
                                                                 throws mks.frame.triggers.TriggerException
        Retrieve a imFieldBean for the Tests For field.
        Throws:
        mks.frame.triggers.TriggerException
      • getTestStepsFieldBean

        public LocalTriggerManager.ScriptFieldBean getTestStepsFieldBean()
                                                                  throws mks.frame.triggers.TriggerException
        Retrieve a imFieldBean for the Test Steps field.
        Throws:
        mks.frame.triggers.TriggerException
      • getSharedTestStepsFieldBean

        public LocalTriggerManager.ScriptFieldBean getSharedTestStepsFieldBean()
                                                                        throws mks.frame.triggers.TriggerException
        Retrieve a imFieldBean for the Shared Test Steps field.
        Throws:
        mks.frame.triggers.TriggerException
      • getTestCasesFieldBean

        public LocalTriggerManager.ScriptFieldBean getTestCasesFieldBean()
                                                                  throws mks.frame.triggers.TriggerException
        Retrieve a imFieldBean for the Test Cases field.
        Throws:
        mks.frame.triggers.TriggerException
      • getTestsAsOfDateFieldBean

        public LocalTriggerManager.ScriptFieldBean getTestsAsOfDateFieldBean()
                                                                      throws mks.frame.triggers.TriggerException
        Retrieve a imFieldBean for the Test As Of Date field.
        Throws:
        mks.frame.triggers.TriggerException
      • getCategoryFieldBean

        public LocalTriggerManager.ScriptFieldBean getCategoryFieldBean()
                                                                 throws mks.frame.triggers.TriggerException
        Retrieve a imFieldBean for the Category field.
        Throws:
        mks.frame.triggers.TriggerException
      • getSharedCategoryFieldBean

        public LocalTriggerManager.ScriptFieldBean getSharedCategoryFieldBean()
                                                                       throws mks.frame.triggers.TriggerException
        Retrieve a imFieldBean for the Shared Category field.
        Throws:
        mks.frame.triggers.TriggerException
      • getSharesFieldBean

        public LocalTriggerManager.ScriptFieldBean getSharesFieldBean()
                                                               throws mks.frame.triggers.TriggerException
        Retrieve a imFieldBean for the Shares field.
        Throws:
        mks.frame.triggers.TriggerException
      • getSharedByFieldBean

        public LocalTriggerManager.ScriptFieldBean getSharedByFieldBean()
                                                                 throws mks.frame.triggers.TriggerException
        Retrieve a imFieldBean for the Share By field.
        Throws:
        mks.frame.triggers.TriggerException
      • getBookmarksField

        public LocalTriggerManager.ScriptFieldBean getBookmarksField()
                                                              throws mks.frame.triggers.TriggerException
        Retrieve a imFieldBean for the Bookmarks field
        Throws:
        mks.frame.triggers.TriggerException
      • getReferencedBookmarksField

        public LocalTriggerManager.ScriptFieldBean getReferencedBookmarksField()
                                                                        throws mks.frame.triggers.TriggerException
        Retrieve a imFieldBean for the Referenced Bookmarks field
        Throws:
        mks.frame.triggers.TriggerException
      • getRevisionField

        public LocalTriggerManager.ScriptFieldBean getRevisionField()
                                                             throws mks.frame.triggers.TriggerException
        Retrieve a imFieldBean for the Revision field
        Throws:
        mks.frame.triggers.TriggerException
      • getRevisionDateField

        public LocalTriggerManager.ScriptFieldBean getRevisionDateField()
                                                                 throws mks.frame.triggers.TriggerException
        Retrieve a imFieldBean for the Revision Date field
        Throws:
        mks.frame.triggers.TriggerException
      • getSignificantEditDateField

        public LocalTriggerManager.ScriptFieldBean getSignificantEditDateField()
                                                                        throws mks.frame.triggers.TriggerException
        Retrieve a imFieldBean for the Significant Edit Date field
        Throws:
        mks.frame.triggers.TriggerException
      • getDeltaField

        public LocalTriggerManager.ScriptFieldBean getDeltaField()
                                                          throws mks.frame.triggers.TriggerException
        Retrieve a imFieldBean for the Significant Change Since Item Revision field
        Throws:
        mks.frame.triggers.TriggerException
      • getReviewSessionsField

        public LocalTriggerManager.ScriptFieldBean getReviewSessionsField()
                                                                   throws mks.frame.triggers.TriggerException
        Retrieve a imFieldBean for the Review Sessions field
        Throws:
        mks.frame.triggers.TriggerException
      • getReviewSessionForField

        public LocalTriggerManager.ScriptFieldBean getReviewSessionForField()
                                                                     throws mks.frame.triggers.TriggerException
        Retrieve a imFieldBean for the Review Session For field
        Throws:
        mks.frame.triggers.TriggerException
      • getCommentTextField

        public LocalTriggerManager.ScriptFieldBean getCommentTextField()
                                                                throws mks.frame.triggers.TriggerException
        Retrieve a imFieldBean for the Comment Text field
        Throws:
        mks.frame.triggers.TriggerException
      • getInSessionField

        public LocalTriggerManager.ScriptFieldBean getInSessionField()
                                                              throws mks.frame.triggers.TriggerException
        Retrieve a imFieldBean for the In Session field
        Throws:
        mks.frame.triggers.TriggerException
      • getCommentForField

        public LocalTriggerManager.ScriptFieldBean getCommentForField()
                                                               throws mks.frame.triggers.TriggerException
        Retrieve a imFieldBean for the Comment For field
        Throws:
        mks.frame.triggers.TriggerException
      • getIsApprovalCommentField

        public LocalTriggerManager.ScriptFieldBean getIsApprovalCommentField()
                                                                      throws mks.frame.triggers.TriggerException
        Retrieve a imFieldBean for the Is Approval Comment field
        Throws:
        mks.frame.triggers.TriggerException
      • getLiveItemIDFieldBean

        public LocalTriggerManager.ScriptFieldBean getLiveItemIDFieldBean()
                                                                   throws mks.frame.triggers.TriggerException
        Retrieve a imFieldBean for the Live Item ID field
        Throws:
        mks.frame.triggers.TriggerException
      • getMajorVersionIDFieldBean

        public LocalTriggerManager.ScriptFieldBean getMajorVersionIDFieldBean()
                                                                       throws mks.frame.triggers.TriggerException
        Retrieve a imFieldBean for the Major Version ID field
        Throws:
        mks.frame.triggers.TriggerException
      • getMinorVersionIDFieldBean

        public LocalTriggerManager.ScriptFieldBean getMinorVersionIDFieldBean()
                                                                       throws mks.frame.triggers.TriggerException
        Retrieve a imFieldBean for the Minor Version ID field
        Throws:
        mks.frame.triggers.TriggerException
      • getCustomFieldsFieldBean

        public LocalTriggerManager.ScriptFieldBean getCustomFieldsFieldBean()
                                                                     throws mks.frame.triggers.TriggerException
        Retrieve a imFieldBean for the Custom Fields field
        Throws:
        mks.frame.triggers.TriggerException
      • getCustomFieldValuesFieldBean

        public LocalTriggerManager.ScriptFieldBean getCustomFieldValuesFieldBean()
                                                                          throws mks.frame.triggers.TriggerException
        Retrieve a imFieldBean for the Custom Field Values field
        Throws:
        mks.frame.triggers.TriggerException
      • getVersionsFieldBean

        public LocalTriggerManager.ScriptFieldBean getVersionsFieldBean()
                                                                 throws mks.frame.triggers.TriggerException
        Retrieve a imFieldBean for the Versions field
        Throws:
        mks.frame.triggers.TriggerException
      • getVersionDescriptionFieldBean

        public LocalTriggerManager.ScriptFieldBean getVersionDescriptionFieldBean()
                                                                           throws mks.frame.triggers.TriggerException
        Retrieve a imFieldBean for the Version Description field
        Throws:
        mks.frame.triggers.TriggerException
      • getInDocumentsFieldBean

        public LocalTriggerManager.ScriptFieldBean getInDocumentsFieldBean()
                                                                    throws mks.frame.triggers.TriggerException
        Retrieve a imFieldBean for the In Documents field
        Throws:
        mks.frame.triggers.TriggerException
      • getGroupBean

        public LocalTriggerManager.ScriptGroupBean getGroupBean​(java.lang.String group)
        Retrieve the ScriptGroupBean for a static group
        Parameters:
        group - the group name
        Returns:
        the ScriptGroupBean or nullif the group doesn't exist
      • getUserBean

        public LocalTriggerManager.ScriptUserBean getUserBean​(java.lang.String user)
        Retrieve the ScriptUserBean for a user
        Parameters:
        user - the user's userid
        Returns:
        the ScriptUserBean or nullif the user doesn't exist
      • getDynamicGroupBean

        public LocalTriggerManager.ScriptDynamicGroupBean getDynamicGroupBean​(java.lang.String dynamicGroup)
        Retrieve the ScriptDynamicGroupBean for a dynamic group
        Parameters:
        dynamicGroup - the dynamic group's dynamicGroupId
        Returns:
        the ScriptDynamicGroupBean or nullif the dynamic group doesn't exist
      • getTypeBean

        public LocalTriggerManager.ScriptTypeBean getTypeBean​(java.lang.String typeName)
        Retrieve the ScriptTypeBean for a type.
        Parameters:
        typeName - the name of the type
        Returns:
        the ScriptTypeBean or null if the type doesn't exist
      • getTestVerdictBean

        public LocalTriggerManager.ScriptTestVerdictBean getTestVerdictBean​(java.lang.String testVerdictName)
        Retrieve the ScriptTestVerdictBean for a test verdict.
        Parameters:
        testVerdictName - the name of the test verdict
        Returns:
        the ScriptTestVerdictBean or null if the test verdict doesn't exist
      • getTestVerdicts

        public java.lang.String[] getTestVerdicts()
        Return an array of all the test verdict names in the system.
      • getVerdictTypes

        public java.lang.String[] getVerdictTypes()
        Return an array of all the verdict types in the system.
      • isSigned

        public boolean isSigned()
        Was a signature provided by the client for this issue modification?
        Returns:
        true if the issue delta was signed whether or not it was authenticated as valid. You must call isSignatureFailure() if this method returns true to determine if the authentication was successful. Correct invocation methodology: if (!serverBean.isSigned()) serverBean.signatureRequired(reason) else if (serverBean.isSignatureFailure()) environmentBean.abortScript(reason, true)
      • getSigner

        public java.lang.String getSigner()
                                   throws mks.frame.triggers.TriggerException
        If isSigned() is true, return the name of the signer. If isSignatureFailure() is true the returned name is not necessarily valid and is whatever was provided by the client. This method should not be called if isSigned() is false; an exception will be thrown.
        Throws:
        mks.frame.triggers.TriggerException - if isSigned() is false
      • getSignatureComment

        public java.lang.String getSignatureComment()
                                             throws mks.frame.triggers.TriggerException
        Return the comment string associated with the signature. A zero length string may be returned if there is no comment This method should not be called if isSigned() is false; an exception will be thrown.
        Throws:
        mks.frame.triggers.TriggerException - if isSigned() is false
      • isSignatureFailure

        public boolean isSignatureFailure()
                                   throws mks.frame.triggers.TriggerException
        If isSigned() is true, return indicating if the signature authenticated correctly. This method should not be called if isSigned() is false; an exception will be thrown.
        Returns:
        true on authentication failure; false on success
        Throws:
        mks.frame.triggers.TriggerException - if isSigned() is false
      • signatureRequired

        public void signatureRequired​(java.lang.String comment)
                               throws mks.frame.triggers.TriggerException
        Indicate that this delta requires a signature. Further triggers will not run, the transaction will be aborted and the client will be prompted for a new Signer and Signature Comment. Note that you can use this method even if isSigned() is already true; for example the user that tried to sign may not have been correctly authenticated, or may not be on the list of approvers. The comment string is incorporated into the message to the end user requesting the signature. It may be null or zero length.
        Throws:
        mks.frame.triggers.TriggerException - always
      • addLabel

        public void addLabel​(int issueID,
                             java.lang.String label,
                             boolean move)
                      throws mks.frame.triggers.TriggerException
        Add a label to the specified issue against the current time. If there are applicable label triggers, then the label PRE triggers will be run immediately, before this function returns. The label POST triggers will be run after the completion of all the issue edit POST triggers.
        Parameters:
        issueID - The issue number
        label - The label
        move - A boolean value indicating the action to take if the label already exists.
        Throws:
        mks.frame.triggers.TriggerException -
        • If the label already exists, and the move parameter is false.
        • If move is false, and the Add Label rule evaluates to false.
        • If move is true, and the Delete Label rule evaluates to false.
      • addLabel

        public void addLabel​(int issueID,
                             java.lang.String label)
                      throws mks.frame.triggers.TriggerException
        Add a label to the specified issue against the current time. If there are applicable label triggers, then the label PRE triggers will be run immediately, before this function returns. The label POST triggers will be run after the completion of all the issue edit POST triggers.
        Parameters:
        issueID - The issue number
        label - The label
        Throws:
        mks.frame.triggers.TriggerException -
        • If the label already exists
        • If the Add Label rule evaluates to false.
      • addLabel

        public void addLabel​(int issueID,
                             java.lang.String label,
                             java.lang.String comment)
                      throws mks.frame.triggers.TriggerException
        Add a label to the specified issue against the current time. If there are applicable label triggers, then the label PRE triggers will be run immediately, before this function returns. The label POST triggers will be run after the completion of all the issue edit POST triggers.
        Parameters:
        issueID - The issue number
        label - The label
        comment - The comment for the label
        Throws:
        mks.frame.triggers.TriggerException -
        • If the label already exists
        • If the Add Label rule evaluates to false.
      • addLabel

        public void addLabel​(int issueID,
                             java.lang.String label,
                             java.lang.String asOfLabel,
                             boolean move)
                      throws mks.frame.triggers.TriggerException
        Add a label to the specified issue. If there are applicable label triggers, then the label PRE triggers will be run immediately, before this function returns. The label POST triggers will be run after the completion of all the issue edit POST triggers.
        Parameters:
        issueID - The issue number
        label - The label
        asOfLabel - The label to use to determine the date against which the new label is to be placed. A null value indicates the current point in time.
        move - A boolean value indicating the action to take if the label already exists.
        Throws:
        mks.frame.triggers.TriggerException -
        • If the label already exists, and the move parameter is false.
        • If move is false, and the Add Label rule evaluates to false.
        • If move is true, and the Delete Label rule evaluates to false.
      • addLabel

        public void addLabel​(int issueID,
                             java.lang.String label,
                             java.util.Date asOfDate,
                             boolean move)
                      throws mks.frame.triggers.TriggerException
        Add a label to the specified issue. If there are applicable label triggers, then the label PRE triggers will be run immediately, before this function returns. The label POST triggers will be run after the completion of all the issue edit POST triggers.
        Parameters:
        issueID - The issue number
        label - The label
        asOfDate - The date against which the label is to be placed. A null value indicates the current point in time.
        move - A boolean value indicating the action to take if the label already exists.
        Throws:
        mks.frame.triggers.TriggerException -
        • If the label already exists, and the move parameter is false.
        • If move is false, and the Add Label rule evaluates to false.
        • If move is true, and the Delete Label rule evaluates to false.
      • addLabel

        public void addLabel​(int issueID,
                             java.lang.String label,
                             java.lang.String comment,
                             java.util.Date asOfDate,
                             boolean move)
                      throws mks.frame.triggers.TriggerException
        Add a label to the specified issue. If there are applicable label triggers, then the label PRE triggers will be run immediately, before this function returns. The label POST triggers will be run after the completion of all the issue edit POST triggers.
        Parameters:
        issueID - The issue number
        label - The label
        comment - The comment for the label
        asOfDate - The date against which the label is to be placed. A null value indicates the current point in time.
        move - A boolean value indicating the action to take if the label already exists.
        Throws:
        mks.frame.triggers.TriggerException -
        • If the label already exists, and the move parameter is false.
        • If move is false, and the Add Label rule evaluates to false.
        • If move is true, and the Delete Label rule evaluates to false.
      • deleteLabel

        public void deleteLabel​(int issueID,
                                java.lang.String label)
                         throws mks.frame.triggers.TriggerException
        Delete the label from the specified issue. If there are applicable label triggers, then the label PRE triggers will be run immediately, before this function returns. The label POST triggers will be run after the completion of all the issue edit POST triggers.
        Parameters:
        issueID - The issue number
        label - The label
        Throws:
        mks.frame.triggers.TriggerException -
        • If the label does not exist
      • branch

        public int branch​(int issueID)
                   throws mks.frame.triggers.TriggerException
        Branch an issue. This operation takes the specified issue, and creates a new issue of the same time, with all the fields visible in that type reproduced in the new issue. A branch record is created on the parent to indicate that the child branch exists.
        1. This is not an edit action. Editability is not required on the issue being branched; no issue delta is created, and the modify time is not changed.
        2. Must be invoked from a PRE-issue edit trigger only
        3. If the issue being branched is being modified in this transaction, the original issue field values are used for the new issue, no modifications will be copied.
        4. Once this method returns, the new issue will have been created, but not yet commited to the database. There will be no further issue edit trigger run for it, unless you choose to further edit the issue.
        5. If you choose to further edit the issue via getIssueDeltaBean there will be a second delta added to the issue, it is not possible to create the newly branched issue with a single delta in this case.
        6. WARNING: If you branch, and then then further edit the new issue via the getIssueDeltaBean, you will receive another issue changed event. If your logic is incorrect, and tries to perform another branch, you will cause an infinite loop of branch/edit operations. There is no way to end this loop, except by taking down your server, or waiting for the server to run out of resources.
        7. The PRE-branch trigger will have completed execution when this method returns.
        8. The POST-branch trigger will be queued to run after the successful completion of all triggers; along with any POST-edit issue triggers.
        9. If for any reason, the transaction fails, for example any trigger invokes the abort() method, the entire transaction will rollback, including this new issue.
        10. If you request the children of the issue being branched the results are undefined. It may depend on whether or not that issue has already been manipulated in the transaction.
        11. As a trigger, the end user does not require permissions on the issue being branched. However, the resulting issue will have as its creator that user.
        12. You may not branch any item whose type is one of the document model types.
        Parameters:
        issueID - The issue id of the issue to be branched.
        Throws:
        mks.frame.triggers.TriggerException
      • branch

        public int branch​(int issueID,
                          java.lang.String[] copyFields)
                   throws mks.frame.triggers.TriggerException
        Branch an issue, copying only the specified fields.
        Parameters:
        issueID - the issue ID of the issue to be branched
        copyFields - the list of fields to be copied
        Returns:
        the issue ID of the new copy.
        Throws:
        mks.frame.triggers.TriggerException
        See Also:
        branch(int issueID)
      • createSegment

        public LocalTriggerManager.ScriptIssueDeltaBean createSegment​(java.lang.String typeName,
                                                                      java.lang.String category,
                                                                      java.lang.String position,
                                                                      java.lang.String project)
                                                               throws mks.frame.triggers.TriggerException
        Create a document model segment. This will be a top level document segment.
        Parameters:
        typeName - The name of the type. The type must be a document model segment.
        category - The value of the Category field. A null value indicates to use the default.
        project - The value of the Project field. A project must be specified to create a segment.
        Returns:
        The IssueDeltaBean for the newly created segment. Additional fields can be set on the returned bean. Any mandatory fields must be set on the returned bean, or an exception will be thrown when the created segment is saved.
        Throws:
        mks.frame.triggers.TriggerException -
      • If the position string is null or not valid
      • If the category is not a legal value for this document
      • If the category is not of type segment
      • Various errors if the document types are not correctly configured
      • branchSegment

        public LocalTriggerManager.ScriptIssueDeltaBean branchSegment​(int issueID,
                                                                      java.lang.String project)
                                                               throws mks.frame.triggers.TriggerException
        Branch a document model segment.
        Parameters:
        issueID - issue ID of the issue to be branched
        project - project you want to assign the branched segment to. A project must be specified to create a segment.
        Returns:
        The IssueDeltaBean for the newly branched segment. Additional fields can be set on the returned bean. Any mandatory fields must be set on the returned bean, or an exception will be thrown when the branched segment is saved.
        Throws:
        mks.frame.triggers.TriggerException -
        1. If this item is not a node or a segment
        2. If the project cannot be found
        3. Various errors if the document types are not correctly configured
      • branchSegment

        public LocalTriggerManager.ScriptIssueDeltaBean branchSegment​(int issueID,
                                                                      java.lang.String project,
                                                                      boolean includeContent,
                                                                      boolean recurseInclude,
                                                                      boolean recurseReference,
                                                                      boolean subSegment,
                                                                      boolean swap,
                                                                      java.lang.String asOf,
                                                                      boolean branch,
                                                                      int parentId,
                                                                      java.lang.String position,
                                                                      boolean recurse)
                                                               throws mks.frame.triggers.TriggerException
        Branch a document model segment.
        Parameters:
        issueID - issue ID of the issue to be branched
        project - project you want to assign the branched segment to. A project must be specified to create a segment.
        includeContent - includes all content from the original segment
        recurseInclude - specifies to branch all included subsegments.
        recurseReference - specifies to branch all inserted subsegments.
        subSegment - branches the subsegment if the selected node references a subsegment.
        swap - specifies to branch the referenced subsegment instead of the owning segment and swaps in the new branch.
        asOf - allows you to branch the segment as of a specific date or label. Valid values are:
        1. date date as of when the specified issue saved.
        2. label:label label of the specified issue.
        branch - specifies how the nodes of the document are connected back to the nodes in the original document:
        parentId - the ID of the parent segment that the segment will be added to.
        position - determines where the segment should go in the parent segment's structural relationship list. You must specify a parentID. Valid values are:
        1. first inserts the content at the beginning of the list
        2. last inserts the content at the end of the list
        3. before:name inserts the content before the specified ID
        4. after:name inserts the content after the specified ID
        5. name inserts the content at the specified location
        recurse - to recursively apply this command to any subprojects
        Returns:
        The IssueDeltaBean for the newly branched segment. Additional fields can be set on the returned bean. Any mandatory fields must be set on the returned bean, or an exception will be thrown when the branched segment is saved.
        Throws:
        mks.frame.triggers.TriggerException -
        1. If this item is not a node or a segment
        2. If the project cannot be found
        3. If parentID is not a node or a segment
        4. If the position string is null or not valid
        5. Various errors if the document types are not correctly configured
      • copyContent

        public LocalTriggerManager.ScriptIssueDeltaBean copyContent​(int issueID,
                                                                    int parentId)
                                                             throws mks.frame.triggers.TriggerException
        Copy node to a segment.
        Parameters:
        issueID - issue ID of the issue to be copied
        parentId - the ID of the parent segment or node that will contain the reference to the node being copied
        Returns:
        The IssueDeltaBean for the newly copied segment. Additional fields can be set on the returned bean. Any mandatory fields must be set on the returned bean, or an exception will be thrown when the copied node is saved.
        Throws:
        mks.frame.triggers.TriggerException -
        1. If this item is not a node or a segment
        2. If parentID is not a node or a segment
        3. Various errors if the document types are not correctly configured
      • copyContent

        public LocalTriggerManager.ScriptIssueDeltaBean copyContent​(int issueID,
                                                                    int parentId,
                                                                    java.lang.String position,
                                                                    java.lang.String asOf,
                                                                    boolean recurse,
                                                                    boolean traces,
                                                                    boolean branch,
                                                                    java.lang.String refmode)
                                                             throws mks.frame.triggers.TriggerException
        Copy node to a segment.
        Parameters:
        issueID - issue ID of the issue to be copied
        parentId - the ID of the parent segment or node that will contain the reference to the node being copied
        position - determines where the copied content should go in the parent segment's structural relationship list. Valid values are:
        1. first inserts the content at the beginning of the list
        2. last inserts the content at the end of the list
        3. before:name inserts the content before the specified ID
        4. after:name inserts the content after the specified ID
        5. number inserts the content at the specified location
        asOf - allows you to copy content as of a specific date or label. Valid values are:
        1. date date as of when the specified issue saved.
        2. label:label label of the specified issue.
        recurse - indicates whether to copy all nodes and/or segments beneath the specify
        traces - indicates whether to copy all existing trace relationships to the new (copied) nodes
        branch - indicates that the copy operation you are performing will be a branch
        refmode - specifies the reference mode you want to apply to the copied content
        Returns:
        The IssueDeltaBean for the newly copied segment. Additional fields can be set on the returned bean. Any mandatory fields must be set on the returned bean, or an exception will be thrown when the copied node is saved.
        Throws:
        mks.frame.triggers.TriggerException -
        1. If this item is not a node or a segment
        2. If parentID is not a node or a segment
        3. If the position string is null or not valid
        4. Various errors if the document types are not correctly configured
      • moveContent

        public void moveContent​(int issueID,
                                int parentId)
                         throws mks.frame.triggers.TriggerException
        Move content to a new location.
        Parameters:
        issueID - issue ID of the issue to be moved
        parentId - the ID of the parent segment or node that will contain the reference to the node being moved
        Throws:
        mks.frame.triggers.TriggerException -
        1. If this item is not a node or a segment
        2. If parentID is not a node or a segment
        3. Various errors if the document types are not correctly configured
      • moveContent

        public void moveContent​(int issueID,
                                int parentId,
                                java.lang.String position,
                                boolean recurse)
                         throws mks.frame.triggers.TriggerException
        Move content to a new location.
        Parameters:
        issueID - issue ID of the issue to be moved
        parentId - the ID of the parent segment or node that will contain the reference to the node being moved
        position - determines where the content should go in the parent segment's structural relationship list. Valid values are:
        1. first inserts the content at the beginning of the list
        2. last inserts the content at the end of the list
        3. before:name inserts the content before the specified ID
        4. after:name inserts the content after the specified ID
        5. number inserts the content at the specified location
        recurse - indicates whether to move all nodes and/or segments beneath the specify
        Throws:
        mks.frame.triggers.TriggerException -
        1. If this item is not a node or a segment
        2. If parentID is not a node or a segment
        3. If the position string is null or not valid
        4. Various errors if the document types are not correctly configured
      • lockSegment

        public void lockSegment​(int segmentID,
                                java.lang.String lockGroup)
                         throws mks.frame.triggers.TriggerException
        Lock a document model segment
        Parameters:
        segmentID - the id of the document that should be locked
        lockGroup - the group ID of the group to lock the document as or null if not locking for a group
        Throws:
        mks.frame.triggers.TriggerException - if the lock operation fails or a specified group is not found
      • unlockSegment

        public void unlockSegment​(int segmentID)
                           throws mks.frame.triggers.TriggerException
        Unlock a document model segment
        Parameters:
        segmentID - the id of the document that should be unlocked
        Throws:
        mks.frame.triggers.TriggerException - if the unlock operation fails
      • getSolutionPropertyValue

        public java.lang.String getSolutionPropertyValue​(java.lang.String solutionName,
                                                         java.lang.String propertyName,
                                                         boolean optional)
                                                  throws mks.frame.triggers.TriggerException
        Get the requested property value from the solution-wide type.
        Parameters:
        solutionName - The solution name, usually "Requirements"
        propertyName - The name of the property to look up
        optional - Flag indicating whether property is required
        Returns:
        String value resulting from the lookup, or null if not found.
        Throws:
        mks.frame.triggers.TriggerException - If property is required but not found
      • walkHierarchy

        public int[] walkHierarchy​(int[] topids,
                                   java.lang.Object[] fields,
                                   boolean includeTopIds)
                            throws mks.frame.triggers.TriggerException
        Perform a walk from the indicated items thru a list of fields.
        Parameters:
        topids - An array of item IDs from which the walk will occur.
        fields - An array of fields. Each entry can either be a string, i.e. the field name; or a field bean.
        includeTopIds - If true then all items in the first arg are passed back with the result.
        Returns:
        an integer array of item ids visited while walking thru those fields. Each item is visited only once. If there are no relationships thru any of the given fields from these items then an empty array is returned. The order of the returned IDs is not defined.

        Be cautious in the use of this function, a significant sized hierarchy could cause a performance problem.

        Throws:
        mks.frame.triggers.TriggerException - if any of the fields specified are not normal relationship fields.
      • findAllSubsegments

        public int[] findAllSubsegments​(int topid,
                                        boolean recurseInclude,
                                        boolean recurseReference,
                                        java.lang.String asOfDate)
                                 throws mks.frame.triggers.TriggerException
        Find all segments contained or referenced from the current segment by walking down the current segment and into its subsegments. Returns topid in the result if it is a segment type. Returns nothing else if both recurseInclude and recurseReference are false. Thus, don't waste your time invoking this method with both booleans set to false.
        Parameters:
        topid - The ID of the starting point segment root or node.
        recurseInclude - Step into all included subsegments.
        recurseReference - Step into all referenced subsegments.
        asOfDate - If not null, the date as of when the documents should be walked. The date is parsed using the default simple date formatter.
        Returns:
        Array of segment root IDs.
        Throws:
        mks.frame.triggers.TriggerException
      • getNotifierAddress

        public java.lang.String getNotifierAddress()
                                            throws mks.frame.triggers.TriggerException
        Get the preferred email address to use in the 'From' field for email sent out by the server. This is the same 'From' email address used by the build in email notification and is often made unique for purposes of filtering and making the source of the email easily identifiable.
        Returns:
        The from email address for notifications.
        Throws:
        mks.frame.triggers.TriggerException - Currently this exception is never thrown but it is reserved for future use.
        Since:
        Integrity Solution 2008
      • getExposedName

        public java.lang.String getExposedName()
        Returns the name of this bean that is exposed to the scripting language.
        Specified by:
        getExposedName in interface mks.frame.triggers.ScriptExposableBean
        Specified by:
        getExposedName in class ScriptBaseBean
        Returns:
        the bean name: imServerBean.
      • getEditDate

        public java.util.Date getEditDate()
        Get edit date for the transaction, if the edit date is null one will be generated from the database. If you wish to know if the date is null or not set call the isEditDateNull() method.
      • isEditDateNull

        public boolean isEditDateNull()
        Check if the date is null, if its is null it can be set, use this instead of getEditDate() because getEditDate
      • setEditDate

        public void setEditDate​(java.util.Date date)
        Set the edit date for the entire transaction
      • isValueUsedInField

        public boolean isValueUsedInField​(java.lang.String field,
                                          double value)
                                   throws mks.frame.triggers.TriggerException

        Query the system to determine if one or more committed items have the specified value in the specified field. It is strongly encouraged that any field searched is indexed.

        This method bypasses project and type visibility constraints.

        Parameters:
        field - The name of a field. This method only supports fields with a data type of Integer.
        value - The value to search for.
        Returns:
        true if there is at least one item where the specified field has the specified value, false otherwise.
        Throws:
        mks.frame.triggers.TriggerException -
        • If not called from an Issue context.
        • If not called from a pre trigger or post trigger.
        • If a field with the supplied name does not exist.
        • If the data type of the field is not supported by this method.
        • If the value is not supported by the field.
      • isValueUsedInField

        public boolean isValueUsedInField​(java.lang.String field,
                                          java.lang.String value)
                                   throws mks.frame.triggers.TriggerException

        Query the system to determine if one or more committed items have the specified value in the specified field. It is strongly encouraged that any field searched is indexed.

        This method bypasses project and type visibility constraints.

        Parameters:
        field - The name of a field. This method only supports fields with a data type of Integer.
        value - The value to search for.
        Returns:
        true if there is at least one item where the specified field has the specified value, false otherwise.
        Throws:
        mks.frame.triggers.TriggerException -
        • If not called from an Issue context.
        • If not called from a pre trigger or post trigger.
        • If a field with the supplied name does not exist.
        • If the data type of the field is not supported by this method.
        • If the value is not supported by the field.
      • setIsMultiEditDocumentMode

        public void setIsMultiEditDocumentMode()
      • isMultiEditDocumentMode

        public boolean isMultiEditDocumentMode()
      • getVersionDescription

        public java.lang.String getVersionDescription()
      • setVersionDescription

        public void setVersionDescription​(java.lang.String versionDescription)
      • isAddVersionDescriptionToAll

        public boolean isAddVersionDescriptionToAll()
      • setAddVersionDescriptionToAll

        public void setAddVersionDescriptionToAll​(boolean isAddVersionDescriptionToAll)