001 /**
002 * Copyright 2005-2011 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016 package org.kuali.rice.kew.rule;
017
018 import java.util.ArrayList;
019 import java.util.List;
020
021 import org.kuali.rice.kew.api.identity.Id;
022 import org.kuali.rice.kew.api.rule.RoleName;
023 import org.kuali.rice.kew.engine.RouteContext;
024 import org.kuali.rice.kew.routeheader.DocumentContent;
025 import org.kuali.rice.kew.workgroup.GroupNameId;
026
027
028 /**
029 * A workgroup role attribute which resolves to workgroups with empty ids. This
030 * should result in an error being thrown from the engine.
031 *
032 * @author Kuali Rice Team (rice.collab@kuali.org)
033 */
034 public class TestBadWorkgroupRoleAttribute extends AbstractRoleAttribute {
035
036 private static final long serialVersionUID = -8319714644552979100L;
037
038
039 public List<RoleName> getRoleNames() {
040 List<RoleName> roles = new ArrayList<RoleName>();
041 roles.add(new RoleName(getClass().getName(), "workgroup", "workgroup label"));
042 return roles;
043 }
044
045 public List<String> getQualifiedRoleNames(String roleName, DocumentContent documentContent) {
046 List<String> qualRoleNames = new ArrayList<String>();
047 qualRoleNames.add("TestWorkgroup");
048 return qualRoleNames;
049 }
050
051
052 public ResolvedQualifiedRole resolveQualifiedRole(RouteContext routeContext, String roleName, String qualifiedRole) {
053 List<Id> recipients = new ArrayList<Id>();
054 recipients.add(new GroupNameId(null));
055 recipients.add(new GroupNameId(""));
056 return new ResolvedQualifiedRole("workgroup role label", recipients);
057 }
058
059
060
061 }