TSK-104 make constructor of impl classes package private

This commit is contained in:
BerndBreier 2018-02-12 11:56:17 +01:00 committed by Marcel Lengl
parent 9408142e57
commit 451d2fc63d
17 changed files with 51 additions and 19 deletions

View File

@ -66,7 +66,7 @@ public class TaskanaEngineConfiguration {
* @return the TaskanaEngine * @return the TaskanaEngine
*/ */
public TaskanaEngine buildTaskanaEngine() { public TaskanaEngine buildTaskanaEngine() {
return new TaskanaEngineImpl(this); return TaskanaEngineImpl.createTaskanaEngine(this);
} }
/** /**

View File

@ -17,6 +17,10 @@ public class AttachmentSummaryImpl implements AttachmentSummary {
private ClassificationSummary classificationSummary; private ClassificationSummary classificationSummary;
private Instant received; private Instant received;
AttachmentSummaryImpl() {
}
/* /*
* (non-Javadoc) * (non-Javadoc)
* @see pro.taskana.impl.AttachmentSummary#getId() * @see pro.taskana.impl.AttachmentSummary#getId()

View File

@ -59,7 +59,7 @@ public class ClassificationQueryImpl implements ClassificationQuery {
private String[] custom8In; private String[] custom8In;
private String[] custom8Like; private String[] custom8Like;
public ClassificationQueryImpl(TaskanaEngine taskanaEngine) { ClassificationQueryImpl(TaskanaEngine taskanaEngine) {
this.taskanaEngineImpl = (TaskanaEngineImpl) taskanaEngine; this.taskanaEngineImpl = (TaskanaEngineImpl) taskanaEngine;
} }

View File

@ -33,7 +33,7 @@ public class ClassificationServiceImpl implements ClassificationService {
private ClassificationMapper classificationMapper; private ClassificationMapper classificationMapper;
private TaskanaEngineImpl taskanaEngineImpl; private TaskanaEngineImpl taskanaEngineImpl;
public ClassificationServiceImpl(TaskanaEngine taskanaEngine, ClassificationMapper classificationMapper) { ClassificationServiceImpl(TaskanaEngine taskanaEngine, ClassificationMapper classificationMapper) {
super(); super();
this.taskanaEngineImpl = (TaskanaEngineImpl) taskanaEngine; this.taskanaEngineImpl = (TaskanaEngineImpl) taskanaEngine;
this.classificationMapper = classificationMapper; this.classificationMapper = classificationMapper;
@ -295,11 +295,13 @@ public class ClassificationServiceImpl implements ClassificationService {
} }
@Override @Override
public void deleteClassification(String classificationKey, String domain) throws ClassificationInUseException, ClassificationNotFoundException { public void deleteClassification(String classificationKey, String domain)
throws ClassificationInUseException, ClassificationNotFoundException {
try { try {
taskanaEngineImpl.openConnection(); taskanaEngineImpl.openConnection();
if (this.classificationMapper.findByKeyAndDomain(classificationKey, domain) == null) { if (this.classificationMapper.findByKeyAndDomain(classificationKey, domain) == null) {
throw new ClassificationNotFoundException("The classification " + classificationKey + "wasn't found in the domain " + domain); throw new ClassificationNotFoundException(
"The classification " + classificationKey + "wasn't found in the domain " + domain);
} }
if (domain.equals("")) { if (domain.equals("")) {
@ -313,12 +315,17 @@ public class ClassificationServiceImpl implements ClassificationService {
TaskServiceImpl taskService = (TaskServiceImpl) taskanaEngineImpl.getTaskService(); TaskServiceImpl taskService = (TaskServiceImpl) taskanaEngineImpl.getTaskService();
try { try {
List<TaskSummary> classificationTasks = taskService.createTaskQuery().classificationKeyIn(classificationKey).domainIn(domain).list(); List<TaskSummary> classificationTasks = taskService.createTaskQuery()
.classificationKeyIn(classificationKey)
.domainIn(domain)
.list();
if (!classificationTasks.isEmpty()) { if (!classificationTasks.isEmpty()) {
throw new ClassificationInUseException("There are " + classificationTasks.size() + " Tasks which belong to this classification or a child classification. Please complete them and try again."); throw new ClassificationInUseException("There are " + classificationTasks.size()
+ " Tasks which belong to this classification or a child classification. Please complete them and try again.");
} }
} catch (NotAuthorizedException e) { } catch (NotAuthorizedException e) {
LOGGER.error("ClassificationQuery unexpectedly returned NotauthorizedException. Throwing SystemException "); LOGGER.error(
"ClassificationQuery unexpectedly returned NotauthorizedException. Throwing SystemException ");
throw new SystemException("ClassificationQuery unexpectedly returned NotauthorizedException."); throw new SystemException("ClassificationQuery unexpectedly returned NotauthorizedException.");
} }

View File

@ -14,6 +14,10 @@ public class ClassificationSummaryImpl implements ClassificationSummary {
private String domain; private String domain;
private String name; private String name;
ClassificationSummaryImpl() {
}
@Override @Override
public String getId() { public String getId() {
return id; return id;

View File

@ -11,6 +11,10 @@ public class MinimalTaskSummary {
private String workbasketKey; private String workbasketKey;
private TaskState taskState; private TaskState taskState;
MinimalTaskSummary() {
}
public String getTaskId() { public String getTaskId() {
return taskId; return taskId;
} }

View File

@ -33,7 +33,7 @@ public class ObjectReferenceQueryImpl implements ObjectReferenceQuery {
private String[] type; private String[] type;
private String[] value; private String[] value;
public ObjectReferenceQueryImpl(TaskanaEngine taskanaEngine) { ObjectReferenceQueryImpl(TaskanaEngine taskanaEngine) {
this.taskanaEngineImpl = (TaskanaEngineImpl) taskanaEngine; this.taskanaEngineImpl = (TaskanaEngineImpl) taskanaEngine;
} }

View File

@ -26,7 +26,7 @@ public class TaskMonitorServiceImpl implements TaskMonitorService {
private TaskanaEngineImpl taskanaEngineImpl; private TaskanaEngineImpl taskanaEngineImpl;
private TaskMonitorMapper taskMonitorMapper; private TaskMonitorMapper taskMonitorMapper;
public TaskMonitorServiceImpl(TaskanaEngine taskanaEngine, TaskMonitorMapper taskMonitorMapper) { TaskMonitorServiceImpl(TaskanaEngine taskanaEngine, TaskMonitorMapper taskMonitorMapper) {
super(); super();
this.taskanaEngineImpl = (TaskanaEngineImpl) taskanaEngine; this.taskanaEngineImpl = (TaskanaEngineImpl) taskanaEngine;
this.taskMonitorMapper = taskMonitorMapper; this.taskMonitorMapper = taskMonitorMapper;

View File

@ -54,7 +54,7 @@ public class TaskQueryImpl implements TaskQuery {
private String porValueLike; private String porValueLike;
private List<String> orderBy; private List<String> orderBy;
public TaskQueryImpl(TaskanaEngine taskanaEngine) { TaskQueryImpl(TaskanaEngine taskanaEngine) {
this.taskanaEngineImpl = (TaskanaEngineImpl) taskanaEngine; this.taskanaEngineImpl = (TaskanaEngineImpl) taskanaEngine;
this.taskService = (TaskServiceImpl) taskanaEngineImpl.getTaskService(); this.taskService = (TaskServiceImpl) taskanaEngineImpl.getTaskService();
this.orderBy = new ArrayList<>(); this.orderBy = new ArrayList<>();

View File

@ -64,7 +64,7 @@ public class TaskServiceImpl implements TaskService {
private TaskMapper taskMapper; private TaskMapper taskMapper;
private AttachmentMapper attachmentMapper; private AttachmentMapper attachmentMapper;
public TaskServiceImpl(TaskanaEngine taskanaEngine, TaskMapper taskMapper, TaskServiceImpl(TaskanaEngine taskanaEngine, TaskMapper taskMapper,
AttachmentMapper attachmentMapper) { AttachmentMapper attachmentMapper) {
super(); super();
this.taskanaEngine = taskanaEngine; this.taskanaEngine = taskanaEngine;

View File

@ -49,6 +49,10 @@ public class TaskSummaryImpl implements TaskSummary {
private String custom9; private String custom9;
private String custom10; private String custom10;
TaskSummaryImpl() {
}
/* /*
* (non-Javadoc) * (non-Javadoc)
* @see pro.taskana.impl.TaskSummary#getId() * @see pro.taskana.impl.TaskSummary#getId()

View File

@ -53,7 +53,11 @@ public class TaskanaEngineImpl implements TaskanaEngine {
protected ConnectionManagementMode mode = ConnectionManagementMode.PARTICIPATE; protected ConnectionManagementMode mode = ConnectionManagementMode.PARTICIPATE;
protected java.sql.Connection connection = null; protected java.sql.Connection connection = null;
public TaskanaEngineImpl(TaskanaEngineConfiguration taskanaEngineConfiguration) { public static TaskanaEngine createTaskanaEngine(TaskanaEngineConfiguration taskanaEngineConfiguration) {
return new TaskanaEngineImpl(taskanaEngineConfiguration);
}
protected TaskanaEngineImpl(TaskanaEngineConfiguration taskanaEngineConfiguration) {
this.taskanaEngineConfiguration = taskanaEngineConfiguration; this.taskanaEngineConfiguration = taskanaEngineConfiguration;
createTransactionFactory(taskanaEngineConfiguration.getUseManagedTransactions()); createTransactionFactory(taskanaEngineConfiguration.getUseManagedTransactions());
this.sessionManager = createSqlSessionManager(); this.sessionManager = createSqlSessionManager();

View File

@ -32,7 +32,7 @@ public class WorkbasketAccessItemQueryImpl implements WorkbasketAccessItemQuery
private TaskanaEngineImpl taskanaEngineImpl; private TaskanaEngineImpl taskanaEngineImpl;
private List<String> orderBy; private List<String> orderBy;
public WorkbasketAccessItemQueryImpl(TaskanaEngine taskanaEngine) { WorkbasketAccessItemQueryImpl(TaskanaEngine taskanaEngine) {
this.taskanaEngineImpl = (TaskanaEngineImpl) taskanaEngine; this.taskanaEngineImpl = (TaskanaEngineImpl) taskanaEngine;
orderBy = new ArrayList<>(); orderBy = new ArrayList<>();
} }

View File

@ -51,7 +51,7 @@ public class WorkbasketQueryImpl implements WorkbasketQuery {
private TaskanaEngineImpl taskanaEngineImpl; private TaskanaEngineImpl taskanaEngineImpl;
private List<String> orderBy; private List<String> orderBy;
public WorkbasketQueryImpl(TaskanaEngine taskanaEngine) { WorkbasketQueryImpl(TaskanaEngine taskanaEngine) {
this.taskanaEngineImpl = (TaskanaEngineImpl) taskanaEngine; this.taskanaEngineImpl = (TaskanaEngineImpl) taskanaEngine;
orderBy = new ArrayList<>(); orderBy = new ArrayList<>();
} }

View File

@ -47,7 +47,7 @@ public class WorkbasketServiceImpl implements WorkbasketService {
public WorkbasketServiceImpl() { public WorkbasketServiceImpl() {
} }
public WorkbasketServiceImpl(TaskanaEngine taskanaEngine, WorkbasketMapper workbasketMapper, WorkbasketServiceImpl(TaskanaEngine taskanaEngine, WorkbasketMapper workbasketMapper,
DistributionTargetMapper distributionTargetMapper, WorkbasketAccessMapper workbasketAccessMapper) { DistributionTargetMapper distributionTargetMapper, WorkbasketAccessMapper workbasketAccessMapper) {
this.taskanaEngine = (TaskanaEngineImpl) taskanaEngine; this.taskanaEngine = (TaskanaEngineImpl) taskanaEngine;
this.workbasketMapper = workbasketMapper; this.workbasketMapper = workbasketMapper;

View File

@ -22,6 +22,10 @@ public class WorkbasketSummaryImpl implements WorkbasketSummary {
private String orgLevel3; private String orgLevel3;
private String orgLevel4; private String orgLevel4;
WorkbasketSummaryImpl() {
}
/* /*
* (non-Javadoc) * (non-Javadoc)
* @see pro.taskana.impl.WorkbasketSummary#getId() * @see pro.taskana.impl.WorkbasketSummary#getId()

View File

@ -240,7 +240,8 @@ public class TaskServiceImplIntAutocommitTest {
dummyTask = (TaskImpl) taskServiceImpl.createTask(dummyTask); dummyTask = (TaskImpl) taskServiceImpl.createTask(dummyTask);
List<TaskSummaryImpl> expectedTaskSumamries = new ArrayList<>(); List<TaskSummaryImpl> expectedTaskSumamries = new ArrayList<>();
TaskSummaryImpl taskSummary = new TaskSummaryImpl(); TaskSummaryImpl taskSummary = (TaskSummaryImpl) taskServiceImpl.newTask(dummyTask.getWorkbasketKey())
.asSummary();
taskSummary.setTaskId(dummyTask.getId()); taskSummary.setTaskId(dummyTask.getId());
taskSummary.setName(dummyTask.getName()); taskSummary.setName(dummyTask.getName());
expectedTaskSumamries.add(taskSummary); expectedTaskSumamries.add(taskSummary);