Commit 3db1986a authored by Raimbek Egemberdiev's avatar Raimbek Egemberdiev

new types and services

parent f6d27a3b
...@@ -40,4 +40,14 @@ public class JsonUtils { ...@@ -40,4 +40,14 @@ public class JsonUtils {
public static String getValueByKey(String jsonData, String key) throws IOException { public static String getValueByKey(String jsonData, String key) throws IOException {
return MAPPER.readTree(jsonData).path(key).getTextValue(); return MAPPER.readTree(jsonData).path(key).getTextValue();
} }
public static String getValueByPath(String jsonData, String path) throws IOException {
String[] pathArray = path.split("\\.");
JsonNode jsonNode = MAPPER.readTree(jsonData);
for (String pathItem : pathArray) {
jsonNode = jsonNode.path(pathItem);
}
return jsonNode.getTextValue();
}
} }
...@@ -172,4 +172,12 @@ public class AsFormService { ...@@ -172,4 +172,12 @@ public class AsFormService {
String result = restHttpQuery.doQuery(query); String result = restHttpQuery.doQuery(query);
return JsonUtils.read(result, AsFormDefinition.class); return JsonUtils.read(result, AsFormDefinition.class);
} }
public String getDocumentIdByDataUuid(String dataUuid) throws IOException {
Query query = Query.newInstance()
.url("/rest/api/asforms/data/document")
.queryParam("dataUUID", dataUuid);
String result = restHttpQuery.doQuery(query);
return JsonUtils.getValueByPath(result, dataUuid + ".documentID");
}
} }
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