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.actiontaken.service.impl;
 
 
 import java.util.List;



Default implementation of the org.kuali.rice.kew.actiontaken.service.ActionTakenService.

Author(s):
Kuali Rice Team (rice.collab@kuali.org)
 
 public class ActionTakenServiceImpl implements ActionTakenService {
     private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(ActionTakenServiceImpl.class);
     private ActionTakenDAO actionTakenDAO;
 
     public ActionTakenValue load(String id) {
         return getActionTakenDAO().load(id);
     }
 
     public ActionTakenValue findByActionTakenId(String actionTakenId) {
         return getActionTakenDAO().findByActionTakenId(actionTakenId);
     }
 
     public ActionTakenValue getPreviousAction(ActionRequestValue actionRequest) {
     	return getPreviousAction(actionRequestnull);
     }
 
     public ActionTakenValue getPreviousAction(ActionRequestValue actionRequestList<ActionTakenValuesimulatedActionsTaken)
     {
         GroupService ims = KimApiServiceLocator.getGroupService();
         ActionTakenValue foundActionTaken = null;
         List<StringprincipalIds = new ArrayList<String>();
         if (actionRequest.isGroupRequest()) {
             principalIds.addAllims.getMemberPrincipalIds(actionRequest.getGroup().getId()));
         } else if (actionRequest.isUserRequest()) {
             principalIds.add(actionRequest.getPrincipalId());
         }
 
         for (String id : principalIds)
         {
             List<ActionTakenValueactionsTakenByUser =
                 getActionTakenDAO().findByDocumentIdWorkflowId(actionRequest.getDocumentId(), id );
             if (simulatedActionsTaken != null) {
                 for (ActionTakenValue simulatedAction : simulatedActionsTaken)
                 {
                     if (id.equals(simulatedAction.getPrincipalId()))
                     {
                         actionsTakenByUser.add(simulatedAction);
                     }
                 }
             }
 
             for (ActionTakenValue actionTaken : actionsTakenByUser)
             {
                 if (ActionRequestValue.compareActionCode(actionTaken.getActionTaken(),
                         actionRequest.getActionRequested(), true) >= 0)
                 {
                   foundActionTaken = actionTaken;
                 }
             }
         }
 
         return foundActionTaken;
     }
 
     public Collection findByDocIdAndAction(String docIdString action) {
        return getActionTakenDAO().findByDocIdAndAction(docIdaction);
    }
    public Collection<ActionTakenValuefindByDocumentId(String documentId) {
        return getActionTakenDAO().findByDocumentId(documentId);
    }
    public List<ActionTakenValuefindByDocumentIdWorkflowId(String documentIdString workflowId) {
        return getActionTakenDAO().findByDocumentIdWorkflowId(documentIdworkflowId);
    }
    public Collection getActionsTaken(String documentId) {
        return getActionTakenDAO().findByDocumentId(documentId);
    }
    public List findByDocumentIdIgnoreCurrentInd(String documentId) {
        return getActionTakenDAO().findByDocumentIdIgnoreCurrentInd(documentId);
    }
    public void saveActionTaken(ActionTakenValue actionTaken) {
        this.getActionTakenDAO().saveActionTaken(actionTaken);
    }
    public void delete(ActionTakenValue actionTaken) {
        getActionTakenDAO().deleteActionTaken(actionTaken);
    }
    public ActionTakenDAO getActionTakenDAO() {
        return ;
    }
    public void setActionTakenDAO(ActionTakenDAO actionTakenDAO) {
        this. = actionTakenDAO;
    }
    public void deleteByDocumentId(String documentId){
        .deleteByDocumentId(documentId);
    }
    public void validateActionTaken(ActionTakenValue actionTaken){
        .debug("Enter validateActionTaken(..)");
        String documentId = actionTaken.getDocumentId();
        if(documentId == null){
            errors.add(new WorkflowServiceErrorImpl("ActionTaken documentid null.""actiontaken.documentid.empty"actionTaken.getActionTakenId().toString()));
        } else if(getRouteHeaderService().getRouteHeader(documentId) == null){
            errors.add(new WorkflowServiceErrorImpl("ActionTaken documentid invalid.""actiontaken.documentid.invalid"actionTaken.getActionTakenId().toString()));
        }
        String principalId = actionTaken.getPrincipalId();
        if(StringUtils.isBlank(principalId)){
            errors.add(new WorkflowServiceErrorImpl("ActionTaken personid null.""actiontaken.personid.empty"actionTaken.getActionTakenId().toString()));
        } else {
        	Principal principal = KimApiServiceLocator.getIdentityService().getPrincipal(principalId);
        	if (principal == null) {
                errors.add(new WorkflowServiceErrorImpl("ActionTaken personid invalid.""actiontaken.personid.invalid"actionTaken.getActionTakenId().toString()));
            }
        }
        String actionTakenCd = actionTaken.getActionTaken();
        if(actionTakenCd == null || actionTakenCd.trim().equals("")){
            errors.add(new WorkflowServiceErrorImpl("ActionTaken cd null.""actiontaken.actiontaken.empty"actionTaken.getActionTakenId().toString()));
        } else if(!..containsKey(actionTakenCd)){
            errors.add(new WorkflowServiceErrorImpl("ActionTaken invalid.""actiontaken.actiontaken.invalid"actionTaken.getActionTakenId().toString()));
        }
        if(actionTaken.getActionDate() == null){
            errors.add(new WorkflowServiceErrorImpl("ActionTaken actiondate null.""actiontaken.actiondate.empty"actionTaken.getActionTakenId().toString()));
        }
        if(actionTaken.getDocVersion() == null){
            errors.add(new WorkflowServiceErrorImpl("ActionTaken docversion null.""actiontaken.docverion.empty"actionTaken.getActionTakenId().toString()));
        }
        .debug("Exit validateActionRequest(..) ");
        if (!errors.isEmpty()) {
            throw new WorkflowServiceErrorException("ActionRequest Validation Error"errors);
        }
    }
    public boolean hasUserTakenAction(String principalIdString documentId) {
    	return getActionTakenDAO().hasUserTakenAction(principalIddocumentId);
    }
        return (RouteHeaderService) KEWServiceLocator.getService(.);
    }
    public Timestamp getLastApprovedDate(String documentId)
    {
        return getActionTakenDAO().getLastActionTakenDate(documentId.);
    }
New to GrepCode? Check out our FAQ X