Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BATM-5515, BATM-5699: added DATE Custom Field, added quiz results #878

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# buildscript - project id
projectGroup=com.generalbytes.batm.public
projectVersion=1.2.4
projectVersion=1.3.1

# buildscript - common dependency versions
bitrafaelVersion=1.0.44
Expand Down
50 changes: 26 additions & 24 deletions gradle/verification-metadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@
</artifact>
</component>
<component group="com.fasterxml.jackson" name="jackson-base" version="2.12.0">
<artifact name="jackson-base-2.12.0.pom">
<sha256 value="145cf8abce581cec4993f90175ef2eb8edc465a5c2100b5a637ed7bbd1da53e5" origin="Generated by Gradle"/>
</artifact>
<artifact name="jackson-base-2.12.0.pom">
<sha256 value="145cf8abce581cec4993f90175ef2eb8edc465a5c2100b5a637ed7bbd1da53e5" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="com.fasterxml.jackson" name="jackson-bom" version="2.12.0">
<artifact name="jackson-bom-2.12.0.pom">
Expand Down Expand Up @@ -74,11 +74,6 @@
<sha256 value="35ba920affa5b6c330d5845fc8e59c851bf7e7968d55a4ea7cd44de79081d5cd" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="com.fasterxml.jackson.datatype" name="jackson-datatypes-collections" version="2.12.0">
<artifact name="jackson-datatypes-collections-2.12.0.pom">
<sha256 value="8b7775f572a36a27a56803545733f31f42f88e6e7411a8da3c7fda3d3d705c7e" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="com.fasterxml.jackson.datatype" name="jackson-datatype-guava" version="2.12.0">
<artifact name="jackson-datatype-guava-2.12.0.jar">
<sha256 value="484a53b30466d3eb2ac95de3e3fd1e6c060e1629f907140fa1aeadd153caee2b" origin="Generated by Gradle"/>
Expand All @@ -103,6 +98,11 @@
<sha256 value="0e86803f0aad2794010de92a995af8d1c4a43b002e56f5859fdb08dd6bfb7e4d" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="com.fasterxml.jackson.datatype" name="jackson-datatypes-collections" version="2.12.0">
<artifact name="jackson-datatypes-collections-2.12.0.pom">
<sha256 value="8b7775f572a36a27a56803545733f31f42f88e6e7411a8da3c7fda3d3d705c7e" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="com.fasterxml.jackson.jaxrs" name="jackson-jaxrs-base" version="2.12.0">
<artifact name="jackson-jaxrs-base-2.12.0.jar">
<sha256 value="9f524c13234447cf4ccb2708dfb8337fb6bacb918307047ca7aa9f226d6e8e5f" origin="Generated by Gradle"/>
Expand All @@ -111,11 +111,6 @@
<sha256 value="f46df1094708f5f3ce3d2f1262cc745f100d160ecc3b8051bf0f7f21ff2504dd" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="com.fasterxml.jackson.jaxrs" name="jackson-jaxrs-providers" version="2.12.0">
<artifact name="jackson-jaxrs-providers-2.12.0.pom">
<sha256 value="dea16d396006d10877bc35e2a0a09c5363b823e4128da357c6618569678f3fb2" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="com.fasterxml.jackson.jaxrs" name="jackson-jaxrs-json-provider" version="2.12.0">
<artifact name="jackson-jaxrs-json-provider-2.12.0.jar">
<sha256 value="7bcf0f909304403ff08f2373a0a1ebe0a80d4db5d0e702ed388074a3887d23e1" origin="Generated by Gradle"/>
Expand All @@ -124,15 +119,10 @@
<sha256 value="4b25e14c6bd710fccb87dab5c648966b2f1457feee3d26ce284fb8667095b605" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="com.fasterxml.jackson.module" name="jackson-modules-base" version="2.12.0">
<artifact name="jackson-modules-base-2.12.0.pom">
<sha256 value="5e3e8b4568b4d058e5d1f8e68eb0e190541a3d8a8537dfc45f1a7af40f91e057" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="com.fasterxml.jackson.module" name="jackson-modules-java8" version="2.12.0">
<artifact name="jackson-modules-java8-2.12.0.pom">
<sha256 value="f4473079941288f100f4ad38effadf34cb76229cc73728492c8b7bd2bc0b179e" origin="Generated by Gradle"/>
</artifact>
<component group="com.fasterxml.jackson.jaxrs" name="jackson-jaxrs-providers" version="2.12.0">
<artifact name="jackson-jaxrs-providers-2.12.0.pom">
<sha256 value="dea16d396006d10877bc35e2a0a09c5363b823e4128da357c6618569678f3fb2" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="com.fasterxml.jackson.module" name="jackson-module-jaxb-annotations" version="2.12.0">
<artifact name="jackson-module-jaxb-annotations-2.12.0.jar">
Expand All @@ -142,6 +132,16 @@
<sha256 value="89552c18387b668300555fec92f4d9adbffe3047b4b51ca706055598c427ba42" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="com.fasterxml.jackson.module" name="jackson-modules-base" version="2.12.0">
<artifact name="jackson-modules-base-2.12.0.pom">
<sha256 value="5e3e8b4568b4d058e5d1f8e68eb0e190541a3d8a8537dfc45f1a7af40f91e057" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="com.fasterxml.jackson.module" name="jackson-modules-java8" version="2.12.0">
<artifact name="jackson-modules-java8-2.12.0.pom">
<sha256 value="f4473079941288f100f4ad38effadf34cb76229cc73728492c8b7bd2bc0b179e" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="com.generalbytes.bitrafael.public" name="bitrafael-client" version="1.0.44">
<artifact name="bitrafael-client-1.0.44.jar">
<sha256 value="1449595b744ea24a32a15220d8abf8aa55249c1f45c27b311a2e031428842385" origin="Generated by Gradle"/>
Expand Down Expand Up @@ -1132,7 +1132,9 @@
</component>
<component group="net.java" name="jvnet-parent" version="1">
<artifact name="jvnet-parent-1.pom">
<sha256 value="281440811268e65d9e266b3cc898297e214e04f09740d0386ceeb4a8923d63bf" origin="Generated by Gradle"/>
<sha256 value="281440811268e65d9e266b3cc898297e214e04f09740d0386ceeb4a8923d63bf" origin="Generated by Gradle">
<also-trust value="5b936f6757872c1b901cb821001652eda746e3b6cffef9c434443534a96bfc9a"/>
</sha256>
</artifact>
</component>
<component group="net.java" name="jvnet-parent" version="3">
Expand Down Expand Up @@ -1655,7 +1657,7 @@
</component>
<component group="org.junit" name="junit-bom" version="5.7.1">
<artifact name="junit-bom-5.7.1.module">
<sha256 value="9854e3894d64b2485207e0046bca07b3d42d169e782f4fa8c9ce229a78faee04" origin="Generated by Gradle"/>
<sha256 value="9854e3894d64b2485207e0046bca07b3d42d169e782f4fa8c9ce229a78faee04" origin="Generated by Gradle"/>
</artifact>
<artifact name="junit-bom-5.7.1.pom">
<sha256 value="0b9b14a3d62106fafe8c68a717b87b87ad18685899451b753c04fa41b6857784" origin="Generated by Gradle"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@
************************************************************************************/
package com.generalbytes.batm.server.extensions;

import com.generalbytes.batm.server.extensions.quiz.QuizResult;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

public interface ITransactionRequest {

Expand Down Expand Up @@ -156,8 +159,11 @@ public interface ITransactionRequest {
*/
BigDecimal getDiscountQuotient();




/**
* Returns quiz results if any quiz has been activated.
*
* @return List of {@link QuizResult}. Can be null.
*/
List<QuizResult> getQuizResults();

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.generalbytes.batm.server.extensions.customfields.value.ChoiceCustomFieldValue;
import com.generalbytes.batm.server.extensions.customfields.value.CustomFieldValue;
import com.generalbytes.batm.server.extensions.customfields.value.FileCustomFieldValue;
import com.generalbytes.batm.server.extensions.customfields.value.LocalDateCustomFieldValue;
import com.generalbytes.batm.server.extensions.customfields.value.StringCustomFieldValue;

/**
Expand Down Expand Up @@ -39,7 +40,12 @@ public enum CustomFieldDefinitionType {
/**
* Document scan or other file
*/
DOCUMENT(FileCustomFieldValue.class);
DOCUMENT(FileCustomFieldValue.class),
/**
* A date value.
* Presented as date picker.
*/
DATE(LocalDateCustomFieldValue.class);

private final Class<? extends CustomFieldValue> allowedValueType;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.generalbytes.batm.server.extensions.customfields.value;

import com.generalbytes.batm.server.extensions.customfields.CustomFieldDefinitionType;

import java.time.LocalDate;

/**
* used with {@link CustomFieldDefinitionType#DATE}
*/
public class LocalDateCustomFieldValue implements CustomFieldValue {
private final LocalDate localDateValue;

public LocalDateCustomFieldValue(LocalDate localDateValue) {
this.localDateValue = localDateValue;
}

public LocalDate getLocalDateValue() {
return localDateValue;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*************************************************************************************
* Copyright (C) 2014-2023 GENERAL BYTES s.r.o. All rights reserved.
*
* This software may be distributed and modified under the terms of the GNU
* General Public License version 2 (GPL2) as published by the Free Software
* Foundation and appearing in the file GPL2.TXT included in the packaging of
* this file. Please note that GPL2 Section 2[b] requires that all works based
* on this software must also be made publicly available under the terms of
* the GPL2 ("Copyleft").
*
* Contact information
* -------------------
*
* GENERAL BYTES s.r.o.
* Web : http://www.generalbytes.com
*
************************************************************************************/
package com.generalbytes.batm.server.extensions.quiz;

/**
* An object representing the question and answer data in the {@link QuizResult}.
*/
public class QuestionAnswer {

private String question;

private String answer;

public QuestionAnswer() {

}

public QuestionAnswer(String question, String answer) {
this.question = question;
this.answer = answer;
}

public String getQuestion() {
return question;
}

public void setQuestion(String question) {
this.question = question;
}

public String getAnswer() {
return answer;
}

public void setAnswer(String answer) {
this.answer = answer;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*************************************************************************************
* Copyright (C) 2014-2023 GENERAL BYTES s.r.o. All rights reserved.
*
* This software may be distributed and modified under the terms of the GNU
* General Public License version 2 (GPL2) as published by the Free Software
* Foundation and appearing in the file GPL2.TXT included in the packaging of
* this file. Please note that GPL2 Section 2[b] requires that all works based
* on this software must also be made publicly available under the terms of
* the GPL2 ("Copyleft").
*
* Contact information
* -------------------
*
* GENERAL BYTES s.r.o.
* Web : http://www.generalbytes.com
*
************************************************************************************/
package com.generalbytes.batm.server.extensions.quiz;

import java.util.List;

/**
* An object representing data about quiz result.
*/
public class QuizResult {

private String quizName;

private List<QuestionAnswer> answers;

public QuizResult() {

}

public QuizResult(String quizName, List<QuestionAnswer> answers) {
this.quizName = quizName;
this.answers = answers;
}

public String getQuizName() {
return quizName;
}

public void setQuizName(String quizName) {
this.quizName = quizName;
}

public List<QuestionAnswer> getAnswers() {
return answers;
}

public void setAnswers(List<QuestionAnswer> answers) {
this.answers = answers;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ public void isValueTypeAllowed() {
assertFalse(CustomFieldDefinitionType.CHECKBOX.isValueTypeAllowed(str.getClass()));
assertFalse(CustomFieldDefinitionType.IMAGE.isValueTypeAllowed(str.getClass()));
assertFalse(CustomFieldDefinitionType.DOCUMENT.isValueTypeAllowed(str.getClass()));
assertFalse(CustomFieldDefinitionType.DATE.isValueTypeAllowed(str.getClass()));
}
}