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


Manages document state in relation to users seeing future requests for a particular document. Construct the object with a document and a user and ask it questions in relation to future requests.

Author(s):
Kuali Rice Team (rice.collab@kuali.org)
 
 
     private static final Logger LOG = Logger.getLogger(FutureRequestDocumentStateManager.class);
 
     private boolean receiveFutureRequests;
     private boolean doNotReceiveFutureRequests;
     private boolean clearFutureRequestState;
 
 
 
     public FutureRequestDocumentStateManager (DocumentRouteHeaderValue documentString principalId)
     {
         if (document.getRootBranch() != null) {
         	for (BranchState state : document.getRootBranchState()) {
         	    if (isStateForUser(stateprincipalId)) {
             		if (isReceiveFutureRequests(state)) {
             		    this. = true;
             		} else if (isDoNotReceiveFutureRequests(state)) {
             		    this. = true;
             		} else if (isClearFutureRequests(state)) {
             		    this. = true;
             		    this. = false;
             		    this. = false;
             		    break;
             		}
         	    }
         	}
         }
     	if (this.isClearFutureRequestState()) {
     	    this.clearStateFromDocument(document);
     	}
     }
 
     public FutureRequestDocumentStateManager (DocumentRouteHeaderValue documentGroup kimGroup)
     {
         GroupService ims = KimApiServiceLocator.getGroupService();
         List<StringprincipalIds =
             ims.getMemberPrincipalIds(kimGroup.getId());
 
         for (String id : principalIds)
 		{
 		    FutureRequestDocumentStateManager requestStateMngr =
 		        new FutureRequestDocumentStateManager(documentid);
 		    if (requestStateMngr.isReceiveFutureRequests()) {
 			this. = true;
 		    } else if (requestStateMngr.isDoNotReceiveFutureRequests()) {
 		    }
 		}
     }
 
     protected void clearStateFromDocument(DocumentRouteHeaderValue document) {
         if (document.getRootBranchState() != null) {
         	for (BranchState state : document.getRootBranchState()) {
         	    if (state.getKey().contains()) {
         		String values[] = state.getKey().split(",");
         		state.setKey( + "," + values[1] + "," + new Date().toString());
         	    }
         	}
         	KEWServiceLocator.getRouteNodeService().save(document.getRootBranch());
        }
    }
    protected boolean isStateForUser(BranchState stateString principalId)
    {
        String[] values = state.getKey().split(",");
        if (values.length != 4 || ! values[0].contains()) {
            return false;
        }
        String statePrincipalId = values[1];
        return principalId.equals(statePrincipalId);
    }
    protected boolean isReceiveFutureRequests(BranchState state) {
    }
    protected boolean isDoNotReceiveFutureRequests(BranchState state) {
    }
    protected boolean isClearFutureRequests(BranchState state) {
    }
    public boolean isClearFutureRequestState() {
        return this.;
    }
    public boolean isDoNotReceiveFutureRequests() {
        return this.;
    }
    public boolean isReceiveFutureRequests() {
        return this.;
    }
New to GrepCode? Check out our FAQ X