Coverage Report - org.kuali.rice.kns.workflow.service.impl.KualiWorkflowDocumentImpl
 
Classes in this File Line Coverage Branch Coverage Complexity
KualiWorkflowDocumentImpl
0%
0/186
0%
0/56
1.41
 
 1  
 /*
 2  
  * Copyright 2005-2007 The Kuali Foundation
 3  
  * 
 4  
  * Licensed under the Educational Community License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  * 
 8  
  * http://www.opensource.org/licenses/ecl2.php
 9  
  * 
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  
  * See the License for the specific language governing permissions and
 14  
  * limitations under the License.
 15  
  */
 16  
 package org.kuali.rice.kns.workflow.service.impl;
 17  
 
 18  
 import java.io.Serializable;
 19  
 import java.sql.Timestamp;
 20  
 import java.util.ArrayList;
 21  
 import java.util.HashSet;
 22  
 import java.util.Iterator;
 23  
 import java.util.Set;
 24  
 
 25  
 import org.apache.commons.lang.StringUtils;
 26  
 import org.kuali.rice.kew.dto.ActionRequestDTO;
 27  
 import org.kuali.rice.kew.dto.ActionTakenDTO;
 28  
 import org.kuali.rice.kew.dto.ReturnPointDTO;
 29  
 import org.kuali.rice.kew.dto.RouteHeaderDTO;
 30  
 import org.kuali.rice.kew.dto.UserIdDTO;
 31  
 import org.kuali.rice.kew.dto.WorkflowAttributeDefinitionDTO;
 32  
 import org.kuali.rice.kew.exception.InvalidActionTakenException;
 33  
 import org.kuali.rice.kew.exception.ResourceUnavailableException;
 34  
 import org.kuali.rice.kew.exception.WorkflowException;
 35  
 import org.kuali.rice.kew.service.WorkflowDocument;
 36  
 import org.kuali.rice.kew.service.WorkflowDocumentActions;
 37  
 import org.kuali.rice.kew.util.KEWConstants;
 38  
 import org.kuali.rice.kim.bo.Person;
 39  
 import org.kuali.rice.kim.service.KIMServiceLocator;
 40  
 import org.kuali.rice.kns.service.KNSServiceLocator;
 41  
 import org.kuali.rice.kns.workflow.service.KualiWorkflowDocument;
 42  
 import org.kuali.rice.kns.workflow.service.KualiWorkflowInfo;
 43  
 
 44  
 public class KualiWorkflowDocumentImpl implements KualiWorkflowDocument, Serializable {
 45  
 
 46  
     private WorkflowDocument workflowDocument;
 47  
 
 48  0
     public KualiWorkflowDocumentImpl(UserIdDTO userId, String documentType) throws WorkflowException {
 49  0
         workflowDocument = new WorkflowDocument(userId, documentType);
 50  0
     }
 51  
 
 52  0
     public KualiWorkflowDocumentImpl(UserIdDTO userId, Long routeHeaderId) throws WorkflowException {
 53  0
         workflowDocument = new WorkflowDocument(userId, routeHeaderId);
 54  0
     }
 55  
 
 56  
     // ########################
 57  
     // Document Content methods
 58  
     // ########################
 59  
 
 60  
     /**
 61  
      * Returns the application specific document content.
 62  
      * 
 63  
      * For documents routed prior to Workflow 2.0: If the application did NOT use attributes for XML generation, this method will
 64  
      * return the entire document content XML. Otherwise it will return the empty string.
 65  
      */
 66  
     public String getApplicationContent() {
 67  0
         return workflowDocument.getApplicationContent();
 68  
     }
 69  
 
 70  
     /**
 71  
      * Sets the application specific document content.
 72  
      */
 73  
     public void setApplicationContent(String applicationContent) {
 74  0
         workflowDocument.setApplicationContent(applicationContent);
 75  0
     }
 76  
 
 77  
     /**
 78  
      * Clears all attribute document content from the document. Typically, this will be used if it is necessary to update the
 79  
      * attribute doc content on the document. This can be accomplished by clearing the content and then adding the desired attribute
 80  
      * definitions.
 81  
      * 
 82  
      * In order for these changes to take effect, an action must be performed on the document (such as "save").
 83  
      */
 84  
     public void clearAttributeContent() {
 85  0
         workflowDocument.clearAttributeContent();
 86  0
     }
 87  
 
 88  
     /**
 89  
      * Returns the attribute-generated document content.
 90  
      */
 91  
     public String getAttributeContent() {
 92  0
         return workflowDocument.getAttributeContent();
 93  
     }
 94  
 
 95  
     /**
 96  
      * Adds an attribute definition which defines creation parameters for a WorkflowAttribute implementation. The created attribute
 97  
      * will be used to generate attribute document content. When the document is sent to the server, this will be appended to the
 98  
      * existing attribute doc content. If it is required to replace the attribute document content, then the clearAttributeContent()
 99  
      * method should be invoked prior to adding attribute definitions.
 100  
      */
 101  
     public void addAttributeDefinition(WorkflowAttributeDefinitionDTO attributeDefinition) {
 102  0
         workflowDocument.addAttributeDefinition(attributeDefinition);
 103  0
     }
 104  
 
 105  
     public void removeAttributeDefinition(WorkflowAttributeDefinitionDTO attributeDefinition) {
 106  0
         workflowDocument.removeAttributeDefinition(attributeDefinition);
 107  0
     }
 108  
 
 109  
     public void clearAttributeDefinitions() {
 110  0
         workflowDocument.clearAttributeDefinitions();
 111  0
     }
 112  
 
 113  
     public WorkflowAttributeDefinitionDTO[] getAttributeDefinitions() {
 114  0
         return workflowDocument.getAttributeDefinitions();
 115  
     }
 116  
 
 117  
     /**
 118  
      * Adds a searchable attribute definition which defines creation parameters for a SearchableAttribute implementation. The
 119  
      * created attribute will be used to generate searchable document content. When the document is sent to the server, this will be
 120  
      * appended to the existing searchable doc content. If it is required to replace the searchable document content, then the
 121  
      * clearSearchableContent() method should be invoked prior to adding definitions.
 122  
      */
 123  
     public void addSearchableDefinition(WorkflowAttributeDefinitionDTO searchableDefinition) {
 124  0
         workflowDocument.addSearchableDefinition(searchableDefinition);
 125  0
     }
 126  
 
 127  
     public void removeSearchableDefinition(WorkflowAttributeDefinitionDTO searchableDefinition) {
 128  0
         workflowDocument.removeSearchableDefinition(searchableDefinition);
 129  0
     }
 130  
 
 131  
     public void clearSearchableDefinitions() {
 132  0
         workflowDocument.clearSearchableDefinitions();
 133  0
     }
 134  
 
 135  
     public WorkflowAttributeDefinitionDTO[] getSearchableDefinitions() {
 136  0
         return workflowDocument.getSearchableDefinitions();
 137  
     }
 138  
 
 139  
     // ########################
 140  
     // END Document Content methods
 141  
     // ########################
 142  
 
 143  
     public RouteHeaderDTO getRouteHeader() {
 144  0
         return workflowDocument.getRouteHeader();
 145  
     }
 146  
 
 147  
     public Long getRouteHeaderId() throws WorkflowException {
 148  0
         return workflowDocument.getRouteHeaderId();
 149  
     }
 150  
 
 151  
     public void setAppDocId(String appDocId) {
 152  0
         workflowDocument.setAppDocId(appDocId);
 153  0
     }
 154  
 
 155  
     public String getAppDocId() {
 156  0
         return workflowDocument.getAppDocId();
 157  
     }
 158  
     
 159  
     public String getTitle() {
 160  0
         return workflowDocument.getTitle();
 161  
     }
 162  
     
 163  
     public String getInitiatorNetworkId() {
 164  0
             return KIMServiceLocator.getIdentityManagementService().getPrincipal(getInitiatorPrincipalId()).getPrincipalName();
 165  
     }
 166  
     
 167  
     public String getInitiatorPrincipalId() {
 168  0
             return workflowDocument.getRouteHeader().getInitiatorPrincipalId();
 169  
     }
 170  
     
 171  
     public String getRoutedByUserNetworkId() {
 172  0
             return KIMServiceLocator.getIdentityManagementService().getPrincipal(getRoutedByPrincipalId()).getPrincipalName();
 173  
     }
 174  
     
 175  
     public String getRoutedByPrincipalId() {
 176  0
             return workflowDocument.getRouteHeader().getRoutedByPrincipalId();
 177  
     }
 178  
 
 179  
     public void saveDocument(String annotation) throws WorkflowException {
 180  0
         workflowDocument.saveDocument(annotation);
 181  0
     }
 182  
 
 183  
     public void routeDocument(String annotation) throws WorkflowException {
 184  0
         workflowDocument.routeDocument(annotation);
 185  0
     }
 186  
 
 187  
     public void disapprove(String annotation) throws WorkflowException {
 188  0
         workflowDocument.disapprove(annotation);
 189  0
     }
 190  
 
 191  
     public void approve(String annotation) throws WorkflowException {
 192  0
         workflowDocument.approve(annotation);
 193  0
     }
 194  
 
 195  
     public void superUserApprove(String annotation) throws WorkflowException {
 196  0
         workflowDocument.superUserApprove(annotation);
 197  0
     }
 198  
 
 199  
     public void superUserActionRequestApprove(Long actionRequestId, String annotation) throws WorkflowException {
 200  0
         workflowDocument.superUserActionRequestApprove(actionRequestId, annotation);
 201  0
     }
 202  
 
 203  
     public void superUserCancel(String annotation) throws WorkflowException {
 204  0
         workflowDocument.superUserCancel(annotation);
 205  0
     }
 206  
 
 207  
     public void superUserDisapprove(String annotation) throws WorkflowException {
 208  0
         workflowDocument.superUserDisapprove(annotation);
 209  0
     }
 210  
 
 211  
     public void cancel(String annotation) throws WorkflowException {
 212  0
         workflowDocument.cancel(annotation);
 213  0
     }
 214  
 
 215  
     public void blanketApprove(String annotation) throws WorkflowException {
 216  0
         workflowDocument.blanketApprove(annotation);
 217  0
     }
 218  
 
 219  
     /**
 220  
      * 
 221  
      * @see org.kuali.rice.kns.workflow.service.KualiWorkflowDocument#blanketApprove(java.lang.String, java.lang.Integer)
 222  
      * @deprecated
 223  
      */
 224  
     @SuppressWarnings("deprecation")
 225  
     public void blanketApprove(String annotation, Integer routeLevel) throws WorkflowException {
 226  0
         workflowDocument.blanketApprove(annotation, routeLevel);
 227  0
     }
 228  
 
 229  
     public void saveRoutingData() throws WorkflowException {
 230  0
         workflowDocument.saveRoutingData();
 231  0
     }
 232  
 
 233  
     public void acknowledge(String annotation) throws WorkflowException {
 234  0
         workflowDocument.acknowledge(annotation);
 235  0
     }
 236  
 
 237  
     public void fyi() throws WorkflowException {
 238  0
         workflowDocument.fyi();
 239  0
     }
 240  
 
 241  
     public void delete() throws WorkflowException {
 242  0
         workflowDocument.delete();
 243  0
     }
 244  
 
 245  
     public void refreshContent() throws WorkflowException {
 246  0
         workflowDocument.refreshContent();
 247  0
     }
 248  
 
 249  
     public void adHocRouteDocumentToPrincipal(String actionRequested, String routeTypeName, String annotation, String principalId, String responsibilityDesc, boolean forceAction) throws WorkflowException {
 250  0
             workflowDocument.adHocRouteDocumentToPrincipal(actionRequested, routeTypeName, annotation, principalId, responsibilityDesc, forceAction);
 251  0
     }
 252  
 
 253  
     public void adHocRouteDocumentToGroup(String actionRequested, String routeTypeName, String annotation, String groupId, String responsibilityDesc, boolean forceAction) throws WorkflowException {
 254  0
         workflowDocument.adHocRouteDocumentToGroup(actionRequested, routeTypeName, annotation, groupId, responsibilityDesc, forceAction);
 255  0
     }
 256  
 
 257  
     public void adHocRouteDocumentToPrincipal(String actionRequested, String routeTypeName, String annotation, String principalId, String responsibilityDesc, boolean forceAction, String actionRequestLabel) throws WorkflowException {
 258  0
             workflowDocument.adHocRouteDocumentToPrincipal(actionRequested, routeTypeName, annotation, principalId, responsibilityDesc, forceAction, actionRequestLabel);
 259  0
     }
 260  
 
 261  
     public void adHocRouteDocumentToGroup(String actionRequested, String routeTypeName, String annotation, String groupId, String responsibilityDesc, boolean forceAction, String actionRequestLabel) throws WorkflowException {
 262  0
             workflowDocument.adHocRouteDocumentToGroup(actionRequested, routeTypeName, annotation, groupId, responsibilityDesc, forceAction, actionRequestLabel);
 263  0
     }
 264  
     
 265  
     public void setTitle(String title) throws WorkflowException {
 266  0
         workflowDocument.setTitle(title);
 267  0
     }
 268  
 
 269  
     public String getDocumentType() {
 270  0
         return workflowDocument.getDocumentType();
 271  
     }
 272  
 
 273  
     /**
 274  
      * @see org.kuali.rice.kns.workflow.service.KualiWorkflowDocument#isAdHocRequested()
 275  
      */
 276  
     public boolean isAdHocRequested() {
 277  0
         boolean isAdHocRequested = false;
 278  0
         Long routeHeaderId = null;
 279  0
         KualiWorkflowInfo workflowInfo = null;
 280  
         try {
 281  0
             routeHeaderId = getRouteHeaderId();
 282  0
             workflowInfo = KNSServiceLocator.getWorkflowInfoService();
 283  0
             String principalId = workflowDocument.getPrincipalId();
 284  0
             ActionRequestDTO[] actionRequests = workflowInfo.getActionRequests(routeHeaderId);
 285  0
             for (int actionRequestIndex = 0; actionRequestIndex < actionRequests.length; actionRequestIndex++) {
 286  0
                 if (actionRequests[actionRequestIndex].isActivated() && actionRequests[actionRequestIndex].isAdHocRequest()) {
 287  0
                     if (actionRequests[actionRequestIndex].isUserRequest() && principalId.equals(actionRequests[actionRequestIndex].getPrincipalId())) {
 288  0
                         isAdHocRequested = true;
 289  
                     }
 290  0
                     else if (actionRequests[actionRequestIndex].isGroupRequest()) {
 291  0
                             if (KIMServiceLocator.getIdentityManagementService().isMemberOfGroup(principalId, actionRequests[actionRequestIndex].getGroupId())) {
 292  0
                                     isAdHocRequested = true;
 293  
                             }
 294  
                     }
 295  
                 }
 296  
             }
 297  
         }
 298  0
         catch (WorkflowException e) {
 299  0
             throw new RuntimeException(new StringBuffer(getClass().getName()).append(" encountered an exception while attempting to get the actoins requests for routeHeaderId: ").append(routeHeaderId).toString(), e);
 300  0
         }
 301  0
         return isAdHocRequested;
 302  
     }
 303  
 
 304  
     /**
 305  
      * 
 306  
      * @see org.kuali.rice.kns.workflow.service.KualiWorkflowDocument#isAcknowledgeRequested()
 307  
      */
 308  
     public boolean isAcknowledgeRequested() {
 309  0
         return workflowDocument.isAcknowledgeRequested();
 310  
     }
 311  
 
 312  
     /**
 313  
      * 
 314  
      * @see org.kuali.rice.kns.workflow.service.KualiWorkflowDocument#isApprovalRequested()
 315  
      */
 316  
     public boolean isApprovalRequested() {
 317  0
         return workflowDocument.isApprovalRequested();
 318  
     }
 319  
 
 320  
     /**
 321  
      * 
 322  
      * @see org.kuali.rice.kns.workflow.service.KualiWorkflowDocument#isCompletionRequested()
 323  
      */
 324  
     public boolean isCompletionRequested() {
 325  0
         return workflowDocument.isCompletionRequested();
 326  
     }
 327  
 
 328  
     /**
 329  
      * 
 330  
      * @see org.kuali.rice.kns.workflow.service.KualiWorkflowDocument#isFYIRequested()
 331  
      */
 332  
     public boolean isFYIRequested() {
 333  0
         return workflowDocument.isFYIRequested();
 334  
     }
 335  
 
 336  
     /**
 337  
      * 
 338  
      * @see org.kuali.rice.kns.workflow.service.KualiWorkflowDocument#isBlanketApproveCapable()
 339  
      */
 340  
     public boolean isBlanketApproveCapable() {
 341  0
         return workflowDocument.isBlanketApproveCapable();
 342  
     }
 343  
 
 344  
     @SuppressWarnings("deprecation")
 345  
     public Integer getDocRouteLevel() {
 346  0
         return workflowDocument.getDocRouteLevel();
 347  
     }
 348  
 
 349  
     /**
 350  
      * @param annotation
 351  
      * @throws InvalidActionTakenException
 352  
      * @throws ResourceUnavailableException
 353  
      * @throws WorkflowException
 354  
      */
 355  
     public void complete(String annotation) throws WorkflowException {
 356  0
         workflowDocument.complete(annotation);
 357  0
     }
 358  
 
 359  
     /**
 360  
      * Performs the 'returnToPrevious' action on the document this WorkflowDocument represents.  If this is a new document,
 361  
      * the document is created first.
 362  
      * @param annotation the message to log for the action
 363  
      * @param nodeName the node to return to
 364  
      * @throws WorkflowException in case an error occurs returning to previous node
 365  
      * @see WorkflowDocumentActions#returnDocumentToPreviousNode(UserIdDTO, RouteHeaderDTO, ReturnPointDTO, String)
 366  
      */
 367  
     public void returnToPreviousNode(String annotation, String nodeName) throws WorkflowException {
 368  0
         workflowDocument.returnToPreviousNode(annotation, nodeName);
 369  0
     }
 370  
 
 371  
     /**
 372  
      * Performs the 'returnToPrevious' action on the document this WorkflowDocument represents.  If this is a new document,
 373  
      * the document is created first.
 374  
      * @param annotation the message to log for the action
 375  
      * @param ReturnPointDTO the node to return to
 376  
      * @throws WorkflowException in case an error occurs returning to previous node
 377  
      * @see WorkflowDocumentActions#returnDocumentToPreviousNode(UserIdDTO, RouteHeaderDTO, ReturnPointDTO, String)
 378  
      */
 379  
     public void returnToPreviousNode(String annotation, ReturnPointDTO returnPoint) throws WorkflowException {
 380  0
         workflowDocument.returnToPreviousNode(annotation, returnPoint);
 381  0
     }
 382  
 
 383  
     /**
 384  
      * @param annotation
 385  
      * @param destRouteLevel
 386  
      * @throws WorkflowException
 387  
      * @throws InvalidActionTakenException
 388  
      * @throws ResourceUnavailableException
 389  
      * @deprecated
 390  
      */
 391  
     @SuppressWarnings("deprecation")
 392  
     public void returnToPreviousRouteLevel(String annotation, Integer destRouteLevel) throws WorkflowException {
 393  0
         workflowDocument.returnToPreviousRouteLevel(annotation, destRouteLevel);
 394  0
     }
 395  
 
 396  
     public void logDocumentAction(String annotation) throws WorkflowException {
 397  0
         workflowDocument.logDocumentAction(annotation);
 398  0
     }
 399  
 
 400  
     /**
 401  
      * Indicates if the document is in the initated state or not.
 402  
      * 
 403  
      * @return true if in the specified state
 404  
      */
 405  
     public boolean stateIsInitiated() {
 406  0
         return workflowDocument.stateIsInitiated();
 407  
     }
 408  
 
 409  
     /**
 410  
      * Indicates if the document is in the saved state or not.
 411  
      * 
 412  
      * @return true if in the specified state
 413  
      */
 414  
     public boolean stateIsSaved() {
 415  0
         return workflowDocument.stateIsSaved();
 416  
     }
 417  
 
 418  
     /**
 419  
      * Indicates if the document is in the enroute state or not.
 420  
      * 
 421  
      * @return true if in the specified state
 422  
      */
 423  
     public boolean stateIsEnroute() {
 424  0
         return workflowDocument.stateIsEnroute();
 425  
     }
 426  
 
 427  
     /**
 428  
      * Indicates if the document is in the final state or not.
 429  
      * 
 430  
      * @return true if in the specified state
 431  
      */
 432  
     public boolean stateIsFinal() {
 433  0
         return workflowDocument.stateIsFinal();
 434  
     }
 435  
 
 436  
     /**
 437  
      * Indicates if the document is in the exception state or not.
 438  
      * 
 439  
      * @return true if in the specified state
 440  
      */
 441  
     public boolean stateIsException() {
 442  0
         return workflowDocument.stateIsException();
 443  
     }
 444  
 
 445  
     /**
 446  
      * Indicates if the document is in the canceled state or not.
 447  
      * 
 448  
      * @return true if in the specified state
 449  
      */
 450  
     public boolean stateIsCanceled() {
 451  0
         return workflowDocument.stateIsCanceled();
 452  
     }
 453  
 
 454  
     /**
 455  
      * Indicates if the document is in the disapproved state or not.
 456  
      * 
 457  
      * @return true if in the specified state
 458  
      */
 459  
     public boolean stateIsDisapproved() {
 460  0
         return workflowDocument.stateIsDisapproved();
 461  
     }
 462  
 
 463  
     /**
 464  
      * Indicates if the document is in the approved state or not. Will answer true is document is in Processed or Finalized state.
 465  
      * 
 466  
      * @return true if in the specified state
 467  
      */
 468  
     public boolean stateIsApproved() {
 469  0
         return workflowDocument.stateIsApproved();
 470  
     }
 471  
 
 472  
     /**
 473  
      * Indicates if the document is in the processed state or not.
 474  
      * 
 475  
      * @return true if in the specified state
 476  
      */
 477  
     public boolean stateIsProcessed() {
 478  0
         return workflowDocument.stateIsProcessed();
 479  
     }
 480  
 
 481  
     public String getStatusDisplayValue() {
 482  0
         return workflowDocument.getStatusDisplayValue();
 483  
     }
 484  
 
 485  
     public Timestamp getCreateDate() {
 486  0
         return workflowDocument.getDateCreated();
 487  
     }
 488  
 
 489  
 
 490  
     /**
 491  
      * 
 492  
      * @see org.kuali.rice.kns.workflow.service.KualiWorkflowDocument#userIsInitiator(org.kuali.rice.kns.bo.user.KualiUser)
 493  
      */
 494  
     public boolean userIsInitiator(Person user) {
 495  0
         if (user == null) {
 496  0
             throw new IllegalArgumentException("invalid (null) user");
 497  
         }
 498  
 
 499  0
         return StringUtils.equalsIgnoreCase(getInitiatorPrincipalId(), user.getPrincipalId());
 500  
     }
 501  
 
 502  
     /**
 503  
      * 
 504  
      * @see org.kuali.rice.kns.workflow.service.KualiWorkflowDocument#userIsRoutedByUser(org.kuali.rice.kns.bo.user.KualiUser)
 505  
      */
 506  
     public boolean userIsRoutedByUser(Person user) {
 507  0
         if (user == null) {
 508  0
             throw new IllegalArgumentException("invalid (null) user");
 509  
         }
 510  
 
 511  0
         return StringUtils.equalsIgnoreCase(getRoutedByPrincipalId(), user.getPrincipalId());
 512  
     }
 513  
 
 514  
     public String[] getNodeNames() throws WorkflowException {
 515  0
         return workflowDocument.getNodeNames();
 516  
     }
 517  
 
 518  
     public String getCurrentRouteNodeNames() {
 519  0
         return workflowDocument.getRouteHeader().getCurrentRouteNodeNames();
 520  
     }
 521  
 
 522  
     public boolean isStandardSaveAllowed() {
 523  0
         return workflowDocument.isActionCodeValidForDocument(KEWConstants.ACTION_TAKEN_SAVED_CD);
 524  
     }
 525  
 
 526  
     public void setReceiveFutureRequests() throws WorkflowException {
 527  0
         workflowDocument.setReceiveFutureRequests();
 528  0
     }
 529  
     
 530  
     public void setDoNotReceiveFutureRequests() throws WorkflowException {
 531  0
         workflowDocument.setDoNotReceiveFutureRequests();
 532  0
     }
 533  
     
 534  
     public void setClearFutureRequests() throws WorkflowException {
 535  0
         workflowDocument.setClearFutureRequests();  
 536  0
     }
 537  
     
 538  
     /**
 539  
      * @see java.lang.Object#toString()
 540  
      */
 541  
     public String toString() {
 542  0
         ArrayList trueFlags = new ArrayList();
 543  0
         if (isAcknowledgeRequested()) {
 544  0
             trueFlags.add("acknowledgeRequested");
 545  
         }
 546  0
         if (isApprovalRequested()) {
 547  0
             trueFlags.add("approvalRequested");
 548  
         }
 549  0
         if (isBlanketApproveCapable()) {
 550  0
             trueFlags.add("blanketApproveCapable");
 551  
         }
 552  0
         if (isCompletionRequested()) {
 553  0
             trueFlags.add("completionRequested");
 554  
         }
 555  0
         if (isFYIRequested()) {
 556  0
             trueFlags.add("FYIRequested");
 557  
         }
 558  
 
 559  0
         if (stateIsApproved()) {
 560  0
             trueFlags.add("stateIsApproved");
 561  
         }
 562  0
         if (stateIsCanceled()) {
 563  0
             trueFlags.add("stateIsCanceled");
 564  
         }
 565  0
         if (stateIsDisapproved()) {
 566  0
             trueFlags.add("stateIsDisapproved");
 567  
         }
 568  0
         if (stateIsEnroute()) {
 569  0
             trueFlags.add("stateIsEnroute");
 570  
         }
 571  0
         if (stateIsException()) {
 572  0
             trueFlags.add("stateIsException");
 573  
         }
 574  0
         if (stateIsFinal()) {
 575  0
             trueFlags.add("stateIsFinal");
 576  
         }
 577  0
         if (stateIsInitiated()) {
 578  0
             trueFlags.add("stateIsInitiated");
 579  
         }
 580  0
         if (stateIsProcessed()) {
 581  0
             trueFlags.add("stateIsProcessed");
 582  
         }
 583  0
         if (stateIsSaved()) {
 584  0
             trueFlags.add("stateIsSaved");
 585  
         }
 586  
 
 587  0
         StringBuffer b = new StringBuffer("true flags=(");
 588  0
         for (Iterator i = trueFlags.iterator(); i.hasNext();) {
 589  0
             b.append(i.next());
 590  0
             if (i.hasNext()) {
 591  0
                 b.append(",");
 592  
             }
 593  
         }
 594  0
         b.append(")");
 595  
 
 596  0
         return b.toString();
 597  
     }
 598  
 
 599  
     /**
 600  
      * @see org.kuali.rice.kns.workflow.service.KualiWorkflowDocument#getAllPriorApprovers()
 601  
      */
 602  
     public Set<Person> getAllPriorApprovers() throws WorkflowException {
 603  0
         org.kuali.rice.kim.service.PersonService personService = org.kuali.rice.kim.service.KIMServiceLocator.getPersonService();
 604  0
         ActionTakenDTO[] actionsTaken = workflowDocument.getActionsTaken();
 605  0
         Set<String> principalIds = new HashSet<String>();
 606  0
         Set<Person> persons = new HashSet<Person>();
 607  
         
 608  0
         for (ActionTakenDTO actionTaken : actionsTaken) {
 609  0
             if (KEWConstants.ACTION_TAKEN_APPROVED_CD.equals(actionTaken.getActionTaken())) {
 610  0
                 String principalId = actionTaken.getPrincipalId();
 611  0
                 if (!principalIds.contains(principalId)) {
 612  0
                     principalIds.add(principalId);
 613  0
                     persons.add(personService.getPerson(principalId));
 614  
                 }
 615  
             }
 616  
         }
 617  0
         return persons;
 618  
     }
 619  
 }