You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hise-commits@incubator.apache.org by wi...@apache.org on 2011/07/26 12:01:27 UTC
svn commit: r1151066 [2/2] - in /incubator/hise/trunk: ./ hise-bundle/
hise-bundle/soapui-tests/ hise-distro/src/distro/examples/claimsHandling/
hise-examples/osgi/
hise-examples/osgi/claims-handling-bundle/src/main/resources/
hise-examples/osgi/claims...
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=1151066&r1=1151065&r2=1151066&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 Tue Jul 26 12:01:15 2011
@@ -51,7 +51,7 @@ import java.util.*;
/**
* Holds task instance information. Provides task business operations.
- *
+ *
* @author Kamil Eisenbart
* @author Witek WoÅejszo
* @author Mateusz LipczyÅski
@@ -77,13 +77,14 @@ public class Task {
private String currentUser;
private DeadlineController deadlineController;
-
+
private TaskHistoryListener taskHistoryListener;
- protected Task() {}
-
+ protected Task() {
+ }
+
public Job getCurrentJob() {
return currentJob;
@@ -166,7 +167,7 @@ public class Task {
TaskOrgEntity selected = null;
for (TaskOrgEntity e : taskDto.getPeopleAssignments()) {
if (e.getGenericHumanRole() == GenericHumanRole.POTENTIALOWNERS) {
- poSize ++;
+ poSize++;
if (e.getType() == TaskOrgEntity.OrgEntityType.USER) {
selected = e;
}
@@ -197,14 +198,14 @@ public class Task {
taskDto.setTaskDefinitionKey(taskDefinition.getTaskName().toString());
taskDto.setCreatedBy(createdBy);
taskDto.setStatus(null);
- for(String partName: inputParts.keySet()) {
+ for (String partName : inputParts.keySet()) {
Node part = inputParts.get(partName);
- if(part != null) {
+ if (part != null) {
taskDto.getInput().put(partName, new Message(partName, DOMUtils.domToString(part)));
} else {
//TODO
}
- }
+ }
taskDto.setSoapHeader(requestHeader == null ? null : DOMUtils.domToString(requestHeader));
taskDto.setCreatedOn(new Date());
taskDto.setActivationTime(new Date());
@@ -213,14 +214,14 @@ public class Task {
taskDto.setSkippable(true);
taskDto.setSavingTaskHistory(taskDefinition.isSavingTaskHistory());
taskDto.setSavingTaskHistoryLanguage(taskDefinition.getSavingHistoryLanguage());
- t.taskDto = taskDto;
+ t.taskDto = taskDto;
taskDto.setPriority(t.getTaskEvaluator().evaluatePriority());
taskDto.setPeopleAssignments(t.getTaskEvaluator().evaluatePeopleAssignments());
taskDto.setPotentalDelegates(t.getTaskEvaluator().evaluatePotentialDelegates());
- if(taskDto.getPotentialDelegates().equals(PotentialDelegates.OTHER)){
- taskDto.addPeopleAssignments(t.getTaskEvaluator().evaluatePeopleDelegated());
+ if (taskDto.getPotentialDelegates().equals(PotentialDelegates.OTHER)) {
+ taskDto.addPeopleAssignments(t.getTaskEvaluator().evaluatePeopleDelegated());
}
-
+
// Vector<TaskOrgEntity> temp=new Vector<TaskOrgEntity>(taskDto.getPeopleAssignments());
// int k=temp.size();
engine.getHiseDao().persist(taskDto);
@@ -230,32 +231,33 @@ public class Task {
} catch (HiseIllegalStateException e) {
throw new IllegalStateException(e);
}
- try {
- if(t.getTaskDefinition().isAutoActivate()){
- t.activate();
- }
- } catch (IllegalStateFault e) {
- throw new IllegalStateException(e);
- }
+ try {
+ if (t.getTaskDefinition().isAutoActivate()) {
+ t.activate();
+ }
+ } catch (IllegalStateFault e) {
+ throw new IllegalStateException(e);
+ }
-
- engine.getHiseDao().persist(taskDto);
- if (taskDefinition.getDeadlines() != null) {
- for (TDeadline deadline : taskDefinition.getDeadlines()
- .getCompletionDeadlineList()) {
- if (deadline.isSetUntil())
- t.getDeadlineController().computeDeadline(deadline, true,
- true);
- }
- for (TDeadline deadline : taskDefinition.getDeadlines()
- .getStartDeadlineList()) {
- if (deadline.isSetUntil())
- t.getDeadlineController().computeDeadline(deadline, false,
- true);
- }
- }
- return t;
+ engine.getHiseDao().persist(taskDto);
+ if (taskDefinition.getDeadlines() != null) {
+ for (TDeadline deadline : taskDefinition.getDeadlines()
+ .getCompletionDeadlineList()) {
+ if (deadline.isSetUntil())
+ t.getDeadlineController().computeDeadline(deadline, true,
+ true);
+ }
+ for (TDeadline deadline : taskDefinition.getDeadlines()
+ .getStartDeadlineList()) {
+ if (deadline.isSetUntil())
+ t.getDeadlineController().computeDeadline(deadline, false,
+ true);
+ }
+ }
+ t.computeCalculatedValues();
+
+ return t;
// recalculatePresentationParameters();
//
@@ -301,30 +303,28 @@ public class Task {
}
-
-
- static Map<String, Node> findInputParts(TaskDefinition taskDefinition, Node requestXml) {
+ static Map<String, Node> findInputParts(TaskDefinition taskDefinition, Node requestXml) {
Map<String, Node> inputParts = new HashMap<String, Node>();
if (taskDefinition.getPortType() == null) {
- //Non wsdl task (for camel integration layer)
- inputParts.put("message", requestXml);
- return inputParts;
+ //Non wsdl task (for camel integration layer)
+ inputParts.put("message", requestXml);
+ return inputParts;
}
-
+
Operation operation = taskDefinition.getPortType().getOperation(taskDefinition.getTaskInterface().getOperation(), null, null);
- if(operation == null) {
+ if (operation == null) {
LogFactory.getLog(Task.class).error("Operation: " + taskDefinition.getTaskInterface().getOperation() + " not found in port type definition.");
return inputParts;
}
Map<String, Part> partsMap = operation.getInput().getMessage().getParts();
Node messagePart = null;
- for (Part part : partsMap.values()) {
+ for (Part part : partsMap.values()) {
String name = part.getName();
QName element = part.getElementName();
QName type = part.getTypeName();
- Element root = (Element) requestXml;
+ Element root = (Element) requestXml;
XPath xPath = XPathFactory.newInstance().newXPath();
try {
if (element != null) {
@@ -360,9 +360,9 @@ public class Task {
taskDto.setTaskDefinitionKey(taskDefinition.getTaskName().toString());
taskDto.setCreatedBy(createdBy);
taskDto.setStatus(null);
- for(String partName: inputParts.keySet()) {
+ for (String partName : inputParts.keySet()) {
Node part = inputParts.get(partName);
- if(part != null) {
+ if (part != null) {
taskDto.getInput().put(partName, new Message(partName, DOMUtils.domToString(part)));
} else {
//TODO
@@ -392,25 +392,27 @@ public class Task {
}
engine.getHiseDao().persist(taskDto);
+ t.computeCalculatedValues();
return t;
}
public void setActualOwner(String user) throws HiseIllegalStateException {
-
- if(taskDto.isSavingTaskHistory()){
- Comment comment=taskHistoryListener.actualOwnerChanged(taskDto, taskDto.getActualOwner(), user, getCurrentUser(), taskDto.getSavingTaskHistoryLanguage());
- taskDto.getComments().add(comment);
- }
+
+ if (taskDto.isSavingTaskHistory()) {
+ Comment comment = taskHistoryListener.actualOwnerChanged(taskDto, taskDto.getActualOwner(), user, getCurrentUser(), taskDto.getSavingTaskHistoryLanguage());
+ taskDto.getComments().add(comment);
+ }
taskDto.setActualOwner(user);
- if(user!=null)
- setStatus(Status.RESERVED);
+ if (user != null)
+ setStatus(Status.RESERVED);
return;
}
public void setOutput(Node requestXml) {
__log.debug("setting task output to: " + requestXml);
this.taskDto.getOutput().put("request", new Message("request", DOMUtils.domToString(requestXml)));
+ computeCalculatedValues();
}
public TaskDefinition getTaskDefinition() {
@@ -419,41 +421,41 @@ public class Task {
/**
* Checks if the task can be delegated. Throws exception if it can't.
- *
+ *
* @return user name (ID)
*/
- public String checkCanDelegate(TOrganizationalEntity delegatee) throws RecipientNotAllowed, IllegalStateFault {
-
- List<String> userList = delegatee.getUsers().getUserList();
- if(userList.size() != 1){
- throw new RecipientNotAllowed("Only one user can by delegated to the task");
- }
- String userID = userList.get(0);
- OrgEntity user = hiseEngine.getHiseDao().find(org.apache.hise.dao.OrgEntity.class, userID);
- if(user == null){
- throw new RecipientNotAllowed("Can't delegate. The user is unknown");
- }
-
- switch(taskDto.getPotentialDelegates()){
- case ANYBODY:
- break;
- case POTENTIAL_OWNERS:
- if(!(getGenericHumanRolesForUser(userID).contains(GenericHumanRole.POTENTIALOWNERS))){
- throw new RecipientNotAllowed("Only PotentialOwners can be delegate to this task");
- }
- break;
- case OTHER:
- Collection<GenericHumanRole> role = this.getGenericHumanRolesForUser(userID);
- if(!(role.contains(GenericHumanRole.POTENTIALDELEGATEES))){
- throw new RecipientNotAllowed("Can't delegate. The user is not authorised to this operation");
- }
- break;
- case NOBODY:
- throw new RecipientNotAllowed("Nobody can be delegated to this task");
- }
- return userID;
- }
-
+ public String checkCanDelegate(TOrganizationalEntity delegatee) throws RecipientNotAllowed, IllegalStateFault {
+
+ List<String> userList = delegatee.getUsers().getUserList();
+ if (userList.size() != 1) {
+ throw new RecipientNotAllowed("Only one user can by delegated to the task");
+ }
+ String userID = userList.get(0);
+ OrgEntity user = hiseEngine.getHiseDao().find(org.apache.hise.dao.OrgEntity.class, userID);
+ if (user == null) {
+ throw new RecipientNotAllowed("Can't delegate. The user is unknown");
+ }
+
+ switch (taskDto.getPotentialDelegates()) {
+ case ANYBODY:
+ break;
+ case POTENTIAL_OWNERS:
+ if (!(getGenericHumanRolesForUser(userID).contains(GenericHumanRole.POTENTIALOWNERS))) {
+ throw new RecipientNotAllowed("Only PotentialOwners can be delegate to this task");
+ }
+ break;
+ case OTHER:
+ Collection<GenericHumanRole> role = this.getGenericHumanRolesForUser(userID);
+ if (!(role.contains(GenericHumanRole.POTENTIALDELEGATEES))) {
+ throw new RecipientNotAllowed("Can't delegate. The user is not authorised to this operation");
+ }
+ break;
+ case NOBODY:
+ throw new RecipientNotAllowed("Nobody can be delegated to this task");
+ }
+ return userID;
+ }
+
// /**
// * If there is only one person in the given list, it
// * returns this person. Otherwise, it returns null.
@@ -579,15 +581,15 @@ public class Task {
//
public void setStatus(Status newStatus) throws HiseIllegalStateException {
- Status oldStatus=null;
- for (TaskStateListener l : taskStateListeners) {
- oldStatus=taskDto.getStatus();
+ Status oldStatus = null;
+ for (TaskStateListener l : taskStateListeners) {
+ oldStatus = taskDto.getStatus();
l.stateChanged(oldStatus, newStatus);
}
- if(taskDto.isSavingTaskHistory()){
- Comment comment= taskHistoryListener.stateChanged(taskDto, oldStatus, newStatus, getCurrentUser(),taskDto.getSavingTaskHistoryLanguage());
- taskDto.getComments().add(comment);
- }
+ if (taskDto.isSavingTaskHistory() && (oldStatus != newStatus)) {
+ Comment comment = taskHistoryListener.stateChanged(taskDto, oldStatus, newStatus, getCurrentUser(), taskDto.getSavingTaskHistoryLanguage());
+ taskDto.getComments().add(comment);
+ }
taskDto.setStatus(newStatus);
}
@@ -689,11 +691,12 @@ public class Task {
// }
// }
//
+
/**
* Claims task. Task in READY status can be claimed by people from potential owners group not listed in excluded owners.
- *
- * @throws HiseIllegalStateException Thrown when task is in illegal state for claim i.e. not READY.
- * @throws HiseIllegalAccessException Thrown when task is in illegal state for claim i.e. not READY or person cannot
+ *
+ * @throws HiseIllegalStateException Thrown when task is in illegal state for claim i.e. not READY.
+ * @throws HiseIllegalAccessException Thrown when task is in illegal state for claim i.e. not READY or person cannot
* become actual owner i.e. not potential owner or excluded.
*/
public void claim() throws HiseIllegalStateException, HiseIllegalAccessException {
@@ -731,8 +734,8 @@ public class Task {
}
public void start() throws HiseIllegalStateException {
- if(getTaskDto().getStatus() == Status.READY)
- setActualOwner(currentUser);
+ if (getTaskDto().getStatus() == Status.READY)
+ setActualOwner(currentUser);
setStatus(Status.IN_PROGRESS);
}
@@ -741,13 +744,14 @@ public class Task {
}
public void release() throws HiseIllegalStateException {
- setActualOwner(null);
- setStatus(Status.READY);
+ setActualOwner(null);
+ setStatus(Status.READY);
}
/**
* Suspends the task.
- * @throws HiseIllegalStateException
+ *
+ * @throws HiseIllegalStateException
*/
public void suspend() throws HiseIllegalStateException {
setStatus(Status.SUSPENDED);
@@ -795,10 +799,10 @@ public class Task {
try {
Node response = taskEvaluator.evaluateOutcome(taskDto.getStatus() == Status.COMPLETED);
hiseEngine.sendResponse(getTaskDefinition().getTaskName(),
- response,
- taskDto.getSoapHeader() == null ? null : taskEvaluator.createEprFromHeader(DOMUtils.parse(taskDto.getSoapHeader()).getDocumentElement()));
+ response,
+ taskEvaluator.createEprFromHeader(DOMUtils.parse(taskDto.getSoapHeader()).getDocumentElement()));
} catch (Exception e) {
- throw new RuntimeException("Sending response failed: "+e.getMessage(), e);
+ throw new RuntimeException("Sending response failed: " + e.getMessage(), e);
}
}
@@ -834,27 +838,27 @@ public class Task {
public void forward(Set<TaskOrgEntity> targets) throws HiseIllegalStateException {
__log.debug("forwarding to " + targets);
releaseOwner();
-
- Set<TaskOrgEntity> old=taskDto.getPeopleAssignments();
-
- Set<TaskOrgEntity> orgs=new HashSet<TaskOrgEntity>();
+
+ Set<TaskOrgEntity> old = taskDto.getPeopleAssignments();
+
+ Set<TaskOrgEntity> orgs = new HashSet<TaskOrgEntity>();
for (TaskOrgEntity x : taskDto.getPeopleAssignments()) {
- if(x.getGenericHumanRole()!=GenericHumanRole.POTENTIALOWNERS){
- orgs.add(x);
+ if (x.getGenericHumanRole() != GenericHumanRole.POTENTIALOWNERS) {
+ orgs.add(x);
}
}
orgs.addAll(targets);
taskDto.setPeopleAssignments(orgs);
-
+
for (TaskOrgEntity x : old) {
- if(x.getGenericHumanRole()==GenericHumanRole.POTENTIALOWNERS){
- x.setTask(null);
- hiseEngine.getHiseDao().remove(x);
+ if (x.getGenericHumanRole() == GenericHumanRole.POTENTIALOWNERS) {
+ x.setTask(null);
+ hiseEngine.getHiseDao().remove(x);
}
}
tryNominateOwner();
__log.debug("forwarding to " + targets);
- int k=targets.size();
+ int k = targets.size();
}
@@ -1324,103 +1328,115 @@ public class Task {
public Node getOutput(String part) {
return DOMUtils.parse(taskDto.getOutput().get(part).getMessage()).getDocumentElement();
}
-
+
/**
- * Give list of user's GenericHumanRole for Task
- *
- * @return list of user's GenericHumanRole
- */
- public Collection<GenericHumanRole> getGenericHumanRolesForUser(String userID)
- {
- Collection<GenericHumanRole> humanRoles = new HashSet<GenericHumanRole>();
- org.apache.hise.dao.OrgEntity user = hiseEngine.getHiseDao().find(org.apache.hise.dao.OrgEntity.class, userID);
- if(user == null) return humanRoles;
-
- Collection<String> userGrupsName = new HashSet<String>();
-
- for(OrgEntity i : user.getUserGroups()){
- userGrupsName.add(i.getName());
- }
-
- for(TaskOrgEntity i : taskDto.getPeopleAssignments()){
- if((i.getType() == TaskOrgEntity.OrgEntityType.USER)&&(i.getName().equals(userID))){
- humanRoles.add(i.getGenericHumanRole());
- }
- else if((i.getType() == TaskOrgEntity.OrgEntityType.GROUP)&&(userGrupsName.contains(i.getName()))){
- humanRoles.add(i.getGenericHumanRole());
- }
- }
-
- if(userID.equals(taskDto.getActualOwner())){
- humanRoles.add(GenericHumanRole.ACTUALOWNER);
- }
- if(userID.equals(taskDto.getCreatedBy())){
- humanRoles.add(GenericHumanRole.TASKINITIATOR);
- }
-
- 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<TaskOrgEntity> tList= new HashSet<TaskOrgEntity>();
- tList.add(t);
- taskDto.addPeopleAssignments(tList);
- return true;
- }
-
- /**
- * If task have PotentalOwners then task is activated. Task's state transition to REDY or RESERVED
- */
- public void activate() throws IllegalStateFault{
- try {
- boolean nominateOwner = this.tryNominateOwner();
- if(!nominateOwner){
- if(!taskDto.getPeopleAssignments().isEmpty()){
- setStatus(Status.READY);
- }else{
- throw new IllegalStateFault("Illegal State Fault");
- }
- }
- } catch (HiseIllegalStateException e) {
- throw new IllegalStateFault("Illegal State Fault");
- }
- }
-
-
- public DeadlineController getDeadlineController() {
- return deadlineController;
- }
-
-
- public void setDeadlineController(DeadlineController deadlineController) {
- this.deadlineController = deadlineController;
- }
-
-
-
+ * Give list of user's GenericHumanRole for Task
+ *
+ * @return list of user's GenericHumanRole
+ */
+ public Collection<GenericHumanRole> getGenericHumanRolesForUser(String userID) {
+ Collection<GenericHumanRole> humanRoles = new HashSet<GenericHumanRole>();
+ org.apache.hise.dao.OrgEntity user = hiseEngine.getHiseDao().find(org.apache.hise.dao.OrgEntity.class, userID);
+ if (user == null) return humanRoles;
+
+ Collection<String> userGrupsName = new HashSet<String>();
+
+ for (OrgEntity i : user.getUserGroups()) {
+ userGrupsName.add(i.getName());
+ }
+
+ for (TaskOrgEntity i : taskDto.getPeopleAssignments()) {
+ if ((i.getType() == TaskOrgEntity.OrgEntityType.USER) && (i.getName().equals(userID))) {
+ humanRoles.add(i.getGenericHumanRole());
+ } else if ((i.getType() == TaskOrgEntity.OrgEntityType.GROUP) && (userGrupsName.contains(i.getName()))) {
+ humanRoles.add(i.getGenericHumanRole());
+ }
+ }
+
+ if (userID.equals(taskDto.getActualOwner())) {
+ humanRoles.add(GenericHumanRole.ACTUALOWNER);
+ }
+ if (userID.equals(taskDto.getCreatedBy())) {
+ humanRoles.add(GenericHumanRole.TASKINITIATOR);
+ }
+
+ 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<TaskOrgEntity> tList = new HashSet<TaskOrgEntity>();
+ tList.add(t);
+ taskDto.addPeopleAssignments(tList);
+ return true;
+ }
+
+ /**
+ * If task have PotentalOwners then task is activated. Task's state transition to REDY or RESERVED
+ */
+ public void activate() throws IllegalStateFault {
+ try {
+ boolean nominateOwner = this.tryNominateOwner();
+ if (!nominateOwner) {
+ if (!taskDto.getPeopleAssignments().isEmpty()) {
+ setStatus(Status.READY);
+ } else {
+ throw new IllegalStateFault("Illegal State Fault");
+ }
+ }
+ } catch (HiseIllegalStateException e) {
+ throw new IllegalStateFault("Illegal State Fault");
+ }
+ }
+
+
+ public DeadlineController getDeadlineController() {
+ return deadlineController;
+ }
+
+
+ public void setDeadlineController(DeadlineController deadlineController) {
+ this.deadlineController = deadlineController;
+ }
+
+ public void computeCalculatedValues() {
+ taskDto.setPresentationSubject(taskEvaluator.evalPresentationSubject());
+ taskDto.setPresentationDescription(taskEvaluator.evalPresentationDescription());
+ if (taskDefinition.getDeadlines() != null && taskDefinition.getDeadlines().getCompletionDeadlineList() != null) {
+ for (TDeadline td : taskDefinition.getDeadlines().getCompletionDeadlineList()) {
+ Date d = taskEvaluator.evaluateDeadline(td, td.isSetUntil());
+ if (d != null && (taskDto.getCompleteBy() == null || taskDto.getCompleteBy().before(d))) {
+ taskDto.setCompleteBy(d);
+ }
+ }
+ }
+
+
+ }
+
+
}
Modified: incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/runtime/TaskEvaluator.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/runtime/TaskEvaluator.java?rev=1151066&r1=1151065&r2=1151066&view=diff
==============================================================================
--- incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/runtime/TaskEvaluator.java (original)
+++ incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/runtime/TaskEvaluator.java Tue Jul 26 12:01:15 2011
@@ -54,7 +54,7 @@ public class TaskEvaluator {
public static Node getInput(String part) {
TaskEvaluator te = (TaskEvaluator) XQueryEvaluator.contextObjectTL.get();
try {
- if(te.task.getTaskDto().getInput().get(part) != null) {
+ if(te.task.getTaskDto().getInput() != null && te.task.getTaskDto().getInput().get(part) != null) {
return DOMUtils.parse(te.task.getTaskDto().getInput().get(part).getMessage()).getDocumentElement();
} else {
return null;
@@ -104,7 +104,8 @@ public class TaskEvaluator {
}
private Object evaluateExpression(String expr, Node queryContextNode) {
- return buildQueryEvaluator(queryContextNode).evaluateExpression(expr, null).get(0);
+ List res = buildQueryEvaluator(queryContextNode).evaluateExpression(expr, null);
+ return res.isEmpty() ? null : res.get(0);
}
public Date evaluateDeadline(TDeadline deadline, boolean isUntil) {
Modified: incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/runtime/TaskHistoryListener.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/runtime/TaskHistoryListener.java?rev=1151066&r1=1151065&r2=1151066&view=diff
==============================================================================
--- incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/runtime/TaskHistoryListener.java (original)
+++ incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/runtime/TaskHistoryListener.java Tue Jul 26 12:01:15 2011
@@ -47,9 +47,9 @@ public class TaskHistoryListener {
}
String content = null;
if (newStatus == Status.CREATED) {
- content = messages.get(new String("CREATED"));
+ content = messages.get("CREATED");
} else {
- content = messages.get(new String("STATE_CHANGE")) + new String(oldStatus.toString()) + " --> " + new String(newStatus.toString()) + ".";
+ content = messages.get("STATE_CHANGE") +" "+ oldStatus.toString() + " --> " + newStatus.toString() + ".";
}
Comment comment = new Comment(content, taskDto, initiator);
return comment;
@@ -66,11 +66,11 @@ public class TaskHistoryListener {
String content = null;
if (oldActualOwner == null || oldActualOwner.length() == 0) {
- content = new String(messages.get(new String("NEW_ACTUALOWNER")) + newActualOwner + ".");
+ content = messages.get("NEW_ACTUALOWNER") + newActualOwner + ".";
} else if (newActualOwner == null || newActualOwner.length() == 0) {
- content = new String(messages.get(new String("DEL_ACTUALOWNER")) + ".");
+ content = messages.get("DEL_ACTUALOWNER") + ".";
} else {
- content = new String(messages.get(new String("CHANGE_ACTUALOWNER")) + oldActualOwner + " -->" + newActualOwner + ".");
+ content = messages.get("CHANGE_ACTUALOWNER") + " "+oldActualOwner + " -->" + newActualOwner + ".";
}
Comment comment = new Comment(content, taskDto, initiator);
return comment;
Modified: incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/utils/StringToConverterFabric.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/utils/StringToConverterFabric.java?rev=1151066&r1=1151065&r2=1151066&view=diff
==============================================================================
--- incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/utils/StringToConverterFabric.java (original)
+++ incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/utils/StringToConverterFabric.java Tue Jul 26 12:01:15 2011
@@ -31,13 +31,25 @@ public class StringToConverterFabric {
return new StringToDateConverter();
if(isBoolean(expression))
return new StringToBooleanConverter();
- if(isInt(expression))
+ if(isLong(expression))
+ return new StringToLongConverter();
+ if(isInt(expression))
return new StringToIntConverter();
return new StringToStringConverter();
}
- private static boolean isInt(String expression) {
+ private static boolean isLong(String expression) {
+ try{
+ Long.parseLong(expression.substring(0, expression.length()-1)) ;
+ return expression.charAt(expression.length()-1)=='l';
+ }
+ catch (Exception e) {
+ return false;
+ }
+ }
+
+ private static boolean isInt(String expression) {
try{
Integer.parseInt(expression);
return true;
Modified: incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/DaoTest.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/DaoTest.java?rev=1151066&r1=1151065&r2=1151066&view=diff
==============================================================================
--- incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/DaoTest.java (original)
+++ incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/DaoTest.java Tue Jul 26 12:01:15 2011
@@ -3,11 +3,7 @@ package org.apache.hise;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.List;
+import java.util.*;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
@@ -39,6 +35,8 @@ import org.springframework.transaction.T
import org.springframework.transaction.support.TransactionCallback;
import org.springframework.transaction.support.TransactionTemplate;
+import static junit.framework.Assert.assertEquals;
+
@ContextConfiguration(locations = "classpath:/dao.xml")
public class DaoTest extends AbstractJUnit4SpringContextTests {
@@ -62,7 +60,42 @@ public class DaoTest extends AbstractJUn
Long tid = taskHelper.addTaskInTransaction(TaskType.TASK1, tt, hiseDao);
Assert.assertNotNull(tid);
}
-
+
+
+
+ @Test
+ public void testQuery() throws Exception {
+
+ Long tid2 =addTasks();
+
+ Assert.assertNotNull(tid2);
+
+ TaskQuery tq = new TaskQuery();
+ tq.setWhereClause("presentationSubject = alaHasCat and presentationDescription = alaHas*");
+ tq.setOrderByClause("presentationDescription desc");
+ tq.setUser(TaskCreationHelper.TASK2_OWNER);
+ List<Task> a = hiseDao.getUserTasks(tq);
+ assertEquals(2, a.size());
+ assertEquals(tid2, a.get(0).getId());
+ }
+
+ private Long addTasks() {
+ TransactionTemplate tt = new TransactionTemplate(transactionManager);
+
+ return (Long) tt.execute(new TransactionCallback() {
+ public Object doInTransaction(TransactionStatus arg0) {
+ try {
+ taskHelper.cleanup(hiseDao);
+ taskHelper.addTask(hiseDao);
+ taskHelper.addTask2(hiseDao);
+ return taskHelper.addTask3(hiseDao);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+ });
+ }
+
@Test
public void testUserTasks() throws Exception {
TransactionTemplate tt = new TransactionTemplate(transactionManager);
@@ -92,6 +125,7 @@ public class DaoTest extends AbstractJUn
public Object doInTransaction(TransactionStatus arg0) {
try{
cleanup();
+ taskHelper.addTask(hiseDao);
taskHelper.addTask2(hiseDao);
TaskQuery query = new TaskQuery();
query.setUser(TaskCreationHelper.TASK2_ASSIGNED_USER);
Modified: incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/TaskCreationHelper.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/TaskCreationHelper.java?rev=1151066&r1=1151065&r2=1151066&view=diff
==============================================================================
--- incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/TaskCreationHelper.java (original)
+++ incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/TaskCreationHelper.java Tue Jul 26 12:01:15 2011
@@ -3,13 +3,7 @@ package org.apache.hise;
import java.util.HashSet;
import java.util.Set;
-import org.apache.hise.dao.GenericHumanRole;
-import org.apache.hise.dao.HISEDao;
-import org.apache.hise.dao.Job;
-import org.apache.hise.dao.Message;
-import org.apache.hise.dao.OrgEntity;
-import org.apache.hise.dao.Task;
-import org.apache.hise.dao.TaskOrgEntity;
+import org.apache.hise.dao.*;
import org.apache.hise.dao.Task.Status;
import org.apache.hise.dao.TaskOrgEntity.OrgEntityType;
import org.junit.Assert;
@@ -33,7 +27,8 @@ public class TaskCreationHelper {
public static String TASK2_ASSIGNED_USER = "user1";
public static String TASK2_ASSIGNED_USER_GROUP = "group1";
public static String TASK2_DEFINITION_KEY = "asd2";
-
+ public static String TASK2_OWNER = "user2";
+
public static String TASK3_ASSIGNED_USER = "user1";
public static String TASK3_ASSIGNED_GROUP = "group1";
public static String TASK3_DEFINITION_KEY = "asd3";
@@ -45,7 +40,7 @@ public class TaskCreationHelper {
public static String TASK5_DEFINITION_KEY = "asd5";
public static String TASK6_DEFINITION_KEY = "asd6";
- private void cleanup(HISEDao hiseDao) throws Exception {
+ public void cleanup(HISEDao hiseDao) throws Exception {
hiseDao.clearAllRecords(OrgEntity.class);
hiseDao.clearAllRecords(Task.class);
hiseDao.clearAllRecords(Job.class);
@@ -74,7 +69,8 @@ public class TaskCreationHelper {
t.setStatus(Status.CREATED);
t.setTaskDefinitionKey(TASK1_DEFINITION_KEY);
t.setActualOwner(TASK1_OWNER);
-
+
+
t.getInput().put(TASK1_INPUT_KEY, new Message(TASK1_INPUT_KEY, TASK1_INPUT_VALUE));
hiseDao.persist(t);
Long id = t.getId();
@@ -82,8 +78,7 @@ public class TaskCreationHelper {
return id;
}
- public void addTask2(HISEDao hiseDao) throws Exception {
- addTask(hiseDao);
+ public Long addTask2(HISEDao hiseDao) throws Exception {
Task t = new Task();
t.setStatus(Status.READY);
t.setTaskDefinitionKey(TASK2_DEFINITION_KEY);
@@ -95,11 +90,15 @@ public class TaskCreationHelper {
x.setTask(t);
pa.add(x);
t.setPeopleAssignments(pa);
+ t.setPresentationDescription("alaHasCat");
+ t.setPresentationSubject("alaHasCat");
+ t.setActualOwner(TASK2_OWNER);
hiseDao.persist(t);
+
+ return t.getId();
}
- public void addTask3(HISEDao hiseDao) throws Exception {
- addTask(hiseDao);
+ public Long addTask3(HISEDao hiseDao) throws Exception {
Task t = new Task();
t.setStatus(Status.READY);
t.setTaskDefinitionKey(TASK3_DEFINITION_KEY);
@@ -108,10 +107,14 @@ public class TaskCreationHelper {
x.setName(TASK3_ASSIGNED_GROUP);
x.setType(OrgEntityType.GROUP);
x.setGenericHumanRole(GenericHumanRole.POTENTIALOWNERS);
+ t.setPresentationDescription("alaHasMouse");
+ t.setPresentationSubject("alaHasCat");
x.setTask(t);
+ t.setActualOwner(TASK2_OWNER);
pa.add(x);
t.setPeopleAssignments(pa);
hiseDao.persist(t);
+ return t.getId();
}
public void addSomeUsers(HISEDao hiseDao){
@@ -259,11 +262,13 @@ public class TaskCreationHelper {
break;
case TASK2:
cleanup(hiseDao);
- addTask2(hiseDao);
+ addTask(hiseDao);
+ tid = addTask2(hiseDao);
break;
case TASK3:
cleanup(hiseDao);
- addTask3(hiseDao);
+ addTask(hiseDao);
+ addTask3(hiseDao);
break;
case TASK4:
addTask4(hiseDao);
Modified: incubator/hise/trunk/hise-test-example-osgi/pom.xml
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-test-example-osgi/pom.xml?rev=1151066&r1=1151065&r2=1151066&view=diff
==============================================================================
--- incubator/hise/trunk/hise-test-example-osgi/pom.xml (original)
+++ incubator/hise/trunk/hise-test-example-osgi/pom.xml Tue Jul 26 12:01:15 2011
@@ -27,6 +27,10 @@
<artifactId>hise-test-example-osgi</artifactId>
<packaging>bundle</packaging>
<version>1.0.0-SNAPSHOT</version>
+ <properties>
+ <maven.test.skip>true</maven.test.skip>
+ </properties>
+
<build>
<plugins>
<plugin>
@@ -76,14 +80,14 @@ org.apache.hise,
org.springframework.beans.factory.config
</Import-Package>
<Private-Package>org.apache.hise.test, org.apache.hise</Private-Package>
-
+
<Require-Bundle>org.apache.cxf.bundle</Require-Bundle>
<Export-Package>org.apache.hise.test,
org.apache.hise</Export-Package>
-
+
<DynamicImport-Package>*</DynamicImport-Package>
<!--
<Require-Bundle>
Added: incubator/hise/trunk/hise-test-example-osgi/src/main/java/org/apache/hise/test/Test.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-test-example-osgi/src/main/java/org/apache/hise/test/Test.java?rev=1151066&view=auto
==============================================================================
--- incubator/hise/trunk/hise-test-example-osgi/src/main/java/org/apache/hise/test/Test.java (added)
+++ incubator/hise/trunk/hise-test-example-osgi/src/main/java/org/apache/hise/test/Test.java Tue Jul 26 12:01:15 2011
@@ -0,0 +1,31 @@
+package org.apache.hise.test;
+
+import org.apache.hise.engine.wsdl.IllegalAccessFault;
+import org.apache.hise.engine.wsdl.IllegalArgumentFault;
+import org.apache.hise.engine.wsdl.IllegalStateFault;
+import org.apache.hise.lang.xsd.htd.TOrganizationalEntity;
+import org.apache.hise.lang.xsd.htdt.*;
+
+import javax.jws.WebService;
+
+@WebService
+public interface Test {
+
+ void cleanup() throws Exception;
+
+ void delegateViaApi(final String identifier, final TOrganizationalEntity organizationalEntity);
+
+ StartResponseDocument startViaApi(StartDocument start, String userName) throws IllegalArgumentFault, IllegalStateFault, IllegalAccessFault ;
+
+ CompleteResponseDocument completeViaApi(CompleteDocument complete, String name) throws IllegalArgumentFault, IllegalStateFault, IllegalAccessFault;
+
+ StopResponseDocument stopViaApi(StopDocument stop, String name) throws IllegalArgumentFault, IllegalStateFault, IllegalAccessFault;
+
+ GetTaskInfoResponseDocument getTaskInfo(GetTaskInfoDocument getTaskInfo) throws IllegalArgumentFault;
+
+ ReleaseResponseDocument release(ReleaseDocument release, String name) throws IllegalArgumentFault, IllegalStateFault, IllegalAccessFault;
+
+ GetMyTaskAbstractsResponseDocument getMyTaskAbstracts(GetMyTaskAbstractsDocument getMyTaskAbstracts, String name) throws IllegalArgumentFault, IllegalStateFault;
+
+ NominateResponseDocument nominate(NominateDocument nominate, String name) throws IllegalArgumentFault, IllegalStateFault, IllegalAccessFault;
+}
Modified: incubator/hise/trunk/hise-test-example-osgi/src/main/java/org/apache/hise/test/TestImpl.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-test-example-osgi/src/main/java/org/apache/hise/test/TestImpl.java?rev=1151066&r1=1151065&r2=1151066&view=diff
==============================================================================
--- incubator/hise/trunk/hise-test-example-osgi/src/main/java/org/apache/hise/test/TestImpl.java (original)
+++ incubator/hise/trunk/hise-test-example-osgi/src/main/java/org/apache/hise/test/TestImpl.java Tue Jul 26 12:01:15 2011
@@ -1,23 +1,6 @@
package org.apache.hise.test;
-import javax.jws.WebService;
-
-import org.apache.hise.lang.xsd.htdt.CompleteDocument;
-import org.apache.hise.lang.xsd.htdt.CompleteResponseDocument;
-import org.apache.hise.lang.xsd.htdt.GetMyTaskAbstractsDocument;
-import org.apache.hise.lang.xsd.htdt.GetMyTaskAbstractsResponseDocument;
-import org.apache.hise.lang.xsd.htdt.GetTaskInfoDocument;
-import org.apache.hise.lang.xsd.htdt.GetTaskInfoResponseDocument;
-import org.apache.hise.lang.xsd.htdt.NominateDocument;
-import org.apache.hise.lang.xsd.htdt.NominateResponseDocument;
-import org.apache.hise.lang.xsd.htdt.ReleaseDocument;
-import org.apache.hise.lang.xsd.htdt.ReleaseResponseDocument;
-import org.apache.hise.lang.xsd.htdt.StartDocument;
-import org.apache.hise.lang.xsd.htdt.StartResponseDocument;
-import org.apache.hise.lang.xsd.htdt.StopDocument;
-import org.apache.hise.lang.xsd.htdt.StopResponseDocument;
-
import org.apache.hise.api.HISEEngine;
import org.apache.hise.api.Management;
import org.apache.hise.dao.Job;
@@ -27,12 +10,16 @@ import org.apache.hise.engine.wsdl.Illeg
import org.apache.hise.engine.wsdl.IllegalStateFault;
import org.apache.hise.engine.wsdl.RecipientNotAllowed;
import org.apache.hise.lang.xsd.htd.TOrganizationalEntity;
+import org.apache.hise.lang.xsd.htdt.*;
+import org.junit.Ignore;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.support.TransactionCallback;
import org.springframework.transaction.support.TransactionTemplate;
-@org.junit.Ignore
+import javax.jws.WebService;
+
+@Ignore
@WebService(endpointInterface = "org.apache.hise.test.Test")
public class TestImpl implements Test {
@@ -41,6 +28,10 @@ public class TestImpl implements Test {
private HISEEngine e;
private Management management;
+
+ public TestImpl() {
+ super();
+ }
public void setE(HISEEngine hiseEngine) {
this.e = hiseEngine;
@@ -54,13 +45,13 @@ public class TestImpl implements Test {
TransactionTemplate tt = new TransactionTemplate(transactionManager);
tt.execute(new TransactionCallback() {
public Object doInTransaction(TransactionStatus status) {
-// hiseDao.clearAllRecords(OrgEntity.class);
e.getHiseDao().clearAllRecords(Task.class);
e.getHiseDao().clearAllRecords(Job.class);
return null;
}
});
}
+
public void delegateViaApi(final String identifier, final TOrganizationalEntity organizationalEntity){
TransactionTemplate tt = new TransactionTemplate(transactionManager);
tt.execute(new TransactionCallback() {
Modified: incubator/hise/trunk/hise-test-example-osgi/src/main/java/org/apache/hise/test/TestingManagment.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-test-example-osgi/src/main/java/org/apache/hise/test/TestingManagment.java?rev=1151066&r1=1151065&r2=1151066&view=diff
==============================================================================
--- incubator/hise/trunk/hise-test-example-osgi/src/main/java/org/apache/hise/test/TestingManagment.java (original)
+++ incubator/hise/trunk/hise-test-example-osgi/src/main/java/org/apache/hise/test/TestingManagment.java Tue Jul 26 12:01:15 2011
@@ -19,32 +19,33 @@
package org.apache.hise.test;
-import java.util.List;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hise.api.Management;
import org.apache.hise.api.Sender;
-import org.apache.hise.engine.jaxws.HISEJaxWSClient;
import org.apache.hise.engine.wsdl.IllegalArgumentFault;
import org.apache.hise.engine.wsdl.IllegalStateFault;
import org.apache.hise.lang.xsd.htda.TTask;
+import org.junit.Ignore;
import org.w3c.dom.Node;
-@org.junit.Ignore
+import java.util.List;
+
+@Ignore
public class TestingManagment implements Sender {
- private final Log __log = LogFactory.getLog(TestingManagment.class);
+ private final Log log = LogFactory.getLog(TestingManagment.class);
Management management;
-
-
+
public TestingManagment() {
super();
}
+
public void init(){
return;
}
+
public Node invoke(Node message, Node epr) {
String text=management.getText();
@@ -52,7 +53,7 @@ public class TestingManagment implements
text.charAt(0);
try {
List<TTask> l = management.getMyTasks(null, null, null, null, null, null, null,null,null,null).getGetMyTasksResponse().getTaskAbstractList();
- __log.debug("TestingManagment wielkosc listy:"+l.size());
+ log.debug("TestingManagment wielkosc listy:"+l.size());
} catch (IllegalArgumentFault e) {
// TODO Auto-generated catch block
e.printStackTrace();
@@ -61,7 +62,7 @@ public class TestingManagment implements
e.printStackTrace();
}
- __log.debug("TestingManagment is alive");
+ log.debug("TestingManagment is alive");
return null;
}
public Management getManagement() {
@@ -70,7 +71,5 @@ public class TestingManagment implements
public void setManagement(Management managment) {
this.management = managment;
}
-
-
}
Modified: incubator/hise/trunk/hise-test-example-osgi/src/main/resources/META-INF/spring/hise-itest.xml
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-test-example-osgi/src/main/resources/META-INF/spring/hise-itest.xml?rev=1151066&r1=1151065&r2=1151066&view=diff
==============================================================================
--- incubator/hise/trunk/hise-test-example-osgi/src/main/resources/META-INF/spring/hise-itest.xml (original)
+++ incubator/hise/trunk/hise-test-example-osgi/src/main/resources/META-INF/spring/hise-itest.xml Tue Jul 26 12:01:15 2011
@@ -30,7 +30,7 @@ xmlns:osgi="http://www.springframework.o
<bean id="test2" class="org.apache.hise.test.TestImpl">
<property name="transactionManager" ref="transactionManager"/>
<property name="e" ref="hiseEngine"></property>
- <property name="management" ref="managementApi"></property>
+ <property name="management" ref="managementApi"></property>
</bean>
<bean id="sampleUsers" class="org.apache.hise.test.SampleUsers" init-method="init">
Modified: incubator/hise/trunk/hise-web/pom.xml
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-web/pom.xml?rev=1151066&r1=1151065&r2=1151066&view=diff
==============================================================================
--- incubator/hise/trunk/hise-web/pom.xml (original)
+++ incubator/hise/trunk/hise-web/pom.xml Tue Jul 26 12:01:15 2011
@@ -26,15 +26,6 @@
<version>1.2.143</version>
<scope>runtime</scope>
</dependency>
- <!--
- <dependency>
- <groupId>oracle</groupId>
- <artifactId>ojdbc5</artifactId>
- <version>11.1.0.6.0</version>
- <scope>test</scope>
- </dependency>
- -->
-
<dependency>
<groupId>org.apache.hise</groupId>
<artifactId>hise-wsdl</artifactId>
@@ -169,6 +160,16 @@
<build>
<plugins>
<plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <excludes>
+ <exclude>**/TestImpl.java</exclude>
+ <exclude>**/TestingManagment.java</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
Modified: incubator/hise/trunk/hise-web/src/test/java/org/apache/hise/Client2Test.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-web/src/test/java/org/apache/hise/Client2Test.java?rev=1151066&r1=1151065&r2=1151066&view=diff
==============================================================================
--- incubator/hise/trunk/hise-web/src/test/java/org/apache/hise/Client2Test.java (original)
+++ incubator/hise/trunk/hise-web/src/test/java/org/apache/hise/Client2Test.java Tue Jul 26 12:01:15 2011
@@ -1,24 +1,28 @@
package org.apache.hise;
-import java.util.Iterator;
+import org.apache.commons.lang.Validate;
+import org.apache.hise.utils.DOMUtils;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.w3c.dom.Document;
import javax.xml.namespace.QName;
-import javax.xml.soap.MessageFactory;
-import javax.xml.soap.SOAPMessage;
import javax.xml.transform.Source;
import javax.xml.transform.dom.DOMSource;
import javax.xml.ws.Dispatch;
import javax.xml.ws.Service;
+import java.util.Iterator;
-import org.apache.commons.lang.Validate;
-import org.apache.hise.utils.DOMUtils;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.w3c.dom.Document;
-
-@Ignore
public class Client2Test {
+
+ public Client2Test() {
+ }
+
@Test
+ public void test() {
+ }
+
+ @Ignore
public void testClient() throws Exception {
Service destinationService = Service.create(getClass().getResource("/ExampleTasks.wsdl"), QName.valueOf("{http://www.insurance.example.com/claims}ClaimsResolvingService"));
QName destinationPort = null;
Modified: incubator/hise/trunk/hise-ws-client/src/main/java/org/apache/hise/wsclient/facade/FilterCriteria.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-ws-client/src/main/java/org/apache/hise/wsclient/facade/FilterCriteria.java?rev=1151066&r1=1151065&r2=1151066&view=diff
==============================================================================
--- incubator/hise/trunk/hise-ws-client/src/main/java/org/apache/hise/wsclient/facade/FilterCriteria.java (original)
+++ incubator/hise/trunk/hise-ws-client/src/main/java/org/apache/hise/wsclient/facade/FilterCriteria.java Tue Jul 26 12:01:15 2011
@@ -31,6 +31,8 @@ public class FilterCriteria implements S
private Integer maxTasks = Tasks.MAX_TASKS;
private Integer fromTask = 0;
+
+ private String whereClause;
public HumanRole getGenericHumanRole() {
return humanRole;
@@ -103,5 +105,12 @@ public class FilterCriteria implements S
public Integer getFromTask() {
return fromTask;
}
-
+
+ public String getWhereClause() {
+ return whereClause;
+ }
+
+ public void setWhereClause(String whereClause) {
+ this.whereClause = whereClause;
+ }
}
Modified: incubator/hise/trunk/hise-ws-client/src/main/java/org/apache/hise/wsclient/facade/HiseApiFacade.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-ws-client/src/main/java/org/apache/hise/wsclient/facade/HiseApiFacade.java?rev=1151066&r1=1151065&r2=1151066&view=diff
==============================================================================
--- incubator/hise/trunk/hise-ws-client/src/main/java/org/apache/hise/wsclient/facade/HiseApiFacade.java (original)
+++ incubator/hise/trunk/hise-ws-client/src/main/java/org/apache/hise/wsclient/facade/HiseApiFacade.java Tue Jul 26 12:01:15 2011
@@ -3,6 +3,7 @@ package org.apache.hise.wsclient.facade;
import java.util.List;
+import org.apache.hise.wsclient.infrastructure.Tasks;
import org.apache.hise.wsclient.model.Comment;
import org.apache.hise.wsclient.model.Task;
@@ -15,7 +16,7 @@ import org.apache.hise.wsclient.model.Ta
*/
public interface HiseApiFacade {
- List<Task> getMyTasks(String user, String password, FilterCriteria filterCriteria);
+ Tasks getMyTasks(String user, String password, FilterCriteria filterCriteria);
Task getTask(String user, String password, String taskId);
String getTaskDescription(String user, String password, String taskId, String contentType);
@@ -24,6 +25,7 @@ public interface HiseApiFacade {
void fail(String user, String password, String identifier);
void complete(String user, String password, String identifier, Object result);
void delegate(String user, String password, String identifier, String newActualOwner);
+ void skip(String user, String password, String identifier);
Object getInput(String user, String password, String identifier, String part);
Object getRendering(String user, String password, String identifier, String renderingType);
Modified: incubator/hise/trunk/hise-ws-client/src/main/java/org/apache/hise/wsclient/facade/HiseApiFacadeImpl.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-ws-client/src/main/java/org/apache/hise/wsclient/facade/HiseApiFacadeImpl.java?rev=1151066&r1=1151065&r2=1151066&view=diff
==============================================================================
--- incubator/hise/trunk/hise-ws-client/src/main/java/org/apache/hise/wsclient/facade/HiseApiFacadeImpl.java (original)
+++ incubator/hise/trunk/hise-ws-client/src/main/java/org/apache/hise/wsclient/facade/HiseApiFacadeImpl.java Tue Jul 26 12:01:15 2011
@@ -2,6 +2,7 @@ package org.apache.hise.wsclient.facade;
import javax.xml.namespace.QName;
+import org.apache.commons.lang.StringUtils;
import org.apache.hise.model.htd.TOrganizationalEntity;
import org.apache.hise.model.htd.TUserlist;
import org.apache.hise.model.ws.TComment;
@@ -20,6 +21,7 @@ import org.apache.hise.wsclient.model.Ta
import org.apache.hise.wsclient.model.enums.HumanRole;
import org.apache.hise.wsclient.model.enums.Status;
+import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
@@ -30,7 +32,7 @@ public class HiseApiFacadeImpl implement
private TaskConverter taskConverter;
private CommentConverter commentConverter;
- public List<Task> getMyTasks(String user, String password, FilterCriteria filterCriteria) {
+ public Tasks getMyTasks(String user, String password, FilterCriteria filterCriteria) {
wssInterceptor.addWsAuthentication(user, password);
Tasks tasks = new Tasks(wssInterceptor, service);
@@ -41,21 +43,22 @@ public class HiseApiFacadeImpl implement
String orderBy = filterCriteria.getOrderBy();
Integer maxTasks = filterCriteria.getMaxTasks();
Integer fromTask = filterCriteria.getFromTask();
+ String whereClause = createWhereClause(filterCriteria);
try {
tasks.clear();
if (humanRole == null) {
- tasks.retrieve(null, statuses, orderBy, maxTasks, fromTask);
+ tasks.retrieve(null, statuses, orderBy, maxTasks, fromTask, whereClause);
}
if (humanRole != null && workingQueue == null) {
- tasks.retrieve(humanRole, statuses, orderBy, maxTasks, fromTask);
+ tasks.retrieve(humanRole, statuses, orderBy, maxTasks, fromTask, whereClause);
}
if (humanRole != null && workingQueue != null) {
- tasks.retrieve(humanRole, workingQueue, statuses, orderBy, maxTasks, fromTask);
+ tasks.retrieve(humanRole, workingQueue, statuses, orderBy, maxTasks, fromTask, whereClause);
}
} catch (Exception e) {
@@ -76,12 +79,35 @@ public class HiseApiFacadeImpl implement
return tasks;
}
+ private String createWhereClause(FilterCriteria filterCriteria) {
+ String where = StringUtils.isEmpty(filterCriteria.getWhereClause()) ? "" : filterCriteria.getWhereClause();
+ String add = " AND ";
+ String addAnd = StringUtils.isEmpty(where) ? "" : add;
+ if (filterCriteria.getPriority()!=null) {
+ where = where+addAnd+"priority="+filterCriteria.getPriority();
+ addAnd = add;
+ }
+ if (filterCriteria.getCompleteByEndDate()!=null) {
+ where = where+addAnd+"completeBy<"+format(filterCriteria.getCompleteByEndDate());
+ addAnd = add;
+ }
+ if (filterCriteria.getCompleteByStartDate()!=null) {
+ where = where+addAnd+"completeBy>"+format(filterCriteria.getCompleteByStartDate());
+ addAnd = add;
+ }
+ return where;
+ }
+
+ private String format(Date date) {
+ return new SimpleDateFormat("dd-MM-yyyy HH:mm").format(date);
+ }
+
public Task getTask(String user, String password, String taskId) {
wssInterceptor.addWsAuthentication(user, password);
try {
TTask task = service.getTaskInfo(taskId);
- String description = service.getTaskDescription(taskId, null);
+ String description = service.getTaskDescription(taskId, "text/plain");
Task taskDto = taskConverter.buildTask(task);
taskDto.setPresentationDescription(description);
@@ -101,7 +127,16 @@ public class HiseApiFacadeImpl implement
}
}
- public void start(String user, String password, String identifier) {
+ public void skip(String user, String password, String identifier) {
+ wssInterceptor.addWsAuthentication(user, password);
+ try {
+ service.skip(identifier);
+ } catch (Exception e) {
+ throw new HiseException("Bad webservice HISE: " + e.getMessage(), e);
+ }
+ }
+
+ public void start(String user, String password, String identifier) {
wssInterceptor.addWsAuthentication(user, password);
try {
service.start(identifier);
Modified: incubator/hise/trunk/hise-ws-client/src/main/java/org/apache/hise/wsclient/infrastructure/Tasks.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-ws-client/src/main/java/org/apache/hise/wsclient/infrastructure/Tasks.java?rev=1151066&r1=1151065&r2=1151066&view=diff
==============================================================================
--- incubator/hise/trunk/hise-ws-client/src/main/java/org/apache/hise/wsclient/infrastructure/Tasks.java (original)
+++ incubator/hise/trunk/hise-ws-client/src/main/java/org/apache/hise/wsclient/infrastructure/Tasks.java Tue Jul 26 12:01:15 2011
@@ -15,83 +15,95 @@ import org.apache.hise.wsclient.model.Ta
import org.apache.hise.wsclient.model.enums.HumanRole;
import org.apache.hise.wsclient.model.enums.Status;
+import javax.xml.ws.Holder;
+
@SuppressWarnings("serial")
public class Tasks extends ArrayList<Task> {
-
- public static String TASK_TYPE = "ALL"; // TODO change to enum
- public static int MAX_TASKS = 100000;
-
- private final TaskConverter taskConverter = new TaskConverter();
- private WSSecurityInterceptor wssInterceptor;
- private TaskOperationsInterface service;
-
- private Tasks() {
- super();
- }
-
- private Tasks(Collection<? extends Task> c) {
- super(c);
- }
-
- private Tasks(int initialCapacity) {
- super(initialCapacity);
- }
-
- public Tasks(final WSSecurityInterceptor wssInterceptor, TaskOperationsInterface service) {
- super();
- this.wssInterceptor = wssInterceptor;
- this.service = service;
- }
-
- public void retrieve(HumanRole humanRole, List<Status> statuses, String orderBy, Integer maxTasks, Integer fromTask) throws IllegalArgumentFault, IllegalStateFault {
- List<TStatus> tStatuses = convertStatuses(statuses);
- List<TTask> myTasks = this.service.getMyTasks("ALL", humanRole == null ? null : humanRole.hiseName(), null, tStatuses, null, orderBy, null, maxTasks, fromTask);
- refreshAll(myTasks);
- }
-
- public void retrieve(HumanRole humanRole, String workingQueue, List<Status> statuses, String orderBy, Integer maxTasks, Integer fromTask) throws IllegalArgumentFault, IllegalStateFault {
- List<TStatus> tStatuses = convertStatuses(statuses);
- List<TTask> myTasks = this.service.getMyTasks("ALL", humanRole == null ? null : humanRole.hiseName(), workingQueue, tStatuses, null, orderBy, null, maxTasks, fromTask);
- refreshAll(myTasks);
- }
-
- private void refreshAll(List<TTask> myTasks) {
- for (TTask tTask : myTasks) {
- Task task = taskConverter.buildTask(tTask);
- this.remove(task);
- this.add(task);
- }
- }
-
- private List<TStatus> convertStatuses(List<Status> statuses) {
- List<TStatus> result = new ArrayList<TStatus>();
- for (Status status : statuses) {
- result.add(convertStatus(status));
- }
- return result;
- }
-
- private TStatus convertStatus(Status status) {
- return TStatus.fromValue(status.toString());
- }
-
- public final List<Task> getAsList() {
- return this;
- }
-
- public final void retainWithPriority(Integer priority) {
- Iterator<Task> i = iterator();
- while (i.hasNext()) {
- if (!i.next().getPriority().equals(priority)) {
- i.remove();
- }
- }
- }
-
- public final void retainWithExpirationByBetween(Date startDate, Date endDate) {
- Iterator<Task> i = iterator();
- while (i.hasNext()) {
- Task t = i.next();
+
+ public static String TASK_TYPE = "ALL"; // TODO change to enum
+ public static int MAX_TASKS = 100000;
+
+ private Long matchingTasksNumber;
+
+ private final TaskConverter taskConverter = new TaskConverter();
+ private WSSecurityInterceptor wssInterceptor;
+ private TaskOperationsInterface service;
+
+ private Tasks() {
+ super();
+ }
+
+ private Tasks(Collection<? extends Task> c) {
+ super(c);
+ }
+
+ private Tasks(int initialCapacity) {
+ super(initialCapacity);
+ }
+
+ public Tasks(final WSSecurityInterceptor wssInterceptor, TaskOperationsInterface service) {
+ super();
+ this.wssInterceptor = wssInterceptor;
+ this.service = service;
+ }
+
+ public void retrieve(HumanRole humanRole, List<Status> statuses, String orderBy, Integer maxTasks, Integer fromTask, String whereClause) throws IllegalArgumentFault, IllegalStateFault {
+ List<TStatus> tStatuses = convertStatuses(statuses);
+ Holder<List<TTask>> tasksHolder = new Holder<List<TTask>>();
+ Holder<Long> matchingTasksNumberHolder = new Holder<Long>();
+
+ this.service.getMyTasks("ALL", humanRole == null ? null : humanRole.hiseName(), null, tStatuses, whereClause, orderBy, null, maxTasks, fromTask, tasksHolder, matchingTasksNumberHolder);
+ this.matchingTasksNumber = matchingTasksNumberHolder.value;
+ refreshAll(tasksHolder.value);
+ }
+
+ public void retrieve(HumanRole humanRole, String workingQueue, List<Status> statuses, String orderBy, Integer maxTasks, Integer fromTask, String whereClause) throws IllegalArgumentFault, IllegalStateFault {
+ List<TStatus> tStatuses = convertStatuses(statuses);
+ Holder<List<TTask>> tasksHolder = new Holder<List<TTask>>();
+ Holder<Long> matchingTasksNumberHolder = new Holder<Long>();
+
+ this.service.getMyTasks("ALL", humanRole == null ? null : humanRole.hiseName(), workingQueue, tStatuses, whereClause, orderBy, null, maxTasks, fromTask, tasksHolder, matchingTasksNumberHolder);
+ this.matchingTasksNumber = matchingTasksNumberHolder.value;
+ refreshAll(tasksHolder.value);
+ }
+
+ private void refreshAll(List<TTask> myTasks) {
+ for (TTask tTask : myTasks) {
+ Task task = taskConverter.buildTask(tTask);
+ this.remove(task);
+ this.add(task);
+ }
+ }
+
+ private List<TStatus> convertStatuses(List<Status> statuses) {
+ List<TStatus> result = new ArrayList<TStatus>();
+ for (Status status : statuses) {
+ result.add(convertStatus(status));
+ }
+ return result;
+ }
+
+ private TStatus convertStatus(Status status) {
+ return TStatus.fromValue(status.toString());
+ }
+
+ public final List<Task> getAsList() {
+ return this;
+ }
+
+ public final void retainWithPriority(Integer priority) {
+ Iterator<Task> i = iterator();
+ while (i.hasNext()) {
+ if (!i.next().getPriority().equals(priority)) {
+ i.remove();
+ }
+ }
+ }
+
+ public final void retainWithExpirationByBetween(Date startDate, Date endDate) {
+ Iterator<Task> i = iterator();
+ while (i.hasNext()) {
+ Task t = i.next();
if (t.getExpirationTime() != null) {
if (t.getExpirationTime().before(startDate) || t.getExpirationTime().after(endDate)) {
i.remove();
@@ -99,5 +111,8 @@ public class Tasks extends ArrayList<Tas
}
}
}
-
+
+ public Long getMatchingTasksNumber() {
+ return matchingTasksNumber;
+ }
}
Modified: incubator/hise/trunk/hise-ws-client/src/main/resources/wsdls/ws-humantask-api-wsdl.xsd
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-ws-client/src/main/resources/wsdls/ws-humantask-api-wsdl.xsd?rev=1151066&r1=1151065&r2=1151066&view=diff
==============================================================================
--- incubator/hise/trunk/hise-ws-client/src/main/resources/wsdls/ws-humantask-api-wsdl.xsd (original)
+++ incubator/hise/trunk/hise-ws-client/src/main/resources/wsdls/ws-humantask-api-wsdl.xsd Tue Jul 26 12:01:15 2011
@@ -565,6 +565,11 @@ Business Machines Corporation, Oracle In
<xsd:sequence>
<xsd:element name="taskAbstract" type="api:tTaskAbstract"
minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="matchingTasksNo" type="xsd:unsignedInt" minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>available when the maxTasks in the request is set</xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
@@ -595,6 +600,11 @@ Business Machines Corporation, Oracle In
<xsd:sequence>
<xsd:element name="taskAbstract" type="api:tTask"
minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="matchingTasksNo" type="xsd:unsignedInt" minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>available when the maxTasks in the request is set</xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
Modified: incubator/hise/trunk/hise-ws-client/src/test/java/org/apache/hise/api/client/facade/HiseApiFacadeUnitTest.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-ws-client/src/test/java/org/apache/hise/api/client/facade/HiseApiFacadeUnitTest.java?rev=1151066&r1=1151065&r2=1151066&view=diff
==============================================================================
--- incubator/hise/trunk/hise-ws-client/src/test/java/org/apache/hise/api/client/facade/HiseApiFacadeUnitTest.java (original)
+++ incubator/hise/trunk/hise-ws-client/src/test/java/org/apache/hise/api/client/facade/HiseApiFacadeUnitTest.java Tue Jul 26 12:01:15 2011
@@ -1,9 +1,8 @@
package org.apache.hise.api.client.facade;
import static junit.framework.Assert.assertEquals;
-import static org.mockito.Matchers.anyListOf;
-import static org.mockito.Matchers.anyString;
-import static org.mockito.Matchers.eq;
+import static org.mockito.Matchers.*;
+import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@@ -26,88 +25,108 @@ import org.apache.hise.wsclient.model.Ta
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
+import org.mockito.invocation.InvocationOnMock;
import org.mockito.runners.MockitoJUnitRunner;
+import org.mockito.stubbing.Answer;
+
+import javax.xml.ws.Holder;
@RunWith(MockitoJUnitRunner.class)
public class HiseApiFacadeUnitTest {
- private static String USER = "testuser";
- private static String PASSWORD = "test";
-
+ private static String USER = "testuser";
+ private static String PASSWORD = "test";
+
@Mock
- private WSSecurityInterceptor wsSecurityInterceptor;
+ private WSSecurityInterceptor wsSecurityInterceptor;
@Mock
- private TaskOperationsInterface hiseInterface;
-
- @Test
+ private TaskOperationsInterface hiseInterface;
+
+ @Test
public void getMyTasksShouldReturnCorrectTasks() throws IllegalArgumentFault, IllegalStateFault {
- //given
- List<TTask> wsTasks = buildTasks(15);
- HiseApiFacade hiseApiFacade = buildHiseApiFacade();
-
- when(hiseInterface.getMyTasks(eq("ALL"), anyString(), anyString(), anyListOf(TStatus.class),
- anyString(), anyString(), anyString(), eq(Tasks.MAX_TASKS), eq(Integer.valueOf(0)))).thenReturn(wsTasks);
-
- //when
- List<Task> tasks = hiseApiFacade.getMyTasks(USER, PASSWORD, new FilterCriteria());
-
- //then
- assertEquals(wsTasks.size(), tasks.size());
- for (int i = 0; i < tasks.size(); i++) {
- assertEquals(wsTasks.get(i).getId(), tasks.get(i).getId());
- }
+ //given
+ final List<TTask> wsTasks = buildTasks(15);
+ HiseApiFacade hiseApiFacade = buildHiseApiFacade();
+
+ doAnswer(new Answer<Object>() {
+
+ public Object answer(InvocationOnMock invocation) throws Throwable {
+ ((Holder)invocation.getArguments()[9]).value = wsTasks;
+ ((Holder)invocation.getArguments()[10]).value = 1500l;
+ return null;
+ }
+
+ }).when(hiseInterface).getMyTasks(eq("ALL"), anyString(), anyString(), anyListOf(TStatus.class),
+ anyString(), anyString(), anyString(), eq(Tasks.MAX_TASKS), eq(Integer.valueOf(0)), any(Holder.class), any(Holder.class));
+
+ //when
+ List<Task> tasks = hiseApiFacade.getMyTasks(USER, PASSWORD, new FilterCriteria());
+
+ //then
+ assertEquals(wsTasks.size(), tasks.size());
+ for (int i = 0; i < tasks.size(); i++) {
+ assertEquals(wsTasks.get(i).getId(), tasks.get(i).getId());
+ }
}
-
- @Test
+
+ @Test
public void getMyTasksShouldFilterOutWrongPriority() throws IllegalArgumentFault, IllegalStateFault {
- //given
- List<TTask> wsTasks = buildTasks(15);
- HiseApiFacade hiseApiFacade = buildHiseApiFacade();
-
- when(hiseInterface.getMyTasks(eq("ALL"), anyString(), anyString(), anyListOf(TStatus.class),
- anyString(), anyString(), anyString(), eq(Tasks.MAX_TASKS), eq(0))).thenReturn(wsTasks);
-
- FilterCriteria fc = new FilterCriteria();
- fc.setPriority(2);
-
- //when
-
- List<Task> tasks = hiseApiFacade.getMyTasks(USER, PASSWORD, fc);
-
- //then
- assertEquals(0, tasks.size());
- }
-
-
- @Test
+ //given
+ final List<TTask> wsTasks = buildTasks(15);
+
+ HiseApiFacade hiseApiFacade = buildHiseApiFacade();
+ doAnswer(new Answer<Object>() {
+
+ public Object answer(InvocationOnMock invocation) throws Throwable {
+ ((Holder)invocation.getArguments()[9]).value = wsTasks;
+ ((Holder)invocation.getArguments()[10]).value = 1500l;
+ return null;
+ }
+
+ }).when(hiseInterface).getMyTasks(eq("ALL"), anyString(), anyString(), anyListOf(TStatus.class),
+ anyString(), anyString(), anyString(), eq(Tasks.MAX_TASKS), eq(Integer.valueOf(0)), any(Holder.class), any(Holder.class));
+
+ FilterCriteria fc = new FilterCriteria();
+ fc.setPriority(2);
+
+ //when
+
+ List<Task> tasks = hiseApiFacade.getMyTasks(USER, PASSWORD, fc);
+
+ //then
+ assertEquals(0, tasks.size());
+ }
+
+
+ @Test
public void getTaskShouldReturnCorrectTasks() throws IllegalArgumentFault, IllegalStateFault {
- //given
- String taskId = "5";
- TTask wsTask = buildTask(5);
- HiseApiFacade hiseApiFacade = buildHiseApiFacade();
- when(hiseInterface.getTaskInfo(taskId)).thenReturn(wsTask);
-
- //when
- Task task = hiseApiFacade.getTask(USER, PASSWORD, taskId);
-
- //then
- verify(hiseInterface).getTaskInfo(taskId);
- assertEquals(wsTask.getId(), task.getId());
+ //given
+ String taskId = "5";
+ TTask wsTask = buildTask(5);
+ HiseApiFacade hiseApiFacade = buildHiseApiFacade();
+ when(hiseInterface.getTaskInfo(taskId)).thenReturn(wsTask);
+
+ //when
+ Task task = hiseApiFacade.getTask(USER, PASSWORD, taskId);
+
+ //then
+ verify(hiseInterface).getTaskInfo(taskId);
+ assertEquals(wsTask.getId(), task.getId());
}
private HiseApiFacade buildHiseApiFacade() {
- HiseApiFacadeImpl hiseApiFacade = new HiseApiFacadeImpl();
- hiseApiFacade.setService(hiseInterface);
- hiseApiFacade.setWssInterceptor(wsSecurityInterceptor);
- hiseApiFacade.setTaskConverter(new TaskConverter());
- return hiseApiFacade;
+ HiseApiFacadeImpl hiseApiFacade = new HiseApiFacadeImpl();
+ hiseApiFacade.setService(hiseInterface);
+ hiseApiFacade.setWssInterceptor(wsSecurityInterceptor);
+ hiseApiFacade.setTaskConverter(new TaskConverter());
+ return hiseApiFacade;
}
private List<TTask> buildTasks(int count) {
List<TTask> tasks = new ArrayList<TTask>();
- for (int i = 0; i < count; i++) {
- tasks.add(buildTask(i));
+ for (int i = 0; i < count; i++) {
+ tasks.add(buildTask(i));
}
return tasks;
}
@@ -115,7 +134,7 @@ public class HiseApiFacadeUnitTest {
private TTask buildTask(int id) {
return buildTask(Integer.toString(id));
}
-
+
private TTask buildTask(String id) {
TTask task = new TTask();
task.setId(id);
Modified: incubator/hise/trunk/hise-wsdl/src/main/resources/ws-humantask-api-wsdl.xsd
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-wsdl/src/main/resources/ws-humantask-api-wsdl.xsd?rev=1151066&r1=1151065&r2=1151066&view=diff
==============================================================================
--- incubator/hise/trunk/hise-wsdl/src/main/resources/ws-humantask-api-wsdl.xsd (original)
+++ incubator/hise/trunk/hise-wsdl/src/main/resources/ws-humantask-api-wsdl.xsd Tue Jul 26 12:01:15 2011
@@ -565,6 +565,11 @@ Business Machines Corporation, Oracle In
<xsd:sequence>
<xsd:element name="taskAbstract" type="api:tTaskAbstract"
minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="matchingTasksNo" type="xsd:unsignedInt" minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>available when the maxTasks in the request is set</xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
@@ -595,6 +600,11 @@ Business Machines Corporation, Oracle In
<xsd:sequence>
<xsd:element name="taskAbstract" type="api:tTask"
minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="matchingTasksNo" type="xsd:unsignedInt" minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>available when the maxTasks in the request is set</xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
Modified: incubator/hise/trunk/itest/task_history.xml
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/itest/task_history.xml?rev=1151066&r1=1151065&r2=1151066&view=diff
==============================================================================
--- incubator/hise/trunk/itest/task_history.xml (original)
+++ incubator/hise/trunk/itest/task_history.xml Tue Jul 26 12:01:15 2011
@@ -4563,7 +4563,7 @@ declare namespace ns1='http://www.exampl
</soapenv:Body>
</soapenv:Envelope>]]></con:request>
<con:assertion type="SOAP Response"/>
- <con:assertion type="XQuery Match" disabled="true">
+ <con:assertion type="XQuery Match">
<con:configuration><path>declare namespace ns2='http://www.example.org/WS-HT/api';
declare namespace ns4='http://www.insurance.example.com/claims';
declare namespace ns3='http://www.example.org/WS-HT';
@@ -5023,7 +5023,7 @@ declare namespace ns1='http://www.exampl
<con:configuration/>
</con:assertion>
<con:assertion type="SOAP Fault Assertion"/>
- <con:assertion type="XQuery Match" disabled="true">
+ <con:assertion type="XQuery Match">
<con:configuration><path>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';
@@ -5097,7 +5097,7 @@ declare namespace ns1='http://www.exampl
<con:configuration/>
</con:assertion>
<con:assertion type="SOAP Fault Assertion"/>
- <con:assertion type="XQuery Match" disabled="true">
+ <con:assertion type="XQuery Match">
<con:configuration><path>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';
Modified: incubator/hise/trunk/pom.xml
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/pom.xml?rev=1151066&r1=1151065&r2=1151066&view=diff
==============================================================================
--- incubator/hise/trunk/pom.xml (original)
+++ incubator/hise/trunk/pom.xml Tue Jul 26 12:01:15 2011
@@ -22,7 +22,7 @@
<groupId>org.apache.hise</groupId>
<artifactId>hise</artifactId>
<packaging>pom</packaging>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0-SNAPSHOT</version>
<modules>
<module>hise-wsdl</module>
<module>hise-test-example</module>
@@ -60,6 +60,11 @@
<build>
<pluginManagement>
<plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>1.5</version>
+ </plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
@@ -119,7 +124,4 @@
</dependency>
</dependencies>
</dependencyManagement>
-
-
-
</project>
Modified: incubator/hise/trunk/rtests/src/test/java/org/apache/hise/evalpeople/EvalPeopleTest.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/rtests/src/test/java/org/apache/hise/evalpeople/EvalPeopleTest.java?rev=1151066&r1=1151065&r2=1151066&view=diff
==============================================================================
--- incubator/hise/trunk/rtests/src/test/java/org/apache/hise/evalpeople/EvalPeopleTest.java (original)
+++ incubator/hise/trunk/rtests/src/test/java/org/apache/hise/evalpeople/EvalPeopleTest.java Tue Jul 26 12:01:15 2011
@@ -11,6 +11,8 @@ import org.junit.Before;
import org.junit.Test;
import org.springframework.util.Assert;
+//TODO ww
+@org.junit.Ignore
public class EvalPeopleTest extends TaskTestBase {
private Task task = null;
Modified: incubator/hise/trunk/rtests/src/test/java/org/apache/hise/managementApi/PagingTest.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/rtests/src/test/java/org/apache/hise/managementApi/PagingTest.java?rev=1151066&r1=1151065&r2=1151066&view=diff
==============================================================================
--- incubator/hise/trunk/rtests/src/test/java/org/apache/hise/managementApi/PagingTest.java (original)
+++ incubator/hise/trunk/rtests/src/test/java/org/apache/hise/managementApi/PagingTest.java Tue Jul 26 12:01:15 2011
@@ -17,6 +17,7 @@ import org.apache.hise.engine.wsdl.Illeg
import org.apache.hise.lang.xsd.htda.TStatus;
import org.apache.hise.lang.xsd.htda.TTask;
import org.apache.hise.lang.xsd.htda.TTaskAbstract;
+import org.apache.hise.lang.xsd.htdt.GetMyTasksResponseDocument.GetMyTasksResponse;
import org.apache.hise.runtime.Task;
import org.junit.Before;
import org.junit.Test;
@@ -59,17 +60,21 @@ public class PagingTest extends TaskTest
maxTasks = null;
fromTaskNumber = 3;
- tasks = management.getMyTasks("user1", "ALL", genericHumanRole, null, statuses, null, null, null, maxTasks, fromTaskNumber).getGetMyTasksResponse().getTaskAbstractList();
+ GetMyTasksResponse getMyTasksResponse = management.getMyTasks("user1", "ALL", genericHumanRole, null, statuses, null, null, null, maxTasks, fromTaskNumber).getGetMyTasksResponse();
+ tasks = getMyTasksResponse.getTaskAbstractList();
Assert.assertEquals(3, tasks.size());
Assert.assertEquals(allTasksID[3], tasks.get(0).getId());
Assert.assertEquals(allTasksID[5], tasks.get(2).getId());
+ Assert.assertEquals(false, getMyTasksResponse.isSetMatchingTasksNo());
maxTasks = 3;
fromTaskNumber = 1;
- tasks = management.getMyTasks("user1", "ALL", genericHumanRole, null, statuses, null, null, null, maxTasks, fromTaskNumber).getGetMyTasksResponse().getTaskAbstractList();
+ getMyTasksResponse = management.getMyTasks("user1", "ALL", genericHumanRole, null, statuses, null, null, null, maxTasks, fromTaskNumber).getGetMyTasksResponse();
+ tasks = getMyTasksResponse.getTaskAbstractList();
Assert.assertEquals(3, tasks.size());
Assert.assertEquals(allTasksID[1], tasks.get(0).getId());
Assert.assertEquals(allTasksID[3], tasks.get(2).getId());
+ Assert.assertEquals(6, getMyTasksResponse.getMatchingTasksNo());
maxTasks = 3;
fromTaskNumber = 4;
@@ -82,6 +87,12 @@ public class PagingTest extends TaskTest
fromTaskNumber = 6;
tasks = management.getMyTasks("user1", "ALL", genericHumanRole, null, statuses,null, null, null, maxTasks, fromTaskNumber).getGetMyTasksResponse().getTaskAbstractList();
Assert.assertEquals(0, tasks.size());
+
+ maxTasks = 20;
+ fromTaskNumber = 3;
+ getMyTasksResponse = management.getMyTasks("user1", "ALL", genericHumanRole, null, statuses, null, null, null, maxTasks, fromTaskNumber).getGetMyTasksResponse();
+ tasks = getMyTasksResponse.getTaskAbstractList();
+ Assert.assertEquals(6, getMyTasksResponse.getMatchingTasksNo());
}
@Test