Commit fbbacc33 authored by Raimbek Egemberdiev's avatar Raimbek Egemberdiev

save

parent 81f08031
...@@ -17,4 +17,5 @@ dependencies { ...@@ -17,4 +17,5 @@ dependencies {
compile group: 'com.google.guava', name: 'guava', version: '19.0' compile group: 'com.google.guava', name: 'guava', version: '19.0'
compile(group: 'org.codehaus.jackson', name: 'jackson-core-asl', version: jacksonVersion, transitive: false) compile(group: 'org.codehaus.jackson', name: 'jackson-core-asl', version: jacksonVersion, transitive: false)
compile(group: 'org.codehaus.jackson', name: 'jackson-mapper-asl', version: jacksonVersion, transitive: false) compile(group: 'org.codehaus.jackson', name: 'jackson-mapper-asl', version: jacksonVersion, transitive: false)
compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.8.4'
} }
...@@ -47,7 +47,8 @@ public class RestHttpQuery { ...@@ -47,7 +47,8 @@ public class RestHttpQuery {
DataOutputStream request = new DataOutputStream(conn.getOutputStream()); DataOutputStream request = new DataOutputStream(conn.getOutputStream());
if (!query.getFormParams().isEmpty()) { if (!query.getFormParams().isEmpty()) {
request.write(joinParamsForQuery(query.getFormParams()).getBytes("UTF-8")); String params = joinParamsForQuery(query.getFormParams());
request.write(params.getBytes("UTF-8"));
} else if (!Strings.isNullOrEmpty(query.getBody())) { } else if (!Strings.isNullOrEmpty(query.getBody())) {
request.write(query.getBody().getBytes("UTF-8")); request.write(query.getBody().getBytes("UTF-8"));
} }
......
...@@ -66,7 +66,7 @@ public class AsFormProvider { ...@@ -66,7 +66,7 @@ public class AsFormProvider {
.url("/rest/api/asforms/data/save") .url("/rest/api/asforms/data/save")
.formParam("formUUID", asForm.getForm()) .formParam("formUUID", asForm.getForm())
.formParam("uuid", asForm.getUuid()) .formParam("uuid", asForm.getUuid())
.formParam("data=\"data\":", JsonUtils.toJson(asFormWrapper)); .formParam("data", "\"data\":" + JsonUtils.toJson(asFormWrapper.getData()));
return restHttpQuery.doQuery(query); return restHttpQuery.doQuery(query);
} }
...@@ -88,8 +88,8 @@ public class AsFormProvider { ...@@ -88,8 +88,8 @@ public class AsFormProvider {
for (Field field : allFields) { for (Field field : allFields) {
Annotation[] declaredAnnotations = field.getDeclaredAnnotations(); Annotation[] declaredAnnotations = field.getDeclaredAnnotations();
for (Annotation annotation : declaredAnnotations) { for (Annotation annotation : declaredAnnotations) {
if (annotation instanceof TextInput) { if (annotation instanceof TextBox) {
String cmpId = ((TextInput) annotation).value(); String cmpId = ((TextBox) annotation).value();
dataContainer.addData(toAsfData(asForm, field, cmpId, index, ComponentTypes.TEXT_BOX)); dataContainer.addData(toAsfData(asForm, field, cmpId, index, ComponentTypes.TEXT_BOX));
break; break;
} }
...@@ -135,6 +135,8 @@ public class AsFormProvider { ...@@ -135,6 +135,8 @@ public class AsFormProvider {
} }
private <T> AsFormData toAsfData(T asForm, Field field, String cmpId, String index, String type) throws IllegalAccessException { private <T> AsFormData toAsfData(T asForm, Field field, String cmpId, String index, String type) throws IllegalAccessException {
field.setAccessible(true);
if (index != null) { if (index != null) {
cmpId = cmpId + "-b" + index; cmpId = cmpId + "-b" + index;
} }
...@@ -146,7 +148,7 @@ public class AsFormProvider { ...@@ -146,7 +148,7 @@ public class AsFormProvider {
asFormData.setData(tableData.getData()); asFormData.setData(tableData.getData());
} }
} }
field.setAccessible(true);
Object valueObject = field.get(asForm); Object valueObject = field.get(asForm);
if (valueObject instanceof AsFormData) { if (valueObject instanceof AsFormData) {
AsFormData asFormDataObject = (AsFormData) valueObject; AsFormData asFormDataObject = (AsFormData) valueObject;
...@@ -186,8 +188,8 @@ public class AsFormProvider { ...@@ -186,8 +188,8 @@ public class AsFormProvider {
for (Field field : allFields) { for (Field field : allFields) {
Annotation[] declaredAnnotations = field.getDeclaredAnnotations(); Annotation[] declaredAnnotations = field.getDeclaredAnnotations();
for (Annotation annotation : declaredAnnotations) { for (Annotation annotation : declaredAnnotations) {
if (annotation instanceof TextInput) { if (annotation instanceof TextBox) {
String cmpId = ((TextInput) annotation).value(); String cmpId = ((TextBox) annotation).value();
setFieldValue(asfData, asFormObject, field, cmpId, index, ComponentTypes.TEXT_BOX); setFieldValue(asfData, asFormObject, field, cmpId, index, ComponentTypes.TEXT_BOX);
break; break;
} }
......
...@@ -11,7 +11,7 @@ import java.lang.annotation.Target; ...@@ -11,7 +11,7 @@ import java.lang.annotation.Target;
*/ */
@Target(ElementType.FIELD) @Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
public @interface TextInput { public @interface TextBox {
String value(); String value();
......
package kz.arta.synergy.api.asforms.pojo; package kz.arta.synergy.api.asforms.pojo;
import com.fasterxml.jackson.annotation.JsonInclude;
import org.codehaus.jackson.annotate.JsonIgnoreProperties; import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -11,6 +12,7 @@ import java.util.List; ...@@ -11,6 +12,7 @@ import java.util.List;
* @since 02.11.2016 * @since 02.11.2016
*/ */
@JsonIgnoreProperties(ignoreUnknown = true) @JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class AdvancedSearchParams { public class AdvancedSearchParams {
private String query; private String query;
private List<String> parameters = new ArrayList<String>(); private List<String> parameters = new ArrayList<String>();
......
package kz.arta.synergy.api.asforms.pojo; package kz.arta.synergy.api.asforms.pojo;
import com.fasterxml.jackson.annotation.JsonInclude;
import org.codehaus.jackson.annotate.JsonIgnoreProperties; import org.codehaus.jackson.annotate.JsonIgnoreProperties;
/** /**
...@@ -7,6 +8,7 @@ import org.codehaus.jackson.annotate.JsonIgnoreProperties; ...@@ -7,6 +8,7 @@ import org.codehaus.jackson.annotate.JsonIgnoreProperties;
* @since 02.11.2016 * @since 02.11.2016
*/ */
@JsonIgnoreProperties(ignoreUnknown = true) @JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class AdvancedSearchResult { public class AdvancedSearchResult {
private String dataUUID; private String dataUUID;
private String documentID; private String documentID;
......
package kz.arta.synergy.api.asforms.pojo; package kz.arta.synergy.api.asforms.pojo;
import com.fasterxml.jackson.annotation.JsonInclude;
import org.codehaus.jackson.annotate.JsonIgnoreProperties; import org.codehaus.jackson.annotate.JsonIgnoreProperties;
/** /**
...@@ -7,6 +8,7 @@ import org.codehaus.jackson.annotate.JsonIgnoreProperties; ...@@ -7,6 +8,7 @@ import org.codehaus.jackson.annotate.JsonIgnoreProperties;
* @since 09.11.2016 * @since 09.11.2016
*/ */
@JsonIgnoreProperties(ignoreUnknown = true) @JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class AsForm { public class AsForm {
private String nodeUUID; private String nodeUUID;
......
package kz.arta.synergy.api.asforms.pojo; package kz.arta.synergy.api.asforms.pojo;
import com.fasterxml.jackson.annotation.JsonInclude;
import org.codehaus.jackson.annotate.JsonIgnoreProperties; import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import java.util.List; import java.util.List;
...@@ -9,6 +10,7 @@ import java.util.List; ...@@ -9,6 +10,7 @@ import java.util.List;
* @since 09.11.2016 * @since 09.11.2016
*/ */
@JsonIgnoreProperties(ignoreUnknown = true) @JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class AsFormData extends AsFormDataContainer { public class AsFormData extends AsFormDataContainer {
private String id; private String id;
private String type; private String type;
......
package kz.arta.synergy.api.asforms.pojo; package kz.arta.synergy.api.asforms.pojo;
import com.fasterxml.jackson.annotation.JsonInclude;
import org.codehaus.jackson.annotate.JsonIgnoreProperties; import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -10,6 +11,7 @@ import java.util.List; ...@@ -10,6 +11,7 @@ import java.util.List;
* @since 10.11.2016 * @since 10.11.2016
*/ */
@JsonIgnoreProperties(ignoreUnknown = true) @JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class AsFormDataContainer { public class AsFormDataContainer {
private List<AsFormData> data; private List<AsFormData> data;
......
package kz.arta.synergy.api.asforms.pojo; package kz.arta.synergy.api.asforms.pojo;
import com.fasterxml.jackson.annotation.JsonInclude;
import org.codehaus.jackson.annotate.JsonIgnoreProperties; import org.codehaus.jackson.annotate.JsonIgnoreProperties;
/** /**
...@@ -7,6 +8,7 @@ import org.codehaus.jackson.annotate.JsonIgnoreProperties; ...@@ -7,6 +8,7 @@ import org.codehaus.jackson.annotate.JsonIgnoreProperties;
* @since 09.11.2016 * @since 09.11.2016
*/ */
@JsonIgnoreProperties(ignoreUnknown = true) @JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class AsFormWrapper extends AsFormDataContainer { public class AsFormWrapper extends AsFormDataContainer {
private String nodeUUID; private String nodeUUID;
private String uuid; private String uuid;
......
...@@ -2,7 +2,7 @@ package kz.arta.synergy.pojo; ...@@ -2,7 +2,7 @@ package kz.arta.synergy.pojo;
import kz.arta.synergy.api.asforms.annotations.KeyValue; import kz.arta.synergy.api.asforms.annotations.KeyValue;
import kz.arta.synergy.api.asforms.annotations.NumericInput; import kz.arta.synergy.api.asforms.annotations.NumericInput;
import kz.arta.synergy.api.asforms.annotations.TextInput; import kz.arta.synergy.api.asforms.annotations.TextBox;
/** /**
* @author raimbek * @author raimbek
...@@ -10,7 +10,7 @@ import kz.arta.synergy.api.asforms.annotations.TextInput; ...@@ -10,7 +10,7 @@ import kz.arta.synergy.api.asforms.annotations.TextInput;
*/ */
public class TableCmp { public class TableCmp {
@TextInput("table_input") @TextBox("table_input")
private String tableInput; private String tableInput;
@KeyValue @KeyValue
......
...@@ -13,7 +13,7 @@ import java.util.List; ...@@ -13,7 +13,7 @@ import java.util.List;
*/ */
public class TestForm extends AsForm { public class TestForm extends AsForm {
@TextInput("text_input") @TextBox("text_input")
private String textInput; private String textInput;
@KeyValue @KeyValue
...@@ -26,10 +26,10 @@ public class TestForm extends AsForm { ...@@ -26,10 +26,10 @@ public class TestForm extends AsForm {
@Cmp(id = "file", type = ComponentTypes.FILE) @Cmp(id = "file", type = ComponentTypes.FILE)
private AsFormData file; private AsFormData file;
@TextInput("double_input") @TextBox("double_input")
private Double doubleValue; private Double doubleValue;
@TextInput("integer_input") @TextBox("integer_input")
private Integer integerValue; private Integer integerValue;
public String getTextInput() { public String getTextInput() {
......
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