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
*/
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 Instant received;
AttachmentSummaryImpl() {
}
/*
* (non-Javadoc)
* @see pro.taskana.impl.AttachmentSummary#getId()

View File

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

View File

@ -33,7 +33,7 @@ public class ClassificationServiceImpl implements ClassificationService {
private ClassificationMapper classificationMapper;
private TaskanaEngineImpl taskanaEngineImpl;
public ClassificationServiceImpl(TaskanaEngine taskanaEngine, ClassificationMapper classificationMapper) {
ClassificationServiceImpl(TaskanaEngine taskanaEngine, ClassificationMapper classificationMapper) {
super();
this.taskanaEngineImpl = (TaskanaEngineImpl) taskanaEngine;
this.classificationMapper = classificationMapper;
@ -295,15 +295,17 @@ public class ClassificationServiceImpl implements ClassificationService {
}
@Override
public void deleteClassification(String classificationKey, String domain) throws ClassificationInUseException, ClassificationNotFoundException {
public void deleteClassification(String classificationKey, String domain)
throws ClassificationInUseException, ClassificationNotFoundException {
try {
taskanaEngineImpl.openConnection();
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("")) {
//master mode - delete all associated classifications in every domain.
// master mode - delete all associated classifications in every domain.
List<String> domains = this.classificationMapper.getDomainsForClassification(classificationKey);
domains.remove("");
for (String classificationDomain : domains) {
@ -313,12 +315,17 @@ public class ClassificationServiceImpl implements ClassificationService {
TaskServiceImpl taskService = (TaskServiceImpl) taskanaEngineImpl.getTaskService();
try {
List<TaskSummary> classificationTasks = taskService.createTaskQuery().classificationKeyIn(classificationKey).domainIn(domain).list();
List<TaskSummary> classificationTasks = taskService.createTaskQuery()
.classificationKeyIn(classificationKey)
.domainIn(domain)
.list();
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) {
LOGGER.error("ClassificationQuery unexpectedly returned NotauthorizedException. Throwing SystemException ");
LOGGER.error(
"ClassificationQuery unexpectedly returned NotauthorizedException. Throwing SystemException ");
throw new SystemException("ClassificationQuery unexpectedly returned NotauthorizedException.");
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -53,7 +53,11 @@ public class TaskanaEngineImpl implements TaskanaEngine {
protected ConnectionManagementMode mode = ConnectionManagementMode.PARTICIPATE;
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;
createTransactionFactory(taskanaEngineConfiguration.getUseManagedTransactions());
this.sessionManager = createSqlSessionManager();

View File

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

View File

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

View File

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

View File

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

View File

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