From dea6f498edbbb8042a8c6b3442268f0043b70484 Mon Sep 17 00:00:00 2001 From: BerndBreier <33351391+BerndBreier@users.noreply.github.com> Date: Thu, 11 Jan 2018 14:30:07 +0100 Subject: [PATCH] TSK-147 Introduce Workbasket summary to be returned in lists and from all queries. --- .../src/main/java/pro/taskana/Workbasket.java | 132 ++++++++++++++++- .../java/pro/taskana/WorkbasketQuery.java | 3 +- .../java/pro/taskana/WorkbasketService.java | 24 +-- .../java/pro/taskana/impl/WorkbasketImpl.java | 41 +++++- .../pro/taskana/impl/WorkbasketQueryImpl.java | 73 ++------- .../taskana/impl/WorkbasketServiceImpl.java | 22 +-- .../pro/taskana/model/WorkbasketSummary.java | 139 ++++++++++++++++++ .../taskana/model/mappings/QueryMapper.java | 28 +--- .../model/mappings/WorkbasketMapper.java | 98 +++++------- .../QueryWorkbasketByPermissionAccTest.java | 10 +- .../impl/WorkbasketServiceImplTest.java | 10 +- ...orkbasketServiceImplIntAutocommitTest.java | 48 +++--- .../WorkbasketServiceImplIntExplicitTest.java | 17 ++- .../pro/taskana/rest/MonitorController.java | 6 +- .../taskana/rest/WorkbasketController.java | 5 +- 15 files changed, 437 insertions(+), 219 deletions(-) create mode 100644 lib/taskana-core/src/main/java/pro/taskana/model/WorkbasketSummary.java diff --git a/lib/taskana-core/src/main/java/pro/taskana/Workbasket.java b/lib/taskana-core/src/main/java/pro/taskana/Workbasket.java index db99db4ea..0b8371f8f 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/Workbasket.java +++ b/lib/taskana-core/src/main/java/pro/taskana/Workbasket.java @@ -3,6 +3,7 @@ package pro.taskana; import java.sql.Timestamp; import java.util.List; +import pro.taskana.model.WorkbasketSummary; import pro.taskana.model.WorkbasketType; /** @@ -126,7 +127,7 @@ public interface Workbasket { * * @return distributionTargets */ - List getDistributionTargets(); + List getDistributionTargets(); /** * Sets the list of distribution targets for this workbasket. @@ -134,5 +135,132 @@ public interface Workbasket { * @param distributionTargets * the distribution targets of the workbasket */ - void setDistributionTargets(List distributionTargets); + void setDistributionTargets(List distributionTargets); + + /** + * Return the value for the custom1 attribute. + * + * @return custom1 + */ + String getCustom1(); + + /** + * Sets the value for custom1 Attribute. + * + * @param custom1 + * the custom1 property of the workbasket + */ + void setCustom1(String custom1); + + /** + * Return the value for the custom2 attribute. + * + * @return custom2 + */ + String getCustom2(); + + /** + * Sets the value for custom2 attribute. + * + * @param custom2 + * the custom2 property of the workbasket + */ + void setCustom2(String custom2); + + /** + * Return the value for the custom3 attribute. + * + * @return custom3 + */ + String getCustom3(); + + /** + * Sets the value for custom3 attribute. + * + * @param custom3 + * the custom3 property of the workbasket + */ + void setCustom3(String custom3); + + /** + * Return the value for the custom4 attribute. + * + * @return custom4 + */ + String getCustom4(); + + /** + * Sets the value for custom4 attribute. + * + * @param custom4 + * the custom4 property of the workbasket + */ + void setCustom4(String custom4); + + /** + * Return the value for the orgLevel1 attribute. + * + * @return orgLevel1 + */ + String getOrgLevel1(); + + /** + * Sets the value for orgLevel1 attribute. + * + * @param orgLevel1 + * the orgLevel1 property of the workbasket + */ + void setOrgLevel1(String orgLevel1); + + /** + * Return the value for the orgLevel2 attribute. + * + * @return orgLevel2 + */ + String getOrgLevel2(); + + /** + * Sets the value for orgLevel2 attribute. + * + * @param orgLevel2 + * the orgLevel2 property of the workbasket + */ + void setOrgLevel2(String orgLevel2); + + /** + * Return the value for the orgLevel3 attribute. + * + * @return orgLevel3 + */ + String getOrgLevel3(); + + /** + * Sets the value for orgLevel3 attribute. + * + * @param orgLevel3 + * the orgLevel3 property of the workbasket + */ + void setOrgLevel3(String orgLevel3); + + /** + * Return the value for the orgLevel4 attribute. + * + * @return orgLevel4 + */ + String getOrgLevel4(); + + /** + * Sets the value for orgLevel4 attribute. + * + * @param orgLevel4 + * the orgLevel4 property of the workbasket + */ + void setOrgLevel4(String orgLevel4); + + /** + * Return a summary of the current workbasket. + * + * @return the WorkbasketSummary object for the current work basket + */ + WorkbasketSummary asSummary(); } diff --git a/lib/taskana-core/src/main/java/pro/taskana/WorkbasketQuery.java b/lib/taskana-core/src/main/java/pro/taskana/WorkbasketQuery.java index f7e52d6d5..3f1e01eb4 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/WorkbasketQuery.java +++ b/lib/taskana-core/src/main/java/pro/taskana/WorkbasketQuery.java @@ -4,12 +4,13 @@ import java.util.Date; import pro.taskana.exceptions.InvalidArgumentException; import pro.taskana.model.WorkbasketAuthorization; +import pro.taskana.model.WorkbasketSummary; import pro.taskana.model.WorkbasketType; /** * WorkitemQuery for generating dynamic sql. */ -public interface WorkbasketQuery extends BaseQuery { +public interface WorkbasketQuery extends BaseQuery { /** * Add your keys to your query. diff --git a/lib/taskana-core/src/main/java/pro/taskana/WorkbasketService.java b/lib/taskana-core/src/main/java/pro/taskana/WorkbasketService.java index 4fc1e2dfa..6319f6dd9 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/WorkbasketService.java +++ b/lib/taskana-core/src/main/java/pro/taskana/WorkbasketService.java @@ -7,6 +7,7 @@ import pro.taskana.exceptions.NotAuthorizedException; import pro.taskana.exceptions.WorkbasketNotFoundException; import pro.taskana.model.WorkbasketAccessItem; import pro.taskana.model.WorkbasketAuthorization; +import pro.taskana.model.WorkbasketSummary; /** * This service manages Workbaskets. @@ -44,9 +45,9 @@ public interface WorkbasketService { /** * Get all available Workbaskets without checking any permission. * - * @return a list containing all Workbaskets + * @return a list containing all Workbasket Summaries */ - List getWorkbaskets(); + List getWorkbaskets(); /** * Create a new Workbasket. @@ -143,6 +144,16 @@ public interface WorkbasketService { */ List getWorkbasketAuthorizations(String workbasketKey); + /** + * This method returns the workbaskets for which the current user has all permissions specified in the permissions + * list. + * + * @param permission + * a List of WorkbasketAuthorization enums + * @return the summaries of all Workbaskets for which the current user has the specified authorizations + */ + List getWorkbaskets(List permission); + /** * This method provides a query builder for querying the database. * @@ -157,13 +168,4 @@ public interface WorkbasketService { */ Workbasket newWorkbasket(); - /** - * This method returns the workbaskets for which the current user has all permissions specified in the permissions - * list. - * - * @param permissions - * a List of WorkbasketAuthorization enums - * @return all Workbaskets for which the current user has the specified authorizations - */ - List getWorkbaskets(List permissions); } diff --git a/lib/taskana-core/src/main/java/pro/taskana/impl/WorkbasketImpl.java b/lib/taskana-core/src/main/java/pro/taskana/impl/WorkbasketImpl.java index d48abfbd7..bba22b720 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/impl/WorkbasketImpl.java +++ b/lib/taskana-core/src/main/java/pro/taskana/impl/WorkbasketImpl.java @@ -5,6 +5,7 @@ import java.util.ArrayList; import java.util.List; import pro.taskana.Workbasket; +import pro.taskana.model.WorkbasketSummary; import pro.taskana.model.WorkbasketType; /** @@ -21,7 +22,7 @@ public class WorkbasketImpl implements Workbasket { private String owner; private String domain; private WorkbasketType type; - private List distributionTargets = new ArrayList<>(); + private List distributionTargets = new ArrayList<>(); private String custom1; private String custom2; private String custom3; @@ -122,79 +123,112 @@ public class WorkbasketImpl implements Workbasket { } @Override - public List getDistributionTargets() { + public List getDistributionTargets() { return distributionTargets; } @Override - public void setDistributionTargets(List distributionTargets) { + public void setDistributionTargets(List distributionTargets) { this.distributionTargets = distributionTargets; } + @Override public String getCustom1() { return custom1; } + @Override public void setCustom1(String custom1) { this.custom1 = custom1; } + @Override public String getCustom2() { return custom2; } + @Override public void setCustom2(String custom2) { this.custom2 = custom2; } + @Override public String getCustom3() { return custom3; } + @Override public void setCustom3(String custom3) { this.custom3 = custom3; } + @Override public String getCustom4() { return custom4; } + @Override public void setCustom4(String custom4) { this.custom4 = custom4; } + @Override public String getOrgLevel1() { return orgLevel1; } + @Override public void setOrgLevel1(String orgLevel1) { this.orgLevel1 = orgLevel1; } + @Override public String getOrgLevel2() { return orgLevel2; } + @Override public void setOrgLevel2(String orgLevel2) { this.orgLevel2 = orgLevel2; } + @Override public String getOrgLevel3() { return orgLevel3; } + @Override public void setOrgLevel3(String orgLevel3) { this.orgLevel3 = orgLevel3; } + @Override public String getOrgLevel4() { return orgLevel4; } + @Override public void setOrgLevel4(String orgLevel4) { this.orgLevel4 = orgLevel4; } + @Override + public WorkbasketSummary asSummary() { + WorkbasketSummary result = new WorkbasketSummary(); + result.setId(this.getId()); + result.setKey(this.getKey()); + result.setName(this.getName()); + result.setDescription(this.getDescription()); + result.setOwner(this.getOwner()); + result.setDomain(this.getDomain()); + result.setType(this.getType()); + result.setOrgLevel1(this.getOrgLevel1()); + result.setOrgLevel2(this.getOrgLevel2()); + result.setOrgLevel3(this.getOrgLevel3()); + result.setOrgLevel4(this.getOrgLevel4()); + return result; + } + @Override public String toString() { StringBuilder builder = new StringBuilder(); @@ -237,4 +271,5 @@ public class WorkbasketImpl implements Workbasket { builder.append("]"); return builder.toString(); } + } diff --git a/lib/taskana-core/src/main/java/pro/taskana/impl/WorkbasketQueryImpl.java b/lib/taskana-core/src/main/java/pro/taskana/impl/WorkbasketQueryImpl.java index 97d568567..cc3dafe56 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/impl/WorkbasketQueryImpl.java +++ b/lib/taskana-core/src/main/java/pro/taskana/impl/WorkbasketQueryImpl.java @@ -9,12 +9,12 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import pro.taskana.TaskanaEngine; -import pro.taskana.Workbasket; import pro.taskana.WorkbasketQuery; import pro.taskana.configuration.TaskanaEngineConfiguration; import pro.taskana.exceptions.InvalidArgumentException; import pro.taskana.impl.util.LoggerUtils; import pro.taskana.model.WorkbasketAuthorization; +import pro.taskana.model.WorkbasketSummary; import pro.taskana.model.WorkbasketType; import pro.taskana.model.mappings.WorkbasketAccessMapper; import pro.taskana.security.CurrentUserContext; @@ -130,18 +130,17 @@ public class WorkbasketQueryImpl implements WorkbasketQuery { String[] accessIds; // Check pre-conditions if (permission == null) { - throw new InvalidArgumentException("Permission can“t be null."); + throw new InvalidArgumentException("Permission cannot be null."); } - if (CurrentUserContext.getAccessIds() != null && CurrentUserContext.getAccessIds().size() > 0) { - accessIds = new String[CurrentUserContext.getAccessIds().size()]; - accessIds = CurrentUserContext.getAccessIds().toArray(accessIds); + List ucAccessIds = CurrentUserContext.getAccessIds(); + if (ucAccessIds != null && ucAccessIds.size() > 0) { + accessIds = new String[ucAccessIds.size()]; + accessIds = ucAccessIds.toArray(accessIds); } else { throw new InvalidArgumentException("CurrentUserContext need to have at least one accessId."); } // set up permissions and ids - accessIds = new String[CurrentUserContext.getAccessIds().size()]; - accessIds = CurrentUserContext.getAccessIds().toArray(accessIds); this.authorization = permission; this.accessId = accessIds; lowercaseAccessIds(); @@ -150,9 +149,9 @@ public class WorkbasketQueryImpl implements WorkbasketQuery { } @Override - public List list() { + public List list() { LOGGER.debug("entry to list(), this = {}", this); - List workbaskets = null; + List workbaskets = null; try { taskanaEngineImpl.openConnection(); workbaskets = taskanaEngineImpl.getSqlSession().selectList(LINK_TO_MAPPER, this); @@ -168,9 +167,9 @@ public class WorkbasketQueryImpl implements WorkbasketQuery { } @Override - public List list(int offset, int limit) { + public List list(int offset, int limit) { LOGGER.debug("entry to list(offset = {}, limit = {}), this = {}", offset, limit, this); - List workbaskets = null; + List workbaskets = null; try { taskanaEngineImpl.openConnection(); RowBounds rowBounds = new RowBounds(offset, limit); @@ -187,9 +186,9 @@ public class WorkbasketQueryImpl implements WorkbasketQuery { } @Override - public Workbasket single() { + public WorkbasketSummary single() { LOGGER.debug("entry to single(), this = {}", this); - WorkbasketImpl workbasket = null; + WorkbasketSummary workbasket = null; try { taskanaEngineImpl.openConnection(); workbasket = taskanaEngineImpl.getSqlSession().selectOne(LINK_TO_MAPPER, this); @@ -204,98 +203,50 @@ public class WorkbasketQueryImpl implements WorkbasketQuery { return accessId; } - public void setAccessId(String[] accessId) { - this.accessId = accessId; - } - public WorkbasketAuthorization getAuthorization() { return authorization; } - public void setAuthorization(WorkbasketAuthorization authorization) { - this.authorization = authorization; - } - public String[] getName() { return name; } - public void setName(String[] name) { - this.name = name; - } - 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; - } - public WorkbasketType[] getType() { return type; } - public void setType(WorkbasketType[] type) { - this.type = type; - } - public Date getCreatedAfter() { return createdAfter; } - public void setCreatedAfter(Date createdAfter) { - this.createdAfter = createdAfter; - } - public Date getCreatedBefore() { return createdBefore; } - public void setCreatedBefore(Date createdBefore) { - this.createdBefore = createdBefore; - } - public Date getModifiedAfter() { return modifiedAfter; } - public void setModifiedAfter(Date modifiedAfter) { - this.modifiedAfter = modifiedAfter; - } - public Date getModifiedBefore() { return modifiedBefore; } - public void setModifiedBefore(Date modifiedBefore) { - this.modifiedBefore = modifiedBefore; - } - public String getDescription() { return description; } - public void setDescription(String description) { - this.description = description; - } - public String[] getOwner() { return owner; } - public void setOwner(String[] owner) { - this.owner = owner; - } - @Override public String toString() { StringBuilder builder = new StringBuilder(); diff --git a/lib/taskana-core/src/main/java/pro/taskana/impl/WorkbasketServiceImpl.java b/lib/taskana-core/src/main/java/pro/taskana/impl/WorkbasketServiceImpl.java index 734e7785f..131f225c0 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/impl/WorkbasketServiceImpl.java +++ b/lib/taskana-core/src/main/java/pro/taskana/impl/WorkbasketServiceImpl.java @@ -20,6 +20,7 @@ import pro.taskana.impl.util.IdGenerator; import pro.taskana.impl.util.LoggerUtils; import pro.taskana.model.WorkbasketAccessItem; import pro.taskana.model.WorkbasketAuthorization; +import pro.taskana.model.WorkbasketSummary; import pro.taskana.model.mappings.DistributionTargetMapper; import pro.taskana.model.mappings.WorkbasketAccessMapper; import pro.taskana.model.mappings.WorkbasketMapper; @@ -96,19 +97,19 @@ public class WorkbasketServiceImpl implements WorkbasketService { } @Override - public List getWorkbaskets(List permissions) { + public List getWorkbaskets(List permissions) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("entry to getWorkbaskets(permissions = {})", LoggerUtils.listToString(permissions)); } - List result = null; + List result = null; try { taskanaEngineImpl.openConnection(); // use a set to avoid duplicates - Set workbaskets = new HashSet<>(); + Set workbaskets = new HashSet<>(); for (String accessId : CurrentUserContext.getAccessIds()) { workbaskets.addAll(workbasketMapper.findByPermission(permissions, accessId)); } - result = new ArrayList(); + result = new ArrayList(); result.addAll(workbaskets); return result; } finally { @@ -122,13 +123,12 @@ public class WorkbasketServiceImpl implements WorkbasketService { } @Override - public List getWorkbaskets() { + public List getWorkbaskets() { LOGGER.debug("entry to getWorkbaskets()"); - List workbaskets = new ArrayList<>(); + List workbaskets = new ArrayList<>(); try { taskanaEngineImpl.openConnection(); - List results = workbasketMapper.findAll(); - results.stream().forEach(w -> workbaskets.add(w)); + workbaskets = workbasketMapper.findAll(); return workbaskets; } finally { taskanaEngineImpl.returnConnection(); @@ -159,7 +159,7 @@ public class WorkbasketServiceImpl implements WorkbasketService { workbasketMapper.insert(workbasket); LOGGER.debug("Method createWorkbasket() created Workbasket '{}'", workbasket); if (workbasket.getDistributionTargets() != null) { - for (Workbasket distributionTarget : workbasket.getDistributionTargets()) { + for (WorkbasketSummary distributionTarget : workbasket.getDistributionTargets()) { // validate that all distribution targets exist this.getWorkbasket(distributionTarget.getId()); distributionTargetMapper.insert(workbasket.getId(), distributionTarget.getId()); @@ -188,8 +188,8 @@ public class WorkbasketServiceImpl implements WorkbasketService { workbasketMapper.update(workbasket); LOGGER.debug("Method updateWorkbasket() updated workbasket '{}'", workbasket.getId()); List oldDistributionTargets = distributionTargetMapper.findBySourceId(workbasket.getId()); - List newDistributionTargets = workbasket.getDistributionTargets(); - for (Workbasket distributionTarget : newDistributionTargets) { + List newDistributionTargets = workbasket.getDistributionTargets(); + for (WorkbasketSummary distributionTarget : newDistributionTargets) { if (!oldDistributionTargets.contains(distributionTarget.getId())) { // check that old distribution target exists getWorkbasket(distributionTarget.getId()); diff --git a/lib/taskana-core/src/main/java/pro/taskana/model/WorkbasketSummary.java b/lib/taskana-core/src/main/java/pro/taskana/model/WorkbasketSummary.java new file mode 100644 index 000000000..6cd7d08a2 --- /dev/null +++ b/lib/taskana-core/src/main/java/pro/taskana/model/WorkbasketSummary.java @@ -0,0 +1,139 @@ +package pro.taskana.model; + +/** + * This entity contains the most important information about a workbasket. + * + * @author bbr + */ +public class WorkbasketSummary { + + private String id; + private String key; + private String name; + private String description; + private String owner; + private String domain; + private WorkbasketType type; + private String orgLevel1; + private String orgLevel2; + private String orgLevel3; + private String orgLevel4; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getOwner() { + return owner; + } + + public void setOwner(String owner) { + this.owner = owner; + } + + public String getDomain() { + return domain; + } + + public void setDomain(String domain) { + this.domain = domain; + } + + public WorkbasketType getType() { + return type; + } + + public void setType(WorkbasketType type) { + this.type = type; + } + + public String getOrgLevel1() { + return orgLevel1; + } + + public void setOrgLevel1(String orgLevel1) { + this.orgLevel1 = orgLevel1; + } + + public String getOrgLevel2() { + return orgLevel2; + } + + public void setOrgLevel2(String orgLevel2) { + this.orgLevel2 = orgLevel2; + } + + public String getOrgLevel3() { + return orgLevel3; + } + + public void setOrgLevel3(String orgLevel3) { + this.orgLevel3 = orgLevel3; + } + + public String getOrgLevel4() { + return orgLevel4; + } + + public void setOrgLevel4(String orgLevel4) { + this.orgLevel4 = orgLevel4; + } + + @Override + public String toString() { + StringBuilder builder = new StringBuilder(); + builder.append("WorkbasketSummary [id="); + builder.append(id); + builder.append(", key="); + builder.append(key); + builder.append(", name="); + builder.append(name); + builder.append(", description="); + builder.append(description); + builder.append(", owner="); + builder.append(owner); + builder.append(", domain="); + builder.append(domain); + builder.append(", type="); + builder.append(type); + builder.append(", orgLevel1="); + builder.append(orgLevel1); + builder.append(", orgLevel2="); + builder.append(orgLevel2); + builder.append(", orgLevel3="); + builder.append(orgLevel3); + builder.append(", orgLevel4="); + builder.append(orgLevel4); + builder.append("]"); + return builder.toString(); + } + +} diff --git a/lib/taskana-core/src/main/java/pro/taskana/model/mappings/QueryMapper.java b/lib/taskana-core/src/main/java/pro/taskana/model/mappings/QueryMapper.java index 242e781cd..02794a31d 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/model/mappings/QueryMapper.java +++ b/lib/taskana-core/src/main/java/pro/taskana/model/mappings/QueryMapper.java @@ -2,7 +2,6 @@ package pro.taskana.model.mappings; import java.util.List; -import org.apache.ibatis.annotations.Many; import org.apache.ibatis.annotations.Result; import org.apache.ibatis.annotations.Results; import org.apache.ibatis.annotations.Select; @@ -12,9 +11,9 @@ import pro.taskana.impl.ClassificationQueryImpl; import pro.taskana.impl.ObjectReferenceQueryImpl; import pro.taskana.impl.TaskImpl; import pro.taskana.impl.TaskQueryImpl; -import pro.taskana.impl.WorkbasketImpl; import pro.taskana.impl.WorkbasketQueryImpl; import pro.taskana.model.ObjectReference; +import pro.taskana.model.WorkbasketSummary; /** * This class provides a mapper for all queries. @@ -149,7 +148,7 @@ public interface QueryMapper { @Result(property = "value", column = "VALUE") }) List queryObjectReference(ObjectReferenceQueryImpl objectReference); - @Select("") - @Results(value = { - @Result(property = "distributionTarget", column = "TARGET_ID") }) - List findDistributionTargets(String sourceId); + List queryWorkbasket(WorkbasketQueryImpl workbasketQuery); } diff --git a/lib/taskana-core/src/main/java/pro/taskana/model/mappings/WorkbasketMapper.java b/lib/taskana-core/src/main/java/pro/taskana/model/mappings/WorkbasketMapper.java index 190a6c561..6a83bd0dd 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/model/mappings/WorkbasketMapper.java +++ b/lib/taskana-core/src/main/java/pro/taskana/model/mappings/WorkbasketMapper.java @@ -15,6 +15,7 @@ import org.apache.ibatis.mapping.FetchType; import pro.taskana.impl.WorkbasketImpl; import pro.taskana.model.WorkbasketAuthorization; +import pro.taskana.model.WorkbasketSummary; /** * This class is the mybatis mapping of workbaskets. @@ -37,12 +38,10 @@ public interface WorkbasketMapper { @Result(property = "custom2", column = "CUSTOM_2"), @Result(property = "custom3", column = "CUSTOM_3"), @Result(property = "custom4", column = "CUSTOM_4"), - @Result(property = "custom5", column = "CUSTOM_5"), - @Result(property = "custom6", column = "CUSTOM_6"), - @Result(property = "custom7", column = "CUSTOM_7"), - @Result(property = "custom8", column = "CUSTOM_8"), - @Result(property = "custom9", column = "CUSTOM_9"), - @Result(property = "custom10", column = "CUSTOM_10") }) + @Result(property = "orgLevel1", column = "ORG_LEVEL_1"), + @Result(property = "orgLevel2", column = "ORG_LEVEL_2"), + @Result(property = "orgLevel3", column = "ORG_LEVEL_3"), + @Result(property = "orgLevel4", column = "ORG_LEVEL_4")}) WorkbasketImpl findById(@Param("id") String id); @Select("SELECT ID, KEY, CREATED, MODIFIED, NAME, DOMAIN, TYPE, DESCRIPTION, OWNER, CUSTOM_1 ,CUSTOM_2 ,CUSTOM_3 ,CUSTOM_4 ,ORG_LEVEL_1 ,ORG_LEVEL_2 ,ORG_LEVEL_3 ,ORG_LEVEL_4 FROM WORKBASKET WHERE KEY = #{key}") @@ -61,65 +60,46 @@ public interface WorkbasketMapper { @Result(property = "custom2", column = "CUSTOM_2"), @Result(property = "custom3", column = "CUSTOM_3"), @Result(property = "custom4", column = "CUSTOM_4"), - @Result(property = "custom5", column = "CUSTOM_5"), - @Result(property = "custom6", column = "CUSTOM_6"), - @Result(property = "custom7", column = "CUSTOM_7"), - @Result(property = "custom8", column = "CUSTOM_8"), - @Result(property = "custom9", column = "CUSTOM_9"), - @Result(property = "custom10", column = "CUSTOM_10") }) + + @Result(property = "orgLevel1", column = "ORG_LEVEL_1"), + @Result(property = "orgLevel2", column = "ORG_LEVEL_2"), + @Result(property = "orgLevel3", column = "ORG_LEVEL_3"), + @Result(property = "orgLevel4", column = "ORG_LEVEL_4")}) WorkbasketImpl findByKey(@Param("key") String key); @Select("SELECT * FROM WORKBASKET WHERE id IN (SELECT TARGET_ID FROM DISTRIBUTION_TARGETS WHERE SOURCE_ID = #{id})") @Results(value = { @Result(property = "id", column = "ID"), @Result(property = "key", column = "KEY"), - @Result(property = "created", column = "CREATED"), - @Result(property = "modified", column = "MODIFIED"), @Result(property = "name", column = "NAME"), - @Result(property = "domain", column = "DOMAIN"), - @Result(property = "type", column = "TYPE"), @Result(property = "description", column = "DESCRIPTION"), @Result(property = "owner", column = "OWNER"), - @Result(property = "distributionTargets", column = "ID", javaType = List.class, - many = @Many(fetchType = FetchType.DEFAULT, select = "findByDistributionTargets")), - @Result(property = "custom1", column = "CUSTOM_1"), - @Result(property = "custom2", column = "CUSTOM_2"), - @Result(property = "custom3", column = "CUSTOM_3"), - @Result(property = "custom4", column = "CUSTOM_4"), - @Result(property = "custom5", column = "CUSTOM_5"), - @Result(property = "custom6", column = "CUSTOM_6"), - @Result(property = "custom7", column = "CUSTOM_7"), - @Result(property = "custom8", column = "CUSTOM_8"), - @Result(property = "custom9", column = "CUSTOM_9"), - @Result(property = "custom10", column = "CUSTOM_10") }) - List findByDistributionTargets(@Param("id") String id); + @Result(property = "domain", column = "DOMAIN"), + @Result(property = "type", column = "TYPE"), + + @Result(property = "orgLevel1", column = "ORG_LEVEL_1"), + @Result(property = "orgLevel2", column = "ORG_LEVEL_2"), + @Result(property = "orgLevel3", column = "ORG_LEVEL_3"), + @Result(property = "orgLevel4", column = "ORG_LEVEL_4")}) + + List findByDistributionTargets(@Param("id") String id); @Select("SELECT * FROM WORKBASKET ORDER BY id") @Results(value = { @Result(property = "id", column = "ID"), @Result(property = "key", column = "KEY"), - @Result(property = "created", column = "CREATED"), - @Result(property = "modified", column = "MODIFIED"), @Result(property = "name", column = "NAME"), - @Result(property = "domain", column = "DOMAIN"), - @Result(property = "type", column = "TYPE"), @Result(property = "description", column = "DESCRIPTION"), @Result(property = "owner", column = "OWNER"), - @Result(property = "distributionTargets", column = "ID", javaType = List.class, - many = @Many(fetchType = FetchType.DEFAULT, select = "findByDistributionTargets")), - @Result(property = "custom1", column = "CUSTOM_1"), - @Result(property = "custom2", column = "CUSTOM_2"), - @Result(property = "custom3", column = "CUSTOM_3"), - @Result(property = "custom4", column = "CUSTOM_4"), - @Result(property = "custom5", column = "CUSTOM_5"), - @Result(property = "custom6", column = "CUSTOM_6"), - @Result(property = "custom7", column = "CUSTOM_7"), - @Result(property = "custom8", column = "CUSTOM_8"), - @Result(property = "custom9", column = "CUSTOM_9"), - @Result(property = "custom10", column = "CUSTOM_10") }) - List findAll(); + @Result(property = "domain", column = "DOMAIN"), + @Result(property = "type", column = "TYPE"), + @Result(property = "orgLevel1", column = "ORG_LEVEL_1"), + @Result(property = "orgLevel2", column = "ORG_LEVEL_2"), + @Result(property = "orgLevel3", column = "ORG_LEVEL_3"), + @Result(property = "orgLevel4", column = "ORG_LEVEL_4")}) + List findAll(); - @Select("