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.actionrequest.dao.impl;
 
 import java.util.List;
 
OJB implementation of the org.kuali.rice.kew.actionrequest.dao.ActionRequestDAO.

Author(s):
Kuali Rice Team (rice.collab@kuali.org)
 
 
     public ActionRequestValue getActionRequestByActionRequestId(String actionRequestId) {
         Criteria crit = new Criteria();
         crit.addEqualTo("actionRequestId"actionRequestId);
     }
 
     public void saveActionRequest(ActionRequestValue actionRequest) {
         if (actionRequest.getActionRequestId() == null) {
             loadDefaultValues(actionRequest);
         }
         if ( actionRequest.getAnnotation() != null && actionRequest.getAnnotation().length() > 2000 ) {
         	actionRequest.setAnnotation( StringUtils.abbreviate(actionRequest.getAnnotation(), 2000) );
         }
         this.getPersistenceBrokerTemplate().store(actionRequest);
     }
 
     public List<ActionRequestValuefindPendingByResponsibilityIds(Collection responsibilityIds) {
         if (responsibilityIds == null || responsibilityIds.size() == 0) return Collections.emptyList();
         Criteria crit = new Criteria();
         Criteria statusCriteria = new Criteria();
         Criteria activatedCriteria = new Criteria();
         activatedCriteria.addEqualTo("status"..getCode());
 
         Criteria initializedCriteria = new Criteria();
         initializedCriteria.addEqualTo("status"..getCode());
 
         statusCriteria.addOrCriteria(activatedCriteria);
         statusCriteria.addOrCriteria(initializedCriteria);
         crit.addAndCriteria(statusCriteria);
         crit.addIn("responsibilityId"responsibilityIds);
     }
 
     public List<ActionRequestValuefindPendingByActionRequestedAndDocId(String actionRequestedCdString documentId) {
         Criteria crit = new Criteria();
         crit.addEqualTo("actionRequested"actionRequestedCd);
         crit.addEqualTo("documentId"documentId);
         crit.addEqualTo("currentIndicator".);
         crit.addAndCriteria(getPendingCriteria());
     }
 
     @SuppressWarnings("unchecked")
     public List<ActionRequestValuefindByStatusAndDocId(String statusCdString documentId) {
         Criteria crit = new Criteria();
         crit.addEqualTo("status"statusCd);
         crit.addEqualTo("documentId"documentId);
         crit.addEqualTo("currentIndicator"true);
 
     }
 
     private void loadDefaultValues(ActionRequestValue actionRequest) {
         checkNull(actionRequest.getActionRequested(), "action requested");
        checkNull(actionRequest.getResponsibilityId(), "responsibility ID");
        checkNull(actionRequest.getRouteLevel(), "route level");
        checkNull(actionRequest.getDocVersion(), "doc version");
        if (actionRequest.getForceAction() == null) {
            actionRequest.setForceAction(.);
        }
        if (actionRequest.getStatus() == null) {
            actionRequest.setStatus(..getCode());
        }
        if (actionRequest.getPriority() == null) {
            actionRequest.setPriority(.);
        }
        if (actionRequest.getCurrentIndicator() == null) {
            actionRequest.setCurrentIndicator(true);
        }
        actionRequest.setCreateDate(new Timestamp(System.currentTimeMillis()));
    }
    //TODO Runtime might not be the right thing to do here...
    private void checkNull(Object valueString valueNamethrows RuntimeException {
        if (value == null) {
            throw new RuntimeException("Null value for " + valueName);
        }
    }
        Criteria crit = new Criteria();
        crit.addEqualTo("routeLevel"routeLevel);
        crit.addNotEqualTo("status"..getCode());
        crit.addEqualTo("documentId"documentId);
        crit.addEqualTo("currentIndicator".);
        crit.addIsNull("parentActionRequest");
    }
    public List<ActionRequestValuefindPendingByDocIdAtOrBelowRouteLevel(String documentIdInteger routeLevel) {
        Criteria crit = new Criteria();
        crit.addLessOrEqualThan("routeLevel"routeLevel);
        crit.addNotEqualTo("status"..getCode());
        crit.addEqualTo("documentId"documentId);
        crit.addEqualTo("currentIndicator"true);
    }
        Criteria crit = new Criteria();
        crit.addLessOrEqualThan("routeLevel"routeLevel);
        crit.addNotEqualTo("status"..getCode());
        crit.addEqualTo("documentId"documentId);
        crit.addEqualTo("currentIndicator"true);
        crit.addIsNull("parentActionRequest");
    }
    public void delete(String actionRequestId) {
    	Criteria crit = new Criteria();
    	crit.addEqualTo("actionRequestId"actionRequestId);
    }
    public List<ActionRequestValuefindAllPendingByDocId(String documentId) {
        Criteria initializedStatCriteria = new Criteria();
        initializedStatCriteria.addEqualTo("status"..getCode());
        Criteria activatedStatCriteria = new Criteria();
        activatedStatCriteria.addEqualTo("status"..getCode());
        Criteria statusCriteria = new Criteria();
        statusCriteria.addOrCriteria(initializedStatCriteria);
        statusCriteria.addOrCriteria(activatedStatCriteria);
        Criteria crit = new Criteria();
        crit.addEqualTo("documentId"documentId);
        crit.addEqualTo("currentIndicator"true);
        crit.addAndCriteria(statusCriteria);
    }
    public List<ActionRequestValuefindAllByDocId(String documentId) {
        Criteria crit = new Criteria();
        crit.addEqualTo("documentId"documentId);
        crit.addEqualTo("currentIndicator"true);
    }
    public List<ActionRequestValuefindAllRootByDocId(String documentId) {
        Criteria crit = new Criteria();
        crit.addEqualTo("documentId"documentId);
        crit.addEqualTo("currentIndicator"true);
        crit.addIsNull("parentActionRequest");
    }
        Criteria crit = new Criteria();
        crit.addEqualTo("documentId"documentId);
    }
    
    private Criteria getPendingCriteria() {
        Criteria pendingCriteria = new Criteria();
        Criteria activatedCriteria = new Criteria();
        activatedCriteria.addEqualTo("status"..getCode());
        Criteria initializedCriteria = new Criteria();
        initializedCriteria.addEqualTo("status"..getCode());
        pendingCriteria.addOrCriteria(activatedCriteria);
        pendingCriteria.addOrCriteria(initializedCriteria);
        return pendingCriteria;
    }
    public  void deleteByDocumentId(String documentId){
        Criteria crit = new Criteria();
        crit.addEqualTo("documentId"documentId);
    }
    	Criteria routeHeaderCrit = new Criteria();
    	routeHeaderCrit.addEqualTo("documentTypeId"documentTypeId);
    	Criteria crit = new Criteria();
    	crit.addIn("documentId"new ReportQueryByCriteria(DocumentRouteHeaderValue.classnew String[] {"documentId"}, routeHeaderCrit));
        crit.addAndCriteria(getPendingCriteria());
        crit.addEqualTo("currentIndicator".);
        crit.addIsNull("parentActionRequest");
    }
    public List<ActionRequestValuefindPendingRootRequestsByDocIdAtRouteNode(String documentIdString nodeInstanceId) {
    	Criteria crit = new Criteria();
        crit.addEqualTo("documentId"documentId);
        crit.addAndCriteria(getPendingCriteria());
        crit.addEqualTo("currentIndicator".);
        crit.addIsNull("parentActionRequest");
        crit.addEqualTo("nodeInstance.routeNodeInstanceId"nodeInstanceId);
    }
    public List<ActionRequestValuefindRootRequestsByDocIdAtRouteNode(String documentIdString nodeInstanceId) {
        Criteria crit = new Criteria();
        crit.addEqualTo("documentId"documentId);
        crit.addEqualTo("currentIndicator".);
        crit.addIsNull("parentActionRequest");
        crit.addEqualTo("nodeInstance.routeNodeInstanceId"nodeInstanceId);
    }
    public boolean doesDocumentHaveUserRequest(String principalIdString documentId) {
    	Criteria crit = new Criteria();
    	crit.addEqualTo("documentId"documentId);
    	crit.addEqualTo("recipientTypeCd"..getCode());
    	crit.addEqualTo("principalId"principalId);
    	crit.addEqualTo("currentIndicator".);
    	int count = getPersistenceBrokerTemplate().getCount(new QueryByCriteria(ActionRequestValue.classcrit));
    	return count > 0;
    }
    public List<StringgetRequestGroupIds(String documentId) {
    	Criteria crit = new Criteria();
    	crit.addEqualTo("documentId"documentId);
    	crit.addEqualTo("recipientTypeCd"..getCode());
    	crit.addEqualTo("currentIndicator".);
    	ReportQueryByCriteria query = QueryFactory.newReportQuery(ActionRequestValue.classcrit);
    	query.setAttributes(new String[] { "groupId" });
    	List<StringgroupIds = new ArrayList<String>();
    	while (iter.hasNext()) {
			Object[] row = (Object[]) iter.next();
			String id = (String)row[0];
			groupIds.add(id);
		}
    	return groupIds;
    }

        Criteria statusCriteria = new Criteria();
        statusCriteria.addEqualTo("status"..getCode());
        Criteria crit = new Criteria();
        crit.addEqualTo("groupId"groupId);
        crit.addEqualTo("currentIndicator"true);
        crit.addAndCriteria(statusCriteria);
	}
    @Override
        Criteria crit = new Criteria();
        crit.addEqualTo("actionTakenId"actionTakenId);
        crit.addEqualTo("currentIndicator"true);
        crit.addEqualTo("recipientTypeCd"..getCode());
        crit.addIsNull("parentActionRequest");
    }
New to GrepCode? Check out our FAQ X