added checkstyle
This commit is contained in:
parent
29126778ec
commit
a251158ca1
|
|
@ -0,0 +1,135 @@
|
|||
<?xml version="1.0"?>
|
||||
<!DOCTYPE module PUBLIC
|
||||
"-//Puppy Crawl//DTD Check Configuration 1.2//EN"
|
||||
"http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
|
||||
|
||||
<!--
|
||||
|
||||
Checkstyle configuration that checks the coding conventions based on http://maven.apache.org/plugins-archives/maven-checkstyle-plugin-2.14/config/sun_checks.html.
|
||||
|
||||
Checkstyle is very configurable. Be sure to read the documentation at
|
||||
http://checkstyle.sf.net (or in your downloaded distribution).
|
||||
|
||||
Most Checks are configurable, be sure to consult the documentation.
|
||||
|
||||
To completely disable a check, just comment it out or delete it from the file.
|
||||
|
||||
Finally, it is worth reading the documentation.
|
||||
|
||||
-->
|
||||
|
||||
<module name="Checker">
|
||||
<!-- Checks whether files end with a new line. -->
|
||||
<!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile -->
|
||||
<module name="NewlineAtEndOfFile">
|
||||
<property name="lineSeparator" value="lf_cr_crlf"/>
|
||||
</module>
|
||||
|
||||
<!-- Checks that property files contain the same keys. -->
|
||||
<!-- See http://checkstyle.sf.net/config_misc.html#Translation -->
|
||||
<module name="Translation"/>
|
||||
|
||||
<module name="FileLength"/>
|
||||
|
||||
<module name="FileTabCharacter">
|
||||
<property name="eachLine" value="true"/>
|
||||
</module>
|
||||
|
||||
<module name="RegexpSingleline">
|
||||
<!-- \s matches whitespace character, $ matches end of line. -->
|
||||
<property name="format" value="\s+$"/>
|
||||
<property name="message" value="Line has trailing spaces."/>
|
||||
</module>
|
||||
|
||||
<module name="TreeWalker">
|
||||
|
||||
<property name="cacheFile" value="${checkstyle.cache.file}"/>
|
||||
|
||||
<!-- required for SuppressWarningsFilter (and other Suppress* rules not used here) -->
|
||||
<!-- see http://checkstyle.sourceforge.net/config_annotation.html#SuppressWarningsHolder -->
|
||||
<module name="SuppressWarningsHolder"/>
|
||||
|
||||
<!-- Checks for Javadoc comments. -->
|
||||
<!-- See http://checkstyle.sf.net/config_javadoc.html -->
|
||||
<module name="JavadocType"/>
|
||||
<module name="JavadocStyle"/>
|
||||
|
||||
|
||||
<!-- Checks for Naming Conventions. -->
|
||||
<!-- See http://checkstyle.sf.net/config_naming.html -->
|
||||
<module name="ConstantName"/>
|
||||
<module name="LocalFinalVariableName"/>
|
||||
<module name="LocalVariableName"/>
|
||||
<module name="MemberName"/>
|
||||
<!-- Removed because of _ not allowed in test method names -->
|
||||
<!-- <module name="MethodName"/> -->
|
||||
<module name="PackageName"/>
|
||||
<module name="ParameterName"/>
|
||||
<module name="StaticVariableName"/>
|
||||
<module name="TypeName"/>
|
||||
|
||||
<!-- Checks for imports -->
|
||||
<!-- See http://checkstyle.sf.net/config_import.html -->
|
||||
<module name="IllegalImport"/> <!-- defaults to sun.* packages -->
|
||||
<module name="RedundantImport"/>
|
||||
<module name="UnusedImports"/>
|
||||
|
||||
<!-- Checks for whitespace -->
|
||||
<!-- See http://checkstyle.sf.net/config_whitespace.html -->
|
||||
<module name="EmptyForIteratorPad"/>
|
||||
<module name="MethodParamPad"/>
|
||||
<module name="NoWhitespaceAfter"/>
|
||||
<module name="NoWhitespaceBefore"/>
|
||||
<module name="OperatorWrap"/>
|
||||
<module name="ParenPad"/>
|
||||
<module name="TypecastParenPad"/>
|
||||
<module name="WhitespaceAfter"/>
|
||||
<module name="WhitespaceAround"/>
|
||||
|
||||
<!-- Modifier Checks -->
|
||||
<!-- See http://checkstyle.sf.net/config_modifiers.html -->
|
||||
<module name="ModifierOrder"/>
|
||||
<module name="RedundantModifier"/>
|
||||
|
||||
<!-- Checks for blocks. You know, those {}'s -->
|
||||
<!-- See http://checkstyle.sf.net/config_blocks.html -->
|
||||
<module name="AvoidNestedBlocks"/>
|
||||
<module name="EmptyBlock"/>
|
||||
<module name="LeftCurly"/>
|
||||
<module name="NeedBraces"/>
|
||||
<module name="RightCurly"/>
|
||||
|
||||
<!-- Checks for common coding problems -->
|
||||
<!-- See http://checkstyle.sf.net/config_coding.html -->
|
||||
<module name="EmptyStatement"/>
|
||||
<module name="EqualsHashCode"/>
|
||||
<module name="IllegalInstantiation"/>
|
||||
<module name="InnerAssignment"/>
|
||||
<module name="MagicNumber"/>
|
||||
<module name="MissingSwitchDefault"/>
|
||||
<module name="SimplifyBooleanExpression"/>
|
||||
<module name="SimplifyBooleanReturn"/>
|
||||
|
||||
<!-- Checks for class design -->
|
||||
<!-- See http://checkstyle.sf.net/config_design.html -->
|
||||
<module name="FinalClass"/>
|
||||
<module name="HideUtilityClassConstructor"/>
|
||||
<module name="InterfaceIsType"/>
|
||||
|
||||
<!-- Miscellaneous other checks. -->
|
||||
<!-- See http://checkstyle.sf.net/config_misc.html -->
|
||||
<module name="ArrayTypeStyle"/>
|
||||
<module name="TodoComment"/>
|
||||
<module name="UpperEll"/>
|
||||
|
||||
</module>
|
||||
|
||||
<!-- Support @SuppressWarnings (added in Checkstyle 5.7) -->
|
||||
<!-- see http://checkstyle.sourceforge.net/config.html#SuppressWarningsFilter -->
|
||||
<module name="SuppressWarningsFilter"/>
|
||||
|
||||
<!-- Checks properties file for a duplicated properties. -->
|
||||
<!-- See http://checkstyle.sourceforge.net/config_misc.html#UniqueProperties -->
|
||||
<module name="UniqueProperties"/>
|
||||
|
||||
</module>
|
||||
|
|
@ -55,4 +55,42 @@
|
|||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-checkstyle-plugin</artifactId>
|
||||
<version>2.17</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>validate</id>
|
||||
<phase>validate</phase>
|
||||
<configuration>
|
||||
<configLocation>checkstyle.xml</configLocation>
|
||||
<encoding>UTF-8</encoding>
|
||||
<consoleOutput>true</consoleOutput>
|
||||
<failsOnError>true</failsOnError>
|
||||
<failOnViolation>true</failOnViolation>
|
||||
<includeTestSourceDirectory>true</includeTestSourceDirectory>
|
||||
</configuration>
|
||||
<goals>
|
||||
<goal>check</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.5.1</version>
|
||||
<configuration>
|
||||
<showWarnings>true</showWarnings>
|
||||
<failOnWarning>true</failOnWarning>
|
||||
<compilerArgs>
|
||||
<arg>-Xlint:all</arg>
|
||||
</compilerArgs>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
|
@ -4,45 +4,43 @@ import java.util.List;
|
|||
|
||||
import org.taskana.model.Classification;
|
||||
|
||||
/**
|
||||
* This class manages the classifications.
|
||||
*/
|
||||
public interface ClassificationService {
|
||||
|
||||
/**
|
||||
* Get all available Classifications
|
||||
*
|
||||
* Get all available Classifications.
|
||||
* @return The List of all Classifications
|
||||
*/
|
||||
public List<Classification> selectClassifications();
|
||||
List<Classification> selectClassifications();
|
||||
|
||||
/**
|
||||
* Get all Classifications with given parent
|
||||
*
|
||||
* Get all Classifications with given parent.
|
||||
* @param parentId
|
||||
* the ID of the parent Classification
|
||||
* @return
|
||||
*/
|
||||
public List<Classification> selectClassificationsByParentId(String parentId);
|
||||
List<Classification> selectClassificationsByParentId(String parentId);
|
||||
|
||||
/**
|
||||
* Get a Classification for a given id
|
||||
*
|
||||
* Get a Classification for a given id.
|
||||
* @param id
|
||||
* @return the requested Classification
|
||||
*/
|
||||
public Classification selectClassificationById(String id);
|
||||
Classification selectClassificationById(String id);
|
||||
|
||||
/**
|
||||
* Insert a new Classification
|
||||
*
|
||||
* Insert a new Classification.
|
||||
* @param classification
|
||||
* the classification to insert
|
||||
*/
|
||||
public void insertClassification(Classification classification);
|
||||
void insertClassification(Classification classification);
|
||||
|
||||
/**
|
||||
* Update a Classification
|
||||
*
|
||||
* Update a Classification.
|
||||
* @param classification
|
||||
* the Classification to update
|
||||
*/
|
||||
public void updateClassification(Classification classification);
|
||||
void updateClassification(Classification classification);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,125 +10,115 @@ import org.taskana.model.Task;
|
|||
import org.taskana.model.TaskState;
|
||||
import org.taskana.model.TaskStateCounter;
|
||||
|
||||
/**
|
||||
* The Task Service manages all operations on tasks.
|
||||
*/
|
||||
public interface TaskService {
|
||||
|
||||
/**
|
||||
* Claim an existing task
|
||||
*
|
||||
* Claim an existing task.
|
||||
* @param id
|
||||
* task id
|
||||
* @param userName
|
||||
* user who claims the task
|
||||
* @throws TaskNotFoundException
|
||||
*/
|
||||
public void claim(String id, String userName) throws TaskNotFoundException;
|
||||
void claim(String id, String userName) throws TaskNotFoundException;
|
||||
|
||||
/**
|
||||
* Set task to completed
|
||||
*
|
||||
* Set task to completed.
|
||||
* @param taskId
|
||||
* the task id
|
||||
* @throws TaskNotFoundException
|
||||
*/
|
||||
public void complete(String taskId) throws TaskNotFoundException;
|
||||
void complete(String taskId) throws TaskNotFoundException;
|
||||
|
||||
/**
|
||||
* Create a task by a task object
|
||||
*
|
||||
* Create a task by a task object.
|
||||
* @param task
|
||||
* @return the created task
|
||||
* @throws NotAuthorizedException
|
||||
*/
|
||||
public Task create(Task task) throws NotAuthorizedException;
|
||||
Task create(Task task) throws NotAuthorizedException;
|
||||
|
||||
/**
|
||||
* Get the details of a task
|
||||
*
|
||||
* Get the details of a task.
|
||||
* @param taskId
|
||||
* the id of the task
|
||||
* @return the Task
|
||||
*/
|
||||
public Task getTaskById(String taskId) throws TaskNotFoundException;
|
||||
Task getTaskById(String taskId) throws TaskNotFoundException;
|
||||
|
||||
/**
|
||||
* Query all tasks for a workbasket.
|
||||
*
|
||||
* @param workbasketId
|
||||
* the workbasket to query
|
||||
* @return the list of tasks, which reside in the workbasket
|
||||
* @throws NotAuthorizedException
|
||||
*/
|
||||
public List<Task> getTasksForWorkbasket(String workbasketId) throws NotAuthorizedException;
|
||||
List<Task> getTasksForWorkbasket(String workbasketId) throws NotAuthorizedException;
|
||||
|
||||
/**
|
||||
* Query all tasks for a workbasket.
|
||||
*
|
||||
* @param workbasketId
|
||||
* the workbasket to query
|
||||
* @return the list of tasks, which reside in the workbasket
|
||||
* @throws NotAuthorizedException
|
||||
*/
|
||||
public List<Task> getTasksForWorkbasket(List<String> workbaskets, List<TaskState> states)
|
||||
throws NotAuthorizedException;
|
||||
List<Task> getTasksForWorkbasket(List<String> workbaskets, List<TaskState> states) throws NotAuthorizedException;
|
||||
|
||||
/**
|
||||
* This method returns all Tasks
|
||||
*
|
||||
* This method returns all Tasks.
|
||||
* @return a {@link List<Task>} of {@link Task}
|
||||
*/
|
||||
public List<Task> getTasks();
|
||||
List<Task> getTasks();
|
||||
|
||||
/**
|
||||
* This method counts all tasks with a given state.
|
||||
*
|
||||
* @param states
|
||||
* the countable states
|
||||
* @return a List of {@link TaskStateCounter}
|
||||
*/
|
||||
public List<TaskStateCounter> getTaskCountForState(List<TaskState> states);
|
||||
List<TaskStateCounter> getTaskCountForState(List<TaskState> states);
|
||||
|
||||
/**
|
||||
* This method returns all tasks with the specified states
|
||||
*
|
||||
* @param states all List with the needed states
|
||||
* This method returns all tasks with the specified states.
|
||||
* @param states
|
||||
* all List with the needed states
|
||||
* @return a list of Tasks
|
||||
*/
|
||||
public List<Task> findTasks(List<TaskState> states);
|
||||
List<Task> findTasks(List<TaskState> states);
|
||||
|
||||
/**
|
||||
* Count all Tasks in a given workbasket with daysInPast as Days from today
|
||||
* in the past and a specific state.
|
||||
*
|
||||
* Count all Tasks in a given workbasket with daysInPast as Days from today in
|
||||
* the past and a specific state.
|
||||
* @param workbasketId
|
||||
* @param daysInPast
|
||||
* @param states
|
||||
* @return
|
||||
*/
|
||||
public long getTaskCountForWorkbasketByDaysInPastAndState(String workbasketId, long daysInPast,
|
||||
List<TaskState> states);
|
||||
long getTaskCountForWorkbasketByDaysInPastAndState(String workbasketId, long daysInPast, List<TaskState> states);
|
||||
|
||||
/**
|
||||
* Transfer task to another workbasket.
|
||||
*
|
||||
* The transfer set the transferred flag and resets the read flag.
|
||||
*
|
||||
* Transfer task to another workbasket. The transfer set the transferred flag
|
||||
* and resets the read flag.
|
||||
* @param workbasketId
|
||||
* @return the updated task
|
||||
* @throws NotAuthorizedException
|
||||
*/
|
||||
public Task transfer(String taskId, String workbasketId)
|
||||
Task transfer(String taskId, String workbasketId)
|
||||
throws TaskNotFoundException, WorkbasketNotFoundException, NotAuthorizedException;
|
||||
|
||||
/**
|
||||
* Marks a task as read.
|
||||
*
|
||||
* @param taskId the id of the task to be updated
|
||||
* @param isRead the new status of the read flag.
|
||||
* @param taskId
|
||||
* the id of the task to be updated
|
||||
* @param isRead
|
||||
* the new status of the read flag.
|
||||
* @return Task the updated Task
|
||||
*/
|
||||
public Task setTaskRead(String taskId, boolean isRead) throws TaskNotFoundException;
|
||||
Task setTaskRead(String taskId, boolean isRead) throws TaskNotFoundException;
|
||||
|
||||
public List<DueWorkbasketCounter> getTaskCountByWorkbasketAndDaysInPastAndState(long daysInPast,
|
||||
List<TaskState> states);
|
||||
List<DueWorkbasketCounter> getTaskCountByWorkbasketAndDaysInPastAndState(long daysInPast, List<TaskState> states);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,34 +3,31 @@ package org.taskana;
|
|||
import org.taskana.configuration.TaskanaEngineConfiguration;
|
||||
|
||||
/**
|
||||
* The TaskanaEngine represents an overall set of all needed services
|
||||
* The TaskanaEngine represents an overall set of all needed services.
|
||||
*/
|
||||
public interface TaskanaEngine {
|
||||
|
||||
/**
|
||||
* The TaskService can be used for operations on all Tasks
|
||||
*
|
||||
* The TaskService can be used for operations on all Tasks.
|
||||
* @return the TaskService
|
||||
*/
|
||||
public TaskService getTaskService();
|
||||
TaskService getTaskService();
|
||||
|
||||
/**
|
||||
* The WorkbasketService can be used for operations on all Workbaskets
|
||||
*
|
||||
* The WorkbasketService can be used for operations on all Workbaskets.
|
||||
* @return the TaskService
|
||||
*/
|
||||
public WorkbasketService getWorkbasketService();
|
||||
WorkbasketService getWorkbasketService();
|
||||
|
||||
/**
|
||||
* The ClassificationService can be used for operations on all Categories
|
||||
*
|
||||
* The ClassificationService can be used for operations on all Categories.
|
||||
* @return the TaskService
|
||||
*/
|
||||
public ClassificationService getClassificationService();
|
||||
ClassificationService getClassificationService();
|
||||
|
||||
/**
|
||||
* The Taskana configuration
|
||||
* The Taskana configuration.
|
||||
* @return the TaskanaConfiguration
|
||||
*/
|
||||
public TaskanaEngineConfiguration getConfiguration();
|
||||
TaskanaEngineConfiguration getConfiguration();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,80 +8,73 @@ import org.taskana.model.Workbasket;
|
|||
import org.taskana.model.WorkbasketAccessItem;
|
||||
import org.taskana.model.WorkbasketAuthorization;
|
||||
|
||||
/**
|
||||
* This service manages the Workbaskets.
|
||||
*/
|
||||
public interface WorkbasketService {
|
||||
|
||||
/**
|
||||
* Get Workbasket for a given id.
|
||||
*
|
||||
* @param workbasketId
|
||||
* @return the requested Workbasket
|
||||
*/
|
||||
public Workbasket getWorkbasket(String workbasketId) throws WorkbasketNotFoundException;
|
||||
Workbasket getWorkbasket(String workbasketId) throws WorkbasketNotFoundException;
|
||||
|
||||
/**
|
||||
* Get all available Workbaskets.
|
||||
*
|
||||
* @return List<Workbasket> the list of all workbaskets
|
||||
*/
|
||||
public List<Workbasket> getWorkbaskets();
|
||||
List<Workbasket> getWorkbaskets();
|
||||
|
||||
/**
|
||||
* Create a new Workbasket.
|
||||
*
|
||||
* @param workbasket
|
||||
* The workbasket to create
|
||||
* @throws NotAuthorizedException
|
||||
*/
|
||||
public Workbasket createWorkbasket(Workbasket workbasket);
|
||||
Workbasket createWorkbasket(Workbasket workbasket);
|
||||
|
||||
/**
|
||||
* Update a Workbasket.
|
||||
*
|
||||
*
|
||||
* @param workbasket
|
||||
* The workbasket to update
|
||||
* @throws NotAuthorizedException
|
||||
*/
|
||||
public Workbasket updateWorkbasket(Workbasket workbasket) throws NotAuthorizedException;
|
||||
Workbasket updateWorkbasket(Workbasket workbasket) throws NotAuthorizedException;
|
||||
|
||||
/**
|
||||
* Create a new authorization for a specific workbasket and a specific user
|
||||
*
|
||||
* Create a new authorization for a specific workbasket and a specific user.
|
||||
* @param workbasket
|
||||
* the choosen workbasket
|
||||
* @param user
|
||||
* the choosen user
|
||||
* @return
|
||||
*/
|
||||
public WorkbasketAccessItem createWorkbasketAuthorization(WorkbasketAccessItem workbasketAccessItem);
|
||||
WorkbasketAccessItem createWorkbasketAuthorization(WorkbasketAccessItem workbasketAccessItem);
|
||||
|
||||
/**
|
||||
* This method updates an Workbasket Authorization
|
||||
*
|
||||
* This method updates an Workbasket Authorization.
|
||||
* @param workbasketAccessItem
|
||||
* the Authorization
|
||||
* @return the updated entity
|
||||
*/
|
||||
public WorkbasketAccessItem updateWorkbasketAuthorization(WorkbasketAccessItem workbasketAccessItem);
|
||||
WorkbasketAccessItem updateWorkbasketAuthorization(WorkbasketAccessItem workbasketAccessItem);
|
||||
|
||||
/**
|
||||
* Get all authorizations of the workbasket
|
||||
*
|
||||
* Get all authorizations of the workbasket.
|
||||
* @return a WorkbasketAccessItem list
|
||||
*/
|
||||
public List<WorkbasketAccessItem> getAllAuthorizations();
|
||||
List<WorkbasketAccessItem> getAllAuthorizations();
|
||||
|
||||
/**
|
||||
* Deletes a specific authorization
|
||||
*
|
||||
* Deletes a specific authorization.
|
||||
* @param id
|
||||
* the specific id
|
||||
*/
|
||||
public void deleteWorkbasketAuthorization(String id);
|
||||
void deleteWorkbasketAuthorization(String id);
|
||||
|
||||
/**
|
||||
* This method checks the authorization with the saved one
|
||||
*
|
||||
* This method checks the authorization with the saved one.
|
||||
* @param workbasket
|
||||
* the workbasket to check
|
||||
* @param userId
|
||||
|
|
@ -92,29 +85,25 @@ public interface WorkbasketService {
|
|||
* if the workbasket do not exist
|
||||
* @throws NotAuthorizedException
|
||||
*/
|
||||
public void checkAuthorization(String workbasketId, WorkbasketAuthorization authorization)
|
||||
throws NotAuthorizedException;
|
||||
void checkAuthorization(String workbasketId, WorkbasketAuthorization authorization) throws NotAuthorizedException;
|
||||
|
||||
/**
|
||||
* This method get one WorkbasketAuthorization with an id
|
||||
*
|
||||
* This method get one WorkbasketAuthorization with an id.
|
||||
* @param id
|
||||
* the id
|
||||
* @return the full {@link WorkbasketAccessItem}
|
||||
*/
|
||||
public WorkbasketAccessItem getWorkbasketAuthorization(String id);
|
||||
WorkbasketAccessItem getWorkbasketAuthorization(String id);
|
||||
|
||||
/**
|
||||
* Get all authorizations for a Workbasket.
|
||||
*
|
||||
* @param workbasketId
|
||||
* @return List<WorkbasketAccessItem>
|
||||
*/
|
||||
public List<WorkbasketAccessItem> getWorkbasketAuthorizations(String workbasketId);
|
||||
List<WorkbasketAccessItem> getWorkbasketAuthorizations(String workbasketId);
|
||||
|
||||
/**
|
||||
* This method provides workbaskets via an permission
|
||||
*
|
||||
* This method provides workbaskets via an permission.
|
||||
* @param permission
|
||||
* as String like in this enum: {@link WorkbasketAuthorization}
|
||||
* @return all filtered workbaskets
|
||||
|
|
|
|||
|
|
@ -11,9 +11,12 @@ import org.apache.ibatis.jdbc.ScriptRunner;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* This class create the schema for taskana.
|
||||
*/
|
||||
public class DbScriptRunner {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(DbScriptRunner.class);
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(DbScriptRunner.class);
|
||||
|
||||
private static final String SQL = "/sql";
|
||||
private static final String DB_SCHEMA = SQL + "/taskana-schema.sql";
|
||||
|
|
@ -31,15 +34,13 @@ public class DbScriptRunner {
|
|||
this.dataSource = dataSource;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Run all db scripts
|
||||
*
|
||||
* Run all db scripts.
|
||||
* @throws SQLException
|
||||
*/
|
||||
public void run() throws SQLException {
|
||||
ScriptRunner runner = new ScriptRunner(dataSource.getConnection());
|
||||
logger.debug(dataSource.getConnection().getMetaData().toString());
|
||||
LOGGER.debug(dataSource.getConnection().getMetaData().toString());
|
||||
|
||||
runner.setStopOnError(true);
|
||||
runner.setLogWriter(logWriter);
|
||||
|
|
@ -50,9 +51,9 @@ public class DbScriptRunner {
|
|||
}
|
||||
runner.closeConnection();
|
||||
|
||||
logger.debug(outWriter.toString());
|
||||
LOGGER.debug(outWriter.toString());
|
||||
if (!errorWriter.toString().trim().isEmpty()) {
|
||||
logger.error(errorWriter.toString());
|
||||
LOGGER.error(errorWriter.toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -60,10 +61,10 @@ public class DbScriptRunner {
|
|||
try {
|
||||
runner.runScript(new InputStreamReader(this.getClass().getResourceAsStream(DB_SCHEMA_DETECTION)));
|
||||
} catch (Exception e) {
|
||||
logger.debug("Schema does not exist.");
|
||||
LOGGER.debug("Schema does not exist.");
|
||||
return false;
|
||||
}
|
||||
logger.debug("Schema does exist.");
|
||||
LOGGER.debug("Schema does exist.");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,11 +12,11 @@ import org.taskana.impl.TaskanaEngineImpl;
|
|||
|
||||
/**
|
||||
* This central class creates the TaskanaEngine and needs all the information
|
||||
* about DB and Security
|
||||
* about DB and Security.
|
||||
*/
|
||||
public class TaskanaEngineConfiguration {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(TaskanaEngineConfiguration.class);
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(TaskanaEngineConfiguration.class);
|
||||
|
||||
private static final String USER_PASSWORD = "sa";
|
||||
private static final String JDBC_H2_MEM_TASKANA = "jdbc:h2:mem:taskana";
|
||||
|
|
@ -55,14 +55,13 @@ public class TaskanaEngineConfiguration {
|
|||
}
|
||||
|
||||
public DataSource createDefaultDataSource() {
|
||||
logger.warn("No datasource is provided. A inmemory db is used: "
|
||||
LOGGER.warn("No datasource is provided. A inmemory db is used: "
|
||||
+ "'org.h2.Driver', 'jdbc:h2:mem:taskana', 'sa', 'sa'");
|
||||
return createDatasource(H2_DRIVER, JDBC_H2_MEM_TASKANA, USER_PASSWORD, USER_PASSWORD);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method creates the TaskanaEngine without an sqlSessionFactory
|
||||
*
|
||||
* This method creates the TaskanaEngine without an sqlSessionFactory.
|
||||
* @return the TaskanaEngine
|
||||
* @throws SQLException
|
||||
*/
|
||||
|
|
@ -71,9 +70,7 @@ public class TaskanaEngineConfiguration {
|
|||
}
|
||||
|
||||
/**
|
||||
* This method creates a PooledDataSource, if the needed properties are
|
||||
* provided
|
||||
*
|
||||
* This method creates a PooledDataSource, if the needed properties are provided.
|
||||
* @param dbConfiguration
|
||||
* @return DataSource
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,10 +1,12 @@
|
|||
package org.taskana.exceptions;
|
||||
|
||||
/**
|
||||
* This exception is used to communicate a not authorized user.
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class NotAuthorizedException extends Exception {
|
||||
|
||||
public NotAuthorizedException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,12 @@
|
|||
package org.taskana.exceptions;
|
||||
|
||||
/**
|
||||
* This exception will be thrown if a specific object is not in the database.
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class NotFoundException extends Exception {
|
||||
|
||||
public NotFoundException(String id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
package org.taskana.exceptions;
|
||||
|
||||
/**
|
||||
* This exception will be thrown if a specific task is not in the database.
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class TaskNotFoundException extends NotFoundException {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
package org.taskana.exceptions;
|
||||
|
||||
/**
|
||||
* This exception will be thrown if a specific workbasket is not in the database.
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class WorkbasketNotFoundException extends NotFoundException {
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,9 @@ import org.taskana.impl.util.IdGenerator;
|
|||
import org.taskana.model.Classification;
|
||||
import org.taskana.model.mappings.ClassificationMapper;
|
||||
|
||||
/**
|
||||
* This is the implementation of ClassificationService.
|
||||
*/
|
||||
public class ClassificationServiceImpl implements ClassificationService {
|
||||
|
||||
private static final String ID_PREFIX_CLASSIFICATION = "CLI";
|
||||
|
|
|
|||
|
|
@ -22,10 +22,12 @@ import org.taskana.model.TaskStateCounter;
|
|||
import org.taskana.model.WorkbasketAuthorization;
|
||||
import org.taskana.model.mappings.ObjectReferenceMapper;
|
||||
import org.taskana.model.mappings.TaskMapper;
|
||||
|
||||
/**
|
||||
* This is the implementation of TaskService.
|
||||
*/
|
||||
public class TaskServiceImpl implements TaskService {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(TaskServiceImpl.class);
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(TaskServiceImpl.class);
|
||||
|
||||
private static final String ID_PREFIX_OBJECTR_EFERENCE = "ORI";
|
||||
private static final String ID_PREFIX_TASK = "TKI";
|
||||
|
|
@ -34,7 +36,8 @@ public class TaskServiceImpl implements TaskService {
|
|||
private TaskMapper taskMapper;
|
||||
private ObjectReferenceMapper objectReferenceMapper;
|
||||
|
||||
public TaskServiceImpl(TaskanaEngine taskanaEngine, TaskMapper taskMapper, ObjectReferenceMapper objectReferenceMapper) {
|
||||
public TaskServiceImpl(TaskanaEngine taskanaEngine, TaskMapper taskMapper,
|
||||
ObjectReferenceMapper objectReferenceMapper) {
|
||||
super();
|
||||
this.taskanaEngine = taskanaEngine;
|
||||
this.taskMapper = taskMapper;
|
||||
|
|
@ -51,7 +54,7 @@ public class TaskServiceImpl implements TaskService {
|
|||
task.setClaimed(now);
|
||||
task.setState(TaskState.CLAIMED);
|
||||
taskMapper.update(task);
|
||||
logger.debug("User '{}' claimed task '{}'.", userName, id);
|
||||
LOGGER.debug("User '{}' claimed task '{}'.", userName, id);
|
||||
} else {
|
||||
throw new TaskNotFoundException(id);
|
||||
}
|
||||
|
|
@ -66,7 +69,7 @@ public class TaskServiceImpl implements TaskService {
|
|||
task.setModified(now);
|
||||
task.setState(TaskState.COMPLETED);
|
||||
taskMapper.update(task);
|
||||
logger.debug("Task '{}' completed.", id);
|
||||
LOGGER.debug("Task '{}' completed.", id);
|
||||
} else {
|
||||
throw new TaskNotFoundException(id);
|
||||
}
|
||||
|
|
@ -96,7 +99,7 @@ public class TaskServiceImpl implements TaskService {
|
|||
}
|
||||
this.taskMapper.insert(task);
|
||||
|
||||
logger.debug("Task '{}' created.", task.getId());
|
||||
LOGGER.debug("Task '{}' created.", task.getId());
|
||||
return task;
|
||||
}
|
||||
|
||||
|
|
@ -159,8 +162,10 @@ public class TaskServiceImpl implements TaskService {
|
|||
|
||||
// transfer requires TRANSFER in source and APPEND on destination
|
||||
// workbasket
|
||||
taskanaEngine.getWorkbasketService().checkAuthorization(destinationWorkbasketId, WorkbasketAuthorization.APPEND);
|
||||
taskanaEngine.getWorkbasketService().checkAuthorization(task.getWorkbasketId(), WorkbasketAuthorization.TRANSFER);
|
||||
taskanaEngine.getWorkbasketService().checkAuthorization(destinationWorkbasketId,
|
||||
WorkbasketAuthorization.APPEND);
|
||||
taskanaEngine.getWorkbasketService().checkAuthorization(task.getWorkbasketId(),
|
||||
WorkbasketAuthorization.TRANSFER);
|
||||
|
||||
// if security is disabled, the implicit existance check on the
|
||||
// destination workbasket has been skipped and needs to be performed
|
||||
|
|
|
|||
|
|
@ -20,6 +20,9 @@ import org.taskana.model.mappings.TaskMapper;
|
|||
import org.taskana.model.mappings.WorkbasketAccessMapper;
|
||||
import org.taskana.model.mappings.WorkbasketMapper;
|
||||
|
||||
/**
|
||||
* This is the implementation of TaskanaEngine.
|
||||
*/
|
||||
public class TaskanaEngineImpl implements TaskanaEngine {
|
||||
|
||||
private static final String DEFAULT = "default";
|
||||
|
|
@ -87,7 +90,6 @@ public class TaskanaEngineImpl implements TaskanaEngine {
|
|||
/**
|
||||
* This method creates the sqlSessionFactory of myBatis. It integrates all the
|
||||
* SQL mappers
|
||||
*
|
||||
* @return a {@link SqlSessionFactory}
|
||||
*/
|
||||
private SqlSessionFactory createSqlSessionFactory() {
|
||||
|
|
|
|||
|
|
@ -17,10 +17,12 @@ import org.taskana.model.mappings.DistributionTargetMapper;
|
|||
import org.taskana.model.mappings.WorkbasketAccessMapper;
|
||||
import org.taskana.model.mappings.WorkbasketMapper;
|
||||
import org.taskana.security.CurrentUserContext;
|
||||
|
||||
/**
|
||||
* This is the implementation of WorkbasketService.
|
||||
*/
|
||||
public class WorkbasketServiceImpl implements WorkbasketService {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(WorkbasketServiceImpl.class);
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(WorkbasketServiceImpl.class);
|
||||
|
||||
private static final String ID_PREFIX_WORKBASKET = "WBI";
|
||||
private static final String ID_PREFIX_WORKBASKET_AUTHORIZATION = "WAI";
|
||||
|
|
@ -70,14 +72,14 @@ public class WorkbasketServiceImpl implements WorkbasketService {
|
|||
workbasket.setId(IdGenerator.generateWithPrefix(ID_PREFIX_WORKBASKET));
|
||||
}
|
||||
workbasketMapper.insert(workbasket);
|
||||
logger.debug("Workbasket '{}' created", workbasket.getId());
|
||||
LOGGER.debug("Workbasket '{}' created", workbasket.getId());
|
||||
if (workbasket.getDistributionTargets() != null) {
|
||||
for (Workbasket distributionTarget : workbasket.getDistributionTargets()) {
|
||||
if (workbasketMapper.findById(distributionTarget.getId()) == null) {
|
||||
distributionTarget.setCreated(now);
|
||||
distributionTarget.setModified(now);
|
||||
workbasketMapper.insert(distributionTarget);
|
||||
logger.debug("Workbasket '{}' created", distributionTarget.getId());
|
||||
LOGGER.debug("Workbasket '{}' created", distributionTarget.getId());
|
||||
}
|
||||
distributionTargetMapper.insert(workbasket.getId(), distributionTarget.getId());
|
||||
}
|
||||
|
|
@ -95,7 +97,7 @@ public class WorkbasketServiceImpl implements WorkbasketService {
|
|||
if (!oldDistributionTargets.contains(distributionTarget.getId())) {
|
||||
if (workbasketMapper.findById(distributionTarget.getId()) == null) {
|
||||
workbasketMapper.insert(distributionTarget);
|
||||
logger.debug("Workbasket '{}' created", distributionTarget.getId());
|
||||
LOGGER.debug("Workbasket '{}' created", distributionTarget.getId());
|
||||
}
|
||||
distributionTargetMapper.insert(workbasket.getId(), distributionTarget.getId());
|
||||
} else {
|
||||
|
|
@ -103,7 +105,7 @@ public class WorkbasketServiceImpl implements WorkbasketService {
|
|||
}
|
||||
}
|
||||
distributionTargetMapper.deleteMultiple(workbasket.getId(), oldDistributionTargets);
|
||||
logger.debug("Workbasket '{}' updated", workbasket.getId());
|
||||
LOGGER.debug("Workbasket '{}' updated", workbasket.getId());
|
||||
return workbasketMapper.findById(workbasket.getId());
|
||||
}
|
||||
|
||||
|
|
@ -135,12 +137,12 @@ public class WorkbasketServiceImpl implements WorkbasketService {
|
|||
|
||||
// Skip permission check is security is not enabled
|
||||
if (!taskanaEngine.getConfiguration().isSecurityEnabled()) {
|
||||
logger.debug("Skipping permissions check since security is disabled.");
|
||||
LOGGER.debug("Skipping permissions check since security is disabled.");
|
||||
return;
|
||||
}
|
||||
|
||||
String userId = CurrentUserContext.getUserid();
|
||||
logger.debug("Verifying that {} has the permission {} on workbasket {}", userId, workbasketAuthorization.name(),
|
||||
LOGGER.debug("Verifying that {} has the permission {} on workbasket {}", userId, workbasketAuthorization.name(),
|
||||
workbasketId);
|
||||
|
||||
List<WorkbasketAccessItem> accessItems = workbasketAccessMapper
|
||||
|
|
|
|||
|
|
@ -2,12 +2,24 @@ package org.taskana.impl.util;
|
|||
|
||||
import java.util.UUID;
|
||||
|
||||
public class IdGenerator {
|
||||
/**
|
||||
* This class contains util emthods for generating ids.
|
||||
*/
|
||||
public final class IdGenerator {
|
||||
|
||||
private static final String SEPERATOR = ":";
|
||||
|
||||
/**
|
||||
* This method create an id with an specific prefix.
|
||||
* @param prefix
|
||||
* only 3 characters!
|
||||
* @return a String with a length of 40 characters
|
||||
*/
|
||||
public static String generateWithPrefix(String prefix) {
|
||||
return new StringBuilder().append(prefix).append(SEPERATOR).append(UUID.randomUUID().toString()).toString();
|
||||
}
|
||||
|
||||
private IdGenerator() {
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Classification entity
|
||||
* Classification entity.
|
||||
*/
|
||||
public class Classification {
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ package org.taskana.model;
|
|||
import java.sql.Date;
|
||||
|
||||
/**
|
||||
* DueWorkbasketCounter entity
|
||||
* DueWorkbasketCounter entity.
|
||||
*/
|
||||
public class DueWorkbasketCounter {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package org.taskana.model;
|
||||
|
||||
/**
|
||||
* ObjectReference entity
|
||||
* ObjectReference entity.
|
||||
*/
|
||||
public class ObjectReference {
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ package org.taskana.model;
|
|||
import java.sql.Timestamp;
|
||||
|
||||
/**
|
||||
* Task entity
|
||||
* Task entity.
|
||||
*/
|
||||
public class Task {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package org.taskana.model;
|
||||
|
||||
/**
|
||||
* This enum contains all status of the tasks
|
||||
* This enum contains all status of the tasks.
|
||||
*/
|
||||
public enum TaskState {
|
||||
READY, CLAIMED, COMPLETED
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package org.taskana.model;
|
||||
|
||||
/**
|
||||
* TaskStateCounter entity
|
||||
* TaskStateCounter entity.
|
||||
*/
|
||||
public class TaskStateCounter {
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Workbasket entity
|
||||
* Workbasket entity.
|
||||
*/
|
||||
public class Workbasket {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package org.taskana.model;
|
||||
|
||||
/**
|
||||
* WorkbasketAccessItem entity
|
||||
* WorkbasketAccessItem entity.
|
||||
*/
|
||||
public class WorkbasketAccessItem {
|
||||
|
||||
|
|
|
|||
|
|
@ -5,11 +5,13 @@ import org.taskana.model.Classification;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* This class is the mybatis mapping of classifications.
|
||||
*/
|
||||
public interface ClassificationMapper {
|
||||
|
||||
@Select("SELECT * FROM CLASSIFICATION ORDER BY ID")
|
||||
@Results({
|
||||
@Result(property="id", column="ID"),
|
||||
@Results({ @Result(property = "id", column = "ID"),
|
||||
@Result(property = "tenantId", column = "TENANT_ID"),
|
||||
@Result(property = "parentClassificationId", column = "PARENT_CLASSIFICATION_ID"),
|
||||
@Result(property = "category", column = "CATEGORY"),
|
||||
|
|
@ -19,8 +21,7 @@ public interface ClassificationMapper {
|
|||
@Result(property = "name", column = "NAME"),
|
||||
@Result(property = "description", column = "DESCRIPTION"),
|
||||
@Result(property = "priority", column = "PRIORITY"),
|
||||
@Result(property="serviceLevel", column="SERVICE_LEVEL")
|
||||
})
|
||||
@Result(property = "serviceLevel", column = "SERVICE_LEVEL") })
|
||||
List<Classification> findAll();
|
||||
|
||||
@Select("SELECT * FROM CLASSIFICATION WHERE PARENT_CLASSIFICATION_ID = #{parentClassificationId} ORDER BY ID")
|
||||
|
|
|
|||
|
|
@ -6,7 +6,9 @@ import org.apache.ibatis.annotations.Delete;
|
|||
import org.apache.ibatis.annotations.Insert;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
/**
|
||||
* This class is the mybatis mapping of distribution targets.
|
||||
*/
|
||||
public interface DistributionTargetMapper {
|
||||
|
||||
@Insert("INSERT INTO DISTRIBUTION_TARGETS (SOURCE_ID, TARGET_ID) VALUES (#{sourceId}, #{targetId})")
|
||||
|
|
|
|||
|
|
@ -10,7 +10,9 @@ import org.apache.ibatis.annotations.Results;
|
|||
import org.apache.ibatis.annotations.Select;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
import org.taskana.model.ObjectReference;
|
||||
|
||||
/**
|
||||
* This class is the mybatis mapping of ObjectReference.
|
||||
*/
|
||||
public interface ObjectReferenceMapper {
|
||||
|
||||
@Select("SELECT ID, TENANT_ID, COMPANY, SYSTEM, SYSTEM_INSTANCE, TYPE, VALUE "
|
||||
|
|
@ -23,8 +25,7 @@ public interface ObjectReferenceMapper {
|
|||
@Result(property = "system", column = "SYSTEM"),
|
||||
@Result(property = "systemInstance", column = "SYSTEM_INSTANCE"),
|
||||
@Result(property = "type", column = "TYPE"),
|
||||
@Result(property="value", column="VALUE")
|
||||
})
|
||||
@Result(property = "value", column = "VALUE") })
|
||||
List<ObjectReference> findAll();
|
||||
|
||||
@Select("SELECT ID, TENANT_ID, COMPANY, SYSTEM, SYSTEM_INSTANCE, TYPE, VALUE "
|
||||
|
|
@ -37,8 +38,7 @@ public interface ObjectReferenceMapper {
|
|||
@Result(property = "system", column = "SYSTEM"),
|
||||
@Result(property = "systemInstance", column = "SYSTEM_INSTANCE"),
|
||||
@Result(property = "type", column = "TYPE"),
|
||||
@Result(property="value", column="VALUE")
|
||||
})
|
||||
@Result(property = "value", column = "VALUE") })
|
||||
ObjectReference findById(@Param("id") String id);
|
||||
|
||||
@Select("SELECT ID, TENANT_ID, COMPANY, SYSTEM, SYSTEM_INSTANCE, TYPE, VALUE "
|
||||
|
|
@ -56,8 +56,7 @@ public interface ObjectReferenceMapper {
|
|||
@Result(property = "system", column = "SYSTEM"),
|
||||
@Result(property = "systemInstance", column = "SYSTEM_INSTANCE"),
|
||||
@Result(property = "type", column = "TYPE"),
|
||||
@Result(property="value", column="VALUE")
|
||||
})
|
||||
@Result(property = "value", column = "VALUE") })
|
||||
ObjectReference findByObjectReference(@Param("objectReference") ObjectReference objectReference);
|
||||
|
||||
@Insert("INSERT INTO OBJECT_REFERENCE (ID, TENANT_ID, COMPANY, SYSTEM, SYSTEM_INSTANCE, TYPE, VALUE) VALUES (#{ref.id}, #{ref.tenantId}, #{ref.company}, #{ref.system}, #{ref.systemInstance}, #{ref.type}, #{ref.value})")
|
||||
|
|
|
|||
|
|
@ -17,12 +17,13 @@ import org.taskana.model.ObjectReference;
|
|||
import org.taskana.model.Task;
|
||||
import org.taskana.model.TaskState;
|
||||
import org.taskana.model.TaskStateCounter;
|
||||
|
||||
/**
|
||||
* This class is the mybatis mapping of task.
|
||||
*/
|
||||
public interface TaskMapper {
|
||||
|
||||
@Select("SELECT ID, TENANT_ID, CREATED, CLAIMED, COMPLETED, MODIFIED, PLANNED, DUE, NAME, DESCRIPTION, PRIORITY, STATE, TYPE, WORKBASKETID, OWNER, PRIMARY_OBJ_REF_ID, IS_READ, IS_TRANSFERRED "
|
||||
+ "FROM TASK "
|
||||
+ "WHERE ID = #{id}")
|
||||
+ "FROM TASK " + "WHERE ID = #{id}")
|
||||
@Results(value = {
|
||||
@Result(property = "id", column = "ID"),
|
||||
@Result(property = "tenantId", column = "TENANT_ID"),
|
||||
|
|
@ -45,9 +46,7 @@ public interface TaskMapper {
|
|||
Task findById(@Param("id") String id);
|
||||
|
||||
@Select("SELECT ID, TENANT_ID, CREATED, CLAIMED, COMPLETED, MODIFIED, PLANNED, DUE, NAME, DESCRIPTION, PRIORITY, STATE, TYPE, WORKBASKETID, OWNER, PRIMARY_OBJ_REF_ID, IS_READ, IS_TRANSFERRED "
|
||||
+ "FROM TASK "
|
||||
+ "WHERE WORKBASKETID = #{workbasketId} "
|
||||
+ "ORDER BY ID")
|
||||
+ "FROM TASK " + "WHERE WORKBASKETID = #{workbasketId} " + "ORDER BY ID")
|
||||
@Results(value = {
|
||||
@Result(property = "id", column = "ID"),
|
||||
@Result(property = "tenantId", column = "TENANT_ID"),
|
||||
|
|
@ -74,8 +73,7 @@ public interface TaskMapper {
|
|||
+ "FROM TASK "
|
||||
+ "WHERE WORKBASKETID IN (<foreach item='item' collection='workbasketIds' separator=','>#{item}</foreach>) "
|
||||
+ "AND STATE IN (<foreach item='item' collection='states' separator=',' >#{item}</foreach>) "
|
||||
+ "ORDER BY ID"
|
||||
+ "</script>")
|
||||
+ "ORDER BY ID" + "</script>")
|
||||
@Results(value = {
|
||||
@Result(property = "id", column = "ID"),
|
||||
@Result(property = "tenantId", column = "TENANT_ID"),
|
||||
|
|
@ -126,21 +124,13 @@ public interface TaskMapper {
|
|||
|
||||
@Select("SELECT ID, TENANT_ID, CREATED, CLAIMED, COMPLETED, MODIFIED, PLANNED, DUE, NAME, DESCRIPTION, PRIORITY, STATE, TYPE, WORKBASKETID, OWNER, PRIMARY_OBJ_REF_ID, IS_READ, IS_TRANSFERRED "
|
||||
+ "FROM TASK ")
|
||||
@Results(value = {
|
||||
@Result(property = "id", column = "ID"),
|
||||
@Result(property = "tenantId", column = "TENANT_ID"),
|
||||
@Result(property = "created", column = "CREATED"),
|
||||
@Result(property = "claimed", column = "CLAIMED"),
|
||||
@Result(property = "completed", column = "COMPLETED"),
|
||||
@Result(property = "modified", column = "MODIFIED"),
|
||||
@Result(property = "planned", column = "PLANNED"),
|
||||
@Result(property = "due", column = "DUE"),
|
||||
@Result(property = "name", column = "NAME"),
|
||||
@Result(property = "description", column = "DESCRIPTION"),
|
||||
@Result(property = "priority", column = "PRIORITY"),
|
||||
@Result(property = "state", column = "STATE"),
|
||||
@Result(property = "type", column = "TYPE"),
|
||||
@Result(property = "workbasketId", column = "WORKBASKETID"),
|
||||
@Results(value = { @Result(property = "id", column = "ID"), @Result(property = "tenantId", column = "TENANT_ID"),
|
||||
@Result(property = "created", column = "CREATED"), @Result(property = "claimed", column = "CLAIMED"),
|
||||
@Result(property = "completed", column = "COMPLETED"), @Result(property = "modified", column = "MODIFIED"),
|
||||
@Result(property = "planned", column = "PLANNED"), @Result(property = "due", column = "DUE"),
|
||||
@Result(property = "name", column = "NAME"), @Result(property = "description", column = "DESCRIPTION"),
|
||||
@Result(property = "priority", column = "PRIORITY"), @Result(property = "state", column = "STATE"),
|
||||
@Result(property = "type", column = "TYPE"), @Result(property = "workbasketId", column = "WORKBASKETID"),
|
||||
@Result(property = "owner", column = "OWNER"),
|
||||
@Result(property = "primaryObjRef", column = "PRIMARY_OBJ_REF_ID", javaType = ObjectReference.class, one = @One(select = "org.taskana.model.mappings.ObjectReferenceMapper.findById")),
|
||||
@Result(property = "isRead", column = "IS_READ"),
|
||||
|
|
@ -153,10 +143,7 @@ public interface TaskMapper {
|
|||
+ "WHERE STATE IN (<foreach collection='status' item='state' separator=','>#{state}</foreach>) "
|
||||
+ "GROUP BY STATE"
|
||||
+ "</script>")
|
||||
@Results({
|
||||
@Result(column="STATE", property="state"),
|
||||
@Result(column="counter", property="counter")
|
||||
})
|
||||
@Results({ @Result(column = "STATE", property = "state"), @Result(column = "counter", property = "counter") })
|
||||
List<TaskStateCounter> getTaskCountForState(@Param("status") List<TaskState> status);
|
||||
|
||||
@Select("<script>"
|
||||
|
|
@ -175,11 +162,9 @@ public interface TaskMapper {
|
|||
+ "AND STATE IN (<foreach collection='status' item='state' separator=','>#{state}</foreach>) "
|
||||
+ "GROUP BY DUE_DATE, WORKBASKETID"
|
||||
+ "</script>")
|
||||
@Results({
|
||||
@Result(column="DUE_DATE", property="due"),
|
||||
@Results({ @Result(column = "DUE_DATE", property = "due"),
|
||||
@Result(column = "WORKBASKETID", property = "workbasketId"),
|
||||
@Result(column="counter", property="taskCounter")
|
||||
})
|
||||
@Result(column = "counter", property = "taskCounter") })
|
||||
List<DueWorkbasketCounter> getTaskCountByWorkbasketIdAndDaysInPastAndState(@Param("fromDate") Date fromDate, @Param("status") List<TaskState> states);
|
||||
|
||||
@Insert("INSERT INTO TASK(ID, TENANT_ID, CREATED, CLAIMED, COMPLETED, MODIFIED, PLANNED, DUE, NAME, DESCRIPTION, PRIORITY, STATE, TYPE, WORKBASKETID, OWNER, PRIMARY_OBJ_REF_ID, IS_READ, IS_TRANSFERRED) "
|
||||
|
|
|
|||
|
|
@ -11,7 +11,9 @@ import org.apache.ibatis.annotations.Results;
|
|||
import org.apache.ibatis.annotations.Select;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
import org.taskana.model.WorkbasketAccessItem;
|
||||
|
||||
/**
|
||||
* This class is the mybatis mapping of workbasket access items.
|
||||
*/
|
||||
public interface WorkbasketAccessMapper {
|
||||
|
||||
@Select("SELECT ID, WORKBASKET_ID, USER_ID, GROUP_ID, READ, OPEN, APPEND, TRANSFER, DISTRIBUTE FROM WORKBASKET_ACCESS_LIST WHERE ID = #{id}")
|
||||
|
|
|
|||
|
|
@ -14,12 +14,13 @@ import org.apache.ibatis.annotations.Update;
|
|||
import org.apache.ibatis.mapping.FetchType;
|
||||
import org.taskana.model.Workbasket;
|
||||
import org.taskana.model.WorkbasketAuthorization;
|
||||
|
||||
/**
|
||||
* This class is the mybatis mapping of workbaskets.
|
||||
*/
|
||||
public interface WorkbasketMapper {
|
||||
|
||||
@Select("SELECT ID, TENANT_ID, CREATED, MODIFIED, NAME, DESCRIPTION, OWNER FROM WORKBASKET WHERE ID = #{id}")
|
||||
@Results(value = {
|
||||
@Result(property = "id", column = "ID"),
|
||||
@Results(value = { @Result(property = "id", column = "ID"),
|
||||
@Result(property = "tenantId", column = "TENANT_ID"),
|
||||
@Result(property = "created", column = "CREATED"),
|
||||
@Result(property = "modified", column = "MODIFIED"),
|
||||
|
|
@ -27,7 +28,7 @@ public interface WorkbasketMapper {
|
|||
@Result(property = "description", column = "DESCRIPTION"),
|
||||
@Result(property = "owner", column = "OWNER"),
|
||||
@Result(property = "distributionTargets", column = "ID", javaType = List.class, many = @Many(fetchType = FetchType.DEFAULT, select = "findByDistributionTargets")) })
|
||||
public Workbasket findById(@Param("id") String id);
|
||||
Workbasket findById(@Param("id") String id);
|
||||
|
||||
@Select("SELECT * FROM WORKBASKET WHERE id IN (SELECT TARGET_ID FROM DISTRIBUTION_TARGETS WHERE SOURCE_ID = #{id})")
|
||||
@Results(value = {
|
||||
|
|
@ -39,7 +40,7 @@ public interface WorkbasketMapper {
|
|||
@Result(property = "description", column = "DESCRIPTION"),
|
||||
@Result(property = "owner", column = "OWNER"),
|
||||
@Result(property = "distributionTargets", column = "ID", javaType = List.class, many = @Many(fetchType = FetchType.DEFAULT, select = "findByDistributionTargets")) })
|
||||
public List<Workbasket> findByDistributionTargets(@Param("id") String id);
|
||||
List<Workbasket> findByDistributionTargets(@Param("id") String id);
|
||||
|
||||
@Select("SELECT * FROM WORKBASKET ORDER BY id")
|
||||
@Results(value = {
|
||||
|
|
@ -51,11 +52,10 @@ public interface WorkbasketMapper {
|
|||
@Result(property = "description", column = "DESCRIPTION"),
|
||||
@Result(property = "owner", column = "OWNER"),
|
||||
@Result(property = "distributionTargets", column = "ID", javaType = List.class, many = @Many(fetchType = FetchType.DEFAULT, select = "findByDistributionTargets")) })
|
||||
public List<Workbasket> findAll();
|
||||
List<Workbasket> findAll();
|
||||
|
||||
@Select("<script>SELECT W.ID, W.TENANT_ID, W.CREATED, W.MODIFIED, W.NAME, W.DESCRIPTION, W.OWNER FROM WORKBASKET AS W "
|
||||
+ "INNER JOIN WORKBASKET_ACCESS_LIST AS ACL "
|
||||
+ "ON (W.ID = ACL.WORKBASKET_ID AND USER_ID = #{userId}) "
|
||||
+ "INNER JOIN WORKBASKET_ACCESS_LIST AS ACL " + "ON (W.ID = ACL.WORKBASKET_ID AND USER_ID = #{userId}) "
|
||||
+ "WHERE <foreach collection='authorizations' item='authorization' separator=' AND '>"
|
||||
+ "<if test=\"authorization.name() == 'OPEN'\">OPEN</if>"
|
||||
+ "<if test=\"authorization.name() == 'READ'\">READ</if>"
|
||||
|
|
@ -72,16 +72,16 @@ public interface WorkbasketMapper {
|
|||
@Result(property = "description", column = "DESCRIPTION"),
|
||||
@Result(property = "owner", column = "OWNER"),
|
||||
@Result(property = "distributionTargets", column = "ID", javaType = List.class, many = @Many(fetchType = FetchType.DEFAULT, select = "findByDistributionTargets")) })
|
||||
public List<Workbasket> findByPermission(@Param("authorizations") List<WorkbasketAuthorization> authorizations, @Param("userId") String userId);
|
||||
List<Workbasket> findByPermission(@Param("authorizations") List<WorkbasketAuthorization> authorizations, @Param("userId") String userId);
|
||||
|
||||
@Insert("INSERT INTO WORKBASKET (ID, TENANT_ID, CREATED, MODIFIED, NAME, DESCRIPTION, OWNER) VALUES (#{workbasket.id}, #{workbasket.tenantId}, #{workbasket.created}, #{workbasket.modified}, #{workbasket.name}, #{workbasket.description}, #{workbasket.owner})")
|
||||
@Options(keyProperty = "id", keyColumn = "ID")
|
||||
public void insert(@Param("workbasket") Workbasket workbasket);
|
||||
void insert(@Param("workbasket") Workbasket workbasket);
|
||||
|
||||
@Update("UPDATE WORKBASKET SET TENANT_ID = #{workbasket.tenantId}, MODIFIED = #{workbasket.modified}, NAME = #{workbasket.name}, DESCRIPTION = #{workbasket.description}, OWNER = #{workbasket.owner} WHERE id = #{workbasket.id}")
|
||||
public void update(@Param("workbasket") Workbasket workbasket);
|
||||
void update(@Param("workbasket") Workbasket workbasket);
|
||||
|
||||
@Delete("DELETE FROM WORKBASKET where id = #{id}")
|
||||
public void delete(@Param("id") String id);
|
||||
void delete(@Param("id") String id);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,23 +13,23 @@ import org.slf4j.LoggerFactory;
|
|||
/**
|
||||
* Provides the context information about the current (calling) user. The
|
||||
* context is gathered from the JAAS subject.
|
||||
*
|
||||
* @author Holger Hagen
|
||||
*
|
||||
*/
|
||||
public class CurrentUserContext {
|
||||
public final class CurrentUserContext {
|
||||
|
||||
private static final String GET_UNIQUE_SECURITY_NAME_METHOD = "getUniqueSecurityName";
|
||||
private static final String GET_CALLER_SUBJECT_METHOD = "getCallerSubject";
|
||||
private static final String WSSUBJECT_CLASSNAME = "com.ibm.websphere.security.auth.WSSubject";
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(CurrentUserContext.class);
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(CurrentUserContext.class);
|
||||
|
||||
private static Boolean runningOnWebSphere = null;
|
||||
|
||||
private CurrentUserContext() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the userid of the current user.
|
||||
*
|
||||
* @return String the userid. null if there is no JAAS subject.
|
||||
*/
|
||||
public static String getUserid() {
|
||||
|
|
@ -41,44 +41,45 @@ public class CurrentUserContext {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the unique security name of the first public credentials found in the WSSubject as userid.
|
||||
*
|
||||
* @return the userid of the caller. If the userid could not be obtained, null is returned.
|
||||
* Returns the unique security name of the first public credentials found in the
|
||||
* WSSubject as userid.
|
||||
* @return the userid of the caller. If the userid could not be obtained, null
|
||||
* is returned.
|
||||
*/
|
||||
private static String getUseridFromWSSubject() {
|
||||
try {
|
||||
Class<?> wsSubjectClass = Class.forName(WSSUBJECT_CLASSNAME);
|
||||
Method getCallerSubjectMethod = wsSubjectClass.getMethod(GET_CALLER_SUBJECT_METHOD, (Class<?>[]) null);
|
||||
Subject callerSubject = (Subject) getCallerSubjectMethod.invoke(null, (Object[]) null);
|
||||
logger.debug("Subject of caller: {}", callerSubject);
|
||||
LOGGER.debug("Subject of caller: {}", callerSubject);
|
||||
if (callerSubject != null) {
|
||||
Set<Object> publicCredentials = callerSubject.getPublicCredentials();
|
||||
logger.debug("Public credentials of caller: {}", publicCredentials);
|
||||
LOGGER.debug("Public credentials of caller: {}", publicCredentials);
|
||||
for (Object pC : publicCredentials) {
|
||||
Object o = pC.getClass().getMethod(GET_UNIQUE_SECURITY_NAME_METHOD, (Class<?>[]) null).invoke(pC, (Object[]) null);
|
||||
logger.debug("Returning the unique security name of first public credential: {}", o);
|
||||
Object o = pC.getClass().getMethod(GET_UNIQUE_SECURITY_NAME_METHOD, (Class<?>[]) null).invoke(pC,
|
||||
(Object[]) null);
|
||||
LOGGER.debug("Returning the unique security name of first public credential: {}", o);
|
||||
return o.toString();
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.warn("Could not get user from WSSubject. Going ahead unauthorized.");
|
||||
LOGGER.warn("Could not get user from WSSubject. Going ahead unauthorized.");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks, whether Taskana is running on IBM WebSphere.
|
||||
*
|
||||
* @return true, if it is running on IBM WebSphere
|
||||
*/
|
||||
private static boolean runningOnWebSphere() {
|
||||
if (runningOnWebSphere == null) {
|
||||
try {
|
||||
Class.forName(WSSUBJECT_CLASSNAME);
|
||||
logger.debug("WSSubject detected. Assuming that Taskana runs on IBM WebSphere.");
|
||||
LOGGER.debug("WSSubject detected. Assuming that Taskana runs on IBM WebSphere.");
|
||||
runningOnWebSphere = new Boolean(true);
|
||||
} catch (ClassNotFoundException e) {
|
||||
logger.debug("No WSSubject detected. Using JAAS subject further on.");
|
||||
LOGGER.debug("No WSSubject detected. Using JAAS subject further on.");
|
||||
runningOnWebSphere = new Boolean(false);
|
||||
}
|
||||
}
|
||||
|
|
@ -87,16 +88,16 @@ public class CurrentUserContext {
|
|||
|
||||
private static String getUseridFromJAASSubject() {
|
||||
Subject subject = Subject.getSubject(AccessController.getContext());
|
||||
logger.debug("Subject of caller: {}", subject);
|
||||
LOGGER.debug("Subject of caller: {}", subject);
|
||||
if (subject != null) {
|
||||
Set<Object> publicCredentials = subject.getPublicCredentials();
|
||||
logger.debug("Public credentials of caller: {}", publicCredentials);
|
||||
LOGGER.debug("Public credentials of caller: {}", publicCredentials);
|
||||
for (Object pC : publicCredentials) {
|
||||
logger.debug("Returning the first public credential: {}", pC.toString());
|
||||
LOGGER.debug("Returning the first public credential: {}", pC.toString());
|
||||
return pC.toString();
|
||||
}
|
||||
}
|
||||
logger.debug("No userid found in subject!");
|
||||
LOGGER.debug("No userid found in subject!");
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,10 @@ import java.util.List;
|
|||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
/**
|
||||
* Unit Test for ClassificationServiceImpl.
|
||||
* @author EH
|
||||
*/
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class ClassificationServiceImplTest {
|
||||
|
||||
|
|
|
|||
|
|
@ -26,9 +26,15 @@ import org.taskana.model.Workbasket;
|
|||
import org.taskana.model.mappings.ObjectReferenceMapper;
|
||||
import org.taskana.model.mappings.TaskMapper;
|
||||
|
||||
/**
|
||||
* Unit Test for TaskServiceImpl.
|
||||
* @author EH
|
||||
*/
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class TaskServiceImplTest {
|
||||
|
||||
private static final int LIST_SIZE = 3;
|
||||
private static final int SLEEP_TIME = 100;
|
||||
@InjectMocks
|
||||
TaskServiceImpl taskServiceImpl;
|
||||
@Mock
|
||||
|
|
@ -64,7 +70,7 @@ public class TaskServiceImplTest {
|
|||
public void testClaim() throws Exception {
|
||||
Task task = createUnitTestTask("1", "Unit Test Task 1", "1");
|
||||
|
||||
Thread.sleep(100); // to have different timestamps
|
||||
Thread.sleep(SLEEP_TIME); // to have different timestamps
|
||||
taskServiceImpl.claim(task.getId(), "John Does");
|
||||
task = taskServiceImpl.getTaskById(task.getId());
|
||||
Assert.assertEquals(task.getState(), TaskState.CLAIMED);
|
||||
|
|
@ -82,7 +88,7 @@ public class TaskServiceImplTest {
|
|||
public void testComplete() throws Exception {
|
||||
Task task = createUnitTestTask("1", "Unit Test Task 1", "1");
|
||||
|
||||
Thread.sleep(100); // to have different timestamps
|
||||
Thread.sleep(SLEEP_TIME); // to have different timestamps
|
||||
taskServiceImpl.complete(task.getId());
|
||||
task = taskServiceImpl.getTaskById(task.getId());
|
||||
Assert.assertEquals(task.getState(), TaskState.COMPLETED);
|
||||
|
|
@ -105,7 +111,7 @@ public class TaskServiceImplTest {
|
|||
Mockito.when(taskMapper.findByWorkBasketId("1")).thenReturn(tasks);
|
||||
|
||||
List<Task> list = taskServiceImpl.getTasksForWorkbasket("1");
|
||||
Assert.assertEquals(list.size(), 3);
|
||||
Assert.assertEquals(LIST_SIZE, list.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -26,9 +26,17 @@ import org.taskana.model.mappings.DistributionTargetMapper;
|
|||
import org.taskana.model.mappings.WorkbasketAccessMapper;
|
||||
import org.taskana.model.mappings.WorkbasketMapper;
|
||||
|
||||
/**
|
||||
* Unit Test for workbasketServiceImpl.
|
||||
* @author EH
|
||||
*/
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class WorkbasketServiceImplTest {
|
||||
|
||||
private static final int THREE = 3;
|
||||
|
||||
private static final int SLEEP_TIME = 100;
|
||||
|
||||
@InjectMocks
|
||||
WorkbasketServiceImpl workbasketServiceImpl;
|
||||
|
||||
|
|
@ -98,7 +106,8 @@ public class WorkbasketServiceImplTest {
|
|||
|
||||
@SuppressWarnings("serial")
|
||||
@Test
|
||||
public void should_InitializeAndStoreWorkbasket_when_WorkbasketWithDistributionTargetsIsCreated() throws NotAuthorizedException {
|
||||
public void should_InitializeAndStoreWorkbasket_when_WorkbasketWithDistributionTargetsIsCreated()
|
||||
throws NotAuthorizedException {
|
||||
doNothing().when(workbasketMapper).insert(any());
|
||||
doNothing().when(distributionTargetMapper).insert(any(), any());
|
||||
|
||||
|
|
@ -120,12 +129,13 @@ public class WorkbasketServiceImplTest {
|
|||
Assert.assertEquals("1", workbasket.getId());
|
||||
Assert.assertEquals(workbasket.getModified(), workbasket.getCreated());
|
||||
|
||||
verify(workbasketMapper, times(3)).insert(any());
|
||||
verify(workbasketMapper, times(THREE)).insert(any());
|
||||
verify(distributionTargetMapper, times(2)).insert(any(), any());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void should_ReturnUpdatedWorkbasket_when_ExistingWorkbasketDescriptionIsChanged() throws NotAuthorizedException {
|
||||
public void should_ReturnUpdatedWorkbasket_when_ExistingWorkbasketDescriptionIsChanged()
|
||||
throws NotAuthorizedException {
|
||||
doNothing().when(workbasketMapper).insert(any());
|
||||
|
||||
Workbasket workbasket = new Workbasket();
|
||||
|
|
@ -169,8 +179,7 @@ public class WorkbasketServiceImplTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void should_UpdateModifiedTimestamp_when_ExistingWorkbasketDistributionTargetIsChanged()
|
||||
throws Exception {
|
||||
public void should_UpdateModifiedTimestamp_when_ExistingWorkbasketDistributionTargetIsChanged() throws Exception {
|
||||
doNothing().when(workbasketMapper).insert(any());
|
||||
|
||||
Workbasket workbasket0 = new Workbasket();
|
||||
|
|
@ -187,7 +196,7 @@ public class WorkbasketServiceImplTest {
|
|||
workbasket3.setId("3");
|
||||
workbasket2.getDistributionTargets().clear();
|
||||
workbasket2.getDistributionTargets().add(workbasket3);
|
||||
Thread.sleep(100);
|
||||
Thread.sleep(SLEEP_TIME);
|
||||
|
||||
doNothing().when(workbasketMapper).update(any());
|
||||
workbasketServiceImpl.updateWorkbasket(workbasket2);
|
||||
|
|
|
|||
|
|
@ -10,7 +10,10 @@ import org.junit.Assert;
|
|||
import org.junit.Test;
|
||||
import org.taskana.TaskanaEngine;
|
||||
import org.taskana.configuration.TaskanaEngineConfiguration;
|
||||
|
||||
/**
|
||||
* Integration Test for TaskanaEngineConfiguration.
|
||||
* @author EH
|
||||
*/
|
||||
public class TaskanaEngineConfigurationTest {
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -14,6 +14,10 @@ import java.io.FileNotFoundException;
|
|||
import java.sql.SQLException;
|
||||
import java.time.LocalDate;
|
||||
|
||||
/**
|
||||
* Integration Test for ClassificationServiceImpl.
|
||||
* @author EH
|
||||
*/
|
||||
public class ClassificationServiceImplIntTest {
|
||||
static int counter = 0;
|
||||
private ClassificationService classificationService;
|
||||
|
|
|
|||
|
|
@ -14,6 +14,10 @@ import org.taskana.model.Task;
|
|||
import java.io.FileNotFoundException;
|
||||
import java.sql.SQLException;
|
||||
|
||||
/**
|
||||
* Integration Test for TaskServiceImpl transactions.
|
||||
* @author EH
|
||||
*/
|
||||
public class TaskServiceImplTransactionTest {
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -19,8 +19,16 @@ import org.taskana.exceptions.WorkbasketNotFoundException;
|
|||
import org.taskana.model.Workbasket;
|
||||
import org.taskana.model.WorkbasketAccessItem;
|
||||
|
||||
|
||||
/**
|
||||
* Integration Test for workbasketServiceImpl.
|
||||
* @author EH
|
||||
*/
|
||||
public class WorkbasketServiceImplIntTest {
|
||||
|
||||
private static final int SLEEP_TIME = 100;
|
||||
private static final int THREE = 3;
|
||||
|
||||
WorkbasketService workbasketServiceImpl;
|
||||
static int counter = 0;
|
||||
|
||||
|
|
@ -61,7 +69,7 @@ public class WorkbasketServiceImplIntTest {
|
|||
workbasket2.setId("2");
|
||||
workbasket2.setName("Hyperbasket");
|
||||
workbasketServiceImpl.createWorkbasket(workbasket2);
|
||||
Assert.assertEquals(before + 3, workbasketServiceImpl.getWorkbaskets().size());
|
||||
Assert.assertEquals(before + THREE, workbasketServiceImpl.getWorkbaskets().size());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -127,7 +135,7 @@ public class WorkbasketServiceImplIntTest {
|
|||
workbasket3.setName("hm ... irgend ein basket");
|
||||
workbasket2.getDistributionTargets().clear();
|
||||
workbasket2.getDistributionTargets().add(workbasket3);
|
||||
Thread.sleep(100);
|
||||
Thread.sleep(SLEEP_TIME);
|
||||
workbasketServiceImpl.updateWorkbasket(workbasket2);
|
||||
|
||||
Workbasket foundBasket = workbasketServiceImpl.getWorkbasket(workbasket2.getId());
|
||||
|
|
@ -169,7 +177,8 @@ public class WorkbasketServiceImplIntTest {
|
|||
accessItem.setUserId("Zaphod Beeblebrox");
|
||||
workbasketServiceImpl.updateWorkbasketAuthorization(accessItem);
|
||||
|
||||
Assert.assertEquals("Zaphod Beeblebrox", workbasketServiceImpl.getWorkbasketAuthorization(accessItem.getId()).getUserId());
|
||||
Assert.assertEquals("Zaphod Beeblebrox",
|
||||
workbasketServiceImpl.getWorkbasketAuthorization(accessItem.getId()).getUserId());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue