Coverage Report - org.kuali.rice.kew.rule.web.DocumentConfigurationViewAction
 
Classes in this File Line Coverage Branch Coverage Complexity
DocumentConfigurationViewAction
0%
0/174
0%
0/84
2.314
DocumentConfigurationViewAction$PermissionForDisplay
0%
0/13
N/A
2.314
DocumentConfigurationViewAction$ResponsibilityForDisplay
0%
0/13
N/A
2.314
 
 1  
 /*
 2  
  * Copyright 2008-2009 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.kew.rule.web;
 17  
 
 18  
 import org.apache.commons.lang.StringUtils;
 19  
 import org.apache.log4j.Logger;
 20  
 import org.apache.struts.action.ActionForm;
 21  
 import org.apache.struts.action.ActionForward;
 22  
 import org.apache.struts.action.ActionMapping;
 23  
 import org.kuali.rice.core.api.criteria.Predicate;
 24  
 import org.kuali.rice.core.api.criteria.QueryByCriteria;
 25  
 import org.kuali.rice.kew.doctype.bo.DocumentType;
 26  
 import org.kuali.rice.kew.doctype.service.DocumentTypeService;
 27  
 import org.kuali.rice.kew.engine.node.RouteNode;
 28  
 import org.kuali.rice.kew.engine.node.service.RouteNodeService;
 29  
 import org.kuali.rice.kew.service.KEWServiceLocator;
 30  
 import org.kuali.rice.kew.util.KEWConstants;
 31  
 import org.kuali.rice.kew.web.KewKualiAction;
 32  
 import org.kuali.rice.kim.api.permission.Permission;
 33  
 import org.kuali.rice.kim.api.responsibility.Responsibility;
 34  
 import org.kuali.rice.kim.api.responsibility.ResponsibilityService;
 35  
 import org.kuali.rice.kim.api.role.Role;
 36  
 import org.kuali.rice.kim.api.role.RoleService;
 37  
 import org.kuali.rice.kim.api.services.KimApiServiceLocator;
 38  
 import org.kuali.rice.kim.bo.impl.KimAttributes;
 39  
 import org.kuali.rice.kim.bo.role.impl.KimPermissionImpl;
 40  
 import org.kuali.rice.kim.impl.permission.PermissionBo;
 41  
 import org.kuali.rice.kim.impl.permission.PermissionTemplateBo;
 42  
 import org.kuali.rice.kim.impl.responsibility.ResponsibilityBo;
 43  
 import org.kuali.rice.kim.service.PermissionService;
 44  
 import org.kuali.rice.kim.util.KimConstants;
 45  
 import org.kuali.rice.kns.service.KNSServiceLocator;
 46  
 import org.kuali.rice.kns.service.MaintenanceDocumentDictionaryService;
 47  
 import org.kuali.rice.krad.service.DataDictionaryService;
 48  
 import org.kuali.rice.krad.service.DocumentHelperService;
 49  
 import org.kuali.rice.krad.service.KRADServiceLocatorWeb;
 50  
 import org.kuali.rice.krad.util.GlobalVariables;
 51  
 import org.kuali.rice.krad.util.KRADConstants;
 52  
 
 53  
 import javax.servlet.http.HttpServletRequest;
 54  
 import javax.servlet.http.HttpServletResponse;
 55  
 import java.util.ArrayList;
 56  
 import java.util.Collections;
 57  
 import java.util.HashMap;
 58  
 import java.util.HashSet;
 59  
 import java.util.LinkedHashMap;
 60  
 import java.util.List;
 61  
 import java.util.Map;
 62  
 import java.util.Set;
 63  
 
 64  
 import static org.kuali.rice.core.api.criteria.PredicateFactory.and;
 65  
 import static org.kuali.rice.core.api.criteria.PredicateFactory.equal;
 66  
 
 67  
 /**
 68  
  * This is a description of what this class does - kellerj don't forget to fill this in. 
 69  
  * 
 70  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 71  
  *
 72  
  */
 73  0
 public class DocumentConfigurationViewAction extends KewKualiAction {
 74  
 
 75  0
         private static final Logger LOG = Logger.getLogger(DocumentConfigurationViewAction.class);
 76  
         
 77  
         private PermissionService permissionService;
 78  
         private RoleService roleService;
 79  
         private ResponsibilityService responsibilityService;
 80  
         private DocumentTypeService documentTypeService;
 81  
         private DataDictionaryService dataDictionaryService;
 82  
         private RouteNodeService routeNodeService;
 83  
         private MaintenanceDocumentDictionaryService maintenanceDocumentDictionaryService;
 84  
         private DocumentHelperService documentHelperService;
 85  
         
 86  
     public ActionForward start(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
 87  0
             populateForm( (DocumentConfigurationViewForm)form );
 88  0
         return mapping.findForward("basic");
 89  
     }
 90  
     
 91  
     protected void populateForm( DocumentConfigurationViewForm form ) {
 92  0
             if ( StringUtils.isNotEmpty( form.getDocumentTypeName() ) ) {
 93  0
                     form.setDocumentType( getDocumentTypeService().findByName( form.getDocumentTypeName() ) ); 
 94  0
                 if ( form.getDocumentType() != null ) {
 95  0
                             form.getDocumentType().getChildrenDocTypes();
 96  0
                             form.setAttributeLabels( new HashMap<String, String>() );
 97  0
                             populateRelatedDocuments( form );
 98  0
                             populatePermissions( form );
 99  0
                             populateRoutingResponsibilities( form );
 100  0
                             populateRoutingExceptionResponsibility( form );
 101  0
                             checkPermissions( form );
 102  
                 }
 103  
             }
 104  0
     }
 105  
 
 106  
     protected void checkPermissions( DocumentConfigurationViewForm form ) {
 107  0
             String docTypeDocumentType = getMaintenanceDocumentDictionaryService().getDocumentTypeName(DocumentType.class);
 108  
         try {
 109  0
             if ((docTypeDocumentType != null) && getDocumentHelperService().getDocumentAuthorizer(docTypeDocumentType).canInitiate(docTypeDocumentType, GlobalVariables.getUserSession().getPerson())) {
 110  0
                 form.setCanInitiateDocumentTypeDocument( true );
 111  
             }
 112  0
         } catch (Exception ex) {
 113  
                         // just skip - and don't display links
 114  0
                 LOG.error( "Unable to check DocumentType initiation permission for "+ docTypeDocumentType, ex );
 115  0
                 }
 116  0
             String permissionDocumentType = getMaintenanceDocumentDictionaryService().getDocumentTypeName(KimPermissionImpl.class);
 117  
         try {
 118  0
             if ((permissionDocumentType != null) && getDocumentHelperService().getDocumentAuthorizer(permissionDocumentType).canInitiate(permissionDocumentType, GlobalVariables.getUserSession().getPerson())) {
 119  0
                 form.setCanInitiatePermissionDocument( true );
 120  
             }
 121  0
         } catch (Exception ex) {
 122  
                         // just skip - and don't display links
 123  0
                 LOG.error( "Unable to check Permission initiation permission for "+ permissionDocumentType, ex );
 124  0
                 }
 125  0
             String responsibilityDocumentType = getMaintenanceDocumentDictionaryService().getDocumentTypeName(ResponsibilityBo.class);
 126  
         try {
 127  0
             if ((responsibilityDocumentType != null) && getDocumentHelperService().getDocumentAuthorizer(responsibilityDocumentType).canInitiate(responsibilityDocumentType, GlobalVariables.getUserSession().getPerson())) {
 128  0
                 form.setCanInitiateResponsibilityDocument( true );
 129  
             }
 130  0
         } catch (Exception ex) {
 131  
                         // just skip - and don't display links
 132  0
                 LOG.error( "Unable to check Responsibility initiation permission for "+ responsibilityDocumentType, ex );
 133  0
                 }
 134  0
     }
 135  
     
 136  
     @SuppressWarnings("unchecked")
 137  
         public void populateRelatedDocuments( DocumentConfigurationViewForm form ) {
 138  0
             form.setParentDocumentType( form.getDocumentType().getParentDocType() );
 139  0
             form.setChildDocumentTypes( new ArrayList<DocumentType>( form.getDocumentType().getChildrenDocTypes() ) );
 140  0
     }
 141  
     
 142  
         public void populatePermissions( DocumentConfigurationViewForm form ) {
 143  
                 
 144  0
                 DocumentType docType = form.getDocumentType();
 145  0
                 Map<String,List<Role>> permRoles = new HashMap<String, List<Role>>();
 146  0
                 Map<String,String> searchCriteria = new HashMap<String,String>();
 147  0
                 searchCriteria.put("attributeName", "documentTypeName" );
 148  0
                 searchCriteria.put("active", "Y");
 149  
                 // loop over the document hierarchy
 150  0
                 Set<String> seenDocumentPermissions = new HashSet<String>();
 151  0
                 while ( docType != null) {
 152  0
                         String documentTypeName = docType.getName();
 153  0
                         searchCriteria.put("detailCriteria",
 154  
                                         KimConstants.AttributeConstants.DOCUMENT_TYPE_NAME+"="+docType.getName()
 155  
                                         );
 156  0
                         List<Permission> perms = getPermissionService().lookupPermissions(searchCriteria, true);
 157  0
                         for ( Permission perm : perms ) {
 158  0
                 PermissionBo permBo = PermissionBo.from(perm);
 159  0
                                 List<String> roleIds = getPermissionService().getRoleIdsForPermissions(Collections.singletonList(perm));
 160  0
                                 permRoles.put( perm.getId(), getRoleService().getRoles(roleIds) );
 161  0
                                 for ( String attributeName : permBo.getDetails().keySet() ) {
 162  0
                                         addAttributeLabel(form, attributeName);
 163  
                                 }
 164  0
                         }
 165  
                         // show the section if the current document or permissions exist
 166  0
                         if ( perms.size() > 0 || documentTypeName.equals( form.getDocumentTypeName() ) ) {
 167  0
                                 ArrayList<PermissionForDisplay> dispPerms = new ArrayList<PermissionForDisplay>( perms.size() );
 168  0
                                 for ( Permission perm : perms ) {
 169  0
                     PermissionBo permBo = PermissionBo.from(perm);
 170  0
                                         if ( permBo.getDetails().size() == 1  ) { // only the document type
 171  
                                                 // this is a document type-specific permission, check if seen earlier
 172  0
                                                 if ( seenDocumentPermissions.contains(perm.getTemplate().getNamespaceCode()+"|"+perm.getTemplate().getName()) ) {
 173  0
                                                         dispPerms.add( new PermissionForDisplay( permBo, true ) );
 174  
                                                 } else {
 175  0
                                                         dispPerms.add( new PermissionForDisplay( permBo, false ) );
 176  0
                                                         seenDocumentPermissions.add(perm.getTemplate().getNamespaceCode()+"|"+perm.getTemplate().getName());
 177  
                                                 }
 178  
                                         } else {
 179  
                                                 // other attributes, can't determine whether this is overridden at another level
 180  0
                                                 dispPerms.add( new PermissionForDisplay( permBo, false ) );
 181  
                                         }
 182  0
                                 }
 183  0
                                 form.setPermissionsForDocumentType(documentTypeName, dispPerms );
 184  0
                                 form.addDocumentType(documentTypeName);
 185  
                         }
 186  0
                         docType = docType.getParentDocType();                        
 187  0
                 }
 188  
                 
 189  0
                 form.setPermissionRoles( permRoles );
 190  0
         }
 191  
         
 192  
         protected void populateRoutingExceptionResponsibility( DocumentConfigurationViewForm form ) {        
 193  0
                 DocumentType docType = form.getDocumentType();
 194  0
                 List<ResponsibilityForDisplay> responsibilities = new ArrayList<ResponsibilityForDisplay>();
 195  0
                 while ( docType != null) {
 196  0
             QueryByCriteria.Builder builder = QueryByCriteria.Builder.create();
 197  0
             Predicate p = and(
 198  
                 equal("template.namespaceCode", KRADConstants.KUALI_RICE_WORKFLOW_NAMESPACE),
 199  
                 equal("template.name", KEWConstants.EXCEPTION_ROUTING_RESPONSIBILITY_TEMPLATE_NAME),
 200  
                 equal("active", "Y"),
 201  
                 equal("attributes[documentTypeName]", docType.getName())
 202  
             );
 203  0
             builder.setPredicates(p);
 204  0
                         List<Responsibility> resps = getResponsibilityService().findResponsibilities(builder.build()).getResults();
 205  
                         
 206  0
                         for ( Responsibility r : resps ) {
 207  0
                                 if ( responsibilities.isEmpty() ) {
 208  0
                                         responsibilities.add( new ResponsibilityForDisplay( r, false ) );
 209  
                                 } else {
 210  0
                                         responsibilities.add( new ResponsibilityForDisplay( r, true ) );
 211  
                                 }
 212  
                         }
 213  0
                         docType = docType.getParentDocType();                        
 214  0
                 }
 215  0
                 form.setExceptionResponsibilities( responsibilities );
 216  0
                 for ( ResponsibilityForDisplay responsibility : responsibilities ) {
 217  0
                         List<String> roleIds = getResponsibilityService().getRoleIdsForResponsibility(responsibility.getResp().getId(), null);
 218  0
                         form.getResponsibilityRoles().put( responsibility.getResponsibilityId(), getRoleService().getRoles(roleIds) );
 219  0
                 }
 220  0
         }
 221  
 
 222  
         protected void addAttributeLabel( DocumentConfigurationViewForm form, String attributeName ) {
 223  0
                 if ( !form.getAttributeLabels().containsKey(attributeName) ) {
 224  0
                         form.getAttributeLabels().put(attributeName, 
 225  
                                         getDataDictionaryService().getAttributeLabel(KimAttributes.class, attributeName) );
 226  
                 }
 227  0
         }
 228  
         
 229  
         // loop over nodes
 230  
         // if split node, push onto stack
 231  
                 // note the number of children, this is the number of times the join node needs to be found
 232  
         // when join node found, return to last split on stack
 233  
                 // move to next child of the split
 234  
         
 235  
         protected RouteNode flattenSplitNode( RouteNode splitNode, Map<String,RouteNode> nodes ) {
 236  0
                 nodes.put( splitNode.getRouteNodeName(), splitNode );
 237  0
                 RouteNode joinNode = null;
 238  
                 
 239  0
                 for ( RouteNode nextNode : splitNode.getNextNodes() ) {
 240  0
                         joinNode = flattenRouteNodes(nextNode, nodes);
 241  
                 }
 242  
                 
 243  0
                 if ( joinNode != null ) {
 244  0
                         nodes.put( joinNode.getRouteNodeName(), joinNode );
 245  
                 }
 246  0
                 return joinNode;
 247  
         }
 248  
         
 249  
         /**
 250  
          * @param node
 251  
          * @param nodes
 252  
          * @return The last node processed by this method.
 253  
          */
 254  
         protected RouteNode flattenRouteNodes( RouteNode node, Map<String,RouteNode> nodes ) {
 255  0
                 RouteNode lastProcessedNode = null;
 256  
                 // if we've seen the node before - skip, avoids infinite loop
 257  0
                 if ( nodes.containsKey(node.getRouteNodeName()) ) {
 258  0
                         return node;
 259  
                 }
 260  
                 
 261  0
                 if ( node.getNodeType().contains( "SplitNode" ) ) { // Hacky - but only way when the class may not be present in the KEW JVM
 262  0
                         lastProcessedNode = flattenSplitNode(node, nodes); // special handling to process all split children before continuing
 263  
                         // now, process the join node's children
 264  0
                         for ( RouteNode nextNode : lastProcessedNode.getNextNodes() ) {
 265  0
                                 lastProcessedNode = flattenRouteNodes(nextNode, nodes);
 266  
                         }
 267  0
                 } else if ( node.getNodeType().contains( "JoinNode" ) ) {
 268  0
                         lastProcessedNode = node; // skip, handled by the split node
 269  
                 } else {
 270  
                         // normal node, add to list and process all children
 271  0
                         nodes.put(node.getRouteNodeName(), node);
 272  0
                         for ( RouteNode nextNode : node.getNextNodes() ) {
 273  0
                                 lastProcessedNode = flattenRouteNodes(nextNode, nodes);
 274  
                         }
 275  
                 }
 276  0
                 return lastProcessedNode;
 277  
         }
 278  
         
 279  
         @SuppressWarnings("unchecked")
 280  
         public void populateRoutingResponsibilities( DocumentConfigurationViewForm form ) {
 281  
                 // pull all the responsibilities
 282  
                 // merge the data and attach to route levels
 283  
                 // pull the route levels and store on form
 284  
                 //List<RouteNode> routeNodes = getRouteNodeService().getFlattenedNodes(form.getDocumentType(), true);
 285  0
                 RouteNode rootNode = ((List<org.kuali.rice.kew.engine.node.Process>)form.getDocumentType().getProcesses()).get(0).getInitialRouteNode();
 286  0
                 LinkedHashMap<String, RouteNode> routeNodeMap = new LinkedHashMap<String, RouteNode>();
 287  0
                 flattenRouteNodes(rootNode, routeNodeMap);
 288  
                 
 289  0
                 form.setRouteNodes( new ArrayList<RouteNode>( routeNodeMap.values() ) );
 290  
                 // pull all the responsibilities and store into a map for use by the JSP
 291  
                 
 292  
                 // FILTER TO THE "Review" template only
 293  
                 // pull responsibility roles
 294  0
                 DocumentType docType = form.getDocumentType();
 295  0
                 Set<Responsibility> responsibilities = new HashSet<Responsibility>();
 296  0
                 Map<String,List<ResponsibilityForDisplay>> nodeToRespMap = new LinkedHashMap<String, List<ResponsibilityForDisplay>>();
 297  0
                 while ( docType != null) {
 298  0
             QueryByCriteria.Builder builder = QueryByCriteria.Builder.create();
 299  0
             Predicate p = and(
 300  
                 equal("template.namespaceCode", KRADConstants.KUALI_RICE_WORKFLOW_NAMESPACE),
 301  
                 equal("template.name", KEWConstants.DEFAULT_RESPONSIBILITY_TEMPLATE_NAME),
 302  
                 equal("active", "Y"),
 303  
                 equal("attributes[documentTypeName]", docType.getName())
 304  
             );
 305  0
             builder.setPredicates(p);
 306  0
                         List<Responsibility> resps = getResponsibilityService().findResponsibilities(builder.build()).getResults();
 307  
                         
 308  0
                         for ( Responsibility r : resps ) {
 309  0
                                 String routeNodeName = r.getAttributes().get(KimConstants.AttributeConstants.ROUTE_NODE_NAME);
 310  0
                                 if ( StringUtils.isNotBlank(routeNodeName) ) {
 311  0
                                         if ( !nodeToRespMap.containsKey( routeNodeName ) ) {
 312  0
                                                 nodeToRespMap.put(routeNodeName, new ArrayList<ResponsibilityForDisplay>() );
 313  0
                                                 nodeToRespMap.get(routeNodeName).add( new ResponsibilityForDisplay( r, false ) );
 314  
                                         } else {
 315  
                                                 // check if the responsibility in the existing list is for the current document
 316  
                                                 // if so, OK to add.  Otherwise, a lower level document has overridden this
 317  
                                                 // responsibility (since we are walking up the hierarchy
 318  0
                                                 if ( nodeToRespMap.get(routeNodeName).get(0).getDetails().get( KimConstants.AttributeConstants.DOCUMENT_TYPE_NAME ).equals(docType.getName() ) ) {
 319  0
                                                         nodeToRespMap.get(routeNodeName).add( new ResponsibilityForDisplay( r, false ) );
 320  
                                                 } else { // doc type name did not match, mark as overridden
 321  0
                                                         nodeToRespMap.get(routeNodeName).add( new ResponsibilityForDisplay( r, true ) );
 322  
                                                 }
 323  
                                         }
 324  0
                                         responsibilities.add(r);
 325  
                                 }
 326  0
                         }
 327  0
                         docType = docType.getParentDocType();                        
 328  0
                 }
 329  0
                 form.setResponsibilityMap( nodeToRespMap );
 330  
                 
 331  0
                 Map<String,List<Role>> respToRoleMap = new HashMap<String, List<Role>>();
 332  0
                 for (Responsibility responsibility : responsibilities ) {
 333  0
                         List<String> roleIds = getResponsibilityService().getRoleIdsForResponsibility(responsibility.getId(), null);
 334  0
                         respToRoleMap.put( responsibility.getId(), getRoleService().getRoles(roleIds) );
 335  0
                 }
 336  0
                 form.setResponsibilityRoles( respToRoleMap );
 337  0
         }
 338  
         
 339  
         /**
 340  
          * @see org.kuali.rice.krad.web.struts.action.KualiAction#toggleTab(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
 341  
          */
 342  
         @Override
 343  
         public ActionForward toggleTab(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
 344  
                 // Repopulating the form is necessary when toggling tab states on the server side.
 345  0
                 ActionForward actionForward = super.toggleTab(mapping, form, request, response);
 346  0
                 populateForm( (DocumentConfigurationViewForm)form );
 347  0
                 return actionForward;
 348  
         }
 349  
 
 350  
         /**
 351  
          * Internal delegate class to wrap a responsibility and add an overridden flag.
 352  
          */
 353  
         public static class ResponsibilityForDisplay {
 354  
 
 355  
                 private Responsibility resp;
 356  0
                 private boolean overridden = false;
 357  
                 
 358  0
                 public ResponsibilityForDisplay( Responsibility resp, boolean overridden ) {
 359  0
                         this.resp = resp;
 360  0
                         this.overridden = overridden;
 361  0
                 }
 362  
                 
 363  
                 /**
 364  
                  * @return the resp
 365  
                  */
 366  
                 Responsibility getResp() {
 367  0
                         return this.resp;
 368  
                 }
 369  
                 
 370  
                 public boolean isOverridden() {
 371  0
                         return this.overridden;
 372  
                 }
 373  
 
 374  
                 public void setOverridden(boolean overridden) {
 375  0
                         this.overridden = overridden;
 376  0
                 }
 377  
 
 378  
                 public Map<String, String> getDetails() {
 379  0
                         return new HashMap<String, String>(this.resp.getAttributes());
 380  
                 }
 381  
 
 382  
                 public String getName() {
 383  0
                         return this.resp.getName();
 384  
                 }
 385  
 
 386  
                 public String getNamespaceCode() {
 387  0
                         return this.resp.getNamespaceCode();
 388  
                 }
 389  
 
 390  
                 public String getResponsibilityId() {
 391  0
                         return this.resp.getId();
 392  
                 }
 393  
         }
 394  
 
 395  0
         public static class PermissionForDisplay {
 396  
                 private PermissionBo perm;
 397  0
                 private boolean overridden = false;
 398  
                 
 399  0
                 public PermissionForDisplay( PermissionBo perm, boolean overridden ) {
 400  0
                         this.perm = perm;
 401  0
                         this.overridden = overridden;
 402  0
                 }
 403  
                 public boolean isOverridden() {
 404  0
                         return this.overridden;
 405  
                 }
 406  
 
 407  
                 public void setOverridden(boolean overridden) {
 408  0
                         this.overridden = overridden;
 409  0
                 }
 410  
                 public Map<String, String> getDetails() {
 411  0
                         return this.perm.getDetails();
 412  
                 }
 413  
                 public String getName() {
 414  0
                         return this.perm.getName();
 415  
                 }
 416  
                 public String getNamespaceCode() {
 417  0
                         return this.perm.getNamespaceCode();
 418  
                 }
 419  
                 public String getPermissionId() {
 420  0
                         return this.perm.getId();
 421  
                 }
 422  
                 public PermissionTemplateBo getTemplate() {
 423  0
                         return this.perm.getTemplate();
 424  
                 }
 425  
                 
 426  
         }
 427  
         
 428  
         /**
 429  
          * @return the permissionService
 430  
          */
 431  
         public PermissionService getPermissionService() {
 432  0
                 if ( permissionService == null ) {
 433  0
                         permissionService = KimApiServiceLocator.getPermissionService();
 434  
                 }
 435  0
                 return permissionService;
 436  
         }
 437  
 
 438  
         /**
 439  
          * @return the roleService
 440  
          */
 441  
         public RoleService getRoleService() {
 442  0
                 if ( roleService == null ) {
 443  0
                         roleService = KimApiServiceLocator.getRoleService();
 444  
                 }
 445  0
                 return roleService;
 446  
         }
 447  
 
 448  
         /**
 449  
          * @return the responsibilityService
 450  
          */
 451  
         public ResponsibilityService getResponsibilityService() {
 452  0
                 if ( responsibilityService == null ) {
 453  0
                         responsibilityService = KimApiServiceLocator.getResponsibilityService();
 454  
                 }
 455  0
                 return responsibilityService;
 456  
         }
 457  
 
 458  
         /**
 459  
          * @return the documentTypeService
 460  
          */
 461  
         public DocumentTypeService getDocumentTypeService() {
 462  0
                 if ( documentTypeService == null ) {
 463  0
                         documentTypeService = KEWServiceLocator.getDocumentTypeService();
 464  
                 }
 465  0
                 return documentTypeService;
 466  
         }
 467  
 
 468  
         public DataDictionaryService getDataDictionaryService() {
 469  0
                 if(dataDictionaryService == null){
 470  0
                         dataDictionaryService = KRADServiceLocatorWeb.getDataDictionaryService();
 471  
                 }
 472  0
                 return dataDictionaryService;
 473  
         }
 474  
 
 475  
         public RouteNodeService getRouteNodeService() {
 476  0
                 if ( routeNodeService == null ) {
 477  0
                         routeNodeService = KEWServiceLocator.getRouteNodeService();
 478  
                 }
 479  0
                 return routeNodeService;
 480  
         }
 481  
 
 482  
         public DocumentHelperService getDocumentHelperService() {
 483  0
                 if(documentHelperService == null){
 484  0
                         documentHelperService = KRADServiceLocatorWeb.getDocumentHelperService();
 485  
                 }
 486  0
                 return documentHelperService;
 487  
         }
 488  
 
 489  
         public MaintenanceDocumentDictionaryService getMaintenanceDocumentDictionaryService() {
 490  0
                 if(maintenanceDocumentDictionaryService == null){
 491  0
                         maintenanceDocumentDictionaryService = KNSServiceLocator.getMaintenanceDocumentDictionaryService();
 492  
                 }
 493  0
                 return maintenanceDocumentDictionaryService;
 494  
         }
 495  
         
 496  
 }