Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright 2005-2013 The Kuali Foundation Licensed under the Educational Community License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.opensource.org/licenses/ecl2.php Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
 
 package org.kuali.rice.kew.actions;
 
 
 
 import java.util.List;


ClearFYIAction deactivates the user requests. The routeheader is first checked to make sure the action is valid for the document. Next the user is checked to make sure he/she has not taken a previous action on this document at the actions responsibility or below. Any requests related to this user are deactivated.

Author(s):
Kuali Rice Team (rice.collab@kuali.org)
 
 public class ClearFYIAction extends ActionTakenEvent {
     private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(ClearFYIAction.class);

    

Parameters:
rh RouteHeader for the document upon which the action is taken.
principal User taking the action.
 
     public ClearFYIAction(DocumentRouteHeaderValue rhPrincipalContract principal) {
         super(.rhprincipal);
     }

    

Parameters:
rh RouteHeader for the document upon which the action is taken.
principal User taking the action.
annotation User comment on the action taken
 
     public ClearFYIAction(DocumentRouteHeaderValue rhPrincipalContract principalString annotation) {
         super(.rhprincipalannotation);
     }
    
    
Method to check if the Action is currently valid on the given document

Returns:
returns an error message to give system better identifier for problem
 
     public String validateActionRules() {
     }
 
     public String validateActionRules(List<ActionRequestValueactionRequests) {
             return "Document is not in a state to have FYI processed";
         }
         List<ActionRequestValuefilteredActionRequests = filterActionRequestsByCode(actionRequests.);
         if (!isActionCompatibleRequest(filteredActionRequests)) {
             return "No request for the user is compatible " + "with the ClearFYI action";
         }
         return "";
     }
 
     public boolean isActionCompatibleRequest(List requests) {
 
         // can always cancel saved or initiated document
         if (.isStateInitiated() || .isStateSaved()) {
             return true;
         }
 
         boolean actionCompatible = false;
         Iterator ars = requests.iterator();
         ActionRequestValue actionRequest = null;
 
         while (ars.hasNext()) {
            actionRequest = (ActionRequestValuears.next();
            //FYI request matches all but deny and cancel
            if (..equals(actionRequest.getActionRequested())) {
                actionCompatible = true;
                break;
            }
        }
        return actionCompatible;
    }

    
Processes the clear FYI action. - Checks to make sure the document status allows the action. - Checks that the user has not taken a previous action. - Deactivates the pending requests for this user

    public void recordAction() throws InvalidActionTakenException {
        MDC.put("docId"getRouteHeader().getDocumentId());
        .debug("Clear FYI for document : " + );
        .debug("Checking to see if the action is legal");
        if (actionRequests == null || actionRequests.isEmpty()) {
        	if (allowUnrequested != null) {
        		if (!allowUnrequested.getPolicyValue()) {
        			throw new InvalidActionTakenException("No request for the user is compatible " + "with the ClearFYI action. " + "Doctype policy ALLOW_UNREQUESTED_ACTION is set to false and someone else likely just took action on the document.");
        		}
        	}
        }
        
        String errorMessage = validateActionRules(actionRequests);
        if (!org.apache.commons.lang.StringUtils.isEmpty(errorMessage)) {
            throw new InvalidActionTakenException(errorMessage);
        }
        ActionTakenValue actionTaken = saveActionTaken(findDelegatorForActionRequests(actionRequests));
        .debug("Deactivate all pending action requests");
        getActionRequestService().deactivateRequests(actionTakenactionRequests);
        notifyActionTaken(actionTaken);
    }
New to GrepCode? Check out our FAQ X