Commit fbbacc33 authored by Raimbek Egemberdiev's avatar Raimbek Egemberdiev

save

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