Class ApprovalContext

    • Method Detail

      • create

        public static ApprovalContext create()
        Creates a new context with no information.
      • withUser

        public ApprovalContext withUser​(@CheckForNull
                                        String user)
        Creates a context with a specified user ID. (ACL.SYSTEM is automatically ignored.)
      • getUser

        @CheckForNull
        public String getUser()
        Gets the associated user ID, if any.
      • withItem

        public ApprovalContext withItem​(@CheckForNull
                                        Item item)
        Associates an item with this approval, used only for display purposes.
      • getItem

        @CheckForNull
        public Item getItem()
        Gets any associated item which should be displayed to an administrator.
      • withKey

        public ApprovalContext withKey​(@CheckForNull
                                       String key)
        Associates a unique key with this approval. If not null, any previous approval of the same kind with the same key will be canceled and replaced by this one. Only considered for whole-script approvals, not signature approvals which are generic.
      • getKey

        @CheckForNull
        public String getKey()
        Gets the unique key, if any.
      • withItemAsKey

        public ApprovalContext withItemAsKey​(@CheckForNull
                                             Item item)
        Associates an item with this approval for display, as well as setting a unique key based on the Item.getFullName() which would cancel any previous approvals for the same item. Note that this only makes sense in cases where it is guaranteed that at most one approvable script is configured on a given item, so do not use this with (for example) build steps.