TSK-598: Added custom1-4 to WorkbasketSummary

This commit is contained in:
julian.schallenmueller 2018-07-05 14:56:26 +02:00 committed by Holger Hagen
parent 70476e597f
commit cc62283437
10 changed files with 169 additions and 29 deletions

View File

@ -56,30 +56,58 @@ public interface WorkbasketSummary {
WorkbasketType getType();
/**
* Gets the orglevel1 property of the task.
* Gets the custom1 property of the workbasket.
*
* @return the task's orglevel1 property
* @return the workbasket's custom1 property.
*/
String getCustom1();
/**
* Gets the custom2 property of the workbasket.
*
* @return the workbasket's custom2 property.
*/
String getCustom2();
/**
* Gets the custom3 property of the workbasket.
*
* @return the workbasket's custom3 property.
*/
String getCustom3();
/**
* Gets the custom4 property of the workbasket.
*
* @return the workbasket's custom4 property.
*/
String getCustom4();
/**
* Gets the orglevel1 property of the workbasket.
*
* @return the workbasket's orglevel1 property
*/
String getOrgLevel1();
/**
* Gets the orglevel2 property of the task.
* Gets the orglevel2 property of the workbasket.
*
* @return the task's orglevel2 property
* @return the workbasket's orglevel2 property
*/
String getOrgLevel2();
/**
* Gets the orglevel3 property of the task.
* Gets the orglevel3 property of the workbasket.
*
* @return the task's orglevel3 property
* @return the workbasket's orglevel3 property
*/
String getOrgLevel3();
/**
* Gets the orglevel4 property of the task.
* Gets the orglevel4 property of the workbasket.
*
* @return the task's orglevel4 property
* @return the workbasket's orglevel4 property
*/
String getOrgLevel4();

View File

@ -15,6 +15,10 @@ public class WorkbasketSummaryImpl implements WorkbasketSummary {
private String owner;
private String domain;
private WorkbasketType type;
private String custom1;
private String custom2;
private String custom3;
private String custom4;
private String orgLevel1;
private String orgLevel2;
private String orgLevel3;
@ -114,6 +118,58 @@ public class WorkbasketSummaryImpl implements WorkbasketSummary {
this.type = type;
}
/*
* (non-Javadoc)
* @see pro.taskana.impl.WorkbasketSummary#getCustom1()
*/
@Override
public String getCustom1() {
return custom1;
}
public void setCustom1(String custom1) {
this.custom1 = custom1;
}
/*
* (non-Javadoc)
* @see pro.taskana.impl.WorkbasketSummary#getCustom2()
*/
@Override
public String getCustom2() {
return custom2;
}
public void setCustom2(String custom2) {
this.custom2 = custom2;
}
/*
* (non-Javadoc)
* @see pro.taskana.impl.WorkbasketSummary#getCustom3()
*/
@Override
public String getCustom3() {
return custom3;
}
public void setCustom3(String custom3) {
this.custom3 = custom3;
}
/*
* (non-Javadoc)
* @see pro.taskana.impl.WorkbasketSummary#getCustom4()
*/
@Override
public String getCustom4() {
return custom4;
}
public void setCustom4(String custom4) {
this.custom4 = custom4;
}
/*
* (non-Javadoc)
* @see pro.taskana.impl.WorkbasketSummary#getOrgLevel1()

View File

@ -356,7 +356,7 @@ public interface QueryMapper {
@Select("<script>"
+ "SELECT DISTINCT "
+ "w.ID, w.KEY, w.NAME, w.DOMAIN, W.TYPE, w.DESCRIPTION, w.OWNER, w.ORG_LEVEL_1, w.ORG_LEVEL_2, w.ORG_LEVEL_3, w.ORG_LEVEL_4 from TASKANA.WORKBASKET w "
+ "w.ID, w.KEY, w.NAME, w.DOMAIN, W.TYPE, w.DESCRIPTION, w.OWNER, w.CUSTOM_1, w.CUSTOM_2, w.CUSTOM_3, w.CUSTOM_4, w.ORG_LEVEL_1, w.ORG_LEVEL_2, w.ORG_LEVEL_3, w.ORG_LEVEL_4 from TASKANA.WORKBASKET w "
+ "<if test = 'joinWithAccessList'> "
+ "<choose>"
+ "<when test=\"_databaseId == 'db2'\">"
@ -446,6 +446,10 @@ public interface QueryMapper {
@Result(property = "owner", column = "OWNER"),
@Result(property = "domain", column = "DOMAIN"),
@Result(property = "type", column = "TYPE"),
@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 = "orgLevel1", column = "ORG_LEVEL_1"),
@Result(property = "orgLevel2", column = "ORG_LEVEL_2"),
@Result(property = "orgLevel3", column = "ORG_LEVEL_3"),

View File

@ -63,7 +63,7 @@ public interface WorkbasketMapper {
@Result(property = "orgLevel4", column = "ORG_LEVEL_4")})
WorkbasketImpl findByKeyAndDomain(@Param("key") String key, @Param("domain") String domain);
@Select("<script>SELECT ID, KEY, NAME, DESCRIPTION, OWNER, DOMAIN, TYPE, ORG_LEVEL_1, ORG_LEVEL_2, ORG_LEVEL_3, ORG_LEVEL_4 FROM TASKANA.WORKBASKET WHERE ID IN (SELECT TARGET_ID FROM TASKANA.DISTRIBUTION_TARGETS WHERE SOURCE_ID = #{id}) "
@Select("<script>SELECT ID, KEY, NAME, DESCRIPTION, OWNER, DOMAIN, TYPE, CUSTOM_1, CUSTOM_2, CUSTOM_3, CUSTOM_4, ORG_LEVEL_1, ORG_LEVEL_2, ORG_LEVEL_3, ORG_LEVEL_4 FROM TASKANA.WORKBASKET WHERE ID IN (SELECT TARGET_ID FROM TASKANA.DISTRIBUTION_TARGETS WHERE SOURCE_ID = #{id}) "
+ "<if test=\"_databaseId == 'db2'\">with UR </if> "
+ "</script>")
@Results(value = {
@ -74,13 +74,17 @@ public interface WorkbasketMapper {
@Result(property = "owner", column = "OWNER"),
@Result(property = "domain", column = "DOMAIN"),
@Result(property = "type", column = "TYPE"),
@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 = "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<WorkbasketSummaryImpl> findDistributionTargets(@Param("id") String id);
@Select("<script>SELECT ID, KEY, NAME, DESCRIPTION, OWNER, DOMAIN, TYPE, ORG_LEVEL_1, ORG_LEVEL_2, ORG_LEVEL_3, ORG_LEVEL_4 FROM TASKANA.WORKBASKET "
@Select("<script>SELECT ID, KEY, NAME, DESCRIPTION, OWNER, DOMAIN, TYPE, CUSTOM_1, CUSTOM_2, CUSTOM_3, CUSTOM_4, ORG_LEVEL_1, ORG_LEVEL_2, ORG_LEVEL_3, ORG_LEVEL_4 FROM TASKANA.WORKBASKET "
+ " WHERE ID IN (SELECT SOURCE_ID FROM TASKANA.DISTRIBUTION_TARGETS WHERE TARGET_ID = #{id}) "
+ "<if test=\"_databaseId == 'db2'\">with UR </if> "
+ "</script>")
@ -92,13 +96,17 @@ public interface WorkbasketMapper {
@Result(property = "owner", column = "OWNER"),
@Result(property = "domain", column = "DOMAIN"),
@Result(property = "type", column = "TYPE"),
@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 = "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<WorkbasketSummaryImpl> findDistributionSources(@Param("id") String id);
@Select("<script>SELECT ID, KEY, NAME, DESCRIPTION, OWNER, DOMAIN, TYPE, ORG_LEVEL_1, ORG_LEVEL_2, ORG_LEVEL_3, ORG_LEVEL_4 FROM TASKANA.WORKBASKET WHERE ID = #{id} "
@Select("<script>SELECT ID, KEY, NAME, DESCRIPTION, OWNER, DOMAIN, TYPE, CUSTOM_1, CUSTOM_2, CUSTOM_3, CUSTOM_4, ORG_LEVEL_1, ORG_LEVEL_2, ORG_LEVEL_3, ORG_LEVEL_4 FROM TASKANA.WORKBASKET WHERE ID = #{id} "
+ "<if test=\"_databaseId == 'db2'\">with UR </if> "
+ "</script>")
@Results(value = {
@ -109,6 +117,10 @@ public interface WorkbasketMapper {
@Result(property = "owner", column = "OWNER"),
@Result(property = "domain", column = "DOMAIN"),
@Result(property = "type", column = "TYPE"),
@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 = "orgLevel1", column = "ORG_LEVEL_1"),
@Result(property = "orgLevel2", column = "ORG_LEVEL_2"),
@Result(property = "orgLevel3", column = "ORG_LEVEL_3"),
@ -126,6 +138,10 @@ public interface WorkbasketMapper {
@Result(property = "owner", column = "OWNER"),
@Result(property = "domain", column = "DOMAIN"),
@Result(property = "type", column = "TYPE"),
@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 = "orgLevel1", column = "ORG_LEVEL_1"),
@Result(property = "orgLevel2", column = "ORG_LEVEL_2"),
@Result(property = "orgLevel3", column = "ORG_LEVEL_3"),

View File

@ -545,6 +545,7 @@ public class QueryClassificationAccTest extends AbstractAccTest {
List<ClassificationSummary> results = classificationService.createClassificationQuery()
.orderByCustom1(desc)
.orderByName(asc)
.orderByDomain(asc)
.list();
assertEquals("CLI:000000000000000000000000000000000002", results.get(0).getId());
}

View File

@ -8,7 +8,6 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
@ -546,7 +545,7 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.custom4Like("%u%")
.list();
assertEquals(4, results.size());
assertEquals(5, results.size());
}
@WithAccessId(
@ -681,8 +680,6 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
assertEquals("WBI:100000000000000000000000000000000012", results.get(results.size() - 3).getId());
}
// TODO Add custom1 - custom4 to the workbasketSummary then reenable this test.
@Ignore
@WithAccessId(
userName = "admin")
@Test
@ -694,8 +691,6 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
assertEquals("WBI:100000000000000000000000000000000015", results.get(results.size() - 4).getId());
}
// TODO Add custom1 - custom4 to the workbasketSummary then reenable this test.
@Ignore
@WithAccessId(
userName = "admin")
@Test
@ -707,8 +702,6 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
assertEquals("WBI:100000000000000000000000000000000014", results.get(0).getId());
}
// TODO Add custom1 - custom4 to the workbasketSummary then reenable this test.
@Ignore
@WithAccessId(
userName = "admin")
@Test
@ -717,11 +710,9 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.orderByCustom3(asc)
.list();
assertEquals("WBI:100000000000000000000000000000000015", results.get(results.size() - 3).getId());
assertEquals("WBI:100000000000000000000000000000000015", results.get(results.size() - 4).getId());
}
// TODO Add custom1 - custom4 to the workbasketSummary then reenable this test.
@Ignore
@WithAccessId(
userName = "admin")
@Test
@ -730,7 +721,7 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.orderByCustom4(desc)
.list();
assertEquals("WBI:100000000000000000000000000000000001", results.get(0).getId());
assertEquals("WBI:100000000000000000000000000000000006", results.get(0).getId());
}
}

View File

@ -4,7 +4,7 @@ INSERT INTO TASKANA.WORKBASKET VALUES ('WBI:100000000000000000000000000000000002
INSERT INTO TASKANA.WORKBASKET VALUES ('WBI:100000000000000000000000000000000003', 'GPK_KSC_2', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'Gruppenpostkorb KSC 2', 'DOMAIN_A', 'GROUP', 'Gruppenpostkorb KSC 2', '', '', '', '', '', '', '', '', '');
INSERT INTO TASKANA.WORKBASKET VALUES ('WBI:100000000000000000000000000000000004', 'TEAMLEAD_1', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'PPK Teamlead KSC 1', 'DOMAIN_A', 'PERSONAL', 'PPK Teamlead KSC 1', '', '', '', '', '', '', '', '', '');
INSERT INTO TASKANA.WORKBASKET VALUES ('WBI:100000000000000000000000000000000005', 'TEAMLEAD_2', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'PPK Teamlead KSC 2', 'DOMAIN_A', 'PERSONAL', 'PPK Teamlead KSC 2', '', '', '', '', '', '', '', '', '');
INSERT INTO TASKANA.WORKBASKET VALUES ('WBI:100000000000000000000000000000000006', 'USER_1_1', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'PPK User 1 KSC 1', 'DOMAIN_A', 'PERSONAL', 'PPK User 1 KSC 1', '', '', '', '', '', '', '', '', '');
INSERT INTO TASKANA.WORKBASKET VALUES ('WBI:100000000000000000000000000000000006', 'USER_1_1', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'PPK User 1 KSC 1', 'DOMAIN_A', 'PERSONAL', 'PPK User 1 KSC 1', '', '', '', '', 'custom4z', '', '', '', '');
INSERT INTO TASKANA.WORKBASKET VALUES ('WBI:100000000000000000000000000000000007', 'USER_1_2', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'PPK User 2 KSC 1', 'DOMAIN_A', 'PERSONAL', 'PPK User 2 KSC 1', 'Peter Maier', 'custom1', 'custom2', 'custom3', 'custom4', 'versicherung', 'abteilung', 'projekt', 'team');
INSERT INTO TASKANA.WORKBASKET VALUES ('WBI:100000000000000000000000000000000008', 'USER_2_1', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'PPK User 1 KSC 2', 'DOMAIN_A', 'PERSONAL', 'PPK User 1 KSC 2', '', '', '', '', '', '', '', '', '');
INSERT INTO TASKANA.WORKBASKET VALUES ('WBI:100000000000000000000000000000000009', 'USER_2_2', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'PPK User 2 KSC 2', 'DOMAIN_A', 'PERSONAL', 'PPK User 2 KSC 2', '', '', '', '', '', '', '', '', '');

View File

@ -161,16 +161,16 @@ public class WorkbasketControllerRestDocumentation {
fieldWithPath("type").description(workbasketFieldDescriptionsMap.get("type")),
fieldWithPath("description").description(workbasketFieldDescriptionsMap.get("description")),
fieldWithPath("owner").description(workbasketFieldDescriptionsMap.get("owner")),
fieldWithPath("custom1").description(workbasketFieldDescriptionsMap.get("custom1")),
fieldWithPath("custom2").description(workbasketFieldDescriptionsMap.get("custom2")),
fieldWithPath("custom3").description(workbasketFieldDescriptionsMap.get("custom3")),
fieldWithPath("custom4").description(workbasketFieldDescriptionsMap.get("custom4")),
fieldWithPath("orgLevel1").description(workbasketFieldDescriptionsMap.get("orgLevel1")),
fieldWithPath("orgLevel2").description(workbasketFieldDescriptionsMap.get("orgLevel2")),
fieldWithPath("orgLevel3").description(workbasketFieldDescriptionsMap.get("orgLevel3")),
fieldWithPath("orgLevel4").description(workbasketFieldDescriptionsMap.get("orgLevel4")),
fieldWithPath("created").ignored(),
fieldWithPath("modified").ignored(),
fieldWithPath("custom1").ignored(),
fieldWithPath("custom2").ignored(),
fieldWithPath("custom3").ignored(),
fieldWithPath("custom4").ignored(),
fieldWithPath("_links.distributionTargets.href").ignored(),
fieldWithPath("_links.removeDistributionTargets.href").ignored(),
fieldWithPath("_links.accessItems.href").ignored(),

View File

@ -29,6 +29,10 @@ public class WorkbasketSummaryResource extends ResourceSupport {
public String description;
public String owner;
public String custom1;
public String custom2;
public String custom3;
public String custom4;
public String orgLevel1;
public String orgLevel2;
public String orgLevel3;
@ -90,6 +94,38 @@ public class WorkbasketSummaryResource extends ResourceSupport {
this.owner = owner;
}
public String getCustom1() {
return custom1;
}
public void setCustom1(String custom1) {
this.custom1 = custom1;
}
public String getCustom2() {
return custom2;
}
public void setCustom2(String custom2) {
this.custom2 = custom2;
}
public String getCustom3() {
return custom3;
}
public void setCustom3(String custom3) {
this.custom3 = custom3;
}
public String getCustom4() {
return custom4;
}
public void setCustom4(String custom4) {
this.custom4 = custom4;
}
public String getOrgLevel1() {
return orgLevel1;
}

View File

@ -37,6 +37,10 @@ public class WorkbasketSummaryAssemblerTest {
workbasketSummary.setDescription("WorkbasketSummaryImplTes");
workbasketSummary.setId("1");
workbasketSummary.setName("WorkbasketSummary");
workbasketSummary.setCustom1("custom1");
workbasketSummary.setCustom2("custom2");
workbasketSummary.setCustom3("custom3");
workbasketSummary.setCustom4("custom4");
workbasketSummary.setOrgLevel1("Org1");
workbasketSummary.setOrgLevel2("Org2");
workbasketSummary.setOrgLevel3("Org3");
@ -51,6 +55,10 @@ public class WorkbasketSummaryAssemblerTest {
Assert.assertEquals(workbasketSummary.getId(), workbasketSummaryResource.workbasketId);
Assert.assertEquals(workbasketSummary.getKey(), workbasketSummaryResource.key);
Assert.assertEquals(workbasketSummary.getName(), workbasketSummaryResource.name);
Assert.assertEquals(workbasketSummary.getCustom1(), workbasketSummaryResource.custom1);
Assert.assertEquals(workbasketSummary.getCustom2(), workbasketSummaryResource.custom2);
Assert.assertEquals(workbasketSummary.getCustom3(), workbasketSummaryResource.custom3);
Assert.assertEquals(workbasketSummary.getCustom4(), workbasketSummaryResource.custom4);
Assert.assertEquals(workbasketSummary.getOrgLevel1(), workbasketSummaryResource.orgLevel1);
Assert.assertEquals(workbasketSummary.getOrgLevel2(), workbasketSummaryResource.orgLevel2);
Assert.assertEquals(workbasketSummary.getOrgLevel3(), workbasketSummaryResource.orgLevel3);