Commit 9debbcab authored by Raimbek Egemberdiev's avatar Raimbek Egemberdiev

компонент DateCmp исправлена ошибка NullPointerException

parent 4878c009
...@@ -47,6 +47,10 @@ public class DateConverter extends AbstractComponentConverter { ...@@ -47,6 +47,10 @@ public class DateConverter extends AbstractComponentConverter {
String cmpId = getCmpId(field, annotation, index); String cmpId = getCmpId(field, annotation, index);
AsFormData data = asfData.getData(cmpId); AsFormData data = asfData.getData(cmpId);
if (data == null) {
return;
}
String dateString; String dateString;
if (ComponentTypes.DATE.equals(data.getType()) || hasKeyValueAnnotation(field)) { if (ComponentTypes.DATE.equals(data.getType()) || hasKeyValueAnnotation(field)) {
dateString = data.getKey(); dateString = data.getKey();
......
...@@ -130,6 +130,13 @@ public class AsFormData extends AsFormDataContainer { ...@@ -130,6 +130,13 @@ public class AsFormData extends AsFormDataContainer {
return asFormData; return asFormData;
} }
public static AsFormData createDate(String cmpId, String value, String key) {
AsFormData asFormData = create(cmpId, ComponentTypes.DATE);
asFormData.setValue(value);
asFormData.setKey(key);
return asFormData;
}
public static AsFormData create(String id, String type) { public static AsFormData create(String id, String type) {
AsFormData asFormData = new AsFormData(); AsFormData asFormData = new AsFormData();
asFormData.setId(id); asFormData.setId(id);
......
...@@ -48,6 +48,7 @@ public class AsFormServiceTest { ...@@ -48,6 +48,7 @@ public class AsFormServiceTest {
asFormWrapper.addData(AsFormData.numericinput("numeric_input_key", expectedNumericInputValue, expectedNumericInputKey)); asFormWrapper.addData(AsFormData.numericinput("numeric_input_key", expectedNumericInputValue, expectedNumericInputKey));
asFormWrapper.addData(AsFormData.numericinput("numeric_input_value", expectedNumericInputValue, expectedNumericInputKey)); asFormWrapper.addData(AsFormData.numericinput("numeric_input_value", expectedNumericInputValue, expectedNumericInputKey));
asFormWrapper.addData(AsFormData.numericinput("file", expectedFileValue, expectedFileKey)); asFormWrapper.addData(AsFormData.numericinput("file", expectedFileValue, expectedFileKey));
asFormWrapper.addData(AsFormData.createDate("date", "2016-05-17 00:00:00", "2016-05-17 00:00:00"));
AsFormData tableData = new AsFormData(); AsFormData tableData = new AsFormData();
tableData.setType(ComponentTypes.TABLE); tableData.setType(ComponentTypes.TABLE);
......
...@@ -5,6 +5,7 @@ import kz.arta.synergy.api.asforms.pojo.AsForm; ...@@ -5,6 +5,7 @@ import kz.arta.synergy.api.asforms.pojo.AsForm;
import kz.arta.synergy.api.asforms.pojo.AsFormData; import kz.arta.synergy.api.asforms.pojo.AsFormData;
import kz.arta.synergy.api.asforms.pojo.ComponentTypes; import kz.arta.synergy.api.asforms.pojo.ComponentTypes;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
...@@ -32,6 +33,12 @@ public class TestForm extends AsForm { ...@@ -32,6 +33,12 @@ public class TestForm extends AsForm {
@TextBox("integer_input") @TextBox("integer_input")
private Integer integerValue; private Integer integerValue;
@DateCmp
private Date date;
@DateCmp
private Date nullDate;
public String getTextInput() { public String getTextInput() {
return textInput; return textInput;
} }
...@@ -90,4 +97,20 @@ public class TestForm extends AsForm { ...@@ -90,4 +97,20 @@ public class TestForm extends AsForm {
public void setTableData(List<TableCmp> tableData) { public void setTableData(List<TableCmp> tableData) {
this.tableData = tableData; this.tableData = tableData;
} }
public Date getDate() {
return date;
}
public void setDate(Date date) {
this.date = date;
}
public Date getNullDate() {
return nullDate;
}
public void setNullDate(Date nullDate) {
this.nullDate = nullDate;
}
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment