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.engine.simulation;
 
 
 import java.util.List;

Criteria which acts as input to the SimulationEngine.

Author(s):
Kuali Rice Team (rice.collab@kuali.org)
See also:
SimulationEngine
 
 public class SimulationCriteria {
 
     // fields related to document simulation
     private String documentId;
     private String destinationNodeName;
     private List<RecipientdestinationRecipients = new ArrayList<Recipient>();
 
     // fields related to document type simulation
     private String documentTypeName;
     private String xmlContent;
     private List<StringnodeNames = new ArrayList<String>();
     private List<StringruleTemplateNames = new ArrayList<String>();
 
     // fields related to both simulation types
     private Boolean activateRequests;
     private Person routingUser;
     private boolean flattenNodes;
 
     public SimulationCriteria() {
         this. = null;
         this. = false;
     }
 
     public static SimulationCriteria createSimulationCritUsingDocumentId(String documentId) {
         return new SimulationCriteria(nulldocumentId);
     }
 
     public static SimulationCriteria createSimulationCritUsingDocTypeName(String documentTypeName) {
         return new SimulationCriteria(documentTypeNamenull);
     }
 
     private SimulationCriteria(String documentTypeNameString documentId) {
         if (StringUtils.isNotBlank(documentId)) {
             this. = documentId;
         } else if (StringUtils.isNotBlank(documentTypeName)) {
             this. = documentTypeName;
         }
     }
 
     public Boolean isActivateRequests() {
         return this.;
     }
 
     public void setActivateRequests(Boolean activateRequests) {
         this. = activateRequests;
     }
 
     public String getDocumentId() {
         return ;
     }
 
     public void setDocumentId(String documentId) {
         this. = documentId;
     }
 
     public String getDestinationNodeName() {
         return ;
     }
 
     public void setDestinationNodeName(String destinationNodeName) {
         this. = destinationNodeName;
    }
        return ;
    }
    public void setDestinationRecipients(List<RecipientdestinationRecipients) {
        this. = destinationRecipients;
    }
    public String getDocumentTypeName() {
        return ;
    }
    public void setDocumentTypeName(String documentTypeName) {
        this. = documentTypeName;
    }
    public List<StringgetRuleTemplateNames() {
        return ;
    }
    public void setRuleTemplateNames(List<StringruleTemplateNames) {
        this. = ruleTemplateNames;
    }
    public String getXmlContent() {
        return ;
    }
    public void setXmlContent(String xmlContent) {
        this. = xmlContent;
    }
    public List<StringgetNodeNames() {
        return ;
    }
    public void setNodeNames(List<StringnodeNames) {
        this. = nodeNames;
    }
    public boolean isDocumentSimulation() {
        return  != null;
    }
    public boolean isDocumentTypeSimulation() {
        return !org.apache.commons.lang.StringUtils.isEmpty();
    }
        return ;
    }
    public void setActionsToTake(List<SimulationActionToTakeactionsToTake) {
        this. = actionsToTake;
    }
    public Person getRoutingUser() {
        return ;
    }
    public void setRoutingUser(Person routingUser) {
        this. = routingUser;
    }
    public boolean isFlattenNodes() {
        return this.;
    }
    public void setFlattenNodes(boolean flattenNodes) {
        this. = flattenNodes;
    }
    public static SimulationCriteria from(RoutingReportCriteria criteriaVO) {
        if (criteriaVO == null) {
            return null;
        }
        SimulationCriteria criteria = new SimulationCriteria();
        criteria.setDestinationNodeName(criteriaVO.getTargetNodeName());
        criteria.setDocumentId(criteriaVO.getDocumentId());
        criteria.setDocumentTypeName(criteriaVO.getDocumentTypeName());
        criteria.setXmlContent(criteriaVO.getXmlContent());
        criteria.setActivateRequests(criteriaVO.isActivateRequests());
        criteria.setFlattenNodes(criteriaVO.isFlattenNodes());
        if (criteriaVO.getRoutingPrincipalId() != null) {
            Principal kPrinc = KEWServiceLocator.getIdentityHelperService().
                    getPrincipal(criteriaVO.getRoutingPrincipalId());
            Person user = KimApiServiceLocator.getPersonService().getPerson(kPrinc.getPrincipalId());
            if (user == null) {
                throw new RiceRuntimeException(
                        "Could not locate user for the given id: " + criteriaVO.getRoutingPrincipalId());
            }
            criteria.setRoutingUser(user);
        }
        if (criteriaVO.getRuleTemplateNames() != null) {
            criteria.setRuleTemplateNames(criteriaVO.getRuleTemplateNames());
        }
        if (criteriaVO.getNodeNames() != null) {
            criteria.setNodeNames(criteriaVO.getNodeNames());
        }
        if (criteriaVO.getTargetPrincipalIds() != null) {
            for (String targetPrincipalId : criteriaVO.getTargetPrincipalIds()) {
                Principal principal = KEWServiceLocator.getIdentityHelperService().getPrincipal(targetPrincipalId);
                criteria.getDestinationRecipients().add(new KimPrincipalRecipient(principal));
            }
        }
        if (criteriaVO.getActionsToTake() != null) {
            for (RoutingReportActionToTake actionToTake : criteriaVO.getActionsToTake()) {
                criteria.getActionsToTake().add(SimulationActionToTake.from(actionToTake));
            }
        }
        return criteria;
    }
New to GrepCode? Check out our FAQ X