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

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

parent 4878c009
......@@ -47,6 +47,10 @@ public class DateConverter extends AbstractComponentConverter {
String cmpId = getCmpId(field, annotation, index);
AsFormData data = asfData.getData(cmpId);
if (data == null) {
return;
}
String dateString;
if (ComponentTypes.DATE.equals(data.getType()) || hasKeyValueAnnotation(field)) {
dateString = data.getKey();
......
......@@ -130,6 +130,13 @@ public class AsFormData extends AsFormDataContainer {
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) {
AsFormData asFormData = new AsFormData();
asFormData.setId(id);
......
......@@ -48,6 +48,7 @@ public class AsFormServiceTest {
asFormWrapper.addData(AsFormData.numericinput("numeric_input_key", expectedNumericInputValue, expectedNumericInputKey));
asFormWrapper.addData(AsFormData.numericinput("numeric_input_value", expectedNumericInputValue, expectedNumericInputKey));
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();
tableData.setType(ComponentTypes.TABLE);
......
......@@ -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.ComponentTypes;
import java.util.Date;
import java.util.List;
/**
......@@ -32,6 +33,12 @@ public class TestForm extends AsForm {
@TextBox("integer_input")
private Integer integerValue;
@DateCmp
private Date date;
@DateCmp
private Date nullDate;
public String getTextInput() {
return textInput;
}
......@@ -90,4 +97,20 @@ public class TestForm extends AsForm {
public void setTableData(List<TableCmp> 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