From hise-commits-return-159-apmail-incubator-hise-commits-archive=incubator.apache.org@incubator.apache.org Mon Jul 26 08:12:41 2010 Return-Path: Delivered-To: apmail-incubator-hise-commits-archive@minotaur.apache.org Received: (qmail 84953 invoked from network); 26 Jul 2010 08:12:41 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 26 Jul 2010 08:12:41 -0000 Received: (qmail 96569 invoked by uid 500); 26 Jul 2010 08:12:41 -0000 Delivered-To: apmail-incubator-hise-commits-archive@incubator.apache.org Received: (qmail 96554 invoked by uid 500); 26 Jul 2010 08:12:40 -0000 Mailing-List: contact hise-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: hise-dev@incubator.apache.org Delivered-To: mailing list hise-commits@incubator.apache.org Received: (qmail 96546 invoked by uid 99); 26 Jul 2010 08:12:39 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 26 Jul 2010 08:12:39 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 26 Jul 2010 08:12:34 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 00F7723889B2; Mon, 26 Jul 2010 08:11:36 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: svn commit: r979190 - in /incubator/hise/trunk: hise-services/src/main/java/org/apache/hise/engine/jaxws/TaskOperationsImpl.java hise-services/src/main/java/org/apache/hise/runtime/Task.java itest/hise-soapui-project.xml Date: Mon, 26 Jul 2010 08:11:36 -0000 To: hise-commits@incubator.apache.org From: rr@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100726081137.00F7723889B2@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: rr Date: Mon Jul 26 08:11:36 2010 New Revision: 979190 URL: http://svn.apache.org/viewvc?rev=979190&view=rev Log: HISE-55: Implement Administrative Operations (Thanks to Michał Więcław) Modified: incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/jaxws/TaskOperationsImpl.java incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/runtime/Task.java incubator/hise/trunk/itest/hise-soapui-project.xml Modified: incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/jaxws/TaskOperationsImpl.java URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/jaxws/TaskOperationsImpl.java?rev=979190&r1=979189&r2=979190&view=diff ============================================================================== --- incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/jaxws/TaskOperationsImpl.java (original) +++ incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/jaxws/TaskOperationsImpl.java Mon Jul 26 08:11:36 2010 @@ -23,6 +23,7 @@ import java.math.BigInteger; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; +import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Set; @@ -402,9 +403,13 @@ public class TaskOperationsImpl implemen Task task = Task.load(hiseEngine, new Long(identifier)); if(!(TaskChecker.checkPermission(TaskChecker.HumanOperationName.ACTIVATE, getUserString(), task))) throw new IllegalAccessFault("Illegal access to operations"); + + try { + task.setStatus(Status.READY); + } catch (HiseIllegalStateException e) { + throw new IllegalStateFault("Illegal State Fault"); + } task.setCurrentUser(getUserString()); - // TODO Auto-generated method stub - } public void addAttachment(String identifier, String attachmentName, String accessType, Object attachment) throws IllegalAccessFault, IllegalStateFault, @@ -438,25 +443,14 @@ public class TaskOperationsImpl implemen throw new IllegalAccessFault("Illegal access to operations"); String userID = task.checkCanDelegate(organizationalEntity); - org.apache.hise.dao.Task taskDto = task.getTaskDto(); task.setCurrentUser(getUserString()); try { task.setActualOwner(userID); + task.addGenericHumanRole(userID, GenericHumanRole.POTENTIALOWNERS); } catch (HiseIllegalStateException e) { throw new IllegalStateFault(); } - - if(!(task.getGenericHumanRolesForUser(userID).contains(GenericHumanRole.POTENTIALOWNERS))){ - Set peopeAssignments = taskDto.getPeopleAssignments(); - TaskOrgEntity taskOrgEntity = new TaskOrgEntity(); - taskOrgEntity.setGenericHumanRole(GenericHumanRole.POTENTIALOWNERS); - taskOrgEntity.setName(userID); - taskOrgEntity.setType(OrgEntityType.USER); - taskOrgEntity.setTask(task.getTaskDto()); - peopeAssignments.add(taskOrgEntity); - taskDto.setPeopleAssignments(peopeAssignments); - } } @@ -633,10 +627,30 @@ public class TaskOperationsImpl implemen Task task = Task.load(hiseEngine, new Long(identifier)); if(!(TaskChecker.checkPermission(TaskChecker.HumanOperationName.NOMINATE, getUserString(), task))) throw new IllegalAccessFault("Illegal access to operations"); - org.apache.hise.dao.Task taskDto = task.getTaskDto(); - if(taskDto.getStatus()==Status.CREATED){ - TUserlist tUsers=organizationalEntity.getUsers(); - //taskDto.getBusinessAdministrators() + + + if(task.getTaskDto().getStatus()==Status.CREATED){ + TUserlist tUsers = organizationalEntity.getUsers(); + TGrouplist tGroup = organizationalEntity.getGroups(); + try { + //When only one user is nominate, he become ActualOwner + if((tGroup == null)&&(tUsers != null)&&(tUsers.getUser().size() == 1)){ + task.setActualOwner(tUsers.getUser().get(0)); + task.addGenericHumanRole(tUsers.getUser().get(0), GenericHumanRole.POTENTIALOWNERS); + }else{ + if(tGroup != null){ + for(String group: tGroup.getGroup()) + task.addGenericHumanRole(group, GenericHumanRole.POTENTIALOWNERS); + } + if(tUsers != null){ + for(String user: tUsers.getUser()) + task.addGenericHumanRole(user,GenericHumanRole.POTENTIALOWNERS); + } + task.setStatus(Status.READY); + } + } catch (HiseIllegalStateException e) { + throw new IllegalStateFault("Illegal State Fault"); + } } else{ throw new IllegalStateFault("Nomination can be performed only in CREATED state"); @@ -659,8 +673,26 @@ public class TaskOperationsImpl implemen if(!(TaskChecker.checkPermission(TaskChecker.HumanOperationName.SET_GENERIC_HUMAN_ROLE, getUserString(), task))) throw new IllegalAccessFault("Illegal access to operations"); - // TODO Auto-generated method stub - + TUserlist tUsers = organizationalEntity.getUsers(); + TGrouplist tGroup = organizationalEntity.getGroups(); + Set orgEntityName = new HashSet(); + if(tUsers != null){ + for(String e: tUsers.getUser()) + orgEntityName.add(e); + } + if(tGroup != null){ + for(String e: tGroup.getGroup()) + orgEntityName.add(e); + } + + for(String i: orgEntityName){ + for(TaskOrgEntity e: task.getTaskDto().getPeopleAssignments()){ + if(i.equals(e.getName())){ + hiseEngine.getHiseDao().remove(e); + } + } + task.addGenericHumanRole(i, GenericHumanRole.valueOf(genericHumanRole)); + } } public void setPriority(String identifier, BigInteger priority) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault { Modified: incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/runtime/Task.java URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/runtime/Task.java?rev=979190&r1=979189&r2=979190&view=diff ============================================================================== --- incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/runtime/Task.java (original) +++ incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/runtime/Task.java Mon Jul 26 08:11:36 2010 @@ -1355,4 +1355,35 @@ public class Task { return humanRoles; } + /** + * Add new GeneralHumanRole for OrgEntity. You can't use this method to set ActualOwner. + * + * @return true if new role was added + */ + public boolean addGenericHumanRole(String peopleID, GenericHumanRole role){ + org.apache.hise.dao.OrgEntity orgEntity = hiseEngine.getHiseDao().find(org.apache.hise.dao.OrgEntity.class, peopleID); + OrgEntityType type = orgEntity.getType(); + + if(role.equals(GenericHumanRole.ACTUALOWNER)) return false; + + if(type.equals(OrgEntityType.GROUP)){ + for(TaskOrgEntity e: taskDto.getPeopleAssignments()){ + if(peopleID.equals(e.getName()) && e.getGenericHumanRole().equals(role)){ + return true; + } + } + }else if(getGenericHumanRolesForUser(peopleID).contains(role)){ + return true; + } + + TaskOrgEntity t = new TaskOrgEntity(); + t.setGenericHumanRole(role); + t.setName(peopleID); + t.setType(type); + t.setTask(taskDto); + Set tList= new HashSet(); + tList.add(t); + taskDto.addPeopleAssignments(tList); + return true; + } } Modified: incubator/hise/trunk/itest/hise-soapui-project.xml URL: http://svn.apache.org/viewvc/incubator/hise/trunk/itest/hise-soapui-project.xml?rev=979190&r1=979189&r2=979190&view=diff ============================================================================== --- incubator/hise/trunk/itest/hise-soapui-project.xml (original) +++ incubator/hise/trunk/itest/hise-soapui-project.xml Mon Jul 26 08:11:36 2010 @@ -3644,7 +3644,7 @@ declare namespace ns1='http://www.exampl -]]>user1user1passtid397tidResponseapprove - Request 1<a>{*/*/*/text()}</a>tidPropertiestaskOperationsSOAPforward<xml-fragment/>UTF-8${#Project#destination}/taskOperations/ +]]>user1user1passtid5tidResponseapprove - Request 1<a>{*/*/*/text()}</a>tidPropertiestaskOperationsSOAPforward<xml-fragment/>UTF-8${#Project#destination}/taskOperations/ @@ -4067,7 +4067,132 @@ declare namespace ns4='http://www.insura declare namespace ns3='http://www.example.org/WS-HT/api'; declare namespace soap='http://schemas.xmlsoap.org/soap/envelope/'; declare namespace ns1='http://www.example.org/WS-HT/api/xsd'; -<v>{//ns3:addedBy/text()};{//ns3:text/text()}</v><v>user1user2;first_commentsecond_comment</v>falseuser1user1passSEQUENTIALClaimsHandlingBindingapprove<xml-fragment/>UTF-8${#Project#destination}/ClaimsHandlingService2/ +<v>{//ns3:addedBy/text()};{//ns3:text/text()}</v><v>user1user2;first_commentsecond_comment</v>falseuser1user1passClaimsHandlingBindingapprove <xml-fragment/>UTF-8${#Project#destination}/ClaimsHandlingService7/ + + user3 + + + + + + 123 + Edmund + Zorn + + 1234 + usa + 2 + 2009-01-02T12:00:00 + + + +]]>user2user2passtid17tidResponseapprove - Request 1<a>{*/*/*/text()}</a>tid1PropertiestaskOperationsSOAPgetTaskInfo<xml-fragment/>UTF-8${#Project#destination}/taskOperations/ + + + + ${Properties#tid1} + + +]]>declare namespace ns2='http://www.example.org/WS-HT'; +declare namespace ns4='http://www.insurance.example.com/claims'; +declare namespace ns3='http://www.example.org/WS-HT/api'; +declare namespace soap='http://schemas.xmlsoap.org/soap/envelope/'; +declare namespace ns1='http://www.example.org/WS-HT/api/xsd'; +<v>{//ns3:status/text()};{//ns3:name/text()}</v><v>READY;ns4:Task7</v>falseuser1user1passtaskOperationsSOAPsuspend<xml-fragment/>UTF-8${#Project#destination}/taskOperations/ + + + + ${Properties#tid1} + + +]]>user5user5passtaskOperationsSOAPgetTaskInfo<xml-fragment/>UTF-8${#Project#destination}/taskOperations/ + + + + ${Properties#tid1} + + +]]>declare namespace ns2='http://www.example.org/WS-HT'; +declare namespace ns4='http://www.insurance.example.com/claims'; +declare namespace ns3='http://www.example.org/WS-HT/api'; +declare namespace soap='http://schemas.xmlsoap.org/soap/envelope/'; +declare namespace ns1='http://www.example.org/WS-HT/api/xsd'; +<v>{//ns3:status/text()};{//ns3:name/text()}</v><v>SUSPENDED;ns4:Task7</v>falseuser1user1passtaskOperationsSOAPactivate<xml-fragment/>UTF-8${#Project#destination}/taskOperations/ + + + + ${Properties#tid1} + + +]]>user5user5passtaskOperationsSOAPgetTaskInfo<xml-fragment/>UTF-8${#Project#destination}/taskOperations/ + + + + ${Properties#tid1} + + +]]>declare namespace ns2='http://www.example.org/WS-HT'; +declare namespace ns4='http://www.insurance.example.com/claims'; +declare namespace ns3='http://www.example.org/WS-HT/api'; +declare namespace soap='http://schemas.xmlsoap.org/soap/envelope/'; +declare namespace ns1='http://www.example.org/WS-HT/api/xsd'; +<v>{//ns3:status/text()};{//ns3:name/text()};{//ns3:taskStakeholders/ns2:users/ns2:user/text()}: +{//ns3:businessAdministrators/ns2:users/ns2:user/text()}:{//ns3:potentialOwners/ns2:users/ns2:user/text()}</v><v>READY;ns4:Task7;user6: +user5:</v>falseuser1user1passtaskOperationsSOAPsetGenericHumanRole<xml-fragment/>UTF-8${#Project#destination}/taskOperations/ + + + + ${Properties#tid1} + POTENTIALOWNERS + + + user6 + + + + +]]>user5user5passtaskOperationsSOAPgetTaskInfo<xml-fragment/>UTF-8${#Project#destination}/taskOperations/ + + + + ${Properties#tid1} + + +]]>declare namespace ns2='http://www.example.org/WS-HT'; +declare namespace ns4='http://www.insurance.example.com/claims'; +declare namespace ns3='http://www.example.org/WS-HT/api'; +declare namespace soap='http://schemas.xmlsoap.org/soap/envelope/'; +declare namespace ns1='http://www.example.org/WS-HT/api/xsd'; +<v>{//ns3:status/text()};{//ns3:name/text()};{//ns3:taskStakeholders/ns2:users/ns2:user/text()}: +{//ns3:businessAdministrators/ns2:users/ns2:user/text()}:{//ns3:potentialOwners/ns2:users/ns2:user/text()}</v><v>READY;ns4:Task7;: +user5:user6</v>falseuser1user1passtaskOperationsSOAPsetGenericHumanRole<xml-fragment/>UTF-8${#Project#destination}/taskOperations/ + + + + ${Properties#tid1} + TASKSTAKEHOLDERS + + + user5 + + + + +]]>user5user5passtaskOperationsSOAPgetTaskInfo<xml-fragment/>UTF-8${#Project#destination}/taskOperations/ + + + + ${Properties#tid1} + + +]]>declare namespace ns2='http://www.example.org/WS-HT'; +declare namespace ns4='http://www.insurance.example.com/claims'; +declare namespace ns3='http://www.example.org/WS-HT/api'; +declare namespace soap='http://schemas.xmlsoap.org/soap/envelope/'; +declare namespace ns1='http://www.example.org/WS-HT/api/xsd'; +<v>{//ns3:status/text()};{//ns3:name/text()};{//ns3:taskStakeholders/ns2:users/ns2:user/text()}: +{//ns3:businessAdministrators/ns2:users/ns2:user/text()}:{//ns3:potentialOwners/ns2:users/ns2:user/text()}</v><v>READY;ns4:Task7;user5: +:user6</v>falseuser1user1passSEQUENTIALClaimsHandlingBindingapprove<xml-fragment/>UTF-8${#Project#destination}/ClaimsHandlingService2/ soapui