1 5 package mc.formgenerator.servlets.bonita; 6 7 import hero.interfaces.ProjectSessionLocalHome; 8 import hero.interfaces.UserSessionLocalHome; 9 import hero.util.HeroException; 10 import hero.util.StrutsNodeValue; 11 12 import java.util.Collection ; 13 import java.util.Hashtable ; 14 import java.util.Iterator ; 15 import java.util.Vector ; 16 17 import javax.ejb.CreateException ; 18 import javax.naming.NamingException ; 19 20 import mc.formgenerator.bonita.Worklist; 21 22 27 public class ModelWorkList { 28 29 private Vector workList; 31 32 33 37 public ModelWorkList(){ 38 this.setWorkList(new Vector ()); 39 } 40 41 42 43 44 50 public void process() 51 throws CreateException , NamingException , HeroException{ 52 53 hero.interfaces.UserSessionLocalHome userh = (UserSessionLocalHome)hero.interfaces.UserSessionUtil.getLocalHome(); 55 hero.interfaces.UserSessionLocal usersession = userh.create(); 56 hero.interfaces.ProjectSessionLocalHome projecth = (ProjectSessionLocalHome)hero.interfaces.ProjectSessionUtil.getLocalHome(); 57 58 Collection projects = usersession.getProjectList(); 60 Iterator i = projects.iterator(); 61 62 while (i.hasNext()){ 63 64 Worklist currentWorkList = new Worklist(); 65 66 String currentProject = ((hero.interfaces.BnProjectLightValue)i.next()).getName(); 68 69 Vector todoListNames = new Vector (usersession.getToDoList(currentProject)); 71 72 Vector activityListNames = new Vector (usersession.getActivityList(currentProject)); 74 75 Hashtable readyList = new Hashtable (); 76 Hashtable executingList = new Hashtable (); 77 Hashtable anticipableList = new Hashtable (); 78 Hashtable anticipatingList = new Hashtable (); 79 80 if (todoListNames.size() != 0 || activityListNames.size() != 0){ 82 83 currentWorkList.setProjectName(currentProject); 85 86 hero.interfaces.ProjectSessionLocal projectsession = projecth.create(); 88 projectsession.initProject(currentProject); 89 90 int j=0; 91 while (j<todoListNames.size()){ 92 StrutsNodeValue stnt = new StrutsNodeValue(); 93 stnt.setProjectName(currentProject); 94 stnt.setName(((hero.interfaces.BnNodeValue)projectsession.getNodeValue((String )todoListNames.elementAt(j))).getName()); 95 96 if (((hero.interfaces.BnNodeValue)projectsession.getNodeValue((String )todoListNames.elementAt(j))).getState() == hero.interfaces.Constants.Nd.READY) 97 readyList.put((String )todoListNames.elementAt(j), stnt); 98 else 99 anticipableList.put((String )todoListNames.elementAt(j), stnt); 100 j++; 101 } 102 103 j=0; 104 while (j<activityListNames.size()){ 105 StrutsNodeValue stna = new StrutsNodeValue(); 106 stna.setProjectName(currentProject); 107 stna.setName(((hero.interfaces.BnNodeValue)projectsession.getNodeValue((String )activityListNames.elementAt(j))).getName()); 108 109 if (((hero.interfaces.BnNodeValue)projectsession.getNodeValue((String )activityListNames.elementAt(j))).getState() == hero.interfaces.Constants.Nd.ANTICIPATING) 110 anticipatingList.put((String )activityListNames.elementAt(j),stna); 111 112 else{ 113 executingList.put((String )activityListNames.elementAt(j),stna); 114 } 115 j++; 116 } 117 118 currentWorkList.setTodoListReady(readyList); 120 currentWorkList.setTodoListAnti(anticipableList); 121 currentWorkList.setActivityListAnti(anticipatingList); 122 currentWorkList.setActivityListExec(executingList); 123 this.getWorkList().add(currentWorkList); 124 } 125 } 126 } 127 128 129 130 131 135 public Vector getWorkList() { 136 return workList; 137 } 138 139 140 141 142 146 public void setWorkList(Vector workList) { 147 this.workList = workList; 148 } 149 } 150 151 | Popular Tags |