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 ut...@apache.org on 2010/09/09 15:03:59 UTC
svn commit: r995452 [2/5] - in /incubator/hise/trunk: ./ hise-fe/
hise-fe/src/ hise-fe/src/main/ hise-fe/src/main/java/
hise-fe/src/main/java/org/ hise-fe/src/main/java/org/apache/
hise-fe/src/main/java/org/apache/hise/ hise-fe/src/main/java/org/apache...
Added: incubator/hise/trunk/hise-fe/src/main/java/org/apache/hise/fe/server/dtos/FilterCriteriaDto.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-fe/src/main/java/org/apache/hise/fe/server/dtos/FilterCriteriaDto.java?rev=995452&view=auto
==============================================================================
--- incubator/hise/trunk/hise-fe/src/main/java/org/apache/hise/fe/server/dtos/FilterCriteriaDto.java (added)
+++ incubator/hise/trunk/hise-fe/src/main/java/org/apache/hise/fe/server/dtos/FilterCriteriaDto.java Thu Sep 9 15:03:55 2010
@@ -0,0 +1,67 @@
+package org.apache.hise.fe.server.dtos;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.hise.fe.server.dtos.enums.HumanRole;
+import org.apache.hise.fe.server.dtos.enums.Status;
+
+
+public class FilterCriteriaDto implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ private HumanRole genericHumanRole = HumanRole.values()[0];
+ private List<Status> statuses = new ArrayList<Status>();
+
+ @Override
+ public int hashCode() {
+ int hashCode = (genericHumanRole != null) ? genericHumanRole.hashCode() : 0;
+ if (statuses != null) {
+ for (Status status : statuses) {
+ hashCode += status.hashCode();
+ }
+ }
+ return hashCode;
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ if (object == null) return false;
+ if (!(object instanceof FilterCriteriaDto)) return false;
+ if (object.hashCode() != hashCode()) return false;
+
+ FilterCriteriaDto other = (FilterCriteriaDto) object;
+ return areHumanRolesEqual(other) && areStatusesEqual(other);
+ }
+
+ private boolean areHumanRolesEqual(FilterCriteriaDto other) {
+ if (genericHumanRole == null && other.genericHumanRole != null) return false;
+ if (!genericHumanRole.equals(other.genericHumanRole)) return false;
+ return true;
+ }
+
+ private boolean areStatusesEqual(FilterCriteriaDto other) {
+ if (statuses == null && other.statuses != null) return false;
+ if (!statuses.equals(other.statuses)) return false;
+ return true;
+ }
+
+ public HumanRole getGenericHumanRole() {
+ return genericHumanRole;
+ }
+
+ public void setGenericHumanRole(HumanRole genericHumanRole) {
+ this.genericHumanRole = genericHumanRole;
+ }
+
+ public List<Status> getStatuses() {
+ return statuses;
+ }
+
+ public void setStatuses(List<Status> statuses) {
+ this.statuses = statuses;
+ }
+
+}
Added: incubator/hise/trunk/hise-fe/src/main/java/org/apache/hise/fe/server/dtos/TaskDto.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-fe/src/main/java/org/apache/hise/fe/server/dtos/TaskDto.java?rev=995452&view=auto
==============================================================================
--- incubator/hise/trunk/hise-fe/src/main/java/org/apache/hise/fe/server/dtos/TaskDto.java (added)
+++ incubator/hise/trunk/hise-fe/src/main/java/org/apache/hise/fe/server/dtos/TaskDto.java Thu Sep 9 15:03:55 2010
@@ -0,0 +1,231 @@
+package org.apache.hise.fe.server.dtos;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.List;
+
+import org.apache.hise.fe.server.dtos.enums.Status;
+
+
+public class TaskDto implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ private String id;
+ private String taskType;
+ private Status status;
+ private Integer priority;
+ private String taskInitiator;
+ private String actualOwner;
+ private Date createdOn;
+ private String createdBy;
+ private Date activationTime;
+ private Date expirationTime;
+ private boolean isSkipable;
+ private boolean hasPotentialOwners;
+ private boolean startByExists;
+ private boolean completeByExists;
+ private String presentationName;
+ private String presentationSubject;
+ private boolean renderingMethodExists;
+ private boolean hasOutput;
+ private boolean hasFault;
+ private boolean hasAttachments;
+ private boolean hasComments;
+ private boolean escalated;
+ private String primarySearchBy;
+ private List<Object> any;
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public Status getStatus() {
+ return status;
+ }
+
+ public void setStatus(Status status) {
+ this.status = status;
+ }
+
+ public String getActualOwner() {
+ return actualOwner;
+ }
+
+ public void setActualOwner(String actualOwner) {
+ this.actualOwner = actualOwner;
+ }
+
+ public String getPresentationName() {
+ return presentationName;
+ }
+
+ public void setPresentationName(String presentationName) {
+ this.presentationName = presentationName;
+ }
+
+ public String getPresentationSubject() {
+ return presentationSubject;
+ }
+
+ public void setPresentationSubject(String presentationSubject) {
+ this.presentationSubject = presentationSubject;
+ }
+
+ public String getTaskType() {
+ return taskType;
+ }
+
+ public void setTaskType(String taskType) {
+ this.taskType = taskType;
+ }
+
+ public Integer getPriority() {
+ return priority;
+ }
+
+ public void setPriority(Integer priority) {
+ this.priority = priority;
+ }
+
+ public String getTaskInitiator() {
+ return taskInitiator;
+ }
+
+ public void setTaskInitiator(String taskInitiator) {
+ this.taskInitiator = taskInitiator;
+ }
+
+ public String getCreatedBy() {
+ return createdBy;
+ }
+
+ public void setCreatedBy(String createdBy) {
+ this.createdBy = createdBy;
+ }
+
+ public String getPrimarySearchBy() {
+ return primarySearchBy;
+ }
+
+ public void setPrimarySearchBy(String primarySearchBy) {
+ this.primarySearchBy = primarySearchBy;
+ }
+
+ public boolean getIsSkipable() {
+ return isSkipable;
+ }
+
+ public void setIsSkipable(boolean isSkipable) {
+ this.isSkipable = isSkipable;
+ }
+
+ public boolean getHasPotentialOwners() {
+ return hasPotentialOwners;
+ }
+
+ public void setHasPotentialOwners(boolean hasPotentialOwners) {
+ this.hasPotentialOwners = hasPotentialOwners;
+ }
+
+ public boolean getStartByExists() {
+ return startByExists;
+ }
+
+ public void setStartByExists(boolean startByExists) {
+ this.startByExists = startByExists;
+ }
+
+ public boolean getCompleteByExists() {
+ return completeByExists;
+ }
+
+ public void setCompleteByExists(boolean completeByExists) {
+ this.completeByExists = completeByExists;
+ }
+
+ public boolean getRenderingMethodExists() {
+ return renderingMethodExists;
+ }
+
+ public void setRenderingMethodExists(boolean renderingMethodExists) {
+ this.renderingMethodExists = renderingMethodExists;
+ }
+
+ public boolean getHasOutput() {
+ return hasOutput;
+ }
+
+ public void setHasOutput(boolean hasOutput) {
+ this.hasOutput = hasOutput;
+ }
+
+ public boolean getHasFault() {
+ return hasFault;
+ }
+
+ public void setHasFault(boolean hasFault) {
+ this.hasFault = hasFault;
+ }
+
+ public boolean getHasAttachments() {
+ return hasAttachments;
+ }
+
+ public void setHasAttachments(boolean hasAttachments) {
+ this.hasAttachments = hasAttachments;
+ }
+
+ public boolean getHasComments() {
+ return hasComments;
+ }
+
+ public void setHasComments(boolean hasComments) {
+ this.hasComments = hasComments;
+ }
+
+ public boolean getEscalated() {
+ return escalated;
+ }
+
+ public void setEscalated(boolean escalated) {
+ this.escalated = escalated;
+ }
+
+ public Date getCreatedOn() {
+ return createdOn;
+ }
+
+ public void setCreatedOn(Date createdOn) {
+ this.createdOn = createdOn;
+ }
+
+ public Date getActivationTime() {
+ return activationTime;
+ }
+
+ public void setActivationTime(Date activationTime) {
+ this.activationTime = activationTime;
+ }
+
+ public Date getExpirationTime() {
+ return expirationTime;
+ }
+
+ public void setExpirationTime(Date expirationTime) {
+ this.expirationTime = expirationTime;
+ }
+
+ public List<Object> getAny() {
+ return any;
+ }
+
+ public void setAny(List<Object> any) {
+ this.any = any;
+ }
+
+}
Added: incubator/hise/trunk/hise-fe/src/main/java/org/apache/hise/fe/server/dtos/enums/Action.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-fe/src/main/java/org/apache/hise/fe/server/dtos/enums/Action.java?rev=995452&view=auto
==============================================================================
--- incubator/hise/trunk/hise-fe/src/main/java/org/apache/hise/fe/server/dtos/enums/Action.java (added)
+++ incubator/hise/trunk/hise-fe/src/main/java/org/apache/hise/fe/server/dtos/enums/Action.java Thu Sep 9 15:03:55 2010
@@ -0,0 +1,30 @@
+package org.apache.hise.fe.server.dtos.enums;
+
+public enum Action {
+
+ CLAIM {
+ @Override
+ public String toString() {
+ return "Przypisz zadanie";
+ }
+ },
+ START {
+ @Override
+ public String toString() {
+ return "Rozpocznij zadanie";
+ }
+ },
+ COMPLETE {
+ @Override
+ public String toString() {
+ return "UkoÅczone";
+ }
+ },
+ FAIL {
+ @Override
+ public String toString() {
+ return "Nieudane";
+ }
+ }
+
+}
Added: incubator/hise/trunk/hise-fe/src/main/java/org/apache/hise/fe/server/dtos/enums/HumanRole.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-fe/src/main/java/org/apache/hise/fe/server/dtos/enums/HumanRole.java?rev=995452&view=auto
==============================================================================
--- incubator/hise/trunk/hise-fe/src/main/java/org/apache/hise/fe/server/dtos/enums/HumanRole.java (added)
+++ incubator/hise/trunk/hise-fe/src/main/java/org/apache/hise/fe/server/dtos/enums/HumanRole.java Thu Sep 9 15:03:55 2010
@@ -0,0 +1,32 @@
+package org.apache.hise.fe.server.dtos.enums;
+
+/**
+ * Enum representing possible values for generic human role.
+ * Function getName returns name to be used when calling HISE.
+ * Function toString returns human readable string, to be displayed in the frontend.
+ */
+public enum HumanRole {
+
+ ACTUAL_OWNER {
+ @Override
+ public String toString() {
+ return "Twoje zadania";
+ }
+ @Override
+ public String getName() {
+ return "ACTUALOWNER";
+ }
+ },
+ POTENTIAL_OWNERS {
+ @Override
+ public String toString() {
+ return "Inne zadania do realizacji";
+ }
+ @Override
+ public String getName() {
+ return "POTENTIALOWNERS";
+ }
+ };
+
+ abstract public String getName();
+}
Added: incubator/hise/trunk/hise-fe/src/main/java/org/apache/hise/fe/server/dtos/enums/Status.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-fe/src/main/java/org/apache/hise/fe/server/dtos/enums/Status.java?rev=995452&view=auto
==============================================================================
--- incubator/hise/trunk/hise-fe/src/main/java/org/apache/hise/fe/server/dtos/enums/Status.java (added)
+++ incubator/hise/trunk/hise-fe/src/main/java/org/apache/hise/fe/server/dtos/enums/Status.java Thu Sep 9 15:03:55 2010
@@ -0,0 +1,86 @@
+package org.apache.hise.fe.server.dtos.enums;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+public enum Status {
+
+ CREATED {
+ @Override
+ public String toString() {
+ return "Utworzone";
+ }
+ },
+ READY {
+ @Override
+ public String toString() {
+ return "Gotowe";
+ }
+ @Override
+ public List<Action> getAvailableActions() {
+ return Arrays.asList(Action.CLAIM);
+ }
+ },
+ RESERVED {
+ @Override
+ public String toString() {
+ return "Zarezerwowane";
+ }
+ @Override
+ public List<Action> getAvailableActions() {
+ return Arrays.asList(Action.START);
+ }
+ },
+ IN_PROGRESS {
+ @Override
+ public String toString() {
+ return "Realizowane";
+ }
+ @Override
+ public List<Action> getAvailableActions() {
+ return Arrays.asList(Action.COMPLETE, Action.FAIL);
+ }
+ },
+ SUSPENDED {
+ @Override
+ public String toString() {
+ return "Wstrzymane";
+ }
+ },
+ COMPLETED {
+ @Override
+ public String toString() {
+ return "UkoÅczone";
+ }
+ },
+ FAILED {
+ @Override
+ public String toString() {
+ return "Nieudane";
+ }
+ },
+ ERROR {
+ @Override
+ public String toString() {
+ return "BÅÄ
d";
+ }
+ },
+ EXITED {
+ @Override
+ public String toString() {
+ return "Porzucone";
+ }
+ },
+ OBSOLETE {
+ @Override
+ public String toString() {
+ return "Nieaktualne";
+ }
+ };
+
+ public List<Action> getAvailableActions() {
+ return new ArrayList<Action>();
+ }
+
+}
Added: incubator/hise/trunk/hise-fe/src/main/java/org/apache/hise/fe/server/dtos/exceptions/HiseApplicationException.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-fe/src/main/java/org/apache/hise/fe/server/dtos/exceptions/HiseApplicationException.java?rev=995452&view=auto
==============================================================================
--- incubator/hise/trunk/hise-fe/src/main/java/org/apache/hise/fe/server/dtos/exceptions/HiseApplicationException.java (added)
+++ incubator/hise/trunk/hise-fe/src/main/java/org/apache/hise/fe/server/dtos/exceptions/HiseApplicationException.java Thu Sep 9 15:03:55 2010
@@ -0,0 +1,23 @@
+package org.apache.hise.fe.server.dtos.exceptions;
+
+
+public class HiseApplicationException extends RuntimeException {
+
+ private static final long serialVersionUID = 1L;
+
+ public HiseApplicationException() {
+ }
+
+ public HiseApplicationException(String s) {
+ super(s);
+ }
+
+ public HiseApplicationException(String s, Throwable throwable) {
+ super(s, throwable);
+ }
+
+ public HiseApplicationException(Throwable throwable) {
+ super(throwable);
+ }
+
+}
Added: incubator/hise/trunk/hise-fe/src/main/java/org/apache/hise/fe/server/facades/TaskFacade.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-fe/src/main/java/org/apache/hise/fe/server/facades/TaskFacade.java?rev=995452&view=auto
==============================================================================
--- incubator/hise/trunk/hise-fe/src/main/java/org/apache/hise/fe/server/facades/TaskFacade.java (added)
+++ incubator/hise/trunk/hise-fe/src/main/java/org/apache/hise/fe/server/facades/TaskFacade.java Thu Sep 9 15:03:55 2010
@@ -0,0 +1,21 @@
+package org.apache.hise.fe.server.facades;
+
+import java.util.List;
+
+import org.apache.hise.fe.server.dtos.FilterCriteriaDto;
+import org.apache.hise.fe.server.dtos.TaskDto;
+import org.apache.hise.fe.server.dtos.exceptions.HiseApplicationException;
+
+
+public interface TaskFacade {
+
+ public List<TaskDto> getMyTasks(FilterCriteriaDto filter) throws HiseApplicationException;
+
+ void claim(String taskId) throws HiseApplicationException;
+
+ void start(String taskId) throws HiseApplicationException;
+
+ void complete(String taskId) throws HiseApplicationException;
+
+ void fail(String taskId) throws HiseApplicationException;
+}
Added: incubator/hise/trunk/hise-fe/src/main/java/org/apache/hise/fe/server/facades/impl/TaskFacade.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-fe/src/main/java/org/apache/hise/fe/server/facades/impl/TaskFacade.java?rev=995452&view=auto
==============================================================================
--- incubator/hise/trunk/hise-fe/src/main/java/org/apache/hise/fe/server/facades/impl/TaskFacade.java (added)
+++ incubator/hise/trunk/hise-fe/src/main/java/org/apache/hise/fe/server/facades/impl/TaskFacade.java Thu Sep 9 15:03:55 2010
@@ -0,0 +1,86 @@
+package org.apache.hise.fe.server.facades.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.hise.fe.server.dtos.FilterCriteriaDto;
+import org.apache.hise.fe.server.dtos.TaskDto;
+import org.apache.hise.fe.server.dtos.exceptions.HiseApplicationException;
+import org.apache.hise.fe.server.utils.SecurityUtil;
+import org.apache.hise.wsclient.facade.FilterCriteria;
+import org.apache.hise.wsclient.facade.HiseApiFacade;
+import org.apache.hise.wsclient.facade.HiseException;
+import org.apache.hise.wsclient.model.Task;
+import org.dozer.DozerBeanMapper;
+
+
+public class TaskFacade implements org.apache.hise.fe.server.facades.TaskFacade {
+
+ private SecurityUtil securityUtil;
+ private HiseApiFacade hiseFacade;
+ private DozerBeanMapper dozer;
+
+ @Override
+ public List<TaskDto> getMyTasks(FilterCriteriaDto filterCriteria) {
+ try {
+ List<Task> tasks = hiseFacade.getMyTasks(securityUtil.getUsername(), securityUtil.getPassword(), dozer.map(filterCriteria, FilterCriteria.class));
+ System.out.println("Got tasks, count=" + tasks.size());
+ List<TaskDto> dtos = new ArrayList<TaskDto>();
+ for (Task task : tasks) {
+ dtos.add(dozer.map(task, TaskDto.class));
+ }
+ return dtos;
+ } catch (HiseException e) {
+ throw new HiseApplicationException(e.getMessage(), e.getCause());
+ }
+ }
+
+ @Override
+ public void claim(String taskId) {
+ try {
+ hiseFacade.claim(securityUtil.getUsername(), securityUtil.getPassword(), taskId);
+ } catch (HiseException e) {
+ throw new HiseApplicationException(e.getMessage(), e.getCause());
+ }
+ }
+
+ @Override
+ public void fail(String taskId) {
+ try {
+ hiseFacade.fail(securityUtil.getUsername(), securityUtil.getPassword(), taskId);
+ } catch (HiseException e) {
+ throw new HiseApplicationException(e.getMessage(), e.getCause());
+ }
+ }
+
+ @Override
+ public void complete(String taskId) {
+ try {
+ hiseFacade.complete(securityUtil.getUsername(), securityUtil.getPassword(), taskId, null);
+ } catch (HiseException e) {
+ throw new HiseApplicationException(e.getMessage(), e.getCause());
+ }
+ }
+
+ @Override
+ public void start(String taskId) {
+ try {
+ hiseFacade.start(securityUtil.getUsername(), securityUtil.getPassword(), taskId);
+ } catch (HiseException e) {
+ throw new HiseApplicationException(e.getMessage(), e.getCause());
+ }
+ }
+
+ public void setSecurityUtil(SecurityUtil securityUtil) {
+ this.securityUtil = securityUtil;
+ }
+
+ public void setHiseFacade(HiseApiFacade hiseFacade) {
+ this.hiseFacade = hiseFacade;
+ }
+
+ public void setDozer(DozerBeanMapper dozer) {
+ this.dozer = dozer;
+ }
+
+}
Added: incubator/hise/trunk/hise-fe/src/main/java/org/apache/hise/fe/server/utils/SecurityUtil.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-fe/src/main/java/org/apache/hise/fe/server/utils/SecurityUtil.java?rev=995452&view=auto
==============================================================================
--- incubator/hise/trunk/hise-fe/src/main/java/org/apache/hise/fe/server/utils/SecurityUtil.java (added)
+++ incubator/hise/trunk/hise-fe/src/main/java/org/apache/hise/fe/server/utils/SecurityUtil.java Thu Sep 9 15:03:55 2010
@@ -0,0 +1,24 @@
+package org.apache.hise.fe.server.utils;
+
+import org.springframework.security.Authentication;
+import org.springframework.security.context.SecurityContextHolder;
+
+
+
+public class SecurityUtil {
+
+ public String getUsername() {
+ Authentication loggedUser = SecurityContextHolder.getContext().getAuthentication();
+ return loggedUser.getName();
+ }
+
+ public String getPassword() {
+ Authentication loggedUser = SecurityContextHolder.getContext().getAuthentication();
+ String password = "";
+ if (loggedUser.getCredentials() != null) {
+ password = loggedUser.getCredentials().toString();
+ }
+ return password;
+ }
+
+}
Added: incubator/hise/trunk/hise-fe/src/main/resources/backendConfiguration.xml
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-fe/src/main/resources/backendConfiguration.xml?rev=995452&view=auto
==============================================================================
--- incubator/hise/trunk/hise-fe/src/main/resources/backendConfiguration.xml (added)
+++ incubator/hise/trunk/hise-fe/src/main/resources/backendConfiguration.xml Thu Sep 9 15:03:55 2010
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
+
+ <import resource="classpath:/hiseWsClientContext.xml"/>
+
+ <bean name="taskFacade" class="org.apache.hise.fe.server.facades.impl.TaskFacade">
+ <property name="hiseFacade" ref="hiseWsClient"/>
+ <property name="securityUtil" ref="securityUtil" />
+ <property name="dozer" ref="dozer" />
+ </bean>
+
+ <bean name="securityUtil" class="org.apache.hise.fe.server.utils.SecurityUtil"/>
+ <bean name="dozer" class="org.dozer.DozerBeanMapper"/>
+
+</beans>
\ No newline at end of file
Added: incubator/hise/trunk/hise-fe/src/main/resources/gwtRpcConfiguration.xml
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-fe/src/main/resources/gwtRpcConfiguration.xml?rev=995452&view=auto
==============================================================================
--- incubator/hise/trunk/hise-fe/src/main/resources/gwtRpcConfiguration.xml (added)
+++ incubator/hise/trunk/hise-fe/src/main/resources/gwtRpcConfiguration.xml Thu Sep 9 15:03:55 2010
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
+
+ <bean id="rpcExporterTaskFacade" class="org.gwtwidgets.server.spring.GWTRPCServiceExporter">
+ <property name="service" ref="taskFacade"/>
+ <property name="serviceInterfaces" value="org.apache.hise.fe.gwt.client.rpc.TaskFacade"/>
+ </bean>
+
+ <!-- URL mapping -->
+ <bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
+ <property name="mappings">
+ <map>
+ <entry key="rpc/TaskFacade.do" value-ref="rpcExporterTaskFacade"/>
+ </map>
+ </property>
+ </bean>
+ <!-- ~ URL mapping -->
+
+</beans>
\ No newline at end of file
Added: incubator/hise/trunk/hise-fe/src/main/resources/hisefe.properties
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-fe/src/main/resources/hisefe.properties?rev=995452&view=auto
==============================================================================
--- incubator/hise/trunk/hise-fe/src/main/resources/hisefe.properties (added)
+++ incubator/hise/trunk/hise-fe/src/main/resources/hisefe.properties Thu Sep 9 15:03:55 2010
@@ -0,0 +1,5 @@
+#hise.service.url= http://192.168.0.187:8080/hise/taskOperations/
+
+#hise.service.url= http://p4.touk.pl:8181/cxf/taskOperations/
+
+hise.service.url=http://localhost:8181/cxf/taskOperations/
Added: incubator/hise/trunk/hise-fe/src/main/resources/security.xml
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-fe/src/main/resources/security.xml?rev=995452&view=auto
==============================================================================
--- incubator/hise/trunk/hise-fe/src/main/resources/security.xml (added)
+++ incubator/hise/trunk/hise-fe/src/main/resources/security.xml Thu Sep 9 15:03:55 2010
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans:beans xmlns="http://www.springframework.org/schema/security"
+ xmlns:beans="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+ http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-2.0.4.xsd">
+
+ <authentication-manager alias="springSecurityManager"/>
+
+ <authentication-provider>
+ <user-service>
+ <user name="user1" password="pass1" authorities="ROLE_USER" />
+ <user name="someUser" password="someUser" authorities="ROLE_USER" />
+ <user name="user2" password="pass2" authorities="ROLE_USER" />
+ <user name="admin" password="admin" authorities="ROLE_USER" />
+ </user-service>
+ </authentication-provider>
+
+ <http>
+ <intercept-url pattern="/login.jsp*" filters="none" />
+ <intercept-url pattern='/css/**' filters='none'/>
+ <intercept-url pattern="/**" access="ROLE_USER" />
+ <form-login login-page="/login.jsp" authentication-failure-url="/login.jsp?errorCode=1" default-target-url="/index.jsp"/>
+ <logout logout-success-url="/login.jsp" />
+ </http>
+
+</beans:beans>
\ No newline at end of file
Added: incubator/hise/trunk/hise-fe/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-fe/src/main/webapp/WEB-INF/web.xml?rev=995452&view=auto
==============================================================================
--- incubator/hise/trunk/hise-fe/src/main/webapp/WEB-INF/web.xml (added)
+++ incubator/hise/trunk/hise-fe/src/main/webapp/WEB-INF/web.xml Thu Sep 9 15:03:55 2010
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
+
+ <display-name>HISE Frontend</display-name>
+
+ <context-param>
+ <param-name>contextConfigLocation</param-name>
+ <param-value>
+ classpath:/security.xml,
+ classpath:/backendConfiguration.xml,
+ classpath:/gwtRpcConfiguration.xml,
+ classpath:/hiseWsClientContext.xml,
+ classpath:/cxf.xml
+ </param-value>
+ </context-param>
+
+ <filter>
+ <filter-name>springSecurityFilterChain</filter-name>
+ <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
+ </filter>
+
+ <filter-mapping>
+ <filter-name>springSecurityFilterChain</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+
+ <listener>
+ <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
+ </listener>
+
+ <listener>
+ <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
+ </listener>
+
+ <!-- GWT Servlet setting for handling RPC -->
+ <servlet>
+ <servlet-name>spring-gwt</servlet-name>
+ <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
+ <init-param>
+ <param-name>contextConfigLocation</param-name>
+ <param-value>classpath:/gwtRpcConfiguration.xml</param-value>
+ </init-param>
+ <load-on-startup>0</load-on-startup>
+ </servlet>
+ <!-- ~ GWT Servlet setting for handling RPC -->
+
+ <servlet-mapping>
+ <servlet-name>spring-gwt</servlet-name>
+ <url-pattern>*.do</url-pattern>
+ </servlet-mapping>
+
+ <welcome-file-list>
+ <welcome-file>index.jsp</welcome-file>
+ </welcome-file-list>
+</web-app>
Added: incubator/hise/trunk/hise-fe/src/main/webapp/css/hise.css
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-fe/src/main/webapp/css/hise.css?rev=995452&view=auto
==============================================================================
--- incubator/hise/trunk/hise-fe/src/main/webapp/css/hise.css (added)
+++ incubator/hise/trunk/hise-fe/src/main/webapp/css/hise.css Thu Sep 9 15:03:55 2010
@@ -0,0 +1,148 @@
+body {
+ font-size: 12pt;
+ font-family: Verdana, Sans-serif;
+}
+
+.loginPanel {
+ font-size: 10pt;
+ border: 1px solid #f0f0f0;
+}
+
+
+.loginPanel span {
+ font-weight: bold;
+}
+
+.submit input {
+ background-color: #78008a;
+ font-weight: bold;
+ color: white;
+ float:middle;
+}
+
+.mainView {
+ border-spacing: 20px;
+ width: 600px;
+}
+
+.taskListTitle {
+ background-color: #78008a;
+ font-weight: bold;
+ color: white;
+ text-align: center;
+ font-size: 16pt;
+}
+.taskListHeader {
+ background-color: #78008a;
+ font-weight: bold;
+ color: white;
+ text-align: center;
+}
+.taskListRow0 {
+ background-color: white;
+}
+.taskListRow1 {
+ background-color: #f0f0f0;
+}
+.taskList table {
+ border: 1px solid #f0f0f0;
+ width: 100%;
+}
+.taskListPanel {
+ width: 100%;
+}
+.taskList {
+ width: 100%;
+}
+.taskList td {
+ border: 1px solid #f0f0f0;
+}
+.taskListRowSelected {
+ background-color: lightgrey;
+}
+
+.taskInfoPanel {
+ border: 1px solid #f0f0f0;
+ width: 100%;
+}
+.taskInfoHeader {
+ background-color: #78008a;
+ font-weight: bold;
+ color: white;
+ text-align: left;
+}
+.taskInfoBody {
+ width: 100%;
+}
+.taskInfoLabel {
+ font-weight: bold;
+ width: 130px;
+}
+.refreshTasksPanel {
+ width: 100%;
+}
+
+.taskListPagingPanel {
+ background-color: #f0f0f0;
+ color: #78008a;
+ font-size: 8pt;
+ cursor: pointer;
+ width: 100%;
+}
+
+.refreshTasksButton {
+ float:left;
+}
+.taskListPagingBar {
+ float:right;
+ background-color: #f0f0f0;
+ color: #78008a;
+ font-size: 8pt;
+ cursor: pointer;
+}
+.taskListPageNumber {
+ margin: 2px;
+}
+.taskListSelectedPageNumber {
+ font-weight: bold;
+ margin: 2px;
+}
+.taskListTaskTotal {
+ float:right;
+}
+.filterPanel {
+ width: 100%;
+ border: 1px solid #f0f0f0;
+}
+.filterPanelHeader {
+ background-color: #78008a;
+ font-weight: bold;
+ color: white;
+ text-align: left;
+ width: 100%;
+}
+.filterHide {
+ float: right;
+}
+.filterPanelBody {
+ width: 100%;
+}
+.filterLabel {
+ font-weight: bold;
+ width: 130px;
+ vertical-align: top;
+}
+.gwt-ListBox {
+ width: 200px;
+}
+.filterButton {
+ float:left;
+ background-color: #78008a;
+ font-weight: bold;
+ color: white;
+ font-size: 10pt;
+ vertical-align: top;
+}
+.sortColumn {
+ text-decoration: underline;
+}
\ No newline at end of file
Added: incubator/hise/trunk/hise-fe/src/main/webapp/index.jsp
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-fe/src/main/webapp/index.jsp?rev=995452&view=auto
==============================================================================
--- incubator/hise/trunk/hise-fe/src/main/webapp/index.jsp (added)
+++ incubator/hise/trunk/hise-fe/src/main/webapp/index.jsp Thu Sep 9 15:03:55 2010
@@ -0,0 +1,17 @@
+<%@page contentType="text/html" pageEncoding="UTF-8"%>
+<html>
+ <head>
+ <title>HISE</title>
+
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
+ <meta name="gwt:property" content="locale=pl"/>
+ <meta name="gwt:property" content="locale=PL_pl"/>
+ <meta name="gwt:property" content="locale=pl_PL"/>
+ <link rel="stylesheet" type="text/css" href="./css/hise.css"/>
+ </head>
+
+ <body>
+ <script language="javascript" src="org.apache.hise.fe.gwt.HiseModule.nocache.js"></script>
+ <iframe id="__gwt_historyFrame" style="width:0;height:0;border:0"></iframe>
+ </body>
+</html>
Added: incubator/hise/trunk/hise-fe/src/main/webapp/login.jsp
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-fe/src/main/webapp/login.jsp?rev=995452&view=auto
==============================================================================
--- incubator/hise/trunk/hise-fe/src/main/webapp/login.jsp (added)
+++ incubator/hise/trunk/hise-fe/src/main/webapp/login.jsp Thu Sep 9 15:03:55 2010
@@ -0,0 +1,46 @@
+<%@page contentType="text/html" %>
+<%@page pageEncoding="UTF-8" %>
+
+<%--
+${param.errorCode}
+ 1 - unknown login or password
+--%>
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+
+<head>
+ <title>HISE</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <link rel="stylesheet" type="text/css" href="css/hise.css">
+
+</head>
+
+<body>
+ <table style="height: 100%; width: 100%">
+ <tr>
+ <td class="mainView" style="height: 100%; width: 100%; vertical-align: middle;">
+ <form action="j_spring_security_check" name="loginForm" method="post" class="loginForm">
+ <table class="loginPanel">
+ <tr>
+ <td><span>Login:</span></td>
+ <td><input name="j_username" class="text" type="text" value=""/></td>
+ </tr>
+ <tr>
+ <td><span>HasÅo:</span></td>
+ <td><input name="j_password" class="text" type="password" value=""/></td>
+ </tr>
+ <tr>
+ <td colspan="2" class="submit"><input type="submit" name="submit" title="Zaloguj" value="Zaloguj"/></td>
+ </tr>
+ </table>
+
+ <%-- ${param.errorCode} --%>
+ </td>
+ </tr>
+ </table>
+
+</body>
+
+</html>
\ No newline at end of file
Added: incubator/hise/trunk/hise-fe/src/test/java/org/apache/hise/fe/SpringConfigurationIntegrationTest.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-fe/src/test/java/org/apache/hise/fe/SpringConfigurationIntegrationTest.java?rev=995452&view=auto
==============================================================================
--- incubator/hise/trunk/hise-fe/src/test/java/org/apache/hise/fe/SpringConfigurationIntegrationTest.java (added)
+++ incubator/hise/trunk/hise-fe/src/test/java/org/apache/hise/fe/SpringConfigurationIntegrationTest.java Thu Sep 9 15:03:55 2010
@@ -0,0 +1,31 @@
+package org.apache.hise.fe;
+
+import javax.annotation.Resource;
+
+import org.gwtwidgets.server.spring.GWTRPCServiceExporter;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(locations = {"classpath:/backendConfiguration.xml", "classpath:/gwtRpcConfiguration.xml"})
+public class SpringConfigurationIntegrationTest extends AbstractJUnit4SpringContextTests {
+
+ @Resource(name = "rpcExporterTaskFacade")
+ private GWTRPCServiceExporter abstractTaskFacade;
+
+ @Test
+ public void testSpringConfigurationShouldSetBeansCorrectly() {
+ //given
+ //Spring application context should be read automatically
+
+ //when
+
+ //then
+ Assert.assertNotNull(abstractTaskFacade);
+ }
+}
Added: incubator/hise/trunk/hise-fe/src/test/java/org/apache/hise/fe/server/dtos/FilterCriteriaDtoUnitTest.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-fe/src/test/java/org/apache/hise/fe/server/dtos/FilterCriteriaDtoUnitTest.java?rev=995452&view=auto
==============================================================================
--- incubator/hise/trunk/hise-fe/src/test/java/org/apache/hise/fe/server/dtos/FilterCriteriaDtoUnitTest.java (added)
+++ incubator/hise/trunk/hise-fe/src/test/java/org/apache/hise/fe/server/dtos/FilterCriteriaDtoUnitTest.java Thu Sep 9 15:03:55 2010
@@ -0,0 +1,85 @@
+package org.apache.hise.fe.server.dtos;
+
+import java.util.Arrays;
+
+import org.apache.hise.fe.server.dtos.FilterCriteriaDto;
+import org.apache.hise.fe.server.dtos.enums.HumanRole;
+import org.apache.hise.fe.server.dtos.enums.Status;
+import org.junit.Assert;
+import org.junit.Test;
+
+
+
+public class FilterCriteriaDtoUnitTest {
+
+ @Test
+ public void testEqualsShouldReturnTrueForNewlyCreatedObjects() {
+ //given
+ FilterCriteriaDto one = new FilterCriteriaDto();
+ FilterCriteriaDto two = new FilterCriteriaDto();
+
+ //when
+ boolean result = one.equals(two);
+
+ //then
+ Assert.assertTrue(result);
+ }
+
+ @Test
+ public void testEqualsShouldReturnTrueForObjectsWithSameProperties() {
+ //given
+ FilterCriteriaDto one = new FilterCriteriaDto();
+ one.setStatuses(Arrays.asList(Status.COMPLETED, Status.CREATED));
+ FilterCriteriaDto two = new FilterCriteriaDto();
+ two.setStatuses(Arrays.asList(Status.COMPLETED, Status.CREATED));
+
+ //when
+ boolean result = one.equals(two);
+
+ //then
+ Assert.assertTrue(result);
+ }
+
+ @Test
+ public void testEqualsShouldReturnFalseForObjectsWithDifferentHumanRoles() {
+ //given
+ FilterCriteriaDto one = new FilterCriteriaDto();
+ one.setGenericHumanRole(HumanRole.ACTUAL_OWNER);
+ FilterCriteriaDto two = new FilterCriteriaDto();
+ two.setGenericHumanRole(HumanRole.POTENTIAL_OWNERS);
+
+ //when
+ boolean result = one.equals(two);
+
+ //then
+ Assert.assertTrue(!result);
+ }
+
+ @Test
+ public void testEqualsShouldReturnFalseForObjectsWithDifferentStatuses() {
+ //given
+ FilterCriteriaDto one = new FilterCriteriaDto();
+ one.setStatuses(Arrays.asList(Status.COMPLETED, Status.CREATED));
+ FilterCriteriaDto two = new FilterCriteriaDto();
+ two.setStatuses(Arrays.asList(Status.COMPLETED, Status.CREATED, Status.RESERVED));
+
+ //when
+ boolean result = one.equals(two);
+
+ //then
+ Assert.assertTrue(!result);
+ }
+
+ @Test
+ public void testEqualsShouldReturnTrueForNullObject() {
+ //given
+ FilterCriteriaDto one = new FilterCriteriaDto();
+ FilterCriteriaDto two = null;
+
+ //when
+ boolean result = one.equals(two);
+
+ //then
+ Assert.assertTrue(!result);
+ }
+}
Added: incubator/hise/trunk/hise-ws-client/pom.xml
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-ws-client/pom.xml?rev=995452&view=auto
==============================================================================
--- incubator/hise/trunk/hise-ws-client/pom.xml (added)
+++ incubator/hise/trunk/hise-ws-client/pom.xml Thu Sep 9 15:03:55 2010
@@ -0,0 +1,166 @@
+<?xml version="1.0"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <parent>
+ <groupId>org.apache.hise</groupId>
+ <artifactId>hise</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.hise</groupId>
+ <artifactId>hise-ws-client</artifactId>
+ <packaging>jar</packaging>
+ <version>1.0.0-SNAPSHOT</version>
+ <name>HISE webservice client</name>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-codegen-plugin</artifactId>
+ <version>${cxf.version}</version>
+ <executions>
+ <execution>
+ <id>process-sources</id>
+ <phase>process-sources</phase>
+ <goals>
+ <goal>wsdl2java</goal>
+ </goals>
+ <configuration>
+ <!--
+ <sourceRoot>${basedir}/target/generated-sources/java</sourceRoot>
+ -->
+ <wsdlOptions>
+ <wsdlOption>
+ <wsdl>${basedir}/src/main/resources/wsdls/ws-humantask.wsdl</wsdl>
+ <bindingFiles>
+ <bindingFile>${basedir}/src/main/binding/bindings-jaxws.xml</bindingFile>
+ <bindingFile>${basedir}/src/main/binding/bindings.xml</bindingFile>
+ </bindingFiles>
+ <extraargs>
+ <extraarg>-verbose</extraarg>
+ <extraarg>-client</extraarg>
+ </extraargs>
+ </wsdlOption>
+ </wsdlOptions>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.servicemix.tooling</groupId>
+ <artifactId>jbi-maven-plugin</artifactId>
+ <version>4.0</version>
+ <extensions>true</extensions>
+ </plugin>
+
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-core</artifactId>
+ <version>${spring.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-jws-api</artifactId>
+ <version>1.4.1</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.xml.ws</groupId>
+ <artifactId>jaxws-api</artifactId>
+ <version>2.1-1</version>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.xml.ws</groupId>
+ <artifactId>jaxws-rt</artifactId>
+ <version>2.1.3</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-core</artifactId>
+ <version>${cxf.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-frontend-jaxws</artifactId>
+ <version>${cxf.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-transports-http-jetty</artifactId>
+ <version>${cxf.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-management</artifactId>
+ <version>${cxf.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-common-utilities</artifactId>
+ <version>${cxf.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ws.security</groupId>
+ <artifactId>wss4j</artifactId>
+ <version>1.5.8</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-ws-security</artifactId>
+ <version>${cxf.version}</version>
+ </dependency>
+
+ <!--test dependencies-->
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-all</artifactId>
+ <scope>test</scope>
+ <version>1.8.0</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ <version>4.7</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-test</artifactId>
+ <version>${spring.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+</project>
Added: incubator/hise/trunk/hise-ws-client/src/main/binding/bindings-jaxws.xml
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-ws-client/src/main/binding/bindings-jaxws.xml?rev=995452&view=auto
==============================================================================
--- incubator/hise/trunk/hise-ws-client/src/main/binding/bindings-jaxws.xml (added)
+++ incubator/hise/trunk/hise-ws-client/src/main/binding/bindings-jaxws.xml Thu Sep 9 15:03:55 2010
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jaxws:bindings
+ jxb:extensionBindingPrefixes="jaxws jxb xjc"
+ version="2.0"
+ xmlns="http://java.sun.com/xml/ns/jaxb"
+ xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
+ xmlns:htd="http://www.example.org/WS-HT"
+ xmlns:htda="http://www.example.org/WS-HT/api"
+ xmlns:htdt="http://www.example.org/WS-HT/api/xsd"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:jaxws="http://java.sun.com/xml/ns/jaxws">
+
+ <jaxws:bindings schemaLocation="../../../resources/wsdls/ws-humantask.wsdl">
+
+ <jxb:globalBindings xmlns:jxb="http://java.sun.com/xml/ns/jaxb" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <jxb:javaType name="java.util.Date" xmlType="xs:dateTime" parseMethod="org.apache.cxf.tools.common.DataTypeAdapter.parseDateTime"
+ printMethod="org.apache.cxf.tools.common.DataTypeAdapter.printDateTime" />
+ </jxb:globalBindings>
+
+ <jaxws:bindings node="wsdl:definitions/wsdl:portType">
+ <jaxws:package name="org.apache.hise.ws"/>
+ <jaxws:class name="TaskOperationsInterface"/>
+ <jaxws:bindings node="wsdl:operation"/>
+ <!--
+ <jaxws:bindings node="wsdl:operation/wsdl:fault">
+ <jaxws:class name="TaskOperationsException"/>
+ </jaxws:bindings>
+ -->
+ </jaxws:bindings>
+
+ </jaxws:bindings>
+
+</jaxws:bindings>
\ No newline at end of file
Added: incubator/hise/trunk/hise-ws-client/src/main/binding/bindings.xml
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-ws-client/src/main/binding/bindings.xml?rev=995452&view=auto
==============================================================================
--- incubator/hise/trunk/hise-ws-client/src/main/binding/bindings.xml (added)
+++ incubator/hise/trunk/hise-ws-client/src/main/binding/bindings.xml Thu Sep 9 15:03:55 2010
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bindings
+ extensionBindingPrefixes="xjc"
+ version="2.0"
+ xmlns="http://java.sun.com/xml/ns/jaxb"
+ xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:htd="http://www.example.org/WS-HT"
+ xmlns:htda="http://www.example.org/WS-HT/api"
+ xmlns:htdt="http://www.example.org/WS-HT/api/xsd">
+
+ <bindings scd="x-schema::htd">
+ <schemaBindings>
+ <package name="org.apache.hise.model.htd" />
+ </schemaBindings>
+ </bindings>
+
+ <bindings scd="x-schema::htda">
+ <schemaBindings>
+ <package name="org.apache.hise.model.ws" />
+ </schemaBindings>
+
+ <globalBindings>
+ <serializable uid="9999001001001"/>
+ <javaType name="java.util.Calendar" xmlType="xs:date"
+ parseMethod="javax.xml.bind.DatatypeConverter.parseDate"
+ printMethod="javax.xml.bind.DatatypeConverter.printDate" />
+ </globalBindings>
+ </bindings>
+
+ <bindings scd="x-schema::htdt">
+ <schemaBindings>
+ <package name="org.apache.hise.ws.api" />
+ </schemaBindings>
+ </bindings>
+
+</bindings>
\ No newline at end of file
Added: 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=995452&view=auto
==============================================================================
--- incubator/hise/trunk/hise-ws-client/src/main/java/org/apache/hise/wsclient/facade/FilterCriteria.java (added)
+++ incubator/hise/trunk/hise-ws-client/src/main/java/org/apache/hise/wsclient/facade/FilterCriteria.java Thu Sep 9 15:03:55 2010
@@ -0,0 +1,76 @@
+package org.apache.hise.wsclient.facade;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import org.apache.hise.wsclient.model.enums.HumanRole;
+import org.apache.hise.wsclient.model.enums.Status;
+
+
+public class FilterCriteria implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ private HumanRole humanRole = HumanRole.ACTUAL_OWNER;
+
+ private List<Status> statuses = new ArrayList<Status>();
+
+ private String workQueue;
+
+ private Integer priority;
+
+ private Date completeByStartDate;
+
+ private Date completeByEndDate;
+
+ public HumanRole getGenericHumanRole() {
+ return humanRole;
+ }
+
+ public void setGenericHumanRole(HumanRole genericHumanRole) {
+ this.humanRole = genericHumanRole;
+ }
+
+ public List<Status> getStatuses() {
+ return statuses;
+ }
+
+ public void setStatuses(List<Status> statuses) {
+ this.statuses = statuses;
+ }
+
+ public String getWorkingQueue() {
+ return workQueue;
+ }
+
+ public void setWorkingQueue(String workingQueue) {
+ this.workQueue = workingQueue;
+ }
+
+ public void setPriority(Integer priority) {
+ this.priority = priority;
+ }
+
+ public Integer getPriority() {
+ return priority;
+ }
+
+ public void setCompleteByStartDate(Date completeByStartDate) {
+ this.completeByStartDate = completeByStartDate;
+ }
+
+ public Date getCompleteByStartDate() {
+ return completeByStartDate;
+ }
+
+ public void setCompleteByEndDate(Date completeByEndDate) {
+ this.completeByEndDate = completeByEndDate;
+ }
+
+ public Date getCompleteByEndDate() {
+ return completeByEndDate;
+ }
+
+}
Added: 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=995452&view=auto
==============================================================================
--- incubator/hise/trunk/hise-ws-client/src/main/java/org/apache/hise/wsclient/facade/HiseApiFacade.java (added)
+++ incubator/hise/trunk/hise-ws-client/src/main/java/org/apache/hise/wsclient/facade/HiseApiFacade.java Thu Sep 9 15:03:55 2010
@@ -0,0 +1,32 @@
+package org.apache.hise.wsclient.facade;
+
+
+import java.util.List;
+
+import org.apache.hise.wsclient.model.Comment;
+import org.apache.hise.wsclient.model.Task;
+
+/**
+ * Adapter to WS Human Task API.
+ *
+ * @author pmotacki
+ * @author Ula Trzaskowska
+ * @author Witek Wolejszo
+ */
+public interface HiseApiFacade {
+
+ List<Task> getMyTasks(String user, String password, FilterCriteria filterCriteria);
+ Task getTask(String user, String password, String taskId);
+
+ void claim(String user, String password, String identifier);
+ void start(String user, String password, String identifier);
+ 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);
+
+ Object getInput(String user, String password, String identifier, String part);
+ Object getRendering(String user, String password, String identifier, String renderingType);
+
+ List<Comment> getComments(String user, String password, String identifier);
+ void addComment(String user, String password, String identifier, String text);
+}
Added: 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=995452&view=auto
==============================================================================
--- incubator/hise/trunk/hise-ws-client/src/main/java/org/apache/hise/wsclient/facade/HiseApiFacadeImpl.java (added)
+++ incubator/hise/trunk/hise-ws-client/src/main/java/org/apache/hise/wsclient/facade/HiseApiFacadeImpl.java Thu Sep 9 15:03:55 2010
@@ -0,0 +1,216 @@
+package org.apache.hise.wsclient.facade;
+
+import javax.xml.namespace.QName;
+
+import org.apache.hise.model.htd.TOrganizationalEntity;
+import org.apache.hise.model.htd.TUserlist;
+import org.apache.hise.model.ws.TComment;
+import org.apache.hise.model.ws.TTask;
+import org.apache.hise.ws.IllegalAccessFault;
+import org.apache.hise.ws.IllegalArgumentFault;
+import org.apache.hise.ws.IllegalStateFault;
+import org.apache.hise.ws.RecipientNotAllowed;
+import org.apache.hise.ws.TaskOperationsInterface;
+import org.apache.hise.wsclient.infrastructure.CommentConverter;
+import org.apache.hise.wsclient.infrastructure.TaskConverter;
+import org.apache.hise.wsclient.infrastructure.Tasks;
+import org.apache.hise.wsclient.infrastructure.WSSecurityInterceptor;
+import org.apache.hise.wsclient.model.Comment;
+import org.apache.hise.wsclient.model.Task;
+import org.apache.hise.wsclient.model.enums.HumanRole;
+import org.apache.hise.wsclient.model.enums.Status;
+
+import java.util.Date;
+import java.util.List;
+
+public class HiseApiFacadeImpl implements HiseApiFacade {
+
+ private WSSecurityInterceptor wssInterceptor;
+ private TaskOperationsInterface service;
+ private TaskConverter taskConverter;
+ private CommentConverter commentConverter;
+
+ public List<Task> getMyTasks(String user, String password, FilterCriteria filterCriteria) {
+
+ wssInterceptor.addWsAuthentication(user, password);
+ Tasks tasks = new Tasks(wssInterceptor, service);
+
+ HumanRole humanRole = filterCriteria.getGenericHumanRole();
+ List<Status> statuses = filterCriteria.getStatuses();
+ String workingQueue = filterCriteria.getWorkingQueue();
+
+ try {
+
+ tasks.clear();
+
+ if (humanRole == null) {
+ tasks.retrieve(null, statuses);
+ }
+
+ if (humanRole != null && workingQueue == null) {
+ tasks.retrieve(humanRole, statuses);
+ }
+
+ if (humanRole != null && workingQueue != null) {
+ tasks.retrieve(humanRole, workingQueue, statuses);
+ }
+
+ } catch (Exception e) {
+ throw new HiseException("BÅÄ
d zwrócony przez webserwis HISE: " + e.getMessage(), e);
+ }
+
+ Integer priority = filterCriteria.getPriority();
+ if (priority != null) {
+ tasks.retainWithPriority(priority);
+ }
+
+ Date startDate = filterCriteria.getCompleteByStartDate();
+ Date endDate = filterCriteria.getCompleteByEndDate();
+ if (endDate != null && startDate != null) {
+ tasks.retainWithExpirationByBetween(startDate, endDate);
+ }
+
+ return tasks;
+ }
+
+ public Task getTask(String user, String password, String taskId) {
+ wssInterceptor.addWsAuthentication(user, password);
+ try {
+ TTask task = service.getTaskInfo(taskId);
+ return taskConverter.buildTask(task);
+ } catch (Exception e) {
+ throw new HiseException("BÅÄ
d zwrócony przez webserwis HISE: " + e.getMessage(), e);
+ }
+ }
+
+ public void claim(String user, String password, String identifier) {
+ wssInterceptor.addWsAuthentication(user, password);
+ try {
+ service.claim(identifier);
+ } catch (Exception e) {
+ throw new HiseException("BÅÄ
d zwrócony przez webserwis HISE: " + e.getMessage(), e);
+ }
+ }
+
+ public void start(String user, String password, String identifier) {
+ wssInterceptor.addWsAuthentication(user, password);
+ try {
+ service.start(identifier);
+ } catch (Exception e) {
+ throw new HiseException("BÅÄ
d zwrócony przez webserwis HISE: " + e.getMessage(), e);
+ }
+ }
+
+ public void fail(String user, String password, String identifier) {
+ wssInterceptor.addWsAuthentication(user, password);
+ try {
+ service.fail(identifier, "name", null);
+ } catch (Exception e) {
+ throw new HiseException("BÅÄ
d zwrócony przez webserwis HISE: " + e.getMessage(), e);
+ }
+ }
+
+ public void complete(String user, String password, String identifier, Object result) {
+ wssInterceptor.addWsAuthentication(user, password);
+ try {
+ service.complete(identifier, result);
+ } catch (Exception e) {
+ throw new HiseException("BÅÄ
d zwrócony przez webserwis HISE: " + e.getMessage(), e);
+ }
+ }
+
+ public Object getInput(String user, String password, String identifier, String part) {
+ wssInterceptor.addWsAuthentication(user, password);
+ try {
+ return service.getInput(identifier, part);
+ } catch (Exception e) {
+ throw new HiseException("BÅÄ
d zwrócony przez webserwis HISE: " + e.getMessage(), e);
+ }
+ }
+
+ /**
+ * @param user
+ * @param password
+ * @param identifier
+ * @param renderingType "{" + Namespace URI + "}" + local part.
+ */
+ public Object getRendering(String user, String password, String identifier, String renderingType) {
+ wssInterceptor.addWsAuthentication(user, password);
+ QName qName = QName.valueOf(renderingType);
+ Object rendering;
+ try {
+ rendering = service.getRendering(identifier, qName);
+ } catch (IllegalArgumentFault e) {
+ throw new HiseException("BÅÄ
d zwrócony przez webserwis HISE: " + e.getMessage(), e);
+ }
+ return rendering;
+ }
+
+ public List<Comment> getComments(String user, String password, String identifier) {
+ wssInterceptor.addWsAuthentication(user, password);
+ try {
+
+ List<TComment> wsComments = service.getComments(identifier);
+ List<Comment> comments = commentConverter.buildComments(wsComments);
+ return comments;
+
+ } catch (IllegalArgumentFault e) {
+ throw new HiseException("BÅÄ
d IllegalArgumentFault zwrócony przez webserwis HISE: " + e.getMessage(), e);
+ } catch (IllegalStateFault e) {
+ throw new HiseException("BÅÄ
d IllegalStateFault zwrócony przez webserwis HISE: " + e.getMessage(), e);
+ } catch (IllegalAccessFault e) {
+ throw new HiseException("BÅÄ
d IllegalAccessFault zwrócony przez webserwis HISE: " + e.getMessage(), e);
+ }
+ }
+
+ public void addComment(String user, String password, String identifier, String text) {
+ wssInterceptor.addWsAuthentication(user, password);
+ try {
+ service.addComment(identifier, text);
+ } catch (IllegalArgumentFault e) {
+ throw new HiseException("BÅÄ
d IllegalArgumentFault zwrócony przez webserwis HISE: " + e.getMessage(), e);
+ } catch (IllegalStateFault e) {
+ throw new HiseException("BÅÄ
d IllegalStateFault zwrócony przez webserwis HISE: " + e.getMessage(), e);
+ } catch (IllegalAccessFault e) {
+ throw new HiseException("BÅÄ
d IllegalAccessFault zwrócony przez webserwis HISE: " + e.getMessage(), e);
+ }
+ }
+
+ public void delegate(String user, String password, String identifier, String newActualOwner) {
+ wssInterceptor.addWsAuthentication(user, password);
+ try {
+ TUserlist users = new TUserlist();
+ TOrganizationalEntity entity = new TOrganizationalEntity();
+ entity.setUsers(users);
+ users.getUser().add(newActualOwner);
+ service.delegate(identifier, entity);
+ } catch (IllegalArgumentFault e) {
+ throw new HiseException("BÅÄ
d IllegalArgumentFault zwrócony przez webserwis HISE: " + e.getMessage(), e);
+ } catch (IllegalStateFault e) {
+ throw new HiseException("BÅÄ
d IllegalStateFault zwrócony przez webserwis HISE: " + e.getMessage(), e);
+ } catch (IllegalAccessFault e) {
+ throw new HiseException("BÅÄ
d IllegalAccessFault zwrócony przez webserwis HISE: " + e.getMessage(), e);
+ } catch (RecipientNotAllowed e) {
+ throw new HiseException("BÅÄ
d IllegalAccessFault zwrócony przez webserwis HISE: " + e.getMessage(), e);
+ }
+ }
+
+ // IoC setters
+
+ public void setService(TaskOperationsInterface service) {
+ this.service = service;
+ }
+
+ public void setWssInterceptor(WSSecurityInterceptor wssInterceptor) {
+ this.wssInterceptor = wssInterceptor;
+ }
+
+ public void setTaskConverter(TaskConverter taskConverter) {
+ this.taskConverter = taskConverter;
+ }
+
+ public void setCommentConverter(CommentConverter commentConverter) {
+ this.commentConverter = commentConverter;
+ }
+
+}
Added: incubator/hise/trunk/hise-ws-client/src/main/java/org/apache/hise/wsclient/facade/HiseException.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-ws-client/src/main/java/org/apache/hise/wsclient/facade/HiseException.java?rev=995452&view=auto
==============================================================================
--- incubator/hise/trunk/hise-ws-client/src/main/java/org/apache/hise/wsclient/facade/HiseException.java (added)
+++ incubator/hise/trunk/hise-ws-client/src/main/java/org/apache/hise/wsclient/facade/HiseException.java Thu Sep 9 15:03:55 2010
@@ -0,0 +1,15 @@
+package org.apache.hise.wsclient.facade;
+
+
+public class HiseException extends RuntimeException {
+
+ private static final long serialVersionUID = 4486234589968824489L;
+
+ public HiseException() {
+ super();
+ }
+
+ public HiseException(String s, Throwable throwable) {
+ super(s, throwable);
+ }
+}
Added: incubator/hise/trunk/hise-ws-client/src/main/java/org/apache/hise/wsclient/infrastructure/ClientPasswordCallback.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-ws-client/src/main/java/org/apache/hise/wsclient/infrastructure/ClientPasswordCallback.java?rev=995452&view=auto
==============================================================================
--- incubator/hise/trunk/hise-ws-client/src/main/java/org/apache/hise/wsclient/infrastructure/ClientPasswordCallback.java (added)
+++ incubator/hise/trunk/hise-ws-client/src/main/java/org/apache/hise/wsclient/infrastructure/ClientPasswordCallback.java Thu Sep 9 15:03:55 2010
@@ -0,0 +1,41 @@
+package org.apache.hise.wsclient.infrastructure;
+
+import java.io.IOException;
+
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.UnsupportedCallbackException;
+
+import org.apache.ws.security.WSPasswordCallback;
+import org.apache.commons.logging.LogFactory;
+import org.apache.commons.logging.Log;
+
+/**
+ * User: pmotacki
+ * Date: 2010-02-18
+ */
+public class ClientPasswordCallback implements CallbackHandler {
+
+ protected final Log logger = LogFactory.getLog(getClass());
+ private String password;
+
+ public ClientPasswordCallback(String password) {
+ this.password = password;
+ }
+
+ public ClientPasswordCallback() {
+ }
+
+ public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
+ WSPasswordCallback pc = (WSPasswordCallback) callbacks[0];
+ pc.setPassword(password);
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public void setPassword(String password) {
+ this.password = password;
+ }
+}
Added: incubator/hise/trunk/hise-ws-client/src/main/java/org/apache/hise/wsclient/infrastructure/CommentConverter.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-ws-client/src/main/java/org/apache/hise/wsclient/infrastructure/CommentConverter.java?rev=995452&view=auto
==============================================================================
--- incubator/hise/trunk/hise-ws-client/src/main/java/org/apache/hise/wsclient/infrastructure/CommentConverter.java (added)
+++ incubator/hise/trunk/hise-ws-client/src/main/java/org/apache/hise/wsclient/infrastructure/CommentConverter.java Thu Sep 9 15:03:55 2010
@@ -0,0 +1,35 @@
+package org.apache.hise.wsclient.infrastructure;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import javax.xml.datatype.XMLGregorianCalendar;
+
+import org.apache.hise.model.ws.TComment;
+import org.apache.hise.wsclient.model.Comment;
+public class CommentConverter {
+
+ public List<Comment> buildComments(List<TComment> wsComments) {
+ List<Comment> comments = new ArrayList<Comment>();
+ if (wsComments != null) {
+ for (TComment wsComment : wsComments) {
+ comments.add(buildComment(wsComment));
+ }
+ }
+ return comments;
+ }
+
+ private Comment buildComment(TComment wsComment) {
+ Comment comment = new Comment(toDate(wsComment.getAddedAt()), wsComment.getAddedBy(), wsComment.getText());
+ return comment;
+ }
+
+ private Date toDate(XMLGregorianCalendar date) {
+ if (date == null) {
+ return null;
+ }
+ return date.toGregorianCalendar().getTime();
+ }
+
+}
Added: incubator/hise/trunk/hise-ws-client/src/main/java/org/apache/hise/wsclient/infrastructure/OrganizationalEntityConverter.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-ws-client/src/main/java/org/apache/hise/wsclient/infrastructure/OrganizationalEntityConverter.java?rev=995452&view=auto
==============================================================================
--- incubator/hise/trunk/hise-ws-client/src/main/java/org/apache/hise/wsclient/infrastructure/OrganizationalEntityConverter.java (added)
+++ incubator/hise/trunk/hise-ws-client/src/main/java/org/apache/hise/wsclient/infrastructure/OrganizationalEntityConverter.java Thu Sep 9 15:03:55 2010
@@ -0,0 +1,30 @@
+/*
+ * Copyright by Touk (c) 2010
+*/
+package org.apache.hise.wsclient.infrastructure;
+
+import org.apache.hise.model.htd.TOrganizationalEntity;
+import org.apache.hise.wsclient.model.OrganizationalEntity;
+
+public class OrganizationalEntityConverter {
+
+ public OrganizationalEntity buildOrganizationalEntity(TOrganizationalEntity tOrganizationalEntity) {
+ if (tOrganizationalEntity == null) {
+ return null;
+ }
+ OrganizationalEntity ret = new OrganizationalEntity();
+
+ if (tOrganizationalEntity.getUsers() != null && tOrganizationalEntity.getUsers().getUser() != null) {
+ for (String user : tOrganizationalEntity.getUsers().getUser()) {
+ ret.getUsers().add(user);
+ }
+ }
+ if (tOrganizationalEntity.getGroups() != null && tOrganizationalEntity.getGroups().getGroup() != null) {
+ for (String group : tOrganizationalEntity.getGroups().getGroup()) {
+ ret.getGroups().add(group);
+ }
+ }
+ return ret;
+ }
+
+}
Added: incubator/hise/trunk/hise-ws-client/src/main/java/org/apache/hise/wsclient/infrastructure/TaskConverter.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-ws-client/src/main/java/org/apache/hise/wsclient/infrastructure/TaskConverter.java?rev=995452&view=auto
==============================================================================
--- incubator/hise/trunk/hise-ws-client/src/main/java/org/apache/hise/wsclient/infrastructure/TaskConverter.java (added)
+++ incubator/hise/trunk/hise-ws-client/src/main/java/org/apache/hise/wsclient/infrastructure/TaskConverter.java Thu Sep 9 15:03:55 2010
@@ -0,0 +1,111 @@
+package org.apache.hise.wsclient.infrastructure;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.hise.model.htd.TDeadlineInfo;
+import org.apache.hise.model.htd.TDeadlinesInfo;
+import org.apache.hise.model.ws.TTask;
+import org.apache.hise.wsclient.model.Task;
+import org.apache.hise.wsclient.model.enums.Status;
+import org.springframework.util.Assert;
+
+import javax.xml.datatype.XMLGregorianCalendar;
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.List;
+
+public class TaskConverter {
+
+ public List<Task> buildTasks(List<TTask> wsTasks) {
+ List<Task> tasks = new ArrayList<Task>();
+ if (wsTasks != null) {
+ for (TTask wsTask : wsTasks) {
+ tasks.add(buildTask(wsTask));
+ }
+ }
+ return tasks;
+ }
+
+ public Task buildTask(TTask wsTask) {
+ Assert.notNull(wsTask);
+
+ Task task = new Task();
+ task.setId(StringUtils.defaultString(wsTask.getId()));
+ task.setActivationTime(toDate(wsTask.getActivationTime()));
+ task.setActualOwner(StringUtils.defaultString(wsTask.getActualOwner()));
+ task.setAny(returnEmptyIfNull(wsTask.getAny()));
+ task.setCompleteByExists(toBooleanSafeIfNull(wsTask.isCompleteByExists()));
+ task.setCreatedBy(StringUtils.defaultString(wsTask.getCreatedBy()));
+ task.setCreatedOn(toDate(wsTask.getCreatedOn()));
+ task.setEscalated(toBooleanSafeIfNull(wsTask.isEscalated()));
+ task.setExpirationTime(toDate(wsTask.getExpirationTime()));
+ task.setHasAttachments(toBooleanSafeIfNull(wsTask.isHasAttachments()));
+ task.setHasComments(toBooleanSafeIfNull(wsTask.isHasComments()));
+ task.setHasFault(toBooleanSafeIfNull(wsTask.isHasFault()));
+ task.setHasOutput(toBooleanSafeIfNull(wsTask.isHasOutput()));
+ task.setHasPotentialOwners(toBooleanSafeIfNull(wsTask.isHasPotentialOwners()));
+ task.setIsSkipable(toBooleanSafeIfNull(wsTask.isIsSkipable()));
+ task.setPresentationName(StringUtils.defaultString(wsTask.getPresentationName()));
+ task.setPresentationSubject(StringUtils.defaultString(wsTask.getPresentationSubject()));
+ task.setPrimarySearchBy(StringUtils.defaultString(wsTask.getPrimarySearchBy()));
+ task.setPriority(toIntSafeIfNull(wsTask.getPriority()));
+ task.setRenderingMethodExists(toBooleanSafeIfNull(wsTask.isRenderingMethodExists()));
+ task.setStartByExists(toBooleanSafeIfNull(wsTask.isStartByExists()));
+ task.setStatus(Status.valueOf(wsTask.getStatus().name()));
+ task.setTaskInitiator(StringUtils.defaultString(wsTask.getTaskInitiator()));
+ task.setTaskType(StringUtils.defaultString(wsTask.getTaskType()));
+ task.setPotentialOwners(new OrganizationalEntityConverter().buildOrganizationalEntity(wsTask.getPotentialOwners()));
+
+ TDeadlinesInfo deadlinesInfo = wsTask.getDeadlinesInfo();
+ if (deadlinesInfo != null) {
+ Iterator<TDeadlineInfo> iCB = deadlinesInfo.getCompleteBy().iterator();
+ while (iCB.hasNext()) {
+ Date d = toDate(iCB.next().getDate());
+ if (task.getCompleteBy() == null || task.getCompleteBy().before(d)) {
+ task.setCompleteBy(d);
+ }
+ }
+
+ Iterator<TDeadlineInfo> iSB = deadlinesInfo.getStartBy().iterator();
+ while (iSB.hasNext()) {
+ Date d = toDate(iSB.next().getDate());
+ if (task.getStartBy() == null || task.getStartBy().after(d)) {
+ task.setStartBy(d);
+ }
+ }
+ }
+
+ return task;
+ }
+
+ private Date toDate(XMLGregorianCalendar date) {
+ if (date == null) {
+ return null;
+ }
+ return date.toGregorianCalendar().getTime();
+ }
+
+ private boolean toBooleanSafeIfNull(Boolean value) {
+ boolean result = false;
+ if (value != null) {
+ result = value;
+ }
+ return result;
+ }
+
+ private Integer toIntSafeIfNull(BigInteger value) {
+ Integer result = null;
+ if (value != null) {
+ result = value.intValue();
+ }
+ return result;
+ }
+
+ private List<Object> returnEmptyIfNull(List<Object> any) {
+ if (any == null) {
+ any = new ArrayList<Object>();
+ }
+ return any;
+ }
+}
Added: 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=995452&view=auto
==============================================================================
--- incubator/hise/trunk/hise-ws-client/src/main/java/org/apache/hise/wsclient/infrastructure/Tasks.java (added)
+++ incubator/hise/trunk/hise-ws-client/src/main/java/org/apache/hise/wsclient/infrastructure/Tasks.java Thu Sep 9 15:03:55 2010
@@ -0,0 +1,103 @@
+package org.apache.hise.wsclient.infrastructure;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.hise.model.ws.TStatus;
+import org.apache.hise.model.ws.TTask;
+import org.apache.hise.ws.IllegalArgumentFault;
+import org.apache.hise.ws.IllegalStateFault;
+import org.apache.hise.ws.TaskOperationsInterface;
+import org.apache.hise.wsclient.model.Task;
+import org.apache.hise.wsclient.model.enums.HumanRole;
+import org.apache.hise.wsclient.model.enums.Status;
+
+@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) throws IllegalArgumentFault, IllegalStateFault {
+ List<TStatus> tStatuses = convertStatuses(statuses);
+ List<TTask> myTasks = this.service.getMyTasks("ALL", humanRole == null ? null : humanRole.hiseName(), null, tStatuses, null, null, MAX_TASKS);
+ refreshAll(myTasks);
+ }
+
+ public void retrieve(HumanRole humanRole, String workingQueue, List<Status> statuses) throws IllegalArgumentFault, IllegalStateFault {
+ List<TStatus> tStatuses = convertStatuses(statuses);
+ List<TTask> myTasks = this.service.getMyTasks("ALL", humanRole == null ? null : humanRole.hiseName(), workingQueue, tStatuses, null, null, MAX_TASKS);
+ 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();
+ if (t.getExpirationTime() != null) {
+ if (t.getExpirationTime().before(startDate) || t.getExpirationTime().after(endDate)) {
+ i.remove();
+ }
+ }
+ }
+ }
+
+}
Added: incubator/hise/trunk/hise-ws-client/src/main/java/org/apache/hise/wsclient/infrastructure/WSSecurityInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-ws-client/src/main/java/org/apache/hise/wsclient/infrastructure/WSSecurityInterceptor.java?rev=995452&view=auto
==============================================================================
--- incubator/hise/trunk/hise-ws-client/src/main/java/org/apache/hise/wsclient/infrastructure/WSSecurityInterceptor.java (added)
+++ incubator/hise/trunk/hise-ws-client/src/main/java/org/apache/hise/wsclient/infrastructure/WSSecurityInterceptor.java Thu Sep 9 15:03:55 2010
@@ -0,0 +1,23 @@
+package org.apache.hise.wsclient.infrastructure;
+
+import java.util.Map;
+
+import org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor;
+
+public class WSSecurityInterceptor {
+
+ private WSS4JOutInterceptor wss4JOutInterceptor;
+
+ public WSSecurityInterceptor(WSS4JOutInterceptor wss4jOutInterceptor) {
+ super();
+ wss4JOutInterceptor = wss4jOutInterceptor;
+ }
+
+ public void addWsAuthentication(String user, String password) {
+ Map<String, Object> properties = wss4JOutInterceptor.getProperties();
+ properties.put("user", user);
+ properties.put("passwordCallbackRef", new ClientPasswordCallback(password));
+ wss4JOutInterceptor.setProperties(properties);
+ }
+
+}
Added: incubator/hise/trunk/hise-ws-client/src/main/java/org/apache/hise/wsclient/model/Comment.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-ws-client/src/main/java/org/apache/hise/wsclient/model/Comment.java?rev=995452&view=auto
==============================================================================
--- incubator/hise/trunk/hise-ws-client/src/main/java/org/apache/hise/wsclient/model/Comment.java (added)
+++ incubator/hise/trunk/hise-ws-client/src/main/java/org/apache/hise/wsclient/model/Comment.java Thu Sep 9 15:03:55 2010
@@ -0,0 +1,34 @@
+package org.apache.hise.wsclient.model;
+
+import java.io.Serializable;
+import java.util.Calendar;
+import java.util.Date;
+
+public class Comment implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ private final Date addedAt;
+ private final String addedBy;
+ private final String text;
+
+ public Comment(Date addedAt, String addedBy, String text) {
+ super();
+ this.addedAt = addedAt;
+ this.addedBy = addedBy;
+ this.text = text;
+ }
+
+ public Date getAddedAt() {
+ return addedAt;
+ }
+
+ public String getAddedBy() {
+ return addedBy;
+ }
+
+ public String getText() {
+ return text;
+ }
+
+}
Added: incubator/hise/trunk/hise-ws-client/src/main/java/org/apache/hise/wsclient/model/OrganizationalEntity.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-ws-client/src/main/java/org/apache/hise/wsclient/model/OrganizationalEntity.java?rev=995452&view=auto
==============================================================================
--- incubator/hise/trunk/hise-ws-client/src/main/java/org/apache/hise/wsclient/model/OrganizationalEntity.java (added)
+++ incubator/hise/trunk/hise-ws-client/src/main/java/org/apache/hise/wsclient/model/OrganizationalEntity.java Thu Sep 9 15:03:55 2010
@@ -0,0 +1,30 @@
+/*
+ * Copyright by Touk (c) 2010
+*/
+package org.apache.hise.wsclient.model;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class OrganizationalEntity {
+
+ private List<String> users = new ArrayList<String>();
+
+ private List<String> groups = new ArrayList<String>();
+
+ public List<String> getUsers() {
+ return users;
+ }
+
+ public void setUsers(List<String> users) {
+ this.users = users;
+ }
+
+ public List<String> getGroups() {
+ return groups;
+ }
+
+ public void setGroups(List<String> groups) {
+ this.groups = groups;
+ }
+}
Added: incubator/hise/trunk/hise-ws-client/src/main/java/org/apache/hise/wsclient/model/Task.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-ws-client/src/main/java/org/apache/hise/wsclient/model/Task.java?rev=995452&view=auto
==============================================================================
--- incubator/hise/trunk/hise-ws-client/src/main/java/org/apache/hise/wsclient/model/Task.java (added)
+++ incubator/hise/trunk/hise-ws-client/src/main/java/org/apache/hise/wsclient/model/Task.java Thu Sep 9 15:03:55 2010
@@ -0,0 +1,293 @@
+package org.apache.hise.wsclient.model;
+
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.List;
+
+import javax.xml.datatype.XMLGregorianCalendar;
+
+import org.apache.hise.wsclient.model.enums.Status;
+
+
+public class Task implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ private String id;
+ private String taskType;
+ private Status status;
+ private Integer priority;
+ private String taskInitiator;
+ private String actualOwner;
+ private Date createdOn;
+ private String createdBy;
+ private Date activationTime;
+ private Date expirationTime;
+ private boolean isSkipable;
+ private boolean hasPotentialOwners;
+ private boolean startByExists;
+ private boolean completeByExists;
+ private String presentationName;
+ private String presentationSubject;
+ private boolean renderingMethodExists;
+ private boolean hasOutput;
+ private boolean hasFault;
+ private boolean hasAttachments;
+ private boolean hasComments;
+ private boolean escalated;
+ private String primarySearchBy;
+ private List<Object> any;
+
+ private Date startBy;
+ private Date completeBy;
+
+ //private OrganizationalEntity taskStakeholders;
+ private OrganizationalEntity potentialOwners;
+ //private OrganizationalEntity businessAdministrators;
+ //private OrganizationalEntity notificationRecipients;
+
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public Status getStatus() {
+ return status;
+ }
+
+ public void setStatus(Status status) {
+ this.status = status;
+ }
+
+ public String getActualOwner() {
+ return actualOwner;
+ }
+
+ public void setActualOwner(String actualOwner) {
+ this.actualOwner = actualOwner;
+ }
+
+ public String getPresentationName() {
+ return presentationName;
+ }
+
+ public void setPresentationName(String presentationName) {
+ this.presentationName = presentationName;
+ }
+
+ public String getPresentationSubject() {
+ return presentationSubject;
+ }
+
+ public void setPresentationSubject(String presentationSubject) {
+ this.presentationSubject = presentationSubject;
+ }
+
+ public String getTaskType() {
+ return taskType;
+ }
+
+ public void setTaskType(String taskType) {
+ this.taskType = taskType;
+ }
+
+ public Integer getPriority() {
+ return priority;
+ }
+
+ public void setPriority(Integer priority) {
+ this.priority = priority;
+ }
+
+ public String getTaskInitiator() {
+ return taskInitiator;
+ }
+
+ public void setTaskInitiator(String taskInitiator) {
+ this.taskInitiator = taskInitiator;
+ }
+
+ public String getCreatedBy() {
+ return createdBy;
+ }
+
+ public void setCreatedBy(String createdBy) {
+ this.createdBy = createdBy;
+ }
+
+ public String getPrimarySearchBy() {
+ return primarySearchBy;
+ }
+
+ public void setPrimarySearchBy(String primarySearchBy) {
+ this.primarySearchBy = primarySearchBy;
+ }
+
+ public boolean getIsSkipable() {
+ return isSkipable;
+ }
+
+ public void setIsSkipable(boolean isSkipable) {
+ this.isSkipable = isSkipable;
+ }
+
+ public boolean getHasPotentialOwners() {
+ return hasPotentialOwners;
+ }
+
+ public void setHasPotentialOwners(boolean hasPotentialOwners) {
+ this.hasPotentialOwners = hasPotentialOwners;
+ }
+
+ public boolean getStartByExists() {
+ return startByExists;
+ }
+
+ public void setStartByExists(boolean startByExists) {
+ this.startByExists = startByExists;
+ }
+
+ public boolean getCompleteByExists() {
+ return completeByExists;
+ }
+
+ public void setCompleteByExists(boolean completeByExists) {
+ this.completeByExists = completeByExists;
+ }
+
+ public boolean getRenderingMethodExists() {
+ return renderingMethodExists;
+ }
+
+ public void setRenderingMethodExists(boolean renderingMethodExists) {
+ this.renderingMethodExists = renderingMethodExists;
+ }
+
+ public boolean getHasOutput() {
+ return hasOutput;
+ }
+
+ public void setHasOutput(boolean hasOutput) {
+ this.hasOutput = hasOutput;
+ }
+
+ public boolean getHasFault() {
+ return hasFault;
+ }
+
+ public void setHasFault(boolean hasFault) {
+ this.hasFault = hasFault;
+ }
+
+ public boolean getHasAttachments() {
+ return hasAttachments;
+ }
+
+ public void setHasAttachments(boolean hasAttachments) {
+ this.hasAttachments = hasAttachments;
+ }
+
+ public boolean getHasComments() {
+ return hasComments;
+ }
+
+ public void setHasComments(boolean hasComments) {
+ this.hasComments = hasComments;
+ }
+
+ public boolean getEscalated() {
+ return escalated;
+ }
+
+ public void setEscalated(boolean escalated) {
+ this.escalated = escalated;
+ }
+
+ public Date getCreatedOn() {
+ return createdOn;
+ }
+
+ public void setCreatedOn(Date createdOn) {
+ this.createdOn = createdOn;
+ }
+
+ public Date getActivationTime() {
+ return activationTime;
+ }
+
+ public void setActivationTime(Date activationTime) {
+ this.activationTime = activationTime;
+ }
+
+ public Date getExpirationTime() {
+ return expirationTime;
+ }
+
+ public void setExpirationTime(Date expirationTime) {
+ this.expirationTime = expirationTime;
+ }
+
+ public List<Object> getAny() {
+ return any;
+ }
+
+ public void setAny(List<Object> any) {
+ this.any = any;
+ }
+
+ public OrganizationalEntity getPotentialOwners() {
+ return potentialOwners;
+ }
+
+ public void setPotentialOwners(OrganizationalEntity potentialOwners) {
+ this.potentialOwners = potentialOwners;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((id == null) ? 0 : id.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ Task other = (Task) obj;
+ if (id == null) {
+ if (other.id != null)
+ return false;
+ } else if (!id.equals(other.id))
+ return false;
+ return true;
+ }
+
+ public void setStartBy(Date startBy) {
+ this.startBy = startBy;
+ }
+
+ public Date getStartBy() {
+ return startBy;
+ }
+
+ public void setCompleteBy(Date completeBy) {
+ this.completeBy = completeBy;
+ }
+
+ public Date getCompleteBy() {
+ return completeBy;
+ }
+
+
+}
Added: incubator/hise/trunk/hise-ws-client/src/main/java/org/apache/hise/wsclient/model/enums/Action.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-ws-client/src/main/java/org/apache/hise/wsclient/model/enums/Action.java?rev=995452&view=auto
==============================================================================
--- incubator/hise/trunk/hise-ws-client/src/main/java/org/apache/hise/wsclient/model/enums/Action.java (added)
+++ incubator/hise/trunk/hise-ws-client/src/main/java/org/apache/hise/wsclient/model/enums/Action.java Thu Sep 9 15:03:55 2010
@@ -0,0 +1,9 @@
+package org.apache.hise.wsclient.model.enums;
+
+public enum Action {
+
+ CLAIM,
+ START,
+ COMPLETE,
+ FAIL
+}
Added: incubator/hise/trunk/hise-ws-client/src/main/java/org/apache/hise/wsclient/model/enums/HumanRole.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-ws-client/src/main/java/org/apache/hise/wsclient/model/enums/HumanRole.java?rev=995452&view=auto
==============================================================================
--- incubator/hise/trunk/hise-ws-client/src/main/java/org/apache/hise/wsclient/model/enums/HumanRole.java (added)
+++ incubator/hise/trunk/hise-ws-client/src/main/java/org/apache/hise/wsclient/model/enums/HumanRole.java Thu Sep 9 15:03:55 2010
@@ -0,0 +1,39 @@
+package org.apache.hise.wsclient.model.enums;
+
+/**
+ * Enum representing possible values for generic human role.
+ * Function getName returns name to be used when calling HISE.
+ * Function toString returns human readable string, to be displayed in the frontend.
+ */
+public enum HumanRole {
+
+ ACTUAL_OWNER {
+ @Override
+ public String hiseName() {
+ return "ACTUALOWNER";
+ }
+ },
+
+ POTENTIAL_OWNERS {
+ @Override
+ public String hiseName() {
+ return "POTENTIALOWNERS";
+ }
+ },
+
+ BUSINESS_ADMINISTRATORS {
+ @Override
+ public String hiseName() {
+ return "BUSINESSADMINISTRATORS";
+ }
+ },
+
+ STAKEHOLDERS {
+ @Override
+ public String hiseName() {
+ return "TASKSTAKEHOLDERS";
+ }
+ };
+
+ abstract public String hiseName();
+}