Commit 76095495 authored by Raimbek Egemberdiev's avatar Raimbek Egemberdiev

new types and services

parent 3db1986a
package kz.arta.synergy.api.pojo;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import org.codehaus.jackson.annotate.JsonProperty;
/**
* @author raimbek
* @since 30.01.2017
*/
@JsonIgnoreProperties(ignoreUnknown = true)
public class PersonalRecordForm {
@JsonProperty("form-uuid")
private String formUUID;
private String formCode;
private String name;
private String editable;
@JsonProperty("data-uuid")
private String dataUuid;
private String mandatory;
public String getFormUUID() {
return formUUID;
}
public void setFormUUID(String formUUID) {
this.formUUID = formUUID;
}
public String getFormCode() {
return formCode;
}
public void setFormCode(String formCode) {
this.formCode = formCode;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getEditable() {
return editable;
}
public void setEditable(String editable) {
this.editable = editable;
}
public String getDataUuid() {
return dataUuid;
}
public void setDataUuid(String dataUuid) {
this.dataUuid = dataUuid;
}
public String getMandatory() {
return mandatory;
}
public void setMandatory(String mandatory) {
this.mandatory = mandatory;
}
}
package kz.arta.synergy.api.services;
import kz.arta.synergy.api.JsonUtils;
import kz.arta.synergy.api.Query;
import kz.arta.synergy.api.QueryContext;
import kz.arta.synergy.api.RestHttpQuery;
import kz.arta.synergy.api.pojo.PersonalRecordForm;
import kz.arta.synergy.api.pojo.SynergyUser;
import org.codehaus.jackson.type.TypeReference;
import java.io.IOException;
import java.util.List;
/**
* @author raimbek
* @since 14.11.2016
*/
public class PersonalRecordService {
private final RestHttpQuery restHttpQuery;
private PersonalRecordService(QueryContext context) {
this.restHttpQuery = new RestHttpQuery(context);
}
public static PersonalRecordService newInstance(QueryContext queryContext) {
return new PersonalRecordService(queryContext);
}
public List<PersonalRecordForm> getForms(String userId) throws IOException {
Query query = Query.newInstance().url("/rest/api/personalrecord/forms/" + userId);
String result = restHttpQuery.doQuery(query);
return JsonUtils.read(result, new TypeReference<List<PersonalRecordForm>>() {});
}
}
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