TSK-1009: Fix building errors after checkstyle changes

This commit is contained in:
Benjamin Eckstein 2020-01-07 15:06:43 +01:00 committed by Mustapha Zorgati
parent 841d38961a
commit c4cd616e35
22 changed files with 269 additions and 300 deletions

View File

@ -3,9 +3,8 @@ package pro.taskana.simplehistory.query;
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.impl.mappings.HistoryQueryMapper#queryHistoryColumnValues}.
*
* @author bv
*/

View File

@ -1,8 +1,8 @@
package pro.taskana;
/**
* Enum containing the column names for {@see
* pro.taskana.mappings.QueryMapper#queryWorkbasketAccessItemColumnValues}.
* Enum containing the column names for
* {@link pro.taskana.mappings.QueryMapper#queryWorkbasketAccessItemColumnValues}.
*
* @author jsa
*/

View File

@ -1,8 +1,8 @@
package pro.taskana;
/**
* Enum containing the column names for {@see
* pro.taskana.mappings.QueryMapper#queryClassificationColumnValues}.
* Enum containing the column names for
* {@link pro.taskana.mappings.QueryMapper#queryClassificationColumnValues}.
*
* @author jsa
*/

View File

@ -33,26 +33,23 @@ public class KeyDomain {
this.domain = domain;
}
@Override
public int hashCode() {
return Objects.hash(key, domain);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
if (!(obj instanceof KeyDomain)) {
return false;
}
KeyDomain other = (KeyDomain) obj;
return Objects.equals(key, other.key) && Objects.equals(domain, other.domain);
}
@Override
public int hashCode() {
return Objects.hash(key, domain);
}
@Override
public String toString() {
return "KeyDomain [key=" + key + ", domain=" + domain + "]";

View File

@ -60,20 +60,12 @@ public class ObjectReference {
this.value = value;
}
@Override
public int hashCode() {
return Objects.hash(id, company, system, systemInstance, type, value);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
if (!(obj instanceof ObjectReference)) {
return false;
}
ObjectReference other = (ObjectReference) obj;
@ -85,6 +77,11 @@ public class ObjectReference {
&& Objects.equals(value, other.value);
}
@Override
public int hashCode() {
return Objects.hash(id, company, system, systemInstance, type, value);
}
@Override
public String toString() {
return "ObjectReference ["

View File

@ -1,8 +1,8 @@
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
* {@link pro.taskana.mappings.QueryMapper#queryTaskColumnValues(pro.taskana.impl.TaskQueryImpl)}.
*
* @author jsa
*/

View File

@ -52,26 +52,23 @@ public class TimeInterval {
this.end = end;
}
@Override
public int hashCode() {
return Objects.hash(begin, end);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
if (!(obj instanceof TimeInterval)) {
return false;
}
TimeInterval other = (TimeInterval) obj;
return Objects.equals(begin, other.begin) && Objects.equals(end, other.end);
}
@Override
public int hashCode() {
return Objects.hash(begin, end);
}
@Override
public String toString() {
return "TimeInterval [" + "begin=" + this.begin + ", end=" + this.end + "]";

View File

@ -1,7 +1,7 @@
package pro.taskana;
/**
* Enum containing the column names for @see {@link
* Enum containing the column names for {@link
* pro.taskana.mappings.QueryMapper#queryWorkbasketColumnValues
* (pro.taskana.impl.WorkbasketQueryImpl)}.
*

View File

@ -161,10 +161,7 @@ public class AttachmentImpl implements Attachment {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
if (!(obj instanceof AttachmentImpl)) {
return false;
}
AttachmentImpl other = (AttachmentImpl) obj;

View File

@ -122,34 +122,12 @@ public class AttachmentSummaryImpl implements AttachmentSummary {
this.classificationSummary = classificationSummary;
}
/*
* (non-Javadoc)
* @see pro.taskana.impl.AttachmentSummary#getReceived()
*/
@Override
public Instant getReceived() {
return received;
}
public void setReceived(Instant received) {
this.received = received;
}
@Override
public int hashCode() {
return Objects.hash(
id, taskId, created, modified, classificationSummary, objectReference, channel, received);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
if (!(obj instanceof AttachmentSummaryImpl)) {
return false;
}
AttachmentSummaryImpl other = (AttachmentSummaryImpl) obj;
@ -163,6 +141,25 @@ public class AttachmentSummaryImpl implements AttachmentSummary {
&& Objects.equals(received, other.received);
}
@Override
public int hashCode() {
return Objects.hash(
id, taskId, created, modified, classificationSummary, objectReference, channel, received);
}
/*
* (non-Javadoc)
* @see pro.taskana.impl.AttachmentSummary#getReceived()
*/
@Override
public Instant getReceived() {
return received;
}
public void setReceived(Instant received) {
this.received = received;
}
@Override
public String toString() {
return "AttachmentSummaryImpl [id="

View File

@ -119,21 +119,12 @@ public class ClassificationImpl extends ClassificationSummaryImpl implements Cla
return (other instanceof ClassificationImpl);
}
@Override
public int hashCode() {
return Objects.hash(
super.hashCode(), isValidInDomain, created, modified, description, applicationEntryPoint);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
if (!(obj instanceof ClassificationImpl)) {
return false;
}
if (!super.equals(obj)) {
@ -147,6 +138,12 @@ public class ClassificationImpl extends ClassificationSummaryImpl implements Cla
&& Objects.equals(applicationEntryPoint, other.applicationEntryPoint);
}
@Override
public int hashCode() {
return Objects.hash(
super.hashCode(), isValidInDomain, created, modified, description, applicationEntryPoint);
}
@Override
public String toString() {
return "ClassificationImpl [id="

View File

@ -190,8 +190,38 @@ public class ClassificationSummaryImpl implements ClassificationSummary {
this.custom8 = custom8;
}
protected boolean canEqual(Object other) {
return (other instanceof ClassificationSummaryImpl);
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof ClassificationSummaryImpl)) {
return false;
}
ClassificationSummaryImpl other = (ClassificationSummaryImpl) obj;
if (!other.canEqual(this)) {
return false;
}
return priority == other.priority
&& Objects.equals(id, other.id)
&& Objects.equals(key, other.key)
&& Objects.equals(category, other.category)
&& Objects.equals(type, other.type)
&& Objects.equals(domain, other.domain)
&& Objects.equals(name, other.name)
&& Objects.equals(parentId, other.parentId)
&& Objects.equals(parentKey, other.parentKey)
&& Objects.equals(serviceLevel, other.serviceLevel)
&& Objects.equals(custom1, other.custom1)
&& Objects.equals(custom2, other.custom2)
&& Objects.equals(custom3, other.custom3)
&& Objects.equals(custom4, other.custom4)
&& Objects.equals(custom5, other.custom5)
&& Objects.equals(custom6, other.custom6)
&& Objects.equals(custom7, other.custom7)
&& Objects.equals(custom8, other.custom8);
}
@Override
@ -217,36 +247,8 @@ public class ClassificationSummaryImpl implements ClassificationSummary {
custom8);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
ClassificationSummaryImpl other = (ClassificationSummaryImpl) obj;
return priority == other.priority
&& Objects.equals(id, other.id)
&& Objects.equals(key, other.key)
&& Objects.equals(category, other.category)
&& Objects.equals(type, other.type)
&& Objects.equals(domain, other.domain)
&& Objects.equals(name, other.name)
&& Objects.equals(parentId, other.parentId)
&& Objects.equals(parentKey, other.parentKey)
&& Objects.equals(serviceLevel, other.serviceLevel)
&& Objects.equals(custom1, other.custom1)
&& Objects.equals(custom2, other.custom2)
&& Objects.equals(custom3, other.custom3)
&& Objects.equals(custom4, other.custom4)
&& Objects.equals(custom5, other.custom5)
&& Objects.equals(custom6, other.custom6)
&& Objects.equals(custom7, other.custom7)
&& Objects.equals(custom8, other.custom8);
protected boolean canEqual(Object other) {
return (other instanceof ClassificationSummaryImpl);
}
@Override

View File

@ -720,62 +720,12 @@ public class TaskImpl implements Task {
return result;
}
@Override
public int hashCode() {
return Objects.hash(
id,
externalId,
created,
claimed,
completed,
modified,
planned,
due,
name,
creator,
description,
note,
priority,
state,
classificationSummary,
workbasketSummary,
businessProcessId,
parentBusinessProcessId,
owner,
primaryObjRef,
isRead,
isTransferred,
customAttributes,
callbackInfo,
callbackState,
attachments,
custom1,
custom2,
custom3,
custom4,
custom5,
custom6,
custom7,
custom8,
custom9,
custom10,
custom11,
custom12,
custom13,
custom14,
custom15,
custom16);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
if (!(obj instanceof TaskImpl)) {
return false;
}
TaskImpl other = (TaskImpl) obj;
@ -823,6 +773,53 @@ public class TaskImpl implements Task {
&& Objects.equals(custom16, other.custom16);
}
@Override
public int hashCode() {
return Objects.hash(
id,
externalId,
created,
claimed,
completed,
modified,
planned,
due,
name,
creator,
description,
note,
priority,
state,
classificationSummary,
workbasketSummary,
businessProcessId,
parentBusinessProcessId,
owner,
primaryObjRef,
isRead,
isTransferred,
customAttributes,
callbackInfo,
callbackState,
attachments,
custom1,
custom2,
custom3,
custom4,
custom5,
custom6,
custom7,
custom8,
custom9,
custom10,
custom11,
custom12,
custom13,
custom14,
custom15,
custom16);
}
@Override
public String toString() {
return "TaskImpl [id="

View File

@ -588,58 +588,12 @@ public class TaskSummaryImpl implements TaskSummary {
this.custom16 = custom16;
}
@Override
public int hashCode() {
return Objects.hash(
taskId,
externalId,
created,
claimed,
completed,
modified,
planned,
due,
name,
creator,
note,
priority,
state,
classificationSummary,
workbasketSummary,
businessProcessId,
parentBusinessProcessId,
owner,
primaryObjRef,
isRead,
isTransferred,
attachmentSummaries,
custom1,
custom2,
custom3,
custom4,
custom5,
custom6,
custom7,
custom8,
custom9,
custom10,
custom11,
custom12,
custom13,
custom14,
custom15,
custom16);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
if (!(obj instanceof TaskSummaryImpl)) {
return false;
}
TaskSummaryImpl other = (TaskSummaryImpl) obj;
@ -683,6 +637,49 @@ public class TaskSummaryImpl implements TaskSummary {
&& Objects.equals(custom16, other.custom16);
}
@Override
public int hashCode() {
return Objects.hash(
taskId,
externalId,
created,
claimed,
completed,
modified,
planned,
due,
name,
creator,
note,
priority,
state,
classificationSummary,
workbasketSummary,
businessProcessId,
parentBusinessProcessId,
owner,
primaryObjRef,
isRead,
isTransferred,
attachmentSummaries,
custom1,
custom2,
custom3,
custom4,
custom5,
custom6,
custom7,
custom8,
custom9,
custom10,
custom11,
custom12,
custom13,
custom14,
custom15,
custom16);
}
@Override
public String toString() {
return "TaskSummaryImpl [taskId="

View File

@ -415,42 +415,12 @@ public class WorkbasketAccessItemImpl implements WorkbasketAccessItem {
this.permCustom12 = permCustom12;
}
@Override
public int hashCode() {
return Objects.hash(
id,
workbasketId,
workbasketKey,
accessId,
accessName,
permRead,
permOpen,
permAppend,
permTransfer,
permDistribute,
permCustom1,
permCustom2,
permCustom3,
permCustom4,
permCustom5,
permCustom6,
permCustom7,
permCustom8,
permCustom9,
permCustom10,
permCustom11,
permCustom12);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
if (!(obj instanceof WorkbasketAccessItemImpl)) {
return false;
}
WorkbasketAccessItemImpl other = (WorkbasketAccessItemImpl) obj;
@ -478,6 +448,33 @@ public class WorkbasketAccessItemImpl implements WorkbasketAccessItem {
&& Objects.equals(accessName, other.accessName);
}
@Override
public int hashCode() {
return Objects.hash(
id,
workbasketId,
workbasketKey,
accessId,
accessName,
permRead,
permOpen,
permAppend,
permTransfer,
permDistribute,
permCustom1,
permCustom2,
permCustom3,
permCustom4,
permCustom5,
permCustom6,
permCustom7,
permCustom8,
permCustom9,
permCustom10,
permCustom11,
permCustom12);
}
@Override
public String toString() {
return "WorkbasketAccessItem [id="

View File

@ -228,38 +228,12 @@ public class WorkbasketImpl implements Workbasket {
return result;
}
@Override
public int hashCode() {
return Objects.hash(
id,
key,
created,
modified,
name,
description,
owner,
domain,
type,
custom1,
custom2,
custom3,
custom4,
orgLevel1,
orgLevel2,
orgLevel3,
orgLevel4,
markedForDeletion);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
if (!(obj instanceof WorkbasketImpl)) {
return false;
}
WorkbasketImpl other = (WorkbasketImpl) obj;
@ -283,6 +257,29 @@ public class WorkbasketImpl implements Workbasket {
&& Objects.equals(orgLevel4, other.orgLevel4);
}
@Override
public int hashCode() {
return Objects.hash(
id,
key,
created,
modified,
name,
description,
owner,
domain,
type,
custom1,
custom2,
custom3,
custom4,
orgLevel1,
orgLevel2,
orgLevel3,
orgLevel4,
markedForDeletion);
}
@Override
public String toString() {
return "WorkbasketImpl [id="

View File

@ -231,36 +231,12 @@ public class WorkbasketSummaryImpl implements WorkbasketSummary {
this.markedForDeletion = markedForDeletion;
}
@Override
public int hashCode() {
return Objects.hash(
id,
key,
name,
description,
owner,
domain,
type,
custom1,
custom2,
custom3,
custom4,
orgLevel1,
orgLevel2,
orgLevel3,
orgLevel4,
markedForDeletion);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
if (!(obj instanceof WorkbasketSummaryImpl)) {
return false;
}
WorkbasketSummaryImpl other = (WorkbasketSummaryImpl) obj;
@ -282,6 +258,27 @@ public class WorkbasketSummaryImpl implements WorkbasketSummary {
&& Objects.equals(orgLevel4, other.orgLevel4);
}
@Override
public int hashCode() {
return Objects.hash(
id,
key,
name,
description,
owner,
domain,
type,
custom1,
custom2,
custom3,
custom4,
orgLevel1,
orgLevel2,
orgLevel3,
orgLevel4,
markedForDeletion);
}
@Override
public String toString() {
return "WorkbasketSummaryImpl [id="

View File

@ -92,7 +92,7 @@ public class SampleDataGenerator {
try (Connection connection = dataSource.getConnection()) {
connection.setSchema(schema);
SqlRunner runner = new SqlRunner(connection);
String tableSafe = SQLReplacer.getSanitizedTableName(table);
String tableSafe = SqlReplacer.getSanitizedTableName(table);
String query = "SELECT 1 FROM " + tableSafe + " LIMIT 1;";
runner.run(query);
return true;
@ -105,7 +105,7 @@ public class SampleDataGenerator {
try (Connection connection = dataSource.getConnection()) {
String dbProductName = connection.getMetaData().getDatabaseProductName();
return scripts
.map(script -> SQLReplacer.getScriptAsSql(dbProductName, now, script))
.map(script -> SqlReplacer.getScriptAsSql(dbProductName, now, script))
.collect(Collectors.toList());
} catch (SQLException e) {
throw new RuntimeSqlException("Connection to database failed.", e);

View File

@ -11,20 +11,21 @@ import java.util.regex.Pattern;
import java.util.stream.Collectors;
/** This class replaces boolean values with int values if the database is db2. */
final class SQLReplacer {
final class SqlReplacer {
static final String RELATIVE_DATE_REGEX = "RELATIVE_DATE\\((-?\\d+)\\)";
static final Pattern RELATIVE_DATE_PATTERN = Pattern.compile(RELATIVE_DATE_REGEX);
static final DateTimeFormatter DATE_TIME_FORMATTER =
DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS");
private SQLReplacer() {}
private SqlReplacer() {
}
static String getScriptAsSql(String dbProductName, LocalDateTime now, String scriptPath) {
return parseAndReplace(getScriptBufferedStream(scriptPath), now, dbProductName);
}
static boolean isPostgreSQL(String databaseProductName) {
static boolean isPostgreSql(String databaseProductName) {
return "PostgreSQL".equals(databaseProductName);
}

View File

@ -21,7 +21,7 @@ class SampleDataProviderTest {
@Test
void getScriptsFileExists() {
SampleDataProvider.getDefaultScripts()
.map(SQLReplacer::getScriptBufferedStream)
.map(SqlReplacer::getScriptBufferedStream)
.forEach(Assertions::assertNotNull);
}
}

View File

@ -1,8 +1,8 @@
package pro.taskana.sampledata;
import static org.hamcrest.MatcherAssert.assertThat;
import static pro.taskana.sampledata.SQLReplacer.DATE_TIME_FORMATTER;
import static pro.taskana.sampledata.SQLReplacer.RELATIVE_DATE_PATTERN;
import static pro.taskana.sampledata.SqlReplacer.DATE_TIME_FORMATTER;
import static pro.taskana.sampledata.SqlReplacer.RELATIVE_DATE_PATTERN;
import java.time.LocalDateTime;
import java.util.regex.Matcher;
@ -11,13 +11,13 @@ import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
/** Test SampleDataGenerator. */
class SQLReplacerTest {
class SqlReplacerTest {
@Test
void replaceRelativeTimeFunctionSameDate() {
LocalDateTime now = LocalDateTime.now();
String dateFormatted = now.format(DATE_TIME_FORMATTER);
String sqlStringReplaced = SQLReplacer.replaceDatePlaceholder(now, "... RELATIVE_DATE(0) ...");
String sqlStringReplaced = SqlReplacer.replaceDatePlaceholder(now, "... RELATIVE_DATE(0) ...");
assertThat(sqlStringReplaced, CoreMatchers.containsString(dateFormatted));
}
@ -47,7 +47,7 @@ class SQLReplacerTest {
void replaceRelativeTimeFunctionPosDate() {
LocalDateTime now = LocalDateTime.now();
String dateFormatted = now.plusDays(5).format(DATE_TIME_FORMATTER);
String sqlStringReplaced = SQLReplacer.replaceDatePlaceholder(now, "... RELATIVE_DATE(5) ...");
String sqlStringReplaced = SqlReplacer.replaceDatePlaceholder(now, "... RELATIVE_DATE(5) ...");
assertThat(sqlStringReplaced, CoreMatchers.containsString(dateFormatted));
}
@ -56,7 +56,7 @@ class SQLReplacerTest {
LocalDateTime now = LocalDateTime.now();
String dateFormatted = now.plusDays(-10).format(DATE_TIME_FORMATTER);
String sqlStringReplaced =
SQLReplacer.replaceDatePlaceholder(now, "... RELATIVE_DATE(-10) ...");
SqlReplacer.replaceDatePlaceholder(now, "... RELATIVE_DATE(-10) ...");
assertThat(sqlStringReplaced, CoreMatchers.containsString(dateFormatted));
}
}

View File

@ -3,6 +3,7 @@ package pro.taskana.rest;
/** Collection of Url to Controller mappings. */
public final class Mapping {
private static final String PRE = "/api/v1/";
public static final String URL_ACCESSID = PRE + "access-ids";
public static final String URL_ACCESSID_GROUPS = URL_ACCESSID + "/groups";
public static final String URL_CLASSIFICATIONS = PRE + "classifications";
@ -39,7 +40,6 @@ public final class Mapping {
public static final String URL_WORKBASKET_DISTRIBUTION_ID =
URL_WORKBASKET + "/distribution-targets/{workbasketId}";
public static final String URL_WORKBASKETDEFIITIONS = PRE + "workbasket-definitions";
private static final String PRE = "/api/v1/";
private Mapping() {}
}