This repository has been archived by the owner on Dec 22, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[RELEASE] 'release-1.3' into 'master'
Conflicts: survey-model/pom.xml survey-model/src/main/java/org/ccem/otus/survey/template/enums/SurveyItemMapping.java
- Loading branch information
Showing
11 changed files
with
226 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
.../src/main/java/org/ccem/otus/survey/template/item/questions/grid/integer/GridInteger.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package org.ccem.otus.survey.template.item.questions.grid.integer; | ||
|
||
import org.ccem.otus.survey.template.item.SurveyItem; | ||
import org.ccem.otus.survey.template.item.label.Label; | ||
|
||
public class GridInteger extends SurveyItem { | ||
|
||
public Label label; | ||
public LayoutGridInteger layout; | ||
public Label unit; | ||
|
||
} |
10 changes: 10 additions & 0 deletions
10
.../main/java/org/ccem/otus/survey/template/item/questions/grid/integer/GridIntegerLine.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package org.ccem.otus.survey.template.item.questions.grid.integer; | ||
|
||
import java.util.List; | ||
|
||
public class GridIntegerLine { | ||
|
||
public String extents; | ||
public String objectType; | ||
public List<GridInteger> gridIntegerList; | ||
} |
10 changes: 10 additions & 0 deletions
10
...n/java/org/ccem/otus/survey/template/item/questions/grid/integer/GridIntegerQuestion.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package org.ccem.otus.survey.template.item.questions.grid.integer; | ||
|
||
import java.util.List; | ||
|
||
import org.ccem.otus.survey.template.item.questions.Question; | ||
|
||
public class GridIntegerQuestion extends Question { | ||
|
||
public List<GridIntegerLine> lines; | ||
} |
9 changes: 9 additions & 0 deletions
9
...ain/java/org/ccem/otus/survey/template/item/questions/grid/integer/LayoutGridInteger.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package org.ccem.otus.survey.template.item.questions.grid.integer; | ||
|
||
public class LayoutGridInteger { | ||
|
||
public String extents; | ||
public String objectType; | ||
public String width; | ||
|
||
} |
12 changes: 12 additions & 0 deletions
12
...-model/src/main/java/org/ccem/otus/survey/template/item/questions/grid/text/GridText.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package org.ccem.otus.survey.template.item.questions.grid.text; | ||
|
||
import org.ccem.otus.survey.template.item.SurveyItem; | ||
import org.ccem.otus.survey.template.item.label.Label; | ||
|
||
public class GridText extends SurveyItem { | ||
|
||
public Label label; | ||
public LayoutGridText layout; | ||
public Label unit; | ||
|
||
} |
12 changes: 12 additions & 0 deletions
12
...el/src/main/java/org/ccem/otus/survey/template/item/questions/grid/text/GridTextLine.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package org.ccem.otus.survey.template.item.questions.grid.text; | ||
|
||
import java.util.List; | ||
|
||
public class GridTextLine { | ||
|
||
public String extents; | ||
public String objectType; | ||
public List<GridText> gridTextList; | ||
|
||
} | ||
|
11 changes: 11 additions & 0 deletions
11
...rc/main/java/org/ccem/otus/survey/template/item/questions/grid/text/GridTextQuestion.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package org.ccem.otus.survey.template.item.questions.grid.text; | ||
|
||
import java.util.List; | ||
|
||
import org.ccem.otus.survey.template.item.questions.Question; | ||
|
||
public class GridTextQuestion extends Question { | ||
|
||
public List<GridTextLine> lines; | ||
} | ||
|
9 changes: 9 additions & 0 deletions
9
.../src/main/java/org/ccem/otus/survey/template/item/questions/grid/text/LayoutGridText.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package org.ccem.otus.survey.template.item.questions.grid.text; | ||
|
||
public class LayoutGridText { | ||
|
||
public String extents; | ||
public String objectType; | ||
public String width; | ||
|
||
} |
137 changes: 137 additions & 0 deletions
137
...del/src/test/java/org/ccem/otus/survey/template/template/enums/SurveyItemMappingTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
package org.ccem.otus.survey.template.template.enums; | ||
|
||
import org.ccem.otus.survey.template.enums.SurveyItemMapping; | ||
import org.ccem.otus.survey.template.item.miscellaneous.ImageItem; | ||
import org.ccem.otus.survey.template.item.miscellaneous.TextItem; | ||
import org.ccem.otus.survey.template.item.questions.*; | ||
import org.ccem.otus.survey.template.item.questions.grid.integer.GridIntegerQuestion; | ||
import org.ccem.otus.survey.template.item.questions.grid.text.GridTextQuestion; | ||
import org.ccem.otus.survey.template.item.questions.numeric.DecimalQuestion; | ||
import org.ccem.otus.survey.template.item.questions.numeric.IntegerQuestion; | ||
import org.ccem.otus.survey.template.item.questions.selectable.CheckboxQuestion; | ||
import org.ccem.otus.survey.template.item.questions.selectable.SingleSelectionQuestion; | ||
import org.junit.Test; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
public class SurveyItemMappingTest { | ||
public static final String CALENDAR_QUESTION = "CalendarQuestion"; | ||
public static final String INTEGER_QUESTION = "IntegerQuestion"; | ||
public static final String DECIMAL_QUESTION = "DecimalQuestion"; | ||
public static final String SINGLE_SELECTION_QUESTION = "SingleSelectionQuestion"; | ||
public static final String CHECKBOX_QUESTION = "CheckboxQuestion"; | ||
public static final String TEXT_QUESTION = "TextQuestion"; | ||
public static final String EMAIL_QUESTION = "EmailQuestion"; | ||
public static final String TIME_QUESTION = "TimeQuestion"; | ||
public static final String PHONE_QUESTION = "PhoneQuestion"; | ||
public static final String FILE_UPLOAD_QUESTION = "FileUploadQuestion"; | ||
public static final String GRID_TEXT_QUESTION = "GridTextQuestion"; | ||
public static final String GRID_INTEGER_QUESTION = "GridIntegerQuestion"; | ||
public static final String TEXT_ITEM = "TextItem"; | ||
public static final String IMAGE_ITEM = "ImageItem"; | ||
|
||
@Test | ||
public void method_getEnumByObjectType_should_return_calendar_question(){ | ||
SurveyItemMapping calendarQuestion = SurveyItemMapping.getEnumByObjectType(CALENDAR_QUESTION); | ||
assertEquals(calendarQuestion.getItemClass(), CalendarQuestion.class); | ||
assertEquals(calendarQuestion.getSurveyItemType(), CALENDAR_QUESTION); | ||
} | ||
|
||
@Test | ||
public void method_getEnumByObjectType_should_return_integer_question(){ | ||
SurveyItemMapping integerQuestion = SurveyItemMapping.getEnumByObjectType(INTEGER_QUESTION); | ||
assertEquals(integerQuestion.getItemClass(), IntegerQuestion.class); | ||
assertEquals(integerQuestion.getSurveyItemType(), INTEGER_QUESTION); | ||
} | ||
|
||
@Test | ||
public void method_getEnumByObjectType_should_return_decimal_question(){ | ||
SurveyItemMapping decimalQuestion = SurveyItemMapping.getEnumByObjectType(DECIMAL_QUESTION); | ||
assertEquals(decimalQuestion.getItemClass(), DecimalQuestion.class); | ||
assertEquals(decimalQuestion.getSurveyItemType(), DECIMAL_QUESTION); | ||
} | ||
|
||
@Test | ||
public void method_getEnumByObjectType_should_return_single_selection_question(){ | ||
SurveyItemMapping singleSelectionQuestion = SurveyItemMapping.getEnumByObjectType(SINGLE_SELECTION_QUESTION); | ||
assertEquals(singleSelectionQuestion.getItemClass(), SingleSelectionQuestion.class); | ||
assertEquals(singleSelectionQuestion.getSurveyItemType(), SINGLE_SELECTION_QUESTION); | ||
} | ||
|
||
@Test | ||
public void method_getEnumByObjectType_should_return_checkbox_question(){ | ||
SurveyItemMapping checkboxQuestion = SurveyItemMapping.getEnumByObjectType(CHECKBOX_QUESTION); | ||
assertEquals(checkboxQuestion.getItemClass(), CheckboxQuestion.class); | ||
assertEquals(checkboxQuestion.getSurveyItemType(), CHECKBOX_QUESTION); | ||
} | ||
|
||
@Test | ||
public void method_getEnumByObjectType_should_return_text_question(){ | ||
SurveyItemMapping textQuestion = SurveyItemMapping.getEnumByObjectType(TEXT_QUESTION); | ||
assertEquals(textQuestion.getItemClass(), TextQuestion.class); | ||
assertEquals(textQuestion.getSurveyItemType(), TEXT_QUESTION); | ||
} | ||
|
||
@Test | ||
public void method_getEnumByObjectType_should_return_email_question(){ | ||
SurveyItemMapping emailQuestion = SurveyItemMapping.getEnumByObjectType(EMAIL_QUESTION); | ||
assertEquals(emailQuestion.getItemClass(), EmailQuestion.class); | ||
assertEquals(emailQuestion.getSurveyItemType(), EMAIL_QUESTION); | ||
} | ||
|
||
@Test | ||
public void method_getEnumByObjectType_should_return_time_question(){ | ||
SurveyItemMapping timeQuestion = SurveyItemMapping.getEnumByObjectType(TIME_QUESTION); | ||
assertEquals(timeQuestion.getItemClass(), TimeQuestion.class); | ||
assertEquals(timeQuestion.getSurveyItemType(), TIME_QUESTION); | ||
} | ||
|
||
@Test | ||
public void method_getEnumByObjectType_should_return_phone_question(){ | ||
SurveyItemMapping phoneQuestion = SurveyItemMapping.getEnumByObjectType(PHONE_QUESTION); | ||
assertEquals(phoneQuestion.getItemClass(), PhoneQuestion.class); | ||
assertEquals(phoneQuestion.getSurveyItemType(), PHONE_QUESTION); | ||
} | ||
|
||
@Test | ||
public void method_getEnumByObjectType_should_return_autocomplete_question(){ | ||
SurveyItemMapping phoneQuestion = SurveyItemMapping.getEnumByObjectType(PHONE_QUESTION); | ||
assertEquals(phoneQuestion.getItemClass(), PhoneQuestion.class); | ||
assertEquals(phoneQuestion.getSurveyItemType(), PHONE_QUESTION); | ||
} | ||
|
||
@Test | ||
public void method_getEnumByObjectType_should_return_file_upload_question(){ | ||
SurveyItemMapping fileUploadQuestion = SurveyItemMapping.getEnumByObjectType(FILE_UPLOAD_QUESTION); | ||
assertEquals(fileUploadQuestion.getItemClass(), FileUploadQuestion.class); | ||
assertEquals(fileUploadQuestion.getSurveyItemType(), FILE_UPLOAD_QUESTION); | ||
} | ||
|
||
@Test | ||
public void method_getEnumByObjectType_should_return_grid_text_question(){ | ||
SurveyItemMapping gridTextQuestion = SurveyItemMapping.getEnumByObjectType(GRID_TEXT_QUESTION); | ||
assertEquals(gridTextQuestion.getItemClass(), GridTextQuestion.class); | ||
assertEquals(gridTextQuestion.getSurveyItemType(), GRID_TEXT_QUESTION); | ||
} | ||
|
||
@Test | ||
public void method_getEnumByObjectType_should_return_grid_integer_question(){ | ||
SurveyItemMapping gridIntegerQuestion = SurveyItemMapping.getEnumByObjectType(GRID_INTEGER_QUESTION); | ||
assertEquals(gridIntegerQuestion.getItemClass(), GridIntegerQuestion.class); | ||
assertEquals(gridIntegerQuestion.getSurveyItemType(), GRID_INTEGER_QUESTION); | ||
} | ||
|
||
@Test | ||
public void method_getEnumByObjectType_should_return_text_item(){ | ||
SurveyItemMapping textItem = SurveyItemMapping.getEnumByObjectType(TEXT_ITEM); | ||
assertEquals(textItem.getItemClass(), TextItem.class); | ||
assertEquals(textItem.getSurveyItemType(), TEXT_ITEM); | ||
} | ||
|
||
@Test | ||
public void method_getEnumByObjectType_should_return_image_item(){ | ||
SurveyItemMapping imageItem = SurveyItemMapping.getEnumByObjectType(IMAGE_ITEM); | ||
assertEquals(imageItem.getItemClass(), ImageItem.class); | ||
assertEquals(imageItem.getSurveyItemType(), IMAGE_ITEM); | ||
} | ||
} |