TSK-1009: refactored project
This commit is contained in:
parent
86476de4ad
commit
afdb22e311
|
|
@ -2,14 +2,12 @@ package pro.taskana.simplehistory;
|
||||||
|
|
||||||
import pro.taskana.history.api.TaskanaHistory;
|
import pro.taskana.history.api.TaskanaHistory;
|
||||||
|
|
||||||
/**
|
/** The TaskanaHistoryEngine represents an overall set of all needed services. */
|
||||||
* The TaskanaHistoryEngine represents an overall set of all needed services.
|
|
||||||
*/
|
|
||||||
public interface TaskanaHistoryEngine {
|
public interface TaskanaHistoryEngine {
|
||||||
/**
|
/**
|
||||||
* The TaskanaHistory can be used for operations on all history events.
|
* The TaskanaHistory can be used for operations on all history events.
|
||||||
*
|
*
|
||||||
* @return the HistoryService
|
* @return the HistoryService
|
||||||
*/
|
*/
|
||||||
TaskanaHistory getTaskanaHistoryService();
|
TaskanaHistory getTaskanaHistoryService();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,73 +10,70 @@ import java.io.StringWriter;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
|
|
||||||
import org.apache.ibatis.jdbc.ScriptRunner;
|
import org.apache.ibatis.jdbc.ScriptRunner;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
/**
|
/** Create the schema for the taskana history. */
|
||||||
* Create the schema for the taskana history.
|
|
||||||
*/
|
|
||||||
public class DbSchemaCreator {
|
public class DbSchemaCreator {
|
||||||
|
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(DbSchemaCreator.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(DbSchemaCreator.class);
|
||||||
private static final String DB_SCHEMA = "/sql/taskana-history-schema.sql";
|
private static final String DB_SCHEMA = "/sql/taskana-history-schema.sql";
|
||||||
private DataSource dataSource;
|
private DataSource dataSource;
|
||||||
private String schemaName;
|
private String schemaName;
|
||||||
private StringWriter outWriter = new StringWriter();
|
private StringWriter outWriter = new StringWriter();
|
||||||
private PrintWriter logWriter = new PrintWriter(outWriter);
|
private PrintWriter logWriter = new PrintWriter(outWriter);
|
||||||
private StringWriter errorWriter = new StringWriter();
|
private StringWriter errorWriter = new StringWriter();
|
||||||
private PrintWriter errorLogWriter = new PrintWriter(errorWriter);
|
private PrintWriter errorLogWriter = new PrintWriter(errorWriter);
|
||||||
|
|
||||||
public DbSchemaCreator(DataSource dataSource, String schema) throws SQLException {
|
public DbSchemaCreator(DataSource dataSource, String schema) throws SQLException {
|
||||||
this.dataSource = dataSource;
|
this.dataSource = dataSource;
|
||||||
this.schemaName = schema;
|
this.schemaName = schema;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Run all db scripts.
|
||||||
|
*
|
||||||
|
* @throws SQLException will be thrown if there will be some incorrect SQL statements invoked.
|
||||||
|
*/
|
||||||
|
public void run() throws SQLException {
|
||||||
|
Connection connection = dataSource.getConnection();
|
||||||
|
connection.setSchema(schemaName);
|
||||||
|
ScriptRunner runner = new ScriptRunner(connection);
|
||||||
|
runner.setStopOnError(true);
|
||||||
|
runner.setLogWriter(logWriter);
|
||||||
|
runner.setErrorLogWriter(errorLogWriter);
|
||||||
|
try {
|
||||||
|
InputStream resourceAsStream = this.getClass().getResourceAsStream(DB_SCHEMA);
|
||||||
|
BufferedReader reader =
|
||||||
|
new BufferedReader(new InputStreamReader(resourceAsStream, StandardCharsets.UTF_8));
|
||||||
|
runner.runScript(getSqlWithSchemaNameParsed(reader));
|
||||||
|
} finally {
|
||||||
|
runner.closeConnection();
|
||||||
}
|
}
|
||||||
|
LOGGER.debug(outWriter.toString());
|
||||||
/**
|
if (!errorWriter.toString().trim().isEmpty()) {
|
||||||
* Run all db scripts.
|
LOGGER.error(errorWriter.toString());
|
||||||
*
|
|
||||||
* @throws SQLException
|
|
||||||
* will be thrown if there will be some incorrect SQL statements invoked.
|
|
||||||
*/
|
|
||||||
public void run() throws SQLException {
|
|
||||||
Connection connection = dataSource.getConnection();
|
|
||||||
connection.setSchema(schemaName);
|
|
||||||
ScriptRunner runner = new ScriptRunner(connection);
|
|
||||||
runner.setStopOnError(true);
|
|
||||||
runner.setLogWriter(logWriter);
|
|
||||||
runner.setErrorLogWriter(errorLogWriter);
|
|
||||||
try {
|
|
||||||
InputStream resourceAsStream = this.getClass().getResourceAsStream(DB_SCHEMA);
|
|
||||||
BufferedReader reader = new BufferedReader(new InputStreamReader(resourceAsStream, StandardCharsets.UTF_8));
|
|
||||||
runner.runScript(getSqlWithSchemaNameParsed(reader));
|
|
||||||
} finally {
|
|
||||||
runner.closeConnection();
|
|
||||||
}
|
|
||||||
LOGGER.debug(outWriter.toString());
|
|
||||||
if (!errorWriter.toString().trim().isEmpty()) {
|
|
||||||
LOGGER.error(errorWriter.toString());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private StringReader getSqlWithSchemaNameParsed(BufferedReader reader) {
|
private StringReader getSqlWithSchemaNameParsed(BufferedReader reader) {
|
||||||
StringBuilder content = new StringBuilder();
|
StringBuilder content = new StringBuilder();
|
||||||
try {
|
try {
|
||||||
String line = "";
|
String line = "";
|
||||||
while (line != null) {
|
while (line != null) {
|
||||||
line = reader.readLine();
|
line = reader.readLine();
|
||||||
if (line != null) {
|
if (line != null) {
|
||||||
content.append(line.replaceAll("%schemaName%", schemaName)).append(System.lineSeparator());
|
content
|
||||||
}
|
.append(line.replaceAll("%schemaName%", schemaName))
|
||||||
}
|
.append(System.lineSeparator());
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
LOGGER.error("SchemaName sql parsing failed for schemaName {}", schemaName);
|
|
||||||
}
|
}
|
||||||
return new StringReader(content.toString());
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
LOGGER.error("SchemaName sql parsing failed for schemaName {}", schemaName);
|
||||||
}
|
}
|
||||||
|
return new StringReader(content.toString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,10 @@ package pro.taskana.simplehistory.impl;
|
||||||
|
|
||||||
import pro.taskana.history.api.TaskanaHistoryEvent;
|
import pro.taskana.history.api.TaskanaHistoryEvent;
|
||||||
|
|
||||||
/**
|
/** This entity contains the most important information about a history event. */
|
||||||
* This entity contains the most important information about a history event.
|
|
||||||
*/
|
|
||||||
public class HistoryEventImpl extends TaskanaHistoryEvent {
|
public class HistoryEventImpl extends TaskanaHistoryEvent {
|
||||||
|
|
||||||
public HistoryEventImpl() {
|
public HistoryEventImpl() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -2,7 +2,6 @@ package pro.taskana.simplehistory.impl;
|
||||||
|
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
|
@ -13,51 +12,52 @@ import pro.taskana.simplehistory.impl.mappings.HistoryEventMapper;
|
||||||
import pro.taskana.simplehistory.impl.mappings.HistoryQueryMapper;
|
import pro.taskana.simplehistory.impl.mappings.HistoryQueryMapper;
|
||||||
import pro.taskana.simplehistory.query.HistoryQuery;
|
import pro.taskana.simplehistory.query.HistoryQuery;
|
||||||
|
|
||||||
/**
|
/** This is the implementation of TaskanaHistory. */
|
||||||
* This is the implementation of TaskanaHistory.
|
|
||||||
*/
|
|
||||||
public class SimpleHistoryServiceImpl implements TaskanaHistory {
|
public class SimpleHistoryServiceImpl implements TaskanaHistory {
|
||||||
|
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(SimpleHistoryServiceImpl.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(SimpleHistoryServiceImpl.class);
|
||||||
private TaskanaHistoryEngineImpl taskanaHistoryEngine;
|
private TaskanaHistoryEngineImpl taskanaHistoryEngine;
|
||||||
private HistoryEventMapper historyEventMapper;
|
private HistoryEventMapper historyEventMapper;
|
||||||
private HistoryQueryMapper historyQueryMapper;
|
private HistoryQueryMapper historyQueryMapper;
|
||||||
|
|
||||||
@Override
|
|
||||||
public void initialize(TaskanaEngineConfiguration taskanaEngineConfiguration) {
|
|
||||||
try {
|
|
||||||
this.taskanaHistoryEngine = TaskanaHistoryEngineImpl.createTaskanaEngine(taskanaEngineConfiguration);
|
|
||||||
if (LOGGER.isDebugEnabled()) {
|
|
||||||
LOGGER.debug("Simple history service implementation initialized with schemaName: {} ",
|
|
||||||
taskanaEngineConfiguration.getSchemaName());
|
|
||||||
}
|
|
||||||
} catch (SQLException e) {
|
|
||||||
LOGGER.error("There was an error creating Taskana history engine", e);
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
this.historyEventMapper = this.taskanaHistoryEngine.getSqlSession().getMapper(HistoryEventMapper.class);
|
|
||||||
this.historyQueryMapper = this.taskanaHistoryEngine.getSqlSession().getMapper(HistoryQueryMapper.class);
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initialize(TaskanaEngineConfiguration taskanaEngineConfiguration) {
|
||||||
|
try {
|
||||||
|
this.taskanaHistoryEngine =
|
||||||
|
TaskanaHistoryEngineImpl.createTaskanaEngine(taskanaEngineConfiguration);
|
||||||
|
if (LOGGER.isDebugEnabled()) {
|
||||||
|
LOGGER.debug(
|
||||||
|
"Simple history service implementation initialized with schemaName: {} ",
|
||||||
|
taskanaEngineConfiguration.getSchemaName());
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
LOGGER.error("There was an error creating Taskana history engine", e);
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
this.historyEventMapper =
|
||||||
|
this.taskanaHistoryEngine.getSqlSession().getMapper(HistoryEventMapper.class);
|
||||||
|
this.historyQueryMapper =
|
||||||
|
this.taskanaHistoryEngine.getSqlSession().getMapper(HistoryQueryMapper.class);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void create(TaskanaHistoryEvent event) {
|
public void create(TaskanaHistoryEvent event) {
|
||||||
try {
|
try {
|
||||||
taskanaHistoryEngine.openConnection();
|
taskanaHistoryEngine.openConnection();
|
||||||
if (event.getCreated() == null) {
|
if (event.getCreated() == null) {
|
||||||
Instant now = Instant.now();
|
Instant now = Instant.now();
|
||||||
event.setCreated(now);
|
event.setCreated(now);
|
||||||
}
|
}
|
||||||
historyEventMapper.insert(event);
|
historyEventMapper.insert(event);
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} finally {
|
} finally {
|
||||||
taskanaHistoryEngine.returnConnection();
|
taskanaHistoryEngine.returnConnection();
|
||||||
LOGGER.debug("exit from create(TaskanaHistoryEvent event). Returning object = {}.", event);
|
LOGGER.debug("exit from create(TaskanaHistoryEvent event). Returning object = {}.", event);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public HistoryQuery createHistoryQuery() {
|
public HistoryQuery createHistoryQuery() {
|
||||||
return new HistoryQueryImpl(taskanaHistoryEngine, historyQueryMapper);
|
return new HistoryQueryImpl(taskanaHistoryEngine, historyQueryMapper);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@ package pro.taskana.simplehistory.impl;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.ArrayDeque;
|
import java.util.ArrayDeque;
|
||||||
import java.util.Deque;
|
import java.util.Deque;
|
||||||
|
|
||||||
import org.apache.ibatis.mapping.Environment;
|
import org.apache.ibatis.mapping.Environment;
|
||||||
import org.apache.ibatis.session.Configuration;
|
import org.apache.ibatis.session.Configuration;
|
||||||
import org.apache.ibatis.session.SqlSession;
|
import org.apache.ibatis.session.SqlSession;
|
||||||
|
|
@ -21,155 +20,151 @@ import pro.taskana.simplehistory.configuration.DbSchemaCreator;
|
||||||
import pro.taskana.simplehistory.impl.mappings.HistoryEventMapper;
|
import pro.taskana.simplehistory.impl.mappings.HistoryEventMapper;
|
||||||
import pro.taskana.simplehistory.impl.mappings.HistoryQueryMapper;
|
import pro.taskana.simplehistory.impl.mappings.HistoryQueryMapper;
|
||||||
|
|
||||||
/**
|
/** This is the implementation of TaskanaHistoryEngine. */
|
||||||
* This is the implementation of TaskanaHistoryEngine.
|
|
||||||
*/
|
|
||||||
public class TaskanaHistoryEngineImpl implements TaskanaHistoryEngine {
|
public class TaskanaHistoryEngineImpl implements TaskanaHistoryEngine {
|
||||||
|
|
||||||
private static final String DEFAULT = "default";
|
protected static final ThreadLocal<Deque<SqlSessionManager>> SESSION_STACK = new ThreadLocal<>();
|
||||||
|
private static final String DEFAULT = "default";
|
||||||
|
TaskanaEngineConfiguration taskanaEngineConfiguration;
|
||||||
|
protected SqlSessionManager sessionManager;
|
||||||
|
protected TransactionFactory transactionFactory;
|
||||||
|
protected TaskanaHistory taskanaHistoryService;
|
||||||
|
|
||||||
TaskanaEngineConfiguration taskanaEngineConfiguration;
|
protected TaskanaHistoryEngineImpl(TaskanaEngineConfiguration taskanaEngineConfiguration)
|
||||||
|
throws SQLException {
|
||||||
|
this.taskanaEngineConfiguration = taskanaEngineConfiguration;
|
||||||
|
|
||||||
protected SqlSessionManager sessionManager;
|
createTransactionFactory(this.taskanaEngineConfiguration.getUseManagedTransactions());
|
||||||
|
this.sessionManager = createSqlSessionManager();
|
||||||
|
new DbSchemaCreator(
|
||||||
|
taskanaEngineConfiguration.getDatasource(), taskanaEngineConfiguration.getSchemaName())
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
protected TransactionFactory transactionFactory;
|
public static TaskanaHistoryEngineImpl createTaskanaEngine(
|
||||||
|
TaskanaEngineConfiguration taskanaEngineConfiguration) throws SQLException {
|
||||||
|
return new TaskanaHistoryEngineImpl(taskanaEngineConfiguration);
|
||||||
|
}
|
||||||
|
|
||||||
protected static final ThreadLocal<Deque<SqlSessionManager>> SESSION_STACK = new ThreadLocal<>();
|
@Override
|
||||||
|
public TaskanaHistory getTaskanaHistoryService() {
|
||||||
protected TaskanaHistory taskanaHistoryService;
|
if (taskanaHistoryService == null) {
|
||||||
|
SimpleHistoryServiceImpl historyService = new SimpleHistoryServiceImpl();
|
||||||
protected TaskanaHistoryEngineImpl(TaskanaEngineConfiguration taskanaEngineConfiguration) throws SQLException {
|
historyService.initialize(taskanaEngineConfiguration);
|
||||||
this.taskanaEngineConfiguration = taskanaEngineConfiguration;
|
this.taskanaHistoryService = historyService;
|
||||||
|
|
||||||
createTransactionFactory(this.taskanaEngineConfiguration.getUseManagedTransactions());
|
|
||||||
this.sessionManager = createSqlSessionManager();
|
|
||||||
new DbSchemaCreator(taskanaEngineConfiguration.getDatasource(),
|
|
||||||
taskanaEngineConfiguration.getSchemaName()).
|
|
||||||
run();
|
|
||||||
}
|
}
|
||||||
|
return this.taskanaHistoryService;
|
||||||
|
}
|
||||||
|
|
||||||
public static TaskanaHistoryEngineImpl createTaskanaEngine(
|
/**
|
||||||
TaskanaEngineConfiguration taskanaEngineConfiguration) throws SQLException {
|
* Open the connection to the database. to be called at the begin of each Api call that accesses
|
||||||
return new TaskanaHistoryEngineImpl(taskanaEngineConfiguration);
|
* the database
|
||||||
|
*
|
||||||
|
* @throws SQLException thrown if the connection could not be opened.
|
||||||
|
*/
|
||||||
|
void openConnection() throws SQLException {
|
||||||
|
initSqlSession();
|
||||||
|
this.sessionManager.getConnection().setSchema(taskanaEngineConfiguration.getSchemaName());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the database connection into the pool. In the case of nested calls, simply pops the
|
||||||
|
* latest session from the session stack. Closes the connection if the session stack is empty. In
|
||||||
|
* mode AUTOCOMMIT commits before the connection is closed. To be called at the end of each Api
|
||||||
|
* call that accesses the database
|
||||||
|
*/
|
||||||
|
void returnConnection() {
|
||||||
|
popSessionFromStack();
|
||||||
|
if (getSessionStack().isEmpty()
|
||||||
|
&& this.sessionManager != null
|
||||||
|
&& this.sessionManager.isManagedSessionStarted()) {
|
||||||
|
try {
|
||||||
|
this.sessionManager.commit();
|
||||||
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
|
this.sessionManager.close();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
/** Initializes the SqlSessionManager. */
|
||||||
public TaskanaHistory getTaskanaHistoryService() {
|
void initSqlSession() {
|
||||||
if (taskanaHistoryService == null) {
|
this.sessionManager.startManagedSession();
|
||||||
SimpleHistoryServiceImpl historyService = new SimpleHistoryServiceImpl();
|
}
|
||||||
historyService.initialize(taskanaEngineConfiguration);
|
|
||||||
this.taskanaHistoryService = historyService;
|
/**
|
||||||
}
|
* retrieve the SqlSession used by taskana.
|
||||||
return this.taskanaHistoryService;
|
*
|
||||||
|
* @return the myBatis SqlSession object used by taskana
|
||||||
|
*/
|
||||||
|
SqlSession getSqlSession() {
|
||||||
|
return this.sessionManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected SqlSessionManager createSqlSessionManager() {
|
||||||
|
Environment environment =
|
||||||
|
new Environment(
|
||||||
|
DEFAULT, this.transactionFactory, taskanaEngineConfiguration.getDatasource());
|
||||||
|
Configuration configuration = new Configuration(environment);
|
||||||
|
|
||||||
|
// add mappers
|
||||||
|
configuration.addMapper(HistoryEventMapper.class);
|
||||||
|
configuration.addMapper(HistoryQueryMapper.class);
|
||||||
|
SqlSessionFactory localSessionFactory = new SqlSessionFactoryBuilder().build(configuration);
|
||||||
|
return SqlSessionManager.newInstance(localSessionFactory);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static void pushSessionToStack(SqlSessionManager session) {
|
||||||
|
getSessionStack().push(session);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static void popSessionFromStack() {
|
||||||
|
Deque<SqlSessionManager> stack = getSessionStack();
|
||||||
|
if (!stack.isEmpty()) {
|
||||||
|
stack.pop();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Open the connection to the database. to be called at the begin of each Api call that accesses the database
|
* With sessionStack, we maintain a Stack of SqlSessionManager objects on a per thread basis.
|
||||||
*
|
* SqlSessionManager is the MyBatis object that wraps database connections. The purpose of this
|
||||||
* @throws SQLException
|
* stack is to keep track of nested calls. Each external API call is wrapped into
|
||||||
* thrown if the connection could not be opened.
|
* taskanaEngineImpl.openConnection(); ..... taskanaEngineImpl.returnConnection(); calls. In order
|
||||||
*/
|
* to avoid duplicate opening / closing of connections, we use the sessionStack in the following
|
||||||
void openConnection() throws SQLException {
|
* way: Each time, an openConnection call is received, we push the current sessionManager onto the
|
||||||
initSqlSession();
|
* stack. On the first call to openConnection, we call sessionManager.startManagedSession() to
|
||||||
this.sessionManager.getConnection().setSchema(taskanaEngineConfiguration.getSchemaName());
|
* open a database connection. On each call to returnConnection() we pop one instance of
|
||||||
|
* sessionManager from the stack. When the stack becomes empty, we close the database connection
|
||||||
|
* by calling sessionManager.close()
|
||||||
|
*
|
||||||
|
* @return Stack of SqlSessionManager
|
||||||
|
*/
|
||||||
|
protected static Deque<SqlSessionManager> getSessionStack() {
|
||||||
|
Deque<SqlSessionManager> stack = SESSION_STACK.get();
|
||||||
|
if (stack == null) {
|
||||||
|
stack = new ArrayDeque<>();
|
||||||
|
SESSION_STACK.set(stack);
|
||||||
}
|
}
|
||||||
|
return stack;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
protected static SqlSessionManager getSessionFromStack() {
|
||||||
* Returns the database connection into the pool. In the case of nested calls, simply pops the latest session from
|
Deque<SqlSessionManager> stack = getSessionStack();
|
||||||
* the session stack. Closes the connection if the session stack is empty. In mode AUTOCOMMIT commits before the
|
if (stack.isEmpty()) {
|
||||||
* connection is closed. To be called at the end of each Api call that accesses the database
|
return null;
|
||||||
*/
|
|
||||||
void returnConnection() {
|
|
||||||
popSessionFromStack();
|
|
||||||
if (getSessionStack().isEmpty()
|
|
||||||
&& this.sessionManager != null && this.sessionManager.isManagedSessionStarted()) {
|
|
||||||
try {
|
|
||||||
this.sessionManager.commit();
|
|
||||||
} catch (Exception e) {
|
|
||||||
}
|
|
||||||
this.sessionManager.close();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
return stack.peek();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes the SqlSessionManager.
|
* creates the MyBatis transaction factory.
|
||||||
*/
|
*
|
||||||
void initSqlSession() {
|
* @param useManagedTransactions true if TASKANA should use a ManagedTransactionFactory.
|
||||||
this.sessionManager.startManagedSession();
|
*/
|
||||||
}
|
private void createTransactionFactory(boolean useManagedTransactions) {
|
||||||
|
if (useManagedTransactions) {
|
||||||
/**
|
this.transactionFactory = new ManagedTransactionFactory();
|
||||||
* retrieve the SqlSession used by taskana.
|
} else {
|
||||||
*
|
this.transactionFactory = new JdbcTransactionFactory();
|
||||||
* @return the myBatis SqlSession object used by taskana
|
|
||||||
*/
|
|
||||||
SqlSession getSqlSession() {
|
|
||||||
return this.sessionManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* creates the MyBatis transaction factory.
|
|
||||||
*
|
|
||||||
* @param useManagedTransactions
|
|
||||||
* true if TASKANA should use a ManagedTransactionFactory.
|
|
||||||
*/
|
|
||||||
private void createTransactionFactory(boolean useManagedTransactions) {
|
|
||||||
if (useManagedTransactions) {
|
|
||||||
this.transactionFactory = new ManagedTransactionFactory();
|
|
||||||
} else {
|
|
||||||
this.transactionFactory = new JdbcTransactionFactory();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected SqlSessionManager createSqlSessionManager() {
|
|
||||||
Environment environment = new Environment(DEFAULT, this.transactionFactory,
|
|
||||||
taskanaEngineConfiguration.getDatasource());
|
|
||||||
Configuration configuration = new Configuration(environment);
|
|
||||||
|
|
||||||
// add mappers
|
|
||||||
configuration.addMapper(HistoryEventMapper.class);
|
|
||||||
configuration.addMapper(HistoryQueryMapper.class);
|
|
||||||
SqlSessionFactory localSessionFactory = new SqlSessionFactoryBuilder().build(configuration);
|
|
||||||
return SqlSessionManager.newInstance(localSessionFactory);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected static void pushSessionToStack(SqlSessionManager session) {
|
|
||||||
getSessionStack().push(session);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected static void popSessionFromStack() {
|
|
||||||
Deque<SqlSessionManager> stack = getSessionStack();
|
|
||||||
if (!stack.isEmpty()) {
|
|
||||||
stack.pop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* With sessionStack, we maintain a Stack of SqlSessionManager objects on a per thread basis. SqlSessionManager is
|
|
||||||
* the MyBatis object that wraps database connections. The purpose of this stack is to keep track of nested calls.
|
|
||||||
* Each external API call is wrapped into taskanaEngineImpl.openConnection(); .....
|
|
||||||
* taskanaEngineImpl.returnConnection(); calls. In order to avoid duplicate opening / closing of connections, we use
|
|
||||||
* the sessionStack in the following way: Each time, an openConnection call is received, we push the current
|
|
||||||
* sessionManager onto the stack. On the first call to openConnection, we call sessionManager.startManagedSession()
|
|
||||||
* to open a database connection. On each call to returnConnection() we pop one instance of sessionManager from the
|
|
||||||
* stack. When the stack becomes empty, we close the database connection by calling sessionManager.close()
|
|
||||||
*
|
|
||||||
* @return Stack of SqlSessionManager
|
|
||||||
*/
|
|
||||||
protected static Deque<SqlSessionManager> getSessionStack() {
|
|
||||||
Deque<SqlSessionManager> stack = SESSION_STACK.get();
|
|
||||||
if (stack == null) {
|
|
||||||
stack = new ArrayDeque<>();
|
|
||||||
SESSION_STACK.set(stack);
|
|
||||||
}
|
|
||||||
return stack;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected static SqlSessionManager getSessionFromStack() {
|
|
||||||
Deque<SqlSessionManager> stack = getSessionStack();
|
|
||||||
if (stack.isEmpty()) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return stack.peek();
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,24 +5,21 @@ import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import pro.taskana.history.api.TaskanaHistoryEvent;
|
import pro.taskana.history.api.TaskanaHistoryEvent;
|
||||||
|
|
||||||
/**
|
/** This class is the mybatis mapping of workbaskets. */
|
||||||
* This class is the mybatis mapping of workbaskets.
|
|
||||||
*/
|
|
||||||
public interface HistoryEventMapper {
|
public interface HistoryEventMapper {
|
||||||
|
|
||||||
@Insert(
|
@Insert(
|
||||||
"<script>INSERT INTO HISTORY_EVENTS (BUSINESS_PROCESS_ID, PARENT_BUSINESS_PROCESS_ID, TASK_ID,"
|
"<script>INSERT INTO HISTORY_EVENTS (BUSINESS_PROCESS_ID, PARENT_BUSINESS_PROCESS_ID, TASK_ID,"
|
||||||
+ " EVENT_TYPE, CREATED, USER_ID, DOMAIN, WORKBASKET_KEY, POR_COMPANY, POR_SYSTEM, POR_INSTANCE,"
|
+ " EVENT_TYPE, CREATED, USER_ID, DOMAIN, WORKBASKET_KEY, POR_COMPANY, POR_SYSTEM, POR_INSTANCE,"
|
||||||
+ " POR_TYPE, POR_VALUE, TASK_CLASSIFICATION_KEY, TASK_CLASSIFICATION_CATEGORY, ATTACHMENT_CLASSIFICATION_KEY, "
|
+ " POR_TYPE, POR_VALUE, TASK_CLASSIFICATION_KEY, TASK_CLASSIFICATION_CATEGORY, ATTACHMENT_CLASSIFICATION_KEY, "
|
||||||
+ " COMMENT, OLD_VALUE, NEW_VALUE, CUSTOM_1, CUSTOM_2, CUSTOM_3, CUSTOM_4, OLD_DATA, NEW_DATA)"
|
+ " COMMENT, OLD_VALUE, NEW_VALUE, CUSTOM_1, CUSTOM_2, CUSTOM_3, CUSTOM_4, OLD_DATA, NEW_DATA)"
|
||||||
+ " VALUES ( #{historyEvent.businessProcessId}, #{historyEvent.parentBusinessProcessId}, #{historyEvent.taskId},"
|
+ " VALUES ( #{historyEvent.businessProcessId}, #{historyEvent.parentBusinessProcessId}, #{historyEvent.taskId},"
|
||||||
+ " #{historyEvent.eventType}, #{historyEvent.created}, #{historyEvent.userId}, #{historyEvent.domain}, #{historyEvent.workbasketKey},"
|
+ " #{historyEvent.eventType}, #{historyEvent.created}, #{historyEvent.userId}, #{historyEvent.domain}, #{historyEvent.workbasketKey},"
|
||||||
+ " #{historyEvent.porCompany}, #{historyEvent.porSystem}, #{historyEvent.porInstance}, #{historyEvent.porType},"
|
+ " #{historyEvent.porCompany}, #{historyEvent.porSystem}, #{historyEvent.porInstance}, #{historyEvent.porType},"
|
||||||
+ " #{historyEvent.porValue}, #{historyEvent.taskClassificationKey}, #{historyEvent.taskClassificationCategory},"
|
+ " #{historyEvent.porValue}, #{historyEvent.taskClassificationKey}, #{historyEvent.taskClassificationCategory},"
|
||||||
+ " #{historyEvent.attachmentClassificationKey}, #{historyEvent.comment}, #{historyEvent.oldValue}, #{historyEvent.newValue},"
|
+ " #{historyEvent.attachmentClassificationKey}, #{historyEvent.comment}, #{historyEvent.oldValue}, #{historyEvent.newValue},"
|
||||||
+ " #{historyEvent.custom1}, #{historyEvent.custom2}, #{historyEvent.custom3}, #{historyEvent.custom4},"
|
+ " #{historyEvent.custom1}, #{historyEvent.custom2}, #{historyEvent.custom3}, #{historyEvent.custom4},"
|
||||||
+ " #{historyEvent.oldData}, #{historyEvent.newData}) "
|
+ " #{historyEvent.oldData}, #{historyEvent.newData}) "
|
||||||
+ "</script>")
|
+ "</script>")
|
||||||
void insert(@Param("historyEvent") TaskanaHistoryEvent historyEvent);
|
void insert(@Param("historyEvent") TaskanaHistoryEvent historyEvent);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
package pro.taskana.simplehistory.impl.mappings;
|
package pro.taskana.simplehistory.impl.mappings;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.ibatis.annotations.Result;
|
import org.apache.ibatis.annotations.Result;
|
||||||
import org.apache.ibatis.annotations.Results;
|
import org.apache.ibatis.annotations.Results;
|
||||||
import org.apache.ibatis.annotations.Select;
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
@ -9,221 +8,221 @@ import org.apache.ibatis.annotations.Select;
|
||||||
import pro.taskana.simplehistory.impl.HistoryEventImpl;
|
import pro.taskana.simplehistory.impl.HistoryEventImpl;
|
||||||
import pro.taskana.simplehistory.impl.HistoryQueryImpl;
|
import pro.taskana.simplehistory.impl.HistoryQueryImpl;
|
||||||
|
|
||||||
/**
|
/** This class is the mybatis mapping of historyQueries. */
|
||||||
* This class is the mybatis mapping of historyQueries.
|
|
||||||
*/
|
|
||||||
public interface HistoryQueryMapper {
|
public interface HistoryQueryMapper {
|
||||||
|
|
||||||
@Select(
|
@Select(
|
||||||
"<script>"
|
"<script>"
|
||||||
+ "SELECT ID, BUSINESS_PROCESS_ID, PARENT_BUSINESS_PROCESS_ID, TASK_ID, EVENT_TYPE, CREATED, USER_ID, DOMAIN, WORKBASKET_KEY, "
|
+ "SELECT ID, BUSINESS_PROCESS_ID, PARENT_BUSINESS_PROCESS_ID, TASK_ID, EVENT_TYPE, CREATED, USER_ID, DOMAIN, WORKBASKET_KEY, "
|
||||||
+ "POR_COMPANY, POR_SYSTEM, POR_INSTANCE, POR_TYPE, POR_VALUE, TASK_CLASSIFICATION_KEY, TASK_CLASSIFICATION_CATEGORY,"
|
+ "POR_COMPANY, POR_SYSTEM, POR_INSTANCE, POR_TYPE, POR_VALUE, TASK_CLASSIFICATION_KEY, TASK_CLASSIFICATION_CATEGORY,"
|
||||||
+ "ATTACHMENT_CLASSIFICATION_KEY, COMMENT, OLD_VALUE, NEW_VALUE, CUSTOM_1, CUSTOM_2, CUSTOM_3, CUSTOM_4, OLD_DATA, NEW_DATA "
|
+ "ATTACHMENT_CLASSIFICATION_KEY, COMMENT, OLD_VALUE, NEW_VALUE, CUSTOM_1, CUSTOM_2, CUSTOM_3, CUSTOM_4, OLD_DATA, NEW_DATA "
|
||||||
+ "FROM HISTORY_EVENTS"
|
+ "FROM HISTORY_EVENTS"
|
||||||
+ "<where>"
|
+ "<where>"
|
||||||
// IN-Queries
|
// IN-Queries
|
||||||
+ "<if test='idIn != null'>AND UPPER(ID) IN (<foreach item='item' collection='idIn' separator=',' >#{item}</foreach>)</if> "
|
+ "<if test='idIn != null'>AND UPPER(ID) IN (<foreach item='item' collection='idIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
+ "<if test='businessProcessIdIn != null'>AND UPPER(BUSINESS_PROCESS_ID) IN (<foreach item='item' collection='businessProcessIdIn' separator=',' >#{item}</foreach>)</if> "
|
+ "<if test='businessProcessIdIn != null'>AND UPPER(BUSINESS_PROCESS_ID) IN (<foreach item='item' collection='businessProcessIdIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
+ "<if test='parentBusinessProcessIdIn != null'>AND UPPER(PARENT_BUSINESS_PROCESS_ID) IN (<foreach item='item' collection='parentBusinessProcessIdIn' separator=',' >#{item}</foreach>)</if> "
|
+ "<if test='parentBusinessProcessIdIn != null'>AND UPPER(PARENT_BUSINESS_PROCESS_ID) IN (<foreach item='item' collection='parentBusinessProcessIdIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
+ "<if test='taskIdIn != null'>AND UPPER(TASK_ID) IN (<foreach item='item' collection='taskIdIn' separator=',' >#{item}</foreach>)</if> "
|
+ "<if test='taskIdIn != null'>AND UPPER(TASK_ID) IN (<foreach item='item' collection='taskIdIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
+ "<if test='eventTypeIn != null'>AND UPPER(EVENT_TYPE) IN (<foreach item='item' collection='eventTypeIn' separator=',' >#{item}</foreach>)</if> "
|
+ "<if test='eventTypeIn != null'>AND UPPER(EVENT_TYPE) IN (<foreach item='item' collection='eventTypeIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
+ "<if test='createdIn !=null'> AND ( <foreach item='item' collection='createdIn' separator=',' > ( <if test='item.begin!=null'> CREATED >= #{item.begin} </if> <if test='item.begin!=null and item.end!=null'> AND </if><if test='item.end!=null'> CREATED <=#{item.end} </if>)</foreach>)</if> "
|
+ "<if test='createdIn !=null'> AND ( <foreach item='item' collection='createdIn' separator=',' > ( <if test='item.begin!=null'> CREATED >= #{item.begin} </if> <if test='item.begin!=null and item.end!=null'> AND </if><if test='item.end!=null'> CREATED <=#{item.end} </if>)</foreach>)</if> "
|
||||||
+ "<if test='userIdIn != null'>AND UPPER(USER_ID) IN (<foreach item='item' collection='userIdIn' separator=',' >#{item}</foreach>)</if> "
|
+ "<if test='userIdIn != null'>AND UPPER(USER_ID) IN (<foreach item='item' collection='userIdIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
+ "<if test='domainIn != null'>AND UPPER(DOMAIN) IN (<foreach item='item' collection='domainIn' separator=',' >#{item}</foreach>)</if> "
|
+ "<if test='domainIn != null'>AND UPPER(DOMAIN) IN (<foreach item='item' collection='domainIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
+ "<if test='workbasketKeyIn != null'>AND UPPER(WORKBASKET_KEY) IN (<foreach item='item' collection='workbasketKeyIn' separator=',' >#{item}</foreach>)</if> "
|
+ "<if test='workbasketKeyIn != null'>AND UPPER(WORKBASKET_KEY) IN (<foreach item='item' collection='workbasketKeyIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
+ "<if test='porCompanyIn != null'>AND UPPER(POR_COMPANY) IN (<foreach item='item' collection='porCompanyIn' separator=',' >#{item}</foreach>)</if> "
|
+ "<if test='porCompanyIn != null'>AND UPPER(POR_COMPANY) IN (<foreach item='item' collection='porCompanyIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
+ "<if test='porSystemIn != null'>AND UPPER(POR_SYSTEM) IN (<foreach item='item' collection='porSystemIn' separator=',' >#{item}</foreach>)</if> "
|
+ "<if test='porSystemIn != null'>AND UPPER(POR_SYSTEM) IN (<foreach item='item' collection='porSystemIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
+ "<if test='porInstanceIn != null'>AND UPPER(POR_INSTANCE) IN (<foreach item='item' collection='porInstanceIn' separator=',' >#{item}</foreach>)</if> "
|
+ "<if test='porInstanceIn != null'>AND UPPER(POR_INSTANCE) IN (<foreach item='item' collection='porInstanceIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
+ "<if test='porTypeIn != null'>AND UPPER(POR_TYPE) IN (<foreach item='item' collection='porTypeIn' separator=',' >#{item}</foreach>)</if> "
|
+ "<if test='porTypeIn != null'>AND UPPER(POR_TYPE) IN (<foreach item='item' collection='porTypeIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
+ "<if test='porValueIn != null'>AND UPPER(POR_VALUE) IN (<foreach item='item' collection='porValueIn' separator=',' >#{item}</foreach>)</if> "
|
+ "<if test='porValueIn != null'>AND UPPER(POR_VALUE) IN (<foreach item='item' collection='porValueIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
+ "<if test='taskClassificationKeyIn != null'>AND UPPER(TASK_CLASSIFICATION_KEY) IN (<foreach item='item' collection='taskClassificationKeyIn' separator=',' >#{item}</foreach>)</if> "
|
+ "<if test='taskClassificationKeyIn != null'>AND UPPER(TASK_CLASSIFICATION_KEY) IN (<foreach item='item' collection='taskClassificationKeyIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
+ "<if test='taskClassificationCategoryIn != null'>AND UPPER(TASK_CLASSIFICATION_CATEGORY) IN (<foreach item='item' collection='taskClassificationCategoryIn' separator=',' >#{item}</foreach>)</if> "
|
+ "<if test='taskClassificationCategoryIn != null'>AND UPPER(TASK_CLASSIFICATION_CATEGORY) IN (<foreach item='item' collection='taskClassificationCategoryIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
+ "<if test='attachmentClassificationKeyIn != null'>AND UPPER(ATTACHMENT_CLASSIFICATION_KEY) IN (<foreach item='item' collection='attachmentClassificationKeyIn' separator=',' >#{item}</foreach>)</if> "
|
+ "<if test='attachmentClassificationKeyIn != null'>AND UPPER(ATTACHMENT_CLASSIFICATION_KEY) IN (<foreach item='item' collection='attachmentClassificationKeyIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
+ "<if test='commentIn != null'>AND UPPER(COMMENT) IN (<foreach item='item' collection='commentIn' separator=',' >#{item}</foreach>)</if> "
|
+ "<if test='commentIn != null'>AND UPPER(COMMENT) IN (<foreach item='item' collection='commentIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
+ "<if test='oldValueIn != null'>AND UPPER(OLD_VALUE) IN (<foreach item='item' collection='oldValueIn' separator=',' >#{item}</foreach>)</if> "
|
+ "<if test='oldValueIn != null'>AND UPPER(OLD_VALUE) IN (<foreach item='item' collection='oldValueIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
+ "<if test='newValueIn != null'>AND UPPER(NEW_VALUE) IN (<foreach item='item' collection='newValueIn' separator=',' >#{item}</foreach>)</if> "
|
+ "<if test='newValueIn != null'>AND UPPER(NEW_VALUE) IN (<foreach item='item' collection='newValueIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
+ "<if test='custom1In != null'>AND UPPER(CUSTOM_1) IN (<foreach item='item' collection='custom1In' separator=',' >#{item}</foreach>)</if> "
|
+ "<if test='custom1In != null'>AND UPPER(CUSTOM_1) IN (<foreach item='item' collection='custom1In' separator=',' >#{item}</foreach>)</if> "
|
||||||
+ "<if test='custom2In != null'>AND UPPER(CUSTOM_2) IN (<foreach item='item' collection='custom2In' separator=',' >#{item}</foreach>)</if> "
|
+ "<if test='custom2In != null'>AND UPPER(CUSTOM_2) IN (<foreach item='item' collection='custom2In' separator=',' >#{item}</foreach>)</if> "
|
||||||
+ "<if test='custom3In != null'>AND UPPER(CUSTOM_3) IN (<foreach item='item' collection='custom3In' separator=',' >#{item}</foreach>)</if> "
|
+ "<if test='custom3In != null'>AND UPPER(CUSTOM_3) IN (<foreach item='item' collection='custom3In' separator=',' >#{item}</foreach>)</if> "
|
||||||
+ "<if test='custom4In != null'>AND UPPER(CUSTOM_4) IN (<foreach item='item' collection='custom4In' separator=',' >#{item}</foreach>)</if> "
|
+ "<if test='custom4In != null'>AND UPPER(CUSTOM_4) IN (<foreach item='item' collection='custom4In' separator=',' >#{item}</foreach>)</if> "
|
||||||
+ "<if test='oldDataIn != null'>AND UPPER(OLD_DATA) IN (<foreach item='item' collection='oldDataIn' separator=',' >#{item}</foreach>)</if> "
|
+ "<if test='oldDataIn != null'>AND UPPER(OLD_DATA) IN (<foreach item='item' collection='oldDataIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
+ "<if test='newDataIn != null'>AND UPPER(NEW_DATA) IN (<foreach item='item' collection='newDataIn' separator=',' >#{item}</foreach>)</if> "
|
+ "<if test='newDataIn != null'>AND UPPER(NEW_DATA) IN (<foreach item='item' collection='newDataIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
// LIKE-Queries
|
// LIKE-Queries
|
||||||
+ "<if test='businessProcessIdLike != null'>AND (<foreach item='item' collection='businessProcessIdLike' separator='OR' > UPPER(BUSINESS_PROCESS_ID) LIKE #{item} </foreach>)</if> "
|
+ "<if test='businessProcessIdLike != null'>AND (<foreach item='item' collection='businessProcessIdLike' separator='OR' > UPPER(BUSINESS_PROCESS_ID) LIKE #{item} </foreach>)</if> "
|
||||||
+ "<if test='parentBusinessProcessIdLike != null'>AND (<foreach item='item' collection='parentBusinessProcessIdLike' separator=' OR ' >UPPER(PARENT_BUSINESS_PROCESS_ID) LIKE #{item}</foreach>)</if> "
|
+ "<if test='parentBusinessProcessIdLike != null'>AND (<foreach item='item' collection='parentBusinessProcessIdLike' separator=' OR ' >UPPER(PARENT_BUSINESS_PROCESS_ID) LIKE #{item}</foreach>)</if> "
|
||||||
+ "<if test='taskIdLike != null'>AND (<foreach item='item' collection='taskIdLike' separator=' OR ' >UPPER(TASK_ID) LIKE #{item}</foreach>)</if> "
|
+ "<if test='taskIdLike != null'>AND (<foreach item='item' collection='taskIdLike' separator=' OR ' >UPPER(TASK_ID) LIKE #{item}</foreach>)</if> "
|
||||||
+ "<if test='eventTypeLike != null'>AND (<foreach item='item' collection='eventTypeLike' separator=' OR ' >UPPER(EVENT_TYPE) LIKE #{item}</foreach>)</if> "
|
+ "<if test='eventTypeLike != null'>AND (<foreach item='item' collection='eventTypeLike' separator=' OR ' >UPPER(EVENT_TYPE) LIKE #{item}</foreach>)</if> "
|
||||||
+ "<if test='userIdLike != null'>AND (<foreach item='item' collection='userIdLike' separator=' OR ' >UPPER(USER_ID) LIKE #{item}</foreach>)</if> "
|
+ "<if test='userIdLike != null'>AND (<foreach item='item' collection='userIdLike' separator=' OR ' >UPPER(USER_ID) LIKE #{item}</foreach>)</if> "
|
||||||
+ "<if test='domainLike != null'>AND (<foreach item='item' collection='domainLike' separator=' OR ' >UPPER(DOMAIN) LIKE #{item}</foreach>)</if> "
|
+ "<if test='domainLike != null'>AND (<foreach item='item' collection='domainLike' separator=' OR ' >UPPER(DOMAIN) LIKE #{item}</foreach>)</if> "
|
||||||
+ "<if test='workbasketKeyLike != null'>AND (<foreach item='item' collection='workbasketKeyLike' separator=' OR ' >UPPER(WORKBASKET_KEY) LIKE #{item}</foreach>)</if> "
|
+ "<if test='workbasketKeyLike != null'>AND (<foreach item='item' collection='workbasketKeyLike' separator=' OR ' >UPPER(WORKBASKET_KEY) LIKE #{item}</foreach>)</if> "
|
||||||
+ "<if test='porCompanyLike != null'>AND (<foreach item='item' collection='porCompanyLike' separator=' OR ' >UPPER(POR_COMPANY) LIKE #{item}</foreach>)</if> "
|
+ "<if test='porCompanyLike != null'>AND (<foreach item='item' collection='porCompanyLike' separator=' OR ' >UPPER(POR_COMPANY) LIKE #{item}</foreach>)</if> "
|
||||||
+ "<if test='porSystemLike != null'>AND (<foreach item='item' collection='porSystemLike' separator=' OR ' >UPPER(POR_SYSTEM) LIKE #{item}</foreach>)</if> "
|
+ "<if test='porSystemLike != null'>AND (<foreach item='item' collection='porSystemLike' separator=' OR ' >UPPER(POR_SYSTEM) LIKE #{item}</foreach>)</if> "
|
||||||
+ "<if test='porInstanceLike != null'>AND (<foreach item='item' collection='porInstanceLike' separator=' OR ' >UPPER(POR_INSTANCE) LIKE #{item}</foreach>)</if> "
|
+ "<if test='porInstanceLike != null'>AND (<foreach item='item' collection='porInstanceLike' separator=' OR ' >UPPER(POR_INSTANCE) LIKE #{item}</foreach>)</if> "
|
||||||
+ "<if test='porTypeLike != null'>AND (<foreach item='item' collection='porTypeLike' separator=' OR ' >UPPER(POR_TYPE) LIKE #{item}</foreach>)</if> "
|
+ "<if test='porTypeLike != null'>AND (<foreach item='item' collection='porTypeLike' separator=' OR ' >UPPER(POR_TYPE) LIKE #{item}</foreach>)</if> "
|
||||||
+ "<if test='porValueLike != null'>AND (<foreach item='item' collection='porValueLike' separator=' OR ' >UPPER(POR_VALUE) LIKE #{item}</foreach>)</if> "
|
+ "<if test='porValueLike != null'>AND (<foreach item='item' collection='porValueLike' separator=' OR ' >UPPER(POR_VALUE) LIKE #{item}</foreach>)</if> "
|
||||||
+ "<if test='taskClassificationKeyLike != null'>AND (<foreach item='item' collection='taskClassificationKeyLike' separator=' OR ' >UPPER(TASK_CLASSIFICATION_KEY) LIKE #{item}</foreach>)</if> "
|
+ "<if test='taskClassificationKeyLike != null'>AND (<foreach item='item' collection='taskClassificationKeyLike' separator=' OR ' >UPPER(TASK_CLASSIFICATION_KEY) LIKE #{item}</foreach>)</if> "
|
||||||
+ "<if test='taskClassificationCategoryLike != null'>AND (<foreach item='item' collection='taskClassificationCategoryLike' separator=' OR ' >UPPER(TASK_CLASSIFICATION_CATEGORY) LIKE #{item}</foreach>)</if> "
|
+ "<if test='taskClassificationCategoryLike != null'>AND (<foreach item='item' collection='taskClassificationCategoryLike' separator=' OR ' >UPPER(TASK_CLASSIFICATION_CATEGORY) LIKE #{item}</foreach>)</if> "
|
||||||
+ "<if test='attachmentClassificationKeyLike != null'>AND (<foreach item='item' collection='attachmentClassificationKeyLike' separator=' OR ' >UPPER(ATTACHMENT_CLASSIFICATION_KEY) LIKE #{item}</foreach>)</if> "
|
+ "<if test='attachmentClassificationKeyLike != null'>AND (<foreach item='item' collection='attachmentClassificationKeyLike' separator=' OR ' >UPPER(ATTACHMENT_CLASSIFICATION_KEY) LIKE #{item}</foreach>)</if> "
|
||||||
+ "<if test='commentLike != null'>AND (<foreach item='item' collection='commentLike' separator=' OR ' >UPPER(COMMENT) LIKE #{item}</foreach>)</if> "
|
+ "<if test='commentLike != null'>AND (<foreach item='item' collection='commentLike' separator=' OR ' >UPPER(COMMENT) LIKE #{item}</foreach>)</if> "
|
||||||
+ "<if test='oldValueLike != null'>AND (<foreach item='item' collection='oldValueLike' separator=' OR ' >UPPER(OLD_VALUE) LIKE #{item}</foreach>)</if> "
|
+ "<if test='oldValueLike != null'>AND (<foreach item='item' collection='oldValueLike' separator=' OR ' >UPPER(OLD_VALUE) LIKE #{item}</foreach>)</if> "
|
||||||
+ "<if test='newValueLike != null'>AND (<foreach item='item' collection='newValueLike' separator=' OR ' >UPPER(NEW_VALUE) LIKE #{item}</foreach>)</if> "
|
+ "<if test='newValueLike != null'>AND (<foreach item='item' collection='newValueLike' separator=' OR ' >UPPER(NEW_VALUE) LIKE #{item}</foreach>)</if> "
|
||||||
+ "<if test='custom1Like != null'>AND (<foreach item='item' collection='custom1Like' separator=' OR ' >UPPER(CUSTOM_1) LIKE #{item}</foreach>)</if> "
|
+ "<if test='custom1Like != null'>AND (<foreach item='item' collection='custom1Like' separator=' OR ' >UPPER(CUSTOM_1) LIKE #{item}</foreach>)</if> "
|
||||||
+ "<if test='custom2Like != null'>AND (<foreach item='item' collection='custom2Like' separator=' OR ' >UPPER(CUSTOM_2) LIKE #{item}</foreach>)</if> "
|
+ "<if test='custom2Like != null'>AND (<foreach item='item' collection='custom2Like' separator=' OR ' >UPPER(CUSTOM_2) LIKE #{item}</foreach>)</if> "
|
||||||
+ "<if test='custom3Like != null'>AND (<foreach item='item' collection='custom3Like' separator=' OR ' >UPPER(CUSTOM_3) LIKE #{item}</foreach>)</if> "
|
+ "<if test='custom3Like != null'>AND (<foreach item='item' collection='custom3Like' separator=' OR ' >UPPER(CUSTOM_3) LIKE #{item}</foreach>)</if> "
|
||||||
+ "<if test='custom4Like != null'>AND (<foreach item='item' collection='custom4Like' separator=' OR ' >UPPER(CUSTOM_4) LIKE #{item}</foreach>)</if> "
|
+ "<if test='custom4Like != null'>AND (<foreach item='item' collection='custom4Like' separator=' OR ' >UPPER(CUSTOM_4) LIKE #{item}</foreach>)</if> "
|
||||||
+ "<if test='oldDataLike != null'>AND (<foreach item='item' collection='oldDataLike' separator=' OR ' >UPPER(OLD_DATA) LIKE #{item}</foreach>)</if> "
|
+ "<if test='oldDataLike != null'>AND (<foreach item='item' collection='oldDataLike' separator=' OR ' >UPPER(OLD_DATA) LIKE #{item}</foreach>)</if> "
|
||||||
+ "<if test='newDataLike != null'>AND (<foreach item='item' collection='newDataLike' separator=' OR ' >UPPER(NEW_DATA) LIKE #{item}</foreach>)</if> "
|
+ "<if test='newDataLike != null'>AND (<foreach item='item' collection='newDataLike' separator=' OR ' >UPPER(NEW_DATA) LIKE #{item}</foreach>)</if> "
|
||||||
+ "</where>"
|
+ "</where>"
|
||||||
+ "<if test='!orderBy.isEmpty()'>ORDER BY <foreach item='item' collection='orderBy' separator=',' >${item}</foreach></if> "
|
+ "<if test='!orderBy.isEmpty()'>ORDER BY <foreach item='item' collection='orderBy' separator=',' >${item}</foreach></if> "
|
||||||
+ "<if test='maxRows > 0'> FETCH FIRST #{maxRows} ROWS ONLY </if>"
|
+ "<if test='maxRows > 0'> FETCH FIRST #{maxRows} ROWS ONLY </if>"
|
||||||
+ "</script>")
|
+ "</script>")
|
||||||
@Results(value = {
|
@Results(
|
||||||
@Result(property = "id", column = "ID"),
|
value = {
|
||||||
@Result(property = "businessProcessId", column = "BUSINESS_PROCESS_ID"),
|
@Result(property = "id", column = "ID"),
|
||||||
@Result(property = "parentBusinessProcessId", column = "PARENT_BUSINESS_PROCESS_ID"),
|
@Result(property = "businessProcessId", column = "BUSINESS_PROCESS_ID"),
|
||||||
@Result(property = "taskId", column = "TASK_ID"),
|
@Result(property = "parentBusinessProcessId", column = "PARENT_BUSINESS_PROCESS_ID"),
|
||||||
@Result(property = "eventType", column = "EVENT_TYPE"),
|
@Result(property = "taskId", column = "TASK_ID"),
|
||||||
@Result(property = "created", column = "CREATED"),
|
@Result(property = "eventType", column = "EVENT_TYPE"),
|
||||||
@Result(property = "userId", column = "USER_ID"),
|
@Result(property = "created", column = "CREATED"),
|
||||||
@Result(property = "domain", column = "DOMAIN"),
|
@Result(property = "userId", column = "USER_ID"),
|
||||||
@Result(property = "workbasketKey", column = "WORKBASKET_KEY"),
|
@Result(property = "domain", column = "DOMAIN"),
|
||||||
@Result(property = "porCompany", column = "POR_COMPANY"),
|
@Result(property = "workbasketKey", column = "WORKBASKET_KEY"),
|
||||||
@Result(property = "porSystem", column = "POR_SYSTEM"),
|
@Result(property = "porCompany", column = "POR_COMPANY"),
|
||||||
@Result(property = "porInstance", column = "POR_INSTANCE"),
|
@Result(property = "porSystem", column = "POR_SYSTEM"),
|
||||||
@Result(property = "porType", column = "POR_TYPE"),
|
@Result(property = "porInstance", column = "POR_INSTANCE"),
|
||||||
@Result(property = "porValue", column = "POR_VALUE"),
|
@Result(property = "porType", column = "POR_TYPE"),
|
||||||
@Result(property = "taskClassificationKey", column = "TASK_CLASSIFICATION_KEY"),
|
@Result(property = "porValue", column = "POR_VALUE"),
|
||||||
@Result(property = "taskClassificationCategory", column = "TASK_CLASSIFICATION_CATEGORY"),
|
@Result(property = "taskClassificationKey", column = "TASK_CLASSIFICATION_KEY"),
|
||||||
@Result(property = "attachmentClassificationKey", column = "ATTACHMENT_CLASSIFICATION_KEY"),
|
@Result(property = "taskClassificationCategory", column = "TASK_CLASSIFICATION_CATEGORY"),
|
||||||
@Result(property = "comment", column = "COMMENT"),
|
@Result(property = "attachmentClassificationKey", column = "ATTACHMENT_CLASSIFICATION_KEY"),
|
||||||
@Result(property = "oldValue", column = "OLD_VALUE"),
|
@Result(property = "comment", column = "COMMENT"),
|
||||||
@Result(property = "newValue", column = "NEW_VALUE"),
|
@Result(property = "oldValue", column = "OLD_VALUE"),
|
||||||
@Result(property = "custom1", column = "CUSTOM_1"),
|
@Result(property = "newValue", column = "NEW_VALUE"),
|
||||||
@Result(property = "custom2", column = "CUSTOM_2"),
|
@Result(property = "custom1", column = "CUSTOM_1"),
|
||||||
@Result(property = "custom3", column = "CUSTOM_3"),
|
@Result(property = "custom2", column = "CUSTOM_2"),
|
||||||
@Result(property = "custom4", column = "CUSTOM_4"),
|
@Result(property = "custom3", column = "CUSTOM_3"),
|
||||||
@Result(property = "oldData", column = "OLD_DATA"),
|
@Result(property = "custom4", column = "CUSTOM_4"),
|
||||||
@Result(property = "newData", column = "NEW_DATA")
|
@Result(property = "oldData", column = "OLD_DATA"),
|
||||||
})
|
@Result(property = "newData", column = "NEW_DATA")
|
||||||
List<HistoryEventImpl> queryHistoryEvent(HistoryQueryImpl historyEventQuery);
|
})
|
||||||
|
List<HistoryEventImpl> queryHistoryEvent(HistoryQueryImpl historyEventQuery);
|
||||||
|
|
||||||
@Select(
|
@Select(
|
||||||
"<script>"
|
"<script>"
|
||||||
+ "SELECT COUNT(ID) "
|
+ "SELECT COUNT(ID) "
|
||||||
+ "FROM HISTORY_EVENTS"
|
+ "FROM HISTORY_EVENTS"
|
||||||
+ "<where>"
|
+ "<where>"
|
||||||
// IN-Queries
|
// IN-Queries
|
||||||
+ "<if test='businessProcessIdIn != null'>AND UPPER(BUSINESS_PROCESS_ID) IN (<foreach item='item' collection='businessProcessIdIn' separator=',' >#{item}</foreach>)</if> "
|
+ "<if test='businessProcessIdIn != null'>AND UPPER(BUSINESS_PROCESS_ID) IN (<foreach item='item' collection='businessProcessIdIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
+ "<if test='parentBusinessProcessIdIn != null'>AND UPPER(PARENT_BUSINESS_PROCESS_ID) IN (<foreach item='item' collection='parentBusinessProcessIdIn' separator=',' >#{item}</foreach>)</if> "
|
+ "<if test='parentBusinessProcessIdIn != null'>AND UPPER(PARENT_BUSINESS_PROCESS_ID) IN (<foreach item='item' collection='parentBusinessProcessIdIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
+ "<if test='taskIdIn != null'>AND UPPER(TASK_ID) IN (<foreach item='item' collection='taskIdIn' separator=',' >#{item}</foreach>)</if> "
|
+ "<if test='taskIdIn != null'>AND UPPER(TASK_ID) IN (<foreach item='item' collection='taskIdIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
+ "<if test='eventTypeIn != null'>AND UPPER(EVENT_TYPE) IN (<foreach item='item' collection='eventTypeIn' separator=',' >#{item}</foreach>)</if> "
|
+ "<if test='eventTypeIn != null'>AND UPPER(EVENT_TYPE) IN (<foreach item='item' collection='eventTypeIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
+ "<if test='createdIn !=null'> AND ( <foreach item='item' collection='createdIn' separator=',' > ( <if test='item.begin!=null'> CREATED >= #{item.begin} </if> <if test='item.begin!=null and item.end!=null'> AND </if><if test='item.end!=null'> CREATED <=#{item.end} </if>)</foreach>)</if> "
|
+ "<if test='createdIn !=null'> AND ( <foreach item='item' collection='createdIn' separator=',' > ( <if test='item.begin!=null'> CREATED >= #{item.begin} </if> <if test='item.begin!=null and item.end!=null'> AND </if><if test='item.end!=null'> CREATED <=#{item.end} </if>)</foreach>)</if> "
|
||||||
+ "<if test='userIdIn != null'>AND UPPER(USER_ID) IN (<foreach item='item' collection='userIdIn' separator=',' >#{item}</foreach>)</if> "
|
+ "<if test='userIdIn != null'>AND UPPER(USER_ID) IN (<foreach item='item' collection='userIdIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
+ "<if test='domainIn != null'>AND UPPER(DOMAIN) IN (<foreach item='item' collection='domainIn' separator=',' >#{item}</foreach>)</if> "
|
+ "<if test='domainIn != null'>AND UPPER(DOMAIN) IN (<foreach item='item' collection='domainIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
+ "<if test='workbasketKeyIn != null'>AND UPPER(WORKBASKET_KEY) IN (<foreach item='item' collection='workbasketKeyIn' separator=',' >#{item}</foreach>)</if> "
|
+ "<if test='workbasketKeyIn != null'>AND UPPER(WORKBASKET_KEY) IN (<foreach item='item' collection='workbasketKeyIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
+ "<if test='porCompanyIn != null'>AND UPPER(POR_COMPANY) IN (<foreach item='item' collection='porCompanyIn' separator=',' >#{item}</foreach>)</if> "
|
+ "<if test='porCompanyIn != null'>AND UPPER(POR_COMPANY) IN (<foreach item='item' collection='porCompanyIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
+ "<if test='porSystemIn != null'>AND UPPER(POR_SYSTEM) IN (<foreach item='item' collection='porSystemIn' separator=',' >#{item}</foreach>)</if> "
|
+ "<if test='porSystemIn != null'>AND UPPER(POR_SYSTEM) IN (<foreach item='item' collection='porSystemIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
+ "<if test='porInstanceIn != null'>AND UPPER(POR_INSTANCE) IN (<foreach item='item' collection='porInstanceIn' separator=',' >#{item}</foreach>)</if> "
|
+ "<if test='porInstanceIn != null'>AND UPPER(POR_INSTANCE) IN (<foreach item='item' collection='porInstanceIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
+ "<if test='porTypeIn != null'>AND UPPER(POR_TYPE) IN (<foreach item='item' collection='porTypeIn' separator=',' >#{item}</foreach>)</if> "
|
+ "<if test='porTypeIn != null'>AND UPPER(POR_TYPE) IN (<foreach item='item' collection='porTypeIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
+ "<if test='porValueIn != null'>AND UPPER(POR_VALUE) IN (<foreach item='item' collection='porValueIn' separator=',' >#{item}</foreach>)</if> "
|
+ "<if test='porValueIn != null'>AND UPPER(POR_VALUE) IN (<foreach item='item' collection='porValueIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
+ "<if test='taskClassificationKeyIn != null'>AND UPPER(TASK_CLASSIFICATION_KEY) IN (<foreach item='item' collection='taskClassificationKeyIn' separator=',' >#{item}</foreach>)</if> "
|
+ "<if test='taskClassificationKeyIn != null'>AND UPPER(TASK_CLASSIFICATION_KEY) IN (<foreach item='item' collection='taskClassificationKeyIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
+ "<if test='taskClassificationCategoryIn != null'>AND UPPER(TASK_CLASSIFICATION_CATEGORY) IN (<foreach item='item' collection='taskClassificationCategoryIn' separator=',' >#{item}</foreach>)</if> "
|
+ "<if test='taskClassificationCategoryIn != null'>AND UPPER(TASK_CLASSIFICATION_CATEGORY) IN (<foreach item='item' collection='taskClassificationCategoryIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
+ "<if test='attachmentClassificationKeyIn != null'>AND UPPER(ATTACHMENT_CLASSIFICATION_KEY) IN (<foreach item='item' collection='attachmentClassificationKeyIn' separator=',' >#{item}</foreach>)</if> "
|
+ "<if test='attachmentClassificationKeyIn != null'>AND UPPER(ATTACHMENT_CLASSIFICATION_KEY) IN (<foreach item='item' collection='attachmentClassificationKeyIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
+ "<if test='commentIn != null'>AND UPPER(COMMENT) IN (<foreach item='item' collection='commentIn' separator=',' >#{item}</foreach>)</if> "
|
+ "<if test='commentIn != null'>AND UPPER(COMMENT) IN (<foreach item='item' collection='commentIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
+ "<if test='oldValueIn != null'>AND UPPER(OLD_VALUE) IN (<foreach item='item' collection='oldValueIn' separator=',' >#{item}</foreach>)</if> "
|
+ "<if test='oldValueIn != null'>AND UPPER(OLD_VALUE) IN (<foreach item='item' collection='oldValueIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
+ "<if test='newValueIn != null'>AND UPPER(NEW_VALUE) IN (<foreach item='item' collection='newValueIn' separator=',' >#{item}</foreach>)</if> "
|
+ "<if test='newValueIn != null'>AND UPPER(NEW_VALUE) IN (<foreach item='item' collection='newValueIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
+ "<if test='custom1In != null'>AND UPPER(CUSTOM_1) IN (<foreach item='item' collection='custom1In' separator=',' >#{item}</foreach>)</if> "
|
+ "<if test='custom1In != null'>AND UPPER(CUSTOM_1) IN (<foreach item='item' collection='custom1In' separator=',' >#{item}</foreach>)</if> "
|
||||||
+ "<if test='custom2In != null'>AND UPPER(CUSTOM_2) IN (<foreach item='item' collection='custom2In' separator=',' >#{item}</foreach>)</if> "
|
+ "<if test='custom2In != null'>AND UPPER(CUSTOM_2) IN (<foreach item='item' collection='custom2In' separator=',' >#{item}</foreach>)</if> "
|
||||||
+ "<if test='custom3In != null'>AND UPPER(CUSTOM_3) IN (<foreach item='item' collection='custom3In' separator=',' >#{item}</foreach>)</if> "
|
+ "<if test='custom3In != null'>AND UPPER(CUSTOM_3) IN (<foreach item='item' collection='custom3In' separator=',' >#{item}</foreach>)</if> "
|
||||||
+ "<if test='custom4In != null'>AND UPPER(CUSTOM_4) IN (<foreach item='item' collection='custom4In' separator=',' >#{item}</foreach>)</if> "
|
+ "<if test='custom4In != null'>AND UPPER(CUSTOM_4) IN (<foreach item='item' collection='custom4In' separator=',' >#{item}</foreach>)</if> "
|
||||||
+ "<if test='oldDataIn != null'>AND UPPER(OLD_DATA) IN (<foreach item='item' collection='oldDataIn' separator=',' >#{item}</foreach>)</if> "
|
+ "<if test='oldDataIn != null'>AND UPPER(OLD_DATA) IN (<foreach item='item' collection='oldDataIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
+ "<if test='newDataIn != null'>AND UPPER(NEW_DATA) IN (<foreach item='item' collection='newDataIn' separator=',' >#{item}</foreach>)</if> "
|
+ "<if test='newDataIn != null'>AND UPPER(NEW_DATA) IN (<foreach item='item' collection='newDataIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
// LIKE-Queries
|
// LIKE-Queries
|
||||||
+ "<if test='businessProcessIdLike != null'>AND (<foreach item='item' collection='businessProcessIdLike' separator='OR' > UPPER(BUSINESS_PROCESS_ID) LIKE #{item} </foreach>)</if> "
|
+ "<if test='businessProcessIdLike != null'>AND (<foreach item='item' collection='businessProcessIdLike' separator='OR' > UPPER(BUSINESS_PROCESS_ID) LIKE #{item} </foreach>)</if> "
|
||||||
+ "<if test='parentBusinessProcessIdLike != null'>AND (<foreach item='item' collection='parentBusinessProcessIdLike' separator=' OR ' >UPPER(PARENT_BUSINESS_PROCESS_ID) LIKE #{item}</foreach>)</if> "
|
+ "<if test='parentBusinessProcessIdLike != null'>AND (<foreach item='item' collection='parentBusinessProcessIdLike' separator=' OR ' >UPPER(PARENT_BUSINESS_PROCESS_ID) LIKE #{item}</foreach>)</if> "
|
||||||
+ "<if test='taskIdLike != null'>AND (<foreach item='item' collection='taskIdLike' separator=' OR ' >UPPER(TASK_ID) LIKE #{item}</foreach>)</if> "
|
+ "<if test='taskIdLike != null'>AND (<foreach item='item' collection='taskIdLike' separator=' OR ' >UPPER(TASK_ID) LIKE #{item}</foreach>)</if> "
|
||||||
+ "<if test='eventTypeLike != null'>AND (<foreach item='item' collection='eventTypeLike' separator=' OR ' >UPPER(EVENT_TYPE) LIKE #{item}</foreach>)</if> "
|
+ "<if test='eventTypeLike != null'>AND (<foreach item='item' collection='eventTypeLike' separator=' OR ' >UPPER(EVENT_TYPE) LIKE #{item}</foreach>)</if> "
|
||||||
+ "<if test='userIdLike != null'>AND (<foreach item='item' collection='userIdLike' separator=' OR ' >UPPER(USER_ID) LIKE #{item}</foreach>)</if> "
|
+ "<if test='userIdLike != null'>AND (<foreach item='item' collection='userIdLike' separator=' OR ' >UPPER(USER_ID) LIKE #{item}</foreach>)</if> "
|
||||||
+ "<if test='domainLike != null'>AND (<foreach item='item' collection='domainLike' separator=' OR ' >UPPER(DOMAIN) LIKE #{item}</foreach>)</if> "
|
+ "<if test='domainLike != null'>AND (<foreach item='item' collection='domainLike' separator=' OR ' >UPPER(DOMAIN) LIKE #{item}</foreach>)</if> "
|
||||||
+ "<if test='workbasketKeyLike != null'>AND (<foreach item='item' collection='workbasketKeyLike' separator=' OR ' >UPPER(WORKBASKET_KEY) LIKE #{item}</foreach>)</if> "
|
+ "<if test='workbasketKeyLike != null'>AND (<foreach item='item' collection='workbasketKeyLike' separator=' OR ' >UPPER(WORKBASKET_KEY) LIKE #{item}</foreach>)</if> "
|
||||||
+ "<if test='porCompanyLike != null'>AND (<foreach item='item' collection='porCompanyLike' separator=' OR ' >UPPER(POR_COMPANY) LIKE #{item}</foreach>)</if> "
|
+ "<if test='porCompanyLike != null'>AND (<foreach item='item' collection='porCompanyLike' separator=' OR ' >UPPER(POR_COMPANY) LIKE #{item}</foreach>)</if> "
|
||||||
+ "<if test='porSystemLike != null'>AND (<foreach item='item' collection='porSystemLike' separator=' OR ' >UPPER(POR_SYSTEM) LIKE #{item}</foreach>)</if> "
|
+ "<if test='porSystemLike != null'>AND (<foreach item='item' collection='porSystemLike' separator=' OR ' >UPPER(POR_SYSTEM) LIKE #{item}</foreach>)</if> "
|
||||||
+ "<if test='porInstanceLike != null'>AND (<foreach item='item' collection='porInstanceLike' separator=' OR ' >UPPER(POR_INSTANCE) LIKE #{item}</foreach>)</if> "
|
+ "<if test='porInstanceLike != null'>AND (<foreach item='item' collection='porInstanceLike' separator=' OR ' >UPPER(POR_INSTANCE) LIKE #{item}</foreach>)</if> "
|
||||||
+ "<if test='porTypeLike != null'>AND (<foreach item='item' collection='porTypeLike' separator=' OR ' >UPPER(POR_TYPE) LIKE #{item}</foreach>)</if> "
|
+ "<if test='porTypeLike != null'>AND (<foreach item='item' collection='porTypeLike' separator=' OR ' >UPPER(POR_TYPE) LIKE #{item}</foreach>)</if> "
|
||||||
+ "<if test='porValueLike != null'>AND (<foreach item='item' collection='porValueLike' separator=' OR ' >UPPER(POR_VALUE) LIKE #{item}</foreach>)</if> "
|
+ "<if test='porValueLike != null'>AND (<foreach item='item' collection='porValueLike' separator=' OR ' >UPPER(POR_VALUE) LIKE #{item}</foreach>)</if> "
|
||||||
+ "<if test='taskClassificationKeyLike != null'>AND (<foreach item='item' collection='taskClassificationKeyLike' separator=' OR ' >UPPER(TASK_CLASSIFICATION_KEY) LIKE #{item}</foreach>)</if> "
|
+ "<if test='taskClassificationKeyLike != null'>AND (<foreach item='item' collection='taskClassificationKeyLike' separator=' OR ' >UPPER(TASK_CLASSIFICATION_KEY) LIKE #{item}</foreach>)</if> "
|
||||||
+ "<if test='taskClassificationCategoryLike != null'>AND (<foreach item='item' collection='taskClassificationCategoryLike' separator=' OR ' >UPPER(TASK_CLASSIFICATION_CATEGORY) LIKE #{item}</foreach>)</if> "
|
+ "<if test='taskClassificationCategoryLike != null'>AND (<foreach item='item' collection='taskClassificationCategoryLike' separator=' OR ' >UPPER(TASK_CLASSIFICATION_CATEGORY) LIKE #{item}</foreach>)</if> "
|
||||||
+ "<if test='attachmentClassificationKeyLike != null'>AND (<foreach item='item' collection='attachmentClassificationKeyLike' separator=' OR ' >UPPER(ATTACHMENT_CLASSIFICATION_KEY) LIKE #{item}</foreach>)</if> "
|
+ "<if test='attachmentClassificationKeyLike != null'>AND (<foreach item='item' collection='attachmentClassificationKeyLike' separator=' OR ' >UPPER(ATTACHMENT_CLASSIFICATION_KEY) LIKE #{item}</foreach>)</if> "
|
||||||
+ "<if test='commentLike != null'>AND (<foreach item='item' collection='commentLike' separator=' OR ' >UPPER(COMMENT) LIKE #{item}</foreach>)</if> "
|
+ "<if test='commentLike != null'>AND (<foreach item='item' collection='commentLike' separator=' OR ' >UPPER(COMMENT) LIKE #{item}</foreach>)</if> "
|
||||||
+ "<if test='oldValueLike != null'>AND (<foreach item='item' collection='oldValueLike' separator=' OR ' >UPPER(OLD_VALUE) LIKE #{item}</foreach>)</if> "
|
+ "<if test='oldValueLike != null'>AND (<foreach item='item' collection='oldValueLike' separator=' OR ' >UPPER(OLD_VALUE) LIKE #{item}</foreach>)</if> "
|
||||||
+ "<if test='newValueLike != null'>AND (<foreach item='item' collection='newValueLike' separator=' OR ' >UPPER(NEW_VALUE) LIKE #{item}</foreach>)</if> "
|
+ "<if test='newValueLike != null'>AND (<foreach item='item' collection='newValueLike' separator=' OR ' >UPPER(NEW_VALUE) LIKE #{item}</foreach>)</if> "
|
||||||
+ "<if test='custom1Like != null'>AND (<foreach item='item' collection='custom1Like' separator=' OR ' >UPPER(CUSTOM_1) LIKE #{item}</foreach>)</if> "
|
+ "<if test='custom1Like != null'>AND (<foreach item='item' collection='custom1Like' separator=' OR ' >UPPER(CUSTOM_1) LIKE #{item}</foreach>)</if> "
|
||||||
+ "<if test='custom2Like != null'>AND (<foreach item='item' collection='custom2Like' separator=' OR ' >UPPER(CUSTOM_2) LIKE #{item}</foreach>)</if> "
|
+ "<if test='custom2Like != null'>AND (<foreach item='item' collection='custom2Like' separator=' OR ' >UPPER(CUSTOM_2) LIKE #{item}</foreach>)</if> "
|
||||||
+ "<if test='custom3Like != null'>AND (<foreach item='item' collection='custom3Like' separator=' OR ' >UPPER(CUSTOM_3) LIKE #{item}</foreach>)</if> "
|
+ "<if test='custom3Like != null'>AND (<foreach item='item' collection='custom3Like' separator=' OR ' >UPPER(CUSTOM_3) LIKE #{item}</foreach>)</if> "
|
||||||
+ "<if test='custom4Like != null'>AND (<foreach item='item' collection='custom4Like' separator=' OR ' >UPPER(CUSTOM_4) LIKE #{item}</foreach>)</if> "
|
+ "<if test='custom4Like != null'>AND (<foreach item='item' collection='custom4Like' separator=' OR ' >UPPER(CUSTOM_4) LIKE #{item}</foreach>)</if> "
|
||||||
+ "<if test='oldDataLike != null'>AND (<foreach item='item' collection='oldDataLike' separator=' OR ' >UPPER(OLD_DATA) LIKE #{item}</foreach>)</if> "
|
+ "<if test='oldDataLike != null'>AND (<foreach item='item' collection='oldDataLike' separator=' OR ' >UPPER(OLD_DATA) LIKE #{item}</foreach>)</if> "
|
||||||
+ "<if test='newDataLike != null'>AND (<foreach item='item' collection='newDataLike' separator=' OR ' >UPPER(NEW_DATA) LIKE #{item}</foreach>)</if> "
|
+ "<if test='newDataLike != null'>AND (<foreach item='item' collection='newDataLike' separator=' OR ' >UPPER(NEW_DATA) LIKE #{item}</foreach>)</if> "
|
||||||
+ "</where>"
|
+ "</where>"
|
||||||
+ "</script>")
|
+ "</script>")
|
||||||
long countHistoryEvent(HistoryQueryImpl historyEventQuery);
|
long countHistoryEvent(HistoryQueryImpl historyEventQuery);
|
||||||
|
|
||||||
@Select("<script>SELECT DISTINCT ${columnName} "
|
@Select(
|
||||||
+ "FROM HISTORY_EVENTS"
|
"<script>SELECT DISTINCT ${columnName} "
|
||||||
+ "<where>"
|
+ "FROM HISTORY_EVENTS"
|
||||||
// IN-Queries
|
+ "<where>"
|
||||||
+ "<if test='idIn != null'>AND UPPER(ID) IN (<foreach item='item' collection='idIn' separator=',' >#{item}</foreach>)</if> "
|
// IN-Queries
|
||||||
+ "<if test='businessProcessIdIn != null'>AND UPPER(BUSINESS_PROCESS_ID) IN (<foreach item='item' collection='businessProcessIdIn' separator=',' >#{item}</foreach>)</if> "
|
+ "<if test='idIn != null'>AND UPPER(ID) IN (<foreach item='item' collection='idIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
+ "<if test='parentBusinessProcessIdIn != null'>AND UPPER(PARENT_BUSINESS_PROCESS_ID) IN (<foreach item='item' collection='parentBusinessProcessIdIn' separator=',' >#{item}</foreach>)</if> "
|
+ "<if test='businessProcessIdIn != null'>AND UPPER(BUSINESS_PROCESS_ID) IN (<foreach item='item' collection='businessProcessIdIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
+ "<if test='taskIdIn != null'>AND UPPER(TASK_ID) IN (<foreach item='item' collection='taskIdIn' separator=',' >#{item}</foreach>)</if> "
|
+ "<if test='parentBusinessProcessIdIn != null'>AND UPPER(PARENT_BUSINESS_PROCESS_ID) IN (<foreach item='item' collection='parentBusinessProcessIdIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
+ "<if test='eventTypeIn != null'>AND UPPER(EVENT_TYPE) IN (<foreach item='item' collection='eventTypeIn' separator=',' >#{item}</foreach>)</if> "
|
+ "<if test='taskIdIn != null'>AND UPPER(TASK_ID) IN (<foreach item='item' collection='taskIdIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
+ "<if test='createdIn !=null'> AND ( <foreach item='item' collection='createdIn' separator=',' > ( <if test='item.begin!=null'> CREATED >= #{item.begin} </if> <if test='item.begin!=null and item.end!=null'> AND </if><if test='item.end!=null'> CREATED <=#{item.end} </if>)</foreach>)</if> "
|
+ "<if test='eventTypeIn != null'>AND UPPER(EVENT_TYPE) IN (<foreach item='item' collection='eventTypeIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
+ "<if test='userIdIn != null'>AND UPPER(USER_ID) IN (<foreach item='item' collection='userIdIn' separator=',' >#{item}</foreach>)</if> "
|
+ "<if test='createdIn !=null'> AND ( <foreach item='item' collection='createdIn' separator=',' > ( <if test='item.begin!=null'> CREATED >= #{item.begin} </if> <if test='item.begin!=null and item.end!=null'> AND </if><if test='item.end!=null'> CREATED <=#{item.end} </if>)</foreach>)</if> "
|
||||||
+ "<if test='domainIn != null'>AND UPPER(DOMAIN) IN (<foreach item='item' collection='domainIn' separator=',' >#{item}</foreach>)</if> "
|
+ "<if test='userIdIn != null'>AND UPPER(USER_ID) IN (<foreach item='item' collection='userIdIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
+ "<if test='workbasketKeyIn != null'>AND UPPER(WORKBASKET_KEY) IN (<foreach item='item' collection='workbasketKeyIn' separator=',' >#{item}</foreach>)</if> "
|
+ "<if test='domainIn != null'>AND UPPER(DOMAIN) IN (<foreach item='item' collection='domainIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
+ "<if test='porCompanyIn != null'>AND UPPER(POR_COMPANY) IN (<foreach item='item' collection='porCompanyIn' separator=',' >#{item}</foreach>)</if> "
|
+ "<if test='workbasketKeyIn != null'>AND UPPER(WORKBASKET_KEY) IN (<foreach item='item' collection='workbasketKeyIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
+ "<if test='porSystemIn != null'>AND UPPER(POR_SYSTEM) IN (<foreach item='item' collection='porSystemIn' separator=',' >#{item}</foreach>)</if> "
|
+ "<if test='porCompanyIn != null'>AND UPPER(POR_COMPANY) IN (<foreach item='item' collection='porCompanyIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
+ "<if test='porInstanceIn != null'>AND UPPER(POR_INSTANCE) IN (<foreach item='item' collection='porInstanceIn' separator=',' >#{item}</foreach>)</if> "
|
+ "<if test='porSystemIn != null'>AND UPPER(POR_SYSTEM) IN (<foreach item='item' collection='porSystemIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
+ "<if test='porTypeIn != null'>AND UPPER(POR_TYPE) IN (<foreach item='item' collection='porTypeIn' separator=',' >#{item}</foreach>)</if> "
|
+ "<if test='porInstanceIn != null'>AND UPPER(POR_INSTANCE) IN (<foreach item='item' collection='porInstanceIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
+ "<if test='porValueIn != null'>AND UPPER(POR_VALUE) IN (<foreach item='item' collection='porValueIn' separator=',' >#{item}</foreach>)</if> "
|
+ "<if test='porTypeIn != null'>AND UPPER(POR_TYPE) IN (<foreach item='item' collection='porTypeIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
+ "<if test='taskClassificationKeyIn != null'>AND UPPER(TASK_CLASSIFICATION_KEY) IN (<foreach item='item' collection='taskClassificationKeyIn' separator=',' >#{item}</foreach>)</if> "
|
+ "<if test='porValueIn != null'>AND UPPER(POR_VALUE) IN (<foreach item='item' collection='porValueIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
+ "<if test='taskClassificationCategoryIn != null'>AND UPPER(TASK_CLASSIFICATION_CATEGORY) IN (<foreach item='item' collection='taskClassificationCategoryIn' separator=',' >#{item}</foreach>)</if> "
|
+ "<if test='taskClassificationKeyIn != null'>AND UPPER(TASK_CLASSIFICATION_KEY) IN (<foreach item='item' collection='taskClassificationKeyIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
+ "<if test='attachmentClassificationKeyIn != null'>AND UPPER(ATTACHMENT_CLASSIFICATION_KEY) IN (<foreach item='item' collection='attachmentClassificationKeyIn' separator=',' >#{item}</foreach>)</if> "
|
+ "<if test='taskClassificationCategoryIn != null'>AND UPPER(TASK_CLASSIFICATION_CATEGORY) IN (<foreach item='item' collection='taskClassificationCategoryIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
+ "<if test='commentIn != null'>AND UPPER(COMMENT) IN (<foreach item='item' collection='commentIn' separator=',' >#{item}</foreach>)</if> "
|
+ "<if test='attachmentClassificationKeyIn != null'>AND UPPER(ATTACHMENT_CLASSIFICATION_KEY) IN (<foreach item='item' collection='attachmentClassificationKeyIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
+ "<if test='oldValueIn != null'>AND UPPER(OLD_VALUE) IN (<foreach item='item' collection='oldValueIn' separator=',' >#{item}</foreach>)</if> "
|
+ "<if test='commentIn != null'>AND UPPER(COMMENT) IN (<foreach item='item' collection='commentIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
+ "<if test='newValueIn != null'>AND UPPER(NEW_VALUE) IN (<foreach item='item' collection='newValueIn' separator=',' >#{item}</foreach>)</if> "
|
+ "<if test='oldValueIn != null'>AND UPPER(OLD_VALUE) IN (<foreach item='item' collection='oldValueIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
+ "<if test='custom1In != null'>AND UPPER(CUSTOM_1) IN (<foreach item='item' collection='custom1In' separator=',' >#{item}</foreach>)</if> "
|
+ "<if test='newValueIn != null'>AND UPPER(NEW_VALUE) IN (<foreach item='item' collection='newValueIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
+ "<if test='custom2In != null'>AND UPPER(CUSTOM_2) IN (<foreach item='item' collection='custom2In' separator=',' >#{item}</foreach>)</if> "
|
+ "<if test='custom1In != null'>AND UPPER(CUSTOM_1) IN (<foreach item='item' collection='custom1In' separator=',' >#{item}</foreach>)</if> "
|
||||||
+ "<if test='custom3In != null'>AND UPPER(CUSTOM_3) IN (<foreach item='item' collection='custom3In' separator=',' >#{item}</foreach>)</if> "
|
+ "<if test='custom2In != null'>AND UPPER(CUSTOM_2) IN (<foreach item='item' collection='custom2In' separator=',' >#{item}</foreach>)</if> "
|
||||||
+ "<if test='custom4In != null'>AND UPPER(CUSTOM_4) IN (<foreach item='item' collection='custom4In' separator=',' >#{item}</foreach>)</if> "
|
+ "<if test='custom3In != null'>AND UPPER(CUSTOM_3) IN (<foreach item='item' collection='custom3In' separator=',' >#{item}</foreach>)</if> "
|
||||||
+ "<if test='oldDataIn != null'>AND UPPER(OLD_DATA) IN (<foreach item='item' collection='oldDataIn' separator=',' >#{item}</foreach>)</if> "
|
+ "<if test='custom4In != null'>AND UPPER(CUSTOM_4) IN (<foreach item='item' collection='custom4In' separator=',' >#{item}</foreach>)</if> "
|
||||||
+ "<if test='newDataIn != null'>AND UPPER(NEW_DATA) IN (<foreach item='item' collection='newDataIn' separator=',' >#{item}</foreach>)</if> "
|
+ "<if test='oldDataIn != null'>AND UPPER(OLD_DATA) IN (<foreach item='item' collection='oldDataIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
// LIKE-Queries
|
+ "<if test='newDataIn != null'>AND UPPER(NEW_DATA) IN (<foreach item='item' collection='newDataIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
+ "<if test='businessProcessIdLike != null'>AND (<foreach item='item' collection='businessProcessIdLike' separator='OR' > UPPER(BUSINESS_PROCESS_ID) LIKE #{item} </foreach>)</if> "
|
// LIKE-Queries
|
||||||
+ "<if test='parentBusinessProcessIdLike != null'>AND (<foreach item='item' collection='parentBusinessProcessIdLike' separator=' OR ' >UPPER(PARENT_BUSINESS_PROCESS_ID) LIKE #{item}</foreach>)</if> "
|
+ "<if test='businessProcessIdLike != null'>AND (<foreach item='item' collection='businessProcessIdLike' separator='OR' > UPPER(BUSINESS_PROCESS_ID) LIKE #{item} </foreach>)</if> "
|
||||||
+ "<if test='taskIdLike != null'>AND (<foreach item='item' collection='taskIdLike' separator=' OR ' >UPPER(TASK_ID) LIKE #{item}</foreach>)</if> "
|
+ "<if test='parentBusinessProcessIdLike != null'>AND (<foreach item='item' collection='parentBusinessProcessIdLike' separator=' OR ' >UPPER(PARENT_BUSINESS_PROCESS_ID) LIKE #{item}</foreach>)</if> "
|
||||||
+ "<if test='eventTypeLike != null'>AND (<foreach item='item' collection='eventTypeLike' separator=' OR ' >UPPER(EVENT_TYPE) LIKE #{item}</foreach>)</if> "
|
+ "<if test='taskIdLike != null'>AND (<foreach item='item' collection='taskIdLike' separator=' OR ' >UPPER(TASK_ID) LIKE #{item}</foreach>)</if> "
|
||||||
+ "<if test='userIdLike != null'>AND (<foreach item='item' collection='userIdLike' separator=' OR ' >UPPER(USER_ID) LIKE #{item}</foreach>)</if> "
|
+ "<if test='eventTypeLike != null'>AND (<foreach item='item' collection='eventTypeLike' separator=' OR ' >UPPER(EVENT_TYPE) LIKE #{item}</foreach>)</if> "
|
||||||
+ "<if test='domainLike != null'>AND (<foreach item='item' collection='domainLike' separator=' OR ' >UPPER(DOMAIN) LIKE #{item}</foreach>)</if> "
|
+ "<if test='userIdLike != null'>AND (<foreach item='item' collection='userIdLike' separator=' OR ' >UPPER(USER_ID) LIKE #{item}</foreach>)</if> "
|
||||||
+ "<if test='workbasketKeyLike != null'>AND (<foreach item='item' collection='workbasketKeyLike' separator=' OR ' >UPPER(WORKBASKET_KEY) LIKE #{item}</foreach>)</if> "
|
+ "<if test='domainLike != null'>AND (<foreach item='item' collection='domainLike' separator=' OR ' >UPPER(DOMAIN) LIKE #{item}</foreach>)</if> "
|
||||||
+ "<if test='porCompanyLike != null'>AND (<foreach item='item' collection='porCompanyLike' separator=' OR ' >UPPER(POR_COMPANY) LIKE #{item}</foreach>)</if> "
|
+ "<if test='workbasketKeyLike != null'>AND (<foreach item='item' collection='workbasketKeyLike' separator=' OR ' >UPPER(WORKBASKET_KEY) LIKE #{item}</foreach>)</if> "
|
||||||
+ "<if test='porSystemLike != null'>AND (<foreach item='item' collection='porSystemLike' separator=' OR ' >UPPER(POR_SYSTEM) LIKE #{item}</foreach>)</if> "
|
+ "<if test='porCompanyLike != null'>AND (<foreach item='item' collection='porCompanyLike' separator=' OR ' >UPPER(POR_COMPANY) LIKE #{item}</foreach>)</if> "
|
||||||
+ "<if test='porInstanceLike != null'>AND (<foreach item='item' collection='porInstanceLike' separator=' OR ' >UPPER(POR_INSTANCE) LIKE #{item}</foreach>)</if> "
|
+ "<if test='porSystemLike != null'>AND (<foreach item='item' collection='porSystemLike' separator=' OR ' >UPPER(POR_SYSTEM) LIKE #{item}</foreach>)</if> "
|
||||||
+ "<if test='porTypeLike != null'>AND (<foreach item='item' collection='porTypeLike' separator=' OR ' >UPPER(POR_TYPE) LIKE #{item}</foreach>)</if> "
|
+ "<if test='porInstanceLike != null'>AND (<foreach item='item' collection='porInstanceLike' separator=' OR ' >UPPER(POR_INSTANCE) LIKE #{item}</foreach>)</if> "
|
||||||
+ "<if test='porValueLike != null'>AND (<foreach item='item' collection='porValueLike' separator=' OR ' >UPPER(POR_VALUE) LIKE #{item}</foreach>)</if> "
|
+ "<if test='porTypeLike != null'>AND (<foreach item='item' collection='porTypeLike' separator=' OR ' >UPPER(POR_TYPE) LIKE #{item}</foreach>)</if> "
|
||||||
+ "<if test='taskClassificationKeyLike != null'>AND (<foreach item='item' collection='taskClassificationKeyLike' separator=' OR ' >UPPER(TASK_CLASSIFICATION_KEY) LIKE #{item}</foreach>)</if> "
|
+ "<if test='porValueLike != null'>AND (<foreach item='item' collection='porValueLike' separator=' OR ' >UPPER(POR_VALUE) LIKE #{item}</foreach>)</if> "
|
||||||
+ "<if test='taskClassificationCategoryLike != null'>AND (<foreach item='item' collection='taskClassificationCategoryLike' separator=' OR ' >UPPER(TASK_CLASSIFICATION_CATEGORY) LIKE #{item}</foreach>)</if> "
|
+ "<if test='taskClassificationKeyLike != null'>AND (<foreach item='item' collection='taskClassificationKeyLike' separator=' OR ' >UPPER(TASK_CLASSIFICATION_KEY) LIKE #{item}</foreach>)</if> "
|
||||||
+ "<if test='attachmentClassificationKeyLike != null'>AND (<foreach item='item' collection='attachmentClassificationKeyLike' separator=' OR ' >UPPER(ATTACHMENT_CLASSIFICATION_KEY) LIKE #{item}</foreach>)</if> "
|
+ "<if test='taskClassificationCategoryLike != null'>AND (<foreach item='item' collection='taskClassificationCategoryLike' separator=' OR ' >UPPER(TASK_CLASSIFICATION_CATEGORY) LIKE #{item}</foreach>)</if> "
|
||||||
+ "<if test='commentLike != null'>AND (<foreach item='item' collection='commentLike' separator=' OR ' >UPPER(COMMENT) LIKE #{item}</foreach>)</if> "
|
+ "<if test='attachmentClassificationKeyLike != null'>AND (<foreach item='item' collection='attachmentClassificationKeyLike' separator=' OR ' >UPPER(ATTACHMENT_CLASSIFICATION_KEY) LIKE #{item}</foreach>)</if> "
|
||||||
+ "<if test='oldValueLike != null'>AND (<foreach item='item' collection='oldValueLike' separator=' OR ' >UPPER(OLD_VALUE) LIKE #{item}</foreach>)</if> "
|
+ "<if test='commentLike != null'>AND (<foreach item='item' collection='commentLike' separator=' OR ' >UPPER(COMMENT) LIKE #{item}</foreach>)</if> "
|
||||||
+ "<if test='newValueLike != null'>AND (<foreach item='item' collection='newValueLike' separator=' OR ' >UPPER(NEW_VALUE) LIKE #{item}</foreach>)</if> "
|
+ "<if test='oldValueLike != null'>AND (<foreach item='item' collection='oldValueLike' separator=' OR ' >UPPER(OLD_VALUE) LIKE #{item}</foreach>)</if> "
|
||||||
+ "<if test='custom1Like != null'>AND (<foreach item='item' collection='custom1Like' separator=' OR ' >UPPER(CUSTOM_1) LIKE #{item}</foreach>)</if> "
|
+ "<if test='newValueLike != null'>AND (<foreach item='item' collection='newValueLike' separator=' OR ' >UPPER(NEW_VALUE) LIKE #{item}</foreach>)</if> "
|
||||||
+ "<if test='custom2Like != null'>AND (<foreach item='item' collection='custom2Like' separator=' OR ' >UPPER(CUSTOM_2) LIKE #{item}</foreach>)</if> "
|
+ "<if test='custom1Like != null'>AND (<foreach item='item' collection='custom1Like' separator=' OR ' >UPPER(CUSTOM_1) LIKE #{item}</foreach>)</if> "
|
||||||
+ "<if test='custom3Like != null'>AND (<foreach item='item' collection='custom3Like' separator=' OR ' >UPPER(CUSTOM_3) LIKE #{item}</foreach>)</if> "
|
+ "<if test='custom2Like != null'>AND (<foreach item='item' collection='custom2Like' separator=' OR ' >UPPER(CUSTOM_2) LIKE #{item}</foreach>)</if> "
|
||||||
+ "<if test='custom4Like != null'>AND (<foreach item='item' collection='custom4Like' separator=' OR ' >UPPER(CUSTOM_4) LIKE #{item}</foreach>)</if> "
|
+ "<if test='custom3Like != null'>AND (<foreach item='item' collection='custom3Like' separator=' OR ' >UPPER(CUSTOM_3) LIKE #{item}</foreach>)</if> "
|
||||||
+ "<if test='oldDataLike != null'>AND (<foreach item='item' collection='oldDataLike' separator=' OR ' >UPPER(OLD_DATA) LIKE #{item}</foreach>)</if> "
|
+ "<if test='custom4Like != null'>AND (<foreach item='item' collection='custom4Like' separator=' OR ' >UPPER(CUSTOM_4) LIKE #{item}</foreach>)</if> "
|
||||||
+ "<if test='newDataLike != null'>AND (<foreach item='item' collection='newDataLike' separator=' OR ' >UPPER(NEW_DATA) LIKE #{item}</foreach>)</if> "
|
+ "<if test='oldDataLike != null'>AND (<foreach item='item' collection='oldDataLike' separator=' OR ' >UPPER(OLD_DATA) LIKE #{item}</foreach>)</if> "
|
||||||
+ "</where>"
|
+ "<if test='newDataLike != null'>AND (<foreach item='item' collection='newDataLike' separator=' OR ' >UPPER(NEW_DATA) LIKE #{item}</foreach>)</if> "
|
||||||
+ "<if test='!orderBy.isEmpty()'>ORDER BY <foreach item='item' collection='orderBy' separator=',' >${item}</foreach></if> "
|
+ "</where>"
|
||||||
+ "</script>")
|
+ "<if test='!orderBy.isEmpty()'>ORDER BY <foreach item='item' collection='orderBy' separator=',' >${item}</foreach></if> "
|
||||||
List<String> queryHistoryColumnValues(HistoryQueryImpl historyQuery);
|
+ "</script>")
|
||||||
|
List<String> queryHistoryColumnValues(HistoryQueryImpl historyQuery);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -3,46 +3,48 @@ package pro.taskana.simplehistory.query;
|
||||||
import pro.taskana.QueryColumnName;
|
import pro.taskana.QueryColumnName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enum containing the column names for @see pro.taskana.simplehistory.mappings.HistoryQueryMapper#queryHistoryColumnValues(pro.taskana.simplehistory.impl.HistoryQueryImpl).
|
* Enum containing the column names for @see
|
||||||
|
* pro.taskana.simplehistory.mappings.HistoryQueryMapper#queryHistoryColumnValues(pro.taskana.simplehistory.impl.HistoryQueryImpl).
|
||||||
*
|
*
|
||||||
* @author bv
|
* @author bv
|
||||||
*/
|
*/
|
||||||
public enum HistoryQueryColumnName implements QueryColumnName {
|
public enum HistoryQueryColumnName implements QueryColumnName {
|
||||||
ID("id"),
|
ID("id"),
|
||||||
BUSINESS_PROCESS_ID("business_process_id"),
|
BUSINESS_PROCESS_ID("business_process_id"),
|
||||||
PARENT_BUSINESS_PROCESS_ID("parent_business_process_id"),
|
PARENT_BUSINESS_PROCESS_ID("parent_business_process_id"),
|
||||||
TASK_ID("task_id"),
|
TASK_ID("task_id"),
|
||||||
EVENT_TYPE("event_type"),
|
EVENT_TYPE("event_type"),
|
||||||
CREATED("created"),
|
CREATED("created"),
|
||||||
USER_ID("user_id"),
|
USER_ID("user_id"),
|
||||||
DOMAIN("domain"),
|
DOMAIN("domain"),
|
||||||
WORKBASKET_KEY("workbasket_key"),
|
WORKBASKET_KEY("workbasket_key"),
|
||||||
POR_COMPANY("por_company"),
|
POR_COMPANY("por_company"),
|
||||||
POR_SYSTEM("por_system"),
|
POR_SYSTEM("por_system"),
|
||||||
POR_INSTANCE("por_instance"),
|
POR_INSTANCE("por_instance"),
|
||||||
POR_TYPE("por_type"),
|
POR_TYPE("por_type"),
|
||||||
POR_VALUE("por_value"),
|
POR_VALUE("por_value"),
|
||||||
TASK_CLASSIFICATION_KEY("task_classification_key"),
|
TASK_CLASSIFICATION_KEY("task_classification_key"),
|
||||||
TASK_CLASSIFICATION_CATEGORY("task_classification_category"),
|
TASK_CLASSIFICATION_CATEGORY("task_classification_category"),
|
||||||
ATTACHMENT_CLASSIFICATION_KEY("attachment_classification_key"),
|
ATTACHMENT_CLASSIFICATION_KEY("attachment_classification_key"),
|
||||||
COMMENT("comment"),
|
COMMENT("comment"),
|
||||||
OLD_VALUE("old_value"),
|
OLD_VALUE("old_value"),
|
||||||
NEW_VALUE("new_value"),
|
NEW_VALUE("new_value"),
|
||||||
CUSTOM_1("custom_1"),
|
CUSTOM_1("custom_1"),
|
||||||
CUSTOM_2("custom_2"),
|
CUSTOM_2("custom_2"),
|
||||||
CUSTOM_3("custom_3"),
|
CUSTOM_3("custom_3"),
|
||||||
CUSTOM_4("custom_4"),
|
CUSTOM_4("custom_4"),
|
||||||
OLD_DATA("old_data"),
|
OLD_DATA("old_data"),
|
||||||
NEW_DATA("new_data"),
|
NEW_DATA("new_data"),
|
||||||
TYPE("type");
|
TYPE("type");
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
HistoryQueryColumnName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
HistoryQueryColumnName(String name) {
|
||||||
public String toString() {
|
this.name = name;
|
||||||
return name;
|
}
|
||||||
}
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package acceptance;
|
package acceptance;
|
||||||
|
|
||||||
|
import configuration.DBWriter;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
|
|
@ -7,234 +8,239 @@ import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
|
|
||||||
import org.apache.ibatis.datasource.pooled.PooledDataSource;
|
import org.apache.ibatis.datasource.pooled.PooledDataSource;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import configuration.DBWriter;
|
|
||||||
import pro.taskana.configuration.TaskanaEngineConfiguration;
|
import pro.taskana.configuration.TaskanaEngineConfiguration;
|
||||||
import pro.taskana.simplehistory.impl.HistoryEventImpl;
|
import pro.taskana.simplehistory.impl.HistoryEventImpl;
|
||||||
import pro.taskana.simplehistory.impl.SimpleHistoryServiceImpl;
|
import pro.taskana.simplehistory.impl.SimpleHistoryServiceImpl;
|
||||||
|
|
||||||
/**
|
/** Set up database for tests. */
|
||||||
* Set up database for tests.
|
|
||||||
*/
|
|
||||||
public class AbstractAccTest {
|
public class AbstractAccTest {
|
||||||
|
|
||||||
public static SimpleHistoryServiceImpl historyService;
|
private static final Logger LOGGER = LoggerFactory.getLogger(AbstractAccTest.class);
|
||||||
|
private static final int POOL_TIME_TO_WAIT = 50;
|
||||||
|
public static SimpleHistoryServiceImpl historyService;
|
||||||
|
protected static TaskanaEngineConfiguration taskanaEngineConfiguration;
|
||||||
|
private static DataSource dataSource = null;
|
||||||
|
private static String schemaName = null;
|
||||||
|
|
||||||
protected static TaskanaEngineConfiguration taskanaEngineConfiguration;
|
protected AbstractAccTest() {
|
||||||
|
// not called
|
||||||
|
}
|
||||||
|
|
||||||
private static DataSource dataSource = null;
|
@BeforeClass
|
||||||
|
public static void setupTest() throws Exception {
|
||||||
|
resetDb(null);
|
||||||
|
}
|
||||||
|
|
||||||
private static String schemaName = null;
|
public static void resetDb(String schemaName) throws SQLException {
|
||||||
|
DataSource dataSource = getDataSource();
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(AbstractAccTest.class);
|
DBWriter writer = new DBWriter();
|
||||||
|
taskanaEngineConfiguration =
|
||||||
private static final int POOL_TIME_TO_WAIT = 50;
|
new TaskanaEngineConfiguration(
|
||||||
|
dataSource,
|
||||||
protected AbstractAccTest() {
|
false,
|
||||||
// not called
|
|
||||||
}
|
|
||||||
|
|
||||||
@BeforeClass
|
|
||||||
public static void setupTest() throws Exception {
|
|
||||||
resetDb(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void resetDb(String schemaName) throws SQLException {
|
|
||||||
DataSource dataSource = getDataSource();
|
|
||||||
DBWriter writer = new DBWriter();
|
|
||||||
taskanaEngineConfiguration = new TaskanaEngineConfiguration(dataSource, false,
|
|
||||||
schemaName != null && !schemaName.isEmpty() ? schemaName : getSchemaName());
|
schemaName != null && !schemaName.isEmpty() ? schemaName : getSchemaName());
|
||||||
historyService = new SimpleHistoryServiceImpl();
|
historyService = new SimpleHistoryServiceImpl();
|
||||||
historyService.initialize(taskanaEngineConfiguration);
|
historyService.initialize(taskanaEngineConfiguration);
|
||||||
|
|
||||||
writer.clearDB(dataSource);
|
writer.clearDB(dataSource);
|
||||||
writer.generateTestData(dataSource);
|
writer.generateTestData(dataSource);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* returns the DataSource used for Junit test. If the file {user.home}/taskanaUnitTest.properties
|
||||||
|
* is present, the Datasource is created according to the properties jdbcDriver, jdbcUrl,
|
||||||
|
* dbUserName and dbPassword. Assuming, the database has the name tskdb, a sample properties file
|
||||||
|
* for DB2 looks as follows: jdbcDriver=com.ibm.db2.jcc.DB2Driver
|
||||||
|
* jdbcUrl=jdbc:db2://localhost:50000/tskdb dbUserName=db2user dbPassword=db2password If any of
|
||||||
|
* these properties is missing, or the file doesn't exist, the default Datasource for h2 in-memory
|
||||||
|
* db is created.
|
||||||
|
*
|
||||||
|
* @return dataSource for unit test
|
||||||
|
*/
|
||||||
|
public static DataSource getDataSource() {
|
||||||
|
if (dataSource == null) {
|
||||||
|
String userHomeDirectroy = System.getProperty("user.home");
|
||||||
|
String propertiesFileName = userHomeDirectroy + "/taskanaUnitTest.properties";
|
||||||
|
File f = new File(propertiesFileName);
|
||||||
|
if (f.exists() && !f.isDirectory()) {
|
||||||
|
dataSource = createDataSourceFromProperties(propertiesFileName);
|
||||||
|
} else {
|
||||||
|
dataSource = createDefaultDataSource();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return dataSource;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* returns the SchemaName used for Junit test. If the file {user.home}/taskanaUnitTest.properties
|
||||||
|
* is present, the SchemaName is created according to the property schemaName. a sample properties
|
||||||
|
* file for DB2 looks as follows: jdbcDriver=com.ibm.db2.jcc.DB2Driver
|
||||||
|
* jdbcUrl=jdbc:db2://localhost:50000/tskdb dbUserName=db2user dbPassword=db2password
|
||||||
|
* schemaName=TASKANA If any of these properties is missing, or the file doesn't exist, the
|
||||||
|
* default schemaName TASKANA is created used.
|
||||||
|
*
|
||||||
|
* @return String for unit test
|
||||||
|
*/
|
||||||
|
public static String getSchemaName() {
|
||||||
|
if (schemaName == null) {
|
||||||
|
String userHomeDirectroy = System.getProperty("user.home");
|
||||||
|
String propertiesFileName = userHomeDirectroy + "/taskanaUnitTest.properties";
|
||||||
|
File f = new File(propertiesFileName);
|
||||||
|
if (f.exists() && !f.isDirectory()) {
|
||||||
|
schemaName = getSchemaNameFromPropertiesObject(propertiesFileName);
|
||||||
|
} else {
|
||||||
|
schemaName = "TASKANA";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return schemaName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* create historyEvent object.
|
||||||
|
*
|
||||||
|
* @param workbasketKey the workbasketKey, the task currently resides in.
|
||||||
|
* @param taskId the taskid the event belongs to.
|
||||||
|
* @param type the type of the event.
|
||||||
|
* @param comment the individual comment.
|
||||||
|
* @param previousWorkbasketId the workbasketId of the previous workbasket (if applicable).
|
||||||
|
* @return History event object created.
|
||||||
|
*/
|
||||||
|
public static HistoryEventImpl createHistoryEvent(
|
||||||
|
String workbasketKey,
|
||||||
|
String taskId,
|
||||||
|
String type,
|
||||||
|
String comment,
|
||||||
|
String previousWorkbasketId) {
|
||||||
|
HistoryEventImpl historyEvent = new HistoryEventImpl();
|
||||||
|
historyEvent.setWorkbasketKey(workbasketKey);
|
||||||
|
historyEvent.setTaskId(taskId);
|
||||||
|
historyEvent.setEventType(type);
|
||||||
|
historyEvent.setComment(comment);
|
||||||
|
historyEvent.setOldValue(previousWorkbasketId);
|
||||||
|
return historyEvent;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* create Default DataSource for in-memory database.
|
||||||
|
*
|
||||||
|
* @return the TASKANA default datasource.
|
||||||
|
*/
|
||||||
|
private static DataSource createDefaultDataSource() {
|
||||||
|
|
||||||
|
String jdbcDriver = "org.h2.Driver";
|
||||||
|
String jdbcUrl = "jdbc:h2:mem:taskana;IGNORECASE=TRUE;LOCK_MODE=0";
|
||||||
|
String dbUserName = "sa";
|
||||||
|
String dbPassword = "sa";
|
||||||
|
DataSource ds =
|
||||||
|
new PooledDataSource(
|
||||||
|
Thread.currentThread().getContextClassLoader(),
|
||||||
|
jdbcDriver,
|
||||||
|
jdbcUrl,
|
||||||
|
dbUserName,
|
||||||
|
dbPassword);
|
||||||
|
((PooledDataSource) ds).setPoolTimeToWait(POOL_TIME_TO_WAIT);
|
||||||
|
((PooledDataSource) ds)
|
||||||
|
.forceCloseAll(); // otherwise the MyBatis pool is not initialized correctly
|
||||||
|
|
||||||
|
return ds;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* create data source from properties file.
|
||||||
|
*
|
||||||
|
* @param propertiesFileName the name of the properties file.
|
||||||
|
* @return the datasource constructed from the information in the properties file.
|
||||||
|
*/
|
||||||
|
private static DataSource createDataSourceFromProperties(String propertiesFileName) {
|
||||||
|
DataSource ds = null;
|
||||||
|
try (InputStream input = new FileInputStream(propertiesFileName)) {
|
||||||
|
Properties prop = new Properties();
|
||||||
|
prop.load(input);
|
||||||
|
boolean propertiesFileIsComplete = true;
|
||||||
|
String warningMessage = "";
|
||||||
|
String jdbcDriver = prop.getProperty("jdbcDriver");
|
||||||
|
if (jdbcDriver == null || jdbcDriver.length() == 0) {
|
||||||
|
propertiesFileIsComplete = false;
|
||||||
|
warningMessage += ", jdbcDriver property missing";
|
||||||
|
}
|
||||||
|
String jdbcUrl = prop.getProperty("jdbcUrl");
|
||||||
|
if (jdbcUrl == null || jdbcUrl.length() == 0) {
|
||||||
|
propertiesFileIsComplete = false;
|
||||||
|
warningMessage += ", jdbcUrl property missing";
|
||||||
|
}
|
||||||
|
String dbUserName = prop.getProperty("dbUserName");
|
||||||
|
if (dbUserName == null || dbUserName.length() == 0) {
|
||||||
|
propertiesFileIsComplete = false;
|
||||||
|
warningMessage += ", dbUserName property missing";
|
||||||
|
}
|
||||||
|
String dbPassword = prop.getProperty("dbPassword");
|
||||||
|
if (dbPassword == null || dbPassword.length() == 0) {
|
||||||
|
propertiesFileIsComplete = false;
|
||||||
|
warningMessage += ", dbPassword property missing";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (propertiesFileIsComplete) {
|
||||||
|
ds =
|
||||||
|
new PooledDataSource(
|
||||||
|
Thread.currentThread().getContextClassLoader(),
|
||||||
|
jdbcDriver,
|
||||||
|
jdbcUrl,
|
||||||
|
dbUserName,
|
||||||
|
dbPassword);
|
||||||
|
((PooledDataSource) ds)
|
||||||
|
.forceCloseAll(); // otherwise the MyBatis pool is not initialized correctly
|
||||||
|
} else {
|
||||||
|
LOGGER.warn("propertiesFile " + propertiesFileName + " is incomplete" + warningMessage);
|
||||||
|
LOGGER.warn("Using default Datasource for Test");
|
||||||
|
ds = createDefaultDataSource();
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (FileNotFoundException e) {
|
||||||
|
LOGGER.warn("createDataSourceFromProperties caught Exception " + e);
|
||||||
|
LOGGER.warn("Using default Datasource for Test");
|
||||||
|
ds = createDefaultDataSource();
|
||||||
|
} catch (IOException e) {
|
||||||
|
LOGGER.warn("createDataSourceFromProperties caught Exception " + e);
|
||||||
|
LOGGER.warn("Using default Datasource for Test");
|
||||||
|
ds = createDefaultDataSource();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
return ds;
|
||||||
* returns the DataSource used for Junit test. If the file {user.home}/taskanaUnitTest.properties is present, the
|
}
|
||||||
* Datasource is created according to the properties jdbcDriver, jdbcUrl, dbUserName and dbPassword. Assuming, the
|
|
||||||
* database has the name tskdb, a sample properties file for DB2 looks as follows:
|
private static String getSchemaNameFromPropertiesObject(String propertiesFileName) {
|
||||||
* jdbcDriver=com.ibm.db2.jcc.DB2Driver jdbcUrl=jdbc:db2://localhost:50000/tskdb dbUserName=db2user
|
String schemaName = "TASKANA";
|
||||||
* dbPassword=db2password If any of these properties is missing, or the file doesn't exist, the default Datasource
|
try (InputStream input = new FileInputStream(propertiesFileName)) {
|
||||||
* for h2 in-memory db is created.
|
Properties prop = new Properties();
|
||||||
*
|
prop.load(input);
|
||||||
* @return dataSource for unit test
|
boolean propertiesFileIsComplete = true;
|
||||||
*/
|
String warningMessage = "";
|
||||||
public static DataSource getDataSource() {
|
schemaName = prop.getProperty("schemaName");
|
||||||
if (dataSource == null) {
|
if (schemaName == null || schemaName.length() == 0) {
|
||||||
String userHomeDirectroy = System.getProperty("user.home");
|
propertiesFileIsComplete = false;
|
||||||
String propertiesFileName = userHomeDirectroy + "/taskanaUnitTest.properties";
|
warningMessage += ", schemaName property missing";
|
||||||
File f = new File(propertiesFileName);
|
}
|
||||||
if (f.exists() && !f.isDirectory()) {
|
|
||||||
dataSource = createDataSourceFromProperties(propertiesFileName);
|
if (!propertiesFileIsComplete) {
|
||||||
} else {
|
LOGGER.warn("propertiesFile " + propertiesFileName + " is incomplete" + warningMessage);
|
||||||
dataSource = createDefaultDataSource();
|
LOGGER.warn("Using default Datasource for Test");
|
||||||
}
|
schemaName = "TASKANA";
|
||||||
}
|
}
|
||||||
return dataSource;
|
|
||||||
|
} catch (FileNotFoundException e) {
|
||||||
|
LOGGER.warn("getSchemaNameFromPropertiesObject caught Exception " + e);
|
||||||
|
LOGGER.warn("Using default schemaName for Test");
|
||||||
|
} catch (IOException e) {
|
||||||
|
LOGGER.warn("createDataSourceFromProperties caught Exception " + e);
|
||||||
|
LOGGER.warn("Using default Datasource for Test");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
return schemaName;
|
||||||
* create Default DataSource for in-memory database.
|
}
|
||||||
*
|
|
||||||
* @return the TASKANA default datasource.
|
|
||||||
*/
|
|
||||||
private static DataSource createDefaultDataSource() {
|
|
||||||
|
|
||||||
String jdbcDriver = "org.h2.Driver";
|
|
||||||
String jdbcUrl = "jdbc:h2:mem:taskana;IGNORECASE=TRUE;LOCK_MODE=0";
|
|
||||||
String dbUserName = "sa";
|
|
||||||
String dbPassword = "sa";
|
|
||||||
DataSource ds = new PooledDataSource(Thread.currentThread().getContextClassLoader(), jdbcDriver,
|
|
||||||
jdbcUrl, dbUserName, dbPassword);
|
|
||||||
((PooledDataSource) ds).setPoolTimeToWait(POOL_TIME_TO_WAIT);
|
|
||||||
((PooledDataSource) ds).forceCloseAll(); // otherwise the MyBatis pool is not initialized correctly
|
|
||||||
|
|
||||||
return ds;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* returns the SchemaName used for Junit test. If the file {user.home}/taskanaUnitTest.properties is present, the
|
|
||||||
* SchemaName is created according to the property schemaName. a sample properties file for DB2 looks as follows:
|
|
||||||
* jdbcDriver=com.ibm.db2.jcc.DB2Driver jdbcUrl=jdbc:db2://localhost:50000/tskdb dbUserName=db2user
|
|
||||||
* dbPassword=db2password schemaName=TASKANA If any of these properties is missing, or the file doesn't exist, the
|
|
||||||
* default schemaName TASKANA is created used.
|
|
||||||
*
|
|
||||||
* @return String for unit test
|
|
||||||
*/
|
|
||||||
public static String getSchemaName() {
|
|
||||||
if (schemaName == null) {
|
|
||||||
String userHomeDirectroy = System.getProperty("user.home");
|
|
||||||
String propertiesFileName = userHomeDirectroy + "/taskanaUnitTest.properties";
|
|
||||||
File f = new File(propertiesFileName);
|
|
||||||
if (f.exists() && !f.isDirectory()) {
|
|
||||||
schemaName = getSchemaNameFromPropertiesObject(propertiesFileName);
|
|
||||||
} else {
|
|
||||||
schemaName = "TASKANA";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return schemaName;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* create historyEvent object.
|
|
||||||
*
|
|
||||||
* @param workbasketKey
|
|
||||||
* the workbasketKey, the task currently resides in.
|
|
||||||
* @param taskId
|
|
||||||
* the taskid the event belongs to.
|
|
||||||
* @param type
|
|
||||||
* the type of the event.
|
|
||||||
* @param comment
|
|
||||||
* the individual comment.
|
|
||||||
* @param previousWorkbasketId
|
|
||||||
* the workbasketId of the previous workbasket (if applicable).
|
|
||||||
* @return History event object created.
|
|
||||||
*/
|
|
||||||
public static HistoryEventImpl createHistoryEvent(String workbasketKey, String taskId, String type, String comment,
|
|
||||||
String previousWorkbasketId) {
|
|
||||||
HistoryEventImpl historyEvent = new HistoryEventImpl();
|
|
||||||
historyEvent.setWorkbasketKey(workbasketKey);
|
|
||||||
historyEvent.setTaskId(taskId);
|
|
||||||
historyEvent.setEventType(type);
|
|
||||||
historyEvent.setComment(comment);
|
|
||||||
historyEvent.setOldValue(previousWorkbasketId);
|
|
||||||
return historyEvent;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* create data source from properties file.
|
|
||||||
*
|
|
||||||
* @param propertiesFileName
|
|
||||||
* the name of the properties file.
|
|
||||||
* @return the datasource constructed from the information in the properties file.
|
|
||||||
*/
|
|
||||||
private static DataSource createDataSourceFromProperties(String propertiesFileName) {
|
|
||||||
DataSource ds = null;
|
|
||||||
try (InputStream input = new FileInputStream(propertiesFileName)) {
|
|
||||||
Properties prop = new Properties();
|
|
||||||
prop.load(input);
|
|
||||||
boolean propertiesFileIsComplete = true;
|
|
||||||
String warningMessage = "";
|
|
||||||
String jdbcDriver = prop.getProperty("jdbcDriver");
|
|
||||||
if (jdbcDriver == null || jdbcDriver.length() == 0) {
|
|
||||||
propertiesFileIsComplete = false;
|
|
||||||
warningMessage += ", jdbcDriver property missing";
|
|
||||||
}
|
|
||||||
String jdbcUrl = prop.getProperty("jdbcUrl");
|
|
||||||
if (jdbcUrl == null || jdbcUrl.length() == 0) {
|
|
||||||
propertiesFileIsComplete = false;
|
|
||||||
warningMessage += ", jdbcUrl property missing";
|
|
||||||
}
|
|
||||||
String dbUserName = prop.getProperty("dbUserName");
|
|
||||||
if (dbUserName == null || dbUserName.length() == 0) {
|
|
||||||
propertiesFileIsComplete = false;
|
|
||||||
warningMessage += ", dbUserName property missing";
|
|
||||||
}
|
|
||||||
String dbPassword = prop.getProperty("dbPassword");
|
|
||||||
if (dbPassword == null || dbPassword.length() == 0) {
|
|
||||||
propertiesFileIsComplete = false;
|
|
||||||
warningMessage += ", dbPassword property missing";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (propertiesFileIsComplete) {
|
|
||||||
ds = new PooledDataSource(Thread.currentThread().getContextClassLoader(), jdbcDriver,
|
|
||||||
jdbcUrl, dbUserName, dbPassword);
|
|
||||||
((PooledDataSource) ds).forceCloseAll(); // otherwise the MyBatis pool is not initialized correctly
|
|
||||||
} else {
|
|
||||||
LOGGER.warn("propertiesFile " + propertiesFileName + " is incomplete" + warningMessage);
|
|
||||||
LOGGER.warn("Using default Datasource for Test");
|
|
||||||
ds = createDefaultDataSource();
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (FileNotFoundException e) {
|
|
||||||
LOGGER.warn("createDataSourceFromProperties caught Exception " + e);
|
|
||||||
LOGGER.warn("Using default Datasource for Test");
|
|
||||||
ds = createDefaultDataSource();
|
|
||||||
} catch (IOException e) {
|
|
||||||
LOGGER.warn("createDataSourceFromProperties caught Exception " + e);
|
|
||||||
LOGGER.warn("Using default Datasource for Test");
|
|
||||||
ds = createDefaultDataSource();
|
|
||||||
}
|
|
||||||
|
|
||||||
return ds;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static String getSchemaNameFromPropertiesObject(String propertiesFileName) {
|
|
||||||
String schemaName = "TASKANA";
|
|
||||||
try (InputStream input = new FileInputStream(propertiesFileName)) {
|
|
||||||
Properties prop = new Properties();
|
|
||||||
prop.load(input);
|
|
||||||
boolean propertiesFileIsComplete = true;
|
|
||||||
String warningMessage = "";
|
|
||||||
schemaName = prop.getProperty("schemaName");
|
|
||||||
if (schemaName == null || schemaName.length() == 0) {
|
|
||||||
propertiesFileIsComplete = false;
|
|
||||||
warningMessage += ", schemaName property missing";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!propertiesFileIsComplete) {
|
|
||||||
LOGGER.warn("propertiesFile " + propertiesFileName + " is incomplete" + warningMessage);
|
|
||||||
LOGGER.warn("Using default Datasource for Test");
|
|
||||||
schemaName = "TASKANA";
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (FileNotFoundException e) {
|
|
||||||
LOGGER.warn("getSchemaNameFromPropertiesObject caught Exception " + e);
|
|
||||||
LOGGER.warn("Using default schemaName for Test");
|
|
||||||
} catch (IOException e) {
|
|
||||||
LOGGER.warn("createDataSourceFromProperties caught Exception " + e);
|
|
||||||
LOGGER.warn("Using default Datasource for Test");
|
|
||||||
}
|
|
||||||
|
|
||||||
return schemaName;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,308 +5,345 @@ import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertNotEquals;
|
import static org.junit.Assert.assertNotEquals;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
|
import acceptance.AbstractAccTest;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import acceptance.AbstractAccTest;
|
|
||||||
import pro.taskana.BaseQuery.SortDirection;
|
import pro.taskana.BaseQuery.SortDirection;
|
||||||
import pro.taskana.TimeInterval;
|
import pro.taskana.TimeInterval;
|
||||||
import pro.taskana.simplehistory.impl.HistoryEventImpl;
|
import pro.taskana.simplehistory.impl.HistoryEventImpl;
|
||||||
import pro.taskana.simplehistory.query.HistoryQuery;
|
import pro.taskana.simplehistory.query.HistoryQuery;
|
||||||
import pro.taskana.simplehistory.query.HistoryQueryColumnName;
|
import pro.taskana.simplehistory.query.HistoryQueryColumnName;
|
||||||
|
|
||||||
/**
|
/** Test for History queries. */
|
||||||
* Test for History queries.
|
|
||||||
*/
|
|
||||||
public class QueryHistoryAccTest extends AbstractAccTest {
|
public class QueryHistoryAccTest extends AbstractAccTest {
|
||||||
|
|
||||||
public QueryHistoryAccTest() {
|
public QueryHistoryAccTest() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testListValuesAscendingAndDescending() {
|
public void testListValuesAscendingAndDescending() {
|
||||||
List<String> defaultList = historyService.createHistoryQuery().listValues(HistoryQueryColumnName.COMMENT, null);
|
List<String> defaultList =
|
||||||
List<String> ascendingList = historyService.createHistoryQuery()
|
historyService.createHistoryQuery().listValues(HistoryQueryColumnName.COMMENT, null);
|
||||||
|
List<String> ascendingList =
|
||||||
|
historyService
|
||||||
|
.createHistoryQuery()
|
||||||
.listValues(HistoryQueryColumnName.COMMENT, SortDirection.ASCENDING);
|
.listValues(HistoryQueryColumnName.COMMENT, SortDirection.ASCENDING);
|
||||||
List<String> descendingList = historyService.createHistoryQuery()
|
List<String> descendingList =
|
||||||
|
historyService
|
||||||
|
.createHistoryQuery()
|
||||||
.listValues(HistoryQueryColumnName.COMMENT, SortDirection.DESCENDING);
|
.listValues(HistoryQueryColumnName.COMMENT, SortDirection.DESCENDING);
|
||||||
|
|
||||||
assertEquals(3, ascendingList.size());
|
assertEquals(3, ascendingList.size());
|
||||||
assertArrayEquals(defaultList.toArray(), ascendingList.toArray());
|
assertArrayEquals(defaultList.toArray(), ascendingList.toArray());
|
||||||
assertEquals(ascendingList.get(2), descendingList.get(0));
|
assertEquals(ascendingList.get(2), descendingList.get(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testComplexQuery() {
|
public void testComplexQuery() {
|
||||||
HistoryQuery query = historyService.createHistoryQuery()
|
HistoryQuery query =
|
||||||
|
historyService
|
||||||
|
.createHistoryQuery()
|
||||||
.businessProcessIdLike("just some string", "BPI:%")
|
.businessProcessIdLike("just some string", "BPI:%")
|
||||||
.domainLike("%A")
|
.domainLike("%A")
|
||||||
.orderByCreated(SortDirection.DESCENDING);
|
.orderByCreated(SortDirection.DESCENDING);
|
||||||
|
|
||||||
List<HistoryEventImpl> results = query.list();
|
List<HistoryEventImpl> results = query.list();
|
||||||
assertEquals(2, results.size());
|
assertEquals(2, results.size());
|
||||||
assertEquals("admin", results.get(0).getUserId());
|
assertEquals("admin", results.get(0).getUserId());
|
||||||
assertEquals("peter", results.get(1).getUserId());
|
assertEquals("peter", results.get(1).getUserId());
|
||||||
|
|
||||||
results = query.orderByUserId(SortDirection.DESCENDING).list();
|
results = query.orderByUserId(SortDirection.DESCENDING).list();
|
||||||
assertEquals(2, results.size());
|
assertEquals(2, results.size());
|
||||||
assertEquals("admin", results.get(0).getUserId());
|
assertEquals("admin", results.get(0).getUserId());
|
||||||
assertEquals("peter", results.get(1).getUserId());
|
assertEquals("peter", results.get(1).getUserId());
|
||||||
assertEquals(3, query.domainLike().count());
|
assertEquals(3, query.domainLike().count());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
@Test
|
||||||
|
public void testQueryListOffset() {
|
||||||
|
List<HistoryEventImpl> result = historyService.createHistoryQuery().list(1, 2);
|
||||||
|
List<HistoryEventImpl> wrongList = historyService.createHistoryQuery().list();
|
||||||
|
|
||||||
@Test
|
assertEquals(2, result.size());
|
||||||
public void testQueryListOffset() {
|
|
||||||
List<HistoryEventImpl> result = historyService.createHistoryQuery().list(1, 2);
|
|
||||||
List<HistoryEventImpl> wrongList = historyService.createHistoryQuery().list();
|
|
||||||
|
|
||||||
assertEquals(2, result.size());
|
assertNotEquals(wrongList.get(0).getUserId(), result.get(0).getUserId());
|
||||||
|
assertEquals(wrongList.get(1).getUserId(), result.get(0).getUserId());
|
||||||
|
}
|
||||||
|
|
||||||
assertNotEquals(wrongList.get(0).getUserId(), result.get(0).getUserId());
|
@Test
|
||||||
assertEquals(wrongList.get(1).getUserId(), result.get(0).getUserId());
|
public void testCorrectResultWithWrongConstraints() {
|
||||||
}
|
List<HistoryEventImpl> result = historyService.createHistoryQuery().list(1, 1000);
|
||||||
|
assertEquals(2, result.size());
|
||||||
|
assertEquals("created by Peter", result.get(0).getComment());
|
||||||
|
|
||||||
@Test
|
result = historyService.createHistoryQuery().list(100, 1000);
|
||||||
public void testCorrectResultWithWrongConstraints() {
|
assertTrue(result.isEmpty());
|
||||||
List<HistoryEventImpl> result = historyService.createHistoryQuery().list(1, 1000);
|
}
|
||||||
assertEquals(2, result.size());
|
|
||||||
assertEquals("created by Peter", result.get(0).getComment());
|
|
||||||
|
|
||||||
result = historyService.createHistoryQuery().list(100, 1000);
|
@Test
|
||||||
assertTrue(result.isEmpty());
|
public void testSingle() {
|
||||||
|
HistoryEventImpl single = historyService.createHistoryQuery().userIdIn("peter").single();
|
||||||
|
assertEquals("CREATE", single.getEventType());
|
||||||
|
|
||||||
}
|
single = historyService.createHistoryQuery().eventTypeIn("CREATE", "xy").single();
|
||||||
|
assertEquals("admin", single.getUserId());
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSingle() {
|
public void testCount() {
|
||||||
HistoryEventImpl single = historyService.createHistoryQuery().userIdIn("peter").single();
|
long count = historyService.createHistoryQuery().userIdIn("peter").count();
|
||||||
assertEquals("CREATE", single.getEventType());
|
assertEquals(1, count);
|
||||||
|
|
||||||
single = historyService.createHistoryQuery().eventTypeIn("CREATE", "xy").single();
|
count = historyService.createHistoryQuery().count();
|
||||||
assertEquals("admin", single.getUserId());
|
assertEquals(3, count);
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
count = historyService.createHistoryQuery().userIdIn("klaus", "arnold", "benni").count();
|
||||||
public void testCount() {
|
assertEquals(0, count);
|
||||||
long count = historyService.createHistoryQuery().userIdIn("peter").count();
|
}
|
||||||
assertEquals(1, count);
|
|
||||||
|
|
||||||
count = historyService.createHistoryQuery().count();
|
@Test
|
||||||
assertEquals(3, count);
|
public void testQueryAttributesIn() {
|
||||||
|
List<HistoryEventImpl> returnValues =
|
||||||
|
historyService.createHistoryQuery().businessProcessIdIn("BPI:01", "BPI:02").list();
|
||||||
|
assertEquals(2, returnValues.size());
|
||||||
|
|
||||||
count = historyService.createHistoryQuery().userIdIn("klaus", "arnold", "benni").count();
|
returnValues = historyService.createHistoryQuery().parentBusinessProcessIdIn("BPI:01").list();
|
||||||
assertEquals(0, count);
|
assertEquals(1, returnValues.size());
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
returnValues =
|
||||||
public void testQueryAttributesIn() {
|
historyService
|
||||||
List<HistoryEventImpl> returnValues = historyService.createHistoryQuery()
|
.createHistoryQuery()
|
||||||
.businessProcessIdIn("BPI:01", "BPI:02")
|
.taskIdIn("TKI:000000000000000000000000000000000000")
|
||||||
.list();
|
.list();
|
||||||
assertEquals(2, returnValues.size());
|
assertEquals(2, returnValues.size());
|
||||||
|
|
||||||
returnValues = historyService.createHistoryQuery().parentBusinessProcessIdIn("BPI:01").list();
|
returnValues = historyService.createHistoryQuery().eventTypeIn("CREATE").list();
|
||||||
assertEquals(1, returnValues.size());
|
assertEquals(3, returnValues.size());
|
||||||
|
|
||||||
returnValues = historyService.createHistoryQuery().taskIdIn("TKI:000000000000000000000000000000000000").list();
|
TimeInterval timeInterval = new TimeInterval(Instant.now().minusSeconds(10), Instant.now());
|
||||||
assertEquals(2, returnValues.size());
|
returnValues = historyService.createHistoryQuery().createdWithin(timeInterval).list();
|
||||||
|
assertEquals(2, returnValues.size());
|
||||||
|
|
||||||
returnValues = historyService.createHistoryQuery().eventTypeIn("CREATE").list();
|
returnValues = historyService.createHistoryQuery().userIdIn("admin").list();
|
||||||
assertEquals(3, returnValues.size());
|
assertEquals(2, returnValues.size());
|
||||||
|
|
||||||
TimeInterval timeInterval = new TimeInterval(Instant.now().minusSeconds(10), Instant.now());
|
returnValues = historyService.createHistoryQuery().domainIn("DOMAIN_A").list();
|
||||||
returnValues = historyService.createHistoryQuery().createdWithin(timeInterval).list();
|
assertEquals(2, returnValues.size());
|
||||||
assertEquals(2, returnValues.size());
|
|
||||||
|
|
||||||
returnValues = historyService.createHistoryQuery().userIdIn("admin").list();
|
returnValues =
|
||||||
assertEquals(2, returnValues.size());
|
historyService
|
||||||
|
.createHistoryQuery()
|
||||||
returnValues = historyService.createHistoryQuery().domainIn("DOMAIN_A").list();
|
|
||||||
assertEquals(2, returnValues.size());
|
|
||||||
|
|
||||||
returnValues = historyService.createHistoryQuery()
|
|
||||||
.workbasketKeyIn("WBI:100000000000000000000000000000000001")
|
.workbasketKeyIn("WBI:100000000000000000000000000000000001")
|
||||||
.list();
|
.list();
|
||||||
assertEquals(2, returnValues.size());
|
assertEquals(2, returnValues.size());
|
||||||
|
|
||||||
returnValues = historyService.createHistoryQuery().porCompanyIn("00").list();
|
returnValues = historyService.createHistoryQuery().porCompanyIn("00").list();
|
||||||
assertEquals(2, returnValues.size());
|
assertEquals(2, returnValues.size());
|
||||||
|
|
||||||
returnValues = historyService.createHistoryQuery().porSystemIn("PASystem").list();
|
returnValues = historyService.createHistoryQuery().porSystemIn("PASystem").list();
|
||||||
assertEquals(2, returnValues.size());
|
assertEquals(2, returnValues.size());
|
||||||
|
|
||||||
returnValues = historyService.createHistoryQuery().porInstanceIn("22").list();
|
returnValues = historyService.createHistoryQuery().porInstanceIn("22").list();
|
||||||
assertEquals(1, returnValues.size());
|
assertEquals(1, returnValues.size());
|
||||||
|
|
||||||
returnValues = historyService.createHistoryQuery().porTypeIn("VN").list();
|
returnValues = historyService.createHistoryQuery().porTypeIn("VN").list();
|
||||||
assertEquals(0, returnValues.size());
|
assertEquals(0, returnValues.size());
|
||||||
|
|
||||||
returnValues = historyService.createHistoryQuery().porValueIn("11223344").list();
|
returnValues = historyService.createHistoryQuery().porValueIn("11223344").list();
|
||||||
assertEquals(2, returnValues.size());
|
assertEquals(2, returnValues.size());
|
||||||
|
|
||||||
returnValues = historyService.createHistoryQuery().taskClassificationKeyIn("L140101").list();
|
returnValues = historyService.createHistoryQuery().taskClassificationKeyIn("L140101").list();
|
||||||
assertEquals(2, returnValues.size());
|
assertEquals(2, returnValues.size());
|
||||||
|
|
||||||
returnValues = historyService.createHistoryQuery().taskClassificationCategoryIn("TASK").list();
|
returnValues = historyService.createHistoryQuery().taskClassificationCategoryIn("TASK").list();
|
||||||
assertEquals(2, returnValues.size());
|
assertEquals(2, returnValues.size());
|
||||||
|
|
||||||
returnValues = historyService.createHistoryQuery().attachmentClassificationKeyIn("DOCTYPE_DEFAULT").list();
|
returnValues =
|
||||||
assertEquals(1, returnValues.size());
|
historyService.createHistoryQuery().attachmentClassificationKeyIn("DOCTYPE_DEFAULT").list();
|
||||||
|
assertEquals(1, returnValues.size());
|
||||||
|
|
||||||
returnValues = historyService.createHistoryQuery().custom1In("custom1").list();
|
returnValues = historyService.createHistoryQuery().custom1In("custom1").list();
|
||||||
assertEquals(3, returnValues.size());
|
assertEquals(3, returnValues.size());
|
||||||
|
|
||||||
returnValues = historyService.createHistoryQuery().custom2In("custom2").list();
|
returnValues = historyService.createHistoryQuery().custom2In("custom2").list();
|
||||||
assertEquals(1, returnValues.size());
|
assertEquals(1, returnValues.size());
|
||||||
|
|
||||||
returnValues = historyService.createHistoryQuery().custom3In("custom3").list();
|
returnValues = historyService.createHistoryQuery().custom3In("custom3").list();
|
||||||
assertEquals(2, returnValues.size());
|
assertEquals(2, returnValues.size());
|
||||||
|
|
||||||
returnValues = historyService.createHistoryQuery().custom4In("custom4").list();
|
returnValues = historyService.createHistoryQuery().custom4In("custom4").list();
|
||||||
assertEquals(1, returnValues.size());
|
assertEquals(1, returnValues.size());
|
||||||
|
|
||||||
returnValues = historyService.createHistoryQuery().commentIn("created a bug").list();
|
returnValues = historyService.createHistoryQuery().commentIn("created a bug").list();
|
||||||
assertEquals(1, returnValues.size());
|
assertEquals(1, returnValues.size());
|
||||||
|
|
||||||
returnValues = historyService.createHistoryQuery().oldValueIn("old_val").list();
|
returnValues = historyService.createHistoryQuery().oldValueIn("old_val").list();
|
||||||
assertEquals(1, returnValues.size());
|
assertEquals(1, returnValues.size());
|
||||||
|
|
||||||
returnValues = historyService.createHistoryQuery().newValueIn("new_val").list();
|
returnValues = historyService.createHistoryQuery().newValueIn("new_val").list();
|
||||||
assertEquals(1, returnValues.size());
|
assertEquals(1, returnValues.size());
|
||||||
|
|
||||||
returnValues = historyService.createHistoryQuery().oldDataIn("123").list();
|
returnValues = historyService.createHistoryQuery().oldDataIn("123").list();
|
||||||
assertEquals(2, returnValues.size());
|
assertEquals(2, returnValues.size());
|
||||||
|
|
||||||
returnValues = historyService.createHistoryQuery().newDataIn("456").list();
|
returnValues = historyService.createHistoryQuery().newDataIn("456").list();
|
||||||
assertEquals(3, returnValues.size());
|
assertEquals(3, returnValues.size());
|
||||||
returnValues = historyService.createHistoryQuery().oldValueLike("old%").list();
|
returnValues = historyService.createHistoryQuery().oldValueLike("old%").list();
|
||||||
assertEquals(1, returnValues.size());
|
assertEquals(1, returnValues.size());
|
||||||
|
|
||||||
returnValues = historyService.createHistoryQuery().newValueLike("new_%").list();
|
returnValues = historyService.createHistoryQuery().newValueLike("new_%").list();
|
||||||
assertEquals(2, returnValues.size());
|
assertEquals(2, returnValues.size());
|
||||||
|
|
||||||
returnValues = historyService.createHistoryQuery().oldDataLike("%23%").list();
|
returnValues = historyService.createHistoryQuery().oldDataLike("%23%").list();
|
||||||
assertEquals(3, returnValues.size());
|
assertEquals(3, returnValues.size());
|
||||||
|
|
||||||
returnValues = historyService.createHistoryQuery().newDataLike("456%").list();
|
returnValues = historyService.createHistoryQuery().newDataLike("456%").list();
|
||||||
assertEquals(3, returnValues.size());
|
assertEquals(3, returnValues.size());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
@Test
|
||||||
|
public void testSomeLikeMethods() {
|
||||||
|
List<HistoryEventImpl> returnValues =
|
||||||
|
historyService.createHistoryQuery().businessProcessIdLike("BPI:0%").list();
|
||||||
|
assertEquals(3, returnValues.size());
|
||||||
|
|
||||||
@Test
|
returnValues =
|
||||||
public void testSomeLikeMethods() {
|
historyService.createHistoryQuery().parentBusinessProcessIdLike("BPI:01", " %").list();
|
||||||
List<HistoryEventImpl> returnValues = historyService.createHistoryQuery()
|
assertEquals(1, returnValues.size());
|
||||||
.businessProcessIdLike("BPI:0%")
|
|
||||||
.list();
|
|
||||||
assertEquals(3, returnValues.size());
|
|
||||||
|
|
||||||
returnValues = historyService.createHistoryQuery().parentBusinessProcessIdLike("BPI:01", " %").list();
|
returnValues = historyService.createHistoryQuery().taskIdLike("TKI:000000000000000%").list();
|
||||||
assertEquals(1, returnValues.size());
|
assertEquals(3, returnValues.size());
|
||||||
|
|
||||||
returnValues = historyService.createHistoryQuery().taskIdLike("TKI:000000000000000%").list();
|
returnValues = historyService.createHistoryQuery().oldValueLike("old%").list();
|
||||||
assertEquals(3, returnValues.size());
|
assertEquals(1, returnValues.size());
|
||||||
|
|
||||||
returnValues = historyService.createHistoryQuery().oldValueLike("old%").list();
|
returnValues = historyService.createHistoryQuery().newValueLike("new_%").list();
|
||||||
assertEquals(1, returnValues.size());
|
assertEquals(2, returnValues.size());
|
||||||
|
|
||||||
returnValues = historyService.createHistoryQuery().newValueLike("new_%").list();
|
returnValues = historyService.createHistoryQuery().oldDataLike("%23%").list();
|
||||||
assertEquals(2, returnValues.size());
|
assertEquals(3, returnValues.size());
|
||||||
|
|
||||||
returnValues = historyService.createHistoryQuery().oldDataLike("%23%").list();
|
returnValues = historyService.createHistoryQuery().newDataLike("456%").list();
|
||||||
assertEquals(3, returnValues.size());
|
assertEquals(3, returnValues.size());
|
||||||
|
}
|
||||||
|
|
||||||
returnValues = historyService.createHistoryQuery().newDataLike("456%").list();
|
@Test
|
||||||
assertEquals(3, returnValues.size());
|
public void testListValues() {
|
||||||
|
List<String> returnedList =
|
||||||
|
historyService.createHistoryQuery().listValues(HistoryQueryColumnName.ID, null);
|
||||||
|
assertEquals(3, returnedList.size());
|
||||||
|
|
||||||
}
|
returnedList =
|
||||||
|
historyService
|
||||||
|
.createHistoryQuery()
|
||||||
|
.listValues(HistoryQueryColumnName.BUSINESS_PROCESS_ID, null);
|
||||||
|
assertEquals(3, returnedList.size());
|
||||||
|
|
||||||
@Test
|
returnedList =
|
||||||
public void testListValues() {
|
historyService
|
||||||
List<String> returnedList = historyService.createHistoryQuery().listValues(HistoryQueryColumnName.ID, null);
|
.createHistoryQuery()
|
||||||
assertEquals(3, returnedList.size());
|
|
||||||
|
|
||||||
returnedList = historyService.createHistoryQuery().listValues(HistoryQueryColumnName.BUSINESS_PROCESS_ID, null);
|
|
||||||
assertEquals(3, returnedList.size());
|
|
||||||
|
|
||||||
returnedList = historyService.createHistoryQuery()
|
|
||||||
.listValues(HistoryQueryColumnName.PARENT_BUSINESS_PROCESS_ID, null);
|
.listValues(HistoryQueryColumnName.PARENT_BUSINESS_PROCESS_ID, null);
|
||||||
assertEquals(2, returnedList.size());
|
assertEquals(2, returnedList.size());
|
||||||
|
|
||||||
returnedList = historyService.createHistoryQuery().listValues(HistoryQueryColumnName.TASK_ID, null);
|
returnedList =
|
||||||
assertEquals(2, returnedList.size());
|
historyService.createHistoryQuery().listValues(HistoryQueryColumnName.TASK_ID, null);
|
||||||
|
assertEquals(2, returnedList.size());
|
||||||
|
|
||||||
returnedList = historyService.createHistoryQuery().listValues(HistoryQueryColumnName.EVENT_TYPE, null);
|
returnedList =
|
||||||
assertEquals(1, returnedList.size());
|
historyService.createHistoryQuery().listValues(HistoryQueryColumnName.EVENT_TYPE, null);
|
||||||
|
assertEquals(1, returnedList.size());
|
||||||
|
|
||||||
returnedList = historyService.createHistoryQuery().listValues(HistoryQueryColumnName.CREATED, null);
|
returnedList =
|
||||||
assertEquals(2, returnedList.size());
|
historyService.createHistoryQuery().listValues(HistoryQueryColumnName.CREATED, null);
|
||||||
|
assertEquals(2, returnedList.size());
|
||||||
|
|
||||||
returnedList = historyService.createHistoryQuery().listValues(HistoryQueryColumnName.USER_ID, null);
|
returnedList =
|
||||||
assertEquals(2, returnedList.size());
|
historyService.createHistoryQuery().listValues(HistoryQueryColumnName.USER_ID, null);
|
||||||
|
assertEquals(2, returnedList.size());
|
||||||
|
|
||||||
returnedList = historyService.createHistoryQuery().listValues(HistoryQueryColumnName.DOMAIN, null);
|
returnedList =
|
||||||
assertEquals(2, returnedList.size());
|
historyService.createHistoryQuery().listValues(HistoryQueryColumnName.DOMAIN, null);
|
||||||
|
assertEquals(2, returnedList.size());
|
||||||
|
|
||||||
returnedList = historyService.createHistoryQuery().listValues(HistoryQueryColumnName.WORKBASKET_KEY, null);
|
returnedList =
|
||||||
assertEquals(2, returnedList.size());
|
historyService.createHistoryQuery().listValues(HistoryQueryColumnName.WORKBASKET_KEY, null);
|
||||||
|
assertEquals(2, returnedList.size());
|
||||||
|
|
||||||
returnedList = historyService.createHistoryQuery().listValues(HistoryQueryColumnName.POR_COMPANY, null);
|
returnedList =
|
||||||
assertEquals(2, returnedList.size());
|
historyService.createHistoryQuery().listValues(HistoryQueryColumnName.POR_COMPANY, null);
|
||||||
|
assertEquals(2, returnedList.size());
|
||||||
|
|
||||||
returnedList = historyService.createHistoryQuery().listValues(HistoryQueryColumnName.POR_SYSTEM, null);
|
returnedList =
|
||||||
assertEquals(2, returnedList.size());
|
historyService.createHistoryQuery().listValues(HistoryQueryColumnName.POR_SYSTEM, null);
|
||||||
|
assertEquals(2, returnedList.size());
|
||||||
|
|
||||||
returnedList = historyService.createHistoryQuery().listValues(HistoryQueryColumnName.POR_INSTANCE, null);
|
returnedList =
|
||||||
assertEquals(2, returnedList.size());
|
historyService.createHistoryQuery().listValues(HistoryQueryColumnName.POR_INSTANCE, null);
|
||||||
|
assertEquals(2, returnedList.size());
|
||||||
|
|
||||||
returnedList = historyService.createHistoryQuery().listValues(HistoryQueryColumnName.POR_TYPE, null);
|
returnedList =
|
||||||
assertEquals(2, returnedList.size());
|
historyService.createHistoryQuery().listValues(HistoryQueryColumnName.POR_TYPE, null);
|
||||||
|
assertEquals(2, returnedList.size());
|
||||||
|
|
||||||
returnedList = historyService.createHistoryQuery().listValues(HistoryQueryColumnName.POR_VALUE, null);
|
returnedList =
|
||||||
assertEquals(2, returnedList.size());
|
historyService.createHistoryQuery().listValues(HistoryQueryColumnName.POR_VALUE, null);
|
||||||
|
assertEquals(2, returnedList.size());
|
||||||
|
|
||||||
returnedList = historyService.createHistoryQuery()
|
returnedList =
|
||||||
|
historyService
|
||||||
|
.createHistoryQuery()
|
||||||
.listValues(HistoryQueryColumnName.TASK_CLASSIFICATION_KEY, null);
|
.listValues(HistoryQueryColumnName.TASK_CLASSIFICATION_KEY, null);
|
||||||
assertEquals(2, returnedList.size());
|
assertEquals(2, returnedList.size());
|
||||||
|
|
||||||
returnedList = historyService.createHistoryQuery()
|
returnedList =
|
||||||
|
historyService
|
||||||
|
.createHistoryQuery()
|
||||||
.listValues(HistoryQueryColumnName.TASK_CLASSIFICATION_CATEGORY, null);
|
.listValues(HistoryQueryColumnName.TASK_CLASSIFICATION_CATEGORY, null);
|
||||||
assertEquals(2, returnedList.size());
|
assertEquals(2, returnedList.size());
|
||||||
|
|
||||||
returnedList = historyService.createHistoryQuery()
|
returnedList =
|
||||||
|
historyService
|
||||||
|
.createHistoryQuery()
|
||||||
.listValues(HistoryQueryColumnName.ATTACHMENT_CLASSIFICATION_KEY, null);
|
.listValues(HistoryQueryColumnName.ATTACHMENT_CLASSIFICATION_KEY, null);
|
||||||
assertEquals(2, returnedList.size());
|
assertEquals(2, returnedList.size());
|
||||||
|
|
||||||
returnedList = historyService.createHistoryQuery().listValues(HistoryQueryColumnName.COMMENT, null);
|
returnedList =
|
||||||
assertEquals(3, returnedList.size());
|
historyService.createHistoryQuery().listValues(HistoryQueryColumnName.COMMENT, null);
|
||||||
|
assertEquals(3, returnedList.size());
|
||||||
|
|
||||||
returnedList = historyService.createHistoryQuery().listValues(HistoryQueryColumnName.OLD_VALUE, null);
|
returnedList =
|
||||||
assertEquals(3, returnedList.size());
|
historyService.createHistoryQuery().listValues(HistoryQueryColumnName.OLD_VALUE, null);
|
||||||
|
assertEquals(3, returnedList.size());
|
||||||
|
|
||||||
returnedList = historyService.createHistoryQuery().listValues(HistoryQueryColumnName.NEW_VALUE, null);
|
returnedList =
|
||||||
assertEquals(3, returnedList.size());
|
historyService.createHistoryQuery().listValues(HistoryQueryColumnName.NEW_VALUE, null);
|
||||||
|
assertEquals(3, returnedList.size());
|
||||||
|
|
||||||
returnedList = historyService.createHistoryQuery().listValues(HistoryQueryColumnName.CUSTOM_1, null);
|
returnedList =
|
||||||
assertEquals(1, returnedList.size());
|
historyService.createHistoryQuery().listValues(HistoryQueryColumnName.CUSTOM_1, null);
|
||||||
|
assertEquals(1, returnedList.size());
|
||||||
|
|
||||||
returnedList = historyService.createHistoryQuery().listValues(HistoryQueryColumnName.CUSTOM_2, null);
|
returnedList =
|
||||||
assertEquals(2, returnedList.size());
|
historyService.createHistoryQuery().listValues(HistoryQueryColumnName.CUSTOM_2, null);
|
||||||
|
assertEquals(2, returnedList.size());
|
||||||
|
|
||||||
returnedList = historyService.createHistoryQuery().listValues(HistoryQueryColumnName.CUSTOM_3, null);
|
returnedList =
|
||||||
assertEquals(2, returnedList.size());
|
historyService.createHistoryQuery().listValues(HistoryQueryColumnName.CUSTOM_3, null);
|
||||||
|
assertEquals(2, returnedList.size());
|
||||||
|
|
||||||
returnedList = historyService.createHistoryQuery().listValues(HistoryQueryColumnName.CUSTOM_4, null);
|
returnedList =
|
||||||
assertEquals(2, returnedList.size());
|
historyService.createHistoryQuery().listValues(HistoryQueryColumnName.CUSTOM_4, null);
|
||||||
|
assertEquals(2, returnedList.size());
|
||||||
|
|
||||||
returnedList = historyService.createHistoryQuery().listValues(HistoryQueryColumnName.OLD_DATA, null);
|
returnedList =
|
||||||
assertEquals(2, returnedList.size());
|
historyService.createHistoryQuery().listValues(HistoryQueryColumnName.OLD_DATA, null);
|
||||||
|
assertEquals(2, returnedList.size());
|
||||||
returnedList = historyService.createHistoryQuery().listValues(HistoryQueryColumnName.NEW_DATA, null);
|
|
||||||
assertEquals(1, returnedList.size());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
returnedList =
|
||||||
|
historyService.createHistoryQuery().listValues(HistoryQueryColumnName.NEW_DATA, null);
|
||||||
|
assertEquals(1, returnedList.size());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,75 +6,69 @@ import java.io.StringReader;
|
||||||
import java.io.StringWriter;
|
import java.io.StringWriter;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
|
|
||||||
import org.apache.ibatis.jdbc.ScriptRunner;
|
import org.apache.ibatis.jdbc.ScriptRunner;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
/**
|
/** Set up the database's writer and generates data for tests. */
|
||||||
* Set up the database's writer and generates data for tests.
|
|
||||||
*/
|
|
||||||
public class DBWriter {
|
public class DBWriter {
|
||||||
|
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(DBWriter.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(DBWriter.class);
|
||||||
private static final String INSERTVALUES = "/sql/history-events.sql";
|
private static final String INSERTVALUES = "/sql/history-events.sql";
|
||||||
private StringWriter outWriter = new StringWriter();
|
private StringWriter outWriter = new StringWriter();
|
||||||
private PrintWriter logWriter;
|
private PrintWriter logWriter;
|
||||||
private StringWriter errorWriter;
|
private StringWriter errorWriter;
|
||||||
private PrintWriter errorLogWriter;
|
private PrintWriter errorLogWriter;
|
||||||
|
|
||||||
public DBWriter() {
|
public DBWriter() {
|
||||||
this.logWriter = new PrintWriter(this.outWriter);
|
this.logWriter = new PrintWriter(this.outWriter);
|
||||||
this.errorWriter = new StringWriter();
|
this.errorWriter = new StringWriter();
|
||||||
this.errorLogWriter = new PrintWriter(this.errorWriter);
|
this.errorLogWriter = new PrintWriter(this.errorWriter);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void generateTestData(DataSource dataSource) throws SQLException {
|
public void generateTestData(DataSource dataSource) throws SQLException {
|
||||||
ScriptRunner runner = null;
|
ScriptRunner runner = null;
|
||||||
try {
|
try {
|
||||||
runner = configScriptRunner(dataSource);
|
runner = configScriptRunner(dataSource);
|
||||||
runner.runScript(
|
runner.runScript(new InputStreamReader(this.getClass().getResourceAsStream(INSERTVALUES)));
|
||||||
new InputStreamReader(
|
} finally {
|
||||||
this.getClass().getResourceAsStream(INSERTVALUES)));
|
if (runner != null) {
|
||||||
} finally {
|
runner.closeConnection();
|
||||||
if (runner != null) {
|
}
|
||||||
runner.closeConnection();
|
LOGGER.debug(outWriter.toString());
|
||||||
}
|
if (!errorWriter.toString().trim().isEmpty()) {
|
||||||
LOGGER.debug(outWriter.toString());
|
LOGGER.error(errorWriter.toString());
|
||||||
if (!errorWriter.toString().trim().isEmpty()) {
|
}
|
||||||
LOGGER.error(errorWriter.toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void clearDB(DataSource dataSource) throws SQLException {
|
public void clearDB(DataSource dataSource) throws SQLException {
|
||||||
ScriptRunner runner = null;
|
ScriptRunner runner = null;
|
||||||
try {
|
try {
|
||||||
runner = configScriptRunner(dataSource);
|
runner = configScriptRunner(dataSource);
|
||||||
runner.runScript(new StringReader("DELETE FROM HISTORY_EVENTS;"));
|
runner.runScript(new StringReader("DELETE FROM HISTORY_EVENTS;"));
|
||||||
} finally {
|
} finally {
|
||||||
if (runner != null) {
|
if (runner != null) {
|
||||||
runner.closeConnection();
|
runner.closeConnection();
|
||||||
}
|
}
|
||||||
LOGGER.debug(outWriter.toString());
|
LOGGER.debug(outWriter.toString());
|
||||||
if (!errorWriter.toString().trim().isEmpty()) {
|
if (!errorWriter.toString().trim().isEmpty()) {
|
||||||
LOGGER.error(errorWriter.toString());
|
LOGGER.error(errorWriter.toString());
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private ScriptRunner configScriptRunner(DataSource dataSource) throws SQLException {
|
private ScriptRunner configScriptRunner(DataSource dataSource) throws SQLException {
|
||||||
Connection connection = dataSource.getConnection();
|
Connection connection = dataSource.getConnection();
|
||||||
LOGGER.debug(connection.getMetaData().toString());
|
LOGGER.debug(connection.getMetaData().toString());
|
||||||
ScriptRunner runner = new ScriptRunner(connection);
|
ScriptRunner runner = new ScriptRunner(connection);
|
||||||
runner.setStopOnError(true);
|
runner.setStopOnError(true);
|
||||||
runner.setLogWriter(this.logWriter);
|
runner.setLogWriter(this.logWriter);
|
||||||
runner.setErrorLogWriter(this.errorLogWriter);
|
runner.setErrorLogWriter(this.errorLogWriter);
|
||||||
runner.setStopOnError(true);
|
runner.setStopOnError(true);
|
||||||
runner.setLogWriter(this.logWriter);
|
runner.setLogWriter(this.logWriter);
|
||||||
runner.setErrorLogWriter(this.errorLogWriter);
|
runner.setErrorLogWriter(this.errorLogWriter);
|
||||||
return runner;
|
return runner;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,14 +2,12 @@ package configuration;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
|
import acceptance.AbstractAccTest;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import acceptance.AbstractAccTest;
|
|
||||||
import pro.taskana.TaskanaEngine;
|
import pro.taskana.TaskanaEngine;
|
||||||
import pro.taskana.configuration.TaskanaEngineConfiguration;
|
import pro.taskana.configuration.TaskanaEngineConfiguration;
|
||||||
|
|
||||||
|
|
@ -20,27 +18,25 @@ import pro.taskana.configuration.TaskanaEngineConfiguration;
|
||||||
*/
|
*/
|
||||||
public class TaskanaEngineConfigurationTest extends AbstractAccTest {
|
public class TaskanaEngineConfigurationTest extends AbstractAccTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCreateTaskanaEngine() throws SQLException {
|
public void testCreateTaskanaEngine() throws SQLException {
|
||||||
DataSource ds = getDataSource();
|
DataSource ds = getDataSource();
|
||||||
TaskanaEngineConfiguration taskEngineConfiguration = new TaskanaEngineConfiguration(ds, false,
|
TaskanaEngineConfiguration taskEngineConfiguration =
|
||||||
getSchemaName());
|
new TaskanaEngineConfiguration(ds, false, getSchemaName());
|
||||||
|
|
||||||
TaskanaEngine te = taskEngineConfiguration.buildTaskanaEngine();
|
TaskanaEngine te = taskEngineConfiguration.buildTaskanaEngine();
|
||||||
|
|
||||||
Assert.assertNotNull(te);
|
Assert.assertNotNull(te);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testCreateTaskanaHistoryEventWithNonDefaultSchemaName() throws SQLException {
|
|
||||||
resetDb("SOMECUSTOMSCHEMANAME");
|
|
||||||
long count = historyService.createHistoryQuery().workbasketKeyIn("wbKey1").count();
|
|
||||||
assertEquals(0, count);
|
|
||||||
historyService.create(
|
|
||||||
AbstractAccTest.createHistoryEvent("wbKey1", "taskId1", "type1", "Some comment", "wbKey2"));
|
|
||||||
count = historyService.createHistoryQuery().workbasketKeyIn("wbKey1").count();
|
|
||||||
assertEquals(1, count);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCreateTaskanaHistoryEventWithNonDefaultSchemaName() throws SQLException {
|
||||||
|
resetDb("SOMECUSTOMSCHEMANAME");
|
||||||
|
long count = historyService.createHistoryQuery().workbasketKeyIn("wbKey1").count();
|
||||||
|
assertEquals(0, count);
|
||||||
|
historyService.create(
|
||||||
|
AbstractAccTest.createHistoryEvent("wbKey1", "taskId1", "type1", "Some comment", "wbKey2"));
|
||||||
|
count = historyService.createHistoryQuery().workbasketKeyIn("wbKey1").count();
|
||||||
|
assertEquals(1, count);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@ import java.sql.SQLException;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
|
@ -27,50 +26,55 @@ import pro.taskana.simplehistory.impl.mappings.HistoryQueryMapper;
|
||||||
@RunWith(MockitoJUnitRunner.class)
|
@RunWith(MockitoJUnitRunner.class)
|
||||||
public class HistoryQueryImplTest {
|
public class HistoryQueryImplTest {
|
||||||
|
|
||||||
private HistoryQueryImpl historyQueryImpl;
|
private HistoryQueryImpl historyQueryImpl;
|
||||||
|
|
||||||
@Mock
|
@Mock private TaskanaHistoryEngineImpl taskanaHistoryEngineMock;
|
||||||
private TaskanaHistoryEngineImpl taskanaHistoryEngineMock;
|
|
||||||
|
|
||||||
@Mock
|
@Mock private HistoryQueryMapper historyQueryMock;
|
||||||
private HistoryQueryMapper historyQueryMock;
|
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setup() {
|
public void setup() {
|
||||||
historyQueryImpl = new HistoryQueryImpl(taskanaHistoryEngineMock, historyQueryMock);
|
historyQueryImpl = new HistoryQueryImpl(taskanaHistoryEngineMock, historyQueryMock);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testShouldReturnList() throws SQLException {
|
public void testShouldReturnList() throws SQLException {
|
||||||
List<HistoryEventImpl> returnList = new ArrayList<>();
|
List<HistoryEventImpl> returnList = new ArrayList<>();
|
||||||
returnList.add(createHistoryEvent("abcd", "T22", "car", "BV", "this was important", null));
|
returnList.add(createHistoryEvent("abcd", "T22", "car", "BV", "this was important", null));
|
||||||
TimeInterval interval = new TimeInterval(Instant.now().minusNanos(1000), Instant.now());
|
TimeInterval interval = new TimeInterval(Instant.now().minusNanos(1000), Instant.now());
|
||||||
|
|
||||||
doNothing().when(taskanaHistoryEngineMock).openConnection();
|
doNothing().when(taskanaHistoryEngineMock).openConnection();
|
||||||
doNothing().when(taskanaHistoryEngineMock).returnConnection();
|
doNothing().when(taskanaHistoryEngineMock).returnConnection();
|
||||||
doReturn(returnList).when(historyQueryMock).queryHistoryEvent(historyQueryImpl);
|
doReturn(returnList).when(historyQueryMock).queryHistoryEvent(historyQueryImpl);
|
||||||
|
|
||||||
List<HistoryEventImpl> result = historyQueryImpl
|
List<HistoryEventImpl> result =
|
||||||
|
historyQueryImpl
|
||||||
.taskIdIn("TKI:01")
|
.taskIdIn("TKI:01")
|
||||||
.workbasketKeyIn("T22", "some_long_long, long loooooooooooooooooooooooooooooooooooong String.")
|
.workbasketKeyIn(
|
||||||
|
"T22", "some_long_long, long loooooooooooooooooooooooooooooooooooong String.")
|
||||||
.userIdIn("BV")
|
.userIdIn("BV")
|
||||||
.commentLike("%as important")
|
.commentLike("%as important")
|
||||||
.createdWithin(interval)
|
.createdWithin(interval)
|
||||||
.list();
|
.list();
|
||||||
|
|
||||||
validateMockitoUsage();
|
validateMockitoUsage();
|
||||||
assertArrayEquals(returnList.toArray(), result.toArray());
|
assertArrayEquals(returnList.toArray(), result.toArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
private HistoryEventImpl createHistoryEvent(String taskId, String workbasketKey, String type, String userId,
|
private HistoryEventImpl createHistoryEvent(
|
||||||
String comment, Instant created) {
|
String taskId,
|
||||||
HistoryEventImpl he = new HistoryEventImpl();
|
String workbasketKey,
|
||||||
he.setTaskId(taskId);
|
String type,
|
||||||
he.setWorkbasketKey(workbasketKey);
|
String userId,
|
||||||
he.setEventType(type);
|
String comment,
|
||||||
he.setUserId(userId);
|
Instant created) {
|
||||||
he.setComment(comment);
|
HistoryEventImpl he = new HistoryEventImpl();
|
||||||
he.setCreated(created);
|
he.setTaskId(taskId);
|
||||||
return he;
|
he.setWorkbasketKey(workbasketKey);
|
||||||
}
|
he.setEventType(type);
|
||||||
|
he.setUserId(userId);
|
||||||
|
he.setComment(comment);
|
||||||
|
he.setCreated(created);
|
||||||
|
return he;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,10 +8,10 @@ import static org.mockito.Mockito.doReturn;
|
||||||
import static org.mockito.Mockito.times;
|
import static org.mockito.Mockito.times;
|
||||||
import static org.mockito.Mockito.verify;
|
import static org.mockito.Mockito.verify;
|
||||||
|
|
||||||
|
import acceptance.AbstractAccTest;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.ibatis.session.SqlSessionManager;
|
import org.apache.ibatis.session.SqlSessionManager;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
@ -25,7 +25,6 @@ import org.powermock.core.classloader.annotations.PowerMockIgnore;
|
||||||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||||
import org.powermock.modules.junit4.PowerMockRunner;
|
import org.powermock.modules.junit4.PowerMockRunner;
|
||||||
|
|
||||||
import acceptance.AbstractAccTest;
|
|
||||||
import pro.taskana.configuration.TaskanaEngineConfiguration;
|
import pro.taskana.configuration.TaskanaEngineConfiguration;
|
||||||
import pro.taskana.simplehistory.impl.mappings.HistoryEventMapper;
|
import pro.taskana.simplehistory.impl.mappings.HistoryEventMapper;
|
||||||
import pro.taskana.simplehistory.impl.mappings.HistoryQueryMapper;
|
import pro.taskana.simplehistory.impl.mappings.HistoryQueryMapper;
|
||||||
|
|
@ -40,83 +39,86 @@ import pro.taskana.simplehistory.impl.mappings.HistoryQueryMapper;
|
||||||
@PowerMockIgnore("javax.management.*")
|
@PowerMockIgnore("javax.management.*")
|
||||||
public class SimpleHistoryServiceImplTest {
|
public class SimpleHistoryServiceImplTest {
|
||||||
|
|
||||||
@InjectMocks
|
@InjectMocks private SimpleHistoryServiceImpl cutSpy;
|
||||||
private SimpleHistoryServiceImpl cutSpy;
|
|
||||||
|
|
||||||
@Mock
|
@Mock private HistoryEventMapper historyEventMapperMock;
|
||||||
private HistoryEventMapper historyEventMapperMock;
|
|
||||||
|
|
||||||
@Mock
|
@Mock private HistoryQueryMapper historyQueryMapperMock;
|
||||||
private HistoryQueryMapper historyQueryMapperMock;
|
|
||||||
|
|
||||||
@Mock
|
@Mock private TaskanaHistoryEngineImpl taskanaHistoryEngineMock;
|
||||||
private TaskanaHistoryEngineImpl taskanaHistoryEngineMock;
|
|
||||||
|
|
||||||
@Mock
|
@Mock private TaskanaEngineConfiguration taskanaEngineConfiguration;
|
||||||
private TaskanaEngineConfiguration taskanaEngineConfiguration;
|
|
||||||
|
|
||||||
@Mock
|
@Mock private SqlSessionManager sqlSessionManagerMock;
|
||||||
private SqlSessionManager sqlSessionManagerMock;
|
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setup() {
|
public void setup() {
|
||||||
MockitoAnnotations.initMocks(this);
|
MockitoAnnotations.initMocks(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testInitializeSimpleHistoryService() throws SQLException {
|
public void testInitializeSimpleHistoryService() throws SQLException {
|
||||||
doReturn(historyEventMapperMock).when(sqlSessionManagerMock).getMapper(HistoryEventMapper.class);
|
doReturn(historyEventMapperMock)
|
||||||
doReturn(historyQueryMapperMock).when(sqlSessionManagerMock).getMapper(HistoryQueryMapper.class);
|
.when(sqlSessionManagerMock)
|
||||||
doReturn(sqlSessionManagerMock).when(taskanaHistoryEngineMock).getSqlSession();
|
.getMapper(HistoryEventMapper.class);
|
||||||
PowerMockito.mockStatic(TaskanaHistoryEngineImpl.class);
|
doReturn(historyQueryMapperMock)
|
||||||
Mockito.when(TaskanaHistoryEngineImpl.createTaskanaEngine(taskanaEngineConfiguration))
|
.when(sqlSessionManagerMock)
|
||||||
.thenReturn(taskanaHistoryEngineMock);
|
.getMapper(HistoryQueryMapper.class);
|
||||||
cutSpy.initialize(taskanaEngineConfiguration);
|
doReturn(sqlSessionManagerMock).when(taskanaHistoryEngineMock).getSqlSession();
|
||||||
|
PowerMockito.mockStatic(TaskanaHistoryEngineImpl.class);
|
||||||
|
Mockito.when(TaskanaHistoryEngineImpl.createTaskanaEngine(taskanaEngineConfiguration))
|
||||||
|
.thenReturn(taskanaHistoryEngineMock);
|
||||||
|
cutSpy.initialize(taskanaEngineConfiguration);
|
||||||
|
|
||||||
verify(sqlSessionManagerMock, times(2)).getMapper(any());
|
verify(sqlSessionManagerMock, times(2)).getMapper(any());
|
||||||
verify(taskanaHistoryEngineMock, times(2)).getSqlSession();
|
verify(taskanaHistoryEngineMock, times(2)).getSqlSession();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testInitializeSimpleHistoryServiceWithNonDefaultSchemaName() throws SQLException {
|
public void testInitializeSimpleHistoryServiceWithNonDefaultSchemaName() throws SQLException {
|
||||||
|
|
||||||
doReturn(historyEventMapperMock).when(sqlSessionManagerMock).getMapper(HistoryEventMapper.class);
|
doReturn(historyEventMapperMock)
|
||||||
doReturn(historyQueryMapperMock).when(sqlSessionManagerMock).getMapper(HistoryQueryMapper.class);
|
.when(sqlSessionManagerMock)
|
||||||
doReturn(sqlSessionManagerMock).when(taskanaHistoryEngineMock).getSqlSession();
|
.getMapper(HistoryEventMapper.class);
|
||||||
PowerMockito.mockStatic(TaskanaHistoryEngineImpl.class);
|
doReturn(historyQueryMapperMock)
|
||||||
Mockito.when(TaskanaHistoryEngineImpl.createTaskanaEngine(taskanaEngineConfiguration))
|
.when(sqlSessionManagerMock)
|
||||||
.thenReturn(taskanaHistoryEngineMock);
|
.getMapper(HistoryQueryMapper.class);
|
||||||
cutSpy.initialize(taskanaEngineConfiguration);
|
doReturn(sqlSessionManagerMock).when(taskanaHistoryEngineMock).getSqlSession();
|
||||||
|
PowerMockito.mockStatic(TaskanaHistoryEngineImpl.class);
|
||||||
|
Mockito.when(TaskanaHistoryEngineImpl.createTaskanaEngine(taskanaEngineConfiguration))
|
||||||
|
.thenReturn(taskanaHistoryEngineMock);
|
||||||
|
cutSpy.initialize(taskanaEngineConfiguration);
|
||||||
|
|
||||||
verify(sqlSessionManagerMock, times(2)).getMapper(any());
|
verify(sqlSessionManagerMock, times(2)).getMapper(any());
|
||||||
verify(taskanaHistoryEngineMock, times(2)).getSqlSession();
|
verify(taskanaHistoryEngineMock, times(2)).getSqlSession();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCreateEvent() throws SQLException {
|
public void testCreateEvent() throws SQLException {
|
||||||
HistoryEventImpl expectedWb = AbstractAccTest.createHistoryEvent("wbKey1", "taskId1", "type1", "Some comment",
|
HistoryEventImpl expectedWb =
|
||||||
"wbKey2");
|
AbstractAccTest.createHistoryEvent("wbKey1", "taskId1", "type1", "Some comment", "wbKey2");
|
||||||
doNothing().when(historyEventMapperMock).insert(expectedWb);
|
doNothing().when(historyEventMapperMock).insert(expectedWb);
|
||||||
|
|
||||||
cutSpy.create(expectedWb);
|
cutSpy.create(expectedWb);
|
||||||
verify(taskanaHistoryEngineMock, times(1)).openConnection();
|
verify(taskanaHistoryEngineMock, times(1)).openConnection();
|
||||||
verify(historyEventMapperMock, times(1)).insert(expectedWb);
|
verify(historyEventMapperMock, times(1)).insert(expectedWb);
|
||||||
verify(taskanaHistoryEngineMock, times(1)).returnConnection();
|
verify(taskanaHistoryEngineMock, times(1)).returnConnection();
|
||||||
assertNotNull(expectedWb.getCreated());
|
assertNotNull(expectedWb.getCreated());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testQueryEvent() throws SQLException {
|
public void testQueryEvent() throws SQLException {
|
||||||
List<HistoryEventImpl> returnList = new ArrayList<>();
|
List<HistoryEventImpl> returnList = new ArrayList<>();
|
||||||
returnList.add(AbstractAccTest.createHistoryEvent("wbKey1", "taskId1", "type1", "Some comment", "wbKey2"));
|
returnList.add(
|
||||||
doReturn(returnList).when(historyQueryMapperMock).queryHistoryEvent(any());
|
AbstractAccTest.createHistoryEvent("wbKey1", "taskId1", "type1", "Some comment", "wbKey2"));
|
||||||
|
doReturn(returnList).when(historyQueryMapperMock).queryHistoryEvent(any());
|
||||||
|
|
||||||
List<HistoryEventImpl> result = cutSpy.createHistoryQuery().taskIdIn("taskId1").list();
|
List<HistoryEventImpl> result = cutSpy.createHistoryQuery().taskIdIn("taskId1").list();
|
||||||
|
|
||||||
verify(taskanaHistoryEngineMock, times(1)).openConnection();
|
verify(taskanaHistoryEngineMock, times(1)).openConnection();
|
||||||
verify(historyQueryMapperMock, times(1)).queryHistoryEvent(any());
|
verify(historyQueryMapperMock, times(1)).queryHistoryEvent(any());
|
||||||
verify(taskanaHistoryEngineMock, times(1)).returnConnection();
|
verify(taskanaHistoryEngineMock, times(1)).returnConnection();
|
||||||
assertEquals(returnList.size(), result.size());
|
assertEquals(returnList.size(), result.size());
|
||||||
assertEquals(returnList.get(0).getWorkbasketKey(), result.get(0).getWorkbasketKey());
|
assertEquals(returnList.get(0).getWorkbasketKey(), result.get(0).getWorkbasketKey());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,7 @@
|
||||||
package rest.pro.taskana.rest.simplehistory;
|
package rest.pro.taskana.rest.simplehistory;
|
||||||
|
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
@ -20,47 +18,47 @@ import org.springframework.transaction.PlatformTransactionManager;
|
||||||
import pro.taskana.rest.simplehistory.TaskHistoryRestConfiguration;
|
import pro.taskana.rest.simplehistory.TaskHistoryRestConfiguration;
|
||||||
import pro.taskana.rest.simplehistory.sampledata.SampleDataGenerator;
|
import pro.taskana.rest.simplehistory.sampledata.SampleDataGenerator;
|
||||||
|
|
||||||
/**
|
/** Example Application showing the implementation of taskana-rest-spring. */
|
||||||
* Example Application showing the implementation of taskana-rest-spring.
|
|
||||||
*/
|
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
@ComponentScan(basePackages = "pro.taskana.rest.simplehistory")
|
@ComponentScan(basePackages = "pro.taskana.rest.simplehistory")
|
||||||
@Import({TaskHistoryRestConfiguration.class, WebMvcConfig.class})
|
@Import({TaskHistoryRestConfiguration.class, WebMvcConfig.class})
|
||||||
public class ExampleRestApplication {
|
public class ExampleRestApplication {
|
||||||
|
|
||||||
@Value("${taskana.schemaName:TASKANA}")
|
@Value("${taskana.schemaName:TASKANA}")
|
||||||
public String schemaName;
|
public String schemaName;
|
||||||
|
|
||||||
private SampleDataGenerator sampleDataGenerator;
|
private SampleDataGenerator sampleDataGenerator;
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
SpringApplication.run(ExampleRestApplication.class, args);
|
SpringApplication.run(ExampleRestApplication.class, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@Primary
|
@Primary
|
||||||
@ConfigurationProperties(prefix = "datasource")
|
@ConfigurationProperties(prefix = "datasource")
|
||||||
public DataSourceProperties dataSourceProperties() {
|
public DataSourceProperties dataSourceProperties() {
|
||||||
DataSourceProperties props = new DataSourceProperties();
|
DataSourceProperties props = new DataSourceProperties();
|
||||||
props.setUrl("jdbc:h2:mem:taskana;IGNORECASE=TRUE;LOCK_MODE=0;INIT=CREATE SCHEMA IF NOT EXISTS " + schemaName);
|
props.setUrl(
|
||||||
return props;
|
"jdbc:h2:mem:taskana;IGNORECASE=TRUE;LOCK_MODE=0;INIT=CREATE SCHEMA IF NOT EXISTS "
|
||||||
}
|
+ schemaName);
|
||||||
|
return props;
|
||||||
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public DataSource dataSource(DataSourceProperties properties) {
|
public DataSource dataSource(DataSourceProperties properties) {
|
||||||
return properties.initializeDataSourceBuilder().build();
|
return properties.initializeDataSourceBuilder().build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public PlatformTransactionManager txManager(DataSource dataSource) {
|
public PlatformTransactionManager txManager(DataSource dataSource) {
|
||||||
return new DataSourceTransactionManager(dataSource);
|
return new DataSourceTransactionManager(dataSource);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@DependsOn("getTaskanaEngine") // generate sample data after schema was inserted
|
@DependsOn("getTaskanaEngine") // generate sample data after schema was inserted
|
||||||
public SampleDataGenerator generateSampleData(DataSource dataSource) throws SQLException {
|
public SampleDataGenerator generateSampleData(DataSource dataSource) throws SQLException {
|
||||||
sampleDataGenerator = new SampleDataGenerator(dataSource);
|
sampleDataGenerator = new SampleDataGenerator(dataSource);
|
||||||
sampleDataGenerator.generateSampleData(schemaName);
|
sampleDataGenerator.generateSampleData(schemaName);
|
||||||
return sampleDataGenerator;
|
return sampleDataGenerator;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
package rest.pro.taskana.rest.simplehistory;
|
package rest.pro.taskana.rest.simplehistory;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.http.converter.HttpMessageConverter;
|
import org.springframework.http.converter.HttpMessageConverter;
|
||||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
||||||
|
|
@ -11,50 +11,47 @@ import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
||||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
/** The Web MVC Configuration. */
|
||||||
import com.fasterxml.jackson.databind.SerializationFeature;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The Web MVC Configuration.
|
|
||||||
*/
|
|
||||||
@Configuration
|
@Configuration
|
||||||
@EnableWebMvc
|
@EnableWebMvc
|
||||||
public class WebMvcConfig implements WebMvcConfigurer {
|
public class WebMvcConfig implements WebMvcConfigurer {
|
||||||
|
|
||||||
private static final String[] CLASSPATH_RESOURCE_LOCATIONS = {
|
private static final String[] CLASSPATH_RESOURCE_LOCATIONS = {
|
||||||
"classpath:/META-INF/resources/", "classpath:/resources/",
|
"classpath:/META-INF/resources/", "classpath:/resources/",
|
||||||
"classpath:/static/", "classpath:/public/"};
|
"classpath:/static/", "classpath:/public/"
|
||||||
|
};
|
||||||
|
|
||||||
private ObjectMapper objectMapper;
|
private ObjectMapper objectMapper;
|
||||||
|
|
||||||
WebMvcConfig(ObjectMapper objectMapper) {
|
WebMvcConfig(ObjectMapper objectMapper) {
|
||||||
this.objectMapper = objectMapper;
|
this.objectMapper = objectMapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||||
|
if (!registry.hasMappingForPattern("/webjars/**")) {
|
||||||
|
registry
|
||||||
|
.addResourceHandler("/webjars/**")
|
||||||
|
.addResourceLocations("classpath:/META-INF/resources/webjars/");
|
||||||
}
|
}
|
||||||
|
if (!registry.hasMappingForPattern("/**")) {
|
||||||
@Override
|
registry.addResourceHandler("/**").addResourceLocations(CLASSPATH_RESOURCE_LOCATIONS);
|
||||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
|
||||||
if (!registry.hasMappingForPattern("/webjars/**")) {
|
|
||||||
registry.addResourceHandler("/webjars/**").addResourceLocations(
|
|
||||||
"classpath:/META-INF/resources/webjars/");
|
|
||||||
}
|
|
||||||
if (!registry.hasMappingForPattern("/**")) {
|
|
||||||
registry.addResourceHandler("/**").addResourceLocations(
|
|
||||||
CLASSPATH_RESOURCE_LOCATIONS);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void extendMessageConverters(List<HttpMessageConverter<?>> converters) {
|
public void extendMessageConverters(List<HttpMessageConverter<?>> converters) {
|
||||||
for (HttpMessageConverter<?> converter : converters) {
|
for (HttpMessageConverter<?> converter : converters) {
|
||||||
if (converter instanceof MappingJackson2HttpMessageConverter) {
|
if (converter instanceof MappingJackson2HttpMessageConverter) {
|
||||||
MappingJackson2HttpMessageConverter jacksonConverter = (MappingJackson2HttpMessageConverter) converter;
|
MappingJackson2HttpMessageConverter jacksonConverter =
|
||||||
jacksonConverter.setPrettyPrint(true);
|
(MappingJackson2HttpMessageConverter) converter;
|
||||||
}
|
jacksonConverter.setPrettyPrint(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void enableObjectIndent() {
|
public void enableObjectIndent() {
|
||||||
objectMapper.enable(SerializationFeature.INDENT_OUTPUT);
|
objectMapper.enable(SerializationFeature.INDENT_OUTPUT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,24 +6,23 @@ import org.springframework.hateoas.mvc.ResourceAssemblerSupport;
|
||||||
import pro.taskana.history.api.TaskanaHistoryEvent;
|
import pro.taskana.history.api.TaskanaHistoryEvent;
|
||||||
import pro.taskana.simplehistory.impl.HistoryEventImpl;
|
import pro.taskana.simplehistory.impl.HistoryEventImpl;
|
||||||
|
|
||||||
/**
|
/** Transforms any {@link HistoryEventImpl} into its {@link TaskHistoryEventResource}. */
|
||||||
* Transforms any {@link HistoryEventImpl} into its {@link TaskHistoryEventResource}.
|
public class TaskHistoryEventAssembler
|
||||||
*/
|
extends ResourceAssemblerSupport<TaskanaHistoryEvent, TaskHistoryEventResource> {
|
||||||
public class TaskHistoryEventAssembler extends ResourceAssemblerSupport<TaskanaHistoryEvent, TaskHistoryEventResource> {
|
|
||||||
|
|
||||||
public TaskHistoryEventAssembler() {
|
public TaskHistoryEventAssembler() {
|
||||||
super(HistoryEventImpl.class, TaskHistoryEventResource.class);
|
super(HistoryEventImpl.class, TaskHistoryEventResource.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TaskHistoryEventResource toResource(TaskanaHistoryEvent historyEvent) {
|
public TaskHistoryEventResource toResource(TaskanaHistoryEvent historyEvent) {
|
||||||
TaskHistoryEventResource resource = createResourceWithId(historyEvent.getId(), historyEvent);
|
TaskHistoryEventResource resource = createResourceWithId(historyEvent.getId(), historyEvent);
|
||||||
BeanUtils.copyProperties(historyEvent, resource);
|
BeanUtils.copyProperties(historyEvent, resource);
|
||||||
if (historyEvent.getCreated() != null) {
|
if (historyEvent.getCreated() != null) {
|
||||||
resource.setCreated(historyEvent.getCreated().toString());
|
resource.setCreated(historyEvent.getCreated().toString());
|
||||||
}
|
|
||||||
resource.setTaskHistoryId(String.valueOf(historyEvent.getId()));
|
|
||||||
resource.removeLinks();
|
|
||||||
return resource;
|
|
||||||
}
|
}
|
||||||
|
resource.setTaskHistoryId(String.valueOf(historyEvent.getId()));
|
||||||
|
resource.removeLinks();
|
||||||
|
return resource;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,48 +3,45 @@ package pro.taskana.rest.resource;
|
||||||
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo;
|
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.springframework.hateoas.Link;
|
import org.springframework.hateoas.Link;
|
||||||
|
|
||||||
import pro.taskana.rest.resource.PagedResources.PageMetadata;
|
import pro.taskana.rest.resource.PagedResources.PageMetadata;
|
||||||
import pro.taskana.rest.simplehistory.TaskHistoryEventController;
|
import pro.taskana.rest.simplehistory.TaskHistoryEventController;
|
||||||
import pro.taskana.simplehistory.impl.HistoryEventImpl;
|
import pro.taskana.simplehistory.impl.HistoryEventImpl;
|
||||||
|
|
||||||
/**
|
/** Mapper to convert from a list of HistoryEventImpl to a TaskHistoryEventResource. */
|
||||||
* Mapper to convert from a list of HistoryEventImpl to a TaskHistoryEventResource.
|
|
||||||
*/
|
|
||||||
public class TaskHistoryEventListAssembler extends AbstractRessourcesAssembler {
|
public class TaskHistoryEventListAssembler extends AbstractRessourcesAssembler {
|
||||||
|
|
||||||
public TaskHistoryEventListAssembler() {
|
public TaskHistoryEventListAssembler() {}
|
||||||
|
|
||||||
|
public TaskHistoryEventListResource toResources(
|
||||||
|
List<HistoryEventImpl> historyEvents, PageMetadata pageMetadata) {
|
||||||
|
|
||||||
|
TaskHistoryEventAssembler assembler = new TaskHistoryEventAssembler();
|
||||||
|
List<TaskHistoryEventResource> resources = assembler.toResources(historyEvents);
|
||||||
|
TaskHistoryEventListResource pagedResources =
|
||||||
|
new TaskHistoryEventListResource(resources, pageMetadata);
|
||||||
|
|
||||||
|
pagedResources.add(new Link(original.toUriString()).withSelfRel());
|
||||||
|
if (pageMetadata != null) {
|
||||||
|
pagedResources.add(linkTo(TaskHistoryEventController.class).withRel("allTaskHistoryEvent"));
|
||||||
|
pagedResources.add(
|
||||||
|
new Link(original.replaceQueryParam("page", 1).toUriString()).withRel(Link.REL_FIRST));
|
||||||
|
pagedResources.add(
|
||||||
|
new Link(original.replaceQueryParam("page", pageMetadata.getTotalPages()).toUriString())
|
||||||
|
.withRel(Link.REL_LAST));
|
||||||
|
if (pageMetadata.getNumber() > 1) {
|
||||||
|
pagedResources.add(
|
||||||
|
new Link(original.replaceQueryParam("page", pageMetadata.getNumber() - 1).toUriString())
|
||||||
|
.withRel(Link.REL_PREVIOUS));
|
||||||
|
}
|
||||||
|
if (pageMetadata.getNumber() < pageMetadata.getTotalPages()) {
|
||||||
|
pagedResources.add(
|
||||||
|
new Link(original.replaceQueryParam("page", pageMetadata.getNumber() + 1).toUriString())
|
||||||
|
.withRel(Link.REL_NEXT));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public TaskHistoryEventListResource toResources(List<HistoryEventImpl> historyEvents,
|
return pagedResources;
|
||||||
PageMetadata pageMetadata) {
|
}
|
||||||
|
|
||||||
TaskHistoryEventAssembler assembler = new TaskHistoryEventAssembler();
|
|
||||||
List<TaskHistoryEventResource> resources = assembler.toResources(historyEvents);
|
|
||||||
TaskHistoryEventListResource pagedResources = new TaskHistoryEventListResource(
|
|
||||||
resources,
|
|
||||||
pageMetadata);
|
|
||||||
|
|
||||||
pagedResources.add(new Link(original.toUriString()).withSelfRel());
|
|
||||||
if (pageMetadata != null) {
|
|
||||||
pagedResources.add(linkTo(TaskHistoryEventController.class).withRel("allTaskHistoryEvent"));
|
|
||||||
pagedResources.add(new Link(original.replaceQueryParam("page", 1).toUriString()).withRel(Link.REL_FIRST));
|
|
||||||
pagedResources.add(new Link(original.replaceQueryParam("page", pageMetadata.getTotalPages()).toUriString())
|
|
||||||
.withRel(Link.REL_LAST));
|
|
||||||
if (pageMetadata.getNumber() > 1) {
|
|
||||||
pagedResources
|
|
||||||
.add(new Link(original.replaceQueryParam("page", pageMetadata.getNumber() - 1).toUriString())
|
|
||||||
.withRel(Link.REL_PREVIOUS));
|
|
||||||
}
|
|
||||||
if (pageMetadata.getNumber() < pageMetadata.getTotalPages()) {
|
|
||||||
pagedResources
|
|
||||||
.add(new Link(original.replaceQueryParam("page", pageMetadata.getNumber() + 1).toUriString())
|
|
||||||
.withRel(Link.REL_NEXT));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return pagedResources;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,34 +1,29 @@
|
||||||
package pro.taskana.rest.resource;
|
package pro.taskana.rest.resource;
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
import org.springframework.hateoas.Link;
|
|
||||||
import org.springframework.hateoas.PagedResources.PageMetadata;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import java.util.Collection;
|
||||||
|
import org.springframework.hateoas.Link;
|
||||||
|
|
||||||
/**
|
/** Resource class for {@link TaskHistoryEventResource} with Pagination. */
|
||||||
* Resource class for {@link TaskHistoryEventResource} with Pagination.
|
|
||||||
*/
|
|
||||||
public class TaskHistoryEventListResource extends PagedResources<TaskHistoryEventResource> {
|
public class TaskHistoryEventListResource extends PagedResources<TaskHistoryEventResource> {
|
||||||
|
|
||||||
public TaskHistoryEventListResource() {
|
public TaskHistoryEventListResource() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public TaskHistoryEventListResource(Collection<TaskHistoryEventResource> content, PageMetadata metadata,
|
public TaskHistoryEventListResource(
|
||||||
Link... links) {
|
Collection<TaskHistoryEventResource> content, PageMetadata metadata, Link... links) {
|
||||||
super(content, metadata, links);
|
super(content, metadata, links);
|
||||||
}
|
}
|
||||||
|
|
||||||
public TaskHistoryEventListResource(Collection<TaskHistoryEventResource> content, PageMetadata metadata,
|
public TaskHistoryEventListResource(
|
||||||
Iterable<Link> links) {
|
Collection<TaskHistoryEventResource> content, PageMetadata metadata, Iterable<Link> links) {
|
||||||
super(content, metadata, links);
|
super(content, metadata, links);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@JsonProperty("taskHistoryEvents")
|
@JsonProperty("taskHistoryEvents")
|
||||||
public Collection<TaskHistoryEventResource> getContent() {
|
public Collection<TaskHistoryEventResource> getContent() {
|
||||||
return super.getContent();
|
return super.getContent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,266 +1,275 @@
|
||||||
package pro.taskana.rest.resource;
|
package pro.taskana.rest.resource;
|
||||||
|
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
import org.springframework.hateoas.ResourceSupport;
|
import org.springframework.hateoas.ResourceSupport;
|
||||||
|
|
||||||
/**
|
/** Resource class for {@link pro.taskana.history.api.TaskanaHistoryEvent}. */
|
||||||
* Resource class for {@link pro.taskana.history.api.TaskanaHistoryEvent}.
|
|
||||||
*/
|
|
||||||
public class TaskHistoryEventResource extends ResourceSupport {
|
public class TaskHistoryEventResource extends ResourceSupport {
|
||||||
@NotNull
|
@NotNull private String taskHistoryEventId;
|
||||||
private String taskHistoryEventId;
|
|
||||||
|
|
||||||
private String businessProcessId;
|
private String businessProcessId;
|
||||||
private String parentBusinessProcessId;
|
private String parentBusinessProcessId;
|
||||||
private String taskId;
|
private String taskId;
|
||||||
private String eventType;
|
private String eventType;
|
||||||
private String created;
|
private String created;
|
||||||
private String userId;
|
private String userId;
|
||||||
private String domain;
|
private String domain;
|
||||||
private String workbasketKey;
|
private String workbasketKey;
|
||||||
private String porCompany;
|
private String porCompany;
|
||||||
private String porType;
|
private String porType;
|
||||||
private String porSystem;
|
private String porSystem;
|
||||||
private String porInstance;
|
private String porInstance;
|
||||||
private String porValue;
|
private String porValue;
|
||||||
private String taskClassificationKey;
|
private String taskClassificationKey;
|
||||||
private String taskClassificationCategory;
|
private String taskClassificationCategory;
|
||||||
private String attachmentClassificationKey;
|
private String attachmentClassificationKey;
|
||||||
private String comment;
|
private String comment;
|
||||||
private String oldValue;
|
private String oldValue;
|
||||||
private String newValue;
|
private String newValue;
|
||||||
private String custom1;
|
private String custom1;
|
||||||
private String custom2;
|
private String custom2;
|
||||||
private String custom3;
|
private String custom3;
|
||||||
private String custom4;
|
private String custom4;
|
||||||
private String oldData;
|
private String oldData;
|
||||||
private String newData;
|
private String newData;
|
||||||
|
|
||||||
public String getTaskHistoryId() {
|
public String getTaskHistoryId() {
|
||||||
return taskHistoryEventId;
|
return taskHistoryEventId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTaskHistoryId(String taskHistoryId) {
|
public void setTaskHistoryId(String taskHistoryId) {
|
||||||
this.taskHistoryEventId = taskHistoryId;
|
this.taskHistoryEventId = taskHistoryId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getBusinessProcessId() {
|
public String getBusinessProcessId() {
|
||||||
return businessProcessId;
|
return businessProcessId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBusinessProcessId(String businessProcessId) {
|
public void setBusinessProcessId(String businessProcessId) {
|
||||||
this.businessProcessId = businessProcessId;
|
this.businessProcessId = businessProcessId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getParentBusinessProcessId() {
|
public String getParentBusinessProcessId() {
|
||||||
return parentBusinessProcessId;
|
return parentBusinessProcessId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setParentBusinessProcessId(String parentBusinessProcessId) {
|
public void setParentBusinessProcessId(String parentBusinessProcessId) {
|
||||||
this.parentBusinessProcessId = parentBusinessProcessId;
|
this.parentBusinessProcessId = parentBusinessProcessId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTaskId() {
|
public String getTaskId() {
|
||||||
return taskId;
|
return taskId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTaskId(String taskId) {
|
public void setTaskId(String taskId) {
|
||||||
this.taskId = taskId;
|
this.taskId = taskId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getEventType() {
|
public String getEventType() {
|
||||||
return eventType;
|
return eventType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEventType(String eventType) {
|
public void setEventType(String eventType) {
|
||||||
this.eventType = eventType;
|
this.eventType = eventType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCreated() {
|
public String getCreated() {
|
||||||
return created;
|
return created;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCreated(String created) {
|
public void setCreated(String created) {
|
||||||
this.created = created;
|
this.created = created;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUserId() {
|
public String getUserId() {
|
||||||
return userId;
|
return userId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUserId(String userId) {
|
public void setUserId(String userId) {
|
||||||
this.userId = userId;
|
this.userId = userId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDomain() {
|
public String getDomain() {
|
||||||
return domain;
|
return domain;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDomain(String domain) {
|
public void setDomain(String domain) {
|
||||||
this.domain = domain;
|
this.domain = domain;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getWorkbasketKey() {
|
public String getWorkbasketKey() {
|
||||||
return workbasketKey;
|
return workbasketKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setWorkbasketKey(String workbasketKey) {
|
public void setWorkbasketKey(String workbasketKey) {
|
||||||
this.workbasketKey = workbasketKey;
|
this.workbasketKey = workbasketKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPorCompany() {
|
public String getPorCompany() {
|
||||||
return porCompany;
|
return porCompany;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPorCompany(String porCompany) {
|
public void setPorCompany(String porCompany) {
|
||||||
this.porCompany = porCompany;
|
this.porCompany = porCompany;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPorType() {
|
public String getPorType() {
|
||||||
return porType;
|
return porType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPorType(String porType) {
|
public void setPorType(String porType) {
|
||||||
this.porType = porType;
|
this.porType = porType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPorSystem() {
|
public String getPorSystem() {
|
||||||
return porSystem;
|
return porSystem;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPorSystem(String porSystem) {
|
public void setPorSystem(String porSystem) {
|
||||||
this.porSystem = porSystem;
|
this.porSystem = porSystem;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPorInstance() {
|
public String getPorInstance() {
|
||||||
return porInstance;
|
return porInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPorInstance(String porInstance) {
|
public void setPorInstance(String porInstance) {
|
||||||
this.porInstance = porInstance;
|
this.porInstance = porInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPorValue() {
|
public String getPorValue() {
|
||||||
return porValue;
|
return porValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPorValue(String porValue) {
|
public void setPorValue(String porValue) {
|
||||||
this.porValue = porValue;
|
this.porValue = porValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTaskClassificationKey() {
|
public String getTaskClassificationKey() {
|
||||||
return taskClassificationKey;
|
return taskClassificationKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTaskClassificationKey(String taskClassificationKey) {
|
public void setTaskClassificationKey(String taskClassificationKey) {
|
||||||
this.taskClassificationKey = taskClassificationKey;
|
this.taskClassificationKey = taskClassificationKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTaskClassificationCategory() {
|
public String getTaskClassificationCategory() {
|
||||||
return taskClassificationCategory;
|
return taskClassificationCategory;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTaskClassificationCategory(String taskClassificationCategory) {
|
public void setTaskClassificationCategory(String taskClassificationCategory) {
|
||||||
this.taskClassificationCategory = taskClassificationCategory;
|
this.taskClassificationCategory = taskClassificationCategory;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAttachmentClassificationKey() {
|
public String getAttachmentClassificationKey() {
|
||||||
return attachmentClassificationKey;
|
return attachmentClassificationKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAttachmentClassificationKey(String attachmentClassificationKey) {
|
public void setAttachmentClassificationKey(String attachmentClassificationKey) {
|
||||||
this.attachmentClassificationKey = attachmentClassificationKey;
|
this.attachmentClassificationKey = attachmentClassificationKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getComment() {
|
public String getComment() {
|
||||||
return comment;
|
return comment;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setComment(String comment) {
|
public void setComment(String comment) {
|
||||||
this.comment = comment;
|
this.comment = comment;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getOldValue() {
|
public String getOldValue() {
|
||||||
return oldValue;
|
return oldValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOldValue(String oldValue) {
|
public void setOldValue(String oldValue) {
|
||||||
this.oldValue = oldValue;
|
this.oldValue = oldValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getNewValue() {
|
public String getNewValue() {
|
||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNewValue(String newValue) {
|
public void setNewValue(String newValue) {
|
||||||
this.newValue = newValue;
|
this.newValue = newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCustom1() {
|
public String getCustom1() {
|
||||||
return custom1;
|
return custom1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCustom1(String custom1) {
|
public void setCustom1(String custom1) {
|
||||||
this.custom1 = custom1;
|
this.custom1 = custom1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCustom2() {
|
public String getCustom2() {
|
||||||
return custom2;
|
return custom2;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCustom2(String custom2) {
|
public void setCustom2(String custom2) {
|
||||||
this.custom2 = custom2;
|
this.custom2 = custom2;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCustom3() {
|
public String getCustom3() {
|
||||||
return custom3;
|
return custom3;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCustom3(String custom3) {
|
public void setCustom3(String custom3) {
|
||||||
this.custom3 = custom3;
|
this.custom3 = custom3;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCustom4() {
|
public String getCustom4() {
|
||||||
return custom4;
|
return custom4;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCustom4(String custom4) {
|
public void setCustom4(String custom4) {
|
||||||
this.custom4 = custom4;
|
this.custom4 = custom4;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getOldData() {
|
public String getOldData() {
|
||||||
return oldData;
|
return oldData;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOldData(String oldData) {
|
public void setOldData(String oldData) {
|
||||||
this.oldData = oldData;
|
this.oldData = oldData;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getNewData() {
|
public String getNewData() {
|
||||||
return newData;
|
return newData;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNewData(String newData) {
|
public void setNewData(String newData) {
|
||||||
this.newData = newData;
|
this.newData = newData;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "TaskHistoryEventResource ["
|
return "TaskHistoryEventResource ["
|
||||||
+ "taskHistoryEventId= " + this.taskHistoryEventId
|
+ "taskHistoryEventId= "
|
||||||
+ "businessProcessId= " + this.businessProcessId
|
+ this.taskHistoryEventId
|
||||||
+ "parentBusinessProcessId= " + this.parentBusinessProcessId
|
+ "businessProcessId= "
|
||||||
+ "taskId= " + this.taskId
|
+ this.businessProcessId
|
||||||
+ "eventType= " + this.eventType
|
+ "parentBusinessProcessId= "
|
||||||
+ "created= " + this.created
|
+ this.parentBusinessProcessId
|
||||||
+ "userId= " + this.userId
|
+ "taskId= "
|
||||||
+ "domain= " + this.domain
|
+ this.taskId
|
||||||
+ "workbasketKey= " + this.workbasketKey
|
+ "eventType= "
|
||||||
+ "oldValue= " + this.oldValue
|
+ this.eventType
|
||||||
+ "newValue= " + this.newValue
|
+ "created= "
|
||||||
+ "oldData= " + this.oldData
|
+ this.created
|
||||||
+ "newData= " + this.newData
|
+ "userId= "
|
||||||
+ "]";
|
+ this.userId
|
||||||
}
|
+ "domain= "
|
||||||
|
+ this.domain
|
||||||
|
+ "workbasketKey= "
|
||||||
|
+ this.workbasketKey
|
||||||
|
+ "oldValue= "
|
||||||
|
+ this.oldValue
|
||||||
|
+ "newValue= "
|
||||||
|
+ this.newValue
|
||||||
|
+ "oldData= "
|
||||||
|
+ this.oldData
|
||||||
|
+ "newData= "
|
||||||
|
+ this.newData
|
||||||
|
+ "]";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ import java.time.Instant;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.hateoas.config.EnableHypermediaSupport;
|
import org.springframework.hateoas.config.EnableHypermediaSupport;
|
||||||
|
|
@ -30,445 +29,456 @@ import pro.taskana.simplehistory.impl.HistoryEventImpl;
|
||||||
import pro.taskana.simplehistory.impl.SimpleHistoryServiceImpl;
|
import pro.taskana.simplehistory.impl.SimpleHistoryServiceImpl;
|
||||||
import pro.taskana.simplehistory.query.HistoryQuery;
|
import pro.taskana.simplehistory.query.HistoryQuery;
|
||||||
|
|
||||||
/**
|
/** Controller for all TaskHistoryEvent related endpoints. */
|
||||||
* Controller for all TaskHistoryEvent related endpoints.
|
|
||||||
*/
|
|
||||||
@RestController
|
@RestController
|
||||||
@EnableHypermediaSupport(type = EnableHypermediaSupport.HypermediaType.HAL)
|
@EnableHypermediaSupport(type = EnableHypermediaSupport.HypermediaType.HAL)
|
||||||
@RequestMapping(path = "/api/v1/task-history-event", produces = "application/hal+json")
|
@RequestMapping(path = "/api/v1/task-history-event", produces = "application/hal+json")
|
||||||
public class TaskHistoryEventController extends AbstractPagingController {
|
public class TaskHistoryEventController extends AbstractPagingController {
|
||||||
|
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(TaskHistoryEventController.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(TaskHistoryEventController.class);
|
||||||
|
|
||||||
private static final String LIKE = "%";
|
private static final String LIKE = "%";
|
||||||
|
|
||||||
private static final String BUSINESS_PROCESS_ID = "business-process-id";
|
private static final String BUSINESS_PROCESS_ID = "business-process-id";
|
||||||
|
|
||||||
private static final String BUSINESS_PROCESS_ID_LIKE = "business-process-id-like";
|
private static final String BUSINESS_PROCESS_ID_LIKE = "business-process-id-like";
|
||||||
|
|
||||||
private static final String PARENT_BUSINESS_PROCESS_ID = "parent-business-process-id";
|
private static final String PARENT_BUSINESS_PROCESS_ID = "parent-business-process-id";
|
||||||
|
|
||||||
private static final String PARENT_BUSINESS_PROCESS_ID_LIKE = "parent-business-process-id-like";
|
private static final String PARENT_BUSINESS_PROCESS_ID_LIKE = "parent-business-process-id-like";
|
||||||
|
|
||||||
private static final String TASK_ID = "task-id";
|
private static final String TASK_ID = "task-id";
|
||||||
|
|
||||||
private static final String TASK_ID_LIKE = "task-id-like";
|
private static final String TASK_ID_LIKE = "task-id-like";
|
||||||
|
|
||||||
private static final String EVENT_TYPE = "event-type";
|
private static final String EVENT_TYPE = "event-type";
|
||||||
|
|
||||||
private static final String EVENT_TYPE_LIKE = "event-type-like";
|
private static final String EVENT_TYPE_LIKE = "event-type-like";
|
||||||
|
|
||||||
private static final String CREATED = "created";
|
private static final String CREATED = "created";
|
||||||
|
|
||||||
private static final String USER_ID = "user-id";
|
private static final String USER_ID = "user-id";
|
||||||
|
|
||||||
private static final String USER_ID_LIKE = "user-id-like";
|
private static final String USER_ID_LIKE = "user-id-like";
|
||||||
|
|
||||||
private static final String DOMAIN = "domain";
|
private static final String DOMAIN = "domain";
|
||||||
|
|
||||||
private static final String WORKBASKET_KEY = "workbasket-key";
|
private static final String WORKBASKET_KEY = "workbasket-key";
|
||||||
|
|
||||||
private static final String WORKBASKET_KEY_LIKE = "workbasket-key-like";
|
private static final String WORKBASKET_KEY_LIKE = "workbasket-key-like";
|
||||||
|
|
||||||
private static final String POR_COMPANY = "por-company";
|
private static final String POR_COMPANY = "por-company";
|
||||||
|
|
||||||
private static final String POR_COMPANY_LIKE = "por-company-like";
|
private static final String POR_COMPANY_LIKE = "por-company-like";
|
||||||
|
|
||||||
private static final String POR_SYSTEM = "por-system";
|
private static final String POR_SYSTEM = "por-system";
|
||||||
|
|
||||||
private static final String POR_SYSTEM_LIKE = "por-system-like";
|
private static final String POR_SYSTEM_LIKE = "por-system-like";
|
||||||
|
|
||||||
private static final String POR_INSTANCE = "por-instance";
|
private static final String POR_INSTANCE = "por-instance";
|
||||||
|
|
||||||
private static final String POR_INSTANCE_LIKE = "por-instance-like";
|
private static final String POR_INSTANCE_LIKE = "por-instance-like";
|
||||||
|
|
||||||
private static final String POR_TYPE = "por-type";
|
private static final String POR_TYPE = "por-type";
|
||||||
|
|
||||||
private static final String POR_TYPE_LIKE = "por-type-like";
|
private static final String POR_TYPE_LIKE = "por-type-like";
|
||||||
|
|
||||||
private static final String POR_VALUE = "por-value";
|
private static final String POR_VALUE = "por-value";
|
||||||
|
|
||||||
private static final String POR_VALUE_LIKE = "por-value-like";
|
private static final String POR_VALUE_LIKE = "por-value-like";
|
||||||
|
|
||||||
private static final String TASK_CLASSIFICATION_KEY = "task-classification-key";
|
private static final String TASK_CLASSIFICATION_KEY = "task-classification-key";
|
||||||
|
|
||||||
private static final String TASK_CLASSIFICATION_KEY_LIKE = "task-classification-key-like";
|
private static final String TASK_CLASSIFICATION_KEY_LIKE = "task-classification-key-like";
|
||||||
|
|
||||||
private static final String TASK_CLASSIFICATION_CATEGORY = "task-classification-category";
|
private static final String TASK_CLASSIFICATION_CATEGORY = "task-classification-category";
|
||||||
|
|
||||||
private static final String TASK_CLASSIFICATION_CATEGORY_LIKE = "task-classification-category-like";
|
private static final String TASK_CLASSIFICATION_CATEGORY_LIKE =
|
||||||
|
"task-classification-category-like";
|
||||||
|
|
||||||
private static final String ATTACHMENT_CLASSIFICATION_KEY = "attachment-classification-key";
|
private static final String ATTACHMENT_CLASSIFICATION_KEY = "attachment-classification-key";
|
||||||
|
|
||||||
private static final String ATTACHMENT_CLASSIFICATION_KEY_LIKE = "attachment-classification-key-like";
|
private static final String ATTACHMENT_CLASSIFICATION_KEY_LIKE =
|
||||||
|
"attachment-classification-key-like";
|
||||||
|
|
||||||
private static final String CUSTOM_1 = "custom-1";
|
private static final String CUSTOM_1 = "custom-1";
|
||||||
|
|
||||||
private static final String CUSTOM_1_LIKE = "custom-1-like";
|
private static final String CUSTOM_1_LIKE = "custom-1-like";
|
||||||
|
|
||||||
private static final String CUSTOM_2 = "custom-2";
|
private static final String CUSTOM_2 = "custom-2";
|
||||||
|
|
||||||
private static final String CUSTOM_2_LIKE = "custom-2-like";
|
private static final String CUSTOM_2_LIKE = "custom-2-like";
|
||||||
|
|
||||||
private static final String CUSTOM_3 = "custom-3";
|
private static final String CUSTOM_3 = "custom-3";
|
||||||
|
|
||||||
private static final String CUSTOM_3_LIKE = "custom-3-like";
|
private static final String CUSTOM_3_LIKE = "custom-3-like";
|
||||||
|
|
||||||
private static final String CUSTOM_4 = "custom-4";
|
private static final String CUSTOM_4 = "custom-4";
|
||||||
|
|
||||||
private static final String CUSTOM_4_LIKE = "custom-4-like";
|
private static final String CUSTOM_4_LIKE = "custom-4-like";
|
||||||
|
|
||||||
private static final String SORT_BY = "sort-by";
|
private static final String SORT_BY = "sort-by";
|
||||||
|
|
||||||
private static final String SORT_DIRECTION = "order";
|
private static final String SORT_DIRECTION = "order";
|
||||||
|
|
||||||
private static final String PAGING_PAGE = "page";
|
private static final String PAGING_PAGE = "page";
|
||||||
|
|
||||||
private static final String PAGING_PAGE_SIZE = "page-size";
|
private static final String PAGING_PAGE_SIZE = "page-size";
|
||||||
|
|
||||||
private SimpleHistoryServiceImpl simpleHistoryService;
|
private SimpleHistoryServiceImpl simpleHistoryService;
|
||||||
|
|
||||||
private TaskanaEngineConfiguration taskanaEngineConfiguration;
|
private TaskanaEngineConfiguration taskanaEngineConfiguration;
|
||||||
|
|
||||||
public TaskHistoryEventController(TaskanaEngineConfiguration taskanaEngineConfiguration,
|
public TaskHistoryEventController(
|
||||||
SimpleHistoryServiceImpl simpleHistoryServiceImpl) {
|
TaskanaEngineConfiguration taskanaEngineConfiguration,
|
||||||
this.taskanaEngineConfiguration = taskanaEngineConfiguration;
|
SimpleHistoryServiceImpl simpleHistoryServiceImpl) {
|
||||||
this.simpleHistoryService = simpleHistoryServiceImpl;
|
this.taskanaEngineConfiguration = taskanaEngineConfiguration;
|
||||||
simpleHistoryService.initialize(taskanaEngineConfiguration);
|
this.simpleHistoryService = simpleHistoryServiceImpl;
|
||||||
|
simpleHistoryService.initialize(taskanaEngineConfiguration);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping
|
||||||
|
@Transactional(readOnly = true, rollbackFor = Exception.class)
|
||||||
|
public ResponseEntity<TaskHistoryEventListResource> getTaskHistoryEvent(
|
||||||
|
@RequestParam MultiValueMap<String, String> params) throws InvalidArgumentException {
|
||||||
|
if (LOGGER.isDebugEnabled()) {
|
||||||
|
LOGGER.debug("Entry to getTaskHistoryEvent(params= {})", LoggerUtils.mapToString(params));
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping
|
HistoryQuery query = simpleHistoryService.createHistoryQuery();
|
||||||
@Transactional(readOnly = true, rollbackFor = Exception.class)
|
query = applySortingParams(query, params);
|
||||||
public ResponseEntity<TaskHistoryEventListResource> getTaskHistoryEvent(
|
query = applyFilterParams(query, params);
|
||||||
@RequestParam MultiValueMap<String, String> params) throws InvalidArgumentException {
|
|
||||||
if (LOGGER.isDebugEnabled()) {
|
|
||||||
LOGGER.debug("Entry to getTaskHistoryEvent(params= {})", LoggerUtils.mapToString(params));
|
|
||||||
}
|
|
||||||
|
|
||||||
HistoryQuery query = simpleHistoryService.createHistoryQuery();
|
PageMetadata pageMetadata = null;
|
||||||
query = applySortingParams(query, params);
|
List<HistoryEventImpl> historyEvents = null;
|
||||||
query = applyFilterParams(query, params);
|
String page = params.getFirst(PAGING_PAGE);
|
||||||
|
String pageSize = params.getFirst(PAGING_PAGE_SIZE);
|
||||||
PageMetadata pageMetadata = null;
|
params.remove(PAGING_PAGE);
|
||||||
List<HistoryEventImpl> historyEvents = null;
|
params.remove(PAGING_PAGE_SIZE);
|
||||||
String page = params.getFirst(PAGING_PAGE);
|
validateNoInvalidParameterIsLeft(params);
|
||||||
String pageSize = params.getFirst(PAGING_PAGE_SIZE);
|
if (page != null && pageSize != null) {
|
||||||
params.remove(PAGING_PAGE);
|
long totalElements = query.count();
|
||||||
params.remove(PAGING_PAGE_SIZE);
|
pageMetadata = initPageMetadata(pageSize, page, totalElements);
|
||||||
validateNoInvalidParameterIsLeft(params);
|
historyEvents = query.listPage((int) pageMetadata.getNumber(), (int) pageMetadata.getSize());
|
||||||
if (page != null && pageSize != null) {
|
} else if (page == null && pageSize == null) {
|
||||||
long totalElements = query.count();
|
historyEvents = query.list();
|
||||||
pageMetadata = initPageMetadata(pageSize, page, totalElements);
|
} else {
|
||||||
historyEvents = query.listPage((int) pageMetadata.getNumber(),
|
throw new InvalidArgumentException("Paging information is incomplete.");
|
||||||
(int) pageMetadata.getSize());
|
|
||||||
} else if (page == null && pageSize == null) {
|
|
||||||
historyEvents = query.list();
|
|
||||||
} else {
|
|
||||||
throw new InvalidArgumentException("Paging information is incomplete.");
|
|
||||||
}
|
|
||||||
|
|
||||||
TaskHistoryEventListAssembler assembler = new TaskHistoryEventListAssembler();
|
|
||||||
TaskHistoryEventListResource pagedResources = assembler.toResources(historyEvents, pageMetadata);
|
|
||||||
|
|
||||||
if (LOGGER.isDebugEnabled()) {
|
|
||||||
LOGGER.debug("Exit from getTaskHistoryEvent(), returning {}",
|
|
||||||
new ResponseEntity<>(pagedResources, HttpStatus.OK));
|
|
||||||
}
|
|
||||||
|
|
||||||
return new ResponseEntity<>(pagedResources, HttpStatus.OK);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private HistoryQuery applySortingParams(HistoryQuery query, MultiValueMap<String, String> params)
|
TaskHistoryEventListAssembler assembler = new TaskHistoryEventListAssembler();
|
||||||
throws IllegalArgumentException, InvalidArgumentException {
|
TaskHistoryEventListResource pagedResources =
|
||||||
if (LOGGER.isDebugEnabled()) {
|
assembler.toResources(historyEvents, pageMetadata);
|
||||||
LOGGER.debug("Entry to applySortingParams(params= {})", LoggerUtils.mapToString(params));
|
|
||||||
}
|
|
||||||
|
|
||||||
String sortBy = params.getFirst(SORT_BY);
|
if (LOGGER.isDebugEnabled()) {
|
||||||
if (sortBy != null) {
|
LOGGER.debug(
|
||||||
BaseQuery.SortDirection sortDirection;
|
"Exit from getTaskHistoryEvent(), returning {}",
|
||||||
if (params.getFirst(SORT_DIRECTION) != null && "desc".equals(params.getFirst(SORT_DIRECTION))) {
|
new ResponseEntity<>(pagedResources, HttpStatus.OK));
|
||||||
sortDirection = BaseQuery.SortDirection.DESCENDING;
|
|
||||||
} else {
|
|
||||||
sortDirection = BaseQuery.SortDirection.ASCENDING;
|
|
||||||
}
|
|
||||||
switch (sortBy) {
|
|
||||||
case (BUSINESS_PROCESS_ID):
|
|
||||||
query = query.orderByBusinessProcessId(sortDirection);
|
|
||||||
break;
|
|
||||||
case (PARENT_BUSINESS_PROCESS_ID):
|
|
||||||
query = query.orderByParentBusinessProcessId(sortDirection);
|
|
||||||
break;
|
|
||||||
case (TASK_ID):
|
|
||||||
query = query.orderByTaskId(sortDirection);
|
|
||||||
break;
|
|
||||||
case (EVENT_TYPE):
|
|
||||||
query = query.orderByEventType(sortDirection);
|
|
||||||
break;
|
|
||||||
case (CREATED):
|
|
||||||
query = query.orderByCreated(sortDirection);
|
|
||||||
break;
|
|
||||||
case (USER_ID):
|
|
||||||
query = query.orderByUserId(sortDirection);
|
|
||||||
break;
|
|
||||||
case (DOMAIN):
|
|
||||||
query = query.orderByDomain(sortDirection);
|
|
||||||
break;
|
|
||||||
case (WORKBASKET_KEY):
|
|
||||||
query = query.orderByWorkbasketKey(sortDirection);
|
|
||||||
break;
|
|
||||||
case (POR_COMPANY):
|
|
||||||
query = query.orderByPorCompany(sortDirection);
|
|
||||||
break;
|
|
||||||
case (POR_SYSTEM):
|
|
||||||
query = query.orderByPorSystem(sortDirection);
|
|
||||||
break;
|
|
||||||
case (POR_INSTANCE):
|
|
||||||
query = query.orderByPorInstance(sortDirection);
|
|
||||||
break;
|
|
||||||
case (POR_TYPE):
|
|
||||||
query = query.orderByPorType(sortDirection);
|
|
||||||
break;
|
|
||||||
case (POR_VALUE):
|
|
||||||
query = query.orderByPorValue(sortDirection);
|
|
||||||
break;
|
|
||||||
case (TASK_CLASSIFICATION_KEY):
|
|
||||||
query = query.orderByTaskClassificationKey(sortDirection);
|
|
||||||
break;
|
|
||||||
case (TASK_CLASSIFICATION_CATEGORY):
|
|
||||||
query = query.orderByTaskClassificationCategory(sortDirection);
|
|
||||||
break;
|
|
||||||
case (ATTACHMENT_CLASSIFICATION_KEY):
|
|
||||||
query = query.orderByAttachmentClassificationKey(sortDirection);
|
|
||||||
break;
|
|
||||||
case (CUSTOM_1):
|
|
||||||
query = query.orderByCustomAttribute(1, sortDirection);
|
|
||||||
break;
|
|
||||||
case (CUSTOM_2):
|
|
||||||
query = query.orderByCustomAttribute(2, sortDirection);
|
|
||||||
break;
|
|
||||||
case (CUSTOM_3):
|
|
||||||
query = query.orderByCustomAttribute(3, sortDirection);
|
|
||||||
break;
|
|
||||||
case (CUSTOM_4):
|
|
||||||
query = query.orderByCustomAttribute(4, sortDirection);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw new IllegalArgumentException("Unknown order '" + sortBy + "'");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
params.remove(SORT_BY);
|
|
||||||
params.remove(SORT_DIRECTION);
|
|
||||||
if (LOGGER.isDebugEnabled()) {
|
|
||||||
LOGGER.debug("Exit from applySortingParams(), returning {}", query);
|
|
||||||
}
|
|
||||||
|
|
||||||
return query;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private HistoryQuery applyFilterParams(HistoryQuery query,
|
return new ResponseEntity<>(pagedResources, HttpStatus.OK);
|
||||||
MultiValueMap<String, String> params) {
|
}
|
||||||
if (LOGGER.isDebugEnabled()) {
|
|
||||||
LOGGER.debug("Entry to applyFilterParams(query= {}, params= {})", query, params);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (params.containsKey(BUSINESS_PROCESS_ID)) {
|
private HistoryQuery applySortingParams(HistoryQuery query, MultiValueMap<String, String> params)
|
||||||
String[] businessProcessId = extractCommaSeparatedFields(params.get(BUSINESS_PROCESS_ID));
|
throws IllegalArgumentException, InvalidArgumentException {
|
||||||
query.businessProcessIdIn(businessProcessId);
|
if (LOGGER.isDebugEnabled()) {
|
||||||
params.remove(BUSINESS_PROCESS_ID);
|
LOGGER.debug("Entry to applySortingParams(params= {})", LoggerUtils.mapToString(params));
|
||||||
}
|
|
||||||
if (params.containsKey(BUSINESS_PROCESS_ID_LIKE)) {
|
|
||||||
query.businessProcessIdLike(LIKE + params.get(BUSINESS_PROCESS_ID_LIKE).get(0) + LIKE);
|
|
||||||
params.remove(BUSINESS_PROCESS_ID_LIKE);
|
|
||||||
}
|
|
||||||
if (params.containsKey(PARENT_BUSINESS_PROCESS_ID)) {
|
|
||||||
String[] parentBusinessProcessId = extractCommaSeparatedFields(params.get(PARENT_BUSINESS_PROCESS_ID));
|
|
||||||
query.parentBusinessProcessIdIn(parentBusinessProcessId);
|
|
||||||
params.remove(PARENT_BUSINESS_PROCESS_ID);
|
|
||||||
}
|
|
||||||
if (params.containsKey(PARENT_BUSINESS_PROCESS_ID_LIKE)) {
|
|
||||||
query.parentBusinessProcessIdLike(LIKE + params.get(PARENT_BUSINESS_PROCESS_ID_LIKE).get(0) + LIKE);
|
|
||||||
params.remove(PARENT_BUSINESS_PROCESS_ID_LIKE);
|
|
||||||
}
|
|
||||||
if (params.containsKey(TASK_ID)) {
|
|
||||||
String[] taskId = extractCommaSeparatedFields(params.get(TASK_ID));
|
|
||||||
query.taskIdIn(taskId);
|
|
||||||
params.remove(TASK_ID);
|
|
||||||
}
|
|
||||||
if (params.containsKey(TASK_ID_LIKE)) {
|
|
||||||
query.taskIdLike(LIKE + params.get(TASK_ID_LIKE).get(0) + LIKE);
|
|
||||||
params.remove(TASK_ID_LIKE);
|
|
||||||
}
|
|
||||||
if (params.containsKey(EVENT_TYPE)) {
|
|
||||||
String[] eventType = extractCommaSeparatedFields(params.get(EVENT_TYPE));
|
|
||||||
query.eventTypeIn(eventType);
|
|
||||||
params.remove(EVENT_TYPE);
|
|
||||||
}
|
|
||||||
if (params.containsKey(EVENT_TYPE_LIKE)) {
|
|
||||||
query.eventTypeLike(LIKE + params.get(EVENT_TYPE_LIKE).get(0) + LIKE);
|
|
||||||
params.remove(EVENT_TYPE_LIKE);
|
|
||||||
}
|
|
||||||
if (params.containsKey(CREATED)) {
|
|
||||||
String[] created = extractCommaSeparatedFields(params.get(CREATED));
|
|
||||||
TimeInterval timeInterval = getTimeIntervalOf(created);
|
|
||||||
query.createdWithin(timeInterval);
|
|
||||||
params.remove(CREATED);
|
|
||||||
}
|
|
||||||
if (params.containsKey(USER_ID)) {
|
|
||||||
String[] userId = extractCommaSeparatedFields(params.get(USER_ID));
|
|
||||||
query.userIdIn(userId);
|
|
||||||
params.remove(USER_ID);
|
|
||||||
}
|
|
||||||
if (params.containsKey(USER_ID_LIKE)) {
|
|
||||||
query.userIdLike(LIKE + params.get(USER_ID_LIKE).get(0) + LIKE);
|
|
||||||
params.remove(USER_ID_LIKE);
|
|
||||||
}
|
|
||||||
if (params.containsKey(DOMAIN)) {
|
|
||||||
query.domainIn(extractCommaSeparatedFields(params.get(DOMAIN)));
|
|
||||||
params.remove(DOMAIN);
|
|
||||||
}
|
|
||||||
if (params.containsKey(WORKBASKET_KEY)) {
|
|
||||||
String[] workbasketKey = extractCommaSeparatedFields(params.get(WORKBASKET_KEY));
|
|
||||||
query.workbasketKeyIn(workbasketKey);
|
|
||||||
params.remove(WORKBASKET_KEY);
|
|
||||||
}
|
|
||||||
if (params.containsKey(WORKBASKET_KEY_LIKE)) {
|
|
||||||
query.workbasketKeyLike(LIKE + params.get(WORKBASKET_KEY_LIKE).get(0) + LIKE);
|
|
||||||
params.remove(WORKBASKET_KEY_LIKE);
|
|
||||||
}
|
|
||||||
if (params.containsKey(POR_COMPANY)) {
|
|
||||||
String[] porCompany = extractCommaSeparatedFields(params.get(POR_COMPANY));
|
|
||||||
query.porCompanyIn(porCompany);
|
|
||||||
params.remove(POR_COMPANY);
|
|
||||||
}
|
|
||||||
if (params.containsKey(POR_COMPANY_LIKE)) {
|
|
||||||
query.porCompanyLike(LIKE + params.get(POR_COMPANY_LIKE).get(0) + LIKE);
|
|
||||||
params.remove(POR_COMPANY_LIKE);
|
|
||||||
}
|
|
||||||
if (params.containsKey(POR_SYSTEM)) {
|
|
||||||
String[] porSystem = extractCommaSeparatedFields(params.get(POR_SYSTEM));
|
|
||||||
query.porSystemIn(porSystem);
|
|
||||||
params.remove(POR_SYSTEM);
|
|
||||||
}
|
|
||||||
if (params.containsKey(POR_SYSTEM_LIKE)) {
|
|
||||||
query.porSystemLike(LIKE + params.get(POR_SYSTEM_LIKE).get(0) + LIKE);
|
|
||||||
params.remove(POR_SYSTEM_LIKE);
|
|
||||||
}
|
|
||||||
if (params.containsKey(POR_INSTANCE)) {
|
|
||||||
String[] porInstance = extractCommaSeparatedFields(params.get(POR_INSTANCE));
|
|
||||||
query.porInstanceIn(porInstance);
|
|
||||||
params.remove(POR_INSTANCE);
|
|
||||||
}
|
|
||||||
if (params.containsKey(POR_INSTANCE_LIKE)) {
|
|
||||||
query.porInstanceLike(LIKE + params.get(POR_INSTANCE_LIKE).get(0) + LIKE);
|
|
||||||
params.remove(POR_INSTANCE_LIKE);
|
|
||||||
}
|
|
||||||
if (params.containsKey(POR_TYPE)) {
|
|
||||||
String[] porType = extractCommaSeparatedFields(params.get(POR_TYPE));
|
|
||||||
query.porTypeIn(porType);
|
|
||||||
params.remove(POR_TYPE);
|
|
||||||
}
|
|
||||||
if (params.containsKey(POR_TYPE_LIKE)) {
|
|
||||||
query.porTypeLike(LIKE + params.get(POR_TYPE_LIKE).get(0) + LIKE);
|
|
||||||
params.remove(POR_TYPE_LIKE);
|
|
||||||
}
|
|
||||||
if (params.containsKey(POR_VALUE)) {
|
|
||||||
String[] porValue = extractCommaSeparatedFields(params.get(POR_VALUE));
|
|
||||||
query.porValueIn(porValue);
|
|
||||||
params.remove(POR_VALUE);
|
|
||||||
}
|
|
||||||
if (params.containsKey(POR_VALUE_LIKE)) {
|
|
||||||
query.porValueLike(LIKE + params.get(POR_VALUE_LIKE).get(0) + LIKE);
|
|
||||||
params.remove(POR_VALUE_LIKE);
|
|
||||||
}
|
|
||||||
if (params.containsKey(TASK_CLASSIFICATION_KEY)) {
|
|
||||||
String[] taskClassificationKey = extractCommaSeparatedFields(params.get(TASK_CLASSIFICATION_KEY));
|
|
||||||
query.taskClassificationKeyIn(taskClassificationKey);
|
|
||||||
params.remove(TASK_CLASSIFICATION_KEY);
|
|
||||||
}
|
|
||||||
if (params.containsKey(TASK_CLASSIFICATION_KEY_LIKE)) {
|
|
||||||
query.taskClassificationKeyLike(LIKE + params.get(TASK_CLASSIFICATION_KEY_LIKE).get(0) + LIKE);
|
|
||||||
params.remove(TASK_CLASSIFICATION_KEY_LIKE);
|
|
||||||
}
|
|
||||||
if (params.containsKey(TASK_CLASSIFICATION_CATEGORY)) {
|
|
||||||
String[] taskClassificationCategory = extractCommaSeparatedFields(params.get(TASK_CLASSIFICATION_CATEGORY));
|
|
||||||
query.taskClassificationCategoryIn(taskClassificationCategory);
|
|
||||||
params.remove(TASK_CLASSIFICATION_CATEGORY);
|
|
||||||
}
|
|
||||||
if (params.containsKey(TASK_CLASSIFICATION_CATEGORY_LIKE)) {
|
|
||||||
query.taskClassificationCategoryLike(LIKE + params.get(TASK_CLASSIFICATION_CATEGORY_LIKE).get(0) + LIKE);
|
|
||||||
params.remove(TASK_CLASSIFICATION_CATEGORY_LIKE);
|
|
||||||
}
|
|
||||||
if (params.containsKey(ATTACHMENT_CLASSIFICATION_KEY)) {
|
|
||||||
String[] attachmentClassificationKey = extractCommaSeparatedFields(
|
|
||||||
params.get(ATTACHMENT_CLASSIFICATION_KEY));
|
|
||||||
query.attachmentClassificationKeyIn(attachmentClassificationKey);
|
|
||||||
params.remove(ATTACHMENT_CLASSIFICATION_KEY);
|
|
||||||
}
|
|
||||||
if (params.containsKey(ATTACHMENT_CLASSIFICATION_KEY_LIKE)) {
|
|
||||||
query.attachmentClassificationKeyLike(LIKE + params.get(ATTACHMENT_CLASSIFICATION_KEY_LIKE).get(0) + LIKE);
|
|
||||||
params.remove(ATTACHMENT_CLASSIFICATION_KEY_LIKE);
|
|
||||||
}
|
|
||||||
if (params.containsKey(CUSTOM_1)) {
|
|
||||||
String[] custom1 = extractCommaSeparatedFields(params.get(CUSTOM_1));
|
|
||||||
query.custom1In(custom1);
|
|
||||||
params.remove(CUSTOM_1);
|
|
||||||
}
|
|
||||||
if (params.containsKey(CUSTOM_1_LIKE)) {
|
|
||||||
query.custom1Like(LIKE + params.get(CUSTOM_1_LIKE).get(0) + LIKE);
|
|
||||||
params.remove(CUSTOM_1_LIKE);
|
|
||||||
}
|
|
||||||
if (params.containsKey(CUSTOM_2)) {
|
|
||||||
String[] custom2 = extractCommaSeparatedFields(params.get(CUSTOM_2));
|
|
||||||
query.custom2In(custom2);
|
|
||||||
params.remove(CUSTOM_2);
|
|
||||||
}
|
|
||||||
if (params.containsKey(CUSTOM_2_LIKE)) {
|
|
||||||
query.custom2Like(LIKE + params.get(CUSTOM_2_LIKE).get(0) + LIKE);
|
|
||||||
params.remove(CUSTOM_2_LIKE);
|
|
||||||
}
|
|
||||||
if (params.containsKey(CUSTOM_3)) {
|
|
||||||
String[] custom3 = extractCommaSeparatedFields(params.get(CUSTOM_3));
|
|
||||||
query.custom3In(custom3);
|
|
||||||
params.remove(CUSTOM_3);
|
|
||||||
}
|
|
||||||
if (params.containsKey(CUSTOM_3_LIKE)) {
|
|
||||||
query.custom3Like(LIKE + params.get(CUSTOM_3_LIKE).get(0) + LIKE);
|
|
||||||
params.remove(CUSTOM_3_LIKE);
|
|
||||||
}
|
|
||||||
if (params.containsKey(CUSTOM_4)) {
|
|
||||||
String[] custom4 = extractCommaSeparatedFields(params.get(CUSTOM_4));
|
|
||||||
query.custom4In(custom4);
|
|
||||||
params.remove(CUSTOM_4);
|
|
||||||
}
|
|
||||||
if (params.containsKey(CUSTOM_4_LIKE)) {
|
|
||||||
query.custom4Like(LIKE + params.get(CUSTOM_4_LIKE).get(0) + LIKE);
|
|
||||||
params.remove(CUSTOM_4_LIKE);
|
|
||||||
}
|
|
||||||
if (LOGGER.isDebugEnabled()) {
|
|
||||||
LOGGER.debug("Exit from applyFilterParams(), returning {}", query);
|
|
||||||
}
|
|
||||||
|
|
||||||
return query;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private TimeInterval getTimeIntervalOf(String[] created) {
|
String sortBy = params.getFirst(SORT_BY);
|
||||||
LocalDate begin;
|
if (sortBy != null) {
|
||||||
LocalDate end;
|
BaseQuery.SortDirection sortDirection;
|
||||||
try {
|
if (params.getFirst(SORT_DIRECTION) != null
|
||||||
begin = LocalDate.parse(created[0]);
|
&& "desc".equals(params.getFirst(SORT_DIRECTION))) {
|
||||||
} catch (Exception e) {
|
sortDirection = BaseQuery.SortDirection.DESCENDING;
|
||||||
throw new IllegalArgumentException(
|
} else {
|
||||||
"Cannot parse String '" + created[0] + "'. Expected a String of the Format 'yyyy-MM-dd'.");
|
sortDirection = BaseQuery.SortDirection.ASCENDING;
|
||||||
}
|
}
|
||||||
if (created.length < 2) {
|
switch (sortBy) {
|
||||||
end = begin.plusDays(1);
|
case (BUSINESS_PROCESS_ID):
|
||||||
} else {
|
query = query.orderByBusinessProcessId(sortDirection);
|
||||||
end = LocalDate.parse(created[1]);
|
break;
|
||||||
}
|
case (PARENT_BUSINESS_PROCESS_ID):
|
||||||
Instant beginInst = begin.atStartOfDay(ZoneId.systemDefault()).toInstant();
|
query = query.orderByParentBusinessProcessId(sortDirection);
|
||||||
Instant endInst = end.atStartOfDay(ZoneId.systemDefault()).toInstant();
|
break;
|
||||||
TimeInterval timeInterval = new TimeInterval(beginInst, endInst);
|
case (TASK_ID):
|
||||||
return timeInterval;
|
query = query.orderByTaskId(sortDirection);
|
||||||
|
break;
|
||||||
|
case (EVENT_TYPE):
|
||||||
|
query = query.orderByEventType(sortDirection);
|
||||||
|
break;
|
||||||
|
case (CREATED):
|
||||||
|
query = query.orderByCreated(sortDirection);
|
||||||
|
break;
|
||||||
|
case (USER_ID):
|
||||||
|
query = query.orderByUserId(sortDirection);
|
||||||
|
break;
|
||||||
|
case (DOMAIN):
|
||||||
|
query = query.orderByDomain(sortDirection);
|
||||||
|
break;
|
||||||
|
case (WORKBASKET_KEY):
|
||||||
|
query = query.orderByWorkbasketKey(sortDirection);
|
||||||
|
break;
|
||||||
|
case (POR_COMPANY):
|
||||||
|
query = query.orderByPorCompany(sortDirection);
|
||||||
|
break;
|
||||||
|
case (POR_SYSTEM):
|
||||||
|
query = query.orderByPorSystem(sortDirection);
|
||||||
|
break;
|
||||||
|
case (POR_INSTANCE):
|
||||||
|
query = query.orderByPorInstance(sortDirection);
|
||||||
|
break;
|
||||||
|
case (POR_TYPE):
|
||||||
|
query = query.orderByPorType(sortDirection);
|
||||||
|
break;
|
||||||
|
case (POR_VALUE):
|
||||||
|
query = query.orderByPorValue(sortDirection);
|
||||||
|
break;
|
||||||
|
case (TASK_CLASSIFICATION_KEY):
|
||||||
|
query = query.orderByTaskClassificationKey(sortDirection);
|
||||||
|
break;
|
||||||
|
case (TASK_CLASSIFICATION_CATEGORY):
|
||||||
|
query = query.orderByTaskClassificationCategory(sortDirection);
|
||||||
|
break;
|
||||||
|
case (ATTACHMENT_CLASSIFICATION_KEY):
|
||||||
|
query = query.orderByAttachmentClassificationKey(sortDirection);
|
||||||
|
break;
|
||||||
|
case (CUSTOM_1):
|
||||||
|
query = query.orderByCustomAttribute(1, sortDirection);
|
||||||
|
break;
|
||||||
|
case (CUSTOM_2):
|
||||||
|
query = query.orderByCustomAttribute(2, sortDirection);
|
||||||
|
break;
|
||||||
|
case (CUSTOM_3):
|
||||||
|
query = query.orderByCustomAttribute(3, sortDirection);
|
||||||
|
break;
|
||||||
|
case (CUSTOM_4):
|
||||||
|
query = query.orderByCustomAttribute(4, sortDirection);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new IllegalArgumentException("Unknown order '" + sortBy + "'");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
params.remove(SORT_BY);
|
||||||
|
params.remove(SORT_DIRECTION);
|
||||||
|
if (LOGGER.isDebugEnabled()) {
|
||||||
|
LOGGER.debug("Exit from applySortingParams(), returning {}", query);
|
||||||
|
}
|
||||||
|
|
||||||
|
return query;
|
||||||
|
}
|
||||||
|
|
||||||
|
private HistoryQuery applyFilterParams(HistoryQuery query, MultiValueMap<String, String> params) {
|
||||||
|
if (LOGGER.isDebugEnabled()) {
|
||||||
|
LOGGER.debug("Entry to applyFilterParams(query= {}, params= {})", query, params);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (params.containsKey(BUSINESS_PROCESS_ID)) {
|
||||||
|
String[] businessProcessId = extractCommaSeparatedFields(params.get(BUSINESS_PROCESS_ID));
|
||||||
|
query.businessProcessIdIn(businessProcessId);
|
||||||
|
params.remove(BUSINESS_PROCESS_ID);
|
||||||
|
}
|
||||||
|
if (params.containsKey(BUSINESS_PROCESS_ID_LIKE)) {
|
||||||
|
query.businessProcessIdLike(LIKE + params.get(BUSINESS_PROCESS_ID_LIKE).get(0) + LIKE);
|
||||||
|
params.remove(BUSINESS_PROCESS_ID_LIKE);
|
||||||
|
}
|
||||||
|
if (params.containsKey(PARENT_BUSINESS_PROCESS_ID)) {
|
||||||
|
String[] parentBusinessProcessId =
|
||||||
|
extractCommaSeparatedFields(params.get(PARENT_BUSINESS_PROCESS_ID));
|
||||||
|
query.parentBusinessProcessIdIn(parentBusinessProcessId);
|
||||||
|
params.remove(PARENT_BUSINESS_PROCESS_ID);
|
||||||
|
}
|
||||||
|
if (params.containsKey(PARENT_BUSINESS_PROCESS_ID_LIKE)) {
|
||||||
|
query.parentBusinessProcessIdLike(
|
||||||
|
LIKE + params.get(PARENT_BUSINESS_PROCESS_ID_LIKE).get(0) + LIKE);
|
||||||
|
params.remove(PARENT_BUSINESS_PROCESS_ID_LIKE);
|
||||||
|
}
|
||||||
|
if (params.containsKey(TASK_ID)) {
|
||||||
|
String[] taskId = extractCommaSeparatedFields(params.get(TASK_ID));
|
||||||
|
query.taskIdIn(taskId);
|
||||||
|
params.remove(TASK_ID);
|
||||||
|
}
|
||||||
|
if (params.containsKey(TASK_ID_LIKE)) {
|
||||||
|
query.taskIdLike(LIKE + params.get(TASK_ID_LIKE).get(0) + LIKE);
|
||||||
|
params.remove(TASK_ID_LIKE);
|
||||||
|
}
|
||||||
|
if (params.containsKey(EVENT_TYPE)) {
|
||||||
|
String[] eventType = extractCommaSeparatedFields(params.get(EVENT_TYPE));
|
||||||
|
query.eventTypeIn(eventType);
|
||||||
|
params.remove(EVENT_TYPE);
|
||||||
|
}
|
||||||
|
if (params.containsKey(EVENT_TYPE_LIKE)) {
|
||||||
|
query.eventTypeLike(LIKE + params.get(EVENT_TYPE_LIKE).get(0) + LIKE);
|
||||||
|
params.remove(EVENT_TYPE_LIKE);
|
||||||
|
}
|
||||||
|
if (params.containsKey(CREATED)) {
|
||||||
|
String[] created = extractCommaSeparatedFields(params.get(CREATED));
|
||||||
|
TimeInterval timeInterval = getTimeIntervalOf(created);
|
||||||
|
query.createdWithin(timeInterval);
|
||||||
|
params.remove(CREATED);
|
||||||
|
}
|
||||||
|
if (params.containsKey(USER_ID)) {
|
||||||
|
String[] userId = extractCommaSeparatedFields(params.get(USER_ID));
|
||||||
|
query.userIdIn(userId);
|
||||||
|
params.remove(USER_ID);
|
||||||
|
}
|
||||||
|
if (params.containsKey(USER_ID_LIKE)) {
|
||||||
|
query.userIdLike(LIKE + params.get(USER_ID_LIKE).get(0) + LIKE);
|
||||||
|
params.remove(USER_ID_LIKE);
|
||||||
|
}
|
||||||
|
if (params.containsKey(DOMAIN)) {
|
||||||
|
query.domainIn(extractCommaSeparatedFields(params.get(DOMAIN)));
|
||||||
|
params.remove(DOMAIN);
|
||||||
|
}
|
||||||
|
if (params.containsKey(WORKBASKET_KEY)) {
|
||||||
|
String[] workbasketKey = extractCommaSeparatedFields(params.get(WORKBASKET_KEY));
|
||||||
|
query.workbasketKeyIn(workbasketKey);
|
||||||
|
params.remove(WORKBASKET_KEY);
|
||||||
|
}
|
||||||
|
if (params.containsKey(WORKBASKET_KEY_LIKE)) {
|
||||||
|
query.workbasketKeyLike(LIKE + params.get(WORKBASKET_KEY_LIKE).get(0) + LIKE);
|
||||||
|
params.remove(WORKBASKET_KEY_LIKE);
|
||||||
|
}
|
||||||
|
if (params.containsKey(POR_COMPANY)) {
|
||||||
|
String[] porCompany = extractCommaSeparatedFields(params.get(POR_COMPANY));
|
||||||
|
query.porCompanyIn(porCompany);
|
||||||
|
params.remove(POR_COMPANY);
|
||||||
|
}
|
||||||
|
if (params.containsKey(POR_COMPANY_LIKE)) {
|
||||||
|
query.porCompanyLike(LIKE + params.get(POR_COMPANY_LIKE).get(0) + LIKE);
|
||||||
|
params.remove(POR_COMPANY_LIKE);
|
||||||
|
}
|
||||||
|
if (params.containsKey(POR_SYSTEM)) {
|
||||||
|
String[] porSystem = extractCommaSeparatedFields(params.get(POR_SYSTEM));
|
||||||
|
query.porSystemIn(porSystem);
|
||||||
|
params.remove(POR_SYSTEM);
|
||||||
|
}
|
||||||
|
if (params.containsKey(POR_SYSTEM_LIKE)) {
|
||||||
|
query.porSystemLike(LIKE + params.get(POR_SYSTEM_LIKE).get(0) + LIKE);
|
||||||
|
params.remove(POR_SYSTEM_LIKE);
|
||||||
|
}
|
||||||
|
if (params.containsKey(POR_INSTANCE)) {
|
||||||
|
String[] porInstance = extractCommaSeparatedFields(params.get(POR_INSTANCE));
|
||||||
|
query.porInstanceIn(porInstance);
|
||||||
|
params.remove(POR_INSTANCE);
|
||||||
|
}
|
||||||
|
if (params.containsKey(POR_INSTANCE_LIKE)) {
|
||||||
|
query.porInstanceLike(LIKE + params.get(POR_INSTANCE_LIKE).get(0) + LIKE);
|
||||||
|
params.remove(POR_INSTANCE_LIKE);
|
||||||
|
}
|
||||||
|
if (params.containsKey(POR_TYPE)) {
|
||||||
|
String[] porType = extractCommaSeparatedFields(params.get(POR_TYPE));
|
||||||
|
query.porTypeIn(porType);
|
||||||
|
params.remove(POR_TYPE);
|
||||||
|
}
|
||||||
|
if (params.containsKey(POR_TYPE_LIKE)) {
|
||||||
|
query.porTypeLike(LIKE + params.get(POR_TYPE_LIKE).get(0) + LIKE);
|
||||||
|
params.remove(POR_TYPE_LIKE);
|
||||||
|
}
|
||||||
|
if (params.containsKey(POR_VALUE)) {
|
||||||
|
String[] porValue = extractCommaSeparatedFields(params.get(POR_VALUE));
|
||||||
|
query.porValueIn(porValue);
|
||||||
|
params.remove(POR_VALUE);
|
||||||
|
}
|
||||||
|
if (params.containsKey(POR_VALUE_LIKE)) {
|
||||||
|
query.porValueLike(LIKE + params.get(POR_VALUE_LIKE).get(0) + LIKE);
|
||||||
|
params.remove(POR_VALUE_LIKE);
|
||||||
|
}
|
||||||
|
if (params.containsKey(TASK_CLASSIFICATION_KEY)) {
|
||||||
|
String[] taskClassificationKey =
|
||||||
|
extractCommaSeparatedFields(params.get(TASK_CLASSIFICATION_KEY));
|
||||||
|
query.taskClassificationKeyIn(taskClassificationKey);
|
||||||
|
params.remove(TASK_CLASSIFICATION_KEY);
|
||||||
|
}
|
||||||
|
if (params.containsKey(TASK_CLASSIFICATION_KEY_LIKE)) {
|
||||||
|
query.taskClassificationKeyLike(
|
||||||
|
LIKE + params.get(TASK_CLASSIFICATION_KEY_LIKE).get(0) + LIKE);
|
||||||
|
params.remove(TASK_CLASSIFICATION_KEY_LIKE);
|
||||||
|
}
|
||||||
|
if (params.containsKey(TASK_CLASSIFICATION_CATEGORY)) {
|
||||||
|
String[] taskClassificationCategory =
|
||||||
|
extractCommaSeparatedFields(params.get(TASK_CLASSIFICATION_CATEGORY));
|
||||||
|
query.taskClassificationCategoryIn(taskClassificationCategory);
|
||||||
|
params.remove(TASK_CLASSIFICATION_CATEGORY);
|
||||||
|
}
|
||||||
|
if (params.containsKey(TASK_CLASSIFICATION_CATEGORY_LIKE)) {
|
||||||
|
query.taskClassificationCategoryLike(
|
||||||
|
LIKE + params.get(TASK_CLASSIFICATION_CATEGORY_LIKE).get(0) + LIKE);
|
||||||
|
params.remove(TASK_CLASSIFICATION_CATEGORY_LIKE);
|
||||||
|
}
|
||||||
|
if (params.containsKey(ATTACHMENT_CLASSIFICATION_KEY)) {
|
||||||
|
String[] attachmentClassificationKey =
|
||||||
|
extractCommaSeparatedFields(params.get(ATTACHMENT_CLASSIFICATION_KEY));
|
||||||
|
query.attachmentClassificationKeyIn(attachmentClassificationKey);
|
||||||
|
params.remove(ATTACHMENT_CLASSIFICATION_KEY);
|
||||||
|
}
|
||||||
|
if (params.containsKey(ATTACHMENT_CLASSIFICATION_KEY_LIKE)) {
|
||||||
|
query.attachmentClassificationKeyLike(
|
||||||
|
LIKE + params.get(ATTACHMENT_CLASSIFICATION_KEY_LIKE).get(0) + LIKE);
|
||||||
|
params.remove(ATTACHMENT_CLASSIFICATION_KEY_LIKE);
|
||||||
|
}
|
||||||
|
if (params.containsKey(CUSTOM_1)) {
|
||||||
|
String[] custom1 = extractCommaSeparatedFields(params.get(CUSTOM_1));
|
||||||
|
query.custom1In(custom1);
|
||||||
|
params.remove(CUSTOM_1);
|
||||||
|
}
|
||||||
|
if (params.containsKey(CUSTOM_1_LIKE)) {
|
||||||
|
query.custom1Like(LIKE + params.get(CUSTOM_1_LIKE).get(0) + LIKE);
|
||||||
|
params.remove(CUSTOM_1_LIKE);
|
||||||
|
}
|
||||||
|
if (params.containsKey(CUSTOM_2)) {
|
||||||
|
String[] custom2 = extractCommaSeparatedFields(params.get(CUSTOM_2));
|
||||||
|
query.custom2In(custom2);
|
||||||
|
params.remove(CUSTOM_2);
|
||||||
|
}
|
||||||
|
if (params.containsKey(CUSTOM_2_LIKE)) {
|
||||||
|
query.custom2Like(LIKE + params.get(CUSTOM_2_LIKE).get(0) + LIKE);
|
||||||
|
params.remove(CUSTOM_2_LIKE);
|
||||||
|
}
|
||||||
|
if (params.containsKey(CUSTOM_3)) {
|
||||||
|
String[] custom3 = extractCommaSeparatedFields(params.get(CUSTOM_3));
|
||||||
|
query.custom3In(custom3);
|
||||||
|
params.remove(CUSTOM_3);
|
||||||
|
}
|
||||||
|
if (params.containsKey(CUSTOM_3_LIKE)) {
|
||||||
|
query.custom3Like(LIKE + params.get(CUSTOM_3_LIKE).get(0) + LIKE);
|
||||||
|
params.remove(CUSTOM_3_LIKE);
|
||||||
|
}
|
||||||
|
if (params.containsKey(CUSTOM_4)) {
|
||||||
|
String[] custom4 = extractCommaSeparatedFields(params.get(CUSTOM_4));
|
||||||
|
query.custom4In(custom4);
|
||||||
|
params.remove(CUSTOM_4);
|
||||||
|
}
|
||||||
|
if (params.containsKey(CUSTOM_4_LIKE)) {
|
||||||
|
query.custom4Like(LIKE + params.get(CUSTOM_4_LIKE).get(0) + LIKE);
|
||||||
|
params.remove(CUSTOM_4_LIKE);
|
||||||
|
}
|
||||||
|
if (LOGGER.isDebugEnabled()) {
|
||||||
|
LOGGER.debug("Exit from applyFilterParams(), returning {}", query);
|
||||||
|
}
|
||||||
|
|
||||||
|
return query;
|
||||||
|
}
|
||||||
|
|
||||||
|
private TimeInterval getTimeIntervalOf(String[] created) {
|
||||||
|
LocalDate begin;
|
||||||
|
LocalDate end;
|
||||||
|
try {
|
||||||
|
begin = LocalDate.parse(created[0]);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new IllegalArgumentException(
|
||||||
|
"Cannot parse String '"
|
||||||
|
+ created[0]
|
||||||
|
+ "'. Expected a String of the Format 'yyyy-MM-dd'.");
|
||||||
|
}
|
||||||
|
if (created.length < 2) {
|
||||||
|
end = begin.plusDays(1);
|
||||||
|
} else {
|
||||||
|
end = LocalDate.parse(created[1]);
|
||||||
|
}
|
||||||
|
Instant beginInst = begin.atStartOfDay(ZoneId.systemDefault()).toInstant();
|
||||||
|
Instant endInst = end.atStartOfDay(ZoneId.systemDefault()).toInstant();
|
||||||
|
TimeInterval timeInterval = new TimeInterval(beginInst, endInst);
|
||||||
|
return timeInterval;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,17 +7,14 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||||
|
|
||||||
import pro.taskana.simplehistory.impl.SimpleHistoryServiceImpl;
|
import pro.taskana.simplehistory.impl.SimpleHistoryServiceImpl;
|
||||||
|
|
||||||
/**
|
/** Configuration for Taskana history REST service. */
|
||||||
* Configuration for Taskana history REST service.
|
|
||||||
*/
|
|
||||||
@Configuration
|
@Configuration
|
||||||
@ComponentScan(basePackages = {"pro.taskana.rest", "pro.taskana.rest.simplehistory"})
|
@ComponentScan(basePackages = {"pro.taskana.rest", "pro.taskana.rest.simplehistory"})
|
||||||
@EnableTransactionManagement
|
@EnableTransactionManagement
|
||||||
public class TaskHistoryRestConfiguration {
|
public class TaskHistoryRestConfiguration {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public SimpleHistoryServiceImpl getSimpleHistoryService() {
|
public SimpleHistoryServiceImpl getSimpleHistoryService() {
|
||||||
return new SimpleHistoryServiceImpl();
|
return new SimpleHistoryServiceImpl();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,76 +8,75 @@ import java.io.StringWriter;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
|
|
||||||
import org.apache.ibatis.jdbc.ScriptRunner;
|
import org.apache.ibatis.jdbc.ScriptRunner;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import pro.taskana.configuration.DB;
|
import pro.taskana.configuration.DB;
|
||||||
|
|
||||||
/**
|
/** This class generates sample data for manual testing purposes. */
|
||||||
* This class generates sample data for manual testing purposes.
|
|
||||||
*/
|
|
||||||
public class SampleDataGenerator {
|
public class SampleDataGenerator {
|
||||||
|
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(SampleDataGenerator.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(SampleDataGenerator.class);
|
||||||
private static final String TEST_DATA = "/sql.sample-data";
|
private static final String TEST_DATA = "/sql.sample-data";
|
||||||
private static final String CLEAR = TEST_DATA + "/clear-db.sql";
|
private static final String CLEAR = TEST_DATA + "/clear-db.sql";
|
||||||
private static final String HISTORY_EVENT = TEST_DATA + "/history-event.sql";
|
private static final String HISTORY_EVENT = TEST_DATA + "/history-event.sql";
|
||||||
private ScriptRunner runner;
|
DataSource dataSource;
|
||||||
|
String dbProductName;
|
||||||
|
private ScriptRunner runner;
|
||||||
|
|
||||||
DataSource dataSource;
|
public SampleDataGenerator(DataSource dataSource) throws SQLException {
|
||||||
String dbProductName;
|
try (Connection connection = dataSource.getConnection()) {
|
||||||
|
dbProductName = connection.getMetaData().getDatabaseProductName();
|
||||||
|
if (LOGGER.isTraceEnabled()) {
|
||||||
|
String msg = connection.getMetaData().toString();
|
||||||
|
LOGGER.trace(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.dataSource = dataSource;
|
||||||
|
|
||||||
public SampleDataGenerator(DataSource dataSource) throws SQLException {
|
runner = new ScriptRunner(dataSource.getConnection());
|
||||||
try (Connection connection = dataSource.getConnection()) {
|
}
|
||||||
dbProductName = connection.getMetaData().getDatabaseProductName();
|
|
||||||
if (LOGGER.isTraceEnabled()) {
|
|
||||||
String msg = connection.getMetaData().toString();
|
|
||||||
LOGGER.trace(msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.dataSource = dataSource;
|
|
||||||
|
|
||||||
runner = new ScriptRunner(dataSource.getConnection());
|
public void generateSampleData(String schemaName) {
|
||||||
|
StringWriter outWriter = new StringWriter();
|
||||||
|
PrintWriter logWriter = new PrintWriter(outWriter);
|
||||||
|
|
||||||
|
StringWriter errorWriter = new StringWriter();
|
||||||
|
PrintWriter errorLogWriter = new PrintWriter(errorWriter);
|
||||||
|
try {
|
||||||
|
runner.runScript(selectSchemaScript(dbProductName, schemaName));
|
||||||
|
runner.setStopOnError(false);
|
||||||
|
runner.runScript(
|
||||||
|
new BufferedReader(
|
||||||
|
new InputStreamReader(
|
||||||
|
this.getClass().getResourceAsStream(CLEAR), StandardCharsets.UTF_8)));
|
||||||
|
} catch (Exception e) {
|
||||||
|
LOGGER.error("caught Exception {}", e, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void generateSampleData(String schemaName) {
|
runner.setStopOnError(true);
|
||||||
StringWriter outWriter = new StringWriter();
|
runner.setLogWriter(logWriter);
|
||||||
PrintWriter logWriter = new PrintWriter(outWriter);
|
runner.setErrorLogWriter(errorLogWriter);
|
||||||
|
|
||||||
StringWriter errorWriter = new StringWriter();
|
runner.runScript(
|
||||||
PrintWriter errorLogWriter = new PrintWriter(errorWriter);
|
new BufferedReader(
|
||||||
try {
|
new InputStreamReader(
|
||||||
runner.runScript(selectSchemaScript(dbProductName, schemaName));
|
this.getClass().getResourceAsStream(HISTORY_EVENT), StandardCharsets.UTF_8)));
|
||||||
runner.setStopOnError(false);
|
|
||||||
runner.runScript(new BufferedReader(
|
|
||||||
new InputStreamReader(this.getClass().getResourceAsStream(CLEAR), StandardCharsets.UTF_8)));
|
|
||||||
} catch (Exception e) {
|
|
||||||
LOGGER.error("caught Exception {}", e, e);
|
|
||||||
}
|
|
||||||
|
|
||||||
runner.setStopOnError(true);
|
runner.closeConnection();
|
||||||
runner.setLogWriter(logWriter);
|
|
||||||
runner.setErrorLogWriter(errorLogWriter);
|
|
||||||
|
|
||||||
runner.runScript(new BufferedReader(
|
LOGGER.trace(outWriter.toString());
|
||||||
new InputStreamReader(this.getClass().getResourceAsStream(HISTORY_EVENT), StandardCharsets.UTF_8)));
|
if (!errorWriter.toString().trim().isEmpty()) {
|
||||||
|
LOGGER.error(errorWriter.toString());
|
||||||
runner.closeConnection();
|
|
||||||
|
|
||||||
LOGGER.trace(outWriter.toString());
|
|
||||||
if (!errorWriter.toString().trim().isEmpty()) {
|
|
||||||
LOGGER.error(errorWriter.toString());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private StringReader selectSchemaScript(String dbProductName, String schemaName) {
|
private StringReader selectSchemaScript(String dbProductName, String schemaName) {
|
||||||
return new StringReader(DB.isPostgreSQL(dbProductName)
|
return new StringReader(
|
||||||
|
DB.isPostgreSQL(dbProductName)
|
||||||
? "SET search_path TO " + schemaName + ";"
|
? "SET search_path TO " + schemaName + ";"
|
||||||
: "SET SCHEMA " + schemaName + ";");
|
: "SET SCHEMA " + schemaName + ";");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,7 @@
|
||||||
package pro.taskana.rest;
|
package pro.taskana.rest;
|
||||||
|
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
|
|
@ -21,48 +19,47 @@ import org.springframework.transaction.PlatformTransactionManager;
|
||||||
import pro.taskana.rest.simplehistory.TaskHistoryRestConfiguration;
|
import pro.taskana.rest.simplehistory.TaskHistoryRestConfiguration;
|
||||||
import pro.taskana.rest.simplehistory.sampledata.SampleDataGenerator;
|
import pro.taskana.rest.simplehistory.sampledata.SampleDataGenerator;
|
||||||
|
|
||||||
/**
|
/** Example Application to create the documentation. */
|
||||||
* Example Application to create the documentation.
|
|
||||||
*/
|
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
@ComponentScan(basePackages = "pro.taskana.rest.simplehistory")
|
@ComponentScan(basePackages = "pro.taskana.rest.simplehistory")
|
||||||
@Import({TaskHistoryRestConfiguration.class})
|
@Import({TaskHistoryRestConfiguration.class})
|
||||||
public class ExampleDocumentationApplication {
|
public class ExampleDocumentationApplication {
|
||||||
|
|
||||||
@Value("${taskana.schemaName:TASKANA}")
|
@Value("${taskana.schemaName:TASKANA}")
|
||||||
private String schemaName;
|
private String schemaName;
|
||||||
|
|
||||||
@Autowired
|
@Autowired private SampleDataGenerator sampleDataGenerator;
|
||||||
private SampleDataGenerator sampleDataGenerator;
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
SpringApplication.run(ExampleDocumentationApplication.class, args);
|
SpringApplication.run(ExampleDocumentationApplication.class, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@Primary
|
@Primary
|
||||||
@ConfigurationProperties(prefix = "datasource")
|
@ConfigurationProperties(prefix = "datasource")
|
||||||
public DataSourceProperties dataSourceProperties() {
|
public DataSourceProperties dataSourceProperties() {
|
||||||
DataSourceProperties props = new DataSourceProperties();
|
DataSourceProperties props = new DataSourceProperties();
|
||||||
props.setUrl("jdbc:h2:mem:taskana;IGNORECASE=TRUE;LOCK_MODE=0;INIT=CREATE SCHEMA IF NOT EXISTS " + schemaName);
|
props.setUrl(
|
||||||
return props;
|
"jdbc:h2:mem:taskana;IGNORECASE=TRUE;LOCK_MODE=0;INIT=CREATE SCHEMA IF NOT EXISTS "
|
||||||
}
|
+ schemaName);
|
||||||
|
return props;
|
||||||
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public DataSource dataSource(DataSourceProperties properties) {
|
public DataSource dataSource(DataSourceProperties properties) {
|
||||||
return properties.initializeDataSourceBuilder().build();
|
return properties.initializeDataSourceBuilder().build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public PlatformTransactionManager txManager(DataSource dataSource) {
|
public PlatformTransactionManager txManager(DataSource dataSource) {
|
||||||
return new DataSourceTransactionManager(dataSource);
|
return new DataSourceTransactionManager(dataSource);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@DependsOn("getTaskanaEngine") // generate sample data after schema was inserted
|
@DependsOn("getTaskanaEngine") // generate sample data after schema was inserted
|
||||||
public SampleDataGenerator generateSampleData(DataSource dataSource) throws SQLException {
|
public SampleDataGenerator generateSampleData(DataSource dataSource) throws SQLException {
|
||||||
sampleDataGenerator = new SampleDataGenerator(dataSource);
|
sampleDataGenerator = new SampleDataGenerator(dataSource);
|
||||||
sampleDataGenerator.generateSampleData(schemaName);
|
sampleDataGenerator.generateSampleData(schemaName);
|
||||||
return sampleDataGenerator;
|
return sampleDataGenerator;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,12 +5,12 @@ import static org.junit.Assert.assertNotNull;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
import static org.junit.Assert.fail;
|
import static org.junit.Assert.fail;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
|
@ -35,171 +35,176 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||||
import org.springframework.web.client.HttpClientErrorException;
|
import org.springframework.web.client.HttpClientErrorException;
|
||||||
import org.springframework.web.client.RestTemplate;
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
||||||
|
|
||||||
import pro.taskana.exceptions.SystemException;
|
import pro.taskana.exceptions.SystemException;
|
||||||
import pro.taskana.rest.resource.TaskHistoryEventListResource;
|
import pro.taskana.rest.resource.TaskHistoryEventListResource;
|
||||||
import pro.taskana.rest.simplehistory.TaskHistoryRestConfiguration;
|
import pro.taskana.rest.simplehistory.TaskHistoryRestConfiguration;
|
||||||
import pro.taskana.rest.simplehistory.sampledata.SampleDataGenerator;
|
import pro.taskana.rest.simplehistory.sampledata.SampleDataGenerator;
|
||||||
|
|
||||||
/**
|
/** Controller for integration test. */
|
||||||
* Controller for integration test.
|
|
||||||
*/
|
|
||||||
@EnableAutoConfiguration
|
@EnableAutoConfiguration
|
||||||
@RunWith(SpringRunner.class)
|
@RunWith(SpringRunner.class)
|
||||||
@SpringBootTest(classes = {TaskHistoryRestConfiguration.class},
|
@SpringBootTest(
|
||||||
|
classes = {TaskHistoryRestConfiguration.class},
|
||||||
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||||||
public class TaskHistoryEventControllerIntTest {
|
public class TaskHistoryEventControllerIntTest {
|
||||||
|
|
||||||
@Value("${taskana.schemaName:TASKANA}")
|
private static final Logger LOGGER =
|
||||||
public String schemaName;
|
LoggerFactory.getLogger(TaskHistoryEventControllerIntTest.class);
|
||||||
|
@Value("${taskana.schemaName:TASKANA}")
|
||||||
|
public String schemaName;
|
||||||
|
String server = "http://127.0.0.1:";
|
||||||
|
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(TaskHistoryEventControllerIntTest.class);
|
RestTemplate template;
|
||||||
|
|
||||||
String server = "http://127.0.0.1:";
|
HttpEntity<String> request;
|
||||||
|
|
||||||
RestTemplate template;
|
@LocalServerPort int port;
|
||||||
|
|
||||||
HttpEntity<String> request;
|
@Autowired private DataSource dataSource;
|
||||||
|
|
||||||
@LocalServerPort
|
@Before
|
||||||
int port;
|
public void before() {
|
||||||
|
template = getRestTemplate();
|
||||||
@Autowired
|
SampleDataGenerator sampleDataGenerator;
|
||||||
private DataSource dataSource;
|
try {
|
||||||
|
sampleDataGenerator = new SampleDataGenerator(dataSource);
|
||||||
@Before
|
sampleDataGenerator.generateSampleData(schemaName);
|
||||||
public void before() {
|
} catch (SQLException e) {
|
||||||
template = getRestTemplate();
|
throw new SystemException("tried to reset DB and caught Exception " + e, e);
|
||||||
SampleDataGenerator sampleDataGenerator;
|
|
||||||
try {
|
|
||||||
sampleDataGenerator = new SampleDataGenerator(dataSource);
|
|
||||||
sampleDataGenerator.generateSampleData(schemaName);
|
|
||||||
} catch (SQLException e) {
|
|
||||||
throw new SystemException("tried to reset DB and caught Exception " + e, e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetAllHistoryEvent() {
|
public void testGetAllHistoryEvent() {
|
||||||
ResponseEntity<TaskHistoryEventListResource> response = template.exchange(
|
ResponseEntity<TaskHistoryEventListResource> response =
|
||||||
server + port + "/api/v1/task-history-event", HttpMethod.GET, request,
|
template.exchange(
|
||||||
new ParameterizedTypeReference<TaskHistoryEventListResource>() {
|
server + port + "/api/v1/task-history-event",
|
||||||
});
|
HttpMethod.GET,
|
||||||
assertNotNull(response.getBody().getLink(Link.REL_SELF));
|
request,
|
||||||
assertEquals(50, response.getBody().getContent().size());
|
new ParameterizedTypeReference<TaskHistoryEventListResource>() {});
|
||||||
}
|
assertNotNull(response.getBody().getLink(Link.REL_SELF));
|
||||||
|
assertEquals(50, response.getBody().getContent().size());
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetAllHistoryEventDescendingOrder() {
|
public void testGetAllHistoryEventDescendingOrder() {
|
||||||
String parameters = "/api/v1/task-history-event?sort-by=business-process-id&order=desc&page-size=3&page=1";
|
String parameters =
|
||||||
ResponseEntity<TaskHistoryEventListResource> response = template.exchange(
|
"/api/v1/task-history-event?sort-by=business-process-id&order=desc&page-size=3&page=1";
|
||||||
server + port + parameters, HttpMethod.GET, request,
|
ResponseEntity<TaskHistoryEventListResource> response =
|
||||||
new ParameterizedTypeReference<TaskHistoryEventListResource>() {
|
template.exchange(
|
||||||
});
|
server + port + parameters,
|
||||||
assertNotNull(response.getBody().getLink(Link.REL_SELF));
|
HttpMethod.GET,
|
||||||
assertEquals(3, response.getBody().getContent().size());
|
request,
|
||||||
assertTrue(response.getBody()
|
new ParameterizedTypeReference<TaskHistoryEventListResource>() {});
|
||||||
.getLink(Link.REL_SELF)
|
assertNotNull(response.getBody().getLink(Link.REL_SELF));
|
||||||
.getHref()
|
assertEquals(3, response.getBody().getContent().size());
|
||||||
.endsWith(parameters));
|
assertTrue(response.getBody().getLink(Link.REL_SELF).getHref().endsWith(parameters));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetSpecificTaskHistoryEvent() {
|
public void testGetSpecificTaskHistoryEvent() {
|
||||||
ResponseEntity<TaskHistoryEventListResource> response = template.exchange(
|
ResponseEntity<TaskHistoryEventListResource> response =
|
||||||
server + port
|
template.exchange(
|
||||||
|
server
|
||||||
|
+ port
|
||||||
+ "/api/v1/task-history-event?business-process-id=BPI:01&sort-by=business-process-id&order=asc&page-size=6&page=1",
|
+ "/api/v1/task-history-event?business-process-id=BPI:01&sort-by=business-process-id&order=asc&page-size=6&page=1",
|
||||||
HttpMethod.GET, request,
|
HttpMethod.GET,
|
||||||
new ParameterizedTypeReference<TaskHistoryEventListResource>() {
|
request,
|
||||||
|
new ParameterizedTypeReference<TaskHistoryEventListResource>() {});
|
||||||
|
|
||||||
});
|
assertNotNull(response.getBody().getLink(Link.REL_SELF));
|
||||||
assertNotNull(response.getBody().getLink(Link.REL_SELF));
|
assertNotNull(response.getBody().getLinks());
|
||||||
assertNotNull(response.getBody().getLinks());
|
assertNotNull(response.getBody().getMetadata());
|
||||||
assertNotNull(response.getBody().getMetadata());
|
assertEquals(1, response.getBody().getContent().size());
|
||||||
assertEquals(1, response.getBody().getContent().size());
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testThrowsExceptionIfInvalidFilterIsUsed() {
|
||||||
|
try {
|
||||||
|
template.exchange(
|
||||||
|
server + port + "/api/v1/task-history-event?invalid=BPI:01",
|
||||||
|
HttpMethod.GET,
|
||||||
|
request,
|
||||||
|
new ParameterizedTypeReference<TaskHistoryEventListResource>() {});
|
||||||
|
fail();
|
||||||
|
} catch (HttpClientErrorException e) {
|
||||||
|
assertEquals(HttpStatus.BAD_REQUEST, e.getStatusCode());
|
||||||
|
assertTrue(e.getResponseBodyAsString().contains("[invalid]"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGetHistoryEventOfDate() {
|
||||||
|
String currentTime = LocalDateTime.now().toString();
|
||||||
|
|
||||||
|
try {
|
||||||
|
template.exchange(
|
||||||
|
server + port + "/api/v1/task-history-event?created=" + currentTime,
|
||||||
|
HttpMethod.GET,
|
||||||
|
request,
|
||||||
|
new ParameterizedTypeReference<TaskHistoryEventListResource>() {});
|
||||||
|
fail();
|
||||||
|
} catch (HttpClientErrorException e) {
|
||||||
|
assertEquals(HttpStatus.BAD_REQUEST, e.getStatusCode());
|
||||||
|
assertTrue(e.getResponseBodyAsString().contains(currentTime));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
// correct Format 'yyyy-MM-dd'
|
||||||
public void testThrowsExceptionIfInvalidFilterIsUsed() {
|
currentTime = currentTime.substring(0, 10);
|
||||||
try {
|
ResponseEntity<TaskHistoryEventListResource> response =
|
||||||
template.exchange(
|
template.exchange(
|
||||||
server + port + "/api/v1/task-history-event?invalid=BPI:01", HttpMethod.GET, request,
|
server + port + "/api/v1/task-history-event?created=" + currentTime,
|
||||||
new ParameterizedTypeReference<TaskHistoryEventListResource>() {
|
HttpMethod.GET,
|
||||||
});
|
request,
|
||||||
fail();
|
new ParameterizedTypeReference<TaskHistoryEventListResource>() {});
|
||||||
} catch (HttpClientErrorException e) {
|
assertNotNull(response.getBody().getLink(Link.REL_SELF));
|
||||||
assertEquals(HttpStatus.BAD_REQUEST, e.getStatusCode());
|
assertEquals(25, response.getBody().getContent().size());
|
||||||
assertTrue(e.getResponseBodyAsString().contains("[invalid]"));
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetHistoryEventOfDate() {
|
public void testGetSecondPageSortedByKey() {
|
||||||
String currentTime = LocalDateTime.now().toString();
|
String parameters =
|
||||||
|
"/api/v1/task-history-event?sort-by=workbasket-key&order=desc&page=2&page-size=2";
|
||||||
|
ResponseEntity<TaskHistoryEventListResource> response =
|
||||||
|
template.exchange(
|
||||||
|
server + port + parameters,
|
||||||
|
HttpMethod.GET,
|
||||||
|
request,
|
||||||
|
new ParameterizedTypeReference<TaskHistoryEventListResource>() {});
|
||||||
|
|
||||||
try {
|
assertEquals(2, response.getBody().getContent().size());
|
||||||
template.exchange(
|
assertEquals(
|
||||||
server + port + "/api/v1/task-history-event?created=" + currentTime, HttpMethod.GET, request,
|
"WBI:100000000000000000000000000000000002",
|
||||||
new ParameterizedTypeReference<TaskHistoryEventListResource>() {
|
response.getBody().getContent().iterator().next().getWorkbasketKey());
|
||||||
});
|
assertNotNull(response.getBody().getLink(Link.REL_SELF));
|
||||||
fail();
|
assertTrue(response.getBody().getLink(Link.REL_SELF).getHref().endsWith(parameters));
|
||||||
} catch (HttpClientErrorException e) {
|
assertNotNull(response.getBody().getLink("allTaskHistoryEvent"));
|
||||||
assertEquals(HttpStatus.BAD_REQUEST, e.getStatusCode());
|
assertTrue(
|
||||||
assertTrue(e.getResponseBodyAsString().contains(currentTime));
|
response
|
||||||
}
|
.getBody()
|
||||||
|
|
||||||
// correct Format 'yyyy-MM-dd'
|
|
||||||
currentTime = currentTime.substring(0, 10);
|
|
||||||
ResponseEntity<TaskHistoryEventListResource> response = template.exchange(
|
|
||||||
server + port + "/api/v1/task-history-event?created=" + currentTime, HttpMethod.GET, request,
|
|
||||||
new ParameterizedTypeReference<TaskHistoryEventListResource>() {
|
|
||||||
});
|
|
||||||
assertNotNull(response.getBody().getLink(Link.REL_SELF));
|
|
||||||
assertEquals(25, response.getBody().getContent().size());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testGetSecondPageSortedByKey() {
|
|
||||||
String parameters = "/api/v1/task-history-event?sort-by=workbasket-key&order=desc&page=2&page-size=2";
|
|
||||||
ResponseEntity<TaskHistoryEventListResource> response = template.exchange(
|
|
||||||
server + port + parameters, HttpMethod.GET, request,
|
|
||||||
new ParameterizedTypeReference<TaskHistoryEventListResource>() {
|
|
||||||
|
|
||||||
});
|
|
||||||
assertEquals(2, response.getBody().getContent().size());
|
|
||||||
assertEquals("WBI:100000000000000000000000000000000002",
|
|
||||||
response.getBody().getContent().iterator().next().getWorkbasketKey());
|
|
||||||
assertNotNull(response.getBody().getLink(Link.REL_SELF));
|
|
||||||
assertTrue(response.getBody()
|
|
||||||
.getLink(Link.REL_SELF)
|
|
||||||
.getHref()
|
|
||||||
.endsWith(parameters));
|
|
||||||
assertNotNull(response.getBody().getLink("allTaskHistoryEvent"));
|
|
||||||
assertTrue(response.getBody()
|
|
||||||
.getLink("allTaskHistoryEvent")
|
.getLink("allTaskHistoryEvent")
|
||||||
.getHref()
|
.getHref()
|
||||||
.endsWith("/api/v1/task-history-event"));
|
.endsWith("/api/v1/task-history-event"));
|
||||||
assertNotNull(response.getBody().getLink(Link.REL_FIRST));
|
assertNotNull(response.getBody().getLink(Link.REL_FIRST));
|
||||||
assertNotNull(response.getBody().getLink(Link.REL_LAST));
|
assertNotNull(response.getBody().getLink(Link.REL_LAST));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a REST template which is capable of dealing with responses in HAL format.
|
* Return a REST template which is capable of dealing with responses in HAL format.
|
||||||
*
|
*
|
||||||
* @return RestTemplate
|
* @return RestTemplate
|
||||||
*/
|
*/
|
||||||
private RestTemplate getRestTemplate() {
|
private RestTemplate getRestTemplate() {
|
||||||
ObjectMapper mapper = new ObjectMapper();
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||||
mapper.registerModule(new Jackson2HalModule());
|
mapper.registerModule(new Jackson2HalModule());
|
||||||
|
|
||||||
MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter();
|
MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter();
|
||||||
converter.setSupportedMediaTypes(MediaType.parseMediaTypes("application/hal+json"));
|
converter.setSupportedMediaTypes(MediaType.parseMediaTypes("application/hal+json"));
|
||||||
converter.setObjectMapper(mapper);
|
converter.setObjectMapper(mapper);
|
||||||
|
|
||||||
RestTemplate template = new RestTemplate(Collections.<HttpMessageConverter<?>> singletonList(converter));
|
RestTemplate template =
|
||||||
return template;
|
new RestTemplate(Collections.<HttpMessageConverter<?>>singletonList(converter));
|
||||||
}
|
return template;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,6 @@ import static org.springframework.restdocs.payload.PayloadDocumentation.response
|
||||||
import static org.springframework.restdocs.payload.PayloadDocumentation.subsectionWithPath;
|
import static org.springframework.restdocs.payload.PayloadDocumentation.subsectionWithPath;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
@ -30,168 +29,177 @@ import org.springframework.web.context.WebApplicationContext;
|
||||||
|
|
||||||
import pro.taskana.rest.simplehistory.TaskHistoryRestConfiguration;
|
import pro.taskana.rest.simplehistory.TaskHistoryRestConfiguration;
|
||||||
|
|
||||||
/**
|
/** Generate documentation for the history event controller. */
|
||||||
* Generate documentation for the history event controller.
|
|
||||||
*/
|
|
||||||
@RunWith(SpringRunner.class)
|
@RunWith(SpringRunner.class)
|
||||||
@SpringBootTest(classes = TaskHistoryRestConfiguration.class,
|
@SpringBootTest(
|
||||||
|
classes = TaskHistoryRestConfiguration.class,
|
||||||
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||||||
public class TaskHistoryEventControllerRestDocumentation {
|
public class TaskHistoryEventControllerRestDocumentation {
|
||||||
|
|
||||||
@LocalServerPort
|
@Rule public JUnitRestDocumentation restDocumentation = new JUnitRestDocumentation();
|
||||||
int port;
|
@LocalServerPort int port;
|
||||||
|
@Autowired private WebApplicationContext context;
|
||||||
|
|
||||||
@Rule
|
private MockMvc mockMvc;
|
||||||
public JUnitRestDocumentation restDocumentation = new JUnitRestDocumentation();
|
|
||||||
|
|
||||||
@Autowired
|
private HashMap<String, String> taskHistoryEventFieldDescriptionsMap =
|
||||||
private WebApplicationContext context;
|
new HashMap<String, String>();
|
||||||
|
|
||||||
private MockMvc mockMvc;
|
private FieldDescriptor[] allTaskHistoryEventFieldDescriptors;
|
||||||
|
|
||||||
private HashMap<String, String> taskHistoryEventFieldDescriptionsMap = new HashMap<String, String>();
|
private FieldDescriptor[] taskHistoryEventFieldDescriptors;
|
||||||
|
|
||||||
private FieldDescriptor[] allTaskHistoryEventFieldDescriptors;
|
@Before
|
||||||
|
public void setUp() {
|
||||||
|
document("{methodName}", preprocessRequest(prettyPrint()), preprocessResponse(prettyPrint()));
|
||||||
|
|
||||||
private FieldDescriptor[] taskHistoryEventFieldDescriptors;
|
this.mockMvc =
|
||||||
|
MockMvcBuilders.webAppContextSetup(this.context)
|
||||||
@Before
|
.apply(
|
||||||
public void setUp() {
|
documentationConfiguration(this.restDocumentation)
|
||||||
document("{methodName}",
|
.operationPreprocessors()
|
||||||
preprocessRequest(prettyPrint()),
|
.withResponseDefaults(prettyPrint())
|
||||||
preprocessResponse(prettyPrint()));
|
.withRequestDefaults(prettyPrint()))
|
||||||
|
|
||||||
this.mockMvc = MockMvcBuilders.webAppContextSetup(this.context)
|
|
||||||
.apply(documentationConfiguration(this.restDocumentation)
|
|
||||||
.operationPreprocessors()
|
|
||||||
.withResponseDefaults(prettyPrint())
|
|
||||||
.withRequestDefaults(prettyPrint()))
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
taskHistoryEventFieldDescriptionsMap.put("taskHistoryId", "Unique ID");
|
taskHistoryEventFieldDescriptionsMap.put("taskHistoryId", "Unique ID");
|
||||||
taskHistoryEventFieldDescriptionsMap.put("businessProcessId", "The id of the business process");
|
taskHistoryEventFieldDescriptionsMap.put("businessProcessId", "The id of the business process");
|
||||||
taskHistoryEventFieldDescriptionsMap.put("parentBusinessProcessId",
|
taskHistoryEventFieldDescriptionsMap.put(
|
||||||
"The id of the parent business process");
|
"parentBusinessProcessId", "The id of the parent business process");
|
||||||
taskHistoryEventFieldDescriptionsMap.put("taskId", "The id of the task");
|
taskHistoryEventFieldDescriptionsMap.put("taskId", "The id of the task");
|
||||||
taskHistoryEventFieldDescriptionsMap.put("eventType", "The type of the event");
|
taskHistoryEventFieldDescriptionsMap.put("eventType", "The type of the event");
|
||||||
taskHistoryEventFieldDescriptionsMap.put("created", "The time was created");
|
taskHistoryEventFieldDescriptionsMap.put("created", "The time was created");
|
||||||
taskHistoryEventFieldDescriptionsMap.put("userId", "The id of the user");
|
taskHistoryEventFieldDescriptionsMap.put("userId", "The id of the user");
|
||||||
taskHistoryEventFieldDescriptionsMap.put("domain", "Domain");
|
taskHistoryEventFieldDescriptionsMap.put("domain", "Domain");
|
||||||
taskHistoryEventFieldDescriptionsMap.put("workbasketKey", "The key of workbasket");
|
taskHistoryEventFieldDescriptionsMap.put("workbasketKey", "The key of workbasket");
|
||||||
taskHistoryEventFieldDescriptionsMap.put("porCompany", "");
|
taskHistoryEventFieldDescriptionsMap.put("porCompany", "");
|
||||||
taskHistoryEventFieldDescriptionsMap.put("porSystem", "");
|
taskHistoryEventFieldDescriptionsMap.put("porSystem", "");
|
||||||
taskHistoryEventFieldDescriptionsMap.put("porInstance", "");
|
taskHistoryEventFieldDescriptionsMap.put("porInstance", "");
|
||||||
taskHistoryEventFieldDescriptionsMap.put("porValue", "");
|
taskHistoryEventFieldDescriptionsMap.put("porValue", "");
|
||||||
taskHistoryEventFieldDescriptionsMap.put("porType", "");
|
taskHistoryEventFieldDescriptionsMap.put("porType", "");
|
||||||
taskHistoryEventFieldDescriptionsMap.put("taskClassificationKey", "The key of classification task");
|
taskHistoryEventFieldDescriptionsMap.put(
|
||||||
taskHistoryEventFieldDescriptionsMap.put("taskClassificationCategory",
|
"taskClassificationKey", "The key of classification task");
|
||||||
"The category of classification");
|
taskHistoryEventFieldDescriptionsMap.put(
|
||||||
taskHistoryEventFieldDescriptionsMap.put("attachmentClassificationKey", "");
|
"taskClassificationCategory", "The category of classification");
|
||||||
taskHistoryEventFieldDescriptionsMap.put("comment", "");
|
taskHistoryEventFieldDescriptionsMap.put("attachmentClassificationKey", "");
|
||||||
taskHistoryEventFieldDescriptionsMap.put("oldValue", "The old value");
|
taskHistoryEventFieldDescriptionsMap.put("comment", "");
|
||||||
taskHistoryEventFieldDescriptionsMap.put("newValue", "The new value");
|
taskHistoryEventFieldDescriptionsMap.put("oldValue", "The old value");
|
||||||
taskHistoryEventFieldDescriptionsMap.put("custom1", "A custom property with name \"1\"");
|
taskHistoryEventFieldDescriptionsMap.put("newValue", "The new value");
|
||||||
taskHistoryEventFieldDescriptionsMap.put("custom2", "A custom property with name \"2\"");
|
taskHistoryEventFieldDescriptionsMap.put("custom1", "A custom property with name \"1\"");
|
||||||
taskHistoryEventFieldDescriptionsMap.put("custom3", "A custom property with name \"3\"");
|
taskHistoryEventFieldDescriptionsMap.put("custom2", "A custom property with name \"2\"");
|
||||||
taskHistoryEventFieldDescriptionsMap.put("custom4", "A custom property with name \"4\"");
|
taskHistoryEventFieldDescriptionsMap.put("custom3", "A custom property with name \"3\"");
|
||||||
taskHistoryEventFieldDescriptionsMap.put("oldData", "The old data");
|
taskHistoryEventFieldDescriptionsMap.put("custom4", "A custom property with name \"4\"");
|
||||||
taskHistoryEventFieldDescriptionsMap.put("newData", "The new data");
|
taskHistoryEventFieldDescriptionsMap.put("oldData", "The old data");
|
||||||
taskHistoryEventFieldDescriptionsMap.put("_links.self.href", "The links of this task history event");
|
taskHistoryEventFieldDescriptionsMap.put("newData", "The new data");
|
||||||
taskHistoryEventFieldDescriptionsMap.put("_links.allTaskHistoryEvent.href", "Link to all task history event");
|
taskHistoryEventFieldDescriptionsMap.put(
|
||||||
taskHistoryEventFieldDescriptionsMap.put("_links.first.href", "Link to the first result");
|
"_links.self.href", "The links of this task history event");
|
||||||
taskHistoryEventFieldDescriptionsMap.put("_links.last.href", "Link to the last result");
|
taskHistoryEventFieldDescriptionsMap.put(
|
||||||
|
"_links.allTaskHistoryEvent.href", "Link to all task history event");
|
||||||
|
taskHistoryEventFieldDescriptionsMap.put("_links.first.href", "Link to the first result");
|
||||||
|
taskHistoryEventFieldDescriptionsMap.put("_links.last.href", "Link to the last result");
|
||||||
|
|
||||||
allTaskHistoryEventFieldDescriptors = new FieldDescriptor[] {
|
allTaskHistoryEventFieldDescriptors =
|
||||||
subsectionWithPath("taskHistoryEvents").description("An array of Task history event"),
|
new FieldDescriptor[] {
|
||||||
fieldWithPath("_links.allTaskHistoryEvent.href").ignored(),
|
subsectionWithPath("taskHistoryEvents").description("An array of Task history event"),
|
||||||
fieldWithPath("_links.self.href").ignored(),
|
fieldWithPath("_links.allTaskHistoryEvent.href").ignored(),
|
||||||
fieldWithPath("_links.first.href").ignored(),
|
fieldWithPath("_links.self.href").ignored(),
|
||||||
fieldWithPath("_links.last.href").ignored(),
|
fieldWithPath("_links.first.href").ignored(),
|
||||||
fieldWithPath("_links.next.href").ignored(),
|
fieldWithPath("_links.last.href").ignored(),
|
||||||
fieldWithPath("page.size").ignored(),
|
fieldWithPath("_links.next.href").ignored(),
|
||||||
fieldWithPath("page.totalElements").ignored(),
|
fieldWithPath("page.size").ignored(),
|
||||||
fieldWithPath("page.totalPages").ignored(),
|
fieldWithPath("page.totalElements").ignored(),
|
||||||
fieldWithPath("page.number").ignored()
|
fieldWithPath("page.totalPages").ignored(),
|
||||||
|
fieldWithPath("page.number").ignored()
|
||||||
};
|
};
|
||||||
|
|
||||||
taskHistoryEventFieldDescriptors = new FieldDescriptor[] {
|
taskHistoryEventFieldDescriptors =
|
||||||
fieldWithPath("taskHistoryEvents[].taskHistoryId").description(
|
new FieldDescriptor[] {
|
||||||
taskHistoryEventFieldDescriptionsMap.get("taskHistoryId")),
|
fieldWithPath("taskHistoryEvents[].taskHistoryId")
|
||||||
fieldWithPath("taskHistoryEvents[].businessProcessId").description(
|
.description(taskHistoryEventFieldDescriptionsMap.get("taskHistoryId")),
|
||||||
taskHistoryEventFieldDescriptionsMap.get("businessProcessId")),
|
fieldWithPath("taskHistoryEvents[].businessProcessId")
|
||||||
fieldWithPath("taskHistoryEvents[].parentBusinessProcessId").description(
|
.description(taskHistoryEventFieldDescriptionsMap.get("businessProcessId")),
|
||||||
taskHistoryEventFieldDescriptionsMap.get("parentBusinessProcessId")),
|
fieldWithPath("taskHistoryEvents[].parentBusinessProcessId")
|
||||||
fieldWithPath("taskHistoryEvents[].taskId").description(
|
.description(taskHistoryEventFieldDescriptionsMap.get("parentBusinessProcessId")),
|
||||||
taskHistoryEventFieldDescriptionsMap.get("taskId")),
|
fieldWithPath("taskHistoryEvents[].taskId")
|
||||||
fieldWithPath("taskHistoryEvents[].eventType").description(
|
.description(taskHistoryEventFieldDescriptionsMap.get("taskId")),
|
||||||
taskHistoryEventFieldDescriptionsMap.get("eventType")),
|
fieldWithPath("taskHistoryEvents[].eventType")
|
||||||
fieldWithPath("taskHistoryEvents[].created").description(
|
.description(taskHistoryEventFieldDescriptionsMap.get("eventType")),
|
||||||
taskHistoryEventFieldDescriptionsMap.get("created")),
|
fieldWithPath("taskHistoryEvents[].created")
|
||||||
fieldWithPath("taskHistoryEvents[].userId").description(
|
.description(taskHistoryEventFieldDescriptionsMap.get("created")),
|
||||||
taskHistoryEventFieldDescriptionsMap.get("userId")),
|
fieldWithPath("taskHistoryEvents[].userId")
|
||||||
fieldWithPath("taskHistoryEvents[].domain").description(
|
.description(taskHistoryEventFieldDescriptionsMap.get("userId")),
|
||||||
taskHistoryEventFieldDescriptionsMap.get("domain")),
|
fieldWithPath("taskHistoryEvents[].domain")
|
||||||
fieldWithPath("taskHistoryEvents[].workbasketKey").description(
|
.description(taskHistoryEventFieldDescriptionsMap.get("domain")),
|
||||||
taskHistoryEventFieldDescriptionsMap.get("workbasketKey")),
|
fieldWithPath("taskHistoryEvents[].workbasketKey")
|
||||||
fieldWithPath("taskHistoryEvents[].porCompany").description(
|
.description(taskHistoryEventFieldDescriptionsMap.get("workbasketKey")),
|
||||||
taskHistoryEventFieldDescriptionsMap.get("porCompany")),
|
fieldWithPath("taskHistoryEvents[].porCompany")
|
||||||
fieldWithPath("taskHistoryEvents[].porSystem").description(
|
.description(taskHistoryEventFieldDescriptionsMap.get("porCompany")),
|
||||||
taskHistoryEventFieldDescriptionsMap.get("porSystem")),
|
fieldWithPath("taskHistoryEvents[].porSystem")
|
||||||
fieldWithPath("taskHistoryEvents[].porInstance").description(
|
.description(taskHistoryEventFieldDescriptionsMap.get("porSystem")),
|
||||||
taskHistoryEventFieldDescriptionsMap.get("porInstance")),
|
fieldWithPath("taskHistoryEvents[].porInstance")
|
||||||
fieldWithPath("taskHistoryEvents[].porValue").description(
|
.description(taskHistoryEventFieldDescriptionsMap.get("porInstance")),
|
||||||
taskHistoryEventFieldDescriptionsMap.get("porValue")),
|
fieldWithPath("taskHistoryEvents[].porValue")
|
||||||
fieldWithPath("taskHistoryEvents[].porType").description(
|
.description(taskHistoryEventFieldDescriptionsMap.get("porValue")),
|
||||||
taskHistoryEventFieldDescriptionsMap.get("porType")),
|
fieldWithPath("taskHistoryEvents[].porType")
|
||||||
fieldWithPath("taskHistoryEvents[].taskClassificationKey").description(
|
.description(taskHistoryEventFieldDescriptionsMap.get("porType")),
|
||||||
taskHistoryEventFieldDescriptionsMap.get("taskClassificationKey")),
|
fieldWithPath("taskHistoryEvents[].taskClassificationKey")
|
||||||
fieldWithPath("taskHistoryEvents[].taskClassificationCategory").description(
|
.description(taskHistoryEventFieldDescriptionsMap.get("taskClassificationKey")),
|
||||||
taskHistoryEventFieldDescriptionsMap.get("taskClassificationCategory")),
|
fieldWithPath("taskHistoryEvents[].taskClassificationCategory")
|
||||||
fieldWithPath("taskHistoryEvents[].attachmentClassificationKey").description(
|
.description(taskHistoryEventFieldDescriptionsMap.get("taskClassificationCategory")),
|
||||||
taskHistoryEventFieldDescriptionsMap.get("attachmentClassificationKey")),
|
fieldWithPath("taskHistoryEvents[].attachmentClassificationKey")
|
||||||
fieldWithPath("taskHistoryEvents[].comment").description(
|
.description(taskHistoryEventFieldDescriptionsMap.get("attachmentClassificationKey")),
|
||||||
taskHistoryEventFieldDescriptionsMap.get("comment")),
|
fieldWithPath("taskHistoryEvents[].comment")
|
||||||
fieldWithPath("taskHistoryEvents[].oldValue").description(
|
.description(taskHistoryEventFieldDescriptionsMap.get("comment")),
|
||||||
taskHistoryEventFieldDescriptionsMap.get("oldValue")),
|
fieldWithPath("taskHistoryEvents[].oldValue")
|
||||||
fieldWithPath("taskHistoryEvents[].newValue").description(
|
.description(taskHistoryEventFieldDescriptionsMap.get("oldValue")),
|
||||||
taskHistoryEventFieldDescriptionsMap.get("newValue")),
|
fieldWithPath("taskHistoryEvents[].newValue")
|
||||||
fieldWithPath("taskHistoryEvents[].custom1").description(
|
.description(taskHistoryEventFieldDescriptionsMap.get("newValue")),
|
||||||
taskHistoryEventFieldDescriptionsMap.get("custom1")),
|
fieldWithPath("taskHistoryEvents[].custom1")
|
||||||
fieldWithPath("taskHistoryEvents[].custom2").description(
|
.description(taskHistoryEventFieldDescriptionsMap.get("custom1")),
|
||||||
taskHistoryEventFieldDescriptionsMap.get("custom2")),
|
fieldWithPath("taskHistoryEvents[].custom2")
|
||||||
fieldWithPath("taskHistoryEvents[].custom3").description(
|
.description(taskHistoryEventFieldDescriptionsMap.get("custom2")),
|
||||||
taskHistoryEventFieldDescriptionsMap.get("custom3")),
|
fieldWithPath("taskHistoryEvents[].custom3")
|
||||||
fieldWithPath("taskHistoryEvents[].custom4").description(
|
.description(taskHistoryEventFieldDescriptionsMap.get("custom3")),
|
||||||
taskHistoryEventFieldDescriptionsMap.get("custom4")),
|
fieldWithPath("taskHistoryEvents[].custom4")
|
||||||
fieldWithPath("taskHistoryEvents[].oldData").description(
|
.description(taskHistoryEventFieldDescriptionsMap.get("custom4")),
|
||||||
taskHistoryEventFieldDescriptionsMap.get("oldData")),
|
fieldWithPath("taskHistoryEvents[].oldData")
|
||||||
fieldWithPath("taskHistoryEvents[].newData").description(
|
.description(taskHistoryEventFieldDescriptionsMap.get("oldData")),
|
||||||
taskHistoryEventFieldDescriptionsMap.get("newData")),
|
fieldWithPath("taskHistoryEvents[].newData")
|
||||||
fieldWithPath("_links.self.href").ignored(),
|
.description(taskHistoryEventFieldDescriptionsMap.get("newData")),
|
||||||
fieldWithPath("page").ignored()
|
fieldWithPath("_links.self.href").ignored(),
|
||||||
|
fieldWithPath("page").ignored()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getAllTaskHistoryEventDocTest() throws Exception {
|
public void getAllTaskHistoryEventDocTest() throws Exception {
|
||||||
this.mockMvc.perform(
|
this.mockMvc
|
||||||
|
.perform(
|
||||||
RestDocumentationRequestBuilders.get(
|
RestDocumentationRequestBuilders.get(
|
||||||
"http://127.0.0.1:" + port + "/api/v1/task-history-event?page=1&page-size=3")
|
"http://127.0.0.1:" + port + "/api/v1/task-history-event?page=1&page-size=3")
|
||||||
.accept("application/hal+json")
|
.accept("application/hal+json")
|
||||||
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
|
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
|
||||||
.andExpect(MockMvcResultMatchers.status().isOk())
|
.andExpect(MockMvcResultMatchers.status().isOk())
|
||||||
.andDo(MockMvcRestDocumentation.document("GetAllTaskHistoryEventDocTest",
|
.andDo(
|
||||||
|
MockMvcRestDocumentation.document(
|
||||||
|
"GetAllTaskHistoryEventDocTest",
|
||||||
responseFields(allTaskHistoryEventFieldDescriptors)));
|
responseFields(allTaskHistoryEventFieldDescriptors)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getSpecificTaskHistoryEventDocTest() throws Exception {
|
public void getSpecificTaskHistoryEventDocTest() throws Exception {
|
||||||
this.mockMvc.perform(RestDocumentationRequestBuilders.get(
|
this.mockMvc
|
||||||
"http://127.0.0.1:" + port + "/api/v1/task-history-event?business-process-id=BPI:02")
|
.perform(
|
||||||
.accept("application/hal+json")
|
RestDocumentationRequestBuilders.get(
|
||||||
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
|
"http://127.0.0.1:"
|
||||||
.andExpect(MockMvcResultMatchers.status().isOk())
|
+ port
|
||||||
.andDo(MockMvcRestDocumentation.document("GetSpecificTaskHistoryEventDocTest",
|
+ "/api/v1/task-history-event?business-process-id=BPI:02")
|
||||||
|
.accept("application/hal+json")
|
||||||
|
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
|
||||||
|
.andExpect(MockMvcResultMatchers.status().isOk())
|
||||||
|
.andDo(
|
||||||
|
MockMvcRestDocumentation.document(
|
||||||
|
"GetSpecificTaskHistoryEventDocTest",
|
||||||
responseFields(taskHistoryEventFieldDescriptors)));
|
responseFields(taskHistoryEventFieldDescriptors)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,37 +15,33 @@ import pro.taskana.exceptions.TaskAlreadyExistException;
|
||||||
import pro.taskana.exceptions.TaskNotFoundException;
|
import pro.taskana.exceptions.TaskNotFoundException;
|
||||||
import pro.taskana.exceptions.WorkbasketNotFoundException;
|
import pro.taskana.exceptions.WorkbasketNotFoundException;
|
||||||
|
|
||||||
/**
|
/** Example Bootstrap Application. */
|
||||||
* Example Bootstrap Application.
|
|
||||||
*/
|
|
||||||
@ApplicationScoped
|
@ApplicationScoped
|
||||||
public class ExampleBootstrap {
|
public class ExampleBootstrap {
|
||||||
|
|
||||||
@EJB
|
@EJB private TaskanaEjb taskanaEjb;
|
||||||
private TaskanaEjb taskanaEjb;
|
|
||||||
|
|
||||||
@PostConstruct
|
|
||||||
public void init(@Observes @Initialized(ApplicationScoped.class) Object init)
|
|
||||||
throws TaskNotFoundException, NotAuthorizedException, WorkbasketNotFoundException,
|
|
||||||
ClassificationNotFoundException, InvalidStateException, InvalidOwnerException, TaskAlreadyExistException,
|
|
||||||
InvalidArgumentException {
|
|
||||||
System.out.println("---------------------------> Start App");
|
|
||||||
Task task = taskanaEjb.getTaskService().newTask(null);
|
|
||||||
ObjectReference objRef = new ObjectReference();
|
|
||||||
objRef.setCompany("aCompany");
|
|
||||||
objRef.setSystem("aSystem");
|
|
||||||
objRef.setSystemInstance("anInstance");
|
|
||||||
objRef.setType("aType");
|
|
||||||
objRef.setValue("aValue");
|
|
||||||
task.setPrimaryObjRef(objRef);
|
|
||||||
task = taskanaEjb.getTaskService().createTask(task);
|
|
||||||
System.out.println("---------------------------> Task started: " + task.getId());
|
|
||||||
taskanaEjb.getTaskService().claim(task.getId());
|
|
||||||
System.out.println(
|
|
||||||
"---------------------------> Task claimed: "
|
|
||||||
+ taskanaEjb.getTaskService().getTask(task.getId()).getOwner());
|
|
||||||
taskanaEjb.getTaskService().completeTask(task.getId());
|
|
||||||
System.out.println("---------------------------> Task completed");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void init(@Observes @Initialized(ApplicationScoped.class) Object init)
|
||||||
|
throws TaskNotFoundException, NotAuthorizedException, WorkbasketNotFoundException,
|
||||||
|
ClassificationNotFoundException, InvalidStateException, InvalidOwnerException,
|
||||||
|
TaskAlreadyExistException, InvalidArgumentException {
|
||||||
|
System.out.println("---------------------------> Start App");
|
||||||
|
Task task = taskanaEjb.getTaskService().newTask(null);
|
||||||
|
ObjectReference objRef = new ObjectReference();
|
||||||
|
objRef.setCompany("aCompany");
|
||||||
|
objRef.setSystem("aSystem");
|
||||||
|
objRef.setSystemInstance("anInstance");
|
||||||
|
objRef.setType("aType");
|
||||||
|
objRef.setValue("aValue");
|
||||||
|
task.setPrimaryObjRef(objRef);
|
||||||
|
task = taskanaEjb.getTaskService().createTask(task);
|
||||||
|
System.out.println("---------------------------> Task started: " + task.getId());
|
||||||
|
taskanaEjb.getTaskService().claim(task.getId());
|
||||||
|
System.out.println(
|
||||||
|
"---------------------------> Task claimed: "
|
||||||
|
+ taskanaEjb.getTaskService().getTask(task.getId()).getOwner());
|
||||||
|
taskanaEjb.getTaskService().completeTask(task.getId());
|
||||||
|
System.out.println("---------------------------> Task completed");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,16 +3,13 @@ package pro.taskana;
|
||||||
import javax.ejb.Stateless;
|
import javax.ejb.Stateless;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
/**
|
/** example Taskana EJB. */
|
||||||
* example Taskana EJB.
|
|
||||||
*/
|
|
||||||
@Stateless
|
@Stateless
|
||||||
public class TaskanaEjb {
|
public class TaskanaEjb {
|
||||||
|
|
||||||
@Inject
|
@Inject private TaskService taskService;
|
||||||
private TaskService taskService;
|
|
||||||
|
|
||||||
public TaskService getTaskService() {
|
public TaskService getTaskService() {
|
||||||
return taskService;
|
return taskService;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@ import java.sql.Connection;
|
||||||
import java.sql.DatabaseMetaData;
|
import java.sql.DatabaseMetaData;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
import javax.enterprise.context.ApplicationScoped;
|
import javax.enterprise.context.ApplicationScoped;
|
||||||
import javax.enterprise.inject.Produces;
|
import javax.enterprise.inject.Produces;
|
||||||
|
|
@ -15,71 +14,67 @@ import javax.naming.Context;
|
||||||
import javax.naming.InitialContext;
|
import javax.naming.InitialContext;
|
||||||
import javax.naming.NamingException;
|
import javax.naming.NamingException;
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import pro.taskana.configuration.TaskanaEngineConfiguration;
|
import pro.taskana.configuration.TaskanaEngineConfiguration;
|
||||||
|
|
||||||
/**
|
/** TODO. */
|
||||||
* TODO.
|
|
||||||
*/
|
|
||||||
@ApplicationScoped
|
@ApplicationScoped
|
||||||
public class TaskanaProducers {
|
public class TaskanaProducers {
|
||||||
|
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(TaskanaProducers.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(TaskanaProducers.class);
|
||||||
|
|
||||||
private static final String TASKANA_PROPERTIES = "taskana.properties";
|
private static final String TASKANA_PROPERTIES = "taskana.properties";
|
||||||
|
|
||||||
@Inject
|
@Inject private TaskanaEngine taskanaEngine;
|
||||||
private TaskanaEngine taskanaEngine;
|
|
||||||
|
|
||||||
private TaskanaEngineConfiguration taskanaEngineConfiguration;
|
private TaskanaEngineConfiguration taskanaEngineConfiguration;
|
||||||
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void init() {
|
public void init() {
|
||||||
// Load Properties and get Datasource via Context
|
// Load Properties and get Datasource via Context
|
||||||
// Load DataSource via Container
|
// Load DataSource via Container
|
||||||
Context ctx;
|
Context ctx;
|
||||||
DataSource dataSource;
|
DataSource dataSource;
|
||||||
ClassLoader classloader = Thread.currentThread().getContextClassLoader();
|
ClassLoader classloader = Thread.currentThread().getContextClassLoader();
|
||||||
try (InputStream propertyStream = classloader.getResourceAsStream(TASKANA_PROPERTIES)) {
|
try (InputStream propertyStream = classloader.getResourceAsStream(TASKANA_PROPERTIES)) {
|
||||||
Properties properties = new Properties();
|
Properties properties = new Properties();
|
||||||
ctx = new InitialContext();
|
ctx = new InitialContext();
|
||||||
properties.load(propertyStream);
|
properties.load(propertyStream);
|
||||||
dataSource = (DataSource) ctx.lookup(properties.getProperty("datasource.jndi"));
|
dataSource = (DataSource) ctx.lookup(properties.getProperty("datasource.jndi"));
|
||||||
try (Connection connection = dataSource.getConnection()) {
|
try (Connection connection = dataSource.getConnection()) {
|
||||||
DatabaseMetaData metaData = connection.getMetaData();
|
DatabaseMetaData metaData = connection.getMetaData();
|
||||||
LOGGER.debug("---------------> " + metaData);
|
LOGGER.debug("---------------> " + metaData);
|
||||||
}
|
}
|
||||||
this.taskanaEngineConfiguration = new TaskanaEngineConfiguration(dataSource, true, false, "TASKANA");
|
this.taskanaEngineConfiguration =
|
||||||
} catch (NamingException | SQLException | IOException e) {
|
new TaskanaEngineConfiguration(dataSource, true, false, "TASKANA");
|
||||||
LOGGER.error("Could not start Taskana: ", e);
|
} catch (NamingException | SQLException | IOException e) {
|
||||||
}
|
LOGGER.error("Could not start Taskana: ", e);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@ApplicationScoped
|
@ApplicationScoped
|
||||||
@Produces
|
@Produces
|
||||||
public TaskanaEngine generateTaskEngine() {
|
public TaskanaEngine generateTaskEngine() {
|
||||||
return taskanaEngineConfiguration.buildTaskanaEngine();
|
return taskanaEngineConfiguration.buildTaskanaEngine();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApplicationScoped
|
@ApplicationScoped
|
||||||
@Produces
|
@Produces
|
||||||
public TaskService generateTaskService() {
|
public TaskService generateTaskService() {
|
||||||
return taskanaEngine.getTaskService();
|
return taskanaEngine.getTaskService();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApplicationScoped
|
@ApplicationScoped
|
||||||
@Produces
|
@Produces
|
||||||
public ClassificationService generateClassificationService() {
|
public ClassificationService generateClassificationService() {
|
||||||
return taskanaEngine.getClassificationService();
|
return taskanaEngine.getClassificationService();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApplicationScoped
|
|
||||||
@Produces
|
|
||||||
public WorkbasketService generateWorkbasketService() {
|
|
||||||
return taskanaEngine.getWorkbasketService();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@ApplicationScoped
|
||||||
|
@Produces
|
||||||
|
public WorkbasketService generateWorkbasketService() {
|
||||||
|
return taskanaEngine.getWorkbasketService();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,6 @@ package pro.taskana;
|
||||||
import javax.ws.rs.ApplicationPath;
|
import javax.ws.rs.ApplicationPath;
|
||||||
import javax.ws.rs.core.Application;
|
import javax.ws.rs.core.Application;
|
||||||
|
|
||||||
/**
|
/** TODO Why does this test exist? */
|
||||||
* TODO Why does this test exist?
|
|
||||||
*/
|
|
||||||
@ApplicationPath("/rest")
|
@ApplicationPath("/rest")
|
||||||
public class RestApplication extends Application {
|
public class RestApplication extends Application {}
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -9,47 +9,42 @@ import pro.taskana.exceptions.NotAuthorizedException;
|
||||||
import pro.taskana.exceptions.TaskAlreadyExistException;
|
import pro.taskana.exceptions.TaskAlreadyExistException;
|
||||||
import pro.taskana.exceptions.WorkbasketNotFoundException;
|
import pro.taskana.exceptions.WorkbasketNotFoundException;
|
||||||
|
|
||||||
/**
|
/** TODO. */
|
||||||
* TODO.
|
|
||||||
*/
|
|
||||||
@Stateless
|
@Stateless
|
||||||
public class TaskanaEjb {
|
public class TaskanaEjb {
|
||||||
|
|
||||||
@Inject
|
@Inject private TaskService taskService;
|
||||||
private TaskService taskService;
|
|
||||||
|
|
||||||
@Inject
|
@Inject private ClassificationService classificationService;
|
||||||
private ClassificationService classificationService;
|
|
||||||
|
|
||||||
@Inject
|
@Inject private WorkbasketService workbasketService;
|
||||||
private WorkbasketService workbasketService;
|
|
||||||
|
|
||||||
public TaskService getTaskService() {
|
public TaskService getTaskService() {
|
||||||
return taskService;
|
return taskService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ClassificationService getClassificationService() {
|
public ClassificationService getClassificationService() {
|
||||||
return classificationService;
|
return classificationService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public WorkbasketService getWorkbasketService() {
|
public WorkbasketService getWorkbasketService() {
|
||||||
return workbasketService;
|
return workbasketService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void triggerRollback() throws NotAuthorizedException, WorkbasketNotFoundException,
|
public void triggerRollback()
|
||||||
ClassificationNotFoundException, TaskAlreadyExistException, InvalidArgumentException {
|
throws NotAuthorizedException, WorkbasketNotFoundException, ClassificationNotFoundException,
|
||||||
Task task = taskService.newTask(null);
|
TaskAlreadyExistException, InvalidArgumentException {
|
||||||
ObjectReference objRef = new ObjectReference();
|
Task task = taskService.newTask(null);
|
||||||
objRef.setCompany("aCompany");
|
ObjectReference objRef = new ObjectReference();
|
||||||
objRef.setSystem("aSystem");
|
objRef.setCompany("aCompany");
|
||||||
objRef.setSystemInstance("anInstance");
|
objRef.setSystem("aSystem");
|
||||||
objRef.setType("aType");
|
objRef.setSystemInstance("anInstance");
|
||||||
objRef.setValue("aValue");
|
objRef.setType("aType");
|
||||||
task.setPrimaryObjRef(objRef);
|
objRef.setValue("aValue");
|
||||||
|
task.setPrimaryObjRef(objRef);
|
||||||
taskService.createTask(task);
|
|
||||||
System.out.println("---------------->" + task.getId());
|
|
||||||
throw new RuntimeException();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
taskService.createTask(task);
|
||||||
|
System.out.println("---------------->" + task.getId());
|
||||||
|
throw new RuntimeException();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,8 @@ import java.sql.Connection;
|
||||||
import java.sql.DriverManager;
|
import java.sql.DriverManager;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
|
||||||
import javax.ws.rs.client.Client;
|
import javax.ws.rs.client.Client;
|
||||||
import javax.ws.rs.client.ClientBuilder;
|
import javax.ws.rs.client.ClientBuilder;
|
||||||
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
import org.jboss.arquillian.container.test.api.Deployment;
|
||||||
import org.jboss.arquillian.junit.Arquillian;
|
import org.jboss.arquillian.junit.Arquillian;
|
||||||
import org.jboss.shrinkwrap.api.Archive;
|
import org.jboss.shrinkwrap.api.Archive;
|
||||||
|
|
@ -17,64 +15,66 @@ import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.wildfly.swarm.undertow.WARArchive;
|
import org.wildfly.swarm.undertow.WARArchive;
|
||||||
|
|
||||||
/**
|
/** TODO. */
|
||||||
* TODO.
|
|
||||||
*/
|
|
||||||
@RunWith(Arquillian.class)
|
@RunWith(Arquillian.class)
|
||||||
public class TaskanaProducersTest {
|
public class TaskanaProducersTest {
|
||||||
|
|
||||||
@Deployment(testable = false)
|
@Deployment(testable = false)
|
||||||
public static Archive<?> createDeployment() throws Exception {
|
public static Archive<?> createDeployment() throws Exception {
|
||||||
WARArchive deployment = ShrinkWrap.create(WARArchive.class);
|
WARArchive deployment = ShrinkWrap.create(WARArchive.class);
|
||||||
deployment.addPackage("pro.taskana");
|
deployment.addPackage("pro.taskana");
|
||||||
deployment.addClass(TaskanaProducers.class);
|
deployment.addClass(TaskanaProducers.class);
|
||||||
deployment.addAllDependencies();
|
deployment.addAllDependencies();
|
||||||
deployment.addDependency("org.mybatis:mybatis:3.4.2");
|
deployment.addDependency("org.mybatis:mybatis:3.4.2");
|
||||||
deployment.addDependency("org.mybatis:mybatis-cdi:1.0.0");
|
deployment.addDependency("org.mybatis:mybatis-cdi:1.0.0");
|
||||||
deployment.addDependency("pro.taskana:taskana-core");
|
deployment.addDependency("pro.taskana:taskana-core");
|
||||||
deployment.addAsResource("META-INF/beans.xml");
|
deployment.addAsResource("META-INF/beans.xml");
|
||||||
deployment.addAsResource("taskana.properties");
|
deployment.addAsResource("taskana.properties");
|
||||||
deployment.addAsResource("project-defaults.yml");
|
deployment.addAsResource("project-defaults.yml");
|
||||||
return deployment;
|
return deployment;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCommit() throws SQLException, ClassNotFoundException {
|
public void testCommit() throws SQLException, ClassNotFoundException {
|
||||||
|
|
||||||
Client client = ClientBuilder.newClient();
|
Client client = ClientBuilder.newClient();
|
||||||
client.target("http://127.0.0.1:8090/rest/test").request().get();
|
client.target("http://127.0.0.1:8090/rest/test").request().get();
|
||||||
|
|
||||||
Class.forName("org.h2.Driver");
|
Class.forName("org.h2.Driver");
|
||||||
int resultCount = 0;
|
int resultCount = 0;
|
||||||
try (Connection conn = DriverManager.getConnection(
|
try (Connection conn =
|
||||||
|
DriverManager.getConnection(
|
||||||
"jdbc:h2:~/taskana-h2-data/testdb;AUTO_SERVER=TRUE;IGNORECASE=TRUE;LOCK_MODE=0",
|
"jdbc:h2:~/taskana-h2-data/testdb;AUTO_SERVER=TRUE;IGNORECASE=TRUE;LOCK_MODE=0",
|
||||||
"SA", "SA")) {
|
"SA",
|
||||||
ResultSet rs = conn.createStatement().executeQuery("SELECT ID, OWNER FROM TASKANA.TASK");
|
"SA")) {
|
||||||
|
ResultSet rs = conn.createStatement().executeQuery("SELECT ID, OWNER FROM TASKANA.TASK");
|
||||||
|
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
resultCount++;
|
resultCount++;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
Assert.assertEquals(0, resultCount);
|
|
||||||
}
|
}
|
||||||
|
Assert.assertEquals(0, resultCount);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRollback() throws SQLException, ClassNotFoundException {
|
public void testRollback() throws SQLException, ClassNotFoundException {
|
||||||
Client client = ClientBuilder.newClient();
|
Client client = ClientBuilder.newClient();
|
||||||
client.target("http://127.0.0.1:8090/rest/test").request().post(null);
|
client.target("http://127.0.0.1:8090/rest/test").request().post(null);
|
||||||
|
|
||||||
Class.forName("org.h2.Driver");
|
Class.forName("org.h2.Driver");
|
||||||
int resultCount = 0;
|
int resultCount = 0;
|
||||||
try (Connection conn = DriverManager.getConnection(
|
try (Connection conn =
|
||||||
|
DriverManager.getConnection(
|
||||||
"jdbc:h2:~/taskana-h2-data/testdb;AUTO_SERVER=TRUE;IGNORECASE=TRUE;LOCK_MODE=0",
|
"jdbc:h2:~/taskana-h2-data/testdb;AUTO_SERVER=TRUE;IGNORECASE=TRUE;LOCK_MODE=0",
|
||||||
"SA", "SA")) {
|
"SA",
|
||||||
ResultSet rs = conn.createStatement().executeQuery("SELECT ID, OWNER FROM TASKANA.TASK");
|
"SA")) {
|
||||||
|
ResultSet rs = conn.createStatement().executeQuery("SELECT ID, OWNER FROM TASKANA.TASK");
|
||||||
|
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
resultCount++;
|
resultCount++;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Assert.assertEquals(0, resultCount);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Assert.assertEquals(0, resultCount);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@ import javax.ws.rs.POST;
|
||||||
import javax.ws.rs.Path;
|
import javax.ws.rs.Path;
|
||||||
import javax.ws.rs.PathParam;
|
import javax.ws.rs.PathParam;
|
||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
|
@ -25,61 +24,60 @@ import pro.taskana.exceptions.TaskNotFoundException;
|
||||||
import pro.taskana.exceptions.WorkbasketAlreadyExistException;
|
import pro.taskana.exceptions.WorkbasketAlreadyExistException;
|
||||||
import pro.taskana.exceptions.WorkbasketNotFoundException;
|
import pro.taskana.exceptions.WorkbasketNotFoundException;
|
||||||
|
|
||||||
/**
|
/** TODO. */
|
||||||
* TODO.
|
|
||||||
*/
|
|
||||||
@Path("/test")
|
@Path("/test")
|
||||||
public class TaskanaRestTest {
|
public class TaskanaRestTest {
|
||||||
|
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(TaskanaRestTest.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(TaskanaRestTest.class);
|
||||||
|
|
||||||
@EJB
|
@EJB private TaskanaEjb taskanaEjb;
|
||||||
private TaskanaEjb taskanaEjb;
|
|
||||||
|
|
||||||
@Inject
|
@Inject private ClassificationService classificationService;
|
||||||
private ClassificationService classificationService;
|
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
public Response startTask() throws NotAuthorizedException, WorkbasketNotFoundException,
|
public Response startTask()
|
||||||
ClassificationNotFoundException, ClassificationAlreadyExistException, InvalidWorkbasketException,
|
throws NotAuthorizedException, WorkbasketNotFoundException, ClassificationNotFoundException,
|
||||||
TaskAlreadyExistException, InvalidArgumentException, WorkbasketAlreadyExistException, DomainNotFoundException {
|
ClassificationAlreadyExistException, InvalidWorkbasketException,
|
||||||
Workbasket workbasket = taskanaEjb.getWorkbasketService().newWorkbasket("key", "cdiDomain");
|
TaskAlreadyExistException, InvalidArgumentException, WorkbasketAlreadyExistException,
|
||||||
workbasket.setName("wb");
|
DomainNotFoundException {
|
||||||
workbasket.setType(WorkbasketType.PERSONAL);
|
Workbasket workbasket = taskanaEjb.getWorkbasketService().newWorkbasket("key", "cdiDomain");
|
||||||
taskanaEjb.getWorkbasketService().createWorkbasket(workbasket);
|
workbasket.setName("wb");
|
||||||
Classification classification = classificationService.newClassification("TEST", "cdiDomain", "t1");
|
workbasket.setType(WorkbasketType.PERSONAL);
|
||||||
taskanaEjb.getClassificationService().createClassification(classification);
|
taskanaEjb.getWorkbasketService().createWorkbasket(workbasket);
|
||||||
|
Classification classification =
|
||||||
|
classificationService.newClassification("TEST", "cdiDomain", "t1");
|
||||||
|
taskanaEjb.getClassificationService().createClassification(classification);
|
||||||
|
|
||||||
Task task = taskanaEjb.getTaskService().newTask(workbasket.getKey());
|
Task task = taskanaEjb.getTaskService().newTask(workbasket.getKey());
|
||||||
task.setClassificationKey(classification.getKey());
|
task.setClassificationKey(classification.getKey());
|
||||||
ObjectReference objRef = new ObjectReference();
|
ObjectReference objRef = new ObjectReference();
|
||||||
objRef.setCompany("aCompany");
|
objRef.setCompany("aCompany");
|
||||||
objRef.setSystem("aSystem");
|
objRef.setSystem("aSystem");
|
||||||
objRef.setSystemInstance("anInstance");
|
objRef.setSystemInstance("anInstance");
|
||||||
objRef.setType("aType");
|
objRef.setType("aType");
|
||||||
objRef.setValue("aValue");
|
objRef.setValue("aValue");
|
||||||
task.setPrimaryObjRef(objRef);
|
task.setPrimaryObjRef(objRef);
|
||||||
|
|
||||||
Task result = taskanaEjb.getTaskService().createTask(task);
|
Task result = taskanaEjb.getTaskService().createTask(task);
|
||||||
|
|
||||||
LOGGER.info(result.getId() + ":" + result.getOwner());
|
LOGGER.info(result.getId() + ":" + result.getOwner());
|
||||||
return Response.status(200).entity(result.getId()).build();
|
return Response.status(200).entity(result.getId()).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@POST
|
@POST
|
||||||
public Response rollbackTask()
|
public Response rollbackTask()
|
||||||
throws NotAuthorizedException, WorkbasketNotFoundException, ClassificationNotFoundException,
|
throws NotAuthorizedException, WorkbasketNotFoundException, ClassificationNotFoundException,
|
||||||
TaskAlreadyExistException, InvalidArgumentException {
|
TaskAlreadyExistException, InvalidArgumentException {
|
||||||
taskanaEjb.triggerRollback();
|
taskanaEjb.triggerRollback();
|
||||||
return Response.status(204).build();
|
return Response.status(204).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@DELETE
|
|
||||||
@Path("{id}")
|
|
||||||
public void completeTask(@PathParam("id") String id)
|
|
||||||
throws TaskNotFoundException, InvalidOwnerException, InvalidStateException, NotAuthorizedException {
|
|
||||||
LOGGER.info(id);
|
|
||||||
taskanaEjb.getTaskService().forceCompleteTask(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@DELETE
|
||||||
|
@Path("{id}")
|
||||||
|
public void completeTask(@PathParam("id") String id)
|
||||||
|
throws TaskNotFoundException, InvalidOwnerException, InvalidStateException,
|
||||||
|
NotAuthorizedException {
|
||||||
|
LOGGER.info(id);
|
||||||
|
taskanaEjb.getTaskService().forceCompleteTask(id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,64 +6,58 @@ package pro.taskana;
|
||||||
* @param <Q> the actual WorkbasketAccessItemQuery behind this interface class
|
* @param <Q> the actual WorkbasketAccessItemQuery behind this interface class
|
||||||
* @param <T> the workbasket access item
|
* @param <T> the workbasket access item
|
||||||
*/
|
*/
|
||||||
public interface AbstractWorkbasketAccessItemQuery<Q extends AbstractWorkbasketAccessItemQuery<Q, T>, T extends WorkbasketAccessItem>
|
public interface AbstractWorkbasketAccessItemQuery<
|
||||||
|
Q extends AbstractWorkbasketAccessItemQuery<Q, T>, T extends WorkbasketAccessItem>
|
||||||
extends BaseQuery<T, AccessItemQueryColumnName> {
|
extends BaseQuery<T, AccessItemQueryColumnName> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add your unique entry id to your query as filter.
|
* Add your unique entry id to your query as filter.
|
||||||
*
|
*
|
||||||
* @param ids
|
* @param ids the unique entry IDs
|
||||||
* the unique entry IDs
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
Q idIn(String... ids);
|
||||||
Q idIn(String... ids);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add your workbasket id to your query.
|
* Add your workbasket id to your query.
|
||||||
*
|
*
|
||||||
* @param workbasketId
|
* @param workbasketId the workbasket Id
|
||||||
* the workbasket Id
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
Q workbasketIdIn(String... workbasketId);
|
||||||
Q workbasketIdIn(String... workbasketId);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add your accessIds to your query.
|
* Add your accessIds to your query.
|
||||||
*
|
*
|
||||||
* @param accessId
|
* @param accessId as access Ids
|
||||||
* as access Ids
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
Q accessIdIn(String... accessId);
|
||||||
Q accessIdIn(String... accessId);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sort the query result by workbasket id.
|
* Sort the query result by workbasket id.
|
||||||
*
|
*
|
||||||
* @param sortDirection
|
* @param sortDirection Determines whether the result is sorted in ascending or descending order.
|
||||||
* Determines whether the result is sorted in ascending or descending order. If sortDirection is null,
|
* If sortDirection is null, the result is sorted in ascending order
|
||||||
* the result is sorted in ascending order
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
Q orderByWorkbasketId(SortDirection sortDirection);
|
||||||
Q orderByWorkbasketId(SortDirection sortDirection);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sort the query result by access Id.
|
* Sort the query result by access Id.
|
||||||
*
|
*
|
||||||
* @param sortDirection
|
* @param sortDirection Determines whether the result is sorted in ascending or descending order.
|
||||||
* Determines whether the result is sorted in ascending or descending order. If sortDirection is null,
|
* If sortDirection is null, the result is sorted in ascending order
|
||||||
* the result is sorted in ascending order
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
Q orderByAccessId(SortDirection sortDirection);
|
||||||
Q orderByAccessId(SortDirection sortDirection);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sort the query result by Id.
|
|
||||||
*
|
|
||||||
* @param sortDirection
|
|
||||||
* Determines whether the result is sorted in ascending or descending order. If sortDirection is null,
|
|
||||||
* the result is sorted in ascending order
|
|
||||||
* @return the query
|
|
||||||
*/
|
|
||||||
Q orderById(SortDirection sortDirection);
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sort the query result by Id.
|
||||||
|
*
|
||||||
|
* @param sortDirection Determines whether the result is sorted in ascending or descending order.
|
||||||
|
* If sortDirection is null, the result is sorted in ascending order
|
||||||
|
* @return the query
|
||||||
|
*/
|
||||||
|
Q orderById(SortDirection sortDirection);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,24 +1,25 @@
|
||||||
package pro.taskana;
|
package pro.taskana;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enum containing the column names for @see pro.taskana.mappings.QueryMapper#queryWorkbasketAccessItemColumnValues(WorkbasketAccessItemQuery).
|
* Enum containing the column names for @see
|
||||||
|
* pro.taskana.mappings.QueryMapper#queryWorkbasketAccessItemColumnValues(WorkbasketAccessItemQuery).
|
||||||
*
|
*
|
||||||
* @author jsa
|
* @author jsa
|
||||||
*/
|
*/
|
||||||
public enum AccessItemQueryColumnName implements QueryColumnName {
|
public enum AccessItemQueryColumnName implements QueryColumnName {
|
||||||
|
ID("id"),
|
||||||
|
WORKBASKET_ID("workbasket_id"),
|
||||||
|
WORKBASKET_KEY("wb.key"),
|
||||||
|
ACCESS_ID("access_id");
|
||||||
|
|
||||||
ID("id"),
|
private String name;
|
||||||
WORKBASKET_ID("workbasket_id"),
|
|
||||||
WORKBASKET_KEY("wb.key"),
|
|
||||||
ACCESS_ID("access_id");
|
|
||||||
|
|
||||||
private String name;
|
AccessItemQueryColumnName(String name) {
|
||||||
AccessItemQueryColumnName(String name) {
|
this.name = name;
|
||||||
this.name = name;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,119 +3,112 @@ package pro.taskana;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/** Attachment-Interface to specify Attachment Attributes. */
|
||||||
* Attachment-Interface to specify Attachment Attributes.
|
|
||||||
*/
|
|
||||||
public interface Attachment {
|
public interface Attachment {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the current id of the attachment.
|
* Returns the current id of the attachment.
|
||||||
*
|
*
|
||||||
* @return ID of attachment
|
* @return ID of attachment
|
||||||
*/
|
*/
|
||||||
String getId();
|
String getId();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the id of the associated task.
|
* Returns the id of the associated task.
|
||||||
*
|
*
|
||||||
* @return taskId
|
* @return taskId
|
||||||
*/
|
*/
|
||||||
String getTaskId();
|
String getTaskId();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the time when the attachment was created.
|
* Returns the time when the attachment was created.
|
||||||
*
|
*
|
||||||
* @return the created time as {@link Instant}
|
* @return the created time as {@link Instant}
|
||||||
*/
|
*/
|
||||||
Instant getCreated();
|
Instant getCreated();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the time when the attachment was last modified.
|
* Returns the time when the attachment was last modified.
|
||||||
*
|
*
|
||||||
* @return modified {@link Instant} of the attachment
|
* @return modified {@link Instant} of the attachment
|
||||||
*/
|
*/
|
||||||
Instant getModified();
|
Instant getModified();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the classification summary of the attachment.
|
* Returns the classification summary of the attachment.
|
||||||
*
|
*
|
||||||
* @return the {@link ClassificationSummary} of this attachment
|
* @return the {@link ClassificationSummary} of this attachment
|
||||||
*/
|
*/
|
||||||
ClassificationSummary getClassificationSummary();
|
ClassificationSummary getClassificationSummary();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the classification summary for this attachment.
|
* Set the classification summary for this attachment.
|
||||||
*
|
*
|
||||||
* @param classificationSummary
|
* @param classificationSummary the {@link ClassificationSummary} for this attachment
|
||||||
* the {@link ClassificationSummary} for this attachment
|
*/
|
||||||
*/
|
void setClassificationSummary(ClassificationSummary classificationSummary);
|
||||||
void setClassificationSummary(ClassificationSummary classificationSummary);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the {@link ObjectReference primaryObjectReference} of the attachment.
|
* Returns the {@link ObjectReference primaryObjectReference} of the attachment.
|
||||||
*
|
*
|
||||||
* @return {@link ObjectReference primaryObjectReference} of the attachment
|
* @return {@link ObjectReference primaryObjectReference} of the attachment
|
||||||
**/
|
*/
|
||||||
ObjectReference getObjectReference();
|
ObjectReference getObjectReference();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the {@link ObjectReference primaryObjectReference} of the attachment.
|
* Sets the {@link ObjectReference primaryObjectReference} of the attachment.
|
||||||
*
|
*
|
||||||
* @param objectReference
|
* @param objectReference the {@link ObjectReference primaryObjectReference} of the attachment
|
||||||
* the {@link ObjectReference primaryObjectReference} of the attachment
|
*/
|
||||||
*/
|
void setObjectReference(ObjectReference objectReference);
|
||||||
void setObjectReference(ObjectReference objectReference);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the Channel on which the attachment was received.
|
* Returns the Channel on which the attachment was received.
|
||||||
*
|
*
|
||||||
* @return the Channel on which the attachment was received.
|
* @return the Channel on which the attachment was received.
|
||||||
**/
|
*/
|
||||||
String getChannel();
|
String getChannel();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the Channel on which the attachment was received.
|
* Sets the Channel on which the attachment was received.
|
||||||
*
|
*
|
||||||
* @param channel
|
* @param channel the channel on which the attachment was received
|
||||||
* the channel on which the attachment was received
|
*/
|
||||||
*/
|
void setChannel(String channel);
|
||||||
void setChannel(String channel);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the time when this attachment was received.
|
* Returns the time when this attachment was received.
|
||||||
*
|
*
|
||||||
* @return received time as exact {@link Instant}
|
* @return received time as exact {@link Instant}
|
||||||
*/
|
*/
|
||||||
Instant getReceived();
|
Instant getReceived();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the time when the attachment was received.
|
* Sets the time when the attachment was received.
|
||||||
*
|
*
|
||||||
* @param received
|
* @param received the time as {@link Instant} when the attachment was received
|
||||||
* the time as {@link Instant} when the attachment was received
|
*/
|
||||||
**/
|
void setReceived(Instant received);
|
||||||
void setReceived(Instant received);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the custom attributes of this attachment.
|
* Returns the custom attributes of this attachment.
|
||||||
*
|
*
|
||||||
* @return customAttributes as {@link Map}
|
* @return customAttributes as {@link Map}
|
||||||
*/
|
*/
|
||||||
Map<String, String> getCustomAttributes();
|
Map<String, String> getCustomAttributes();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the custom attribute Map of the attachment.
|
* Sets the custom attribute Map of the attachment.
|
||||||
*
|
*
|
||||||
* @param customAttributes
|
* @param customAttributes a {@link Map} that contains the custom attributes of the attachment as
|
||||||
* a {@link Map} that contains the custom attributes of the attachment as key, value pairs
|
* key, value pairs
|
||||||
*/
|
*/
|
||||||
void setCustomAttributes(Map<String, String> customAttributes);
|
void setCustomAttributes(Map<String, String> customAttributes);
|
||||||
|
|
||||||
/**
|
|
||||||
* Return a summary of the current Attachment.
|
|
||||||
*
|
|
||||||
* @return the AttachmentSummary object for the current attachment
|
|
||||||
*/
|
|
||||||
AttachmentSummary asSummary();
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a summary of the current Attachment.
|
||||||
|
*
|
||||||
|
* @return the AttachmentSummary object for the current attachment
|
||||||
|
*/
|
||||||
|
AttachmentSummary asSummary();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,64 +3,64 @@ package pro.taskana;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface for AttachmentSummaries. This is a specific short model-object which only contains the most important
|
* Interface for AttachmentSummaries. This is a specific short model-object which only contains the
|
||||||
* information.
|
* most important information.
|
||||||
*/
|
*/
|
||||||
public interface AttachmentSummary {
|
public interface AttachmentSummary {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the id of the attachment.
|
* Gets the id of the attachment.
|
||||||
*
|
*
|
||||||
* @return attachmentId
|
* @return attachmentId
|
||||||
*/
|
*/
|
||||||
String getId();
|
String getId();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the id of the associated task.
|
* Gets the id of the associated task.
|
||||||
*
|
*
|
||||||
* @return taskId
|
* @return taskId
|
||||||
*/
|
*/
|
||||||
String getTaskId();
|
String getTaskId();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the time when the attachment was created.
|
* Gets the time when the attachment was created.
|
||||||
*
|
*
|
||||||
* @return the created Instant
|
* @return the created Instant
|
||||||
*/
|
*/
|
||||||
Instant getCreated();
|
Instant getCreated();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the time when the attachment was last modified.
|
* Gets the time when the attachment was last modified.
|
||||||
*
|
*
|
||||||
* @return the last modified Instant
|
* @return the last modified Instant
|
||||||
*/
|
*/
|
||||||
Instant getModified();
|
Instant getModified();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the {@link ObjectReference primaryObjectReference} of the attachment.
|
* Gets the {@link ObjectReference primaryObjectReference} of the attachment.
|
||||||
*
|
*
|
||||||
* @return {@link ObjectReference primaryObjectReference} of the attachment
|
* @return {@link ObjectReference primaryObjectReference} of the attachment
|
||||||
**/
|
*/
|
||||||
ObjectReference getObjectReference();
|
ObjectReference getObjectReference();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the Channel on which the attachment was received.
|
* Gets the Channel on which the attachment was received.
|
||||||
*
|
*
|
||||||
* @return the channel
|
* @return the channel
|
||||||
**/
|
*/
|
||||||
String getChannel();
|
String getChannel();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the classificationSummary of the attachment.
|
* Gets the classificationSummary of the attachment.
|
||||||
*
|
*
|
||||||
* @return the classification summary
|
* @return the classification summary
|
||||||
*/
|
*/
|
||||||
ClassificationSummary getClassificationSummary();
|
ClassificationSummary getClassificationSummary();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the time when the attachment was received.
|
* Gets the time when the attachment was received.
|
||||||
*
|
*
|
||||||
* @return received Instant
|
* @return received Instant
|
||||||
*/
|
*/
|
||||||
Instant getReceived();
|
Instant getReceived();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,112 +6,105 @@ import java.util.List;
|
||||||
* Main query interface.
|
* Main query interface.
|
||||||
*
|
*
|
||||||
* @author EH
|
* @author EH
|
||||||
* @param <T>
|
* @param <T> specifies the return type of the follwing methods
|
||||||
* specifies the return type of the follwing methods
|
* @param <U> specifies the type of the enum used
|
||||||
* @param <U>
|
|
||||||
* specifies the type of the enum used
|
|
||||||
*/
|
*/
|
||||||
public interface BaseQuery<T, U extends Enum<U> & QueryColumnName> {
|
public interface BaseQuery<T, U extends Enum<U> & QueryColumnName> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method will return a list of defined {@link T} objects. In case of a TaskQuery, this method can throw a
|
* This method will return a list of defined {@link T} objects. In case of a TaskQuery, this
|
||||||
* NotAuthorizedToQueryWorkbasketException.
|
* method can throw a NotAuthorizedToQueryWorkbasketException.
|
||||||
*
|
*
|
||||||
* @return List containing elements of type T
|
* @return List containing elements of type T
|
||||||
*/
|
*/
|
||||||
List<T> list();
|
List<T> list();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method will return a list of defined {@link T} objects with specified offset and an limit. In case of a
|
* This method will return a list of defined {@link T} objects with specified offset and an limit.
|
||||||
* TaskQuery, this method can throw a NotAuthorizedToQueryWorkbasketException.
|
* In case of a TaskQuery, this method can throw a NotAuthorizedToQueryWorkbasketException.
|
||||||
*
|
*
|
||||||
* @param offset
|
* @param offset index of the first element which should be returned.
|
||||||
* index of the first element which should be returned.
|
* @param limit number of elements which should be returned beginning with offset.
|
||||||
* @param limit
|
* @return List containing elements of type T
|
||||||
* number of elements which should be returned beginning with offset.
|
*/
|
||||||
* @return List containing elements of type T
|
List<T> list(int offset, int limit);
|
||||||
*/
|
|
||||||
List<T> list(int offset, int limit);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method will return all currently existing values of a DB-Table once. The order of the returning values can
|
* This method will return all currently existing values of a DB-Table once. The order of the
|
||||||
* be configured ASC oder DEC - DEFAULT at NULL is ASC. <br>
|
* returning values can be configured ASC oder DEC - DEFAULT at NULL is ASC. <br>
|
||||||
* All called orderBy()-Methods will be override. Just the current column-values will be ordered itself by the given
|
* All called orderBy()-Methods will be override. Just the current column-values will be ordered
|
||||||
* direction.
|
* itself by the given direction.
|
||||||
*
|
*
|
||||||
* @param dbColumnName
|
* @param dbColumnName column name of a existing DB Table.
|
||||||
* column name of a existing DB Table.
|
* @param sortDirection Determines whether the result is sorted in ascending or descending order.
|
||||||
* @param sortDirection
|
* If sortDirection is null, the result is sorted in ascending order
|
||||||
* Determines whether the result is sorted in ascending or descending order. If sortDirection is null,
|
* @return a list of all existing values.
|
||||||
* the result is sorted in ascending order
|
*/
|
||||||
* @return a list of all existing values.
|
List<String> listValues(U dbColumnName, SortDirection sortDirection);
|
||||||
*/
|
|
||||||
List<String> listValues(U dbColumnName, SortDirection sortDirection);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method will return all results for page X with a size of Y of the current query.<br>
|
* This method will return all results for page X with a size of Y of the current query.<br>
|
||||||
* Negative pageNumber/size will be changed to 1 or 0 and the last page might contains less elements. In case of a
|
* Negative pageNumber/size will be changed to 1 or 0 and the last page might contains less
|
||||||
* TaskQuery, this method can throw a NotAuthorizedToQueryWorkbasketException.
|
* elements. In case of a TaskQuery, this method can throw a
|
||||||
*
|
* NotAuthorizedToQueryWorkbasketException.
|
||||||
* @param pageNumber
|
*
|
||||||
* current pagination page starting at 1.
|
* @param pageNumber current pagination page starting at 1.
|
||||||
* @param pageSize
|
* @param pageSize amount of elements for this page.
|
||||||
* amount of elements for this page.
|
* @return resulList for the current query starting at X and returning max Y elements.
|
||||||
* @return resulList for the current query starting at X and returning max Y elements.
|
*/
|
||||||
*/
|
default List<T> listPage(int pageNumber, int pageSize) {
|
||||||
default List<T> listPage(int pageNumber, int pageSize) {
|
int offset = (pageNumber < 1) ? 0 : ((pageNumber - 1) * pageSize);
|
||||||
int offset = (pageNumber < 1) ? 0 : ((pageNumber - 1) * pageSize);
|
int limit = (pageSize < 0) ? 0 : pageSize;
|
||||||
int limit = (pageSize < 0) ? 0 : pageSize;
|
return list(offset, limit);
|
||||||
return list(offset, limit);
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method will return a single object of {@link T}. In case of a TaskQuery, this method can
|
||||||
|
* throw a NotAuthorizedToQueryWorkbasketException.
|
||||||
|
*
|
||||||
|
* @return T a single object of given Type.
|
||||||
|
*/
|
||||||
|
T single();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Counting the amount of rows/results for the current query. This can be used for a pagination
|
||||||
|
* afterwards. In case of a TaskQuery, this method can throw a
|
||||||
|
* NotAuthorizedToQueryWorkbasketException.
|
||||||
|
*
|
||||||
|
* @return resultRowCount
|
||||||
|
*/
|
||||||
|
long count();
|
||||||
|
|
||||||
|
default String[] toUpperCopy(String... source) {
|
||||||
|
if (source == null || source.length == 0) {
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
String[] target = new String[source.length];
|
||||||
|
for (int i = 0; i < source.length; i++) {
|
||||||
|
target[i] = source[i].toUpperCase();
|
||||||
|
}
|
||||||
|
return target;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines the sort direction.
|
||||||
|
*
|
||||||
|
* @author bbr
|
||||||
|
*/
|
||||||
|
enum SortDirection {
|
||||||
|
ASCENDING("ASC"),
|
||||||
|
DESCENDING("DESC");
|
||||||
|
|
||||||
|
private final String sortDirection;
|
||||||
|
|
||||||
|
SortDirection(String sortDirection) {
|
||||||
|
this.sortDirection = sortDirection;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* This method will return a single object of {@link T}. In case of a TaskQuery, this method can throw a
|
public String toString() {
|
||||||
* NotAuthorizedToQueryWorkbasketException.
|
return sortDirection;
|
||||||
*
|
|
||||||
* @return T a single object of given Type.
|
|
||||||
*/
|
|
||||||
T single();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Counting the amount of rows/results for the current query. This can be used for a pagination afterwards. In case
|
|
||||||
* of a TaskQuery, this method can throw a NotAuthorizedToQueryWorkbasketException.
|
|
||||||
*
|
|
||||||
* @return resultRowCount
|
|
||||||
*/
|
|
||||||
long count();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determines the sort direction.
|
|
||||||
*
|
|
||||||
* @author bbr
|
|
||||||
*/
|
|
||||||
enum SortDirection {
|
|
||||||
ASCENDING("ASC"),
|
|
||||||
DESCENDING("DESC");
|
|
||||||
|
|
||||||
private final String sortDirection;
|
|
||||||
|
|
||||||
SortDirection(String sortDirection) {
|
|
||||||
this.sortDirection = sortDirection;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return sortDirection;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
default String[] toUpperCopy(String... source) {
|
|
||||||
if (source == null || source.length == 0) {
|
|
||||||
return null;
|
|
||||||
} else {
|
|
||||||
String[] target = new String[source.length];
|
|
||||||
for (int i = 0; i < source.length; i++) {
|
|
||||||
target[i] = source[i].toUpperCase();
|
|
||||||
}
|
|
||||||
return target;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,135 +4,132 @@ import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import pro.taskana.impl.util.LoggerUtils;
|
import pro.taskana.impl.util.LoggerUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returning type for a bulk db interaction with errors. This wrapper is storing them with a matching object ID.
|
* Returning type for a bulk db interaction with errors. This wrapper is storing them with a
|
||||||
|
* matching object ID.
|
||||||
*
|
*
|
||||||
* @param <K>
|
* @param <K> unique keys for the logs.
|
||||||
* unique keys for the logs.
|
* @param <V> type of the stored informations
|
||||||
* @param <V>
|
|
||||||
* type of the stored informations
|
|
||||||
*/
|
*/
|
||||||
public class BulkOperationResults<K, V> {
|
public class BulkOperationResults<K, V> {
|
||||||
|
|
||||||
private Map<K, V> errorMap = new HashMap<>();
|
private static final Logger LOGGER = LoggerFactory.getLogger(BulkOperationResults.class);
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(BulkOperationResults.class);
|
private Map<K, V> errorMap = new HashMap<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returning a list of current errors as map. If there are no errors the result will be empty.
|
* Returning a list of current errors as map. If there are no errors the result will be empty.
|
||||||
*
|
*
|
||||||
* @return map of errors which can´t be null.
|
* @return map of errors which can´t be null.
|
||||||
*/
|
*/
|
||||||
public Map<K, V> getErrorMap() {
|
public Map<K, V> getErrorMap() {
|
||||||
return this.errorMap;
|
return this.errorMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adding an appearing error to the map and list them by a unique ID as key. NULL keys will be
|
||||||
|
* ignored.
|
||||||
|
*
|
||||||
|
* @param objectId unique key of a entity.
|
||||||
|
* @param error occurred error of a interaction with the entity
|
||||||
|
* @return status of adding the values.
|
||||||
|
*/
|
||||||
|
public boolean addError(K objectId, V error) {
|
||||||
|
boolean status = false;
|
||||||
|
try {
|
||||||
|
if (objectId != null) {
|
||||||
|
this.errorMap.put(objectId, error);
|
||||||
|
status = true;
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
LOGGER.warn(
|
||||||
|
"Can´t add bulkoperation-error, because of a map failure. ID={}, error={} and current failure={}",
|
||||||
|
objectId,
|
||||||
|
error,
|
||||||
|
e);
|
||||||
|
}
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returning the status of a bulk-error-log.
|
||||||
|
*
|
||||||
|
* @return true if there are logged errors.
|
||||||
|
*/
|
||||||
|
public boolean containsErrors() {
|
||||||
|
boolean isContainingErrors = false;
|
||||||
|
if (!this.errorMap.isEmpty()) {
|
||||||
|
isContainingErrors = true;
|
||||||
|
}
|
||||||
|
return isContainingErrors;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the stored error for a unique ID or NULL if there is no error stored or ID invalid.
|
||||||
|
*
|
||||||
|
* @param idKey which is mapped with an error
|
||||||
|
* @return stored error for ID
|
||||||
|
*/
|
||||||
|
public V getErrorForId(K idKey) {
|
||||||
|
V result = null;
|
||||||
|
if (idKey != null) {
|
||||||
|
result = this.errorMap.get(idKey);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the IDs of the Object with failed requests.
|
||||||
|
*
|
||||||
|
* @return a List of IDs that could not be processed successfully.
|
||||||
|
*/
|
||||||
|
public List<K> getFailedIds() {
|
||||||
|
return new ArrayList<>(this.errorMap.keySet());
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Clearing the map - all entries will be removed. */
|
||||||
|
public void clearErrors() {
|
||||||
|
this.errorMap.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add all errors from another BulkOperationResult to this.
|
||||||
|
*
|
||||||
|
* @param log the other log
|
||||||
|
*/
|
||||||
|
public void addAllErrors(BulkOperationResults<K, V> log) {
|
||||||
|
if (log != null && log.containsErrors()) {
|
||||||
|
List<K> failedIds = log.getFailedIds();
|
||||||
|
for (K id : failedIds) {
|
||||||
|
addError(id, log.getErrorForId(id));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Map from any exception type to Exception.
|
||||||
|
*
|
||||||
|
* @return map of errors which can´t be null.
|
||||||
|
*/
|
||||||
|
public BulkOperationResults<K, Exception> mapBulkOperationResults() {
|
||||||
|
BulkOperationResults<K, Exception> bulkLogMapped = new BulkOperationResults<>();
|
||||||
|
|
||||||
|
List<K> failedIds = this.getFailedIds();
|
||||||
|
for (K id : failedIds) {
|
||||||
|
bulkLogMapped.addError(id, (Exception) this.getErrorForId(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
return bulkLogMapped;
|
||||||
* Adding an appearing error to the map and list them by a unique ID as key. NULL keys will be ignored.
|
}
|
||||||
*
|
|
||||||
* @param objectId
|
|
||||||
* unique key of a entity.
|
|
||||||
* @param error
|
|
||||||
* occurred error of a interaction with the entity
|
|
||||||
* @return status of adding the values.
|
|
||||||
*/
|
|
||||||
public boolean addError(K objectId, V error) {
|
|
||||||
boolean status = false;
|
|
||||||
try {
|
|
||||||
if (objectId != null) {
|
|
||||||
this.errorMap.put(objectId, error);
|
|
||||||
status = true;
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
LOGGER.warn(
|
|
||||||
"Can´t add bulkoperation-error, because of a map failure. ID={}, error={} and current failure={}",
|
|
||||||
objectId, error, e);
|
|
||||||
}
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* Returning the status of a bulk-error-log.
|
public String toString() {
|
||||||
*
|
return "BulkOperationResults [BulkOperationResults= "
|
||||||
* @return true if there are logged errors.
|
+ LoggerUtils.mapToString(this.errorMap)
|
||||||
*/
|
+ "]";
|
||||||
public boolean containsErrors() {
|
}
|
||||||
boolean isContainingErrors = false;
|
|
||||||
if (!this.errorMap.isEmpty()) {
|
|
||||||
isContainingErrors = true;
|
|
||||||
}
|
|
||||||
return isContainingErrors;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the stored error for a unique ID or NULL if there is no error stored or ID invalid.
|
|
||||||
*
|
|
||||||
* @param idKey
|
|
||||||
* which is mapped with an error
|
|
||||||
* @return stored error for ID
|
|
||||||
*/
|
|
||||||
public V getErrorForId(K idKey) {
|
|
||||||
V result = null;
|
|
||||||
if (idKey != null) {
|
|
||||||
result = this.errorMap.get(idKey);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the IDs of the Object with failed requests.
|
|
||||||
*
|
|
||||||
* @return a List of IDs that could not be processed successfully.
|
|
||||||
*/
|
|
||||||
public List<K> getFailedIds() {
|
|
||||||
return new ArrayList<>(this.errorMap.keySet());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Clearing the map - all entries will be removed.
|
|
||||||
*/
|
|
||||||
public void clearErrors() {
|
|
||||||
this.errorMap.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add all errors from another BulkOperationResult to this.
|
|
||||||
*
|
|
||||||
* @param log
|
|
||||||
* the other log
|
|
||||||
*/
|
|
||||||
public void addAllErrors(BulkOperationResults<K, V> log) {
|
|
||||||
if (log != null && log.containsErrors()) {
|
|
||||||
List<K> failedIds = log.getFailedIds();
|
|
||||||
for (K id : failedIds) {
|
|
||||||
addError(id, log.getErrorForId(id));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Map from any exception type to Exception.
|
|
||||||
*
|
|
||||||
* @return map of errors which can´t be null.
|
|
||||||
*/
|
|
||||||
public BulkOperationResults<K, Exception> mapBulkOperationResults() {
|
|
||||||
BulkOperationResults<K, Exception> bulkLogMapped = new BulkOperationResults<>();
|
|
||||||
|
|
||||||
List<K> failedIds = this.getFailedIds();
|
|
||||||
for (K id : failedIds) {
|
|
||||||
bulkLogMapped.addError(id, (Exception) this.getErrorForId(id));
|
|
||||||
}
|
|
||||||
|
|
||||||
return bulkLogMapped;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "BulkOperationResults [BulkOperationResults= " + LoggerUtils.mapToString(this.errorMap) + "]";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,12 @@
|
||||||
package pro.taskana;
|
package pro.taskana;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This enum contains all status of synchronization between a taskana task and a task in a remote system.
|
* This enum contains all status of synchronization between a taskana task and a task in a remote
|
||||||
|
* system.
|
||||||
*/
|
*/
|
||||||
public enum CallbackState {
|
public enum CallbackState {
|
||||||
NONE, CALLBACK_PROCESSING_REQUIRED, CLAIMED, CALLBACK_PROCESSING_COMPLETED
|
NONE,
|
||||||
|
CALLBACK_PROCESSING_REQUIRED,
|
||||||
|
CLAIMED,
|
||||||
|
CALLBACK_PROCESSING_COMPLETED
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,200 +1,183 @@
|
||||||
package pro.taskana;
|
package pro.taskana;
|
||||||
|
|
||||||
import java.time.Instant;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||||
|
import java.time.Instant;
|
||||||
|
|
||||||
import pro.taskana.impl.ClassificationImpl;
|
import pro.taskana.impl.ClassificationImpl;
|
||||||
|
|
||||||
/**
|
/** Interface used to specify the Classification-Model. */
|
||||||
* Interface used to specify the Classification-Model.
|
|
||||||
*/
|
|
||||||
@JsonDeserialize(as = ClassificationImpl.class)
|
@JsonDeserialize(as = ClassificationImpl.class)
|
||||||
public interface Classification extends ClassificationSummary {
|
public interface Classification extends ClassificationSummary {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set/Change a reference to the current parent classification via ID. EMPTY if there is no parent.
|
* Set/Change a reference to the current parent classification via ID. EMPTY if there is no
|
||||||
*
|
* parent.
|
||||||
* @param parentId
|
*
|
||||||
* The ID of the parent classification.
|
* @param parentId The ID of the parent classification.
|
||||||
*/
|
*/
|
||||||
void setParentId(String parentId);
|
void setParentId(String parentId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set/Change a reference to the current parent classification via key. EMPTY if there is no parent.
|
* Set/Change a reference to the current parent classification via key. EMPTY if there is no
|
||||||
*
|
* parent.
|
||||||
* @param parentKey
|
*
|
||||||
* The key of the parent classification.
|
* @param parentKey The key of the parent classification.
|
||||||
*/
|
*/
|
||||||
void setParentKey(String parentKey);
|
void setParentKey(String parentKey);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set/Change the category of this classification.
|
* Set/Change the category of this classification.
|
||||||
*
|
*
|
||||||
* @param category
|
* @param category The category of the classification.
|
||||||
* The category of the classification.
|
*/
|
||||||
*/
|
void setCategory(String category);
|
||||||
void setCategory(String category);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the current domain-name of this classification.
|
* Get the current domain-name of this classification.
|
||||||
*
|
*
|
||||||
* @return domain name
|
* @return domain name
|
||||||
*/
|
*/
|
||||||
String getDomain();
|
String getDomain();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a flag if the classification if currently valid in the used domain.
|
* Get a flag if the classification if currently valid in the used domain.
|
||||||
*
|
*
|
||||||
* @return isValidInDomain - flag
|
* @return isValidInDomain - flag
|
||||||
*/
|
*/
|
||||||
Boolean getIsValidInDomain();
|
Boolean getIsValidInDomain();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set/Change the flag which marks the classification as valid/invalid in the currently used domain.
|
* Set/Change the flag which marks the classification as valid/invalid in the currently used
|
||||||
*
|
* domain.
|
||||||
* @param isValidInDomain
|
*
|
||||||
* - flag
|
* @param isValidInDomain - flag
|
||||||
*/
|
*/
|
||||||
void setIsValidInDomain(Boolean isValidInDomain);
|
void setIsValidInDomain(Boolean isValidInDomain);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the timestamp when this classification was as created.
|
* Get the timestamp when this classification was as created.
|
||||||
*
|
*
|
||||||
* @return created as instant
|
* @return created as instant
|
||||||
*/
|
*/
|
||||||
Instant getCreated();
|
Instant getCreated();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the timestamp when this classification was as modified the last time.
|
* Get the timestamp when this classification was as modified the last time.
|
||||||
*
|
*
|
||||||
* @return modified as instant
|
* @return modified as instant
|
||||||
*/
|
*/
|
||||||
Instant getModified();
|
Instant getModified();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set/Change the classification name.
|
* Set/Change the classification name.
|
||||||
*
|
*
|
||||||
* @param name
|
* @param name the name of the Classification
|
||||||
* the name of the Classification
|
*/
|
||||||
*/
|
void setName(String name);
|
||||||
void setName(String name);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the description of a classification.
|
* Get the description of a classification.
|
||||||
*
|
*
|
||||||
* @return description
|
* @return description
|
||||||
*/
|
*/
|
||||||
String getDescription();
|
String getDescription();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set/Change the classification description.
|
* Set/Change the classification description.
|
||||||
*
|
*
|
||||||
* @param description
|
* @param description the description of the Classification
|
||||||
* the description of the Classification
|
*/
|
||||||
*/
|
void setDescription(String description);
|
||||||
void setDescription(String description);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set/Change the numeric priority of a classification.
|
* Set/Change the numeric priority of a classification.
|
||||||
*
|
*
|
||||||
* @param priority
|
* @param priority the Priority of the Classification
|
||||||
* the Priority of the Classification
|
*/
|
||||||
*/
|
void setPriority(int priority);
|
||||||
void setPriority(int priority);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set/Change the service level.
|
* Set/Change the service level.
|
||||||
*
|
*
|
||||||
* @param serviceLevel
|
* @param serviceLevel the service level. Must be a String in ISO-8601 duration format. See the
|
||||||
* the service level. Must be a String in ISO-8601 duration format. See the parse() method of
|
* parse() method of {@code Duration} for details.
|
||||||
* {@code Duration} for details.
|
*/
|
||||||
*/
|
void setServiceLevel(String serviceLevel);
|
||||||
void setServiceLevel(String serviceLevel);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the logical name of the associated application entry point.
|
* Get the logical name of the associated application entry point.
|
||||||
*
|
*
|
||||||
* @return applicationEntryPoint
|
* @return applicationEntryPoint
|
||||||
*/
|
*/
|
||||||
String getApplicationEntryPoint();
|
String getApplicationEntryPoint();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the logical name of the associated application entry point.
|
* Set the logical name of the associated application entry point.
|
||||||
*
|
*
|
||||||
* @param applicationEntryPoint
|
* @param applicationEntryPoint The application entry point
|
||||||
* The application entry point
|
*/
|
||||||
*/
|
void setApplicationEntryPoint(String applicationEntryPoint);
|
||||||
void setApplicationEntryPoint(String applicationEntryPoint);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set/Change the 1. custom-attribute.
|
* Set/Change the 1. custom-attribute.
|
||||||
*
|
*
|
||||||
* @param custom1
|
* @param custom1 the first custom attribute
|
||||||
* the first custom attribute
|
*/
|
||||||
*/
|
void setCustom1(String custom1);
|
||||||
void setCustom1(String custom1);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set/Change the 2. custom-attribute.
|
* Set/Change the 2. custom-attribute.
|
||||||
*
|
*
|
||||||
* @param custom2
|
* @param custom2 the second custom attribute
|
||||||
* the second custom attribute
|
*/
|
||||||
*/
|
void setCustom2(String custom2);
|
||||||
void setCustom2(String custom2);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set/Change the 3. custom-attribute.
|
* Set/Change the 3. custom-attribute.
|
||||||
*
|
*
|
||||||
* @param custom3
|
* @param custom3 the third custom attribute
|
||||||
* the third custom attribute
|
*/
|
||||||
*/
|
void setCustom3(String custom3);
|
||||||
void setCustom3(String custom3);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set/Change the 4. custom-attribute.
|
* Set/Change the 4. custom-attribute.
|
||||||
*
|
*
|
||||||
* @param custom4
|
* @param custom4 the fourth custom attribute
|
||||||
* the fourth custom attribute
|
*/
|
||||||
*/
|
void setCustom4(String custom4);
|
||||||
void setCustom4(String custom4);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set/Change the 5. custom-attribute.
|
* Set/Change the 5. custom-attribute.
|
||||||
*
|
*
|
||||||
* @param custom5
|
* @param custom5 the fifth custom attribute
|
||||||
* the fifth custom attribute
|
*/
|
||||||
*/
|
void setCustom5(String custom5);
|
||||||
void setCustom5(String custom5);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set/Change the 6. custom-attribute.
|
* Set/Change the 6. custom-attribute.
|
||||||
*
|
*
|
||||||
* @param custom6
|
* @param custom6 the sixth custom attribute
|
||||||
* the sixth custom attribute
|
*/
|
||||||
*/
|
void setCustom6(String custom6);
|
||||||
void setCustom6(String custom6);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set/Change the 7. custom-attribute.
|
* Set/Change the 7. custom-attribute.
|
||||||
*
|
*
|
||||||
* @param custom7
|
* @param custom7 the seventh custom attribute
|
||||||
* the seventh custom attribute
|
*/
|
||||||
*/
|
void setCustom7(String custom7);
|
||||||
void setCustom7(String custom7);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set/Change the 8. custom-attribute.
|
* Set/Change the 8. custom-attribute.
|
||||||
*
|
*
|
||||||
* @param custom8
|
* @param custom8 the eight custom attribute
|
||||||
* the eight custom attribute
|
*/
|
||||||
*/
|
void setCustom8(String custom8);
|
||||||
void setCustom8(String custom8);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a summary of the current Classification.
|
* Return a summary of the current Classification.
|
||||||
*
|
*
|
||||||
* @return the ClassificationSummary object for the current classification
|
* @return the ClassificationSummary object for the current classification
|
||||||
*/
|
*/
|
||||||
ClassificationSummary asSummary();
|
ClassificationSummary asSummary();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,302 +2,269 @@ package pro.taskana;
|
||||||
|
|
||||||
import pro.taskana.exceptions.InvalidArgumentException;
|
import pro.taskana.exceptions.InvalidArgumentException;
|
||||||
|
|
||||||
/**
|
/** ClassificationQuery for generating dynamic sql. */
|
||||||
* ClassificationQuery for generating dynamic sql.
|
public interface ClassificationQuery
|
||||||
*/
|
extends BaseQuery<ClassificationSummary, ClassificationQueryColumnName> {
|
||||||
public interface ClassificationQuery extends BaseQuery<ClassificationSummary, ClassificationQueryColumnName> {
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add your key to your query.
|
* Add your key to your query.
|
||||||
*
|
*
|
||||||
* @param key
|
* @param key as String
|
||||||
* as String
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
ClassificationQuery keyIn(String... key);
|
||||||
ClassificationQuery keyIn(String... key);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add your Id to your query.
|
* Add your Id to your query.
|
||||||
*
|
*
|
||||||
* @param id
|
* @param id as String
|
||||||
* as String
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
ClassificationQuery idIn(String... id);
|
||||||
ClassificationQuery idIn(String... id);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add your parentIds to your query.
|
* Add your parentIds to your query.
|
||||||
*
|
*
|
||||||
* @param parentId
|
* @param parentId as an array of Strings
|
||||||
* as an array of Strings
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
ClassificationQuery parentIdIn(String... parentId);
|
||||||
ClassificationQuery parentIdIn(String... parentId);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add your parentKeys to your query.
|
* Add your parentKeys to your query.
|
||||||
*
|
*
|
||||||
* @param parentKey
|
* @param parentKey as an array of Strings
|
||||||
* as an array of Strings
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
ClassificationQuery parentKeyIn(String... parentKey);
|
||||||
ClassificationQuery parentKeyIn(String... parentKey);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add your category to your query.
|
* Add your category to your query.
|
||||||
*
|
*
|
||||||
* @param category
|
* @param category as String
|
||||||
* as String
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
ClassificationQuery categoryIn(String... category);
|
||||||
ClassificationQuery categoryIn(String... category);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add your type to your query.
|
* Add your type to your query.
|
||||||
*
|
*
|
||||||
* @param type
|
* @param type as String
|
||||||
* as String
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
ClassificationQuery typeIn(String... type);
|
||||||
ClassificationQuery typeIn(String... type);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add your domains to your query which are used as filter.
|
* Add your domains to your query which are used as filter.
|
||||||
*
|
*
|
||||||
* @param domain
|
* @param domain or domains for filtering.
|
||||||
* or domains for filtering.
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
ClassificationQuery domainIn(String... domain);
|
||||||
ClassificationQuery domainIn(String... domain);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add to your query if the Classification shall be valid in its domain.
|
* Add to your query if the Classification shall be valid in its domain.
|
||||||
*
|
*
|
||||||
* @param validInDomain
|
* @param validInDomain a simple flag showing if domain is valid
|
||||||
* a simple flag showing if domain is valid
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
ClassificationQuery validInDomainEquals(Boolean validInDomain);
|
||||||
ClassificationQuery validInDomainEquals(Boolean validInDomain);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add your created-Dates to your query.
|
* Add your created-Dates to your query.
|
||||||
*
|
*
|
||||||
* @param createdIn
|
* @param createdIn the {@link TimeInterval} within which the searched-for classifications were
|
||||||
* the {@link TimeInterval} within which the searched-for classifications were created.
|
* created.
|
||||||
* @return the query
|
* @return the query
|
||||||
*/
|
*/
|
||||||
ClassificationQuery createdWithin(TimeInterval... createdIn);
|
ClassificationQuery createdWithin(TimeInterval... createdIn);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add your modified-Dates to your query.
|
* Add your modified-Dates to your query.
|
||||||
*
|
*
|
||||||
* @param modifiedIn
|
* @param modifiedIn the {@link TimeInterval} within which the searched-for classifications were
|
||||||
* the {@link TimeInterval} within which the searched-for classifications were modified the last time.
|
* modified the last time.
|
||||||
* @return the query
|
* @return the query
|
||||||
*/
|
*/
|
||||||
ClassificationQuery modifiedWithin(TimeInterval... modifiedIn);
|
ClassificationQuery modifiedWithin(TimeInterval... modifiedIn);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add your name to your query.
|
* Add your name to your query.
|
||||||
*
|
*
|
||||||
* @param nameIn
|
* @param nameIn as String
|
||||||
* as String
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
ClassificationQuery nameIn(String... nameIn);
|
||||||
ClassificationQuery nameIn(String... nameIn);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add your name to your query. It will be compared in SQL with an LIKE.
|
* Add your name to your query. It will be compared in SQL with an LIKE.
|
||||||
*
|
*
|
||||||
* @param nameLike
|
* @param nameLike as String
|
||||||
* as String
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
ClassificationQuery nameLike(String... nameLike);
|
||||||
ClassificationQuery nameLike(String... nameLike);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add your description to your query. It will be compared in SQL with an LIKE. If you use a wildcard like % then it
|
* Add your description to your query. It will be compared in SQL with an LIKE. If you use a
|
||||||
* will be transmitted to the database.
|
* wildcard like % then it will be transmitted to the database.
|
||||||
*
|
*
|
||||||
* @param descriptionLike
|
* @param descriptionLike your description
|
||||||
* your description
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
ClassificationQuery descriptionLike(String descriptionLike);
|
||||||
ClassificationQuery descriptionLike(String descriptionLike);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add your priority to your query.
|
* Add your priority to your query.
|
||||||
*
|
*
|
||||||
* @param priorities
|
* @param priorities as integers
|
||||||
* as integers
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
ClassificationQuery priorityIn(int... priorities);
|
||||||
ClassificationQuery priorityIn(int... priorities);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add your serviceLevel to your query.
|
* Add your serviceLevel to your query.
|
||||||
*
|
*
|
||||||
* @param serviceLevelIn
|
* @param serviceLevelIn as String
|
||||||
* as String
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
ClassificationQuery serviceLevelIn(String... serviceLevelIn);
|
||||||
ClassificationQuery serviceLevelIn(String... serviceLevelIn);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add your serviceLevel to your query. It will be compared in SQL with an LIKE.
|
* Add your serviceLevel to your query. It will be compared in SQL with an LIKE.
|
||||||
*
|
*
|
||||||
* @param serviceLevelLike
|
* @param serviceLevelLike as String
|
||||||
* as String
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
ClassificationQuery serviceLevelLike(String... serviceLevelLike);
|
||||||
ClassificationQuery serviceLevelLike(String... serviceLevelLike);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add your applicationEntryPoint to your query.
|
* Add your applicationEntryPoint to your query.
|
||||||
*
|
*
|
||||||
* @param applicationEntryPointIn
|
* @param applicationEntryPointIn name of the applications entrypoint
|
||||||
* name of the applications entrypoint
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
ClassificationQuery applicationEntryPointIn(String... applicationEntryPointIn);
|
||||||
ClassificationQuery applicationEntryPointIn(String... applicationEntryPointIn);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add your applicationEntryPoint to your query. It will be compared in SQL with an LIKE.
|
* Add your applicationEntryPoint to your query. It will be compared in SQL with an LIKE.
|
||||||
*
|
*
|
||||||
* @param applicationEntryPointLike
|
* @param applicationEntryPointLike name of the applications entrypoint
|
||||||
* name of the applications entrypoint
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
ClassificationQuery applicationEntryPointLike(String... applicationEntryPointLike);
|
||||||
ClassificationQuery applicationEntryPointLike(String... applicationEntryPointLike);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a custom to your query.
|
* Add a custom to your query.
|
||||||
*
|
*
|
||||||
* @param num
|
* @param num the number of the custom as String (eg "4")
|
||||||
* the number of the custom as String (eg "4")
|
* @param customIn filter for this custom
|
||||||
* @param customIn
|
* @return the query
|
||||||
* filter for this custom
|
* @throws InvalidArgumentException when the number of the custom is incorrect.
|
||||||
* @return the query
|
*/
|
||||||
* @throws InvalidArgumentException
|
ClassificationQuery customAttributeIn(String num, String... customIn)
|
||||||
* when the number of the custom is incorrect.
|
throws InvalidArgumentException;
|
||||||
*/
|
|
||||||
ClassificationQuery customAttributeIn(String num, String... customIn) throws InvalidArgumentException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a custom to your query.
|
* Add a custom to your query.
|
||||||
*
|
*
|
||||||
* @param num
|
* @param num the number of the custom as String (eg "4")
|
||||||
* the number of the custom as String (eg "4")
|
* @param customLike filter for this custom with a LIKE-query
|
||||||
* @param customLike
|
* @return the query
|
||||||
* filter for this custom with a LIKE-query
|
* @throws InvalidArgumentException when the number of the custom is incorrect.
|
||||||
* @return the query
|
*/
|
||||||
* @throws InvalidArgumentException
|
ClassificationQuery customAttributeLike(String num, String... customLike)
|
||||||
* when the number of the custom is incorrect.
|
throws InvalidArgumentException;
|
||||||
*/
|
|
||||||
ClassificationQuery customAttributeLike(String num, String... customLike) throws InvalidArgumentException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sort the query result by key.
|
* Sort the query result by key.
|
||||||
*
|
*
|
||||||
* @param sortDirection
|
* @param sortDirection Determines whether the result is sorted in ascending or descending order.
|
||||||
* Determines whether the result is sorted in ascending or descending order. If sortDirection is null,
|
* If sortDirection is null, the result is sorted in ascending order
|
||||||
* the result is sorted in ascending order
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
ClassificationQuery orderByKey(SortDirection sortDirection);
|
||||||
ClassificationQuery orderByKey(SortDirection sortDirection);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sort the query result by the parent classification ID.
|
* Sort the query result by the parent classification ID.
|
||||||
*
|
*
|
||||||
* @param sortDirection
|
* @param sortDirection Determines whether the result is sorted in ascending or descending order.
|
||||||
* Determines whether the result is sorted in ascending or descending order. If sortDirection is null,
|
* If sortDirection is null, the result is sorted in ascending order
|
||||||
* the result is sorted in ascending order
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
ClassificationQuery orderByParentId(SortDirection sortDirection);
|
||||||
ClassificationQuery orderByParentId(SortDirection sortDirection);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sort the query result by the parent classification key.
|
* Sort the query result by the parent classification key.
|
||||||
*
|
*
|
||||||
* @param sortDirection
|
* @param sortDirection Determines whether the result is sorted in ascending or descending order.
|
||||||
* Determines whether the result is sorted in ascending or descending order. If sortDirection is null,
|
* If sortDirection is null, the result is sorted in ascending order
|
||||||
* the result is sorted in ascending order
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
ClassificationQuery orderByParentKey(SortDirection sortDirection);
|
||||||
ClassificationQuery orderByParentKey(SortDirection sortDirection);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sort the query result by category.
|
* Sort the query result by category.
|
||||||
*
|
*
|
||||||
* @param sortDirection
|
* @param sortDirection Determines whether the result is sorted in ascending or descending order.
|
||||||
* Determines whether the result is sorted in ascending or descending order. If sortDirection is null,
|
* If sortDirection is null, the result is sorted in ascending order
|
||||||
* the result is sorted in ascending order
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
ClassificationQuery orderByCategory(SortDirection sortDirection);
|
||||||
ClassificationQuery orderByCategory(SortDirection sortDirection);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sort the query result by domain.
|
* Sort the query result by domain.
|
||||||
*
|
*
|
||||||
* @param sortDirection
|
* @param sortDirection Determines whether the result is sorted in ascending or descending order.
|
||||||
* Determines whether the result is sorted in ascending or descending order. If sortDirection is null,
|
* If sortDirection is null, the result is sorted in ascending order
|
||||||
* the result is sorted in ascending order
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
ClassificationQuery orderByDomain(SortDirection sortDirection);
|
||||||
ClassificationQuery orderByDomain(SortDirection sortDirection);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sort the query result by name.
|
* Sort the query result by name.
|
||||||
*
|
*
|
||||||
* @param sortDirection
|
* @param sortDirection Determines whether the result is sorted in ascending or descending order.
|
||||||
* Determines whether the result is sorted in ascending or descending order. If sortDirection is null,
|
* If sortDirection is null, the result is sorted in ascending order
|
||||||
* the result is sorted in ascending order
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
ClassificationQuery orderByName(SortDirection sortDirection);
|
||||||
ClassificationQuery orderByName(SortDirection sortDirection);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sort the query result by service level.
|
* Sort the query result by service level.
|
||||||
*
|
*
|
||||||
* @param sortDirection
|
* @param sortDirection Determines whether the result is sorted in ascending or descending order.
|
||||||
* Determines whether the result is sorted in ascending or descending order. If sortDirection is null,
|
* If sortDirection is null, the result is sorted in ascending order
|
||||||
* the result is sorted in ascending order
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
ClassificationQuery orderByServiceLevel(SortDirection sortDirection);
|
||||||
ClassificationQuery orderByServiceLevel(SortDirection sortDirection);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sort the query result by priority.
|
* Sort the query result by priority.
|
||||||
*
|
*
|
||||||
* @param sortDirection
|
* @param sortDirection Determines whether the result is sorted in ascending or descending order.
|
||||||
* Determines whether the result is sorted in ascending or descending order. If sortDirection is null,
|
* If sortDirection is null, the result is sorted in ascending order
|
||||||
* the result is sorted in ascending order
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
ClassificationQuery orderByPriority(SortDirection sortDirection);
|
||||||
ClassificationQuery orderByPriority(SortDirection sortDirection);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sort the query result by the application entry point name.
|
* Sort the query result by the application entry point name.
|
||||||
*
|
*
|
||||||
* @param sortDirection
|
* @param sortDirection Determines whether the result is sorted in ascending or descending order.
|
||||||
* Determines whether the result is sorted in ascending or descending order. If sortDirection is null,
|
* If sortDirection is null, the result is sorted in ascending order
|
||||||
* the result is sorted in ascending order
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
ClassificationQuery orderByApplicationEntryPoint(SortDirection sortDirection);
|
||||||
ClassificationQuery orderByApplicationEntryPoint(SortDirection sortDirection);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sort the query result by a custom.
|
|
||||||
*
|
|
||||||
* @param num
|
|
||||||
* the number of the custom as String (eg "4")
|
|
||||||
* @param sortDirection
|
|
||||||
* Determines whether the result is sorted in ascending or descending order. If sortDirection is null,
|
|
||||||
* the result is sorted in ascending order
|
|
||||||
* @return the query
|
|
||||||
* @throws InvalidArgumentException
|
|
||||||
* when the number of the custom is incorrect.
|
|
||||||
*/
|
|
||||||
ClassificationQuery orderByCustomAttribute(String num, SortDirection sortDirection) throws InvalidArgumentException;
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sort the query result by a custom.
|
||||||
|
*
|
||||||
|
* @param num the number of the custom as String (eg "4")
|
||||||
|
* @param sortDirection Determines whether the result is sorted in ascending or descending order.
|
||||||
|
* If sortDirection is null, the result is sorted in ascending order
|
||||||
|
* @return the query
|
||||||
|
* @throws InvalidArgumentException when the number of the custom is incorrect.
|
||||||
|
*/
|
||||||
|
ClassificationQuery orderByCustomAttribute(String num, SortDirection sortDirection)
|
||||||
|
throws InvalidArgumentException;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,42 +1,44 @@
|
||||||
package pro.taskana;
|
package pro.taskana;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enum containing the column names for @see pro.taskana.mappings.QueryMapper#queryClassificationColumnValues(pro.taskana.impl.ClassificationQueryImpl).
|
* Enum containing the column names for @see
|
||||||
|
* pro.taskana.mappings.QueryMapper#queryClassificationColumnValues(pro.taskana.impl.ClassificationQueryImpl).
|
||||||
*
|
*
|
||||||
* @author jsa
|
* @author jsa
|
||||||
*/
|
*/
|
||||||
public enum ClassificationQueryColumnName implements QueryColumnName {
|
public enum ClassificationQueryColumnName implements QueryColumnName {
|
||||||
ID("id"),
|
ID("id"),
|
||||||
KEY("key"),
|
KEY("key"),
|
||||||
PARENT_ID("parent_id"),
|
PARENT_ID("parent_id"),
|
||||||
PARENT_KEY("parent_key"),
|
PARENT_KEY("parent_key"),
|
||||||
CATEGORY("category"),
|
CATEGORY("category"),
|
||||||
TYPE("type"),
|
TYPE("type"),
|
||||||
DOMAIN("domain"),
|
DOMAIN("domain"),
|
||||||
VALID_IN_DOMAIN("valid_in_domain"),
|
VALID_IN_DOMAIN("valid_in_domain"),
|
||||||
CREATED("created"),
|
CREATED("created"),
|
||||||
MODIFIED("modified"),
|
MODIFIED("modified"),
|
||||||
NAME("name"),
|
NAME("name"),
|
||||||
DESCRIPTION("description"),
|
DESCRIPTION("description"),
|
||||||
PRIORITY("priority"),
|
PRIORITY("priority"),
|
||||||
SERVICELEVEL("serviceLevel"),
|
SERVICELEVEL("serviceLevel"),
|
||||||
APPLICATION_ENTRY_POINT("application_entry_point"),
|
APPLICATION_ENTRY_POINT("application_entry_point"),
|
||||||
CUSTOM_1("custom_1"),
|
CUSTOM_1("custom_1"),
|
||||||
CUSTOM_2("custom_2"),
|
CUSTOM_2("custom_2"),
|
||||||
CUSTOM_3("custom_3"),
|
CUSTOM_3("custom_3"),
|
||||||
CUSTOM_4("custom_4"),
|
CUSTOM_4("custom_4"),
|
||||||
CUSTOM_5("custom_5"),
|
CUSTOM_5("custom_5"),
|
||||||
CUSTOM_6("custom_6"),
|
CUSTOM_6("custom_6"),
|
||||||
CUSTOM_7("custom_7"),
|
CUSTOM_7("custom_7"),
|
||||||
CUSTOM_8("custom_8");
|
CUSTOM_8("custom_8");
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
ClassificationQueryColumnName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
ClassificationQueryColumnName(String name) {
|
||||||
public String toString() {
|
this.name = name;
|
||||||
return name;
|
}
|
||||||
}
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,125 +8,111 @@ import pro.taskana.exceptions.DomainNotFoundException;
|
||||||
import pro.taskana.exceptions.InvalidArgumentException;
|
import pro.taskana.exceptions.InvalidArgumentException;
|
||||||
import pro.taskana.exceptions.NotAuthorizedException;
|
import pro.taskana.exceptions.NotAuthorizedException;
|
||||||
|
|
||||||
/**
|
/** This class manages the classifications. */
|
||||||
* This class manages the classifications.
|
|
||||||
*/
|
|
||||||
public interface ClassificationService {
|
public interface ClassificationService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the Classification for key and domain. If there's no Classification in the given domain, return the
|
* Get the Classification for key and domain. If there's no Classification in the given domain,
|
||||||
* Classification from the master domain.
|
* return the Classification from the master domain.
|
||||||
*
|
*
|
||||||
* @param key
|
* @param key the key of the searched-for classifications
|
||||||
* the key of the searched-for classifications
|
* @param domain the domain of the searched-for classifications
|
||||||
* @param domain
|
* @return If exist: domain-specific classification, else master classification
|
||||||
* the domain of the searched-for classifications
|
* @throws ClassificationNotFoundException if no classification is found that matches the key
|
||||||
* @return If exist: domain-specific classification, else master classification
|
* either in domain or in the master domain.
|
||||||
* @throws ClassificationNotFoundException
|
*/
|
||||||
* if no classification is found that matches the key either in domain or in the master domain.
|
Classification getClassification(String key, String domain)
|
||||||
*/
|
throws ClassificationNotFoundException;
|
||||||
Classification getClassification(String key, String domain) throws ClassificationNotFoundException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the Classification by id.
|
* Get the Classification by id.
|
||||||
*
|
*
|
||||||
* @param id
|
* @param id the id of the searched-for classifications
|
||||||
* the id of the searched-for classifications
|
* @return the classification identified by id
|
||||||
* @return the classification identified by id
|
* @throws ClassificationNotFoundException if no classification is found that matches the id.
|
||||||
* @throws ClassificationNotFoundException
|
*/
|
||||||
* if no classification is found that matches the id.
|
Classification getClassification(String id) throws ClassificationNotFoundException;
|
||||||
*/
|
|
||||||
Classification getClassification(String id) throws ClassificationNotFoundException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete a classification with all child classifications.
|
* Delete a classification with all child classifications.
|
||||||
*
|
*
|
||||||
* @param id
|
* @param id the id of the searched-for classifications
|
||||||
* the id of the searched-for classifications
|
* @throws ClassificationInUseException if there are Task existing, which refer to this
|
||||||
* @throws ClassificationInUseException
|
* classification.
|
||||||
* if there are Task existing, which refer to this classification.
|
* @throws ClassificationNotFoundException if for an domain no classification specification is
|
||||||
* @throws ClassificationNotFoundException
|
* found.
|
||||||
* if for an domain no classification specification is found.
|
* @throws NotAuthorizedException if the current user is not member of role BUSINESS_ADMIN or
|
||||||
* @throws NotAuthorizedException
|
* ADMIN
|
||||||
* if the current user is not member of role BUSINESS_ADMIN or ADMIN
|
*/
|
||||||
*/
|
void deleteClassification(String id)
|
||||||
void deleteClassification(String id)
|
throws ClassificationInUseException, ClassificationNotFoundException, NotAuthorizedException;
|
||||||
throws ClassificationInUseException, ClassificationNotFoundException, NotAuthorizedException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete a classification with all child classifications.
|
* Delete a classification with all child classifications.
|
||||||
*
|
*
|
||||||
* @param classificationKey
|
* @param classificationKey the key of the classification you want to delete.
|
||||||
* the key of the classification you want to delete.
|
* @param domain the domains for which you want to delete the classification. if "", the function
|
||||||
* @param domain
|
* tries to delete the "master domain" classification and any other classification with this
|
||||||
* the domains for which you want to delete the classification. if "", the function tries to delete the
|
* key.
|
||||||
* "master domain" classification and any other classification with this key.
|
* @throws ClassificationInUseException if there are Task existing, which refer to this
|
||||||
* @throws ClassificationInUseException
|
* classification.
|
||||||
* if there are Task existing, which refer to this classification.
|
* @throws ClassificationNotFoundException if for an domain no classification specification is
|
||||||
* @throws ClassificationNotFoundException
|
* found.
|
||||||
* if for an domain no classification specification is found.
|
* @throws NotAuthorizedException if the current user is not member of role BUSINESS_ADMIN or
|
||||||
* @throws NotAuthorizedException
|
* ADMIN
|
||||||
* if the current user is not member of role BUSINESS_ADMIN or ADMIN
|
*/
|
||||||
*/
|
void deleteClassification(String classificationKey, String domain)
|
||||||
void deleteClassification(String classificationKey, String domain)
|
throws ClassificationInUseException, ClassificationNotFoundException, NotAuthorizedException;
|
||||||
throws ClassificationInUseException, ClassificationNotFoundException, NotAuthorizedException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Persists a new classification after adding default values. <br >
|
* Persists a new classification after adding default values. <br>
|
||||||
* The classification will be added to master-domain, too - if not already existing.
|
* The classification will be added to master-domain, too - if not already existing.
|
||||||
*
|
*
|
||||||
* @param classification
|
* @param classification the classification to insert
|
||||||
* the classification to insert
|
* @return classification which is persisted with unique ID.
|
||||||
* @return classification which is persisted with unique ID.
|
* @throws ClassificationAlreadyExistException when the classification does already exists at the
|
||||||
* @throws ClassificationAlreadyExistException
|
* given domain.
|
||||||
* when the classification does already exists at the given domain.
|
* @throws NotAuthorizedException if the current user is not member of role BUSINESS_ADMIN or
|
||||||
* @throws NotAuthorizedException
|
* ADMIN
|
||||||
* if the current user is not member of role BUSINESS_ADMIN or ADMIN
|
* @throws DomainNotFoundException if the domain does not exist in the configuration
|
||||||
* @throws DomainNotFoundException
|
* @throws InvalidArgumentException if the ServiceLevel property does not comply with the ISO 8601
|
||||||
* if the domain does not exist in the configuration
|
* specification
|
||||||
* @throws InvalidArgumentException
|
*/
|
||||||
* if the ServiceLevel property does not comply with the ISO 8601 specification
|
Classification createClassification(Classification classification)
|
||||||
*/
|
throws ClassificationAlreadyExistException, NotAuthorizedException, DomainNotFoundException,
|
||||||
Classification createClassification(Classification classification)
|
InvalidArgumentException;
|
||||||
throws ClassificationAlreadyExistException, NotAuthorizedException,
|
|
||||||
DomainNotFoundException, InvalidArgumentException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates a Classification.
|
* Updates a Classification.
|
||||||
*
|
*
|
||||||
* @param classification
|
* @param classification the Classification to update
|
||||||
* the Classification to update
|
* @return the updated Classification.
|
||||||
* @return the updated Classification.
|
* @throws ClassificationNotFoundException when the classification OR it´s parent does not exist.
|
||||||
* @throws ClassificationNotFoundException
|
* @throws NotAuthorizedException when the caller got no ADMIN or BUSINESS_ADMIN permissions.
|
||||||
* when the classification OR it´s parent does not exist.
|
* @throws ConcurrencyException when the Classification was modified meanwhile and is not latest
|
||||||
* @throws NotAuthorizedException
|
* anymore.
|
||||||
* when the caller got no ADMIN or BUSINESS_ADMIN permissions.
|
* @throws InvalidArgumentException if the ServiceLevel property does not comply with the ISO 8601
|
||||||
* @throws ConcurrencyException
|
* specification
|
||||||
* when the Classification was modified meanwhile and is not latest anymore.
|
*/
|
||||||
* @throws InvalidArgumentException
|
Classification updateClassification(Classification classification)
|
||||||
* if the ServiceLevel property does not comply with the ISO 8601 specification
|
throws ClassificationNotFoundException, NotAuthorizedException, ConcurrencyException,
|
||||||
*/
|
InvalidArgumentException;
|
||||||
Classification updateClassification(Classification classification)
|
|
||||||
throws ClassificationNotFoundException, NotAuthorizedException, ConcurrencyException, InvalidArgumentException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method provides a query builder for quering the database.
|
* This method provides a query builder for quering the database.
|
||||||
*
|
*
|
||||||
* @return a {@link ClassificationQuery}
|
* @return a {@link ClassificationQuery}
|
||||||
*/
|
*/
|
||||||
ClassificationQuery createClassificationQuery();
|
ClassificationQuery createClassificationQuery();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creating a new {@link Classification} with unchangeable default values. It will be only generated and is not
|
* Creating a new {@link Classification} with unchangeable default values. It will be only
|
||||||
* persisted until CREATE-call.
|
* generated and is not persisted until CREATE-call.
|
||||||
*
|
*
|
||||||
* @param key
|
* @param key the key of the classification
|
||||||
* the key of the classification
|
* @param domain the domain of the new classification
|
||||||
* @param domain
|
* @param type the type of the new classification
|
||||||
* the domain of the new classification
|
* @return classification to specify
|
||||||
* @param type
|
*/
|
||||||
* the type of the new classification
|
Classification newClassification(String key, String domain, String type);
|
||||||
* @return classification to specify
|
|
||||||
*/
|
|
||||||
Classification newClassification(String key, String domain, String type);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,136 +1,135 @@
|
||||||
package pro.taskana;
|
package pro.taskana;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface for ClassificationSummaries. This is a specific short model-object which only requieres the most important
|
* Interface for ClassificationSummaries. This is a specific short model-object which only requieres
|
||||||
* informations. Specific ones can be load afterwards via ID.
|
* the most important informations. Specific ones can be load afterwards via ID.
|
||||||
*/
|
*/
|
||||||
public interface ClassificationSummary {
|
public interface ClassificationSummary {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the id of the classification.
|
* Gets the id of the classification.
|
||||||
*
|
*
|
||||||
* @return classificationId
|
* @return classificationId
|
||||||
*/
|
*/
|
||||||
String getId();
|
String getId();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the key of the classification.
|
* Gets the key of the classification.
|
||||||
*
|
*
|
||||||
* @return classificationKey
|
* @return classificationKey
|
||||||
*/
|
*/
|
||||||
String getKey();
|
String getKey();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the category of the classification.
|
* Gets the category of the classification.
|
||||||
*
|
*
|
||||||
* @return classificationCategory
|
* @return classificationCategory
|
||||||
*/
|
*/
|
||||||
String getCategory();
|
String getCategory();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the type of the classification.
|
* Gets the type of the classification.
|
||||||
*
|
*
|
||||||
* @return classificationType
|
* @return classificationType
|
||||||
*/
|
*/
|
||||||
String getType();
|
String getType();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the domain of the classification.
|
* Gets the domain of the classification.
|
||||||
*
|
*
|
||||||
* @return classificationDomain
|
* @return classificationDomain
|
||||||
*/
|
*/
|
||||||
String getDomain();
|
String getDomain();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the name of the classification.
|
* Gets the name of the classification.
|
||||||
*
|
*
|
||||||
* @return classificationName
|
* @return classificationName
|
||||||
*/
|
*/
|
||||||
String getName();
|
String getName();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the ID of the parent classification.
|
* Gets the ID of the parent classification.
|
||||||
*
|
*
|
||||||
* @return parentId
|
* @return parentId
|
||||||
*/
|
*/
|
||||||
String getParentId();
|
String getParentId();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the key of the parent classification.
|
* Gets the key of the parent classification.
|
||||||
*
|
*
|
||||||
* @return parentKey
|
* @return parentKey
|
||||||
*/
|
*/
|
||||||
String getParentKey();
|
String getParentKey();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the service level of the parent classification. It is a String in ISO-8601 duration format. See the parse()
|
* Gets the service level of the parent classification. It is a String in ISO-8601 duration
|
||||||
* method of {@code Duration} for details.
|
* format. See the parse() method of {@code Duration} for details.
|
||||||
*
|
*
|
||||||
* @return the service level
|
* @return the service level
|
||||||
*/
|
*/
|
||||||
String getServiceLevel();
|
String getServiceLevel();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the priority of the classification.
|
* Gets the priority of the classification.
|
||||||
*
|
*
|
||||||
* @return the priority
|
* @return the priority
|
||||||
*/
|
*/
|
||||||
int getPriority();
|
int getPriority();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the 1. custom-attribute.
|
* Get the 1. custom-attribute.
|
||||||
*
|
*
|
||||||
* @return custom1
|
* @return custom1
|
||||||
*/
|
*/
|
||||||
String getCustom1();
|
String getCustom1();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the 2. custom-attribute.
|
* Get the 2. custom-attribute.
|
||||||
*
|
*
|
||||||
* @return custom2
|
* @return custom2
|
||||||
*/
|
*/
|
||||||
String getCustom2();
|
String getCustom2();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the 3. custom-attribute.
|
* Get the 3. custom-attribute.
|
||||||
*
|
*
|
||||||
* @return custom3
|
* @return custom3
|
||||||
*/
|
*/
|
||||||
String getCustom3();
|
String getCustom3();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the 4. custom-attribute.
|
* Get the 4. custom-attribute.
|
||||||
*
|
*
|
||||||
* @return custom4
|
* @return custom4
|
||||||
*/
|
*/
|
||||||
String getCustom4();
|
String getCustom4();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the 5. custom-attribute.
|
* Get the 5. custom-attribute.
|
||||||
*
|
*
|
||||||
* @return custom5
|
* @return custom5
|
||||||
*/
|
*/
|
||||||
String getCustom5();
|
String getCustom5();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the 6. custom-attribute.
|
* Get the 6. custom-attribute.
|
||||||
*
|
*
|
||||||
* @return custom6
|
* @return custom6
|
||||||
*/
|
*/
|
||||||
String getCustom6();
|
String getCustom6();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the 7. custom-attribute.
|
* Get the 7. custom-attribute.
|
||||||
*
|
*
|
||||||
* @return custom7
|
* @return custom7
|
||||||
*/
|
*/
|
||||||
String getCustom7();
|
String getCustom7();
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the 8. custom-attribute.
|
|
||||||
*
|
|
||||||
* @return custom8
|
|
||||||
*/
|
|
||||||
String getCustom8();
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the 8. custom-attribute.
|
||||||
|
*
|
||||||
|
* @return custom8
|
||||||
|
*/
|
||||||
|
String getCustom8();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,21 @@
|
||||||
package pro.taskana;
|
package pro.taskana;
|
||||||
|
|
||||||
/**
|
/** This enum contains the fields CUSTOM_1 - CUSTOM_10 for the task entity. */
|
||||||
* This enum contains the fields CUSTOM_1 - CUSTOM_10 for the task entity.
|
|
||||||
*/
|
|
||||||
public enum CustomField {
|
public enum CustomField {
|
||||||
CUSTOM_1,
|
CUSTOM_1,
|
||||||
CUSTOM_2,
|
CUSTOM_2,
|
||||||
CUSTOM_3,
|
CUSTOM_3,
|
||||||
CUSTOM_4,
|
CUSTOM_4,
|
||||||
CUSTOM_5,
|
CUSTOM_5,
|
||||||
CUSTOM_6,
|
CUSTOM_6,
|
||||||
CUSTOM_7,
|
CUSTOM_7,
|
||||||
CUSTOM_8,
|
CUSTOM_8,
|
||||||
CUSTOM_9,
|
CUSTOM_9,
|
||||||
CUSTOM_10,
|
CUSTOM_10,
|
||||||
CUSTOM_11,
|
CUSTOM_11,
|
||||||
CUSTOM_12,
|
CUSTOM_12,
|
||||||
CUSTOM_13,
|
CUSTOM_13,
|
||||||
CUSTOM_14,
|
CUSTOM_14,
|
||||||
CUSTOM_15,
|
CUSTOM_15,
|
||||||
CUSTOM_16
|
CUSTOM_16
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,18 +2,14 @@ package pro.taskana;
|
||||||
|
|
||||||
import pro.taskana.jobs.ScheduledJob;
|
import pro.taskana.jobs.ScheduledJob;
|
||||||
|
|
||||||
/**
|
/** Service to manage the TASKANA jobs. */
|
||||||
* Service to manage the TASKANA jobs.
|
|
||||||
*/
|
|
||||||
public interface JobService {
|
public interface JobService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a schedule a new job.
|
* Create a schedule a new job.
|
||||||
*
|
*
|
||||||
* @param job
|
* @param job {@link ScheduledJob} The job to be created.
|
||||||
* {@link ScheduledJob} The job to be created.
|
* @return {@link ScheduledJob} The created job.
|
||||||
* @return {@link ScheduledJob} The created job.
|
*/
|
||||||
*/
|
ScheduledJob createJob(ScheduledJob job);
|
||||||
ScheduledJob createJob(ScheduledJob job);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,74 +7,70 @@ package pro.taskana;
|
||||||
*/
|
*/
|
||||||
public class KeyDomain {
|
public class KeyDomain {
|
||||||
|
|
||||||
private String key;
|
private String key;
|
||||||
private String domain;
|
private String domain;
|
||||||
|
|
||||||
public KeyDomain(String key, String domain) {
|
public KeyDomain(String key, String domain) {
|
||||||
this.key = key;
|
this.key = key;
|
||||||
this.domain = domain;
|
this.domain = domain;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getKey() {
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setKey(String key) {
|
||||||
|
this.key = key;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDomain() {
|
||||||
|
return domain;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDomain(String domain) {
|
||||||
|
this.domain = domain;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
final int prime = 31;
|
||||||
|
int result = 1;
|
||||||
|
result = prime * result + ((domain == null) ? 0 : domain.hashCode());
|
||||||
|
result = prime * result + ((key == null) ? 0 : key.hashCode());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (this == obj) {
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
if (obj == null) {
|
||||||
public String getKey() {
|
return false;
|
||||||
return key;
|
|
||||||
}
|
}
|
||||||
|
if (!getClass().isAssignableFrom(obj.getClass())) {
|
||||||
public void setKey(String key) {
|
return false;
|
||||||
this.key = key;
|
|
||||||
}
|
}
|
||||||
|
KeyDomain other = (KeyDomain) obj;
|
||||||
public String getDomain() {
|
if (domain == null) {
|
||||||
return domain;
|
if (other.domain != null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else if (!domain.equals(other.domain)) {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
if (key == null) {
|
||||||
public void setDomain(String domain) {
|
if (other.key != null) {
|
||||||
this.domain = domain;
|
return false;
|
||||||
}
|
}
|
||||||
|
} else if (!key.equals(other.key)) {
|
||||||
@Override
|
return false;
|
||||||
public String toString() {
|
|
||||||
return "KeyDomain ["
|
|
||||||
+ "key=" + this.key
|
|
||||||
+ ", domain=" + this.domain
|
|
||||||
+ "]";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
final int prime = 31;
|
|
||||||
int result = 1;
|
|
||||||
result = prime * result + ((domain == null) ? 0 : domain.hashCode());
|
|
||||||
result = prime * result + ((key == null) ? 0 : key.hashCode());
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj) {
|
|
||||||
if (this == obj) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (obj == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (!getClass().isAssignableFrom(obj.getClass())) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
KeyDomain other = (KeyDomain) obj;
|
|
||||||
if (domain == null) {
|
|
||||||
if (other.domain != null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} else if (!domain.equals(other.domain)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (key == null) {
|
|
||||||
if (other.key != null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} else if (!key.equals(other.key)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "KeyDomain [" + "key=" + this.key + ", domain=" + this.domain + "]";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,136 +1,143 @@
|
||||||
package pro.taskana;
|
package pro.taskana;
|
||||||
|
|
||||||
/**
|
/** ObjectReference entity. */
|
||||||
* ObjectReference entity.
|
|
||||||
*/
|
|
||||||
public class ObjectReference {
|
public class ObjectReference {
|
||||||
|
|
||||||
private String id;
|
private String id;
|
||||||
private String company;
|
private String company;
|
||||||
private String system;
|
private String system;
|
||||||
private String systemInstance;
|
private String systemInstance;
|
||||||
private String type;
|
private String type;
|
||||||
private String value;
|
private String value;
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return id;
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCompany() {
|
||||||
|
return company;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCompany(String company) {
|
||||||
|
this.company = company;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSystem() {
|
||||||
|
return system;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSystem(String system) {
|
||||||
|
this.system = system;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSystemInstance() {
|
||||||
|
return systemInstance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSystemInstance(String systemInstance) {
|
||||||
|
this.systemInstance = systemInstance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(String type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValue(String value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
final int prime = 31;
|
||||||
|
int result = 1;
|
||||||
|
result = prime * result + ((id == null) ? 0 : id.hashCode());
|
||||||
|
result = prime * result + ((company == null) ? 0 : company.hashCode());
|
||||||
|
result = prime * result + ((system == null) ? 0 : system.hashCode());
|
||||||
|
result = prime * result + ((systemInstance == null) ? 0 : systemInstance.hashCode());
|
||||||
|
result = prime * result + ((type == null) ? 0 : type.hashCode());
|
||||||
|
result = prime * result + ((value == null) ? 0 : value.hashCode());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object other) {
|
||||||
|
if (this == other) {
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
if (other == null) {
|
||||||
public void setId(String id) {
|
return false;
|
||||||
this.id = id;
|
|
||||||
}
|
}
|
||||||
|
if (!getClass().isAssignableFrom(other.getClass())) {
|
||||||
public String getCompany() {
|
return false;
|
||||||
return company;
|
|
||||||
}
|
}
|
||||||
|
ObjectReference o = (ObjectReference) other;
|
||||||
|
|
||||||
public void setCompany(String company) {
|
if (id == null && o.id != null) {
|
||||||
this.company = company;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (id != null && !(id.equals(o.id))) {
|
||||||
public String getSystem() {
|
return false;
|
||||||
return system;
|
|
||||||
}
|
}
|
||||||
|
if (company == null && o.company != null) {
|
||||||
public void setSystem(String system) {
|
return false;
|
||||||
this.system = system;
|
|
||||||
}
|
}
|
||||||
|
if (company != null && !(company.equals(o.company))) {
|
||||||
public String getSystemInstance() {
|
return false;
|
||||||
return systemInstance;
|
|
||||||
}
|
}
|
||||||
|
if (system == null && o.system != null) {
|
||||||
public void setSystemInstance(String systemInstance) {
|
return false;
|
||||||
this.systemInstance = systemInstance;
|
|
||||||
}
|
}
|
||||||
|
if (system != null && !(system.equals(o.system))) {
|
||||||
public String getType() {
|
return false;
|
||||||
return type;
|
|
||||||
}
|
}
|
||||||
|
if (systemInstance == null && o.systemInstance != null) {
|
||||||
public void setType(String type) {
|
return false;
|
||||||
this.type = type;
|
|
||||||
}
|
}
|
||||||
|
if (systemInstance != null && !(systemInstance.equals(o.systemInstance))) {
|
||||||
public String getValue() {
|
return false;
|
||||||
return value;
|
|
||||||
}
|
}
|
||||||
|
if (type == null && o.type != null) {
|
||||||
public void setValue(String value) {
|
return false;
|
||||||
this.value = value;
|
|
||||||
}
|
}
|
||||||
|
if (type != null && !(type.equals(o.type))) {
|
||||||
@Override
|
return false;
|
||||||
public String toString() {
|
|
||||||
return "ObjectReference ["
|
|
||||||
+ "id=" + this.id + ", company="
|
|
||||||
+ this.company + ", system=" + this.system
|
|
||||||
+ ", systemInstance=" + this.systemInstance
|
|
||||||
+ ", type=" + this.type + ", value=" + this.value + "]";
|
|
||||||
}
|
}
|
||||||
|
if (value == null && o.value != null) {
|
||||||
@Override
|
return false;
|
||||||
public int hashCode() {
|
|
||||||
final int prime = 31;
|
|
||||||
int result = 1;
|
|
||||||
result = prime * result + ((id == null) ? 0 : id.hashCode());
|
|
||||||
result = prime * result + ((company == null) ? 0 : company.hashCode());
|
|
||||||
result = prime * result + ((system == null) ? 0 : system.hashCode());
|
|
||||||
result = prime * result + ((systemInstance == null) ? 0 : systemInstance.hashCode());
|
|
||||||
result = prime * result + ((type == null) ? 0 : type.hashCode());
|
|
||||||
result = prime * result + ((value == null) ? 0 : value.hashCode());
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
if (value != null && !(value.equals(o.value))) {
|
||||||
@Override
|
return false;
|
||||||
public boolean equals(Object other) {
|
|
||||||
if (this == other) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (other == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (!getClass().isAssignableFrom(other.getClass())) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
ObjectReference o = (ObjectReference) other;
|
|
||||||
|
|
||||||
if (id == null && o.id != null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (id != null && !(id.equals(o.id))) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (company == null && o.company != null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (company != null && !(company.equals(o.company))) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (system == null && o.system != null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (system != null && !(system.equals(o.system))) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (systemInstance == null && o.systemInstance != null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (systemInstance != null && !(systemInstance.equals(o.systemInstance))) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (type == null && o.type != null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (type != null && !(type.equals(o.type))) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (value == null && o.value != null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (value != null && !(value.equals(o.value))) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "ObjectReference ["
|
||||||
|
+ "id="
|
||||||
|
+ this.id
|
||||||
|
+ ", company="
|
||||||
|
+ this.company
|
||||||
|
+ ", system="
|
||||||
|
+ this.system
|
||||||
|
+ ", systemInstance="
|
||||||
|
+ this.systemInstance
|
||||||
|
+ ", type="
|
||||||
|
+ this.type
|
||||||
|
+ ", value="
|
||||||
|
+ this.value
|
||||||
|
+ "]";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,52 +1,46 @@
|
||||||
package pro.taskana;
|
package pro.taskana;
|
||||||
|
|
||||||
/**
|
/** ObjectReferenceQuery for generating dynamic sql. */
|
||||||
* ObjectReferenceQuery for generating dynamic sql.
|
public interface ObjectReferenceQuery
|
||||||
*/
|
extends BaseQuery<ObjectReference, ObjectReferenceQueryColumnName> {
|
||||||
public interface ObjectReferenceQuery extends BaseQuery<ObjectReference, ObjectReferenceQueryColumnName> {
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add your company to your query.
|
* Add your company to your query.
|
||||||
*
|
*
|
||||||
* @param companies
|
* @param companies as Strings
|
||||||
* as Strings
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
ObjectReferenceQuery companyIn(String... companies);
|
||||||
ObjectReferenceQuery companyIn(String... companies);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add your system to your query.
|
* Add your system to your query.
|
||||||
*
|
*
|
||||||
* @param systems
|
* @param systems as Strings
|
||||||
* as Strings
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
ObjectReferenceQuery systemIn(String... systems);
|
||||||
ObjectReferenceQuery systemIn(String... systems);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add your systemInstance to your query.
|
* Add your systemInstance to your query.
|
||||||
*
|
*
|
||||||
* @param systemInstances
|
* @param systemInstances as Strings
|
||||||
* as Strings
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
ObjectReferenceQuery systemInstanceIn(String... systemInstances);
|
||||||
ObjectReferenceQuery systemInstanceIn(String... systemInstances);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add your type to your query.
|
* Add your type to your query.
|
||||||
*
|
*
|
||||||
* @param types
|
* @param types as Strings
|
||||||
* as Strings
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
ObjectReferenceQuery typeIn(String... types);
|
||||||
ObjectReferenceQuery typeIn(String... types);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add your value to your query.
|
* Add your value to your query.
|
||||||
*
|
*
|
||||||
* @param values
|
* @param values as Strings
|
||||||
* as Strings
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
ObjectReferenceQuery valueIn(String... values);
|
||||||
ObjectReferenceQuery valueIn(String... values);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,26 +1,27 @@
|
||||||
package pro.taskana;
|
package pro.taskana;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enum containing the column names for @see {@link pro.taskana.mappings.QueryMapper#queryObjectReferenceColumnValues(pro.taskana.impl.ObjectReferenceQueryImpl)}.
|
* Enum containing the column names for @see {@link
|
||||||
|
* pro.taskana.mappings.QueryMapper#queryObjectReferenceColumnValues(pro.taskana.impl.ObjectReferenceQueryImpl)}.
|
||||||
*
|
*
|
||||||
* @author jsa
|
* @author jsa
|
||||||
*/
|
*/
|
||||||
public enum ObjectReferenceQueryColumnName implements QueryColumnName {
|
public enum ObjectReferenceQueryColumnName implements QueryColumnName {
|
||||||
ID("id"),
|
ID("id"),
|
||||||
COMPANY("company"),
|
COMPANY("company"),
|
||||||
SYSTEM("system"),
|
SYSTEM("system"),
|
||||||
SYSTEM_INSTANCE("system_instance"),
|
SYSTEM_INSTANCE("system_instance"),
|
||||||
TYPE("type"),
|
TYPE("type"),
|
||||||
VALUE("value");
|
VALUE("value");
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
ObjectReferenceQueryColumnName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
ObjectReferenceQueryColumnName(String name) {
|
||||||
public String toString() {
|
this.name = name;
|
||||||
return name;
|
}
|
||||||
}
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,5 +5,4 @@ package pro.taskana;
|
||||||
*
|
*
|
||||||
* @author jsa
|
* @author jsa
|
||||||
*/
|
*/
|
||||||
public interface QueryColumnName {
|
public interface QueryColumnName {}
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -6,376 +6,357 @@ import java.util.Map;
|
||||||
|
|
||||||
import pro.taskana.exceptions.InvalidArgumentException;
|
import pro.taskana.exceptions.InvalidArgumentException;
|
||||||
|
|
||||||
/**
|
/** task-Interface to specify attribute interactions. */
|
||||||
* task-Interface to specify attribute interactions.
|
|
||||||
*/
|
|
||||||
public interface Task {
|
public interface Task {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the current id of the task.
|
* The key that is used to supply Callback_state within the CallbackInfo map. The Callback_state
|
||||||
*
|
* is used predominantly by the taskana adapter. It controls synchronization between taskana and
|
||||||
* @return taskId
|
* the external system.
|
||||||
*/
|
*/
|
||||||
String getId();
|
String CALLBACK_STATE = "callbackState";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the external id of the task. This Id can be used to correlate the task to a task in an external
|
* Returns the current id of the task.
|
||||||
* system and to enforce idempotency of task creation. If not set by the client, it will be set by taskana.
|
*
|
||||||
*
|
* @return taskId
|
||||||
* @return external Id
|
*/
|
||||||
*/
|
String getId();
|
||||||
String getExternalId();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the external Id. It can be used to correlate the task to a task in an external system.
|
* Returns the external id of the task. This Id can be used to correlate the task to a task in an
|
||||||
* The external Id is enforced to be unique. An attempt to create a task with
|
* external system and to enforce idempotency of task creation. If not set by the client, it will
|
||||||
* an existing external Id will be rejected. So, this Id can be used to enforce idempotency of task creation.
|
* be set by taskana.
|
||||||
* The externalId can only be set before the task is persisted. Taskana rejects attempts to modify externalId.
|
*
|
||||||
*
|
* @return external Id
|
||||||
* @param externalId the external Id
|
*/
|
||||||
*
|
String getExternalId();
|
||||||
*/
|
|
||||||
void setExternalId(String externalId);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the UserId of the task-creator.
|
* Sets the external Id. It can be used to correlate the task to a task in an external system. The
|
||||||
*
|
* external Id is enforced to be unique. An attempt to create a task with an existing external Id
|
||||||
* @return creator
|
* will be rejected. So, this Id can be used to enforce idempotency of task creation. The
|
||||||
*/
|
* externalId can only be set before the task is persisted. Taskana rejects attempts to modify
|
||||||
String getCreator();
|
* externalId.
|
||||||
|
*
|
||||||
|
* @param externalId the external Id
|
||||||
|
*/
|
||||||
|
void setExternalId(String externalId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the time when the task was {@link TaskState#READY}.
|
* Gets the UserId of the task-creator.
|
||||||
*
|
*
|
||||||
* @return created as exact {@link Instant}
|
* @return creator
|
||||||
*/
|
*/
|
||||||
Instant getCreated();
|
String getCreator();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the time when the task was set to {@link TaskState#CLAIMED} by/to a user.
|
* Returns the time when the task was {@link TaskState#READY}.
|
||||||
*
|
*
|
||||||
* @return claimed as exact {@link Instant}
|
* @return created as exact {@link Instant}
|
||||||
*/
|
*/
|
||||||
Instant getClaimed();
|
Instant getCreated();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the time when the task was set into {@link TaskState#COMPLETED}.
|
* Returns the time when the task was set to {@link TaskState#CLAIMED} by/to a user.
|
||||||
*
|
*
|
||||||
* @return completed as exact {@link Instant}
|
* @return claimed as exact {@link Instant}
|
||||||
*/
|
*/
|
||||||
Instant getCompleted();
|
Instant getClaimed();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the time when the task was modified the last time.
|
* Returns the time when the task was set into {@link TaskState#COMPLETED}.
|
||||||
*
|
*
|
||||||
* @return modified as exact {@link Instant}
|
* @return completed as exact {@link Instant}
|
||||||
*/
|
*/
|
||||||
Instant getModified();
|
Instant getCompleted();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the time when the work on this task was planned to be started.
|
* Returns the time when the task was modified the last time.
|
||||||
*
|
*
|
||||||
* @return planned as exact {@link Instant}
|
* @return modified as exact {@link Instant}
|
||||||
*/
|
*/
|
||||||
Instant getPlanned();
|
Instant getModified();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the time when the work on this task should be started.
|
* Returns the time when the work on this task was planned to be started.
|
||||||
*
|
*
|
||||||
* @param planned
|
* @return planned as exact {@link Instant}
|
||||||
* as exact {@link Instant}
|
*/
|
||||||
*/
|
Instant getPlanned();
|
||||||
void setPlanned(Instant planned);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the time when this task should be finished.
|
* Sets the time when the work on this task should be started.
|
||||||
*
|
*
|
||||||
* @return due as exact {@link Instant}
|
* @param planned as exact {@link Instant}
|
||||||
*/
|
*/
|
||||||
Instant getDue();
|
void setPlanned(Instant planned);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the time when the work on this task should be finished.
|
* Returns the time when this task should be finished.
|
||||||
*
|
*
|
||||||
* @param due
|
* @return due as exact {@link Instant}
|
||||||
* as exact {@link Instant}
|
*/
|
||||||
*/
|
Instant getDue();
|
||||||
void setDue(Instant due);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the name of the current task.
|
* Sets the time when the work on this task should be finished.
|
||||||
*
|
*
|
||||||
* @return name of the task
|
* @param due as exact {@link Instant}
|
||||||
*/
|
*/
|
||||||
String getName();
|
void setDue(Instant due);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the name of the current task.
|
* Return the name of the current task.
|
||||||
*
|
*
|
||||||
* @param name
|
* @return name of the task
|
||||||
* the name of the task
|
*/
|
||||||
*/
|
String getName();
|
||||||
void setName(String name);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the task-description.
|
* Sets the name of the current task.
|
||||||
*
|
*
|
||||||
* @return description of a task
|
* @param name the name of the task
|
||||||
*/
|
*/
|
||||||
String getDescription();
|
void setName(String name);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the description of the task.
|
* Return the task-description.
|
||||||
*
|
*
|
||||||
* @param description
|
* @return description of a task
|
||||||
* the description of the task
|
*/
|
||||||
*/
|
String getDescription();
|
||||||
void setDescription(String description);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the numeric priority of a task.
|
* Sets the description of the task.
|
||||||
*
|
*
|
||||||
* @return priority of the task
|
* @param description the description of the task
|
||||||
*/
|
*/
|
||||||
int getPriority();
|
void setDescription(String description);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the current {@link TaskState} of the task.
|
* Returns the numeric priority of a task.
|
||||||
*
|
*
|
||||||
* @return taskState
|
* @return priority of the task
|
||||||
*/
|
*/
|
||||||
TaskState getState();
|
int getPriority();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the {@link ClassificationSummary} of the task.
|
* Returns the current {@link TaskState} of the task.
|
||||||
*
|
*
|
||||||
* @return classification summary for the task
|
* @return taskState
|
||||||
*/
|
*/
|
||||||
ClassificationSummary getClassificationSummary();
|
TaskState getState();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the Classification key that - together with the Domain from this task's work basket - selects the
|
* Returns the {@link ClassificationSummary} of the task.
|
||||||
* appropriate {@link Classification} for this task.
|
*
|
||||||
*
|
* @return classification summary for the task
|
||||||
* @param classificationKey
|
*/
|
||||||
* the classification key for the task
|
ClassificationSummary getClassificationSummary();
|
||||||
*/
|
|
||||||
void setClassificationKey(String classificationKey);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the key of the Workbasket where the task is stored in.
|
* Sets the Classification key that - together with the Domain from this task's work basket -
|
||||||
*
|
* selects the appropriate {@link Classification} for this task.
|
||||||
* @return workbasketKey
|
*
|
||||||
*/
|
* @param classificationKey the classification key for the task
|
||||||
String getWorkbasketKey();
|
*/
|
||||||
|
void setClassificationKey(String classificationKey);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the the Summary of the workbasket where the task is stored in.
|
* Returns the key of the Workbasket where the task is stored in.
|
||||||
*
|
*
|
||||||
* @return workbasketSummary
|
* @return workbasketKey
|
||||||
*/
|
*/
|
||||||
WorkbasketSummary getWorkbasketSummary();
|
String getWorkbasketKey();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the Domain, to which the Task belongs at this moment.
|
* Returns the the Summary of the workbasket where the task is stored in.
|
||||||
*
|
*
|
||||||
* @return domain the current domain of the task
|
* @return workbasketSummary
|
||||||
*/
|
*/
|
||||||
String getDomain();
|
WorkbasketSummary getWorkbasketSummary();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the businessProcessId of a task.
|
* Returns the Domain, to which the Task belongs at this moment.
|
||||||
*
|
*
|
||||||
* @return businessProcessId Gets the business process id the task belongs to.
|
* @return domain the current domain of the task
|
||||||
*/
|
*/
|
||||||
String getBusinessProcessId();
|
String getDomain();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the external business process id.
|
* Returns the businessProcessId of a task.
|
||||||
*
|
*
|
||||||
* @param businessProcessId
|
* @return businessProcessId Gets the business process id the task belongs to.
|
||||||
* Sets the business process id the task belongs to.
|
*/
|
||||||
*/
|
String getBusinessProcessId();
|
||||||
void setBusinessProcessId(String businessProcessId);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the parentBusinessProcessId of a task.
|
* Sets the external business process id.
|
||||||
*
|
*
|
||||||
* @return parentBusinessProcessId Gets the parent business process id the task belongs to
|
* @param businessProcessId Sets the business process id the task belongs to.
|
||||||
*/
|
*/
|
||||||
String getParentBusinessProcessId();
|
void setBusinessProcessId(String businessProcessId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the parent business process id to group associated processes.
|
* Returns the parentBusinessProcessId of a task.
|
||||||
*
|
*
|
||||||
* @param parentBusinessProcessId
|
* @return parentBusinessProcessId Gets the parent business process id the task belongs to
|
||||||
* Sets the parent business process id the task belongs to
|
*/
|
||||||
*/
|
String getParentBusinessProcessId();
|
||||||
void setParentBusinessProcessId(String parentBusinessProcessId);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the id of the task-owner.
|
* Sets the parent business process id to group associated processes.
|
||||||
*
|
*
|
||||||
* @return taskOwnerId
|
* @param parentBusinessProcessId Sets the parent business process id the task belongs to
|
||||||
*/
|
*/
|
||||||
String getOwner();
|
void setParentBusinessProcessId(String parentBusinessProcessId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the ownerId of this task.
|
* Return the id of the task-owner.
|
||||||
*
|
*
|
||||||
* @param taskOwnerId
|
* @return taskOwnerId
|
||||||
* the user id of the task's owner
|
*/
|
||||||
*/
|
String getOwner();
|
||||||
void setOwner(String taskOwnerId);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the {@link ObjectReference primaryObjectReference} of the task.
|
* Sets the ownerId of this task.
|
||||||
*
|
*
|
||||||
* @return primaryObjRef to task main-subject
|
* @param taskOwnerId the user id of the task's owner
|
||||||
*/
|
*/
|
||||||
ObjectReference getPrimaryObjRef();
|
void setOwner(String taskOwnerId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the {@link ObjectReference primaryObjectReference} of the task.
|
* Returns the {@link ObjectReference primaryObjectReference} of the task.
|
||||||
*
|
*
|
||||||
* @param primaryObjRef
|
* @return primaryObjRef to task main-subject
|
||||||
* to task main-subject
|
*/
|
||||||
*/
|
ObjectReference getPrimaryObjRef();
|
||||||
void setPrimaryObjRef(ObjectReference primaryObjRef);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the isRead-flag, which flags a task as viewed at least one time.
|
* Sets the {@link ObjectReference primaryObjectReference} of the task.
|
||||||
*
|
*
|
||||||
* @return isRead-flag
|
* @param primaryObjRef to task main-subject
|
||||||
*/
|
*/
|
||||||
boolean isRead();
|
void setPrimaryObjRef(ObjectReference primaryObjRef);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the isTransferred-flag, which flags a task as transfered into an other workbasket.
|
* Return the isRead-flag, which flags a task as viewed at least one time.
|
||||||
*
|
*
|
||||||
* @return isTransferred-flag
|
* @return isRead-flag
|
||||||
*/
|
*/
|
||||||
boolean isTransferred();
|
boolean isRead();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a Map of custom Attributes.
|
* Return the isTransferred-flag, which flags a task as transfered into an other workbasket.
|
||||||
*
|
*
|
||||||
* @return customAttributes as {@link Map}
|
* @return isTransferred-flag
|
||||||
*/
|
*/
|
||||||
Map<String, String> getCustomAttributes();
|
boolean isTransferred();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets a Map of custom Attributes.
|
* Returns a Map of custom Attributes.
|
||||||
*
|
*
|
||||||
* @param customAttributes
|
* @return customAttributes as {@link Map}
|
||||||
* a {@link Map} that contains the custom attributes
|
*/
|
||||||
*/
|
Map<String, String> getCustomAttributes();
|
||||||
void setCustomAttributes(Map<String, String> customAttributes);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a Map of Callback info.
|
* Sets a Map of custom Attributes.
|
||||||
*
|
*
|
||||||
* @return callbackInfo as {@link Map}
|
* @param customAttributes a {@link Map} that contains the custom attributes
|
||||||
*/
|
*/
|
||||||
Map<String, String> getCallbackInfo();
|
void setCustomAttributes(Map<String, String> customAttributes);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets a Map of callback info.
|
* Returns a Map of Callback info.
|
||||||
*
|
*
|
||||||
* @param callbackInfo
|
* @return callbackInfo as {@link Map}
|
||||||
* a {@link Map} that contains the callback info
|
*/
|
||||||
*/
|
Map<String, String> getCallbackInfo();
|
||||||
void setCallbackInfo(Map<String, String> callbackInfo);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the value for custom Attribute number num.
|
* Sets a Map of callback info.
|
||||||
*
|
*
|
||||||
* @param num
|
* @param callbackInfo a {@link Map} that contains the callback info
|
||||||
* identifies which custom attribute is requested. Taskana concatenates "custom_" with num and the
|
*/
|
||||||
* resulting String must match the name of the database column that contains the custom attribute. Valid
|
void setCallbackInfo(Map<String, String> callbackInfo);
|
||||||
* values are "1", "2" .. "16"
|
|
||||||
* @return the value of custom attribute number num
|
|
||||||
* @throws InvalidArgumentException
|
|
||||||
* if num has not a value of "1", "2" ... "16"
|
|
||||||
*/
|
|
||||||
String getCustomAttribute(String num) throws InvalidArgumentException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the value for custom Attribute number num.
|
* Return the value for custom Attribute number num.
|
||||||
*
|
*
|
||||||
* @param num
|
* @param num identifies which custom attribute is requested. Taskana concatenates "custom_" with
|
||||||
* identifies which custom attribute is to be set. Taskana concatenates "custom_" with num and the
|
* num and the resulting String must match the name of the database column that contains the
|
||||||
* resulting String must match the name of the database column that contains the custom attribute. Valid
|
* custom attribute. Valid values are "1", "2" .. "16"
|
||||||
* values are "1", "2" .. "16"
|
* @return the value of custom attribute number num
|
||||||
* @param value
|
* @throws InvalidArgumentException if num has not a value of "1", "2" ... "16"
|
||||||
* the value of the custom attribute to be set
|
*/
|
||||||
* @throws InvalidArgumentException
|
String getCustomAttribute(String num) throws InvalidArgumentException;
|
||||||
* if num has not a value of "1", "2" ... "16"
|
|
||||||
*/
|
|
||||||
void setCustomAttribute(String num, String value) throws InvalidArgumentException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add an attachment.<br>
|
* Sets the value for custom Attribute number num.
|
||||||
* NULL will be ignored and an attachment with the same ID will be replaced by the newer one.<br>
|
*
|
||||||
*
|
* @param num identifies which custom attribute is to be set. Taskana concatenates "custom_" with
|
||||||
* @param attachment
|
* num and the resulting String must match the name of the database column that contains the
|
||||||
* the {@link Attachment attachment} to be added to the task
|
* custom attribute. Valid values are "1", "2" .. "16"
|
||||||
*/
|
* @param value the value of the custom attribute to be set
|
||||||
void addAttachment(Attachment attachment);
|
* @throws InvalidArgumentException if num has not a value of "1", "2" ... "16"
|
||||||
|
*/
|
||||||
|
void setCustomAttribute(String num, String value) throws InvalidArgumentException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the attachments for this task. <br>
|
* Add an attachment.<br>
|
||||||
* Do not use List.add()/addAll() for adding Elements, because it can cause redundant data. Use addAttachment().
|
* NULL will be ignored and an attachment with the same ID will be replaced by the newer one.<br>
|
||||||
* Clear() and remove() can be used, because it´s a controllable change.
|
*
|
||||||
*
|
* @param attachment the {@link Attachment attachment} to be added to the task
|
||||||
* @return the {@link List list} of {@link Attachment attachments} for this task
|
*/
|
||||||
*/
|
void addAttachment(Attachment attachment);
|
||||||
List<Attachment> getAttachments();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the custom note for this Task.
|
* Return the attachments for this task. <br>
|
||||||
*
|
* Do not use List.add()/addAll() for adding Elements, because it can cause redundant data. Use
|
||||||
* @return the custom note for this TAsk
|
* addAttachment(). Clear() and remove() can be used, because it´s a controllable change.
|
||||||
*/
|
*
|
||||||
String getNote();
|
* @return the {@link List list} of {@link Attachment attachments} for this task
|
||||||
|
*/
|
||||||
|
List<Attachment> getAttachments();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets/Changing the custom note for this Task.
|
* Returns the custom note for this Task.
|
||||||
*
|
*
|
||||||
* @param note
|
* @return the custom note for this TAsk
|
||||||
* the custom note for this Task.
|
*/
|
||||||
*/
|
String getNote();
|
||||||
void setNote(String note);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a summary of the current Task.
|
* Sets/Changing the custom note for this Task.
|
||||||
*
|
*
|
||||||
* @return the TaskSummary object for the current task
|
* @param note the custom note for this Task.
|
||||||
*/
|
*/
|
||||||
TaskSummary asSummary();
|
void setNote(String note);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes an attachment of the current task locally, when the ID is represented and does return the removed
|
* Return a summary of the current Task.
|
||||||
* attachment or null if there was no match.<br>
|
*
|
||||||
* The changed Task need to be updated calling the {@link TaskService#updateTask(Task)}.
|
* @return the TaskSummary object for the current task
|
||||||
*
|
*/
|
||||||
* @param attachmentID
|
TaskSummary asSummary();
|
||||||
* ID of the attachment which should be removed.
|
|
||||||
* @return attachment which will be removed after updating OR null if there was no matching attachment
|
|
||||||
*/
|
|
||||||
Attachment removeAttachment(String attachmentID);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the category of the current classification.
|
* Removes an attachment of the current task locally, when the ID is represented and does return
|
||||||
*
|
* the removed attachment or null if there was no match.<br>
|
||||||
* @return classificationCategory
|
* The changed Task need to be updated calling the {@link TaskService#updateTask(Task)}.
|
||||||
*/
|
*
|
||||||
String getClassificationCategory();
|
* @param attachmentID ID of the attachment which should be removed.
|
||||||
|
* @return attachment which will be removed after updating OR null if there was no matching
|
||||||
|
* attachment
|
||||||
|
*/
|
||||||
|
Attachment removeAttachment(String attachmentID);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The key that is used to supply Callback_state within the CallbackInfo map.
|
* Returns the category of the current classification.
|
||||||
* The Callback_state is used predominantly by the taskana adapter. It controls synchronization between taskana and the external system.
|
*
|
||||||
*
|
* @return classificationCategory
|
||||||
*/
|
*/
|
||||||
String CALLBACK_STATE = "callbackState";
|
String getClassificationCategory();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,62 +3,58 @@ package pro.taskana;
|
||||||
import pro.taskana.report.CategoryReport;
|
import pro.taskana.report.CategoryReport;
|
||||||
import pro.taskana.report.ClassificationReport;
|
import pro.taskana.report.ClassificationReport;
|
||||||
import pro.taskana.report.CustomFieldValueReport;
|
import pro.taskana.report.CustomFieldValueReport;
|
||||||
import pro.taskana.report.TimestampReport;
|
|
||||||
import pro.taskana.report.TaskStatusReport;
|
import pro.taskana.report.TaskStatusReport;
|
||||||
|
import pro.taskana.report.TimestampReport;
|
||||||
import pro.taskana.report.WorkbasketReport;
|
import pro.taskana.report.WorkbasketReport;
|
||||||
|
|
||||||
/**
|
/** The Task Monitor Service manages operations on tasks regarding the monitoring. */
|
||||||
* The Task Monitor Service manages operations on tasks regarding the monitoring.
|
|
||||||
*/
|
|
||||||
public interface TaskMonitorService {
|
public interface TaskMonitorService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides a {@link WorkbasketReport.Builder} for creating a {@link WorkbasketReport}, list the task ids of this report
|
* Provides a {@link WorkbasketReport.Builder} for creating a {@link WorkbasketReport}, list the
|
||||||
* and list the values of an entered custom attribute.
|
* task ids of this report and list the values of an entered custom attribute.
|
||||||
*
|
*
|
||||||
* @return a {@link WorkbasketReport.Builder}
|
* @return a {@link WorkbasketReport.Builder}
|
||||||
*/
|
*/
|
||||||
WorkbasketReport.Builder createWorkbasketReportBuilder();
|
WorkbasketReport.Builder createWorkbasketReportBuilder();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides a {@link CategoryReport.Builder} for creating a {@link CategoryReport}, list the task ids of this report and list
|
* Provides a {@link CategoryReport.Builder} for creating a {@link CategoryReport}, list the task
|
||||||
* the values of an entered custom attribute.
|
* ids of this report and list the values of an entered custom attribute.
|
||||||
*
|
*
|
||||||
* @return a {@link CategoryReport.Builder}
|
* @return a {@link CategoryReport.Builder}
|
||||||
*/
|
*/
|
||||||
CategoryReport.Builder createCategoryReportBuilder();
|
CategoryReport.Builder createCategoryReportBuilder();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides a {@link ClassificationReport.Builder} for creating a {@link ClassificationReport} or a
|
* Provides a {@link ClassificationReport.Builder} for creating a {@link ClassificationReport} or
|
||||||
* DetailedClassificationReport, list the task ids of these reports and list the values of an entered custom
|
* a DetailedClassificationReport, list the task ids of these reports and list the values of an
|
||||||
* attribute.
|
* entered custom attribute.
|
||||||
*
|
*
|
||||||
* @return a {@link ClassificationReport.Builder}
|
* @return a {@link ClassificationReport.Builder}
|
||||||
*/
|
*/
|
||||||
ClassificationReport.Builder createClassificationReportBuilder();
|
ClassificationReport.Builder createClassificationReportBuilder();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides a {@link CustomFieldValueReport.Builder} for creating a {@link CustomFieldValueReport} and list the values of
|
* Provides a {@link CustomFieldValueReport.Builder} for creating a {@link CustomFieldValueReport}
|
||||||
* an entered custom attribute.
|
* and list the values of an entered custom attribute.
|
||||||
*
|
*
|
||||||
* @param customField
|
* @param customField the customField whose values should appear in the report
|
||||||
* the customField whose values should appear in the report
|
* @return a {@link CustomFieldValueReport.Builder}
|
||||||
* @return a {@link CustomFieldValueReport.Builder}
|
*/
|
||||||
*/
|
CustomFieldValueReport.Builder createCustomFieldValueReportBuilder(CustomField customField);
|
||||||
CustomFieldValueReport.Builder createCustomFieldValueReportBuilder(CustomField customField);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides a {@link TaskStatusReport.Builder} for creating a {@link TaskStatusReport}.
|
* Provides a {@link TaskStatusReport.Builder} for creating a {@link TaskStatusReport}.
|
||||||
*
|
*
|
||||||
* @return a {@link TaskStatusReport.Builder}
|
* @return a {@link TaskStatusReport.Builder}
|
||||||
*/
|
*/
|
||||||
TaskStatusReport.Builder createTaskStatusReportBuilder();
|
TaskStatusReport.Builder createTaskStatusReportBuilder();
|
||||||
|
|
||||||
/**
|
|
||||||
* Provides a {@link TimestampReport.Builder} for creating a {@link TimestampReport}.
|
|
||||||
*
|
|
||||||
* @return a {@link TimestampReport.Builder}
|
|
||||||
*/
|
|
||||||
TimestampReport.Builder createTimestampReportBuilder();
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides a {@link TimestampReport.Builder} for creating a {@link TimestampReport}.
|
||||||
|
*
|
||||||
|
* @return a {@link TimestampReport.Builder}
|
||||||
|
*/
|
||||||
|
TimestampReport.Builder createTimestampReportBuilder();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,75 +1,77 @@
|
||||||
package pro.taskana;
|
package pro.taskana;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enum containing the column names for @see pro.taskana.mappings.QueryMapper#queryTaskColumnValues(pro.taskana.impl.TaskQueryImpl).
|
* Enum containing the column names for @see
|
||||||
|
* pro.taskana.mappings.QueryMapper#queryTaskColumnValues(pro.taskana.impl.TaskQueryImpl).
|
||||||
*
|
*
|
||||||
* @author jsa
|
* @author jsa
|
||||||
*/
|
*/
|
||||||
public enum TaskQueryColumnName implements QueryColumnName {
|
public enum TaskQueryColumnName implements QueryColumnName {
|
||||||
ID("t.id"),
|
ID("t.id"),
|
||||||
EXTERNAL_ID("t.external_id"),
|
EXTERNAL_ID("t.external_id"),
|
||||||
CREATED("t.created"),
|
CREATED("t.created"),
|
||||||
CLAIMED("t.claimed"),
|
CLAIMED("t.claimed"),
|
||||||
COMPLETED("t.completed"),
|
COMPLETED("t.completed"),
|
||||||
MODIFIED("t.modified"),
|
MODIFIED("t.modified"),
|
||||||
PLANNED("t.planned"),
|
PLANNED("t.planned"),
|
||||||
DUE("t.due"),
|
DUE("t.due"),
|
||||||
NAME("t.name"),
|
NAME("t.name"),
|
||||||
CREATOR("t.creator"),
|
CREATOR("t.creator"),
|
||||||
DESCRIPTION("t.description"),
|
DESCRIPTION("t.description"),
|
||||||
NOTE("t.note"),
|
NOTE("t.note"),
|
||||||
PRIORITY("t.priority"),
|
PRIORITY("t.priority"),
|
||||||
STATE("t.state"),
|
STATE("t.state"),
|
||||||
CLASSIFICATION_CATEGORY("t.classification_category"),
|
CLASSIFICATION_CATEGORY("t.classification_category"),
|
||||||
CLASSIFICATION_KEY("t.classification_key"),
|
CLASSIFICATION_KEY("t.classification_key"),
|
||||||
CLASSIFICATION_ID("t.classification_id"),
|
CLASSIFICATION_ID("t.classification_id"),
|
||||||
CLASSIFICATION_NAME("c.name"),
|
CLASSIFICATION_NAME("c.name"),
|
||||||
WORKBASKET_ID("t.workbasket_id"),
|
WORKBASKET_ID("t.workbasket_id"),
|
||||||
WORKBASKET_KEY("t.workbasket_key"),
|
WORKBASKET_KEY("t.workbasket_key"),
|
||||||
DOMAIN("t.domain"),
|
DOMAIN("t.domain"),
|
||||||
BUSINESS_PROCESS_ID("t.business_process_id"),
|
BUSINESS_PROCESS_ID("t.business_process_id"),
|
||||||
PARENT_BUSINESS_PROCESS_ID("t.parent_business_process_id"),
|
PARENT_BUSINESS_PROCESS_ID("t.parent_business_process_id"),
|
||||||
OWNER("t.owner"),
|
OWNER("t.owner"),
|
||||||
POR_COMPANY("t.por_company"),
|
POR_COMPANY("t.por_company"),
|
||||||
POR_SYSTEM("t.por_system"),
|
POR_SYSTEM("t.por_system"),
|
||||||
POR_INSTANCE("t.por_instance"),
|
POR_INSTANCE("t.por_instance"),
|
||||||
POR_TYPE("t.por_type"),
|
POR_TYPE("t.por_type"),
|
||||||
POR_VALUE("t.por_value"),
|
POR_VALUE("t.por_value"),
|
||||||
IS_READ("t.is_read"),
|
IS_READ("t.is_read"),
|
||||||
IS_TRANSFERRED("t.is_transferred"),
|
IS_TRANSFERRED("t.is_transferred"),
|
||||||
CUSTOM_1("t.custom_1"),
|
CUSTOM_1("t.custom_1"),
|
||||||
CUSTOM_2("t.custom_2"),
|
CUSTOM_2("t.custom_2"),
|
||||||
CUSTOM_3("t.custom_3"),
|
CUSTOM_3("t.custom_3"),
|
||||||
CUSTOM_4("t.custom_4"),
|
CUSTOM_4("t.custom_4"),
|
||||||
CUSTOM_5("t.custom_5"),
|
CUSTOM_5("t.custom_5"),
|
||||||
CUSTOM_6("t.custom_6"),
|
CUSTOM_6("t.custom_6"),
|
||||||
CUSTOM_7("t.custom_7"),
|
CUSTOM_7("t.custom_7"),
|
||||||
CUSTOM_8("t.custom_8"),
|
CUSTOM_8("t.custom_8"),
|
||||||
CUSTOM_9("t.custom_9"),
|
CUSTOM_9("t.custom_9"),
|
||||||
CUSTOM_10("t.custom_10"),
|
CUSTOM_10("t.custom_10"),
|
||||||
CUSTOM_11("t.custom_11"),
|
CUSTOM_11("t.custom_11"),
|
||||||
CUSTOM_12("t.custom_12"),
|
CUSTOM_12("t.custom_12"),
|
||||||
CUSTOM_13("t.custom_13"),
|
CUSTOM_13("t.custom_13"),
|
||||||
CUSTOM_14("t.custom_14"),
|
CUSTOM_14("t.custom_14"),
|
||||||
CUSTOM_15("t.custom_15"),
|
CUSTOM_15("t.custom_15"),
|
||||||
CUSTOM_16("t.custom_16"),
|
CUSTOM_16("t.custom_16"),
|
||||||
A_CLASSIFICATION_KEY("a.classification_key"),
|
A_CLASSIFICATION_KEY("a.classification_key"),
|
||||||
A_CLASSIFICATION_ID("a.classification_id"),
|
A_CLASSIFICATION_ID("a.classification_id"),
|
||||||
A_CLASSIFICATION_NAME("ac.name"),
|
A_CLASSIFICATION_NAME("ac.name"),
|
||||||
A_CHANNEL("a.channel"),
|
A_CHANNEL("a.channel"),
|
||||||
A_REF_VALUE("a.ref_value");
|
A_REF_VALUE("a.ref_value");
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
TaskQueryColumnName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
TaskQueryColumnName(String name) {
|
||||||
public String toString() {
|
this.name = name;
|
||||||
return name;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isAttachmentColumn() {
|
public boolean isAttachmentColumn() {
|
||||||
return this.name().startsWith("A_");
|
return this.name().startsWith("A_");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,418 +15,356 @@ import pro.taskana.exceptions.TaskNotFoundException;
|
||||||
import pro.taskana.exceptions.TaskanaException;
|
import pro.taskana.exceptions.TaskanaException;
|
||||||
import pro.taskana.exceptions.WorkbasketNotFoundException;
|
import pro.taskana.exceptions.WorkbasketNotFoundException;
|
||||||
|
|
||||||
/**
|
/** The Task Service manages all operations on tasks. */
|
||||||
* The Task Service manages all operations on tasks.
|
|
||||||
*/
|
|
||||||
public interface TaskService {
|
public interface TaskService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Claim an existing task for the current user.
|
* Claim an existing task for the current user.
|
||||||
*
|
*
|
||||||
* @param taskId
|
* @param taskId the id of the task to be claimed
|
||||||
* the id of the task to be claimed
|
* @return claimed Task
|
||||||
* @return claimed Task
|
* @throws TaskNotFoundException if the task with taskId was not found
|
||||||
* @throws TaskNotFoundException
|
* @throws InvalidStateException if the state of the task with taskId is not READY
|
||||||
* if the task with taskId was not found
|
* @throws InvalidOwnerException if the task with taskId is claimed by some else
|
||||||
* @throws InvalidStateException
|
* @throws NotAuthorizedException if the current user has no read permission for the workbasket
|
||||||
* if the state of the task with taskId is not READY
|
* the task is in
|
||||||
* @throws InvalidOwnerException
|
*/
|
||||||
* if the task with taskId is claimed by some else
|
Task claim(String taskId)
|
||||||
* @throws NotAuthorizedException
|
throws TaskNotFoundException, InvalidStateException, InvalidOwnerException,
|
||||||
* if the current user has no read permission for the workbasket the task is in
|
NotAuthorizedException;
|
||||||
*/
|
|
||||||
Task claim(String taskId)
|
|
||||||
throws TaskNotFoundException, InvalidStateException, InvalidOwnerException, NotAuthorizedException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Claim an existing task for the current user even if it is already claimed by someone else.
|
* Claim an existing task for the current user even if it is already claimed by someone else.
|
||||||
*
|
*
|
||||||
* @param taskId
|
* @param taskId the id of the task to be claimed
|
||||||
* the id of the task to be claimed
|
* @return claimed Task
|
||||||
* @return claimed Task
|
* @throws TaskNotFoundException if the task with taskId was not found
|
||||||
* @throws TaskNotFoundException
|
* @throws InvalidStateException if the state of the task with taskId is not READY
|
||||||
* if the task with taskId was not found
|
* @throws InvalidOwnerException if the task with taskId is claimed by someone else
|
||||||
* @throws InvalidStateException
|
* @throws NotAuthorizedException if the current user has no read permission for the workbasket
|
||||||
* if the state of the task with taskId is not READY
|
* the task is in
|
||||||
* @throws InvalidOwnerException
|
*/
|
||||||
* if the task with taskId is claimed by someone else
|
Task forceClaim(String taskId)
|
||||||
* @throws NotAuthorizedException
|
throws TaskNotFoundException, InvalidStateException, InvalidOwnerException,
|
||||||
* if the current user has no read permission for the workbasket the task is in
|
NotAuthorizedException;
|
||||||
*/
|
|
||||||
Task forceClaim(String taskId)
|
|
||||||
throws TaskNotFoundException, InvalidStateException, InvalidOwnerException, NotAuthorizedException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cancel the claim of an existing task if it was claimed by the current user before.
|
* Cancel the claim of an existing task if it was claimed by the current user before.
|
||||||
*
|
*
|
||||||
* @param taskId
|
* @param taskId id of the task which should be unclaimed.
|
||||||
* id of the task which should be unclaimed.
|
* @return updated unclaimed task
|
||||||
* @return updated unclaimed task
|
* @throws TaskNotFoundException if the task can´t be found or does not exist
|
||||||
* @throws TaskNotFoundException
|
* @throws InvalidStateException when the task is already completed.
|
||||||
* if the task can´t be found or does not exist
|
* @throws InvalidOwnerException when the task is claimed by another user.
|
||||||
* @throws InvalidStateException
|
* @throws NotAuthorizedException if the current user has no read permission for the workbasket
|
||||||
* when the task is already completed.
|
* the task is in
|
||||||
* @throws InvalidOwnerException
|
*/
|
||||||
* when the task is claimed by another user.
|
Task cancelClaim(String taskId)
|
||||||
* @throws NotAuthorizedException
|
throws TaskNotFoundException, InvalidStateException, InvalidOwnerException,
|
||||||
* if the current user has no read permission for the workbasket the task is in
|
NotAuthorizedException;
|
||||||
*/
|
|
||||||
Task cancelClaim(String taskId)
|
|
||||||
throws TaskNotFoundException, InvalidStateException, InvalidOwnerException, NotAuthorizedException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cancel the claim of an existing task even if it was claimed by another user.
|
* Cancel the claim of an existing task even if it was claimed by another user.
|
||||||
*
|
*
|
||||||
* @param taskId
|
* @param taskId id of the task which should be unclaimed.
|
||||||
* id of the task which should be unclaimed.
|
* @return updated unclaimed task
|
||||||
* @return updated unclaimed task
|
* @throws TaskNotFoundException if the task can´t be found or does not exist
|
||||||
* @throws TaskNotFoundException
|
* @throws InvalidStateException when the task is already completed.
|
||||||
* if the task can´t be found or does not exist
|
* @throws InvalidOwnerException when forceCancel is false and the task is claimed by another
|
||||||
* @throws InvalidStateException
|
* user.
|
||||||
* when the task is already completed.
|
* @throws NotAuthorizedException if the current user has no read permission for the workbasket
|
||||||
* @throws InvalidOwnerException
|
* the task is in
|
||||||
* when forceCancel is false and the task is claimed by another user.
|
*/
|
||||||
* @throws NotAuthorizedException
|
Task forceCancelClaim(String taskId)
|
||||||
* if the current user has no read permission for the workbasket the task is in
|
throws TaskNotFoundException, InvalidStateException, InvalidOwnerException,
|
||||||
*/
|
NotAuthorizedException;
|
||||||
Task forceCancelClaim(String taskId)
|
|
||||||
throws TaskNotFoundException, InvalidStateException, InvalidOwnerException, NotAuthorizedException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Complete a claimed Task as owner/admin and update State and Timestamps. If task is already completed, the task is
|
* Complete a claimed Task as owner/admin and update State and Timestamps. If task is already
|
||||||
* returned as itself.
|
* completed, the task is returned as itself.
|
||||||
*
|
*
|
||||||
* @param taskId
|
* @param taskId - Id of the Task which should be completed.
|
||||||
* - Id of the Task which should be completed.
|
* @return Task - updated task after completion.
|
||||||
* @return Task - updated task after completion.
|
* @throws InvalidStateException when Task wasn´t claimed before.
|
||||||
* @throws InvalidStateException
|
* @throws TaskNotFoundException if the given Task can´t be found in DB.
|
||||||
* when Task wasn´t claimed before.
|
* @throws InvalidOwnerException if current user is not the task-owner or administrator.
|
||||||
* @throws TaskNotFoundException
|
* @throws NotAuthorizedException if the current user has no read permission for the workbasket
|
||||||
* if the given Task can´t be found in DB.
|
* the task is in
|
||||||
* @throws InvalidOwnerException
|
*/
|
||||||
* if current user is not the task-owner or administrator.
|
Task completeTask(String taskId)
|
||||||
* @throws NotAuthorizedException
|
throws TaskNotFoundException, InvalidOwnerException, InvalidStateException,
|
||||||
* if the current user has no read permission for the workbasket the task is in
|
NotAuthorizedException;
|
||||||
*/
|
|
||||||
Task completeTask(String taskId)
|
|
||||||
throws TaskNotFoundException, InvalidOwnerException, InvalidStateException, NotAuthorizedException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Complete a Task and update State and Timestamps in every case if the Task exists. If task is already completed,
|
* Complete a Task and update State and Timestamps in every case if the Task exists. If task is
|
||||||
* the task is returned as itself.
|
* already completed, the task is returned as itself.
|
||||||
*
|
*
|
||||||
* @param taskId
|
* @param taskId - Id of the Task which should be completed.
|
||||||
* - Id of the Task which should be completed.
|
* @return Task - updated task after completion.
|
||||||
* @return Task - updated task after completion.
|
* @throws InvalidStateException when Task wasn´t claimed before.
|
||||||
* @throws InvalidStateException
|
* @throws TaskNotFoundException if the given Task can´t be found in DB.
|
||||||
* when Task wasn´t claimed before.
|
* @throws InvalidOwnerException if current user is not the task-owner or administrator.
|
||||||
* @throws TaskNotFoundException
|
* @throws NotAuthorizedException if the current user has no read permission for the workbasket
|
||||||
* if the given Task can´t be found in DB.
|
* the task is in
|
||||||
* @throws InvalidOwnerException
|
*/
|
||||||
* if current user is not the task-owner or administrator.
|
Task forceCompleteTask(String taskId)
|
||||||
* @throws NotAuthorizedException
|
throws TaskNotFoundException, InvalidOwnerException, InvalidStateException,
|
||||||
* if the current user has no read permission for the workbasket the task is in
|
NotAuthorizedException;
|
||||||
*/
|
|
||||||
Task forceCompleteTask(String taskId)
|
|
||||||
throws TaskNotFoundException, InvalidOwnerException, InvalidStateException, NotAuthorizedException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Persists a not persisted Task which does not exist already.
|
* Persists a not persisted Task which does not exist already.
|
||||||
*
|
*
|
||||||
* @param taskToCreate
|
* @param taskToCreate the transient task object to be persisted
|
||||||
* the transient task object to be persisted
|
* @return the created and persisted task
|
||||||
* @return the created and persisted task
|
* @throws TaskAlreadyExistException when the Task does already exist.
|
||||||
* @throws TaskAlreadyExistException
|
* @throws NotAuthorizedException thrown if the current user is not authorized to create that task
|
||||||
* when the Task does already exist.
|
* @throws WorkbasketNotFoundException thrown if the work basket referenced by the task is not
|
||||||
* @throws NotAuthorizedException
|
* found
|
||||||
* thrown if the current user is not authorized to create that task
|
* @throws ClassificationNotFoundException thrown if the {@link Classification} referenced by the
|
||||||
* @throws WorkbasketNotFoundException
|
* task is not found
|
||||||
* thrown if the work basket referenced by the task is not found
|
* @throws InvalidArgumentException thrown if the primary ObjectReference is invalid
|
||||||
* @throws ClassificationNotFoundException
|
*/
|
||||||
* thrown if the {@link Classification} referenced by the task is not found
|
Task createTask(Task taskToCreate)
|
||||||
* @throws InvalidArgumentException
|
throws NotAuthorizedException, WorkbasketNotFoundException, ClassificationNotFoundException,
|
||||||
* thrown if the primary ObjectReference is invalid
|
TaskAlreadyExistException, InvalidArgumentException;
|
||||||
*/
|
|
||||||
Task createTask(Task taskToCreate)
|
|
||||||
throws NotAuthorizedException, WorkbasketNotFoundException, ClassificationNotFoundException,
|
|
||||||
TaskAlreadyExistException, InvalidArgumentException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the details of a task by Id without checking permissions.
|
* Get the details of a task by Id without checking permissions.
|
||||||
*
|
*
|
||||||
* @param taskId
|
* @param taskId the id of the task
|
||||||
* the id of the task
|
* @return the Task
|
||||||
* @return the Task
|
* @throws TaskNotFoundException thrown of the {@link Task} with taskId is not found
|
||||||
* @throws TaskNotFoundException
|
* @throws NotAuthorizedException if the current user has no READ permission for the workbasket
|
||||||
* thrown of the {@link Task} with taskId is not found
|
* the task is in.
|
||||||
* @throws NotAuthorizedException
|
*/
|
||||||
* if the current user has no READ permission for the workbasket the task is in.
|
Task getTask(String taskId) throws TaskNotFoundException, NotAuthorizedException;
|
||||||
*/
|
|
||||||
Task getTask(String taskId) throws TaskNotFoundException, NotAuthorizedException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Transfer a task to another work basket. The transfer sets the transferred flag and resets the read flag.
|
* Transfer a task to another work basket. The transfer sets the transferred flag and resets the
|
||||||
*
|
* read flag.
|
||||||
* @param taskId
|
*
|
||||||
* The id of the {@link Task} to be transferred
|
* @param taskId The id of the {@link Task} to be transferred
|
||||||
* @param destinationWorkbasketId
|
* @param destinationWorkbasketId The Id of the target work basket
|
||||||
* The Id of the target work basket
|
* @return the transferred task
|
||||||
* @return the transferred task
|
* @throws TaskNotFoundException Thrown if the {@link Task} with taskId was not found.
|
||||||
* @throws TaskNotFoundException
|
* @throws WorkbasketNotFoundException Thrown if the target work basket was not found.
|
||||||
* Thrown if the {@link Task} with taskId was not found.
|
* @throws NotAuthorizedException Thrown if the current user is not authorized to transfer this
|
||||||
* @throws WorkbasketNotFoundException
|
* {@link Task} to the target work basket
|
||||||
* Thrown if the target work basket was not found.
|
* @throws InvalidStateException Thrown if the task is in a state which does not allow
|
||||||
* @throws NotAuthorizedException
|
* transferring
|
||||||
* Thrown if the current user is not authorized to transfer this {@link Task} to the target work basket
|
*/
|
||||||
* @throws InvalidStateException
|
Task transfer(String taskId, String destinationWorkbasketId)
|
||||||
* Thrown if the task is in a state which does not allow transferring
|
throws TaskNotFoundException, WorkbasketNotFoundException, NotAuthorizedException,
|
||||||
*/
|
InvalidStateException;
|
||||||
Task transfer(String taskId, String destinationWorkbasketId)
|
|
||||||
throws TaskNotFoundException, WorkbasketNotFoundException, NotAuthorizedException, InvalidStateException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Transfer a task to another work basket. The transfer sets the transferred flag and resets the read flag.
|
* Transfer a task to another work basket. The transfer sets the transferred flag and resets the
|
||||||
*
|
* read flag.
|
||||||
* @param taskId
|
*
|
||||||
* The id of the {@link Task} to be transferred
|
* @param taskId The id of the {@link Task} to be transferred
|
||||||
* @param workbasketKey
|
* @param workbasketKey The key of the target work basket
|
||||||
* The key of the target work basket
|
* @param domain The domain of the target work basket
|
||||||
* @param domain
|
* @return the transferred task
|
||||||
* The domain of the target work basket
|
* @throws TaskNotFoundException Thrown if the {@link Task} with taskId was not found.
|
||||||
* @return the transferred task
|
* @throws WorkbasketNotFoundException Thrown if the target work basket was not found.
|
||||||
* @throws TaskNotFoundException
|
* @throws NotAuthorizedException Thrown if the current user is not authorized to transfer this
|
||||||
* Thrown if the {@link Task} with taskId was not found.
|
* {@link Task} to the target work basket
|
||||||
* @throws WorkbasketNotFoundException
|
* @throws InvalidStateException Thrown if the task is in a state which does not allow
|
||||||
* Thrown if the target work basket was not found.
|
* transferring
|
||||||
* @throws NotAuthorizedException
|
*/
|
||||||
* Thrown if the current user is not authorized to transfer this {@link Task} to the target work basket
|
Task transfer(String taskId, String workbasketKey, String domain)
|
||||||
* @throws InvalidStateException
|
throws TaskNotFoundException, WorkbasketNotFoundException, NotAuthorizedException,
|
||||||
* Thrown if the task is in a state which does not allow transferring
|
InvalidStateException;
|
||||||
*/
|
|
||||||
Task transfer(String taskId, String workbasketKey, String domain)
|
|
||||||
throws TaskNotFoundException, WorkbasketNotFoundException, NotAuthorizedException, InvalidStateException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Marks a task as read.
|
* Marks a task as read.
|
||||||
*
|
*
|
||||||
* @param taskId
|
* @param taskId the id of the task to be updated
|
||||||
* the id of the task to be updated
|
* @param isRead the new status of the read flag.
|
||||||
* @param isRead
|
* @return the updated Task
|
||||||
* the new status of the read flag.
|
* @throws TaskNotFoundException Thrown if the {@link Task} with taskId was not found
|
||||||
* @return the updated Task
|
* @throws NotAuthorizedException if the current user has no read permission for the workbasket
|
||||||
* @throws TaskNotFoundException
|
* the task is in
|
||||||
* Thrown if the {@link Task} with taskId was not found
|
*/
|
||||||
* @throws NotAuthorizedException
|
Task setTaskRead(String taskId, boolean isRead)
|
||||||
* if the current user has no read permission for the workbasket the task is in
|
throws TaskNotFoundException, NotAuthorizedException;
|
||||||
*/
|
|
||||||
Task setTaskRead(String taskId, boolean isRead)
|
|
||||||
throws TaskNotFoundException, NotAuthorizedException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method provides a query builder for quering the database.
|
* This method provides a query builder for quering the database.
|
||||||
*
|
*
|
||||||
* @return a {@link TaskQuery}
|
* @return a {@link TaskQuery}
|
||||||
*/
|
*/
|
||||||
TaskQuery createTaskQuery();
|
TaskQuery createTaskQuery();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a not persisted instance of {@link Task}.
|
* Returns a not persisted instance of {@link Task}. The returned task has no workbasket Id set.
|
||||||
* The returned task has no workbasket Id set. When createTask() is
|
* When createTask() is invoked for this task, TaskService will call the TaskRouting SPI to
|
||||||
* invoked for this task, TaskService will call the TaskRouting SPI to
|
* determine a workbasket for the task. If the TaskRouting API is not active, e.g. because no
|
||||||
* determine a workbasket for the task. If the TaskRouting API is not active,
|
* TaskRouter is registered, or the TaskRouter(s) don't find a workbasket, the task will not be
|
||||||
* e.g. because no TaskRouter is registered, or the TaskRouter(s) don't find a workbasket,
|
* persisted.
|
||||||
* the task will not be persisted.
|
*
|
||||||
*
|
* @return an empty new Task
|
||||||
* @return an empty new Task
|
*/
|
||||||
*/
|
Task newTask();
|
||||||
Task newTask();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a not persisted instance of {@link Task}.
|
* Returns a not persisted instance of {@link Task}.
|
||||||
*
|
*
|
||||||
* @param workbasketId
|
* @param workbasketId the id of the workbasket to which the task belongs
|
||||||
* the id of the workbasket to which the task belongs
|
* @return an empty new Task
|
||||||
* @return an empty new Task
|
*/
|
||||||
*/
|
Task newTask(String workbasketId);
|
||||||
Task newTask(String workbasketId);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a not persisted instance of {@link Task}.
|
* Returns a not persisted instance of {@link Task}.
|
||||||
*
|
*
|
||||||
* @param workbasketKey
|
* @param workbasketKey the key of the workbasket to which the task belongs
|
||||||
* the key of the workbasket to which the task belongs
|
* @param domain the domain of the workbasket to which the task belongs
|
||||||
* @param domain
|
* @return an empty new Task
|
||||||
* the domain of the workbasket to which the task belongs
|
*/
|
||||||
* @return an empty new Task
|
Task newTask(String workbasketKey, String domain);
|
||||||
*/
|
|
||||||
Task newTask(String workbasketKey, String domain);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a not persisted instance of {@link Attachment}.
|
* Returns a not persisted instance of {@link Attachment}.
|
||||||
*
|
*
|
||||||
* @return an empty new Attachment
|
* @return an empty new Attachment
|
||||||
*/
|
*/
|
||||||
Attachment newAttachment();
|
Attachment newAttachment();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update a task.
|
* Update a task.
|
||||||
*
|
*
|
||||||
* @param task
|
* @param task the task to be updated in the database
|
||||||
* the task to be updated in the database
|
* @return the updated task
|
||||||
* @return the updated task
|
* @throws InvalidArgumentException if the task to be updated contains invalid properties like
|
||||||
* @throws InvalidArgumentException
|
* e.g. invalid object references
|
||||||
* if the task to be updated contains invalid properties like e.g. invalid object references
|
* @throws TaskNotFoundException if the id of the task is not found in the database
|
||||||
* @throws TaskNotFoundException
|
* @throws ConcurrencyException if the task has already been updated by another user
|
||||||
* if the id of the task is not found in the database
|
* @throws ClassificationNotFoundException if the updated task refers to a classification that
|
||||||
* @throws ConcurrencyException
|
* cannot be found
|
||||||
* if the task has already been updated by another user
|
* @throws NotAuthorizedException if the current user is not authorized to update the task
|
||||||
* @throws ClassificationNotFoundException
|
* @throws AttachmentPersistenceException if an Attachment with ID will be added multiple times
|
||||||
* if the updated task refers to a classification that cannot be found
|
* without using the task-methods.
|
||||||
* @throws NotAuthorizedException
|
*/
|
||||||
* if the current user is not authorized to update the task
|
Task updateTask(Task task)
|
||||||
* @throws AttachmentPersistenceException
|
throws InvalidArgumentException, TaskNotFoundException, ConcurrencyException,
|
||||||
* if an Attachment with ID will be added multiple times without using the task-methods.
|
ClassificationNotFoundException, NotAuthorizedException, AttachmentPersistenceException;
|
||||||
*/
|
|
||||||
Task updateTask(Task task) throws InvalidArgumentException, TaskNotFoundException, ConcurrencyException,
|
|
||||||
ClassificationNotFoundException, NotAuthorizedException, AttachmentPersistenceException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Transfers a list of tasks to an other workbasket. Exceptions will be thrown if the caller got no permissions on
|
* Transfers a list of tasks to an other workbasket. Exceptions will be thrown if the caller got
|
||||||
* the target or it doesn´t exist. Other Exceptions will be stored and returned in the end.
|
* no permissions on the target or it doesn´t exist. Other Exceptions will be stored and returned
|
||||||
*
|
* in the end.
|
||||||
* @param destinationWorkbasketId
|
*
|
||||||
* target workbasket id
|
* @param destinationWorkbasketId target workbasket id
|
||||||
* @param taskIds
|
* @param taskIds source task which will be moved
|
||||||
* source task which will be moved
|
* @return Bulkresult with ID and Error in it for failed transactions.
|
||||||
* @return Bulkresult with ID and Error in it for failed transactions.
|
* @throws NotAuthorizedException if the caller hasn´t permissions on tarket WB.
|
||||||
* @throws NotAuthorizedException
|
* @throws InvalidArgumentException if the method paramesters are EMPTY or NULL.
|
||||||
* if the caller hasn´t permissions on tarket WB.
|
* @throws WorkbasketNotFoundException if the target WB can´t be found.
|
||||||
* @throws InvalidArgumentException
|
*/
|
||||||
* if the method paramesters are EMPTY or NULL.
|
BulkOperationResults<String, TaskanaException> transferTasks(
|
||||||
* @throws WorkbasketNotFoundException
|
String destinationWorkbasketId, List<String> taskIds)
|
||||||
* if the target WB can´t be found.
|
throws NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException;
|
||||||
*/
|
|
||||||
BulkOperationResults<String, TaskanaException> transferTasks(String destinationWorkbasketId, List<String> taskIds)
|
|
||||||
throws NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Transfers a list of tasks to an other workbasket. Exceptions will be thrown if the caller got no permissions on
|
* Transfers a list of tasks to an other workbasket. Exceptions will be thrown if the caller got
|
||||||
* the target or it doesn´t exist. Other Exceptions will be stored and returned in the end.
|
* no permissions on the target or it doesn´t exist. Other Exceptions will be stored and returned
|
||||||
*
|
* in the end.
|
||||||
* @param destinationWorkbasketKey
|
*
|
||||||
* target workbasket key
|
* @param destinationWorkbasketKey target workbasket key
|
||||||
* @param destinationWorkbasketDomain
|
* @param destinationWorkbasketDomain target workbasket domain
|
||||||
* target workbasket domain
|
* @param taskIds source task which will be moved
|
||||||
* @param taskIds
|
* @return Bulkresult with ID and Error in it for failed transactions.
|
||||||
* source task which will be moved
|
* @throws NotAuthorizedException if the caller hasn´t permissions on tarket WB.
|
||||||
* @return Bulkresult with ID and Error in it for failed transactions.
|
* @throws InvalidArgumentException if the method paramesters are EMPTY or NULL.
|
||||||
* @throws NotAuthorizedException
|
* @throws WorkbasketNotFoundException if the target WB can´t be found.
|
||||||
* if the caller hasn´t permissions on tarket WB.
|
*/
|
||||||
* @throws InvalidArgumentException
|
BulkOperationResults<String, TaskanaException> transferTasks(
|
||||||
* if the method paramesters are EMPTY or NULL.
|
String destinationWorkbasketKey, String destinationWorkbasketDomain, List<String> taskIds)
|
||||||
* @throws WorkbasketNotFoundException
|
throws NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException;
|
||||||
* if the target WB can´t be found.
|
|
||||||
*/
|
|
||||||
BulkOperationResults<String, TaskanaException> transferTasks(String destinationWorkbasketKey,
|
|
||||||
String destinationWorkbasketDomain, List<String> taskIds)
|
|
||||||
throws NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes the task with the given Id.
|
* Deletes the task with the given Id.
|
||||||
*
|
*
|
||||||
* @param taskId
|
* @param taskId The Id of the task to delete.
|
||||||
* The Id of the task to delete.
|
* @throws TaskNotFoundException If the given Id does not refer to an existing task.
|
||||||
* @throws TaskNotFoundException
|
* @throws InvalidStateException If the state of the referenced task is not Completed.
|
||||||
* If the given Id does not refer to an existing task.
|
* @throws NotAuthorizedException if the current user is not member of role ADMIN
|
||||||
* @throws InvalidStateException
|
*/
|
||||||
* If the state of the referenced task is not Completed.
|
void deleteTask(String taskId)
|
||||||
* @throws NotAuthorizedException
|
throws TaskNotFoundException, InvalidStateException, NotAuthorizedException;
|
||||||
* if the current user is not member of role ADMIN
|
|
||||||
*/
|
|
||||||
void deleteTask(String taskId)
|
|
||||||
throws TaskNotFoundException, InvalidStateException, NotAuthorizedException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes the task with the given Id even if it is not completed.
|
* Deletes the task with the given Id even if it is not completed.
|
||||||
*
|
*
|
||||||
* @param taskId
|
* @param taskId The Id of the task to delete.
|
||||||
* The Id of the task to delete.
|
* @throws TaskNotFoundException If the given Id does not refer to an existing task.
|
||||||
* @throws TaskNotFoundException
|
* @throws InvalidStateException If the state of the referenced task is not Completed and
|
||||||
* If the given Id does not refer to an existing task.
|
* forceDelet is false.
|
||||||
* @throws InvalidStateException
|
* @throws NotAuthorizedException if the current user is not member of role ADMIN
|
||||||
* If the state of the referenced task is not Completed and forceDelet is false.
|
*/
|
||||||
* @throws NotAuthorizedException
|
void forceDeleteTask(String taskId)
|
||||||
* if the current user is not member of role ADMIN
|
throws TaskNotFoundException, InvalidStateException, NotAuthorizedException;
|
||||||
*/
|
|
||||||
void forceDeleteTask(String taskId)
|
|
||||||
throws TaskNotFoundException, InvalidStateException, NotAuthorizedException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes a list of tasks.
|
* Deletes a list of tasks.
|
||||||
*
|
*
|
||||||
* @param tasks
|
* @param tasks the ids of the tasks to delete.
|
||||||
* the ids of the tasks to delete.
|
* @return the result of the operations with Id and Exception for each failed task deletion.
|
||||||
* @return the result of the operations with Id and Exception for each failed task deletion.
|
* @throws InvalidArgumentException if the TaskIds parameter is NULL
|
||||||
* @throws InvalidArgumentException
|
*/
|
||||||
* if the TaskIds parameter is NULL
|
BulkOperationResults<String, TaskanaException> deleteTasks(List<String> tasks)
|
||||||
*/
|
throws InvalidArgumentException;
|
||||||
BulkOperationResults<String, TaskanaException> deleteTasks(List<String> tasks) throws InvalidArgumentException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Completes a list of tasks.
|
* Completes a list of tasks.
|
||||||
*
|
*
|
||||||
* @param taskIds
|
* @param taskIds of the tasks which should be completed.
|
||||||
* of the tasks which should be completed.
|
* @return the result of the operations with Id and Exception for each failed task completion.
|
||||||
* @return the result of the operations with Id and Exception for each failed task completion.
|
* @throws InvalidArgumentException If the taskId parameter is NULL.
|
||||||
* @throws InvalidArgumentException
|
*/
|
||||||
* If the taskId parameter is NULL.
|
BulkOperationResults<String, TaskanaException> completeTasks(List<String> taskIds)
|
||||||
*/
|
throws InvalidArgumentException;
|
||||||
BulkOperationResults<String, TaskanaException> completeTasks(List<String> taskIds)
|
|
||||||
throws InvalidArgumentException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates tasks with a matching {@link ObjectReference}.
|
* Updates tasks with a matching {@link ObjectReference}.
|
||||||
*
|
*
|
||||||
* @param selectionCriteria
|
* @param selectionCriteria the {@link ObjectReference} that is used to select the tasks.
|
||||||
* the {@link ObjectReference} that is used to select the tasks.
|
* @param customFieldsToUpdate a {@link Map} that contains as key the identification of the custom
|
||||||
* @param customFieldsToUpdate
|
* field and as value the corresponding new value of that custom field. The key for
|
||||||
* a {@link Map} that contains as key the identification of the custom field and as value the
|
* identification of the custom field must be a String with value "1", "2" ... "16" as in the
|
||||||
* corresponding new value of that custom field. The key for identification of the custom field must be a
|
* setCustomAttribute or getCustomAttribute method of {@link Task}
|
||||||
* String with value "1", "2" ... "16" as in the setCustomAttribute or getCustomAttribute method of
|
* @return a list of the Ids of all modified tasks
|
||||||
* {@link Task}
|
* @throws InvalidArgumentException If the customFieldsToUpdate map contains an invalid key or if
|
||||||
* @return a list of the Ids of all modified tasks
|
* the selectionCriteria is invalid
|
||||||
* @throws InvalidArgumentException
|
*/
|
||||||
* If the customFieldsToUpdate map contains an invalid key or if the selectionCriteria is invalid
|
List<String> updateTasks(
|
||||||
*/
|
ObjectReference selectionCriteria, Map<String, String> customFieldsToUpdate)
|
||||||
List<String> updateTasks(ObjectReference selectionCriteria,
|
throws InvalidArgumentException;
|
||||||
Map<String, String> customFieldsToUpdate) throws InvalidArgumentException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates tasks with matching taskIds.
|
* Updates tasks with matching taskIds.
|
||||||
*
|
*
|
||||||
* @param taskIds
|
* @param taskIds the taskIds that are used to select the tasks.
|
||||||
* the taskIds that are used to select the tasks.
|
* @param customFieldsToUpdate a {@link Map} that contains as key the identification of the custom
|
||||||
* @param customFieldsToUpdate
|
* field and as value the corresponding new value of that custom field. The key for
|
||||||
* a {@link Map} that contains as key the identification of the custom field and as value the
|
* identification of the custom field must be a String with value "1", "2" ... "16" as in the
|
||||||
* corresponding new value of that custom field. The key for identification of the custom field must be a
|
* setCustomAttribute or getCustomAttribute method of {@link Task}
|
||||||
* String with value "1", "2" ... "16" as in the setCustomAttribute or getCustomAttribute method of
|
* @return a list of the Ids of all modified tasks
|
||||||
* {@link Task}
|
* @throws InvalidArgumentException If the customFieldsToUpdate map contains an invalid key or if
|
||||||
* @return a list of the Ids of all modified tasks
|
* the selectionCriteria is invalid
|
||||||
* @throws InvalidArgumentException
|
*/
|
||||||
* If the customFieldsToUpdate map contains an invalid key or if the selectionCriteria is invalid
|
List<String> updateTasks(List<String> taskIds, Map<String, String> customFieldsToUpdate)
|
||||||
*/
|
throws InvalidArgumentException;
|
||||||
List<String> updateTasks(List<String> taskIds,
|
|
||||||
Map<String, String> customFieldsToUpdate) throws InvalidArgumentException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the callback state on a list of tasks.
|
|
||||||
* Note: this method is primarily intended to be used by the TaskanaAdapter
|
|
||||||
*
|
|
||||||
* @param externalIds the EXTERNAL_IDs of the tasks on which the callback state is set.
|
|
||||||
* @param state the callback state that is to be set on the tasks
|
|
||||||
*
|
|
||||||
* @return the result of the operations with Id and Exception for each failed task deletion.
|
|
||||||
*/
|
|
||||||
BulkOperationResults<String, TaskanaException> setCallbackStateForTasks(List<String> externalIds, CallbackState state);
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the callback state on a list of tasks. Note: this method is primarily intended to be used
|
||||||
|
* by the TaskanaAdapter
|
||||||
|
*
|
||||||
|
* @param externalIds the EXTERNAL_IDs of the tasks on which the callback state is set.
|
||||||
|
* @param state the callback state that is to be set on the tasks
|
||||||
|
* @return the result of the operations with Id and Exception for each failed task deletion.
|
||||||
|
*/
|
||||||
|
BulkOperationResults<String, TaskanaException> setCallbackStateForTasks(
|
||||||
|
List<String> externalIds, CallbackState state);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
package pro.taskana;
|
package pro.taskana;
|
||||||
|
|
||||||
/**
|
/** This enum contains all status of the tasks. */
|
||||||
* This enum contains all status of the tasks.
|
|
||||||
*/
|
|
||||||
public enum TaskState {
|
public enum TaskState {
|
||||||
READY, CLAIMED, COMPLETED
|
READY,
|
||||||
|
CLAIMED,
|
||||||
|
COMPLETED
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,182 +6,180 @@ import java.util.List;
|
||||||
import pro.taskana.exceptions.InvalidArgumentException;
|
import pro.taskana.exceptions.InvalidArgumentException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface for TaskSummary. This is a specific short model-object which only contains the most important information.
|
* Interface for TaskSummary. This is a specific short model-object which only contains the most
|
||||||
|
* important information.
|
||||||
*/
|
*/
|
||||||
public interface TaskSummary {
|
public interface TaskSummary {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the id of the task.
|
* Gets the id of the task.
|
||||||
*
|
*
|
||||||
* @return taskId
|
* @return taskId
|
||||||
*/
|
*/
|
||||||
String getTaskId();
|
String getTaskId();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the external id of the task.
|
* Gets the external id of the task.
|
||||||
*
|
*
|
||||||
* @return the external Id
|
* @return the external Id
|
||||||
*/
|
*/
|
||||||
String getExternalId();
|
String getExternalId();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the name of the task-creator.
|
* Gets the name of the task-creator.
|
||||||
*
|
*
|
||||||
* @return creator
|
* @return creator
|
||||||
*/
|
*/
|
||||||
String getCreator();
|
String getCreator();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the time when the task was created.
|
* Gets the time when the task was created.
|
||||||
*
|
*
|
||||||
* @return the created Instant
|
* @return the created Instant
|
||||||
*/
|
*/
|
||||||
Instant getCreated();
|
Instant getCreated();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the time when the task was claimed.
|
* Gets the time when the task was claimed.
|
||||||
*
|
*
|
||||||
* @return the claimed Instant
|
* @return the claimed Instant
|
||||||
*/
|
*/
|
||||||
Instant getClaimed();
|
Instant getClaimed();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the time when the task was completed.
|
* Gets the time when the task was completed.
|
||||||
*
|
*
|
||||||
* @return the completed Instant
|
* @return the completed Instant
|
||||||
*/
|
*/
|
||||||
Instant getCompleted();
|
Instant getCompleted();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the time when the task was last modified.
|
* Gets the time when the task was last modified.
|
||||||
*
|
*
|
||||||
* @return the last modified Instant
|
* @return the last modified Instant
|
||||||
*/
|
*/
|
||||||
Instant getModified();
|
Instant getModified();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the time when the task is planned to be executed.
|
* Gets the time when the task is planned to be executed.
|
||||||
*
|
*
|
||||||
* @return the planned Instant
|
* @return the planned Instant
|
||||||
*/
|
*/
|
||||||
Instant getPlanned();
|
Instant getPlanned();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the time when the task is due.
|
* Gets the time when the task is due.
|
||||||
*
|
*
|
||||||
* @return the due Instant
|
* @return the due Instant
|
||||||
*/
|
*/
|
||||||
Instant getDue();
|
Instant getDue();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the name of the task.
|
* Gets the name of the task.
|
||||||
*
|
*
|
||||||
* @return the task's name
|
* @return the task's name
|
||||||
*/
|
*/
|
||||||
String getName();
|
String getName();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the note attached to the task.
|
* Gets the note attached to the task.
|
||||||
*
|
*
|
||||||
* @return the task's note
|
* @return the task's note
|
||||||
*/
|
*/
|
||||||
String getNote();
|
String getNote();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the priority of the task.
|
* Gets the priority of the task.
|
||||||
*
|
*
|
||||||
* @return the task's priority
|
* @return the task's priority
|
||||||
*/
|
*/
|
||||||
int getPriority();
|
int getPriority();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the state of the task.
|
* Gets the state of the task.
|
||||||
*
|
*
|
||||||
* @return the task's state
|
* @return the task's state
|
||||||
*/
|
*/
|
||||||
TaskState getState();
|
TaskState getState();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the classification summary of the task.
|
* Gets the classification summary of the task.
|
||||||
*
|
*
|
||||||
* @return the task's classificationSummary
|
* @return the task's classificationSummary
|
||||||
*/
|
*/
|
||||||
ClassificationSummary getClassificationSummary();
|
ClassificationSummary getClassificationSummary();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the workbasket summary of the task.
|
* Gets the workbasket summary of the task.
|
||||||
*
|
*
|
||||||
* @return the task's workbasketSummary
|
* @return the task's workbasketSummary
|
||||||
*/
|
*/
|
||||||
WorkbasketSummary getWorkbasketSummary();
|
WorkbasketSummary getWorkbasketSummary();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the attachment summaries of the task.
|
* Gets the attachment summaries of the task.
|
||||||
*
|
*
|
||||||
* @return the task's attachment summaries
|
* @return the task's attachment summaries
|
||||||
*/
|
*/
|
||||||
List<AttachmentSummary> getAttachmentSummaries();
|
List<AttachmentSummary> getAttachmentSummaries();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the domain of the task.
|
* Gets the domain of the task.
|
||||||
*
|
*
|
||||||
* @return the task's domain
|
* @return the task's domain
|
||||||
*/
|
*/
|
||||||
String getDomain();
|
String getDomain();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the businessProcessId of the task.
|
* Gets the businessProcessId of the task.
|
||||||
*
|
*
|
||||||
* @return the task's businessProcessId
|
* @return the task's businessProcessId
|
||||||
*/
|
*/
|
||||||
String getBusinessProcessId();
|
String getBusinessProcessId();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the parentBusinessProcessId of the task.
|
* Gets the parentBusinessProcessId of the task.
|
||||||
*
|
*
|
||||||
* @return the task's parentBusinessProcessId
|
* @return the task's parentBusinessProcessId
|
||||||
*/
|
*/
|
||||||
String getParentBusinessProcessId();
|
String getParentBusinessProcessId();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the owner of the task.
|
* Gets the owner of the task.
|
||||||
*
|
*
|
||||||
* @return the task's owner
|
* @return the task's owner
|
||||||
*/
|
*/
|
||||||
String getOwner();
|
String getOwner();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the primary ObjectReference of the task.
|
* Gets the primary ObjectReference of the task.
|
||||||
*
|
*
|
||||||
* @return the task's primary ObjectReference
|
* @return the task's primary ObjectReference
|
||||||
*/
|
*/
|
||||||
ObjectReference getPrimaryObjRef();
|
ObjectReference getPrimaryObjRef();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the isRead flag of the task.
|
* Gets the isRead flag of the task.
|
||||||
*
|
*
|
||||||
* @return the task's isRead flag
|
* @return the task's isRead flag
|
||||||
*/
|
*/
|
||||||
boolean isRead();
|
boolean isRead();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the isTransferred flag of the task.
|
* Gets the isTransferred flag of the task.
|
||||||
*
|
*
|
||||||
* @return the task's isTransferred flag.
|
* @return the task's isTransferred flag.
|
||||||
*/
|
*/
|
||||||
boolean isTransferred();
|
boolean isTransferred();
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the custom attribute number num of the task.
|
|
||||||
*
|
|
||||||
* @param num
|
|
||||||
* identifies which custom attribute is requested. Taskana concatenates "custom_" with num and the
|
|
||||||
* resulting String must match the name of the database column that contains the custom attribute. Valid
|
|
||||||
* values are "1", "2" .. "16"
|
|
||||||
* @return the value of custom attribute number num
|
|
||||||
* @throws InvalidArgumentException
|
|
||||||
* if num has not a value of "1", "2" ... "16"
|
|
||||||
*/
|
|
||||||
String getCustomAttribute(String num) throws InvalidArgumentException;
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the custom attribute number num of the task.
|
||||||
|
*
|
||||||
|
* @param num identifies which custom attribute is requested. Taskana concatenates "custom_" with
|
||||||
|
* num and the resulting String must match the name of the database column that contains the
|
||||||
|
* custom attribute. Valid values are "1", "2" .. "16"
|
||||||
|
* @return the value of custom attribute number num
|
||||||
|
* @throws InvalidArgumentException if num has not a value of "1", "2" ... "16"
|
||||||
|
*/
|
||||||
|
String getCustomAttribute(String num) throws InvalidArgumentException;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,123 +5,116 @@ import java.sql.SQLException;
|
||||||
import pro.taskana.configuration.TaskanaEngineConfiguration;
|
import pro.taskana.configuration.TaskanaEngineConfiguration;
|
||||||
import pro.taskana.exceptions.NotAuthorizedException;
|
import pro.taskana.exceptions.NotAuthorizedException;
|
||||||
|
|
||||||
/**
|
/** The TaskanaEngine represents an overall set of all needed services. */
|
||||||
* The TaskanaEngine represents an overall set of all needed services.
|
|
||||||
*/
|
|
||||||
public interface TaskanaEngine {
|
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
|
* @return the TaskService
|
||||||
*/
|
*/
|
||||||
TaskService getTaskService();
|
TaskService getTaskService();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The TaskMonitorService can be used for monitoring Tasks.
|
* The TaskMonitorService can be used for monitoring Tasks.
|
||||||
*
|
*
|
||||||
* @return the TaskMonitorService
|
* @return the TaskMonitorService
|
||||||
*/
|
*/
|
||||||
TaskMonitorService getTaskMonitorService();
|
TaskMonitorService getTaskMonitorService();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The WorkbasketService can be used for operations on all Workbaskets.
|
* The WorkbasketService can be used for operations on all Workbaskets.
|
||||||
*
|
*
|
||||||
* @return the TaskService
|
* @return the TaskService
|
||||||
*/
|
*/
|
||||||
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
|
* @return the TaskService
|
||||||
*/
|
*/
|
||||||
ClassificationService getClassificationService();
|
ClassificationService getClassificationService();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The JobService can be user for all job operations.
|
* The JobService can be user for all job operations.
|
||||||
*
|
*
|
||||||
* @return the JobService
|
* @return the JobService
|
||||||
*/
|
*/
|
||||||
JobService getJobService();
|
JobService getJobService();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Taskana configuration.
|
* The Taskana configuration.
|
||||||
*
|
*
|
||||||
* @return the TaskanaConfiguration
|
* @return the TaskanaConfiguration
|
||||||
*/
|
*/
|
||||||
TaskanaEngineConfiguration getConfiguration();
|
TaskanaEngineConfiguration getConfiguration();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the history plugin is enabled.
|
* Checks if the history plugin is enabled.
|
||||||
*
|
*
|
||||||
* @return true if the history is enabled. Otherwise false.
|
* @return true if the history is enabled. Otherwise false.
|
||||||
*/
|
*/
|
||||||
boolean isHistoryEnabled();
|
boolean isHistoryEnabled();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* sets the connection management mode.
|
* sets the connection management mode.
|
||||||
*
|
*
|
||||||
* @param mode
|
* @param mode the connection management mode Valid values are:
|
||||||
* the connection management mode Valid values are:
|
* <ul>
|
||||||
* <ul>
|
* <li>PARTICIPATE - taskana participates in global transaction. This is the default mode.
|
||||||
* <li>PARTICIPATE - taskana participates in global transaction. This is the default mode.</li>
|
* <li>AUTOCOMMIT - taskana commits each API call separately
|
||||||
* <li>AUTOCOMMIT - taskana commits each API call separately</li>
|
* <li>EXPLICIT - commit processing is managed explicitly by the client
|
||||||
* <li>EXPLICIT - commit processing is managed explicitly by the client</li>
|
* </ul>
|
||||||
* </ul>
|
*/
|
||||||
*/
|
void setConnectionManagementMode(ConnectionManagementMode mode);
|
||||||
void setConnectionManagementMode(ConnectionManagementMode mode);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the connection to be used by taskana in mode CONNECTION_MANAGED_EXTERNALLY. If this Api is called, taskana
|
* Set the connection to be used by taskana in mode CONNECTION_MANAGED_EXTERNALLY. If this Api is
|
||||||
* uses the connection passed by the client for all subsequent API calls until the client resets this connection.
|
* called, taskana uses the connection passed by the client for all subsequent API calls until the
|
||||||
* Control over commit and rollback of the connection is the responsibility of the client. In order to close the
|
* client resets this connection. Control over commit and rollback of the connection is the
|
||||||
* connection, closeConnection() or setConnection(null) has to be called.
|
* responsibility of the client. In order to close the connection, closeConnection() or
|
||||||
*
|
* setConnection(null) has to be called.
|
||||||
* @param connection
|
*
|
||||||
* - The java.sql.Connection that is controlled by the client
|
* @param connection - The java.sql.Connection that is controlled by the client
|
||||||
* @throws SQLException
|
* @throws SQLException if a database access error occurs
|
||||||
* if a database access error occurs
|
*/
|
||||||
*/
|
void setConnection(java.sql.Connection connection) throws SQLException;
|
||||||
void setConnection(java.sql.Connection connection) throws SQLException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Closes the client's connection, sets it to null and switches to mode PARTICIPATE. Only applicable in mode
|
* Closes the client's connection, sets it to null and switches to mode PARTICIPATE. Only
|
||||||
* EXPLICIT. Has the same effect as setConnection(null).
|
* applicable in mode EXPLICIT. Has the same effect as setConnection(null).
|
||||||
*/
|
*/
|
||||||
void closeConnection();
|
void closeConnection();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* check whether the current user is member of one of the roles specified.
|
* check whether the current user is member of one of the roles specified.
|
||||||
*
|
*
|
||||||
* @param roles
|
* @param roles The roles that are checked for membership of the current user
|
||||||
* The roles that are checked for membership of the current user
|
* @return true if the current user is a member of at least one of the specified groups
|
||||||
* @return true if the current user is a member of at least one of the specified groups
|
*/
|
||||||
*/
|
boolean isUserInRole(TaskanaRole... roles);
|
||||||
boolean isUserInRole(TaskanaRole... roles);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks whether current user is member of any of the specified roles.
|
* Checks whether current user is member of any of the specified roles.
|
||||||
*
|
*
|
||||||
* @param roles
|
* @param roles The roles that are checked for membership of the current user
|
||||||
* The roles that are checked for membership of the current user
|
* @throws NotAuthorizedException If the current user is not member of any specified role
|
||||||
* @throws NotAuthorizedException
|
*/
|
||||||
* If the current user is not member of any specified role
|
void checkRoleMembership(TaskanaRole... roles) throws NotAuthorizedException;
|
||||||
*/
|
|
||||||
void checkRoleMembership(TaskanaRole... roles) throws NotAuthorizedException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Connection management mode. Controls the connection handling of taskana
|
|
||||||
* <ul>
|
|
||||||
* <li>PARTICIPATE - taskana participates in global transaction. This is the default mode</li>
|
|
||||||
* <li>AUTOCOMMIT - taskana commits each API call separately</li>
|
|
||||||
* <li>EXPLICIT - commit processing is managed explicitly by the client</li>
|
|
||||||
* </ul>
|
|
||||||
*/
|
|
||||||
enum ConnectionManagementMode {
|
|
||||||
PARTICIPATE,
|
|
||||||
AUTOCOMMIT,
|
|
||||||
EXPLICIT
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Connection management mode. Controls the connection handling of taskana
|
||||||
|
*
|
||||||
|
* <ul>
|
||||||
|
* <li>PARTICIPATE - taskana participates in global transaction. This is the default mode
|
||||||
|
* <li>AUTOCOMMIT - taskana commits each API call separately
|
||||||
|
* <li>EXPLICIT - commit processing is managed explicitly by the client
|
||||||
|
* </ul>
|
||||||
|
*/
|
||||||
|
enum ConnectionManagementMode {
|
||||||
|
PARTICIPATE,
|
||||||
|
AUTOCOMMIT,
|
||||||
|
EXPLICIT
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,36 +6,33 @@ import java.util.stream.Collectors;
|
||||||
|
|
||||||
import pro.taskana.exceptions.SystemException;
|
import pro.taskana.exceptions.SystemException;
|
||||||
|
|
||||||
/**
|
/** This enum contains all roles that are known to taskana. */
|
||||||
* This enum contains all roles that are known to taskana.
|
|
||||||
*/
|
|
||||||
public enum TaskanaRole {
|
public enum TaskanaRole {
|
||||||
USER("taskana.roles.user"),
|
USER("taskana.roles.user"),
|
||||||
BUSINESS_ADMIN("taskana.roles.businessadmin"),
|
BUSINESS_ADMIN("taskana.roles.businessadmin"),
|
||||||
ADMIN("taskana.roles.admin"),
|
ADMIN("taskana.roles.admin"),
|
||||||
MONITOR("taskana.roles.monitor");
|
MONITOR("taskana.roles.monitor");
|
||||||
|
|
||||||
private final String propertyName;
|
private final String propertyName;
|
||||||
|
|
||||||
TaskanaRole(String propertyName) {
|
TaskanaRole(String propertyName) {
|
||||||
this.propertyName = propertyName;
|
this.propertyName = propertyName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TaskanaRole fromPropertyName(String name) {
|
public static TaskanaRole fromPropertyName(String name) {
|
||||||
return Arrays.stream(TaskanaRole.values())
|
return Arrays.stream(TaskanaRole.values())
|
||||||
.filter(x -> x.propertyName.equalsIgnoreCase(name))
|
.filter(x -> x.propertyName.equalsIgnoreCase(name))
|
||||||
.findFirst()
|
.findFirst()
|
||||||
.orElseThrow(() -> new SystemException(
|
.orElseThrow(
|
||||||
"Internal System error when processing role property " + name));
|
() ->
|
||||||
}
|
new SystemException("Internal System error when processing role property " + name));
|
||||||
|
}
|
||||||
|
|
||||||
public static List<String> getValidPropertyNames() {
|
public static List<String> getValidPropertyNames() {
|
||||||
return Arrays.stream(values())
|
return Arrays.stream(values()).map(TaskanaRole::getPropertyName).collect(Collectors.toList());
|
||||||
.map(TaskanaRole::getPropertyName)
|
}
|
||||||
.collect(Collectors.toList());
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPropertyName() {
|
public String getPropertyName() {
|
||||||
return propertyName;
|
return propertyName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,95 +3,94 @@ package pro.taskana;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Capture a time interval. A fixed interval has defined begin and end Instant. An open ended interval has either begin
|
* Capture a time interval. A fixed interval has defined begin and end Instant. An open ended
|
||||||
* == null or end ==null.
|
* interval has either begin == null or end ==null.
|
||||||
*
|
*
|
||||||
* @author bbr
|
* @author bbr
|
||||||
*/
|
*/
|
||||||
public class TimeInterval {
|
public class TimeInterval {
|
||||||
|
|
||||||
private Instant begin;
|
private Instant begin;
|
||||||
private Instant end;
|
private Instant end;
|
||||||
|
|
||||||
public TimeInterval(Instant begin, Instant end) {
|
public TimeInterval(Instant begin, Instant end) {
|
||||||
this.begin = begin;
|
this.begin = begin;
|
||||||
this.end = end;
|
this.end = end;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean contains(Instant i) {
|
||||||
|
if (i == null) {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
boolean isAfterBegin = begin == null ? true : !i.isBefore(begin);
|
||||||
|
boolean isBeforeEnd = end == null ? true : !i.isAfter(end);
|
||||||
|
return (isAfterBegin && isBeforeEnd);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean contains(Instant i) {
|
public boolean isValid() {
|
||||||
if (i == null) {
|
boolean isValid = begin != null || end != null;
|
||||||
return false;
|
if (begin != null && end != null && begin.isAfter(end)) {
|
||||||
}
|
isValid = false;
|
||||||
boolean isAfterBegin = begin == null ? true : !i.isBefore(begin);
|
|
||||||
boolean isBeforeEnd = end == null ? true : !i.isAfter(end);
|
|
||||||
return (isAfterBegin && isBeforeEnd);
|
|
||||||
}
|
}
|
||||||
|
return isValid;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isValid() {
|
public Instant getBegin() {
|
||||||
boolean isValid = begin != null || end != null;
|
return begin;
|
||||||
if (begin != null && end != null && begin.isAfter(end)) {
|
}
|
||||||
isValid = false;
|
|
||||||
}
|
public void setBegin(Instant begin) {
|
||||||
return isValid;
|
this.begin = begin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Instant getEnd() {
|
||||||
|
return end;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEnd(Instant end) {
|
||||||
|
this.end = end;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
final int prime = 31;
|
||||||
|
int result = 1;
|
||||||
|
result = prime * result + ((begin == null) ? 0 : begin.hashCode());
|
||||||
|
result = prime * result + ((end == null) ? 0 : end.hashCode());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (this == obj) {
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
if (obj == null) {
|
||||||
public Instant getBegin() {
|
return false;
|
||||||
return begin;
|
|
||||||
}
|
}
|
||||||
|
if (!getClass().isAssignableFrom(obj.getClass())) {
|
||||||
public void setBegin(Instant begin) {
|
return false;
|
||||||
this.begin = begin;
|
|
||||||
}
|
}
|
||||||
|
TimeInterval other = (TimeInterval) obj;
|
||||||
public Instant getEnd() {
|
if (begin == null) {
|
||||||
return end;
|
if (other.begin != null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else if (!begin.equals(other.begin)) {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
if (end == null) {
|
||||||
public void setEnd(Instant end) {
|
if (other.end != null) {
|
||||||
this.end = end;
|
return false;
|
||||||
}
|
}
|
||||||
|
} else if (!end.equals(other.end)) {
|
||||||
@Override
|
return false;
|
||||||
public String toString() {
|
|
||||||
return "TimeInterval [" + "begin=" + this.begin + ", end=" + this.end + "]";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
final int prime = 31;
|
|
||||||
int result = 1;
|
|
||||||
result = prime * result + ((begin == null) ? 0 : begin.hashCode());
|
|
||||||
result = prime * result + ((end == null) ? 0 : end.hashCode());
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj) {
|
|
||||||
if (this == obj) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (obj == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (!getClass().isAssignableFrom(obj.getClass())) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
TimeInterval other = (TimeInterval) obj;
|
|
||||||
if (begin == null) {
|
|
||||||
if (other.begin != null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} else if (!begin.equals(other.begin)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (end == null) {
|
|
||||||
if (other.end != null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} else if (!end.equals(other.end)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "TimeInterval [" + "begin=" + this.begin + ", end=" + this.end + "]";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,251 +1,235 @@
|
||||||
package pro.taskana;
|
package pro.taskana;
|
||||||
|
|
||||||
import java.time.Instant;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||||
|
import java.time.Instant;
|
||||||
|
|
||||||
import pro.taskana.impl.WorkbasketImpl;
|
import pro.taskana.impl.WorkbasketImpl;
|
||||||
|
|
||||||
/**
|
/** Workbasket entity interface. */
|
||||||
* Workbasket entity interface.
|
|
||||||
*/
|
|
||||||
@JsonDeserialize(as = WorkbasketImpl.class)
|
@JsonDeserialize(as = WorkbasketImpl.class)
|
||||||
public interface Workbasket {
|
public interface Workbasket {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the unique id of a workbasket.
|
* Returns the unique id of a workbasket.
|
||||||
*
|
*
|
||||||
* @return workbasketId
|
* @return workbasketId
|
||||||
*/
|
*/
|
||||||
String getId();
|
String getId();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the date when the workbasket was created.
|
* Returns the date when the workbasket was created.
|
||||||
*
|
*
|
||||||
* @return created as Instant
|
* @return created as Instant
|
||||||
*/
|
*/
|
||||||
Instant getCreated();
|
Instant getCreated();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the key of the workbasket.
|
* Returns the key of the workbasket.
|
||||||
*
|
*
|
||||||
* @return the key of the workbasket
|
* @return the key of the workbasket
|
||||||
*/
|
*/
|
||||||
String getKey();
|
String getKey();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the domain of the workbasket.
|
* Returns the domain of the workbasket.
|
||||||
*
|
*
|
||||||
* @return domain of the workbasket
|
* @return domain of the workbasket
|
||||||
*/
|
*/
|
||||||
String getDomain();
|
String getDomain();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the type of the workbasket.
|
* Returns the type of the workbasket.
|
||||||
*
|
*
|
||||||
* @return the type of the workbasket
|
* @return the type of the workbasket
|
||||||
*/
|
*/
|
||||||
WorkbasketType getType();
|
WorkbasketType getType();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the type of the workbasket.
|
* Sets the type of the workbasket.
|
||||||
*
|
*
|
||||||
* @param type
|
* @param type the type of the workbasket
|
||||||
* the type of the workbasket
|
*/
|
||||||
*/
|
void setType(WorkbasketType type);
|
||||||
void setType(WorkbasketType type);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the date when the workbasket was modified the last time.
|
* Returns the date when the workbasket was modified the last time.
|
||||||
*
|
*
|
||||||
* @return modified as Instant
|
* @return modified as Instant
|
||||||
*/
|
*/
|
||||||
Instant getModified();
|
Instant getModified();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the name of the workbasket.
|
* Returns the name of the workbasket.
|
||||||
*
|
*
|
||||||
* @return workbasketName
|
* @return workbasketName
|
||||||
*/
|
*/
|
||||||
String getName();
|
String getName();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the name of the workbasket.
|
* Sets the name of the workbasket.
|
||||||
*
|
*
|
||||||
* @param workbasketName
|
* @param workbasketName the name of the workbasket
|
||||||
* the name of the workbasket
|
*/
|
||||||
*/
|
void setName(String workbasketName);
|
||||||
void setName(String workbasketName);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the workbasket-descriptions.
|
* Returns the workbasket-descriptions.
|
||||||
*
|
*
|
||||||
* @return description
|
* @return description
|
||||||
*/
|
*/
|
||||||
String getDescription();
|
String getDescription();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the workbasket-descriptions.
|
* Sets the workbasket-descriptions.
|
||||||
*
|
*
|
||||||
* @param description
|
* @param description the description of the workbasket
|
||||||
* the description of the workbasket
|
*/
|
||||||
*/
|
void setDescription(String description);
|
||||||
void setDescription(String description);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the Id of the workbasket-owner.
|
* Returns the Id of the workbasket-owner.
|
||||||
*
|
*
|
||||||
* @return ownerId
|
* @return ownerId
|
||||||
*/
|
*/
|
||||||
String getOwner();
|
String getOwner();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the owner-ID of the workbasket.
|
* Sets the owner-ID of the workbasket.
|
||||||
*
|
*
|
||||||
* @param owner
|
* @param owner of the current workbasket
|
||||||
* of the current workbasket
|
*/
|
||||||
*/
|
void setOwner(String owner);
|
||||||
void setOwner(String owner);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the value for the custom1 attribute.
|
* Return the value for the custom1 attribute.
|
||||||
*
|
*
|
||||||
* @return custom1
|
* @return custom1
|
||||||
*/
|
*/
|
||||||
String getCustom1();
|
String getCustom1();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the value for custom1 Attribute.
|
* Sets the value for custom1 Attribute.
|
||||||
*
|
*
|
||||||
* @param custom1
|
* @param custom1 the custom1 property of the workbasket
|
||||||
* the custom1 property of the workbasket
|
*/
|
||||||
*/
|
void setCustom1(String custom1);
|
||||||
void setCustom1(String custom1);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the value for the custom2 attribute.
|
* Return the value for the custom2 attribute.
|
||||||
*
|
*
|
||||||
* @return custom2
|
* @return custom2
|
||||||
*/
|
*/
|
||||||
String getCustom2();
|
String getCustom2();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the value for custom2 attribute.
|
* Sets the value for custom2 attribute.
|
||||||
*
|
*
|
||||||
* @param custom2
|
* @param custom2 the custom2 property of the workbasket
|
||||||
* the custom2 property of the workbasket
|
*/
|
||||||
*/
|
void setCustom2(String custom2);
|
||||||
void setCustom2(String custom2);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the value for the custom3 attribute.
|
* Return the value for the custom3 attribute.
|
||||||
*
|
*
|
||||||
* @return custom3
|
* @return custom3
|
||||||
*/
|
*/
|
||||||
String getCustom3();
|
String getCustom3();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the value for custom3 attribute.
|
* Sets the value for custom3 attribute.
|
||||||
*
|
*
|
||||||
* @param custom3
|
* @param custom3 the custom3 property of the workbasket
|
||||||
* the custom3 property of the workbasket
|
*/
|
||||||
*/
|
void setCustom3(String custom3);
|
||||||
void setCustom3(String custom3);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the value for the custom4 attribute.
|
* Return the value for the custom4 attribute.
|
||||||
*
|
*
|
||||||
* @return custom4
|
* @return custom4
|
||||||
*/
|
*/
|
||||||
String getCustom4();
|
String getCustom4();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the value for custom4 attribute.
|
* Sets the value for custom4 attribute.
|
||||||
*
|
*
|
||||||
* @param custom4
|
* @param custom4 the custom4 property of the workbasket
|
||||||
* the custom4 property of the workbasket
|
*/
|
||||||
*/
|
void setCustom4(String custom4);
|
||||||
void setCustom4(String custom4);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the value for the orgLevel1 attribute.
|
* Return the value for the orgLevel1 attribute.
|
||||||
*
|
*
|
||||||
* @return orgLevel1
|
* @return orgLevel1
|
||||||
*/
|
*/
|
||||||
String getOrgLevel1();
|
String getOrgLevel1();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the value for orgLevel1 attribute.
|
* Sets the value for orgLevel1 attribute.
|
||||||
*
|
*
|
||||||
* @param orgLevel1
|
* @param orgLevel1 the orgLevel1 property of the workbasket
|
||||||
* the orgLevel1 property of the workbasket
|
*/
|
||||||
*/
|
void setOrgLevel1(String orgLevel1);
|
||||||
void setOrgLevel1(String orgLevel1);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the value for the orgLevel2 attribute.
|
* Return the value for the orgLevel2 attribute.
|
||||||
*
|
*
|
||||||
* @return orgLevel2
|
* @return orgLevel2
|
||||||
*/
|
*/
|
||||||
String getOrgLevel2();
|
String getOrgLevel2();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the value for orgLevel2 attribute.
|
* Sets the value for orgLevel2 attribute.
|
||||||
*
|
*
|
||||||
* @param orgLevel2
|
* @param orgLevel2 the orgLevel2 property of the workbasket
|
||||||
* the orgLevel2 property of the workbasket
|
*/
|
||||||
*/
|
void setOrgLevel2(String orgLevel2);
|
||||||
void setOrgLevel2(String orgLevel2);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the value for the orgLevel3 attribute.
|
* Return the value for the orgLevel3 attribute.
|
||||||
*
|
*
|
||||||
* @return orgLevel3
|
* @return orgLevel3
|
||||||
*/
|
*/
|
||||||
String getOrgLevel3();
|
String getOrgLevel3();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the value for orgLevel3 attribute.
|
* Sets the value for orgLevel3 attribute.
|
||||||
*
|
*
|
||||||
* @param orgLevel3
|
* @param orgLevel3 the orgLevel3 property of the workbasket
|
||||||
* the orgLevel3 property of the workbasket
|
*/
|
||||||
*/
|
void setOrgLevel3(String orgLevel3);
|
||||||
void setOrgLevel3(String orgLevel3);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the value for the orgLevel4 attribute.
|
* Return the value for the orgLevel4 attribute.
|
||||||
*
|
*
|
||||||
* @return orgLevel4
|
* @return orgLevel4
|
||||||
*/
|
*/
|
||||||
String getOrgLevel4();
|
String getOrgLevel4();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the value for orgLevel4 attribute.
|
* Sets the value for orgLevel4 attribute.
|
||||||
*
|
*
|
||||||
* @param orgLevel4
|
* @param orgLevel4 the orgLevel4 property of the workbasket
|
||||||
* the orgLevel4 property of the workbasket
|
*/
|
||||||
*/
|
void setOrgLevel4(String orgLevel4);
|
||||||
void setOrgLevel4(String orgLevel4);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the value for the markedForDeletion attribute.
|
* Return the value for the markedForDeletion attribute.
|
||||||
*
|
*
|
||||||
* @return markedForDeletion
|
* @return markedForDeletion
|
||||||
*/
|
*/
|
||||||
boolean isMarkedForDeletion();
|
boolean isMarkedForDeletion();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the value for markedForDeletion attribute.
|
* Sets the value for markedForDeletion attribute.
|
||||||
*
|
*
|
||||||
* @param markedForDeletion
|
* @param markedForDeletion the markedForDeletion property of the workbasket
|
||||||
* the markedForDeletion property of the workbasket
|
*/
|
||||||
*/
|
void setMarkedForDeletion(boolean markedForDeletion);
|
||||||
void setMarkedForDeletion(boolean markedForDeletion);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a summary of the current workbasket.
|
* Return a summary of the current workbasket.
|
||||||
*
|
*
|
||||||
* @return the WorkbasketSummary object for the current work basket
|
* @return the WorkbasketSummary object for the current work basket
|
||||||
*/
|
*/
|
||||||
WorkbasketSummary asSummary();
|
WorkbasketSummary asSummary();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,331 +1,318 @@
|
||||||
package pro.taskana;
|
package pro.taskana;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface for WorkbasketAccessItem. This interface is used to control access of users to workbaskets.
|
* Interface for WorkbasketAccessItem. This interface is used to control access of users to
|
||||||
|
* workbaskets.
|
||||||
*
|
*
|
||||||
* @author bbr
|
* @author bbr
|
||||||
*/
|
*/
|
||||||
public interface WorkbasketAccessItem {
|
public interface WorkbasketAccessItem {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the current id of the WorkbasketAccessItem.
|
* Returns the current id of the WorkbasketAccessItem.
|
||||||
*
|
*
|
||||||
* @return Id
|
* @return Id
|
||||||
*/
|
*/
|
||||||
String getId();
|
String getId();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the Id of the referenced workbasket.
|
* Returns the Id of the referenced workbasket.
|
||||||
*
|
*
|
||||||
* @return the workbasket Id
|
* @return the workbasket Id
|
||||||
*/
|
*/
|
||||||
String getWorkbasketId();
|
String getWorkbasketId();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the Key of the referenced workbasket.
|
* Returns the Key of the referenced workbasket.
|
||||||
*
|
*
|
||||||
* @return the workbasket Key
|
* @return the workbasket Key
|
||||||
*/
|
*/
|
||||||
String getWorkbasketKey();
|
String getWorkbasketKey();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the group id or user id for which this WorkbasketAccessItem controls access permissions.
|
* Returns the group id or user id for which this WorkbasketAccessItem controls access
|
||||||
*
|
* permissions.
|
||||||
* @return access id, this is the group id or user id
|
*
|
||||||
*/
|
* @return access id, this is the group id or user id
|
||||||
String getAccessId();
|
*/
|
||||||
|
String getAccessId();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the name of the group or user for which this WorkbasketAccessItem controls access permissions.
|
* Returns the name of the group or user for which this WorkbasketAccessItem controls access
|
||||||
*
|
* permissions.
|
||||||
* @return access name, this is the name of the group or user
|
*
|
||||||
*/
|
* @return access name, this is the name of the group or user
|
||||||
String getAccessName();
|
*/
|
||||||
|
String getAccessName();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the name of the group or user for which this WorkbasketAccessItem controls access permissions.
|
* Set the name of the group or user for which this WorkbasketAccessItem controls access
|
||||||
*
|
* permissions.
|
||||||
* @param name
|
*
|
||||||
* the name of the group or user for which this WorkbasketAccessItem controls access permissions.
|
* @param name the name of the group or user for which this WorkbasketAccessItem controls access
|
||||||
*/
|
* permissions.
|
||||||
void setAccessName(String name);
|
*/
|
||||||
|
void setAccessName(String name);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether read of the referenced workbasket is permitted.
|
* Returns whether read of the referenced workbasket is permitted.
|
||||||
*
|
*
|
||||||
* @return read permission for the referenced workbasket
|
* @return read permission for the referenced workbasket
|
||||||
*/
|
*/
|
||||||
boolean isPermRead();
|
boolean isPermRead();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets read permission for the referenced workbasket.
|
* Sets read permission for the referenced workbasket.
|
||||||
*
|
*
|
||||||
* @param permRead
|
* @param permRead specifies whether read is permitted for the referenced workbasket.
|
||||||
* specifies whether read is permitted for the referenced workbasket.
|
*/
|
||||||
*/
|
void setPermRead(boolean permRead);
|
||||||
void setPermRead(boolean permRead);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether open of the referenced workbasket is permitted.
|
* Returns whether open of the referenced workbasket is permitted.
|
||||||
*
|
*
|
||||||
* @return open permission for the referenced workbasket
|
* @return open permission for the referenced workbasket
|
||||||
*/
|
*/
|
||||||
boolean isPermOpen();
|
boolean isPermOpen();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets open permission for the referenced workbasket.
|
* Sets open permission for the referenced workbasket.
|
||||||
*
|
*
|
||||||
* @param permOpen
|
* @param permOpen specifies whether open is permitted for the referenced workbasket.
|
||||||
* specifies whether open is permitted for the referenced workbasket.
|
*/
|
||||||
*/
|
void setPermOpen(boolean permOpen);
|
||||||
void setPermOpen(boolean permOpen);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether append to the referenced workbasket is permitted.
|
* Returns whether append to the referenced workbasket is permitted.
|
||||||
*
|
*
|
||||||
* @return append permission for the referenced workbasket
|
* @return append permission for the referenced workbasket
|
||||||
*/
|
*/
|
||||||
boolean isPermAppend();
|
boolean isPermAppend();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets append permission for the referenced workbasket.
|
* Sets append permission for the referenced workbasket.
|
||||||
*
|
*
|
||||||
* @param permAppend
|
* @param permAppend specifies whether append to the referenced workbasket is permitted.
|
||||||
* specifies whether append to the referenced workbasket is permitted.
|
*/
|
||||||
*/
|
void setPermAppend(boolean permAppend);
|
||||||
void setPermAppend(boolean permAppend);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether transfer from the referenced workbasket is permitted.
|
* Returns whether transfer from the referenced workbasket is permitted.
|
||||||
*
|
*
|
||||||
* @return transfer permission for the referenced workbasket
|
* @return transfer permission for the referenced workbasket
|
||||||
*/
|
*/
|
||||||
boolean isPermTransfer();
|
boolean isPermTransfer();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets transfer permission for the referenced workbasket.
|
* Sets transfer permission for the referenced workbasket.
|
||||||
*
|
*
|
||||||
* @param permTransfer
|
* @param permTransfer specifies whether transfer from the referenced workbasket is permitted.
|
||||||
* specifies whether transfer from the referenced workbasket is permitted.
|
*/
|
||||||
*/
|
void setPermTransfer(boolean permTransfer);
|
||||||
void setPermTransfer(boolean permTransfer);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether distribute from the referenced workbasket is permitted.
|
* Returns whether distribute from the referenced workbasket is permitted.
|
||||||
*
|
*
|
||||||
* @return distribute permission for the referenced workbasket
|
* @return distribute permission for the referenced workbasket
|
||||||
*/
|
*/
|
||||||
boolean isPermDistribute();
|
boolean isPermDistribute();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets distribute permission for the referenced workbasket.
|
* Sets distribute permission for the referenced workbasket.
|
||||||
*
|
*
|
||||||
* @param permDistribute
|
* @param permDistribute specifies whether distribute from the referenced workbasket is permitted.
|
||||||
* specifies whether distribute from the referenced workbasket is permitted.
|
*/
|
||||||
*/
|
void setPermDistribute(boolean permDistribute);
|
||||||
void setPermDistribute(boolean permDistribute);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether custom1 permission is granted for the referenced workbasket. The semantics of this custom
|
* Returns whether custom1 permission is granted for the referenced workbasket. The semantics of
|
||||||
* permission is transparent to taskana.
|
* this custom permission is transparent to taskana.
|
||||||
*
|
*
|
||||||
* @return custom1 permission for the referenced workbasket
|
* @return custom1 permission for the referenced workbasket
|
||||||
*/
|
*/
|
||||||
boolean isPermCustom1();
|
boolean isPermCustom1();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the custom1 permission for the referenced workbasket. The semantics of this custom permission is transparent
|
* Sets the custom1 permission for the referenced workbasket. The semantics of this custom
|
||||||
* to taskana.
|
* permission is transparent to taskana.
|
||||||
*
|
*
|
||||||
* @param permCustom1
|
* @param permCustom1 specifies whether custom1 permission is granted
|
||||||
* specifies whether custom1 permission is granted
|
*/
|
||||||
*/
|
void setPermCustom1(boolean permCustom1);
|
||||||
void setPermCustom1(boolean permCustom1);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether custom2 permission is granted for the referenced workbasket. The semantics of this custom
|
* Returns whether custom2 permission is granted for the referenced workbasket. The semantics of
|
||||||
* permission is transparent to taskana.
|
* this custom permission is transparent to taskana.
|
||||||
*
|
*
|
||||||
* @return custom2 permission for the referenced workbasket
|
* @return custom2 permission for the referenced workbasket
|
||||||
*/
|
*/
|
||||||
boolean isPermCustom2();
|
boolean isPermCustom2();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the custom2 permission for the referenced workbasket. The semantics of this custom permission is transparent
|
* Sets the custom2 permission for the referenced workbasket. The semantics of this custom
|
||||||
* to taskana.
|
* permission is transparent to taskana.
|
||||||
*
|
*
|
||||||
* @param permCustom2
|
* @param permCustom2 specifies whether custom2 permission is granted
|
||||||
* specifies whether custom2 permission is granted
|
*/
|
||||||
*/
|
void setPermCustom2(boolean permCustom2);
|
||||||
void setPermCustom2(boolean permCustom2);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether custom3 permission is granted for the referenced workbasket. The semantics of this custom
|
* Returns whether custom3 permission is granted for the referenced workbasket. The semantics of
|
||||||
* permission is transparent to taskana.
|
* this custom permission is transparent to taskana.
|
||||||
*
|
*
|
||||||
* @return custom3 permission for the referenced workbasket
|
* @return custom3 permission for the referenced workbasket
|
||||||
*/
|
*/
|
||||||
boolean isPermCustom3();
|
boolean isPermCustom3();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the custom3 permission for the referenced workbasket. The semantics of this custom permission is transparent
|
* Sets the custom3 permission for the referenced workbasket. The semantics of this custom
|
||||||
* to taskana.
|
* permission is transparent to taskana.
|
||||||
*
|
*
|
||||||
* @param permCustom3
|
* @param permCustom3 specifies whether custom3 permission is granted
|
||||||
* specifies whether custom3 permission is granted
|
*/
|
||||||
*/
|
void setPermCustom3(boolean permCustom3);
|
||||||
void setPermCustom3(boolean permCustom3);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether custom4 permission is granted for the referenced workbasket. The semantics of this custom
|
* Returns whether custom4 permission is granted for the referenced workbasket. The semantics of
|
||||||
* permission is transparent to taskana.
|
* this custom permission is transparent to taskana.
|
||||||
*
|
*
|
||||||
* @return custom4 permission for the referenced workbasket
|
* @return custom4 permission for the referenced workbasket
|
||||||
*/
|
*/
|
||||||
boolean isPermCustom4();
|
boolean isPermCustom4();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the custom4 permission for the referenced workbasket. The semantics of this custom permission is transparent
|
* Sets the custom4 permission for the referenced workbasket. The semantics of this custom
|
||||||
* to taskana.
|
* permission is transparent to taskana.
|
||||||
*
|
*
|
||||||
* @param permCustom4
|
* @param permCustom4 specifies whether custom4 permission is granted
|
||||||
* specifies whether custom4 permission is granted
|
*/
|
||||||
*/
|
void setPermCustom4(boolean permCustom4);
|
||||||
void setPermCustom4(boolean permCustom4);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether custom5 permission is granted for the referenced workbasket. The semantics of this custom
|
* Returns whether custom5 permission is granted for the referenced workbasket. The semantics of
|
||||||
* permission is transparent to taskana.
|
* this custom permission is transparent to taskana.
|
||||||
*
|
*
|
||||||
* @return custom5 permission for the referenced workbasket
|
* @return custom5 permission for the referenced workbasket
|
||||||
*/
|
*/
|
||||||
boolean isPermCustom5();
|
boolean isPermCustom5();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the custom5 permission for the referenced workbasket. The semantics of this custom permission is transparent
|
* Sets the custom5 permission for the referenced workbasket. The semantics of this custom
|
||||||
* to taskana.
|
* permission is transparent to taskana.
|
||||||
*
|
*
|
||||||
* @param permCustom5
|
* @param permCustom5 specifies whether custom5 permission is granted
|
||||||
* specifies whether custom5 permission is granted
|
*/
|
||||||
*/
|
void setPermCustom5(boolean permCustom5);
|
||||||
void setPermCustom5(boolean permCustom5);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether custom6 permission is granted for the referenced workbasket. The semantics of this custom
|
* Returns whether custom6 permission is granted for the referenced workbasket. The semantics of
|
||||||
* permission is transparent to taskana.
|
* this custom permission is transparent to taskana.
|
||||||
*
|
*
|
||||||
* @return custom6 permission for the referenced workbasket
|
* @return custom6 permission for the referenced workbasket
|
||||||
*/
|
*/
|
||||||
boolean isPermCustom6();
|
boolean isPermCustom6();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the custom6 permission for the referenced workbasket. The semantics of this custom permission is transparent
|
* Sets the custom6 permission for the referenced workbasket. The semantics of this custom
|
||||||
* to taskana.
|
* permission is transparent to taskana.
|
||||||
*
|
*
|
||||||
* @param permCustom6
|
* @param permCustom6 specifies whether custom6 permission is granted
|
||||||
* specifies whether custom6 permission is granted
|
*/
|
||||||
*/
|
void setPermCustom6(boolean permCustom6);
|
||||||
void setPermCustom6(boolean permCustom6);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether custom7 permission is granted for the referenced workbasket. The semantics of this custom
|
* Returns whether custom7 permission is granted for the referenced workbasket. The semantics of
|
||||||
* permission is transparent to taskana.
|
* this custom permission is transparent to taskana.
|
||||||
*
|
*
|
||||||
* @return custom7 permission for the referenced workbasket
|
* @return custom7 permission for the referenced workbasket
|
||||||
*/
|
*/
|
||||||
boolean isPermCustom7();
|
boolean isPermCustom7();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the custom7 permission for the referenced workbasket. The semantics of this custom permission is transparent
|
* Sets the custom7 permission for the referenced workbasket. The semantics of this custom
|
||||||
* to taskana.
|
* permission is transparent to taskana.
|
||||||
*
|
*
|
||||||
* @param permCustom7
|
* @param permCustom7 specifies whether custom7 permission is granted
|
||||||
* specifies whether custom7 permission is granted
|
*/
|
||||||
*/
|
void setPermCustom7(boolean permCustom7);
|
||||||
void setPermCustom7(boolean permCustom7);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether custom8 permission is granted for the referenced workbasket. The semantics of this custom
|
* Returns whether custom8 permission is granted for the referenced workbasket. The semantics of
|
||||||
* permission is transparent to taskana.
|
* this custom permission is transparent to taskana.
|
||||||
*
|
*
|
||||||
* @return custom8 permission for the referenced workbasket
|
* @return custom8 permission for the referenced workbasket
|
||||||
*/
|
*/
|
||||||
boolean isPermCustom8();
|
boolean isPermCustom8();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the custom8 permission for the referenced workbasket. The semantics of this custom permission is transparent
|
* Sets the custom8 permission for the referenced workbasket. The semantics of this custom
|
||||||
* to taskana.
|
* permission is transparent to taskana.
|
||||||
*
|
*
|
||||||
* @param permCustom8
|
* @param permCustom8 specifies whether custom8 permission is granted
|
||||||
* specifies whether custom8 permission is granted
|
*/
|
||||||
*/
|
void setPermCustom8(boolean permCustom8);
|
||||||
void setPermCustom8(boolean permCustom8);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether custom9 permission is granted for the referenced workbasket. The semantics of this custom
|
* Returns whether custom9 permission is granted for the referenced workbasket. The semantics of
|
||||||
* permission is transparent to taskana.
|
* this custom permission is transparent to taskana.
|
||||||
*
|
*
|
||||||
* @return custom9 permission for the referenced workbasket
|
* @return custom9 permission for the referenced workbasket
|
||||||
*/
|
*/
|
||||||
boolean isPermCustom9();
|
boolean isPermCustom9();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the custom9 permission for the referenced workbasket. The semantics of this custom permission is transparent
|
* Sets the custom9 permission for the referenced workbasket. The semantics of this custom
|
||||||
* to taskana.
|
* permission is transparent to taskana.
|
||||||
*
|
*
|
||||||
* @param permCustom9
|
* @param permCustom9 specifies whether custom9 permission is granted
|
||||||
* specifies whether custom9 permission is granted
|
*/
|
||||||
*/
|
void setPermCustom9(boolean permCustom9);
|
||||||
void setPermCustom9(boolean permCustom9);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether custom10 permission is granted for the referenced workbasket. The semantics of this custom
|
* Returns whether custom10 permission is granted for the referenced workbasket. The semantics of
|
||||||
* permission is transparent to taskana.
|
* this custom permission is transparent to taskana.
|
||||||
*
|
*
|
||||||
* @return custom10 permission for the referenced workbasket
|
* @return custom10 permission for the referenced workbasket
|
||||||
*/
|
*/
|
||||||
boolean isPermCustom10();
|
boolean isPermCustom10();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the custom10 permission for the referenced workbasket. The semantics of this custom permission is
|
* Sets the custom10 permission for the referenced workbasket. The semantics of this custom
|
||||||
* transparent to taskana.
|
* permission is transparent to taskana.
|
||||||
*
|
*
|
||||||
* @param permCustom10
|
* @param permCustom10 specifies whether custom10 permission is granted
|
||||||
* specifies whether custom10 permission is granted
|
*/
|
||||||
*/
|
void setPermCustom10(boolean permCustom10);
|
||||||
void setPermCustom10(boolean permCustom10);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether custom11 permission is granted for the referenced workbasket. The semantics of this custom
|
* Returns whether custom11 permission is granted for the referenced workbasket. The semantics of
|
||||||
* permission is transparent to taskana.
|
* this custom permission is transparent to taskana.
|
||||||
*
|
*
|
||||||
* @return custom11 permission for the referenced workbasket
|
* @return custom11 permission for the referenced workbasket
|
||||||
*/
|
*/
|
||||||
boolean isPermCustom11();
|
boolean isPermCustom11();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the custom11 permission for the referenced workbasket. The semantics of this custom permission is
|
* Sets the custom11 permission for the referenced workbasket. The semantics of this custom
|
||||||
* transparent to taskana.
|
* permission is transparent to taskana.
|
||||||
*
|
*
|
||||||
* @param permCustom11
|
* @param permCustom11 specifies whether custom11 permission is granted
|
||||||
* specifies whether custom11 permission is granted
|
*/
|
||||||
*/
|
void setPermCustom11(boolean permCustom11);
|
||||||
void setPermCustom11(boolean permCustom11);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether custom12 permission is granted for the referenced workbasket. The semantics of this custom
|
* Returns whether custom12 permission is granted for the referenced workbasket. The semantics of
|
||||||
* permission is transparent to taskana.
|
* this custom permission is transparent to taskana.
|
||||||
*
|
*
|
||||||
* @return custom12 permission for the referenced workbasket
|
* @return custom12 permission for the referenced workbasket
|
||||||
*/
|
*/
|
||||||
boolean isPermCustom12();
|
boolean isPermCustom12();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the custom12 permission for the referenced workbasket. The semantics of this custom permission is
|
* Sets the custom12 permission for the referenced workbasket. The semantics of this custom
|
||||||
* transparent to taskana.
|
* permission is transparent to taskana.
|
||||||
*
|
*
|
||||||
* @param permCustom12
|
* @param permCustom12 specifies whether custom12 permission is granted
|
||||||
* specifies whether custom12 permission is granted
|
*/
|
||||||
*/
|
void setPermCustom12(boolean permCustom12);
|
||||||
void setPermCustom12(boolean permCustom12);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,106 +1,96 @@
|
||||||
package pro.taskana;
|
package pro.taskana;
|
||||||
|
|
||||||
/**
|
/** WorkbasketAccessItemQuery for generating dynamic SQL. */
|
||||||
* WorkbasketAccessItemQuery for generating dynamic SQL.
|
public interface WorkbasketAccessItemQuery
|
||||||
*/
|
extends BaseQuery<WorkbasketAccessItem, AccessItemQueryColumnName> {
|
||||||
public interface WorkbasketAccessItemQuery extends BaseQuery<WorkbasketAccessItem, AccessItemQueryColumnName> {
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add your unique entry id to your query as filter.
|
* Add your unique entry id to your query as filter.
|
||||||
*
|
*
|
||||||
* @param ids
|
* @param ids the unique entry IDs
|
||||||
* the unique entry IDs
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
WorkbasketAccessItemQuery idIn(String... ids);
|
||||||
WorkbasketAccessItemQuery idIn(String... ids);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add your workbasket id to your query.
|
* Add your workbasket id to your query.
|
||||||
*
|
*
|
||||||
* @param workbasketId
|
* @param workbasketId the workbasket Id
|
||||||
* the workbasket Id
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
WorkbasketAccessItemQuery workbasketIdIn(String... workbasketId);
|
||||||
WorkbasketAccessItemQuery workbasketIdIn(String... workbasketId);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add your unique entry workbasket key to your query as filter.
|
* Add your unique entry workbasket key to your query as filter.
|
||||||
*
|
*
|
||||||
* @param keys
|
* @param keys the unique entry Keys
|
||||||
* the unique entry Keys
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
WorkbasketAccessItemQuery workbasketKeyIn(String... keys);
|
||||||
WorkbasketAccessItemQuery workbasketKeyIn(String... keys);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add keys to your query. The keys are compared case-insensitively to the keys of access items with the SQL LIKE
|
* Add keys to your query. The keys are compared case-insensitively to the keys of access items
|
||||||
* operator. You may add a wildcard like '%' to search generically. If you specify multiple keys they are connected
|
* with the SQL LIKE operator. You may add a wildcard like '%' to search generically. If you
|
||||||
* with an OR operator, this is, the query searches access items workbaskets whose keys are like key1 or like key2, etc.
|
* specify multiple keys they are connected with an OR operator, this is, the query searches
|
||||||
*
|
* access items workbaskets whose keys are like key1 or like key2, etc.
|
||||||
* @param key
|
*
|
||||||
* the keys as Strings
|
* @param key the keys as Strings
|
||||||
* @return the query
|
* @return the query
|
||||||
*/
|
*/
|
||||||
WorkbasketAccessItemQuery workbasketKeyLike(String... key);
|
WorkbasketAccessItemQuery workbasketKeyLike(String... key);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add your accessIds to your query.
|
* Add your accessIds to your query.
|
||||||
*
|
*
|
||||||
* @param accessId
|
* @param accessId as access Ids
|
||||||
* as access Ids
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
WorkbasketAccessItemQuery accessIdIn(String... accessId);
|
||||||
WorkbasketAccessItemQuery accessIdIn(String... accessId);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add keys to your query. The keys are compared case-insensitively to the keys of access items with the SQL LIKE
|
* Add keys to your query. The keys are compared case-insensitively to the keys of access items
|
||||||
* operator. You may add a wildcard like '%' to search generically. If you specify multiple keys they are connected
|
* with the SQL LIKE operator. You may add a wildcard like '%' to search generically. If you
|
||||||
* with an OR operator, this is, the query searches access items whose ids are like id1 or like id2, etc.
|
* specify multiple keys they are connected with an OR operator, this is, the query searches
|
||||||
*
|
* access items whose ids are like id1 or like id2, etc.
|
||||||
* @param ids
|
*
|
||||||
* the ids as Strings
|
* @param ids the ids as Strings
|
||||||
* @return the query
|
* @return the query
|
||||||
*/
|
*/
|
||||||
WorkbasketAccessItemQuery accessIdLike(String... ids);
|
WorkbasketAccessItemQuery accessIdLike(String... ids);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sort the query result by workbasket id.
|
* Sort the query result by workbasket id.
|
||||||
*
|
*
|
||||||
* @param sortDirection
|
* @param sortDirection Determines whether the result is sorted in ascending or descending order.
|
||||||
* Determines whether the result is sorted in ascending or descending order. If sortDirection is null,
|
* If sortDirection is null, the result is sorted in ascending order
|
||||||
* the result is sorted in ascending order
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
WorkbasketAccessItemQuery orderByWorkbasketId(SortDirection sortDirection);
|
||||||
WorkbasketAccessItemQuery orderByWorkbasketId(SortDirection sortDirection);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sort the query result by workbasket key.
|
* Sort the query result by workbasket key.
|
||||||
*
|
*
|
||||||
* @param sortDirection
|
* @param sortDirection Determines whether the result is sorted in ascending or descending order.
|
||||||
* Determines whether the result is sorted in ascending or descending order. If sortDirection is null,
|
* If sortDirection is null, the result is sorted in ascending order
|
||||||
* the result is sorted in ascending order
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
WorkbasketAccessItemQuery orderByWorkbasketKey(SortDirection sortDirection);
|
||||||
WorkbasketAccessItemQuery orderByWorkbasketKey(SortDirection sortDirection);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sort the query result by access Id.
|
* Sort the query result by access Id.
|
||||||
*
|
*
|
||||||
* @param sortDirection
|
* @param sortDirection Determines whether the result is sorted in ascending or descending order.
|
||||||
* Determines whether the result is sorted in ascending or descending order. If sortDirection is null,
|
* If sortDirection is null, the result is sorted in ascending order
|
||||||
* the result is sorted in ascending order
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
WorkbasketAccessItemQuery orderByAccessId(SortDirection sortDirection);
|
||||||
WorkbasketAccessItemQuery orderByAccessId(SortDirection sortDirection);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sort the query result by Id.
|
|
||||||
*
|
|
||||||
* @param sortDirection
|
|
||||||
* Determines whether the result is sorted in ascending or descending order. If sortDirection is null,
|
|
||||||
* the result is sorted in ascending order
|
|
||||||
* @return the query
|
|
||||||
*/
|
|
||||||
WorkbasketAccessItemQuery orderById(SortDirection sortDirection);
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sort the query result by Id.
|
||||||
|
*
|
||||||
|
* @param sortDirection Determines whether the result is sorted in ascending or descending order.
|
||||||
|
* If sortDirection is null, the result is sorted in ascending order
|
||||||
|
* @return the query
|
||||||
|
*/
|
||||||
|
WorkbasketAccessItemQuery orderById(SortDirection sortDirection);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,24 +1,22 @@
|
||||||
package pro.taskana;
|
package pro.taskana;
|
||||||
|
|
||||||
/**
|
/** This enum contains all permission values for the workbaskets. */
|
||||||
* This enum contains all permission values for the workbaskets.
|
|
||||||
*/
|
|
||||||
public enum WorkbasketPermission {
|
public enum WorkbasketPermission {
|
||||||
READ,
|
READ,
|
||||||
OPEN,
|
OPEN,
|
||||||
APPEND,
|
APPEND,
|
||||||
TRANSFER,
|
TRANSFER,
|
||||||
DISTRIBUTE,
|
DISTRIBUTE,
|
||||||
CUSTOM_1,
|
CUSTOM_1,
|
||||||
CUSTOM_2,
|
CUSTOM_2,
|
||||||
CUSTOM_3,
|
CUSTOM_3,
|
||||||
CUSTOM_4,
|
CUSTOM_4,
|
||||||
CUSTOM_5,
|
CUSTOM_5,
|
||||||
CUSTOM_6,
|
CUSTOM_6,
|
||||||
CUSTOM_7,
|
CUSTOM_7,
|
||||||
CUSTOM_8,
|
CUSTOM_8,
|
||||||
CUSTOM_9,
|
CUSTOM_9,
|
||||||
CUSTOM_10,
|
CUSTOM_10,
|
||||||
CUSTOM_11,
|
CUSTOM_11,
|
||||||
CUSTOM_12
|
CUSTOM_12
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,492 +3,447 @@ package pro.taskana;
|
||||||
import pro.taskana.exceptions.InvalidArgumentException;
|
import pro.taskana.exceptions.InvalidArgumentException;
|
||||||
import pro.taskana.exceptions.NotAuthorizedException;
|
import pro.taskana.exceptions.NotAuthorizedException;
|
||||||
|
|
||||||
/**
|
/** WorkitemQuery for generating dynamic sql. */
|
||||||
* WorkitemQuery for generating dynamic sql.
|
|
||||||
*/
|
|
||||||
public interface WorkbasketQuery extends BaseQuery<WorkbasketSummary, WorkbasketQueryColumnName> {
|
public interface WorkbasketQuery extends BaseQuery<WorkbasketSummary, WorkbasketQueryColumnName> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add your ids to your query. The ids are compared to the ids of workbaskets with the IN operator.
|
* Add your ids to your query. The ids are compared to the ids of workbaskets with the IN
|
||||||
*
|
* operator.
|
||||||
* @param id
|
*
|
||||||
* the id as Strings
|
* @param id the id as Strings
|
||||||
* @return the query
|
* @return the query
|
||||||
*/
|
*/
|
||||||
WorkbasketQuery idIn(String... id);
|
WorkbasketQuery idIn(String... id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add your keys to your query. The keys are compared case-insensitively to the keys of workbaskets with the IN
|
* Add your keys to your query. The keys are compared case-insensitively to the keys of
|
||||||
* operator.
|
* workbaskets with the IN operator.
|
||||||
* @param key
|
*
|
||||||
* the keys as Strings
|
* @param key the keys as Strings
|
||||||
* @return the query
|
* @return the query
|
||||||
*/
|
*/
|
||||||
WorkbasketQuery keyIn(String... key);
|
WorkbasketQuery keyIn(String... key);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add keys to your query. The keys are compared case-insensitively to the keys of workbaskets with the SQL LIKE
|
* Add keys to your query. The keys are compared case-insensitively to the keys of workbaskets
|
||||||
* operator. You may add a wildcard like '%' to search generically. If you specify multiple keys they are connected
|
* with the SQL LIKE operator. You may add a wildcard like '%' to search generically. If you
|
||||||
* with an OR operator, this is, the query searches workbaskets whose keys are like key1 or like key2, etc.
|
* specify multiple keys they are connected with an OR operator, this is, the query searches
|
||||||
*
|
* workbaskets whose keys are like key1 or like key2, etc.
|
||||||
* @param key
|
*
|
||||||
* the keys as Strings
|
* @param key the keys as Strings
|
||||||
* @return the query
|
* @return the query
|
||||||
*/
|
*/
|
||||||
WorkbasketQuery keyLike(String... key);
|
WorkbasketQuery keyLike(String... key);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add your names to your query. The names are compared case-insensitively to the names of workbaskets
|
* Add your names to your query. The names are compared case-insensitively to the names of
|
||||||
*
|
* workbaskets
|
||||||
* @param name
|
*
|
||||||
* the names as Strings
|
* @param name the names as Strings
|
||||||
* @return the query
|
* @return the query
|
||||||
*/
|
*/
|
||||||
WorkbasketQuery nameIn(String... name);
|
WorkbasketQuery nameIn(String... name);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add names to your query. The names are compared case-insensitively to the names of workbaskets with the SQL LIKE
|
* Add names to your query. The names are compared case-insensitively to the names of workbaskets
|
||||||
* operator. You may add a wildcard like '%' to search generically. If you specify multiple names, they are
|
* with the SQL LIKE operator. You may add a wildcard like '%' to search generically. If you
|
||||||
* connected with an OR operator, this is, the query searches workbaskets whose names are like name1 or like name2,
|
* specify multiple names, they are connected with an OR operator, this is, the query searches
|
||||||
* etc.
|
* workbaskets whose names are like name1 or like name2, etc.
|
||||||
*
|
*
|
||||||
* @param name
|
* @param name the names as Strings
|
||||||
* the names as Strings
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
WorkbasketQuery nameLike(String... name);
|
||||||
WorkbasketQuery nameLike(String... name);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add search strings to your query that are searched case-insensitively in the key and name fields of workbaskets.
|
* Add search strings to your query that are searched case-insensitively in the key and name
|
||||||
* You may add a wildcard like '%' to search generically. If you specify multiple keys they are connected with an OR
|
* fields of workbaskets. You may add a wildcard like '%' to search generically. If you specify
|
||||||
* operator, this is, the query searches workbaskets whose keys are like string1 or whose names are like string1 or
|
* multiple keys they are connected with an OR operator, this is, the query searches workbaskets
|
||||||
* whose keys are like string2 or whose names are like string2, etc...
|
* whose keys are like string1 or whose names are like string1 or whose keys are like string2 or
|
||||||
*
|
* whose names are like string2, etc...
|
||||||
* @param searchString
|
*
|
||||||
* the seach strings
|
* @param searchString the seach strings
|
||||||
* @return the query
|
* @return the query
|
||||||
*/
|
*/
|
||||||
WorkbasketQuery keyOrNameLike(String... searchString);
|
WorkbasketQuery keyOrNameLike(String... searchString);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add your domains to your query.
|
* Add your domains to your query.
|
||||||
*
|
*
|
||||||
* @param domain
|
* @param domain the domains as Strings
|
||||||
* the domains as Strings
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
WorkbasketQuery domainIn(String... domain);
|
||||||
WorkbasketQuery domainIn(String... domain);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add your types to your query.
|
* Add your types to your query.
|
||||||
*
|
*
|
||||||
* @param type
|
* @param type the types
|
||||||
* the types
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
WorkbasketQuery typeIn(WorkbasketType... type);
|
||||||
WorkbasketQuery typeIn(WorkbasketType... type);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add the time intervals within which the workbasket was created to your query. For each time interval, the
|
* Add the time intervals within which the workbasket was created to your query. For each time
|
||||||
* database query will search for workbaskets whose created timestamp is after or at the interval's begin and before
|
* interval, the database query will search for workbaskets whose created timestamp is after or at
|
||||||
* or at the interval's end. If more than one interval is specified, the query will connect them with the OR
|
* the interval's begin and before or at the interval's end. If more than one interval is
|
||||||
* keyword. If either begin or end of an interval are null, these values will not be specified in the query.
|
* specified, the query will connect them with the OR keyword. If either begin or end of an
|
||||||
*
|
* interval are null, these values will not be specified in the query.
|
||||||
* @param intervals
|
*
|
||||||
* - the TimeIntervals within which the workbasket was created
|
* @param intervals - the TimeIntervals within which the workbasket was created
|
||||||
* @return the query
|
* @return the query
|
||||||
*/
|
*/
|
||||||
WorkbasketQuery createdWithin(TimeInterval... intervals);
|
WorkbasketQuery createdWithin(TimeInterval... intervals);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add the time intervals within which the workbasket was modified to your query. For each time interval, the
|
* Add the time intervals within which the workbasket was modified to your query. For each time
|
||||||
* database query will search for workbaskets whose created timestamp is after or at the interval's begin and before
|
* interval, the database query will search for workbaskets whose created timestamp is after or at
|
||||||
* or at the interval's end. If more than one interval is specified, the query will connect them with the OR
|
* the interval's begin and before or at the interval's end. If more than one interval is
|
||||||
* keyword. If either begin or end of an interval are null, these values will not be specified in the query.
|
* specified, the query will connect them with the OR keyword. If either begin or end of an
|
||||||
*
|
* interval are null, these values will not be specified in the query.
|
||||||
* @param intervals
|
*
|
||||||
* - the TimeIntervals within which the workbasket was created
|
* @param intervals - the TimeIntervals within which the workbasket was created
|
||||||
* @return the query
|
* @return the query
|
||||||
*/
|
*/
|
||||||
WorkbasketQuery modifiedWithin(TimeInterval... intervals);
|
WorkbasketQuery modifiedWithin(TimeInterval... intervals);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add your description to your query. It will be compared case-insensitively to the descriptions of workbaskets
|
* Add your description to your query. It will be compared case-insensitively to the descriptions
|
||||||
* using the LIKE operator. You may use a wildcard like '%' to search generically. If you specify multiple arguments
|
* of workbaskets using the LIKE operator. You may use a wildcard like '%' to search generically.
|
||||||
* they are combined with the OR keyword.
|
* If you specify multiple arguments they are combined with the OR keyword.
|
||||||
*
|
*
|
||||||
* @param description
|
* @param description your description
|
||||||
* your description
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
WorkbasketQuery descriptionLike(String... description);
|
||||||
WorkbasketQuery descriptionLike(String... description);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add the owners to your query.
|
* Add the owners to your query.
|
||||||
*
|
*
|
||||||
* @param owners
|
* @param owners the owners as String
|
||||||
* the owners as String
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
WorkbasketQuery ownerIn(String... owners);
|
||||||
WorkbasketQuery ownerIn(String... owners);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add the owners for pattern matching to your query. It will be compared in SQL with the LIKE operator. You may use
|
* Add the owners for pattern matching to your query. It will be compared in SQL with the LIKE
|
||||||
* a wildcard like % to specify the pattern. If you specify multiple arguments they are combined with the OR
|
* operator. You may use a wildcard like % to specify the pattern. If you specify multiple
|
||||||
* keyword.
|
* arguments they are combined with the OR keyword.
|
||||||
*
|
*
|
||||||
* @param owners
|
* @param owners the owners as Strings
|
||||||
* the owners as Strings
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
WorkbasketQuery ownerLike(String... owners);
|
||||||
WorkbasketQuery ownerLike(String... owners);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setting up the permission which should be granted on the result workbaskets and the users which should be
|
* Setting up the permission which should be granted on the result workbaskets and the users which
|
||||||
* checked. READ permission will always be checked by default.<br>
|
* should be checked. READ permission will always be checked by default.<br>
|
||||||
* The AccessIds and the given permission will throw a Exception if they would be NULL.
|
* The AccessIds and the given permission will throw a Exception if they would be NULL.
|
||||||
*
|
*
|
||||||
* @param permission
|
* @param permission which should be used for results.
|
||||||
* which should be used for results.
|
* @param accessIds Users which sould be checked for given permissions on workbaskets.
|
||||||
* @param accessIds
|
* @return the current query object.
|
||||||
* Users which sould be checked for given permissions on workbaskets.
|
* @throws InvalidArgumentException when permission OR the accessIds are NULL.
|
||||||
* @return the current query object.
|
* @throws NotAuthorizedException if the current user is not member of role BUSINESS_ADMIN or
|
||||||
* @throws InvalidArgumentException
|
* ADMIN
|
||||||
* when permission OR the accessIds are NULL.
|
*/
|
||||||
* @throws NotAuthorizedException
|
WorkbasketQuery accessIdsHavePermission(WorkbasketPermission permission, String... accessIds)
|
||||||
* if the current user is not member of role BUSINESS_ADMIN or ADMIN
|
throws InvalidArgumentException, NotAuthorizedException;
|
||||||
*/
|
|
||||||
WorkbasketQuery accessIdsHavePermission(WorkbasketPermission permission, String... accessIds)
|
|
||||||
throws InvalidArgumentException, NotAuthorizedException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add condition to query if the caller (one of the accessIds of the caller) has the given permission on the
|
* Add condition to query if the caller (one of the accessIds of the caller) has the given
|
||||||
* workbasket.
|
* permission on the workbasket.
|
||||||
*
|
*
|
||||||
* @return the updated query.
|
* @return the updated query.
|
||||||
* @param permission
|
* @param permission the permission for the query condition.
|
||||||
* the permission for the query condition.
|
*/
|
||||||
*/
|
WorkbasketQuery callerHasPermission(WorkbasketPermission permission);
|
||||||
WorkbasketQuery callerHasPermission(WorkbasketPermission permission);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sort the query result by name.
|
* Sort the query result by name.
|
||||||
*
|
*
|
||||||
* @param sortDirection
|
* @param sortDirection Determines whether the result is sorted in ascending or descending order.
|
||||||
* Determines whether the result is sorted in ascending or descending order. If sortDirection is null,
|
* If sortDirection is null, the result is sorted in ascending order
|
||||||
* the result is sorted in ascending order
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
WorkbasketQuery orderByName(SortDirection sortDirection);
|
||||||
WorkbasketQuery orderByName(SortDirection sortDirection);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sort the query result by key.
|
* Sort the query result by key.
|
||||||
*
|
*
|
||||||
* @param sortDirection
|
* @param sortDirection Determines whether the result is sorted in ascending or descending order.
|
||||||
* Determines whether the result is sorted in ascending or descending order. If sortDirection is null,
|
* If sortDirection is null, the result is sorted in ascending order
|
||||||
* the result is sorted in ascending order
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
WorkbasketQuery orderByKey(SortDirection sortDirection);
|
||||||
WorkbasketQuery orderByKey(SortDirection sortDirection);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sort the query result by description.
|
* Sort the query result by description.
|
||||||
*
|
*
|
||||||
* @param sortDirection
|
* @param sortDirection Determines whether the result is sorted in ascending or descending order.
|
||||||
* Determines whether the result is sorted in ascending or descending order. If sortDirection is null,
|
* If sortDirection is null, the result is sorted in ascending order
|
||||||
* the result is sorted in ascending order
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
WorkbasketQuery orderByDescription(SortDirection sortDirection);
|
||||||
WorkbasketQuery orderByDescription(SortDirection sortDirection);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sort the query result by owner.
|
* Sort the query result by owner.
|
||||||
*
|
*
|
||||||
* @param sortDirection
|
* @param sortDirection Determines whether the result is sorted in ascending or descending order.
|
||||||
* Determines whether the result is sorted in ascending or descending order. If sortDirection is null,
|
* If sortDirection is null, the result is sorted in ascending order
|
||||||
* the result is sorted in ascending order
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
WorkbasketQuery orderByOwner(SortDirection sortDirection);
|
||||||
WorkbasketQuery orderByOwner(SortDirection sortDirection);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sort the query result by type.
|
* Sort the query result by type.
|
||||||
*
|
*
|
||||||
* @param sortDirection
|
* @param sortDirection Determines whether the result is sorted in ascending or descending order.
|
||||||
* Determines whether the result is sorted in ascending or descending order. If sortDirection is null,
|
* If sortDirection is null, the result is sorted in ascending order
|
||||||
* the result is sorted in ascending order
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
WorkbasketQuery orderByType(SortDirection sortDirection);
|
||||||
WorkbasketQuery orderByType(SortDirection sortDirection);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sort the query result by domain.
|
* Sort the query result by domain.
|
||||||
*
|
*
|
||||||
* @param sortDirection
|
* @param sortDirection Determines whether the result is sorted in ascending or descending order.
|
||||||
* Determines whether the result is sorted in ascending or descending order. If sortDirection is null,
|
* If sortDirection is null, the result is sorted in ascending order
|
||||||
* the result is sorted in ascending order
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
WorkbasketQuery orderByDomain(SortDirection sortDirection);
|
||||||
WorkbasketQuery orderByDomain(SortDirection sortDirection);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add the domains for pattern matching to your query. It will be compared in SQL with the LIKE operator. You may
|
* Add the domains for pattern matching to your query. It will be compared in SQL with the LIKE
|
||||||
* use a wildcard like % to specify the pattern. If you specify multiple arguments they are combined with the OR
|
* operator. You may use a wildcard like % to specify the pattern. If you specify multiple
|
||||||
* keyword.
|
* arguments they are combined with the OR keyword.
|
||||||
*
|
*
|
||||||
* @param domain
|
* @param domain the domains of workbaskets as Strings
|
||||||
* the domains of workbaskets as Strings
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
WorkbasketQuery domainLike(String... domain);
|
||||||
WorkbasketQuery domainLike(String... domain);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sort the query result by custom property 1.
|
* Sort the query result by custom property 1.
|
||||||
*
|
*
|
||||||
* @param sortDirection
|
* @param sortDirection Determines whether the result is sorted in ascending or descending order.
|
||||||
* Determines whether the result is sorted in ascending or descending order. If sortDirection is null,
|
* If sortDirection is null, the result is sorted in ascending order
|
||||||
* the result is sorted in ascending order
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
WorkbasketQuery orderByCustom1(SortDirection sortDirection);
|
||||||
WorkbasketQuery orderByCustom1(SortDirection sortDirection);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sort the query result by custom property 2.
|
* Sort the query result by custom property 2.
|
||||||
*
|
*
|
||||||
* @param sortDirection
|
* @param sortDirection Determines whether the result is sorted in ascending or descending order.
|
||||||
* Determines whether the result is sorted in ascending or descending order. If sortDirection is null,
|
* If sortDirection is null, the result is sorted in ascending order
|
||||||
* the result is sorted in ascending order
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
WorkbasketQuery orderByCustom2(SortDirection sortDirection);
|
||||||
WorkbasketQuery orderByCustom2(SortDirection sortDirection);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sort the query result by custom property 3.
|
* Sort the query result by custom property 3.
|
||||||
*
|
*
|
||||||
* @param sortDirection
|
* @param sortDirection Determines whether the result is sorted in ascending or descending order.
|
||||||
* Determines whether the result is sorted in ascending or descending order. If sortDirection is null,
|
* If sortDirection is null, the result is sorted in ascending order
|
||||||
* the result is sorted in ascending order
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
WorkbasketQuery orderByCustom3(SortDirection sortDirection);
|
||||||
WorkbasketQuery orderByCustom3(SortDirection sortDirection);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sort the query result by custom property 4.
|
* Sort the query result by custom property 4.
|
||||||
*
|
*
|
||||||
* @param sortDirection
|
* @param sortDirection Determines whether the result is sorted in ascending or descending order.
|
||||||
* Determines whether the result is sorted in ascending or descending order. If sortDirection is null,
|
* If sortDirection is null, the result is sorted in ascending order
|
||||||
* the result is sorted in ascending order
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
WorkbasketQuery orderByCustom4(SortDirection sortDirection);
|
||||||
WorkbasketQuery orderByCustom4(SortDirection sortDirection);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sort the query result by organization level 1.
|
* Sort the query result by organization level 1.
|
||||||
*
|
*
|
||||||
* @param sortDirection
|
* @param sortDirection Determines whether the result is sorted in ascending or descending order.
|
||||||
* Determines whether the result is sorted in ascending or descending order. If sortDirection is null,
|
* If sortDirection is null, the result is sorted in ascending order
|
||||||
* the result is sorted in ascending order
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
WorkbasketQuery orderByOrgLevel1(SortDirection sortDirection);
|
||||||
WorkbasketQuery orderByOrgLevel1(SortDirection sortDirection);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sort the query result by organization level 2.
|
* Sort the query result by organization level 2.
|
||||||
*
|
*
|
||||||
* @param sortDirection
|
* @param sortDirection Determines whether the result is sorted in ascending or descending order.
|
||||||
* Determines whether the result is sorted in ascending or descending order. If sortDirection is null,
|
* If sortDirection is null, the result is sorted in ascending order
|
||||||
* the result is sorted in ascending order
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
WorkbasketQuery orderByOrgLevel2(SortDirection sortDirection);
|
||||||
WorkbasketQuery orderByOrgLevel2(SortDirection sortDirection);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sort the query result by organization level 3.
|
* Sort the query result by organization level 3.
|
||||||
*
|
*
|
||||||
* @param sortDirection
|
* @param sortDirection Determines whether the result is sorted in ascending or descending order.
|
||||||
* Determines whether the result is sorted in ascending or descending order. If sortDirection is null,
|
* If sortDirection is null, the result is sorted in ascending order
|
||||||
* the result is sorted in ascending order
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
WorkbasketQuery orderByOrgLevel3(SortDirection sortDirection);
|
||||||
WorkbasketQuery orderByOrgLevel3(SortDirection sortDirection);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sort the query result by organization level 4.
|
* Sort the query result by organization level 4.
|
||||||
*
|
*
|
||||||
* @param sortDirection
|
* @param sortDirection Determines whether the result is sorted in ascending or descending order.
|
||||||
* Determines whether the result is sorted in ascending or descending order. If sortDirection is null,
|
* If sortDirection is null, the result is sorted in ascending order
|
||||||
* the result is sorted in ascending order
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
WorkbasketQuery orderByOrgLevel4(SortDirection sortDirection);
|
||||||
WorkbasketQuery orderByOrgLevel4(SortDirection sortDirection);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add the 1st custom property to your query.
|
* Add the 1st custom property to your query.
|
||||||
*
|
*
|
||||||
* @param custom1
|
* @param custom1 the 1st custom property as String
|
||||||
* the 1st custom property as String
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
WorkbasketQuery custom1In(String... custom1);
|
||||||
WorkbasketQuery custom1In(String... custom1);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add the 1st custom property for pattern matching to your query. It will be compared in SQL with the LIKE
|
* Add the 1st custom property for pattern matching to your query. It will be compared in SQL with
|
||||||
* operator. You may use a wildcard like % to specify the pattern. If you specify multiple arguments they are
|
* the LIKE operator. You may use a wildcard like % to specify the pattern. If you specify
|
||||||
* combined with the OR keyword.
|
* multiple arguments they are combined with the OR keyword.
|
||||||
*
|
*
|
||||||
* @param custom1
|
* @param custom1 the 1st custom property of workbaskets as Strings
|
||||||
* the 1st custom property of workbaskets as Strings
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
WorkbasketQuery custom1Like(String... custom1);
|
||||||
WorkbasketQuery custom1Like(String... custom1);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add the 2nd custom property to your query.
|
* Add the 2nd custom property to your query.
|
||||||
*
|
*
|
||||||
* @param custom2
|
* @param custom2 the 2nd custom property as String
|
||||||
* the 2nd custom property as String
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
WorkbasketQuery custom2In(String... custom2);
|
||||||
WorkbasketQuery custom2In(String... custom2);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add the 2nd custom property for pattern matching to your query. It will be compared in SQL with the LIKE
|
* Add the 2nd custom property for pattern matching to your query. It will be compared in SQL with
|
||||||
* operator. You may use a wildcard like % to specify the pattern. If you specify multiple arguments they are
|
* the LIKE operator. You may use a wildcard like % to specify the pattern. If you specify
|
||||||
* combined with the OR keyword.
|
* multiple arguments they are combined with the OR keyword.
|
||||||
*
|
*
|
||||||
* @param custom2
|
* @param custom2 the 2nd custom property of workbaskets as Strings
|
||||||
* the 2nd custom property of workbaskets as Strings
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
WorkbasketQuery custom2Like(String... custom2);
|
||||||
WorkbasketQuery custom2Like(String... custom2);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add the 3rd custom property to your query.
|
* Add the 3rd custom property to your query.
|
||||||
*
|
*
|
||||||
* @param custom3
|
* @param custom3 the 3rd custom property as String
|
||||||
* the 3rd custom property as String
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
WorkbasketQuery custom3In(String... custom3);
|
||||||
WorkbasketQuery custom3In(String... custom3);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add the 3rd custom property for pattern matching to your query. It will be compared in SQL with the LIKE
|
* Add the 3rd custom property for pattern matching to your query. It will be compared in SQL with
|
||||||
* operator. You may use a wildcard like % to specify the pattern. If you specify multiple arguments they are
|
* the LIKE operator. You may use a wildcard like % to specify the pattern. If you specify
|
||||||
* combined with the OR keyword.
|
* multiple arguments they are combined with the OR keyword.
|
||||||
*
|
*
|
||||||
* @param custom3
|
* @param custom3 the 3rd custom property of workbaskets as Strings
|
||||||
* the 3rd custom property of workbaskets as Strings
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
WorkbasketQuery custom3Like(String... custom3);
|
||||||
WorkbasketQuery custom3Like(String... custom3);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add the 4th custom property to your query.
|
* Add the 4th custom property to your query.
|
||||||
*
|
*
|
||||||
* @param custom4
|
* @param custom4 the 4th custom property as String
|
||||||
* the 4th custom property as String
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
WorkbasketQuery custom4In(String... custom4);
|
||||||
WorkbasketQuery custom4In(String... custom4);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add the 4th custom property for pattern matching to your query. It will be compared in SQL with the LIKE
|
* Add the 4th custom property for pattern matching to your query. It will be compared in SQL with
|
||||||
* operator. You may use a wildcard like % to specify the pattern. If you specify multiple arguments they are
|
* the LIKE operator. You may use a wildcard like % to specify the pattern. If you specify
|
||||||
* combined with the OR keyword.
|
* multiple arguments they are combined with the OR keyword.
|
||||||
*
|
*
|
||||||
* @param custom4
|
* @param custom4 the 4th custom property of workbaskets as Strings
|
||||||
* the 4th custom property of workbaskets as Strings
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
WorkbasketQuery custom4Like(String... custom4);
|
||||||
WorkbasketQuery custom4Like(String... custom4);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add the 1st organization level to your query.
|
* Add the 1st organization level to your query.
|
||||||
*
|
*
|
||||||
* @param orgLevel1
|
* @param orgLevel1 the 1st organization level as String
|
||||||
* the 1st organization level as String
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
WorkbasketQuery orgLevel1In(String... orgLevel1);
|
||||||
WorkbasketQuery orgLevel1In(String... orgLevel1);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add the 1st organization level for pattern matching to your query. It will be compared in SQL with the LIKE
|
* Add the 1st organization level for pattern matching to your query. It will be compared in SQL
|
||||||
* operator. You may use a wildcard like % to specify the pattern. If you specify multiple arguments they are
|
* with the LIKE operator. You may use a wildcard like % to specify the pattern. If you specify
|
||||||
* combined with the OR keyword.
|
* multiple arguments they are combined with the OR keyword.
|
||||||
*
|
*
|
||||||
* @param orgLevel1
|
* @param orgLevel1 the 1st organization level as Strings
|
||||||
* the 1st organization level as Strings
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
WorkbasketQuery orgLevel1Like(String... orgLevel1);
|
||||||
WorkbasketQuery orgLevel1Like(String... orgLevel1);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add the 2nd organization level to your query.
|
* Add the 2nd organization level to your query.
|
||||||
*
|
*
|
||||||
* @param orgLevel2
|
* @param orgLevel2 the 2nd organization level as String
|
||||||
* the 2nd organization level as String
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
WorkbasketQuery orgLevel2In(String... orgLevel2);
|
||||||
WorkbasketQuery orgLevel2In(String... orgLevel2);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add the 2nd organization level for pattern matching to your query. It will be compared in SQL with the LIKE
|
* Add the 2nd organization level for pattern matching to your query. It will be compared in SQL
|
||||||
* operator. You may use a wildcard like % to specify the pattern. If you specify multiple arguments they are
|
* with the LIKE operator. You may use a wildcard like % to specify the pattern. If you specify
|
||||||
* combined with the OR keyword.
|
* multiple arguments they are combined with the OR keyword.
|
||||||
*
|
*
|
||||||
* @param orgLevel2
|
* @param orgLevel2 the 2nd organization level as Strings
|
||||||
* the 2nd organization level as Strings
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
WorkbasketQuery orgLevel2Like(String... orgLevel2);
|
||||||
WorkbasketQuery orgLevel2Like(String... orgLevel2);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add the 3rd organization level to your query.
|
* Add the 3rd organization level to your query.
|
||||||
*
|
*
|
||||||
* @param orgLevel3
|
* @param orgLevel3 the 3rd organization level as String
|
||||||
* the 3rd organization level as String
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
WorkbasketQuery orgLevel3In(String... orgLevel3);
|
||||||
WorkbasketQuery orgLevel3In(String... orgLevel3);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add the 3rd organization level for pattern matching to your query. It will be compared in SQL with the LIKE
|
* Add the 3rd organization level for pattern matching to your query. It will be compared in SQL
|
||||||
* operator. You may use a wildcard like % to specify the pattern. If you specify multiple arguments they are
|
* with the LIKE operator. You may use a wildcard like % to specify the pattern. If you specify
|
||||||
* combined with the OR keyword.
|
* multiple arguments they are combined with the OR keyword.
|
||||||
*
|
*
|
||||||
* @param orgLevel3
|
* @param orgLevel3 the 3rd organization level as Strings
|
||||||
* the 3rd organization level as Strings
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
WorkbasketQuery orgLevel3Like(String... orgLevel3);
|
||||||
WorkbasketQuery orgLevel3Like(String... orgLevel3);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add the 4th organization level to your query.
|
* Add the 4th organization level to your query.
|
||||||
*
|
*
|
||||||
* @param orgLevel4
|
* @param orgLevel4 the 4th organization level as String
|
||||||
* the 4th organization level as String
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
WorkbasketQuery orgLevel4In(String... orgLevel4);
|
||||||
WorkbasketQuery orgLevel4In(String... orgLevel4);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add the 4th organization level for pattern matching to your query. It will be compared in SQL with the LIKE
|
* Add the 4th organization level for pattern matching to your query. It will be compared in SQL
|
||||||
* operator. You may use a wildcard like % to specify the pattern. If you specify multiple arguments they are
|
* with the LIKE operator. You may use a wildcard like % to specify the pattern. If you specify
|
||||||
* combined with the OR keyword.
|
* multiple arguments they are combined with the OR keyword.
|
||||||
*
|
*
|
||||||
* @param orgLevel4
|
* @param orgLevel4 the 4th organization level as Strings
|
||||||
* the 4th organization level as Strings
|
* @return the query
|
||||||
* @return the query
|
*/
|
||||||
*/
|
WorkbasketQuery orgLevel4Like(String... orgLevel4);
|
||||||
WorkbasketQuery orgLevel4Like(String... orgLevel4);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add to your query if the Workbasket shall be marked for deletion.
|
|
||||||
*
|
|
||||||
* @param markedForDeletion
|
|
||||||
* a simple flag showing if the workbasket is marked for deletion
|
|
||||||
* @return the query
|
|
||||||
*/
|
|
||||||
WorkbasketQuery markedForDeletion(boolean markedForDeletion);
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add to your query if the Workbasket shall be marked for deletion.
|
||||||
|
*
|
||||||
|
* @param markedForDeletion a simple flag showing if the workbasket is marked for deletion
|
||||||
|
* @return the query
|
||||||
|
*/
|
||||||
|
WorkbasketQuery markedForDeletion(boolean markedForDeletion);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,34 +1,35 @@
|
||||||
package pro.taskana;
|
package pro.taskana;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enum containing the column names for @see {@link pro.taskana.mappings.QueryMapper#queryWorkbasketColumnValues(pro.taskana.impl.WorkbasketQueryImpl)}.
|
* Enum containing the column names for @see {@link
|
||||||
|
* pro.taskana.mappings.QueryMapper#queryWorkbasketColumnValues(pro.taskana.impl.WorkbasketQueryImpl)}.
|
||||||
*
|
*
|
||||||
* @author jsa
|
* @author jsa
|
||||||
*/
|
*/
|
||||||
public enum WorkbasketQueryColumnName implements QueryColumnName {
|
public enum WorkbasketQueryColumnName implements QueryColumnName {
|
||||||
|
OWNER("w.owner"),
|
||||||
|
ID("w.id"),
|
||||||
|
KEY("w.key"),
|
||||||
|
NAME("w.name"),
|
||||||
|
DOMAIN("w.domain"),
|
||||||
|
TYPE("w.type"),
|
||||||
|
CUSTOM_1("w.custom_1"),
|
||||||
|
CUSTOM_2("w.custom_2"),
|
||||||
|
CUSTOM_3("w.custom_3"),
|
||||||
|
CUSTOM_4("w.custom_4"),
|
||||||
|
ORG_LEVEL_1("w.org_level_1"),
|
||||||
|
ORG_LEVEL_2("w.org_level_2"),
|
||||||
|
ORG_LEVEL_3("w.org_level_3"),
|
||||||
|
ORG_LEVEL_4("w.org_level_4");
|
||||||
|
|
||||||
OWNER("w.owner"),
|
private String name;
|
||||||
ID("w.id"),
|
|
||||||
KEY("w.key"),
|
|
||||||
NAME("w.name"),
|
|
||||||
DOMAIN("w.domain"),
|
|
||||||
TYPE("w.type"),
|
|
||||||
CUSTOM_1("w.custom_1"),
|
|
||||||
CUSTOM_2("w.custom_2"),
|
|
||||||
CUSTOM_3("w.custom_3"),
|
|
||||||
CUSTOM_4("w.custom_4"),
|
|
||||||
ORG_LEVEL_1("w.org_level_1"),
|
|
||||||
ORG_LEVEL_2("w.org_level_2"),
|
|
||||||
ORG_LEVEL_3("w.org_level_3"),
|
|
||||||
ORG_LEVEL_4("w.org_level_4");
|
|
||||||
|
|
||||||
private String name;
|
WorkbasketQueryColumnName(String name) {
|
||||||
WorkbasketQueryColumnName(String name) {
|
this.name = name;
|
||||||
this.name = name;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,366 +11,315 @@ import pro.taskana.exceptions.WorkbasketAlreadyExistException;
|
||||||
import pro.taskana.exceptions.WorkbasketInUseException;
|
import pro.taskana.exceptions.WorkbasketInUseException;
|
||||||
import pro.taskana.exceptions.WorkbasketNotFoundException;
|
import pro.taskana.exceptions.WorkbasketNotFoundException;
|
||||||
|
|
||||||
/**
|
/** This service manages Workbaskets. */
|
||||||
* This service manages Workbaskets.
|
|
||||||
*/
|
|
||||||
public interface WorkbasketService {
|
public interface WorkbasketService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Workbasket for a given id.
|
* Get Workbasket for a given id.
|
||||||
*
|
*
|
||||||
* @param workbasketId
|
* @param workbasketId the Id of the Workbasket requested
|
||||||
* the Id of the Workbasket requested
|
* @return the requested Workbasket
|
||||||
* @return the requested Workbasket
|
* @throws WorkbasketNotFoundException If the Workbasket with workbasketId is not found
|
||||||
* @throws WorkbasketNotFoundException
|
* @throws NotAuthorizedException If the current user or group does not have the permissions for
|
||||||
* If the Workbasket with workbasketId is not found
|
* interactions.
|
||||||
* @throws NotAuthorizedException
|
*/
|
||||||
* If the current user or group does not have the permissions for interactions.
|
Workbasket getWorkbasket(String workbasketId)
|
||||||
*/
|
throws WorkbasketNotFoundException, NotAuthorizedException;
|
||||||
Workbasket getWorkbasket(String workbasketId)
|
|
||||||
throws WorkbasketNotFoundException, NotAuthorizedException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Workbasket for a given key.
|
* Get Workbasket for a given key.
|
||||||
*
|
*
|
||||||
* @param workbasketKey
|
* @param workbasketKey the Key of the Workbasket requested
|
||||||
* the Key of the Workbasket requested
|
* @param domain the domain of the workbasket
|
||||||
* @param domain
|
* @return the requested Workbasket
|
||||||
* the domain of the workbasket
|
* @throws WorkbasketNotFoundException If the Workbasket with workbasketId is not found
|
||||||
* @return the requested Workbasket
|
* @throws NotAuthorizedException If the current user or group does not have the permissions for
|
||||||
* @throws WorkbasketNotFoundException
|
* interactions.
|
||||||
* If the Workbasket with workbasketId is not found
|
*/
|
||||||
* @throws NotAuthorizedException
|
Workbasket getWorkbasket(String workbasketKey, String domain)
|
||||||
* If the current user or group does not have the permissions for interactions.
|
throws WorkbasketNotFoundException, NotAuthorizedException;
|
||||||
*/
|
|
||||||
Workbasket getWorkbasket(String workbasketKey, String domain)
|
|
||||||
throws WorkbasketNotFoundException, NotAuthorizedException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new Workbasket.
|
* Create a new Workbasket.
|
||||||
*
|
*
|
||||||
* @param workbasket
|
* @param workbasket The Workbasket to create
|
||||||
* The Workbasket to create
|
* @return the created and persisted Workbasket
|
||||||
* @return the created and persisted Workbasket
|
* @throws InvalidWorkbasketException If a required property of the Workbasket is not set.
|
||||||
* @throws InvalidWorkbasketException
|
* @throws NotAuthorizedException if the current user is not member of role BUSINESS_ADMIN or
|
||||||
* If a required property of the Workbasket is not set.
|
* ADMIN
|
||||||
* @throws NotAuthorizedException
|
* @throws WorkbasketAlreadyExistException if the workbasket exists already
|
||||||
* if the current user is not member of role BUSINESS_ADMIN or ADMIN
|
* @throws DomainNotFoundException if the domain does not exist in the configuration.
|
||||||
* @throws WorkbasketAlreadyExistException
|
*/
|
||||||
* if the workbasket exists already
|
Workbasket createWorkbasket(Workbasket workbasket)
|
||||||
* @throws DomainNotFoundException
|
throws InvalidWorkbasketException, NotAuthorizedException, WorkbasketAlreadyExistException,
|
||||||
* if the domain does not exist in the configuration.
|
DomainNotFoundException;
|
||||||
*/
|
|
||||||
Workbasket createWorkbasket(Workbasket workbasket)
|
|
||||||
throws InvalidWorkbasketException, NotAuthorizedException, WorkbasketAlreadyExistException,
|
|
||||||
DomainNotFoundException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update a Workbasket.
|
* Update a Workbasket.
|
||||||
*
|
*
|
||||||
* @param workbasket
|
* @param workbasket The Workbasket to update
|
||||||
* The Workbasket to update
|
* @return the updated Workbasket
|
||||||
* @return the updated Workbasket
|
* @throws NotAuthorizedException if the current user is not authorized to update the work basket
|
||||||
* @throws NotAuthorizedException
|
*/
|
||||||
* if the current user is not authorized to update the work basket
|
Workbasket updateWorkbasket(Workbasket workbasket) throws NotAuthorizedException;
|
||||||
*/
|
|
||||||
Workbasket updateWorkbasket(Workbasket workbasket)
|
|
||||||
throws NotAuthorizedException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a new WorkbasketAccessItem which is not persisted.
|
* Returns a new WorkbasketAccessItem which is not persisted.
|
||||||
*
|
*
|
||||||
* @param workbasketId
|
* @param workbasketId the workbasket id used to identify the referenced workbasket
|
||||||
* the workbasket id used to identify the referenced workbasket
|
* @param accessId the group id or user id for which access is controlled
|
||||||
* @param accessId
|
* @return new WorkbasketAccessItem
|
||||||
* the group id or user id for which access is controlled
|
*/
|
||||||
* @return new WorkbasketAccessItem
|
WorkbasketAccessItem newWorkbasketAccessItem(String workbasketId, String accessId);
|
||||||
*/
|
|
||||||
WorkbasketAccessItem newWorkbasketAccessItem(String workbasketId, String accessId);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create and persist a new {@link WorkbasketAccessItem} with a WorkbasketId, an accessId and permissions.
|
* Create and persist a new {@link WorkbasketAccessItem} with a WorkbasketId, an accessId and
|
||||||
*
|
* permissions.
|
||||||
* @param workbasketAccessItem
|
*
|
||||||
* the new workbasketAccessItem
|
* @param workbasketAccessItem the new workbasketAccessItem
|
||||||
* @return the created WorkbasketAccessItem
|
* @return the created WorkbasketAccessItem
|
||||||
* @throws InvalidArgumentException
|
* @throws InvalidArgumentException when the preconditions dont match the required ones.
|
||||||
* when the preconditions dont match the required ones.
|
* @throws NotAuthorizedException if the current user is not member of role BUSINESS_ADMIN or
|
||||||
* @throws NotAuthorizedException
|
* ADMIN
|
||||||
* if the current user is not member of role BUSINESS_ADMIN or ADMIN
|
* @throws WorkbasketNotFoundException if the workbasketAccessItem refers to a not existing
|
||||||
* @throws WorkbasketNotFoundException
|
* workbasket
|
||||||
* if the workbasketAccessItem refers to a not existing workbasket
|
*/
|
||||||
*/
|
WorkbasketAccessItem createWorkbasketAccessItem(WorkbasketAccessItem workbasketAccessItem)
|
||||||
WorkbasketAccessItem createWorkbasketAccessItem(WorkbasketAccessItem workbasketAccessItem)
|
throws InvalidArgumentException, NotAuthorizedException, WorkbasketNotFoundException;
|
||||||
throws InvalidArgumentException, NotAuthorizedException, WorkbasketNotFoundException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method updates a {@link WorkbasketAccessItem}.
|
* This method updates a {@link WorkbasketAccessItem}.
|
||||||
*
|
*
|
||||||
* @param workbasketAccessItem
|
* @param workbasketAccessItem the {@link WorkbasketAccessItem}
|
||||||
* the {@link WorkbasketAccessItem}
|
* @return the updated entity
|
||||||
* @return the updated entity
|
* @throws InvalidArgumentException if accessid or workbasketId is changed in the
|
||||||
* @throws InvalidArgumentException
|
* workbasketAccessItem
|
||||||
* if accessid or workbasketId is changed in the workbasketAccessItem
|
* @throws NotAuthorizedException if the current user is not member of role BUSINESS_ADMIN or
|
||||||
* @throws NotAuthorizedException
|
* ADMIN
|
||||||
* if the current user is not member of role BUSINESS_ADMIN or ADMIN
|
*/
|
||||||
*/
|
WorkbasketAccessItem updateWorkbasketAccessItem(WorkbasketAccessItem workbasketAccessItem)
|
||||||
WorkbasketAccessItem updateWorkbasketAccessItem(WorkbasketAccessItem workbasketAccessItem)
|
throws InvalidArgumentException, NotAuthorizedException;
|
||||||
throws InvalidArgumentException, NotAuthorizedException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes a specific {@link WorkbasketAccessItem}.
|
* Deletes a specific {@link WorkbasketAccessItem}.
|
||||||
*
|
*
|
||||||
* @param id
|
* @param id the id of the WorbasketAccessItem to be deleted
|
||||||
* the id of the WorbasketAccessItem to be deleted
|
* @throws NotAuthorizedException if the current user is not member of role BUSINESS_ADMIN or
|
||||||
* @throws NotAuthorizedException
|
* ADMIN
|
||||||
* if the current user is not member of role BUSINESS_ADMIN or ADMIN
|
*/
|
||||||
*/
|
void deleteWorkbasketAccessItem(String id) throws NotAuthorizedException;
|
||||||
void deleteWorkbasketAccessItem(String id) throws NotAuthorizedException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method checks the authorization for the actual User.
|
* This method checks the authorization for the actual User.
|
||||||
*
|
*
|
||||||
* @param workbasketId
|
* @param workbasketId the id of the workbasket we want to access
|
||||||
* the id of the workbasket we want to access
|
* @param permission the needed {@link WorkbasketPermission} If more than one permission is
|
||||||
* @param permission
|
* specified, the current user needs all of them.
|
||||||
* the needed {@link WorkbasketPermission} If more than one permission is specified, the current user
|
* @throws NotAuthorizedException if the current user has not the requested authorization for the
|
||||||
* needs all of them.
|
* specified workbasket
|
||||||
* @throws NotAuthorizedException
|
* @throws WorkbasketNotFoundException if the workbasket cannot be found for the given ID.
|
||||||
* if the current user has not the requested authorization for the specified workbasket
|
*/
|
||||||
* @throws WorkbasketNotFoundException
|
void checkAuthorization(String workbasketId, WorkbasketPermission... permission)
|
||||||
* if the workbasket cannot be found for the given ID.
|
throws NotAuthorizedException, WorkbasketNotFoundException;
|
||||||
*/
|
|
||||||
void checkAuthorization(String workbasketId, WorkbasketPermission... permission)
|
|
||||||
throws NotAuthorizedException, WorkbasketNotFoundException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method checks the authorization for the actual User.
|
* This method checks the authorization for the actual User.
|
||||||
*
|
*
|
||||||
* @param workbasketKey
|
* @param workbasketKey the key of the workbasket we want to access
|
||||||
* the key of the workbasket we want to access
|
* @param domain the domain of the workbasket we want to access
|
||||||
* @param domain
|
* @param permission the needed {@link WorkbasketPermission}. If more than one permission is
|
||||||
* the domain of the workbasket we want to access
|
* specified, the current user needs all of them.
|
||||||
* @param permission
|
* @throws NotAuthorizedException if the current user has not the requested permission for the
|
||||||
* the needed {@link WorkbasketPermission}. If more than one permission is specified, the current user
|
* specified workbasket
|
||||||
* needs all of them.
|
* @throws WorkbasketNotFoundException if no workbasket can be found for the given key+domain
|
||||||
* @throws NotAuthorizedException
|
* values.
|
||||||
* if the current user has not the requested permission for the specified workbasket
|
*/
|
||||||
* @throws WorkbasketNotFoundException
|
void checkAuthorization(String workbasketKey, String domain, WorkbasketPermission... permission)
|
||||||
* if no workbasket can be found for the given key+domain values.
|
throws NotAuthorizedException, WorkbasketNotFoundException;
|
||||||
*/
|
|
||||||
void checkAuthorization(String workbasketKey, String domain, WorkbasketPermission... permission)
|
|
||||||
throws NotAuthorizedException, WorkbasketNotFoundException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all {@link WorkbasketAccessItem s} for a Workbasket.
|
* Get all {@link WorkbasketAccessItem s} for a Workbasket.
|
||||||
*
|
*
|
||||||
* @param workbasketId
|
* @param workbasketId the id of the Workbasket
|
||||||
* the id of the Workbasket
|
* @return List of WorkbasketAccessItems for the Workbasket with workbasketKey
|
||||||
* @return List of WorkbasketAccessItems for the Workbasket with workbasketKey
|
* @throws NotAuthorizedException if the current user is not member of role BUSINESS_ADMIN or
|
||||||
* @throws NotAuthorizedException
|
* ADMIN
|
||||||
* if the current user is not member of role BUSINESS_ADMIN or ADMIN
|
*/
|
||||||
*/
|
List<WorkbasketAccessItem> getWorkbasketAccessItems(String workbasketId)
|
||||||
List<WorkbasketAccessItem> getWorkbasketAccessItems(String workbasketId) throws NotAuthorizedException;
|
throws NotAuthorizedException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setting up the new WorkbasketAccessItems for a Workbasket. Already stored values will be completely replaced by
|
* Setting up the new WorkbasketAccessItems for a Workbasket. Already stored values will be
|
||||||
* the current ones.
|
* completely replaced by the current ones.
|
||||||
*
|
*
|
||||||
* @param workbasketId
|
* @param workbasketId ID of the access-target workbasket.
|
||||||
* ID of the access-target workbasket.
|
* @param wbAccessItems List of WorkbasketAccessItems which does replace all current stored ones.
|
||||||
* @param wbAccessItems
|
* @throws InvalidArgumentException will be thrown when the parameter is NULL or member doesn´t
|
||||||
* List of WorkbasketAccessItems which does replace all current stored ones.
|
* match the preconditions
|
||||||
* @throws InvalidArgumentException
|
* @throws NotAuthorizedException if the current user is not member of role BUSINESS_ADMIN or
|
||||||
* will be thrown when the parameter is NULL or member doesn´t match the preconditions
|
* ADMIN
|
||||||
* @throws NotAuthorizedException
|
*/
|
||||||
* if the current user is not member of role BUSINESS_ADMIN or ADMIN
|
void setWorkbasketAccessItems(String workbasketId, List<WorkbasketAccessItem> wbAccessItems)
|
||||||
*/
|
throws InvalidArgumentException, NotAuthorizedException;
|
||||||
void setWorkbasketAccessItems(String workbasketId, List<WorkbasketAccessItem> wbAccessItems)
|
|
||||||
throws InvalidArgumentException, NotAuthorizedException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method provides a query builder for querying the database.
|
* This method provides a query builder for querying the database.
|
||||||
*
|
*
|
||||||
* @return a {@link WorkbasketQuery}
|
* @return a {@link WorkbasketQuery}
|
||||||
*/
|
*/
|
||||||
WorkbasketQuery createWorkbasketQuery();
|
WorkbasketQuery createWorkbasketQuery();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method provides a query builder for querying the database.
|
* This method provides a query builder for querying the database.
|
||||||
*
|
*
|
||||||
* @return a {@link WorkbasketAccessItemQuery}
|
* @return a {@link WorkbasketAccessItemQuery}
|
||||||
* @throws NotAuthorizedException
|
* @throws NotAuthorizedException if the current user is not member of role BUSINESS_ADMIN or
|
||||||
* if the current user is not member of role BUSINESS_ADMIN or ADMIN
|
* ADMIN
|
||||||
*/
|
*/
|
||||||
WorkbasketAccessItemQuery createWorkbasketAccessItemQuery() throws NotAuthorizedException;
|
WorkbasketAccessItemQuery createWorkbasketAccessItemQuery() throws NotAuthorizedException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a new workbasket which is not persisted.
|
* Returns a new workbasket which is not persisted.
|
||||||
*
|
*
|
||||||
* @param key
|
* @param key the workbasket key used to identify the workbasket
|
||||||
* the workbasket key used to identify the workbasket
|
* @param domain the domain of the new workbasket
|
||||||
* @param domain
|
* @return new Workbasket
|
||||||
* the domain of the new workbasket
|
*/
|
||||||
* @return new Workbasket
|
Workbasket newWorkbasket(String key, String domain);
|
||||||
*/
|
|
||||||
Workbasket newWorkbasket(String key, String domain);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a set with all permissions of the current user at this workbasket.<br>
|
* Returns a set with all permissions of the current user at this workbasket.<br>
|
||||||
* If the workbasketId is invalid, an empty list of permissions is returned since there is no distinction made
|
* If the workbasketId is invalid, an empty list of permissions is returned since there is no
|
||||||
* between the situation that the workbasket is not found and the caller has no permissions on the workbasket.
|
* distinction made between the situation that the workbasket is not found and the caller has no
|
||||||
*
|
* permissions on the workbasket.
|
||||||
* @param workbasketId
|
*
|
||||||
* the id of the referenced workbasket
|
* @param workbasketId the id of the referenced workbasket
|
||||||
* @return a {@link List} with all {@link WorkbasketPermission}s of the caller on the requested workbasket.
|
* @return a {@link List} with all {@link WorkbasketPermission}s of the caller on the requested
|
||||||
*/
|
* workbasket.
|
||||||
List<WorkbasketPermission> getPermissionsForWorkbasket(String workbasketId);
|
*/
|
||||||
|
List<WorkbasketPermission> getPermissionsForWorkbasket(String workbasketId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the distribution targets for a given workbasket.
|
* Returns the distribution targets for a given workbasket.
|
||||||
*
|
*
|
||||||
* @param workbasketId
|
* @param workbasketId the id of the referenced workbasket
|
||||||
* the id of the referenced workbasket
|
* @return the distribution targets of the specified workbasket
|
||||||
* @return the distribution targets of the specified workbasket
|
* @throws NotAuthorizedException if the current user has no read permission for the specified
|
||||||
* @throws NotAuthorizedException
|
* workbasket
|
||||||
* if the current user has no read permission for the specified workbasket
|
* @throws WorkbasketNotFoundException if the workbasket doesn't exist
|
||||||
* @throws WorkbasketNotFoundException
|
*/
|
||||||
* if the workbasket doesn't exist
|
List<WorkbasketSummary> getDistributionTargets(String workbasketId)
|
||||||
*/
|
throws NotAuthorizedException, WorkbasketNotFoundException;
|
||||||
List<WorkbasketSummary> getDistributionTargets(String workbasketId)
|
|
||||||
throws NotAuthorizedException, WorkbasketNotFoundException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the distribution targets for a given workbasket.
|
* Returns the distribution targets for a given workbasket.
|
||||||
*
|
*
|
||||||
* @param workbasketKey
|
* @param workbasketKey the key of the referenced workbasket
|
||||||
* the key of the referenced workbasket
|
* @param domain the domain of the referenced workbasket
|
||||||
* @param domain
|
* @return the distribution targets of the specified workbasket
|
||||||
* the domain of the referenced workbasket
|
* @throws NotAuthorizedException if the current user has no read permission for the specified
|
||||||
* @return the distribution targets of the specified workbasket
|
* workbasket
|
||||||
* @throws NotAuthorizedException
|
* @throws WorkbasketNotFoundException if the workbasket doesn't exist
|
||||||
* if the current user has no read permission for the specified workbasket
|
*/
|
||||||
* @throws WorkbasketNotFoundException
|
List<WorkbasketSummary> getDistributionTargets(String workbasketKey, String domain)
|
||||||
* if the workbasket doesn't exist
|
throws NotAuthorizedException, WorkbasketNotFoundException;
|
||||||
*/
|
|
||||||
List<WorkbasketSummary> getDistributionTargets(String workbasketKey, String domain)
|
|
||||||
throws NotAuthorizedException, WorkbasketNotFoundException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the distribution targets for a workbasket.
|
* Set the distribution targets for a workbasket.
|
||||||
*
|
*
|
||||||
* @param sourceWorkbasketId
|
* @param sourceWorkbasketId the id of the source workbasket for which the distribution targets
|
||||||
* the id of the source workbasket for which the distribution targets are to be set
|
* are to be set
|
||||||
* @param targetWorkbasketIds
|
* @param targetWorkbasketIds a list of the ids of the target workbaskets
|
||||||
* a list of the ids of the target workbaskets
|
* @throws NotAuthorizedException if the current used doesn't have READ permission for the source
|
||||||
* @throws NotAuthorizedException
|
* workbasket
|
||||||
* if the current used doesn't have READ permission for the source workbasket
|
* @throws WorkbasketNotFoundException if either the source workbasket or any of the target
|
||||||
* @throws WorkbasketNotFoundException
|
* workbaskets don't exist
|
||||||
* if either the source workbasket or any of the target workbaskets don't exist
|
*/
|
||||||
*/
|
void setDistributionTargets(String sourceWorkbasketId, List<String> targetWorkbasketIds)
|
||||||
void setDistributionTargets(String sourceWorkbasketId, List<String> targetWorkbasketIds)
|
throws NotAuthorizedException, WorkbasketNotFoundException;
|
||||||
throws NotAuthorizedException, WorkbasketNotFoundException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a distribution target to a workbasket. If the specified distribution target exists already, the method
|
* Add a distribution target to a workbasket. If the specified distribution target exists already,
|
||||||
* silently returns without doing anything.
|
* the method silently returns without doing anything.
|
||||||
*
|
*
|
||||||
* @param sourceWorkbasketId
|
* @param sourceWorkbasketId the id of the source workbasket
|
||||||
* the id of the source workbasket
|
* @param targetWorkbasketId the id of the target workbasket
|
||||||
* @param targetWorkbasketId
|
* @throws NotAuthorizedException if the current user doesn't have READ permission for the source
|
||||||
* the id of the target workbasket
|
* workbasket
|
||||||
* @throws NotAuthorizedException
|
* @throws WorkbasketNotFoundException if either the source workbasket or the target workbasket
|
||||||
* if the current user doesn't have READ permission for the source workbasket
|
* doesn't exist
|
||||||
* @throws WorkbasketNotFoundException
|
*/
|
||||||
* if either the source workbasket or the target workbasket doesn't exist
|
void addDistributionTarget(String sourceWorkbasketId, String targetWorkbasketId)
|
||||||
*/
|
throws NotAuthorizedException, WorkbasketNotFoundException;
|
||||||
void addDistributionTarget(String sourceWorkbasketId, String targetWorkbasketId)
|
|
||||||
throws NotAuthorizedException, WorkbasketNotFoundException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a distribution target from a workbasket. If the the specified distribution target doesn't exist, the
|
* Remove a distribution target from a workbasket. If the the specified distribution target
|
||||||
* method silently returns without doing anything.
|
* doesn't exist, the method silently returns without doing anything.
|
||||||
*
|
*
|
||||||
* @param sourceWorkbasketId
|
* @param sourceWorkbasketId The id of the source workbasket
|
||||||
* The id of the source workbasket
|
* @param targetWorkbasketId The id of the target workbasket
|
||||||
* @param targetWorkbasketId
|
* @throws NotAuthorizedException If the current user doesn't have READ permission for the source
|
||||||
* The id of the target workbasket
|
* workbasket
|
||||||
* @throws NotAuthorizedException
|
*/
|
||||||
* If the current user doesn't have READ permission for the source workbasket
|
void removeDistributionTarget(String sourceWorkbasketId, String targetWorkbasketId)
|
||||||
*/
|
throws NotAuthorizedException;
|
||||||
void removeDistributionTarget(String sourceWorkbasketId, String targetWorkbasketId)
|
|
||||||
throws NotAuthorizedException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes the workbasket by the given ID of it.
|
* Deletes the workbasket by the given ID of it.
|
||||||
*
|
*
|
||||||
* @param workbasketId
|
* @param workbasketId Id of the workbasket which should be deleted.
|
||||||
* Id of the workbasket which should be deleted.
|
* @return true if the workbasket is marked for deletion. False in another case.
|
||||||
* @return true if the workbasket is marked for deletion. False in another case.
|
* @throws NotAuthorizedException if the current user got no permissions for this interaction.
|
||||||
* @throws NotAuthorizedException
|
* @throws WorkbasketNotFoundException if the workbasket does not exist.
|
||||||
* if the current user got no permissions for this interaction.
|
* @throws WorkbasketInUseException if the workbasket does contain task-content.
|
||||||
* @throws WorkbasketNotFoundException
|
* @throws InvalidArgumentException if the workbasketId is NULL or EMPTY
|
||||||
* if the workbasket does not exist.
|
*/
|
||||||
* @throws WorkbasketInUseException
|
boolean deleteWorkbasket(String workbasketId)
|
||||||
* if the workbasket does contain task-content.
|
throws NotAuthorizedException, WorkbasketNotFoundException, WorkbasketInUseException,
|
||||||
* @throws InvalidArgumentException
|
InvalidArgumentException;
|
||||||
* if the workbasketId is NULL or EMPTY
|
|
||||||
*/
|
|
||||||
boolean deleteWorkbasket(String workbasketId)
|
|
||||||
throws NotAuthorizedException, WorkbasketNotFoundException, WorkbasketInUseException, InvalidArgumentException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes a list of workbaskets.
|
* Deletes a list of workbaskets.
|
||||||
*
|
*
|
||||||
* @param workbasketsIds
|
* @param workbasketsIds the ids of the workbaskets to delete.
|
||||||
* the ids of the workbaskets to delete.
|
* @return the result of the operations with Id and Exception for each failed workbasket deletion.
|
||||||
* @return the result of the operations with Id and Exception for each failed workbasket deletion.
|
* @throws InvalidArgumentException if the WorkbasketIds parameter list is NULL or empty
|
||||||
* @throws InvalidArgumentException
|
* @throws NotAuthorizedException if the current user got no permission for this interaction.
|
||||||
* if the WorkbasketIds parameter list is NULL or empty
|
*/
|
||||||
* @throws NotAuthorizedException
|
BulkOperationResults<String, TaskanaException> deleteWorkbaskets(List<String> workbasketsIds)
|
||||||
* if the current user got no permission for this interaction.
|
throws NotAuthorizedException, InvalidArgumentException;
|
||||||
*/
|
|
||||||
BulkOperationResults<String, TaskanaException> deleteWorkbaskets(List<String> workbasketsIds)
|
|
||||||
throws NotAuthorizedException, InvalidArgumentException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the distribution sources for a given workbasket.
|
* Returns the distribution sources for a given workbasket.
|
||||||
*
|
*
|
||||||
* @param workbasketId
|
* @param workbasketId the id of the referenced workbasket
|
||||||
* the id of the referenced workbasket
|
* @return the workbaskets that are distribution sources of the specified workbasket.
|
||||||
* @return the workbaskets that are distribution sources of the specified workbasket.
|
* @throws NotAuthorizedException if the current user has no read permission for the specified
|
||||||
* @throws NotAuthorizedException
|
* workbasket
|
||||||
* if the current user has no read permission for the specified workbasket
|
* @throws WorkbasketNotFoundException if the workbasket doesn't exist
|
||||||
* @throws WorkbasketNotFoundException
|
*/
|
||||||
* if the workbasket doesn't exist
|
List<WorkbasketSummary> getDistributionSources(String workbasketId)
|
||||||
*/
|
throws NotAuthorizedException, WorkbasketNotFoundException;
|
||||||
List<WorkbasketSummary> getDistributionSources(String workbasketId)
|
|
||||||
throws NotAuthorizedException, WorkbasketNotFoundException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the distribution sources for a given workbasket.
|
* Returns the distribution sources for a given workbasket.
|
||||||
*
|
*
|
||||||
* @param workbasketKey
|
* @param workbasketKey the key of the referenced workbasket
|
||||||
* the key of the referenced workbasket
|
* @param domain the domain of the referenced workbasket
|
||||||
* @param domain
|
* @return the workbaskets that are distribution sources of the specified workbasket.
|
||||||
* the domain of the referenced workbasket
|
* @throws NotAuthorizedException if the current user has no read permission for the specified
|
||||||
* @return the workbaskets that are distribution sources of the specified workbasket.
|
* workbasket
|
||||||
* @throws NotAuthorizedException
|
* @throws WorkbasketNotFoundException if the workbasket doesn't exist
|
||||||
* if the current user has no read permission for the specified workbasket
|
*/
|
||||||
* @throws WorkbasketNotFoundException
|
List<WorkbasketSummary> getDistributionSources(String workbasketKey, String domain)
|
||||||
* if the workbasket doesn't exist
|
throws NotAuthorizedException, WorkbasketNotFoundException;
|
||||||
*/
|
|
||||||
List<WorkbasketSummary> getDistributionSources(String workbasketKey, String domain)
|
|
||||||
throws NotAuthorizedException, WorkbasketNotFoundException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes all WorkbasketAccessItems using the given AccessId of a user.
|
* Deletes all WorkbasketAccessItems using the given AccessId of a user.
|
||||||
*
|
*
|
||||||
* @param accessId
|
* @param accessId of a taskana-user.
|
||||||
* of a taskana-user.
|
* @throws NotAuthorizedException if the current user is not member of role BUSINESS_ADMIN or
|
||||||
* @throws NotAuthorizedException
|
* ADMIN
|
||||||
* if the current user is not member of role BUSINESS_ADMIN or ADMIN
|
*/
|
||||||
*/
|
void deleteWorkbasketAccessItemsForAccessId(String accessId) throws NotAuthorizedException;
|
||||||
void deleteWorkbasketAccessItemsForAccessId(String accessId) throws NotAuthorizedException;
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,121 +1,120 @@
|
||||||
package pro.taskana;
|
package pro.taskana;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface for WorkbasketSummary. This is a specific short model-object which only contains the most important
|
* Interface for WorkbasketSummary. This is a specific short model-object which only contains the
|
||||||
* information.
|
* most important information.
|
||||||
*/
|
*/
|
||||||
public interface WorkbasketSummary {
|
public interface WorkbasketSummary {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the id of the workbasket.
|
* Gets the id of the workbasket.
|
||||||
*
|
*
|
||||||
* @return workbasketId
|
* @return workbasketId
|
||||||
*/
|
*/
|
||||||
String getId();
|
String getId();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the key of the workbasket.
|
* Gets the key of the workbasket.
|
||||||
*
|
*
|
||||||
* @return workbasketKey
|
* @return workbasketKey
|
||||||
*/
|
*/
|
||||||
String getKey();
|
String getKey();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the name of the workbasket.
|
* Gets the name of the workbasket.
|
||||||
*
|
*
|
||||||
* @return workbasket's name
|
* @return workbasket's name
|
||||||
*/
|
*/
|
||||||
String getName();
|
String getName();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the description of the workbasket.
|
* Gets the description of the workbasket.
|
||||||
*
|
*
|
||||||
* @return workbasket's description
|
* @return workbasket's description
|
||||||
*/
|
*/
|
||||||
String getDescription();
|
String getDescription();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the owner of the workbasket.
|
* Gets the owner of the workbasket.
|
||||||
*
|
*
|
||||||
* @return workbasket's owner
|
* @return workbasket's owner
|
||||||
*/
|
*/
|
||||||
String getOwner();
|
String getOwner();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the domain of the workbasket.
|
* Gets the domain of the workbasket.
|
||||||
*
|
*
|
||||||
* @return workbasket's domain
|
* @return workbasket's domain
|
||||||
*/
|
*/
|
||||||
String getDomain();
|
String getDomain();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the type of the workbasket.
|
* Gets the type of the workbasket.
|
||||||
*
|
*
|
||||||
* @return workbasket's type
|
* @return workbasket's type
|
||||||
*/
|
*/
|
||||||
WorkbasketType getType();
|
WorkbasketType getType();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the custom1 property of the workbasket.
|
* Gets the custom1 property of the workbasket.
|
||||||
*
|
*
|
||||||
* @return the workbasket's custom1 property.
|
* @return the workbasket's custom1 property.
|
||||||
*/
|
*/
|
||||||
String getCustom1();
|
String getCustom1();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the custom2 property of the workbasket.
|
* Gets the custom2 property of the workbasket.
|
||||||
*
|
*
|
||||||
* @return the workbasket's custom2 property.
|
* @return the workbasket's custom2 property.
|
||||||
*/
|
*/
|
||||||
String getCustom2();
|
String getCustom2();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the custom3 property of the workbasket.
|
* Gets the custom3 property of the workbasket.
|
||||||
*
|
*
|
||||||
* @return the workbasket's custom3 property.
|
* @return the workbasket's custom3 property.
|
||||||
*/
|
*/
|
||||||
String getCustom3();
|
String getCustom3();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the custom4 property of the workbasket.
|
* Gets the custom4 property of the workbasket.
|
||||||
*
|
*
|
||||||
* @return the workbasket's custom4 property.
|
* @return the workbasket's custom4 property.
|
||||||
*/
|
*/
|
||||||
String getCustom4();
|
String getCustom4();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the orglevel1 property of the workbasket.
|
* Gets the orglevel1 property of the workbasket.
|
||||||
*
|
*
|
||||||
* @return the workbasket's orglevel1 property
|
* @return the workbasket's orglevel1 property
|
||||||
*/
|
*/
|
||||||
String getOrgLevel1();
|
String getOrgLevel1();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the orglevel2 property of the workbasket.
|
* Gets the orglevel2 property of the workbasket.
|
||||||
*
|
*
|
||||||
* @return the workbasket's orglevel2 property
|
* @return the workbasket's orglevel2 property
|
||||||
*/
|
*/
|
||||||
String getOrgLevel2();
|
String getOrgLevel2();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the orglevel3 property of the workbasket.
|
* Gets the orglevel3 property of the workbasket.
|
||||||
*
|
*
|
||||||
* @return the workbasket's orglevel3 property
|
* @return the workbasket's orglevel3 property
|
||||||
*/
|
*/
|
||||||
String getOrgLevel3();
|
String getOrgLevel3();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the orglevel4 property of the workbasket.
|
* Gets the orglevel4 property of the workbasket.
|
||||||
*
|
*
|
||||||
* @return the workbasket's orglevel4 property
|
* @return the workbasket's orglevel4 property
|
||||||
*/
|
*/
|
||||||
String getOrgLevel4();
|
String getOrgLevel4();
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the markedForDeletion property of the workbasket.
|
|
||||||
*
|
|
||||||
* @return the workbasket's markedForDeletion property
|
|
||||||
*/
|
|
||||||
boolean isMarkedForDeletion();
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the markedForDeletion property of the workbasket.
|
||||||
|
*
|
||||||
|
* @return the workbasket's markedForDeletion property
|
||||||
|
*/
|
||||||
|
boolean isMarkedForDeletion();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
package pro.taskana;
|
package pro.taskana;
|
||||||
|
|
||||||
/**
|
/** This enum contains the supported work basket types. */
|
||||||
* This enum contains the supported work basket types.
|
|
||||||
*/
|
|
||||||
public enum WorkbasketType {
|
public enum WorkbasketType {
|
||||||
GROUP, PERSONAL, TOPIC, CLEARANCE
|
GROUP,
|
||||||
|
PERSONAL,
|
||||||
|
TOPIC,
|
||||||
|
CLEARANCE
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,45 +2,42 @@ package pro.taskana.configuration;
|
||||||
|
|
||||||
import pro.taskana.exceptions.UnsupportedDatabaseException;
|
import pro.taskana.exceptions.UnsupportedDatabaseException;
|
||||||
|
|
||||||
/**
|
/** Supported versions of databases. */
|
||||||
* Supported versions of databases.
|
|
||||||
*/
|
|
||||||
public enum DB {
|
public enum DB {
|
||||||
|
H2("H2", "h2"),
|
||||||
|
DB2("DB2", "db2"),
|
||||||
|
POSTGRESS("PostgreSQL", "postgres");
|
||||||
|
|
||||||
H2("H2", "h2"),
|
public final String dbProductname;
|
||||||
DB2("DB2", "db2"),
|
public final String dbProductId;
|
||||||
POSTGRESS("PostgreSQL", "postgres");
|
|
||||||
|
|
||||||
public final String dbProductname;
|
DB(String dbProductname, String dbProductId) {
|
||||||
public final String dbProductId;
|
this.dbProductname = dbProductname;
|
||||||
|
this.dbProductId = dbProductId;
|
||||||
|
}
|
||||||
|
|
||||||
DB(String dbProductname, String dbProductId) {
|
public static boolean isDb2(String dbProductName) {
|
||||||
this.dbProductname = dbProductname;
|
return dbProductName != null && dbProductName.contains(DB2.dbProductname);
|
||||||
this.dbProductId = dbProductId;
|
}
|
||||||
}
|
|
||||||
|
public static boolean isH2(String dbProductName) {
|
||||||
public static boolean isDb2(String dbProductName) {
|
return dbProductName != null && dbProductName.contains(H2.dbProductname);
|
||||||
return dbProductName != null && dbProductName.contains(DB2.dbProductname);
|
}
|
||||||
}
|
|
||||||
|
public static boolean isPostgreSQL(String dbProductName) {
|
||||||
public static boolean isH2(String dbProductName) {
|
return POSTGRESS.dbProductname.equals(dbProductName);
|
||||||
return dbProductName != null && dbProductName.contains(H2.dbProductname);
|
}
|
||||||
}
|
|
||||||
|
public static String getDatabaseProductId(String dbProductName) {
|
||||||
public static boolean isPostgreSQL(String dbProductName) {
|
|
||||||
return POSTGRESS.dbProductname.equals(dbProductName);
|
if (isDb2(dbProductName)) {
|
||||||
}
|
return DB2.dbProductId;
|
||||||
|
} else if (isH2(dbProductName)) {
|
||||||
public static String getDatabaseProductId(String dbProductName) {
|
return H2.dbProductId;
|
||||||
|
} else if (isPostgreSQL(dbProductName)) {
|
||||||
if (isDb2(dbProductName)) {
|
return POSTGRESS.dbProductId;
|
||||||
return DB2.dbProductId;
|
} else {
|
||||||
} else if (isH2(dbProductName)) {
|
throw new UnsupportedDatabaseException(dbProductName);
|
||||||
return H2.dbProductId;
|
|
||||||
} else if (isPostgreSQL(dbProductName)) {
|
|
||||||
return POSTGRESS.dbProductId;
|
|
||||||
} else {
|
|
||||||
throw new UnsupportedDatabaseException(dbProductName);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,163 +11,164 @@ import java.nio.charset.StandardCharsets;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
|
|
||||||
import org.apache.ibatis.jdbc.ScriptRunner;
|
import org.apache.ibatis.jdbc.ScriptRunner;
|
||||||
import org.apache.ibatis.jdbc.SqlRunner;
|
import org.apache.ibatis.jdbc.SqlRunner;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
/**
|
/** This class create the schema for taskana. */
|
||||||
* This class create the schema for taskana.
|
|
||||||
*/
|
|
||||||
public class DbSchemaCreator {
|
public class DbSchemaCreator {
|
||||||
|
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(DbSchemaCreator.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(DbSchemaCreator.class);
|
||||||
private static final String SQL = "/sql";
|
private static final String SQL = "/sql";
|
||||||
private static final String DB_SCHEMA = SQL + "/taskana-schema.sql";
|
private static final String DB_SCHEMA = SQL + "/taskana-schema.sql";
|
||||||
private static final String DB_SCHEMA_DB2 = SQL + "/taskana-schema-db2.sql";
|
private static final String DB_SCHEMA_DB2 = SQL + "/taskana-schema-db2.sql";
|
||||||
private static final String DB_SCHEMA_POSTGRES = SQL + "/taskana-schema-postgres.sql";
|
private static final String DB_SCHEMA_POSTGRES = SQL + "/taskana-schema-postgres.sql";
|
||||||
private static final String DB_SCHEMA_DETECTION = SQL + "/schema-detection.sql";
|
private static final String DB_SCHEMA_DETECTION = SQL + "/schema-detection.sql";
|
||||||
private static final String DB_SCHEMA_DETECTION_POSTGRES = SQL + "/schema-detection-postgres.sql";
|
private static final String DB_SCHEMA_DETECTION_POSTGRES = SQL + "/schema-detection-postgres.sql";
|
||||||
|
|
||||||
private DataSource dataSource;
|
private DataSource dataSource;
|
||||||
private String schemaName;
|
private String schemaName;
|
||||||
private StringWriter outWriter = new StringWriter();
|
private StringWriter outWriter = new StringWriter();
|
||||||
private PrintWriter logWriter = new PrintWriter(outWriter);
|
private PrintWriter logWriter = new PrintWriter(outWriter);
|
||||||
private StringWriter errorWriter = new StringWriter();
|
private StringWriter errorWriter = new StringWriter();
|
||||||
private PrintWriter errorLogWriter = new PrintWriter(errorWriter);
|
private PrintWriter errorLogWriter = new PrintWriter(errorWriter);
|
||||||
|
|
||||||
public DbSchemaCreator(DataSource dataSource, String schema) {
|
public DbSchemaCreator(DataSource dataSource, String schema) {
|
||||||
super();
|
super();
|
||||||
this.dataSource = dataSource;
|
this.dataSource = dataSource;
|
||||||
this.schemaName = schema;
|
this.schemaName = schema;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Run all db scripts.
|
||||||
|
*
|
||||||
|
* @throws SQLException will be thrown if there will be some incorrect SQL statements invoked.
|
||||||
|
*/
|
||||||
|
public void run() throws SQLException {
|
||||||
|
Connection connection = dataSource.getConnection();
|
||||||
|
LOGGER.debug(
|
||||||
|
"Using database of type {} with url '{}'",
|
||||||
|
connection.getMetaData().getDatabaseProductName(),
|
||||||
|
connection.getMetaData().getURL());
|
||||||
|
ScriptRunner runner = getScriptRunnerInstance(connection);
|
||||||
|
try {
|
||||||
|
if (!isSchemaPreexisting(connection)) {
|
||||||
|
String scriptPath =
|
||||||
|
selectDbScriptFileName(connection.getMetaData().getDatabaseProductName());
|
||||||
|
InputStream resourceAsStream = this.getClass().getResourceAsStream(scriptPath);
|
||||||
|
BufferedReader reader =
|
||||||
|
new BufferedReader(new InputStreamReader(resourceAsStream, StandardCharsets.UTF_8));
|
||||||
|
runner.runScript(getSqlSchemaNameParsed(reader));
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
runner.closeConnection();
|
||||||
}
|
}
|
||||||
|
LOGGER.debug(outWriter.toString());
|
||||||
private static String selectDbScriptFileName(String dbProductName) {
|
if (!errorWriter.toString().trim().isEmpty()) {
|
||||||
return DB.isPostgreSQL(dbProductName)
|
LOGGER.error(errorWriter.toString());
|
||||||
? DB_SCHEMA_POSTGRES
|
|
||||||
: DB.isH2(dbProductName) ? DB_SCHEMA : DB_SCHEMA_DB2;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static String selectDbSchemaDetectionScript(String dbProductName) {
|
public boolean isValidSchemaVersion(String expectedVersion) {
|
||||||
return DB.isPostgreSQL(dbProductName) ? DB_SCHEMA_DETECTION_POSTGRES : DB_SCHEMA_DETECTION;
|
SqlRunner runner = null;
|
||||||
}
|
try {
|
||||||
|
Connection connection = dataSource.getConnection();
|
||||||
|
connection.setSchema(this.schemaName);
|
||||||
|
runner = new SqlRunner(connection);
|
||||||
|
LOGGER.debug(connection.getMetaData().toString());
|
||||||
|
|
||||||
/**
|
String query =
|
||||||
* Run all db scripts.
|
"select VERSION from TASKANA_SCHEMA_VERSION where "
|
||||||
*
|
+ "VERSION = (select max(VERSION) from TASKANA_SCHEMA_VERSION) "
|
||||||
* @throws SQLException
|
+ "AND VERSION = ?";
|
||||||
* will be thrown if there will be some incorrect SQL statements invoked.
|
|
||||||
*/
|
|
||||||
public void run() throws SQLException {
|
|
||||||
Connection connection = dataSource.getConnection();
|
|
||||||
LOGGER.debug("Using database of type {} with url '{}'", connection.getMetaData().getDatabaseProductName(),
|
|
||||||
connection.getMetaData().getURL());
|
|
||||||
ScriptRunner runner = getScriptRunnerInstance(connection);
|
|
||||||
try {
|
|
||||||
if (!isSchemaPreexisting(connection)) {
|
|
||||||
String scriptPath = selectDbScriptFileName(connection.getMetaData().getDatabaseProductName());
|
|
||||||
InputStream resourceAsStream = this.getClass().getResourceAsStream(scriptPath);
|
|
||||||
BufferedReader reader = new BufferedReader(
|
|
||||||
new InputStreamReader(resourceAsStream, StandardCharsets.UTF_8));
|
|
||||||
runner.runScript(getSqlSchemaNameParsed(reader));
|
|
||||||
}
|
|
||||||
} finally {
|
|
||||||
runner.closeConnection();
|
|
||||||
}
|
|
||||||
LOGGER.debug(outWriter.toString());
|
|
||||||
if (!errorWriter.toString().trim().isEmpty()) {
|
|
||||||
LOGGER.error(errorWriter.toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private ScriptRunner getScriptRunnerInstance(Connection connection) {
|
Map<String, Object> queryResult = runner.selectOne(query, expectedVersion);
|
||||||
ScriptRunner runner = new ScriptRunner(connection);
|
if (queryResult == null || queryResult.isEmpty()) {
|
||||||
runner.setStopOnError(true);
|
LOGGER.error(
|
||||||
runner.setLogWriter(logWriter);
|
"Schema version not valid. The VERSION property in table TASKANA_SCHEMA_VERSION has not the expected value {}",
|
||||||
runner.setErrorLogWriter(errorLogWriter);
|
expectedVersion);
|
||||||
return runner;
|
return false;
|
||||||
}
|
} else {
|
||||||
|
LOGGER.debug("Schema version is valid.");
|
||||||
private boolean isSchemaPreexisting(Connection connection) {
|
|
||||||
ScriptRunner runner = getScriptRunnerInstance(connection);
|
|
||||||
StringWriter errorWriter = new StringWriter();
|
|
||||||
runner.setErrorLogWriter(new PrintWriter(errorWriter));
|
|
||||||
try {
|
|
||||||
String scriptPath = selectDbSchemaDetectionScript(connection.getMetaData().getDatabaseProductName());
|
|
||||||
InputStream resourceAsStream = this.getClass().getResourceAsStream(scriptPath);
|
|
||||||
BufferedReader reader = new BufferedReader(new InputStreamReader(resourceAsStream, StandardCharsets.UTF_8));
|
|
||||||
runner.runScript(getSqlSchemaNameParsed(reader));
|
|
||||||
} catch (Exception e) {
|
|
||||||
LOGGER.debug("Schema does not exist.");
|
|
||||||
if (!errorWriter.toString().trim().isEmpty()) {
|
|
||||||
LOGGER.debug(errorWriter.toString());
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
LOGGER.debug("Schema does exist.");
|
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
LOGGER.error(
|
||||||
|
"Schema version not valid. The VERSION property in table TASKANA_SCHEMA_VERSION has not the expected value {}",
|
||||||
|
expectedVersion);
|
||||||
|
return false;
|
||||||
|
} finally {
|
||||||
|
if (runner != null) {
|
||||||
|
runner.closeConnection();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isValidSchemaVersion(String expectedVersion) {
|
public DataSource getDataSource() {
|
||||||
SqlRunner runner = null;
|
return dataSource;
|
||||||
try {
|
}
|
||||||
Connection connection = dataSource.getConnection();
|
|
||||||
connection.setSchema(this.schemaName);
|
|
||||||
runner = new SqlRunner(connection);
|
|
||||||
LOGGER.debug(connection.getMetaData().toString());
|
|
||||||
|
|
||||||
String query = "select VERSION from TASKANA_SCHEMA_VERSION where "
|
public void setDataSource(DataSource dataSource) {
|
||||||
+ "VERSION = (select max(VERSION) from TASKANA_SCHEMA_VERSION) "
|
this.dataSource = dataSource;
|
||||||
+ "AND VERSION = ?";
|
}
|
||||||
|
|
||||||
Map<String, Object> queryResult = runner.selectOne(query, expectedVersion);
|
private static String selectDbScriptFileName(String dbProductName) {
|
||||||
if (queryResult == null || queryResult.isEmpty()) {
|
return DB.isPostgreSQL(dbProductName)
|
||||||
LOGGER.error(
|
? DB_SCHEMA_POSTGRES
|
||||||
"Schema version not valid. The VERSION property in table TASKANA_SCHEMA_VERSION has not the expected value {}",
|
: DB.isH2(dbProductName) ? DB_SCHEMA : DB_SCHEMA_DB2;
|
||||||
expectedVersion);
|
}
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
LOGGER.debug("Schema version is valid.");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
private static String selectDbSchemaDetectionScript(String dbProductName) {
|
||||||
LOGGER.error(
|
return DB.isPostgreSQL(dbProductName) ? DB_SCHEMA_DETECTION_POSTGRES : DB_SCHEMA_DETECTION;
|
||||||
"Schema version not valid. The VERSION property in table TASKANA_SCHEMA_VERSION has not the expected value {}",
|
}
|
||||||
expectedVersion);
|
|
||||||
return false;
|
private ScriptRunner getScriptRunnerInstance(Connection connection) {
|
||||||
} finally {
|
ScriptRunner runner = new ScriptRunner(connection);
|
||||||
if (runner != null) {
|
runner.setStopOnError(true);
|
||||||
runner.closeConnection();
|
runner.setLogWriter(logWriter);
|
||||||
}
|
runner.setErrorLogWriter(errorLogWriter);
|
||||||
|
return runner;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isSchemaPreexisting(Connection connection) {
|
||||||
|
ScriptRunner runner = getScriptRunnerInstance(connection);
|
||||||
|
StringWriter errorWriter = new StringWriter();
|
||||||
|
runner.setErrorLogWriter(new PrintWriter(errorWriter));
|
||||||
|
try {
|
||||||
|
String scriptPath =
|
||||||
|
selectDbSchemaDetectionScript(connection.getMetaData().getDatabaseProductName());
|
||||||
|
InputStream resourceAsStream = this.getClass().getResourceAsStream(scriptPath);
|
||||||
|
BufferedReader reader =
|
||||||
|
new BufferedReader(new InputStreamReader(resourceAsStream, StandardCharsets.UTF_8));
|
||||||
|
runner.runScript(getSqlSchemaNameParsed(reader));
|
||||||
|
} catch (Exception e) {
|
||||||
|
LOGGER.debug("Schema does not exist.");
|
||||||
|
if (!errorWriter.toString().trim().isEmpty()) {
|
||||||
|
LOGGER.debug(errorWriter.toString());
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
LOGGER.debug("Schema does exist.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private StringReader getSqlSchemaNameParsed(BufferedReader reader) {
|
||||||
|
|
||||||
|
StringBuffer content = new StringBuffer();
|
||||||
|
try {
|
||||||
|
String line = "";
|
||||||
|
while (line != null) {
|
||||||
|
line = reader.readLine();
|
||||||
|
if (line != null) {
|
||||||
|
content.append(line.replaceAll("%schemaName%", schemaName) + System.lineSeparator());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
LOGGER.error("SchemaName sql parsing failed for schemaName {}", schemaName, e);
|
||||||
}
|
}
|
||||||
|
return new StringReader(content.toString());
|
||||||
public DataSource getDataSource() {
|
}
|
||||||
return dataSource;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDataSource(DataSource dataSource) {
|
|
||||||
this.dataSource = dataSource;
|
|
||||||
}
|
|
||||||
|
|
||||||
private StringReader getSqlSchemaNameParsed(BufferedReader reader) {
|
|
||||||
|
|
||||||
StringBuffer content = new StringBuffer();
|
|
||||||
try {
|
|
||||||
String line = "";
|
|
||||||
while (line != null) {
|
|
||||||
line = reader.readLine();
|
|
||||||
if (line != null) {
|
|
||||||
content.append(line.replaceAll("%schemaName%", schemaName) + System.lineSeparator());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
LOGGER.error("SchemaName sql parsing failed for schemaName {}", schemaName, e);
|
|
||||||
}
|
|
||||||
return new StringReader(content.toString());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,9 +22,7 @@ import java.util.Properties;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
|
|
||||||
import org.apache.ibatis.datasource.pooled.PooledDataSource;
|
import org.apache.ibatis.datasource.pooled.PooledDataSource;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
@ -36,492 +34,521 @@ import pro.taskana.impl.TaskanaEngineImpl;
|
||||||
import pro.taskana.impl.util.LoggerUtils;
|
import pro.taskana.impl.util.LoggerUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This central class creates the TaskanaEngine and holds all the information about DB and Security.<br>
|
* This central class creates the TaskanaEngine and holds all the information about DB and Security.
|
||||||
|
* <br>
|
||||||
* Security is enabled by default.
|
* Security is enabled by default.
|
||||||
*/
|
*/
|
||||||
public class TaskanaEngineConfiguration {
|
public class TaskanaEngineConfiguration {
|
||||||
|
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(TaskanaEngineConfiguration.class);
|
protected static final String TASKANA_SCHEMA_VERSION =
|
||||||
|
"1.1.5"; // must match the VERSION value in table
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(TaskanaEngineConfiguration.class);
|
||||||
|
private static final String USER_NAME = "sa";
|
||||||
|
private static final String USER_PASSWORD = "sa";
|
||||||
|
private static final String JDBC_H2_MEM_TASKANA =
|
||||||
|
"jdbc:h2:mem:taskana;IGNORECASE=TRUE;LOCK_MODE=0";
|
||||||
|
private static final String H2_DRIVER = "org.h2.Driver";
|
||||||
|
private static final String TASKANA_PROPERTIES = "/taskana.properties";
|
||||||
|
private static final String TASKANA_ROLES_SEPARATOR = "|";
|
||||||
|
private static final String TASKANA_JOB_BATCHSIZE = "taskana.jobs.batchSize";
|
||||||
|
private static final String TASKANA_JOB_RETRIES = "taskana.jobs.maxRetries";
|
||||||
|
private static final String TASKANA_JOB_CLEANUP_RUN_EVERY = "taskana.jobs.cleanup.runEvery";
|
||||||
|
private static final String TASKANA_JOB_CLEANUP_FIRST_RUN = "taskana.jobs.cleanup.firstRunAt";
|
||||||
|
private static final String TASKANA_JOB_CLEANUP_MINIMUM_AGE = "taskana.jobs.cleanup.minimumAge";
|
||||||
|
private static final String TASKANA_JOB_TASK_CLEANUP_ALL_COMPLETED_SAME_PARENTE_BUSINESS =
|
||||||
|
"taskana.jobs.cleanup.allCompletedSameParentBusiness";
|
||||||
|
private static final String TASKANA_DOMAINS_PROPERTY = "taskana.domains";
|
||||||
|
private static final String TASKANA_CLASSIFICATION_TYPES_PROPERTY =
|
||||||
|
"taskana.classification.types";
|
||||||
|
private static final String TASKANA_CLASSIFICATION_CATEGORIES_PROPERTY =
|
||||||
|
"taskana.classification.categories";
|
||||||
|
// TASKANA_SCHEMA_VERSION
|
||||||
|
private static final String DEFAULT_SCHEMA_NAME = "TASKANA";
|
||||||
|
|
||||||
private static final String USER_NAME = "sa";
|
// Taskana properties file
|
||||||
private static final String USER_PASSWORD = "sa";
|
protected String propertiesFileName = TASKANA_PROPERTIES;
|
||||||
private static final String JDBC_H2_MEM_TASKANA = "jdbc:h2:mem:taskana;IGNORECASE=TRUE;LOCK_MODE=0";
|
|
||||||
private static final String H2_DRIVER = "org.h2.Driver";
|
|
||||||
private static final String TASKANA_PROPERTIES = "/taskana.properties";
|
|
||||||
private static final String TASKANA_ROLES_SEPARATOR = "|";
|
|
||||||
private static final String TASKANA_JOB_BATCHSIZE = "taskana.jobs.batchSize";
|
|
||||||
private static final String TASKANA_JOB_RETRIES = "taskana.jobs.maxRetries";
|
|
||||||
private static final String TASKANA_JOB_CLEANUP_RUN_EVERY = "taskana.jobs.cleanup.runEvery";
|
|
||||||
private static final String TASKANA_JOB_CLEANUP_FIRST_RUN = "taskana.jobs.cleanup.firstRunAt";
|
|
||||||
private static final String TASKANA_JOB_CLEANUP_MINIMUM_AGE = "taskana.jobs.cleanup.minimumAge";
|
|
||||||
private static final String TASKANA_JOB_TASK_CLEANUP_ALL_COMPLETED_SAME_PARENTE_BUSINESS = "taskana.jobs.cleanup.allCompletedSameParentBusiness";
|
|
||||||
|
|
||||||
private static final String TASKANA_DOMAINS_PROPERTY = "taskana.domains";
|
// Taskana datasource configuration
|
||||||
private static final String TASKANA_CLASSIFICATION_TYPES_PROPERTY = "taskana.classification.types";
|
protected DataSource dataSource;
|
||||||
private static final String TASKANA_CLASSIFICATION_CATEGORIES_PROPERTY = "taskana.classification.categories";
|
protected DbSchemaCreator dbSchemaCreator;
|
||||||
protected static final String TASKANA_SCHEMA_VERSION = "1.1.5"; // must match the VERSION value in table
|
protected String schemaName;
|
||||||
// TASKANA_SCHEMA_VERSION
|
|
||||||
private static final String DEFAULT_SCHEMA_NAME = "TASKANA";
|
|
||||||
|
|
||||||
// Taskana properties file
|
// Taskana role configuration
|
||||||
protected String propertiesFileName = TASKANA_PROPERTIES;
|
protected String rolesSeparator = TASKANA_ROLES_SEPARATOR;
|
||||||
|
protected Map<TaskanaRole, Set<String>> roleMap = new HashMap<>();
|
||||||
|
|
||||||
// Taskana datasource configuration
|
// global switch to enable JAAS based authentication and Taskana
|
||||||
protected DataSource dataSource;
|
// authorizations
|
||||||
protected DbSchemaCreator dbSchemaCreator;
|
protected boolean securityEnabled = true;
|
||||||
protected String schemaName;
|
protected boolean useManagedTransactions;
|
||||||
|
// List of configured domain names
|
||||||
|
protected List<String> domains = new ArrayList<String>();
|
||||||
|
// List of configured classification types
|
||||||
|
protected List<String> classificationTypes = new ArrayList<String>();
|
||||||
|
protected Map<String, List<String>> classificationCategoriesByTypeMap =
|
||||||
|
new HashMap<String, List<String>>();
|
||||||
|
// Properties for the monitor
|
||||||
|
private boolean germanPublicHolidaysEnabled;
|
||||||
|
private List<LocalDate> customHolidays;
|
||||||
|
// Properties for generalo job execution
|
||||||
|
private int jobBatchSize = 100;
|
||||||
|
private int maxNumberOfJobRetries = 3;
|
||||||
|
// Properties for the cleanup job
|
||||||
|
private Instant cleanupJobFirstRun = Instant.parse("2018-01-01T00:00:00Z");
|
||||||
|
private Duration cleanupJobRunEvery = Duration.parse("P1D");
|
||||||
|
private Duration cleanupJobMinimumAge = Duration.parse("P14D");
|
||||||
|
private boolean taskCleanupJobAllCompletedSameParentBusiness = true;
|
||||||
|
|
||||||
// Taskana role configuration
|
public TaskanaEngineConfiguration(
|
||||||
protected String rolesSeparator = TASKANA_ROLES_SEPARATOR;
|
DataSource dataSource, boolean useManagedTransactions, String schemaName)
|
||||||
protected Map<TaskanaRole, Set<String>> roleMap = new HashMap<>();
|
throws SQLException {
|
||||||
|
this(dataSource, useManagedTransactions, true, schemaName);
|
||||||
|
}
|
||||||
|
|
||||||
// global switch to enable JAAS based authentication and Taskana
|
public TaskanaEngineConfiguration(
|
||||||
// authorizations
|
DataSource dataSource,
|
||||||
protected boolean securityEnabled = true;
|
boolean useManagedTransactions,
|
||||||
protected boolean useManagedTransactions;
|
boolean securityEnabled,
|
||||||
|
String schemaName)
|
||||||
|
throws SQLException {
|
||||||
|
this(dataSource, useManagedTransactions, securityEnabled, null, null, schemaName);
|
||||||
|
}
|
||||||
|
|
||||||
// Properties for the monitor
|
public TaskanaEngineConfiguration(
|
||||||
private boolean germanPublicHolidaysEnabled;
|
DataSource dataSource,
|
||||||
private List<LocalDate> customHolidays;
|
boolean useManagedTransactions,
|
||||||
|
boolean securityEnabled,
|
||||||
|
String propertiesFileName,
|
||||||
|
String rolesSeparator,
|
||||||
|
String schemaName)
|
||||||
|
throws SQLException {
|
||||||
|
this.useManagedTransactions = useManagedTransactions;
|
||||||
|
this.securityEnabled = securityEnabled;
|
||||||
|
|
||||||
// Properties for generalo job execution
|
if (propertiesFileName != null) {
|
||||||
private int jobBatchSize = 100;
|
this.propertiesFileName = propertiesFileName;
|
||||||
private int maxNumberOfJobRetries = 3;
|
|
||||||
|
|
||||||
// Properties for the cleanup job
|
|
||||||
private Instant cleanupJobFirstRun = Instant.parse("2018-01-01T00:00:00Z");
|
|
||||||
private Duration cleanupJobRunEvery = Duration.parse("P1D");
|
|
||||||
private Duration cleanupJobMinimumAge = Duration.parse("P14D");
|
|
||||||
private boolean taskCleanupJobAllCompletedSameParentBusiness = true;
|
|
||||||
|
|
||||||
// List of configured domain names
|
|
||||||
protected List<String> domains = new ArrayList<String>();
|
|
||||||
|
|
||||||
// List of configured classification types
|
|
||||||
protected List<String> classificationTypes = new ArrayList<String>();
|
|
||||||
|
|
||||||
protected Map<String, List<String>> classificationCategoriesByTypeMap = new HashMap<String, List<String>>();
|
|
||||||
|
|
||||||
public TaskanaEngineConfiguration(DataSource dataSource, boolean useManagedTransactions, String schemaName)
|
|
||||||
throws SQLException {
|
|
||||||
this(dataSource, useManagedTransactions, true, schemaName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public TaskanaEngineConfiguration(DataSource dataSource, boolean useManagedTransactions,
|
if (rolesSeparator != null) {
|
||||||
boolean securityEnabled, String schemaName) throws SQLException {
|
this.rolesSeparator = rolesSeparator;
|
||||||
this(dataSource, useManagedTransactions, securityEnabled, null, null, schemaName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public TaskanaEngineConfiguration(DataSource dataSource, boolean useManagedTransactions,
|
if (dataSource != null) {
|
||||||
boolean securityEnabled, String propertiesFileName, String rolesSeparator, String schemaName)
|
this.dataSource = dataSource;
|
||||||
throws SQLException {
|
} else {
|
||||||
this.useManagedTransactions = useManagedTransactions;
|
// use default In Memory datasource
|
||||||
this.securityEnabled = securityEnabled;
|
this.dataSource = createDefaultDataSource();
|
||||||
|
|
||||||
if (propertiesFileName != null) {
|
|
||||||
this.propertiesFileName = propertiesFileName;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rolesSeparator != null) {
|
|
||||||
this.rolesSeparator = rolesSeparator;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dataSource != null) {
|
|
||||||
this.dataSource = dataSource;
|
|
||||||
} else {
|
|
||||||
// use default In Memory datasource
|
|
||||||
this.dataSource = createDefaultDataSource();
|
|
||||||
}
|
|
||||||
|
|
||||||
initSchemaName(schemaName);
|
|
||||||
initTaskanaProperties(this.propertiesFileName, this.rolesSeparator);
|
|
||||||
|
|
||||||
dbSchemaCreator = new DbSchemaCreator(this.dataSource, this.getSchemaName());
|
|
||||||
dbSchemaCreator.run();
|
|
||||||
|
|
||||||
if (!dbSchemaCreator.isValidSchemaVersion(TASKANA_SCHEMA_VERSION)) {
|
|
||||||
throw new SystemException(
|
|
||||||
"The Database Schema Version doesn't match the expected version " + TASKANA_SCHEMA_VERSION);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initTaskanaProperties(String propertiesFile, String rolesSeparator) {
|
initSchemaName(schemaName);
|
||||||
LOGGER.debug("Reading taskana configuration from {} with role separator {}", propertiesFile, rolesSeparator);
|
initTaskanaProperties(this.propertiesFileName, this.rolesSeparator);
|
||||||
Properties props = readPropertiesFromFile(propertiesFile);
|
|
||||||
initTaskanaRoles(props, rolesSeparator);
|
dbSchemaCreator = new DbSchemaCreator(this.dataSource, this.getSchemaName());
|
||||||
initJobParameters(props);
|
dbSchemaCreator.run();
|
||||||
initDomains(props);
|
|
||||||
initClassificationTypes(props);
|
if (!dbSchemaCreator.isValidSchemaVersion(TASKANA_SCHEMA_VERSION)) {
|
||||||
initClassificationCategories(props);
|
throw new SystemException(
|
||||||
|
"The Database Schema Version doesn't match the expected version "
|
||||||
|
+ TASKANA_SCHEMA_VERSION);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void initJobParameters(Properties props) {
|
public void initTaskanaProperties(String propertiesFile, String rolesSeparator) {
|
||||||
String jobBatchSizeProperty = props.getProperty(TASKANA_JOB_BATCHSIZE);
|
LOGGER.debug(
|
||||||
if (jobBatchSizeProperty != null && !jobBatchSizeProperty.isEmpty()) {
|
"Reading taskana configuration from {} with role separator {}",
|
||||||
try {
|
propertiesFile,
|
||||||
jobBatchSize = Integer.parseInt(jobBatchSizeProperty);
|
rolesSeparator);
|
||||||
} catch (Exception e) {
|
Properties props = readPropertiesFromFile(propertiesFile);
|
||||||
LOGGER.warn("Could not parse jobBatchSizeProperty ({}). Using default. Exception: {} ",
|
initTaskanaRoles(props, rolesSeparator);
|
||||||
jobBatchSizeProperty, e.getMessage());
|
initJobParameters(props);
|
||||||
}
|
initDomains(props);
|
||||||
}
|
initClassificationTypes(props);
|
||||||
|
initClassificationCategories(props);
|
||||||
|
}
|
||||||
|
|
||||||
String maxNumberOfJobRetriesProperty = props.getProperty(TASKANA_JOB_RETRIES);
|
public static DataSource createDefaultDataSource() {
|
||||||
if (maxNumberOfJobRetriesProperty != null && !maxNumberOfJobRetriesProperty.isEmpty()) {
|
LOGGER.info(
|
||||||
try {
|
"No datasource is provided. A inmemory db is used: "
|
||||||
maxNumberOfJobRetries = Integer.parseInt(maxNumberOfJobRetriesProperty);
|
|
||||||
} catch (Exception e) {
|
|
||||||
LOGGER.warn("Could not parse maxNumberOfJobRetriesProperty ({}). Using default. Exception: {} ",
|
|
||||||
maxNumberOfJobRetriesProperty, e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
String taskCleanupJobFirstRunProperty = props.getProperty(TASKANA_JOB_CLEANUP_FIRST_RUN);
|
|
||||||
if (taskCleanupJobFirstRunProperty != null && !taskCleanupJobFirstRunProperty.isEmpty()) {
|
|
||||||
try {
|
|
||||||
cleanupJobFirstRun = Instant.parse(taskCleanupJobFirstRunProperty);
|
|
||||||
} catch (Exception e) {
|
|
||||||
LOGGER.warn("Could not parse taskCleanupJobFirstRunProperty ({}). Using default. Exception: {} ",
|
|
||||||
taskCleanupJobFirstRunProperty, e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
String taskCleanupJobRunEveryProperty = props.getProperty(TASKANA_JOB_CLEANUP_RUN_EVERY);
|
|
||||||
if (taskCleanupJobRunEveryProperty != null && !taskCleanupJobRunEveryProperty.isEmpty()) {
|
|
||||||
try {
|
|
||||||
cleanupJobRunEvery = Duration.parse(taskCleanupJobRunEveryProperty);
|
|
||||||
} catch (Exception e) {
|
|
||||||
LOGGER.warn("Could not parse taskCleanupJobRunEveryProperty ({}). Using default. Exception: {} ",
|
|
||||||
taskCleanupJobRunEveryProperty, e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
String taskCleanupJobMinimumAgeProperty = props.getProperty(TASKANA_JOB_CLEANUP_MINIMUM_AGE);
|
|
||||||
if (taskCleanupJobMinimumAgeProperty != null && !taskCleanupJobMinimumAgeProperty.isEmpty()) {
|
|
||||||
try {
|
|
||||||
cleanupJobMinimumAge = Duration.parse(taskCleanupJobMinimumAgeProperty);
|
|
||||||
} catch (Exception e) {
|
|
||||||
LOGGER.warn("Could not parse taskCleanupJobMinimumAgeProperty ({}). Using default. Exception: {} ",
|
|
||||||
taskCleanupJobMinimumAgeProperty, e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
String taskCleanupJobAllCompletedSameParentBusinessProperty = props.getProperty(
|
|
||||||
TASKANA_JOB_TASK_CLEANUP_ALL_COMPLETED_SAME_PARENTE_BUSINESS);
|
|
||||||
if (taskCleanupJobAllCompletedSameParentBusinessProperty != null
|
|
||||||
&& !taskCleanupJobAllCompletedSameParentBusinessProperty.isEmpty()) {
|
|
||||||
try {
|
|
||||||
taskCleanupJobAllCompletedSameParentBusiness = Boolean.parseBoolean(
|
|
||||||
taskCleanupJobAllCompletedSameParentBusinessProperty);
|
|
||||||
} catch (Exception e) {
|
|
||||||
LOGGER.warn(
|
|
||||||
"Could not parse taskCleanupJobAllCompletedSameParentBusinessProperty ({}). Using default. Exception: {} ",
|
|
||||||
taskCleanupJobAllCompletedSameParentBusinessProperty, e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
LOGGER.debug("Configured number of task and workbasket updates per transaction: {}", jobBatchSize);
|
|
||||||
LOGGER.debug("Number of retries of failed task updates: {}", maxNumberOfJobRetries);
|
|
||||||
LOGGER.debug("CleanupJob configuration: first run at {}", cleanupJobFirstRun);
|
|
||||||
LOGGER.debug("CleanupJob configuration: runs every {}", cleanupJobRunEvery);
|
|
||||||
LOGGER.debug("CleanupJob configuration: minimum age of tasks to be cleanup up is {}",
|
|
||||||
cleanupJobMinimumAge);
|
|
||||||
LOGGER.debug("TaskCleanupJob configuration: all completed task with the same parent business property id {}",
|
|
||||||
taskCleanupJobAllCompletedSameParentBusiness);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initDomains(Properties props) {
|
|
||||||
String domainNames = props.getProperty(TASKANA_DOMAINS_PROPERTY);
|
|
||||||
if (domainNames != null && !domainNames.isEmpty()) {
|
|
||||||
StringTokenizer st = new StringTokenizer(domainNames, ",");
|
|
||||||
while (st.hasMoreTokens()) {
|
|
||||||
domains.add(st.nextToken().trim().toUpperCase());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
LOGGER.debug("Configured domains: {}", domains);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initClassificationTypes(Properties props) {
|
|
||||||
String classificationTypesNames = props.getProperty(TASKANA_CLASSIFICATION_TYPES_PROPERTY);
|
|
||||||
if (classificationTypesNames != null && !classificationTypesNames.isEmpty()) {
|
|
||||||
StringTokenizer st = new StringTokenizer(classificationTypesNames, ",");
|
|
||||||
while (st.hasMoreTokens()) {
|
|
||||||
classificationTypes.add(st.nextToken().trim().toUpperCase());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
LOGGER.warn("Configuration issue. Classification type is missing");
|
|
||||||
}
|
|
||||||
LOGGER.debug("Configured classificationTypes: {}", classificationTypes);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initClassificationCategories(Properties props) {
|
|
||||||
if (classificationTypes != null && !classificationTypes.isEmpty()) {
|
|
||||||
String classificationCategoryNames;
|
|
||||||
StringTokenizer st;
|
|
||||||
List<String> classificationCategoriesAux;
|
|
||||||
for (String type : classificationTypes) {
|
|
||||||
classificationCategoriesAux = new ArrayList<>();
|
|
||||||
classificationCategoryNames = props.getProperty(
|
|
||||||
TASKANA_CLASSIFICATION_CATEGORIES_PROPERTY + "." + type.toLowerCase());
|
|
||||||
if (classificationCategoryNames != null && !classificationCategoryNames.isEmpty()) {
|
|
||||||
st = new StringTokenizer(classificationCategoryNames, ",");
|
|
||||||
while (st.hasMoreTokens()) {
|
|
||||||
classificationCategoriesAux.add(st.nextToken().trim().toUpperCase());
|
|
||||||
}
|
|
||||||
classificationCategoriesByTypeMap.put(type, classificationCategoriesAux);
|
|
||||||
} else {
|
|
||||||
LOGGER.warn("Configuration issue. Classification categories by type is missing");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
LOGGER.debug("Configured classification categories : {}", domains);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initSchemaName(String schemaName) {
|
|
||||||
if (schemaName != null && !schemaName.isEmpty()) {
|
|
||||||
this.setSchemaName(schemaName);
|
|
||||||
} else {
|
|
||||||
this.setSchemaName(DEFAULT_SCHEMA_NAME);
|
|
||||||
}
|
|
||||||
|
|
||||||
try (Connection connection = dataSource.getConnection()) {
|
|
||||||
String databaseProductName = connection.getMetaData().getDatabaseProductName();
|
|
||||||
if (DB.isPostgreSQL(databaseProductName)) {
|
|
||||||
this.schemaName = this.schemaName.toLowerCase();
|
|
||||||
} else {
|
|
||||||
this.schemaName = this.schemaName.toUpperCase();
|
|
||||||
}
|
|
||||||
} catch (SQLException ex) {
|
|
||||||
LOGGER.error("Caught {} when attempting to initialize the schema name", ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
LOGGER.debug("Using schema name {}", this.getSchemaName());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initTaskanaRoles(Properties props, String rolesSeparator) {
|
|
||||||
List<String> validPropertyNames = TaskanaRole.getValidPropertyNames();
|
|
||||||
|
|
||||||
props.keySet()
|
|
||||||
.stream()
|
|
||||||
.map(String::valueOf)
|
|
||||||
.filter(propertyName -> validPropertyNames.contains(propertyName.toLowerCase().trim()))
|
|
||||||
.forEach(validPropertyName -> roleMap.put(TaskanaRole.fromPropertyName(validPropertyName),
|
|
||||||
getTokensWithCollection(props.getProperty(validPropertyName), rolesSeparator)));
|
|
||||||
|
|
||||||
ensureRoleMapIsFullyInitialized();
|
|
||||||
|
|
||||||
if (LOGGER.isDebugEnabled()) {
|
|
||||||
roleMap.forEach(
|
|
||||||
(k, v) -> LOGGER.debug("Found Taskana RoleConfig {} : {} ", k, LoggerUtils.setToString(v)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private HashSet<String> getTokensWithCollection(String str, String rolesSeparator) {
|
|
||||||
return Collections.list(new StringTokenizer(str, rolesSeparator)).stream()
|
|
||||||
.map(token -> String.valueOf(token).toLowerCase().trim())
|
|
||||||
.collect(Collectors.toCollection(HashSet::new));
|
|
||||||
}
|
|
||||||
|
|
||||||
private Properties readPropertiesFromFile(String propertiesFile) {
|
|
||||||
Properties props = new Properties();
|
|
||||||
boolean loadFromClasspath = loadFromClasspath(propertiesFile);
|
|
||||||
try {
|
|
||||||
if (loadFromClasspath) {
|
|
||||||
InputStream inputStream = this.getClass().getResourceAsStream(propertiesFile);
|
|
||||||
if (inputStream == null) {
|
|
||||||
LOGGER.error("taskana properties file {} was not found on classpath.",
|
|
||||||
propertiesFile);
|
|
||||||
} else {
|
|
||||||
props.load(new InputStreamReader(inputStream, StandardCharsets.UTF_8));
|
|
||||||
LOGGER.debug("Role properties were loaded from file {} from classpath.", propertiesFile);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
props.load(new FileInputStream(propertiesFile));
|
|
||||||
LOGGER.debug("Role properties were loaded from file {}.", propertiesFile);
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
LOGGER.error("caught IOException when processing properties file {}.", propertiesFile);
|
|
||||||
throw new SystemException("internal System error when processing properties file " + propertiesFile,
|
|
||||||
e.getCause());
|
|
||||||
}
|
|
||||||
return props;
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean loadFromClasspath(String propertiesFile) {
|
|
||||||
boolean loadFromClasspath = true;
|
|
||||||
File f = new File(propertiesFile);
|
|
||||||
if (f.exists() && !f.isDirectory()) {
|
|
||||||
loadFromClasspath = false;
|
|
||||||
}
|
|
||||||
return loadFromClasspath;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ensureRoleMapIsFullyInitialized() {
|
|
||||||
// make sure that roleMap does not return null for any role
|
|
||||||
Arrays.stream(TaskanaRole.values())
|
|
||||||
.forEach(role -> roleMap.putIfAbsent(role, new HashSet<>()));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static DataSource createDefaultDataSource() {
|
|
||||||
LOGGER.info("No datasource is provided. A inmemory db is used: "
|
|
||||||
+ "'org.h2.Driver', 'jdbc:h2:mem:taskana;IGNORECASE=TRUE;LOCK_MODE=0', 'sa', 'sa'");
|
+ "'org.h2.Driver', 'jdbc:h2:mem:taskana;IGNORECASE=TRUE;LOCK_MODE=0', 'sa', 'sa'");
|
||||||
return createDatasource(H2_DRIVER, JDBC_H2_MEM_TASKANA, USER_NAME, USER_PASSWORD);
|
return createDatasource(H2_DRIVER, JDBC_H2_MEM_TASKANA, USER_NAME, USER_PASSWORD);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method creates the TaskanaEngine without an sqlSessionFactory.
|
||||||
|
*
|
||||||
|
* @return the TaskanaEngine
|
||||||
|
*/
|
||||||
|
public TaskanaEngine buildTaskanaEngine() {
|
||||||
|
return TaskanaEngineImpl.createTaskanaEngine(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method creates a PooledDataSource, if the needed properties are provided.
|
||||||
|
*
|
||||||
|
* @param driver the name of the jdbc driver
|
||||||
|
* @param jdbcUrl the url to which the jdbc driver connects
|
||||||
|
* @param username the user name for database access
|
||||||
|
* @param password the password for database access
|
||||||
|
* @return DataSource
|
||||||
|
*/
|
||||||
|
public static DataSource createDatasource(
|
||||||
|
String driver, String jdbcUrl, String username, String password) {
|
||||||
|
return new PooledDataSource(driver, jdbcUrl, username, password);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isSecurityEnabled() {
|
||||||
|
return this.securityEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DataSource getDatasource() {
|
||||||
|
return this.dataSource;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getUseManagedTransactions() {
|
||||||
|
return this.useManagedTransactions;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPropertiesFileName() {
|
||||||
|
return this.propertiesFileName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPropertiesFileName(String propertiesFileName) {
|
||||||
|
this.propertiesFileName = propertiesFileName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMaxNumberOfUpdatesPerTransaction() {
|
||||||
|
return jobBatchSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMaxNumberOfJobRetries() {
|
||||||
|
return maxNumberOfJobRetries;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPropertiesSeparator() {
|
||||||
|
return this.rolesSeparator;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPropertiesSeparator(String propertiesSeparator) {
|
||||||
|
this.rolesSeparator = propertiesSeparator;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isGermanPublicHolidaysEnabled() {
|
||||||
|
return this.germanPublicHolidaysEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGermanPublicHolidaysEnabled(boolean germanPublicHolidaysEnabled) {
|
||||||
|
this.germanPublicHolidaysEnabled = germanPublicHolidaysEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<LocalDate> getCustomHolidays() {
|
||||||
|
return customHolidays;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCustomHolidays(List<LocalDate> customHolidays) {
|
||||||
|
this.customHolidays = customHolidays;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<TaskanaRole, Set<String>> getRoleMap() {
|
||||||
|
return roleMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRoleMap(Map<TaskanaRole, Set<String>> roleMap) {
|
||||||
|
this.roleMap = roleMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getDomains() {
|
||||||
|
return domains;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDomains(List<String> domains) {
|
||||||
|
this.domains = domains;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getClassificationTypes() {
|
||||||
|
return classificationTypes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setClassificationTypes(List<String> classificationTypes) {
|
||||||
|
this.classificationTypes = classificationTypes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getAllClassificationCategories() {
|
||||||
|
List<String> classificationCategories = new ArrayList<>();
|
||||||
|
for (Map.Entry<String, List<String>> type : this.classificationCategoriesByTypeMap.entrySet()) {
|
||||||
|
classificationCategories.addAll(type.getValue());
|
||||||
|
}
|
||||||
|
return classificationCategories;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getClassificationCategoriesByType(String type) {
|
||||||
|
return classificationCategoriesByTypeMap.get(type);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setClassificationCategoriesByType(
|
||||||
|
Map<String, List<String>> classificationCategoriesByType) {
|
||||||
|
this.classificationCategoriesByTypeMap = classificationCategoriesByType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Instant getCleanupJobFirstRun() {
|
||||||
|
return cleanupJobFirstRun;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Duration getCleanupJobRunEvery() {
|
||||||
|
return cleanupJobRunEvery;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Duration getCleanupJobMinimumAge() {
|
||||||
|
return cleanupJobMinimumAge;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isTaskCleanupJobAllCompletedSameParentBusiness() {
|
||||||
|
return taskCleanupJobAllCompletedSameParentBusiness;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTaskCleanupJobAllCompletedSameParentBusiness(
|
||||||
|
boolean taskCleanupJobAllCompletedSameParentBusiness) {
|
||||||
|
this.taskCleanupJobAllCompletedSameParentBusiness =
|
||||||
|
taskCleanupJobAllCompletedSameParentBusiness;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSchemaName() {
|
||||||
|
return schemaName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSchemaName(String schemaName) {
|
||||||
|
this.schemaName = schemaName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper method to determine whether all access ids (user Id and group ids) should be used in
|
||||||
|
* lower case.
|
||||||
|
*
|
||||||
|
* @return true if all access ids should be used in lower case, false otherwise
|
||||||
|
*/
|
||||||
|
public static boolean shouldUseLowerCaseForAccessIds() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initJobParameters(Properties props) {
|
||||||
|
String jobBatchSizeProperty = props.getProperty(TASKANA_JOB_BATCHSIZE);
|
||||||
|
if (jobBatchSizeProperty != null && !jobBatchSizeProperty.isEmpty()) {
|
||||||
|
try {
|
||||||
|
jobBatchSize = Integer.parseInt(jobBatchSizeProperty);
|
||||||
|
} catch (Exception e) {
|
||||||
|
LOGGER.warn(
|
||||||
|
"Could not parse jobBatchSizeProperty ({}). Using default. Exception: {} ",
|
||||||
|
jobBatchSizeProperty,
|
||||||
|
e.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
String maxNumberOfJobRetriesProperty = props.getProperty(TASKANA_JOB_RETRIES);
|
||||||
* This method creates the TaskanaEngine without an sqlSessionFactory.
|
if (maxNumberOfJobRetriesProperty != null && !maxNumberOfJobRetriesProperty.isEmpty()) {
|
||||||
*
|
try {
|
||||||
* @return the TaskanaEngine
|
maxNumberOfJobRetries = Integer.parseInt(maxNumberOfJobRetriesProperty);
|
||||||
*/
|
} catch (Exception e) {
|
||||||
public TaskanaEngine buildTaskanaEngine() {
|
LOGGER.warn(
|
||||||
return TaskanaEngineImpl.createTaskanaEngine(this);
|
"Could not parse maxNumberOfJobRetriesProperty ({}). Using default. Exception: {} ",
|
||||||
|
maxNumberOfJobRetriesProperty,
|
||||||
|
e.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
String taskCleanupJobFirstRunProperty = props.getProperty(TASKANA_JOB_CLEANUP_FIRST_RUN);
|
||||||
* This method creates a PooledDataSource, if the needed properties are provided.
|
if (taskCleanupJobFirstRunProperty != null && !taskCleanupJobFirstRunProperty.isEmpty()) {
|
||||||
*
|
try {
|
||||||
* @param driver
|
cleanupJobFirstRun = Instant.parse(taskCleanupJobFirstRunProperty);
|
||||||
* the name of the jdbc driver
|
} catch (Exception e) {
|
||||||
* @param jdbcUrl
|
LOGGER.warn(
|
||||||
* the url to which the jdbc driver connects
|
"Could not parse taskCleanupJobFirstRunProperty ({}). Using default. Exception: {} ",
|
||||||
* @param username
|
taskCleanupJobFirstRunProperty,
|
||||||
* the user name for database access
|
e.getMessage());
|
||||||
* @param password
|
}
|
||||||
* the password for database access
|
|
||||||
* @return DataSource
|
|
||||||
*/
|
|
||||||
public static DataSource createDatasource(String driver, String jdbcUrl, String username, String password) {
|
|
||||||
return new PooledDataSource(driver, jdbcUrl, username, password);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSecurityEnabled() {
|
String taskCleanupJobRunEveryProperty = props.getProperty(TASKANA_JOB_CLEANUP_RUN_EVERY);
|
||||||
return this.securityEnabled;
|
if (taskCleanupJobRunEveryProperty != null && !taskCleanupJobRunEveryProperty.isEmpty()) {
|
||||||
|
try {
|
||||||
|
cleanupJobRunEvery = Duration.parse(taskCleanupJobRunEveryProperty);
|
||||||
|
} catch (Exception e) {
|
||||||
|
LOGGER.warn(
|
||||||
|
"Could not parse taskCleanupJobRunEveryProperty ({}). Using default. Exception: {} ",
|
||||||
|
taskCleanupJobRunEveryProperty,
|
||||||
|
e.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public DataSource getDatasource() {
|
String taskCleanupJobMinimumAgeProperty = props.getProperty(TASKANA_JOB_CLEANUP_MINIMUM_AGE);
|
||||||
return this.dataSource;
|
if (taskCleanupJobMinimumAgeProperty != null && !taskCleanupJobMinimumAgeProperty.isEmpty()) {
|
||||||
|
try {
|
||||||
|
cleanupJobMinimumAge = Duration.parse(taskCleanupJobMinimumAgeProperty);
|
||||||
|
} catch (Exception e) {
|
||||||
|
LOGGER.warn(
|
||||||
|
"Could not parse taskCleanupJobMinimumAgeProperty ({}). Using default. Exception: {} ",
|
||||||
|
taskCleanupJobMinimumAgeProperty,
|
||||||
|
e.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getUseManagedTransactions() {
|
String taskCleanupJobAllCompletedSameParentBusinessProperty =
|
||||||
return this.useManagedTransactions;
|
props.getProperty(TASKANA_JOB_TASK_CLEANUP_ALL_COMPLETED_SAME_PARENTE_BUSINESS);
|
||||||
|
if (taskCleanupJobAllCompletedSameParentBusinessProperty != null
|
||||||
|
&& !taskCleanupJobAllCompletedSameParentBusinessProperty.isEmpty()) {
|
||||||
|
try {
|
||||||
|
taskCleanupJobAllCompletedSameParentBusiness =
|
||||||
|
Boolean.parseBoolean(taskCleanupJobAllCompletedSameParentBusinessProperty);
|
||||||
|
} catch (Exception e) {
|
||||||
|
LOGGER.warn(
|
||||||
|
"Could not parse taskCleanupJobAllCompletedSameParentBusinessProperty ({}). Using default. Exception: {} ",
|
||||||
|
taskCleanupJobAllCompletedSameParentBusinessProperty,
|
||||||
|
e.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPropertiesFileName() {
|
LOGGER.debug(
|
||||||
return this.propertiesFileName;
|
"Configured number of task and workbasket updates per transaction: {}", jobBatchSize);
|
||||||
}
|
LOGGER.debug("Number of retries of failed task updates: {}", maxNumberOfJobRetries);
|
||||||
|
LOGGER.debug("CleanupJob configuration: first run at {}", cleanupJobFirstRun);
|
||||||
|
LOGGER.debug("CleanupJob configuration: runs every {}", cleanupJobRunEvery);
|
||||||
|
LOGGER.debug(
|
||||||
|
"CleanupJob configuration: minimum age of tasks to be cleanup up is {}",
|
||||||
|
cleanupJobMinimumAge);
|
||||||
|
LOGGER.debug(
|
||||||
|
"TaskCleanupJob configuration: all completed task with the same parent business property id {}",
|
||||||
|
taskCleanupJobAllCompletedSameParentBusiness);
|
||||||
|
}
|
||||||
|
|
||||||
public int getMaxNumberOfUpdatesPerTransaction() {
|
private void initDomains(Properties props) {
|
||||||
return jobBatchSize;
|
String domainNames = props.getProperty(TASKANA_DOMAINS_PROPERTY);
|
||||||
|
if (domainNames != null && !domainNames.isEmpty()) {
|
||||||
|
StringTokenizer st = new StringTokenizer(domainNames, ",");
|
||||||
|
while (st.hasMoreTokens()) {
|
||||||
|
domains.add(st.nextToken().trim().toUpperCase());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
LOGGER.debug("Configured domains: {}", domains);
|
||||||
|
}
|
||||||
|
|
||||||
public int getMaxNumberOfJobRetries() {
|
private void initClassificationTypes(Properties props) {
|
||||||
return maxNumberOfJobRetries;
|
String classificationTypesNames = props.getProperty(TASKANA_CLASSIFICATION_TYPES_PROPERTY);
|
||||||
|
if (classificationTypesNames != null && !classificationTypesNames.isEmpty()) {
|
||||||
|
StringTokenizer st = new StringTokenizer(classificationTypesNames, ",");
|
||||||
|
while (st.hasMoreTokens()) {
|
||||||
|
classificationTypes.add(st.nextToken().trim().toUpperCase());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
LOGGER.warn("Configuration issue. Classification type is missing");
|
||||||
}
|
}
|
||||||
|
LOGGER.debug("Configured classificationTypes: {}", classificationTypes);
|
||||||
|
}
|
||||||
|
|
||||||
public void setPropertiesFileName(String propertiesFileName) {
|
private void initClassificationCategories(Properties props) {
|
||||||
this.propertiesFileName = propertiesFileName;
|
if (classificationTypes != null && !classificationTypes.isEmpty()) {
|
||||||
}
|
String classificationCategoryNames;
|
||||||
|
StringTokenizer st;
|
||||||
public String getPropertiesSeparator() {
|
List<String> classificationCategoriesAux;
|
||||||
return this.rolesSeparator;
|
for (String type : classificationTypes) {
|
||||||
}
|
classificationCategoriesAux = new ArrayList<>();
|
||||||
|
classificationCategoryNames =
|
||||||
public void setPropertiesSeparator(String propertiesSeparator) {
|
props.getProperty(
|
||||||
this.rolesSeparator = propertiesSeparator;
|
TASKANA_CLASSIFICATION_CATEGORIES_PROPERTY + "." + type.toLowerCase());
|
||||||
}
|
if (classificationCategoryNames != null && !classificationCategoryNames.isEmpty()) {
|
||||||
|
st = new StringTokenizer(classificationCategoryNames, ",");
|
||||||
public boolean isGermanPublicHolidaysEnabled() {
|
while (st.hasMoreTokens()) {
|
||||||
return this.germanPublicHolidaysEnabled;
|
classificationCategoriesAux.add(st.nextToken().trim().toUpperCase());
|
||||||
}
|
}
|
||||||
|
classificationCategoriesByTypeMap.put(type, classificationCategoriesAux);
|
||||||
public void setGermanPublicHolidaysEnabled(boolean germanPublicHolidaysEnabled) {
|
} else {
|
||||||
this.germanPublicHolidaysEnabled = germanPublicHolidaysEnabled;
|
LOGGER.warn("Configuration issue. Classification categories by type is missing");
|
||||||
}
|
|
||||||
|
|
||||||
public List<LocalDate> getCustomHolidays() {
|
|
||||||
return customHolidays;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCustomHolidays(List<LocalDate> customHolidays) {
|
|
||||||
this.customHolidays = customHolidays;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map<TaskanaRole, Set<String>> getRoleMap() {
|
|
||||||
return roleMap;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRoleMap(Map<TaskanaRole, Set<String>> roleMap) {
|
|
||||||
this.roleMap = roleMap;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> getDomains() {
|
|
||||||
return domains;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDomains(List<String> domains) {
|
|
||||||
this.domains = domains;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> getClassificationTypes() {
|
|
||||||
return classificationTypes;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setClassificationTypes(List<String> classificationTypes) {
|
|
||||||
this.classificationTypes = classificationTypes;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> getAllClassificationCategories() {
|
|
||||||
List<String> classificationCategories = new ArrayList<>();
|
|
||||||
for (Map.Entry<String, List<String>> type : this.classificationCategoriesByTypeMap.entrySet()) {
|
|
||||||
classificationCategories.addAll(type.getValue());
|
|
||||||
}
|
}
|
||||||
return classificationCategories;
|
}
|
||||||
|
}
|
||||||
|
LOGGER.debug("Configured classification categories : {}", domains);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initSchemaName(String schemaName) {
|
||||||
|
if (schemaName != null && !schemaName.isEmpty()) {
|
||||||
|
this.setSchemaName(schemaName);
|
||||||
|
} else {
|
||||||
|
this.setSchemaName(DEFAULT_SCHEMA_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getClassificationCategoriesByType(String type) {
|
try (Connection connection = dataSource.getConnection()) {
|
||||||
return classificationCategoriesByTypeMap.get(type);
|
String databaseProductName = connection.getMetaData().getDatabaseProductName();
|
||||||
|
if (DB.isPostgreSQL(databaseProductName)) {
|
||||||
|
this.schemaName = this.schemaName.toLowerCase();
|
||||||
|
} else {
|
||||||
|
this.schemaName = this.schemaName.toUpperCase();
|
||||||
|
}
|
||||||
|
} catch (SQLException ex) {
|
||||||
|
LOGGER.error("Caught {} when attempting to initialize the schema name", ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setClassificationCategoriesByType(Map<String, List<String>> classificationCategoriesByType) {
|
LOGGER.debug("Using schema name {}", this.getSchemaName());
|
||||||
this.classificationCategoriesByTypeMap = classificationCategoriesByType;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public Instant getCleanupJobFirstRun() {
|
private void initTaskanaRoles(Properties props, String rolesSeparator) {
|
||||||
return cleanupJobFirstRun;
|
List<String> validPropertyNames = TaskanaRole.getValidPropertyNames();
|
||||||
}
|
|
||||||
|
|
||||||
public Duration getCleanupJobRunEvery() {
|
props.keySet().stream()
|
||||||
return cleanupJobRunEvery;
|
.map(String::valueOf)
|
||||||
}
|
.filter(propertyName -> validPropertyNames.contains(propertyName.toLowerCase().trim()))
|
||||||
|
.forEach(
|
||||||
|
validPropertyName ->
|
||||||
|
roleMap.put(
|
||||||
|
TaskanaRole.fromPropertyName(validPropertyName),
|
||||||
|
getTokensWithCollection(props.getProperty(validPropertyName), rolesSeparator)));
|
||||||
|
|
||||||
public Duration getCleanupJobMinimumAge() {
|
ensureRoleMapIsFullyInitialized();
|
||||||
return cleanupJobMinimumAge;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTaskCleanupJobAllCompletedSameParentBusiness(boolean taskCleanupJobAllCompletedSameParentBusiness) {
|
if (LOGGER.isDebugEnabled()) {
|
||||||
this.taskCleanupJobAllCompletedSameParentBusiness = taskCleanupJobAllCompletedSameParentBusiness;
|
roleMap.forEach(
|
||||||
|
(k, v) ->
|
||||||
|
LOGGER.debug("Found Taskana RoleConfig {} : {} ", k, LoggerUtils.setToString(v)));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isTaskCleanupJobAllCompletedSameParentBusiness() {
|
private HashSet<String> getTokensWithCollection(String str, String rolesSeparator) {
|
||||||
return taskCleanupJobAllCompletedSameParentBusiness;
|
return Collections.list(new StringTokenizer(str, rolesSeparator)).stream()
|
||||||
|
.map(token -> String.valueOf(token).toLowerCase().trim())
|
||||||
|
.collect(Collectors.toCollection(HashSet::new));
|
||||||
|
}
|
||||||
|
|
||||||
|
private Properties readPropertiesFromFile(String propertiesFile) {
|
||||||
|
Properties props = new Properties();
|
||||||
|
boolean loadFromClasspath = loadFromClasspath(propertiesFile);
|
||||||
|
try {
|
||||||
|
if (loadFromClasspath) {
|
||||||
|
InputStream inputStream = this.getClass().getResourceAsStream(propertiesFile);
|
||||||
|
if (inputStream == null) {
|
||||||
|
LOGGER.error("taskana properties file {} was not found on classpath.", propertiesFile);
|
||||||
|
} else {
|
||||||
|
props.load(new InputStreamReader(inputStream, StandardCharsets.UTF_8));
|
||||||
|
LOGGER.debug("Role properties were loaded from file {} from classpath.", propertiesFile);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
props.load(new FileInputStream(propertiesFile));
|
||||||
|
LOGGER.debug("Role properties were loaded from file {}.", propertiesFile);
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
LOGGER.error("caught IOException when processing properties file {}.", propertiesFile);
|
||||||
|
throw new SystemException(
|
||||||
|
"internal System error when processing properties file " + propertiesFile, e.getCause());
|
||||||
}
|
}
|
||||||
|
return props;
|
||||||
|
}
|
||||||
|
|
||||||
public String getSchemaName() {
|
private boolean loadFromClasspath(String propertiesFile) {
|
||||||
return schemaName;
|
boolean loadFromClasspath = true;
|
||||||
}
|
File f = new File(propertiesFile);
|
||||||
|
if (f.exists() && !f.isDirectory()) {
|
||||||
public void setSchemaName(String schemaName) {
|
loadFromClasspath = false;
|
||||||
this.schemaName = schemaName;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Helper method to determine whether all access ids (user Id and group ids) should be used in lower case.
|
|
||||||
*
|
|
||||||
* @return true if all access ids should be used in lower case, false otherwise
|
|
||||||
*/
|
|
||||||
public static boolean shouldUseLowerCaseForAccessIds() {
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
return loadFromClasspath;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ensureRoleMapIsFullyInitialized() {
|
||||||
|
// make sure that roleMap does not return null for any role
|
||||||
|
Arrays.stream(TaskanaRole.values()).forEach(role -> roleMap.putIfAbsent(role, new HashSet<>()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,14 +2,14 @@ package pro.taskana.exceptions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Thrown, when an attachment should be inserted to the DB, but it does already exist.<br>
|
* Thrown, when an attachment should be inserted to the DB, but it does already exist.<br>
|
||||||
* This may happen when a not persisted attachment with ID will be added twice on a task. This can´t be happen it the
|
* This may happen when a not persisted attachment with ID will be added twice on a task. This can´t
|
||||||
* correct Task-Methods will be used instead the List ones.
|
* be happen it the correct Task-Methods will be used instead the List ones.
|
||||||
*/
|
*/
|
||||||
public class AttachmentPersistenceException extends TaskanaException {
|
public class AttachmentPersistenceException extends TaskanaException {
|
||||||
|
|
||||||
private static final long serialVersionUID = 123L;
|
private static final long serialVersionUID = 123L;
|
||||||
|
|
||||||
public AttachmentPersistenceException(String msg, Throwable cause) {
|
public AttachmentPersistenceException(String msg, Throwable cause) {
|
||||||
super(msg, cause);
|
super(msg, cause);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,10 @@
|
||||||
package pro.taskana.exceptions;
|
package pro.taskana.exceptions;
|
||||||
|
|
||||||
/**
|
/** Thrown in ConnectionManagementMode AUTOCOMMIT when an attempt to commit fails. */
|
||||||
* Thrown in ConnectionManagementMode AUTOCOMMIT when an attempt to commit fails.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class AutocommitFailedException extends TaskanaRuntimeException {
|
public class AutocommitFailedException extends TaskanaRuntimeException {
|
||||||
public AutocommitFailedException(Throwable cause) {
|
private static final long serialVersionUID = 1L;
|
||||||
super("Autocommit failed", cause);
|
|
||||||
}
|
public AutocommitFailedException(Throwable cause) {
|
||||||
private static final long serialVersionUID = 1L;
|
super("Autocommit failed", cause);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,15 +2,19 @@ package pro.taskana.exceptions;
|
||||||
|
|
||||||
import pro.taskana.Classification;
|
import pro.taskana.Classification;
|
||||||
|
|
||||||
/**
|
/** Thrown, when a classification does already exits, but wanted to create with same ID+domain. */
|
||||||
* Thrown, when a classification does already exits, but wanted to create with same ID+domain.
|
|
||||||
*/
|
|
||||||
public class ClassificationAlreadyExistException extends TaskanaException {
|
public class ClassificationAlreadyExistException extends TaskanaException {
|
||||||
|
|
||||||
private static final long serialVersionUID = 4716611657569005013L;
|
private static final long serialVersionUID = 4716611657569005013L;
|
||||||
|
|
||||||
public ClassificationAlreadyExistException(Classification classification) {
|
public ClassificationAlreadyExistException(Classification classification) {
|
||||||
super("ID='" + classification.getId() + "', KEY='" + classification.getKey() + "', DOMAIN='"
|
super(
|
||||||
+ classification.getDomain() + "';");
|
"ID='"
|
||||||
}
|
+ classification.getId()
|
||||||
|
+ "', KEY='"
|
||||||
|
+ classification.getKey()
|
||||||
|
+ "', DOMAIN='"
|
||||||
|
+ classification.getDomain()
|
||||||
|
+ "';");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,15 @@
|
||||||
package pro.taskana.exceptions;
|
package pro.taskana.exceptions;
|
||||||
|
|
||||||
/**
|
/** Thrown if a specific task is not in the database. */
|
||||||
* Thrown if a specific task is not in the database.
|
|
||||||
*/
|
|
||||||
public class ClassificationInUseException extends TaskanaException {
|
public class ClassificationInUseException extends TaskanaException {
|
||||||
|
|
||||||
public ClassificationInUseException(String msg) {
|
private static final long serialVersionUID = 1L;
|
||||||
super(msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ClassificationInUseException(String msg, Throwable cause) {
|
public ClassificationInUseException(String msg) {
|
||||||
super(msg, cause);
|
super(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
public ClassificationInUseException(String msg, Throwable cause) {
|
||||||
|
super(msg, cause);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,30 +1,27 @@
|
||||||
package pro.taskana.exceptions;
|
package pro.taskana.exceptions;
|
||||||
|
|
||||||
/**
|
/** Thrown if a specific task is not in the database. */
|
||||||
* Thrown if a specific task is not in the database.
|
|
||||||
*/
|
|
||||||
public class ClassificationNotFoundException extends NotFoundException {
|
public class ClassificationNotFoundException extends NotFoundException {
|
||||||
|
|
||||||
private String key;
|
private static final long serialVersionUID = 1L;
|
||||||
private String domain;
|
private String key;
|
||||||
|
private String domain;
|
||||||
|
|
||||||
public ClassificationNotFoundException(String id, String msg) {
|
public ClassificationNotFoundException(String id, String msg) {
|
||||||
super(id, msg);
|
super(id, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ClassificationNotFoundException(String key, String domain, String msg) {
|
public ClassificationNotFoundException(String key, String domain, String msg) {
|
||||||
super(null, msg);
|
super(null, msg);
|
||||||
this.key = key;
|
this.key = key;
|
||||||
this.domain = domain;
|
this.domain = domain;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getKey() {
|
public String getKey() {
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDomain() {
|
public String getDomain() {
|
||||||
return domain;
|
return domain;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,16 @@
|
||||||
package pro.taskana.exceptions;
|
package pro.taskana.exceptions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This exception is thrown when an attempt is made to update an object that has already been updated by another user.
|
* This exception is thrown when an attempt is made to update an object that has already been
|
||||||
|
* updated by another user.
|
||||||
*
|
*
|
||||||
* @author bbr
|
* @author bbr
|
||||||
*/
|
*/
|
||||||
public class ConcurrencyException extends TaskanaException {
|
public class ConcurrencyException extends TaskanaException {
|
||||||
|
|
||||||
public ConcurrencyException(String msg) {
|
private static final long serialVersionUID = 1L;
|
||||||
super(msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
public ConcurrencyException(String msg) {
|
||||||
|
super(msg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,14 @@
|
||||||
package pro.taskana.exceptions;
|
package pro.taskana.exceptions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Thrown if ConnectionManagementMode is CONNECTION_MANAGED_EXTERNALLY and an attempt is made to call an API method before the setConnection() method has been called.
|
* Thrown if ConnectionManagementMode is CONNECTION_MANAGED_EXTERNALLY and an attempt is made to
|
||||||
*
|
* call an API method before the setConnection() method has been called.
|
||||||
*/
|
*/
|
||||||
public class ConnectionNotSetException extends TaskanaRuntimeException {
|
public class ConnectionNotSetException extends TaskanaRuntimeException {
|
||||||
|
|
||||||
public ConnectionNotSetException() {
|
private static final long serialVersionUID = 1L;
|
||||||
super("Connection not set");
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
public ConnectionNotSetException() {
|
||||||
|
super("Connection not set");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,9 @@ package pro.taskana.exceptions;
|
||||||
*/
|
*/
|
||||||
public class DomainNotFoundException extends NotFoundException {
|
public class DomainNotFoundException extends NotFoundException {
|
||||||
|
|
||||||
public DomainNotFoundException(String domain, String msg) {
|
private static final long serialVersionUID = 1L;
|
||||||
super(domain, msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
|
public DomainNotFoundException(String domain, String msg) {
|
||||||
|
super(domain, msg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,13 +7,13 @@ package pro.taskana.exceptions;
|
||||||
*/
|
*/
|
||||||
public class InvalidArgumentException extends TaskanaException {
|
public class InvalidArgumentException extends TaskanaException {
|
||||||
|
|
||||||
public InvalidArgumentException(String msg) {
|
private static final long serialVersionUID = 1L;
|
||||||
super(msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
public InvalidArgumentException(String msg, Throwable cause) {
|
public InvalidArgumentException(String msg) {
|
||||||
super(msg, cause);
|
super(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
public InvalidArgumentException(String msg, Throwable cause) {
|
||||||
|
super(msg, cause);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,13 @@ package pro.taskana.exceptions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This exception is thrown when the task state doesn't allow the requested operation.
|
* This exception is thrown when the task state doesn't allow the requested operation.
|
||||||
* @author bbr
|
|
||||||
*
|
*
|
||||||
|
* @author bbr
|
||||||
*/
|
*/
|
||||||
public class InvalidOwnerException extends TaskanaException {
|
public class InvalidOwnerException extends TaskanaException {
|
||||||
public InvalidOwnerException(String msg) {
|
private static final long serialVersionUID = 1L;
|
||||||
super(msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
public InvalidOwnerException(String msg) {
|
||||||
|
super(msg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,13 @@ package pro.taskana.exceptions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This exception is thrown when the task state doesn't allow the requested operation.
|
* This exception is thrown when the task state doesn't allow the requested operation.
|
||||||
* @author bbr
|
|
||||||
*
|
*
|
||||||
|
* @author bbr
|
||||||
*/
|
*/
|
||||||
public class InvalidStateException extends TaskanaException {
|
public class InvalidStateException extends TaskanaException {
|
||||||
public InvalidStateException(String msg) {
|
private static final long serialVersionUID = 1L;
|
||||||
super(msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
public InvalidStateException(String msg) {
|
||||||
|
super(msg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,16 @@
|
||||||
package pro.taskana.exceptions;
|
package pro.taskana.exceptions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This exception is thrown when a request is made to insert or update a workbasket that is missing a required property.
|
* This exception is thrown when a request is made to insert or update a workbasket that is missing
|
||||||
|
* a required property.
|
||||||
*
|
*
|
||||||
* @author bbr
|
* @author bbr
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class InvalidWorkbasketException extends TaskanaException {
|
public class InvalidWorkbasketException extends TaskanaException {
|
||||||
|
|
||||||
public InvalidWorkbasketException(String msg) {
|
private static final long serialVersionUID = 1L;
|
||||||
super(msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
public InvalidWorkbasketException(String msg) {
|
||||||
|
super(msg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,20 +1,17 @@
|
||||||
package pro.taskana.exceptions;
|
package pro.taskana.exceptions;
|
||||||
|
|
||||||
/**
|
/** This exception is used to communicate a not authorized user. */
|
||||||
* This exception is used to communicate a not authorized user.
|
|
||||||
*/
|
|
||||||
public class NotAuthorizedException extends TaskanaException {
|
public class NotAuthorizedException extends TaskanaException {
|
||||||
|
|
||||||
private final String currentUserId;
|
private static final long serialVersionUID = 21235L;
|
||||||
|
private final String currentUserId;
|
||||||
|
|
||||||
public NotAuthorizedException(String msg, String currentUserId) {
|
public NotAuthorizedException(String msg, String currentUserId) {
|
||||||
super(msg + " - [CURRENT USER: {'" + currentUserId + "'}]");
|
super(msg + " - [CURRENT USER: {'" + currentUserId + "'}]");
|
||||||
this.currentUserId = currentUserId;
|
this.currentUserId = currentUserId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCurrentUserId() {
|
public String getCurrentUserId() {
|
||||||
return currentUserId;
|
return currentUserId;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final long serialVersionUID = 21235L;
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,15 @@
|
||||||
package pro.taskana.exceptions;
|
package pro.taskana.exceptions;
|
||||||
|
|
||||||
/**
|
/** This exception is used to communicate that a user is not authorized to query a Workbasket. */
|
||||||
* This exception is used to communicate that a user is not authorized to query a Workbasket.
|
|
||||||
*/
|
|
||||||
public class NotAuthorizedToQueryWorkbasketException extends TaskanaRuntimeException {
|
public class NotAuthorizedToQueryWorkbasketException extends TaskanaRuntimeException {
|
||||||
|
|
||||||
public NotAuthorizedToQueryWorkbasketException(String msg) {
|
private static final long serialVersionUID = 1L;
|
||||||
super(msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
public NotAuthorizedToQueryWorkbasketException(String msg, Throwable cause) {
|
public NotAuthorizedToQueryWorkbasketException(String msg) {
|
||||||
super(msg, cause);
|
super(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
|
public NotAuthorizedToQueryWorkbasketException(String msg, Throwable cause) {
|
||||||
|
super(msg, cause);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,20 +1,17 @@
|
||||||
package pro.taskana.exceptions;
|
package pro.taskana.exceptions;
|
||||||
|
|
||||||
/**
|
/** This exception will be thrown if a specific object is not in the database. */
|
||||||
* This exception will be thrown if a specific object is not in the database.
|
|
||||||
*/
|
|
||||||
public class NotFoundException extends TaskanaException {
|
public class NotFoundException extends TaskanaException {
|
||||||
|
|
||||||
String id;
|
private static final long serialVersionUID = 1L;
|
||||||
|
String id;
|
||||||
|
|
||||||
public NotFoundException(String id, String message) {
|
public NotFoundException(String id, String message) {
|
||||||
super(message);
|
super(message);
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,15 @@
|
||||||
package pro.taskana.exceptions;
|
package pro.taskana.exceptions;
|
||||||
|
|
||||||
/**
|
/** This exception is thrown when a generic taskana problem is encountered. */
|
||||||
* This exception is thrown when a generic taskana problem is encountered.
|
|
||||||
*/
|
|
||||||
public class SystemException extends TaskanaRuntimeException {
|
public class SystemException extends TaskanaRuntimeException {
|
||||||
|
|
||||||
public SystemException(String msg) {
|
private static final long serialVersionUID = 1L;
|
||||||
super(msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
public SystemException(String msg, Throwable cause) {
|
public SystemException(String msg) {
|
||||||
super(msg, cause);
|
super(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
public SystemException(String msg, Throwable cause) {
|
||||||
|
super(msg, cause);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,14 @@
|
||||||
package pro.taskana.exceptions;
|
package pro.taskana.exceptions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Thrown when a Task is going to be created, but a Task with the same ID does already exist. The Task ID should be
|
* Thrown when a Task is going to be created, but a Task with the same ID does already exist. The
|
||||||
* unique.
|
* Task ID should be unique.
|
||||||
*/
|
*/
|
||||||
public class TaskAlreadyExistException extends TaskanaException {
|
public class TaskAlreadyExistException extends TaskanaException {
|
||||||
|
|
||||||
public TaskAlreadyExistException(String id) {
|
private static final long serialVersionUID = 1L;
|
||||||
super(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
public TaskAlreadyExistException(String id) {
|
||||||
|
super(id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,11 @@
|
||||||
package pro.taskana.exceptions;
|
package pro.taskana.exceptions;
|
||||||
|
|
||||||
/**
|
/** This exception will be thrown if a specific task is not in the database. */
|
||||||
* This exception will be thrown if a specific task is not in the database.
|
|
||||||
*/
|
|
||||||
public class TaskNotFoundException extends NotFoundException {
|
public class TaskNotFoundException extends NotFoundException {
|
||||||
|
|
||||||
public TaskNotFoundException(String id, String msg) {
|
private static final long serialVersionUID = 1L;
|
||||||
super(id, msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
public TaskNotFoundException(String id, String msg) {
|
||||||
|
super(id, msg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,25 +7,26 @@ package pro.taskana.exceptions;
|
||||||
*/
|
*/
|
||||||
public class TaskanaException extends Exception {
|
public class TaskanaException extends Exception {
|
||||||
|
|
||||||
private static final long serialVersionUID = 123234345123412L;
|
private static final long serialVersionUID = 123234345123412L;
|
||||||
|
|
||||||
public TaskanaException() {
|
public TaskanaException() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public TaskanaException(String message) {
|
public TaskanaException(String message) {
|
||||||
super(message);
|
super(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public TaskanaException(Throwable cause) {
|
public TaskanaException(Throwable cause) {
|
||||||
super(cause);
|
super(cause);
|
||||||
}
|
}
|
||||||
|
|
||||||
public TaskanaException(String message, Throwable cause) {
|
public TaskanaException(String message, Throwable cause) {
|
||||||
super(message, cause);
|
super(message, cause);
|
||||||
}
|
}
|
||||||
|
|
||||||
public TaskanaException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
|
public TaskanaException(
|
||||||
super(message, cause, enableSuppression, writableStackTrace);
|
String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
|
||||||
}
|
super(message, cause, enableSuppression, writableStackTrace);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,26 +7,26 @@ package pro.taskana.exceptions;
|
||||||
*/
|
*/
|
||||||
public class TaskanaRuntimeException extends RuntimeException {
|
public class TaskanaRuntimeException extends RuntimeException {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1511142769801824L;
|
private static final long serialVersionUID = 1511142769801824L;
|
||||||
|
|
||||||
public TaskanaRuntimeException() {
|
public TaskanaRuntimeException() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public TaskanaRuntimeException(String message) {
|
public TaskanaRuntimeException(String message) {
|
||||||
super(message);
|
super(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public TaskanaRuntimeException(Throwable cause) {
|
public TaskanaRuntimeException(Throwable cause) {
|
||||||
super(cause);
|
super(cause);
|
||||||
}
|
}
|
||||||
|
|
||||||
public TaskanaRuntimeException(String message, Throwable cause) {
|
public TaskanaRuntimeException(String message, Throwable cause) {
|
||||||
super(message, cause);
|
super(message, cause);
|
||||||
}
|
}
|
||||||
|
|
||||||
public TaskanaRuntimeException(String message, Throwable cause, boolean enableSuppression,
|
public TaskanaRuntimeException(
|
||||||
boolean writableStackTrace) {
|
String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
|
||||||
super(message, cause, enableSuppression, writableStackTrace);
|
super(message, cause, enableSuppression, writableStackTrace);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,9 @@ package pro.taskana.exceptions;
|
||||||
*/
|
*/
|
||||||
public class UnsupportedDatabaseException extends RuntimeException {
|
public class UnsupportedDatabaseException extends RuntimeException {
|
||||||
|
|
||||||
public UnsupportedDatabaseException(String name) {
|
private static final long serialVersionUID = 1L;
|
||||||
super("Database with '" + name + "' not found");
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
public UnsupportedDatabaseException(String name) {
|
||||||
|
super("Database with '" + name + "' not found");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,15 +2,19 @@ package pro.taskana.exceptions;
|
||||||
|
|
||||||
import pro.taskana.Workbasket;
|
import pro.taskana.Workbasket;
|
||||||
|
|
||||||
/**
|
/** Thrown, when a workbasket does already exits, but wanted to create with same ID. */
|
||||||
* Thrown, when a workbasket does already exits, but wanted to create with same ID.
|
|
||||||
*/
|
|
||||||
public class WorkbasketAlreadyExistException extends TaskanaException {
|
public class WorkbasketAlreadyExistException extends TaskanaException {
|
||||||
|
|
||||||
private static final long serialVersionUID = 6115013L;
|
private static final long serialVersionUID = 6115013L;
|
||||||
|
|
||||||
public WorkbasketAlreadyExistException(Workbasket workbasket) {
|
public WorkbasketAlreadyExistException(Workbasket workbasket) {
|
||||||
super("ID='" + workbasket.getId() + "', KEY=' " + workbasket.getKey() + "', DOMAIN='"
|
super(
|
||||||
+ workbasket.getDomain() + "';");
|
"ID='"
|
||||||
}
|
+ workbasket.getId()
|
||||||
|
+ "', KEY=' "
|
||||||
|
+ workbasket.getKey()
|
||||||
|
+ "', DOMAIN='"
|
||||||
|
+ workbasket.getDomain()
|
||||||
|
+ "';");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,11 @@
|
||||||
package pro.taskana.exceptions;
|
package pro.taskana.exceptions;
|
||||||
|
|
||||||
/**
|
/** Thrown if a specific Workbasket does have content and should be deleted. */
|
||||||
* Thrown if a specific Workbasket does have content and should be deleted.
|
|
||||||
*/
|
|
||||||
public class WorkbasketInUseException extends TaskanaException {
|
public class WorkbasketInUseException extends TaskanaException {
|
||||||
|
|
||||||
public WorkbasketInUseException(String msg) {
|
private static final long serialVersionUID = 1234L;
|
||||||
super(msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1234L;
|
public WorkbasketInUseException(String msg) {
|
||||||
|
super(msg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,30 +1,27 @@
|
||||||
package pro.taskana.exceptions;
|
package pro.taskana.exceptions;
|
||||||
|
|
||||||
/**
|
/** This exception will be thrown if a specific workbasket is not in the database. */
|
||||||
* This exception will be thrown if a specific workbasket is not in the database.
|
|
||||||
*/
|
|
||||||
public class WorkbasketNotFoundException extends NotFoundException {
|
public class WorkbasketNotFoundException extends NotFoundException {
|
||||||
|
|
||||||
private String key;
|
private static final long serialVersionUID = 1L;
|
||||||
private String domain;
|
private String key;
|
||||||
|
private String domain;
|
||||||
|
|
||||||
public WorkbasketNotFoundException(String id, String msg) {
|
public WorkbasketNotFoundException(String id, String msg) {
|
||||||
super(id, msg);
|
super(id, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
public WorkbasketNotFoundException(String key, String domain, String msg) {
|
public WorkbasketNotFoundException(String key, String domain, String msg) {
|
||||||
super(null, msg);
|
super(null, msg);
|
||||||
this.key = key;
|
this.key = key;
|
||||||
this.domain = domain;
|
this.domain = domain;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getKey() {
|
public String getKey() {
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDomain() {
|
public String getDomain() {
|
||||||
return domain;
|
return domain;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue