use of com.twinsoft.convertigo.beans.core.Document in project convertigo by convertigo.
the class MobilePickerContentProvider method addFsObjects.
private void addFsObjects(Map<String, Set<String>> map, TVObject tvd, Object object, boolean isReferenced) {
if (object != null) {
if (object instanceof Project) {
Project project = (Project) object;
for (Connector c : project.getConnectorsList()) {
if (c instanceof FullSyncConnector) {
String label = isReferenced ? c.getQName() : c.getName();
TVObject tvc = tvd.add(new TVObject(label));
for (Document d : c.getDocumentsList()) {
if (d instanceof DesignDocument) {
TVObject tdd = tvc.add(new TVObject(d.getName()));
JSONObject views = CouchKey.views.JSONObject(((DesignDocument) d).getJSONObject());
if (views != null) {
for (Iterator<String> it = GenericUtils.cast(views.keys()); it.hasNext(); ) {
try {
Set<String> infos = null;
String view = it.next();
String key = c.getQName() + "." + d.getName() + "." + view;
TVObject tvv = tdd.add(new TVObject(view));
SourceData sd = null;
try {
sd = Filter.Database.toSourceData(new JSONObject().put("connector", c.getQName()).put("document", d.getQName()).put("queryview", view).put("verb", "get"));
} catch (JSONException e) {
e.printStackTrace();
}
tvv.add(new TVObject("get", d, sd));
infos = map.get(key + ".get");
if (infos == null) {
infos = map.get(c.getQName() + ".get");
}
if (infos != null) {
for (String info : infos) {
try {
JSONObject jsonInfo = new JSONObject(info);
boolean includeDocs = false;
if (jsonInfo.has("include_docs")) {
includeDocs = Boolean.valueOf(jsonInfo.getString("include_docs")).booleanValue();
}
if (jsonInfo.has("marker")) {
String marker = jsonInfo.getString("marker");
if (!marker.isEmpty()) {
String name = "get" + "#" + marker;
sd = Filter.Database.toSourceData(new JSONObject().put("connector", c.getQName()).put("document", d.getQName()).put("queryview", view).put("verb", "get").put("marker", marker).put("includeDocs", includeDocs));
tvv.add(new TVObject(name, d, sd, jsonInfo));
}
}
} catch (JSONException e) {
e.printStackTrace();
}
}
}
try {
sd = Filter.Database.toSourceData(new JSONObject().put("connector", c.getQName()).put("document", d.getQName()).put("queryview", view).put("verb", "view"));
} catch (JSONException e) {
e.printStackTrace();
}
tvv.add(new TVObject("view", d, sd));
infos = map.get(key + ".view");
if (infos != null) {
for (String info : infos) {
try {
JSONObject jsonInfo = new JSONObject(info);
boolean includeDocs = false;
if (jsonInfo.has("include_docs")) {
includeDocs = Boolean.valueOf(jsonInfo.getString("include_docs")).booleanValue();
}
if (jsonInfo.has("marker")) {
String marker = jsonInfo.getString("marker");
if (!marker.isEmpty()) {
String name = "view" + "#" + marker;
sd = Filter.Database.toSourceData(new JSONObject().put("connector", c.getQName()).put("document", d.getQName()).put("queryview", view).put("verb", "view").put("marker", marker).put("includeDocs", includeDocs));
tvv.add(new TVObject(name, d, sd, jsonInfo));
}
}
} catch (JSONException e) {
e.printStackTrace();
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
}
}
}
}
}
}
use of com.twinsoft.convertigo.beans.core.Document in project convertigo by convertigo.
the class NgxPickerContentProvider method addFsObjects.
private void addFsObjects(Map<String, Set<String>> map, TVObject tvd, Object object, boolean isReferenced) {
if (object != null) {
if (object instanceof Project) {
Project project = (Project) object;
for (Connector c : project.getConnectorsList()) {
if (c instanceof FullSyncConnector) {
String label = isReferenced ? c.getQName() : c.getName();
TVObject tvc = tvd.add(new TVObject(label));
for (Document d : c.getDocumentsList()) {
if (d instanceof DesignDocument) {
TVObject tdd = tvc.add(new TVObject(d.getName()));
JSONObject views = CouchKey.views.JSONObject(((DesignDocument) d).getJSONObject());
if (views != null) {
for (Iterator<String> it = GenericUtils.cast(views.keys()); it.hasNext(); ) {
try {
Set<String> infos = null;
String view = it.next();
String key = c.getQName() + "." + d.getName() + "." + view;
TVObject tvv = tdd.add(new TVObject(view));
SourceData sd = null;
try {
sd = Filter.Database.toSourceData(new JSONObject().put("connector", c.getQName()).put("document", d.getQName()).put("queryview", view).put("verb", "get"));
} catch (JSONException e) {
e.printStackTrace();
}
tvv.add(new TVObject("get", d, sd));
infos = map.get(key + ".get");
if (infos == null) {
infos = map.get(c.getQName() + ".get");
}
if (infos != null) {
for (String info : infos) {
try {
JSONObject jsonInfo = new JSONObject(info);
boolean includeDocs = false;
if (jsonInfo.has("include_docs")) {
includeDocs = Boolean.valueOf(jsonInfo.getString("include_docs")).booleanValue();
}
if (jsonInfo.has("marker")) {
String marker = jsonInfo.getString("marker");
if (!marker.isEmpty()) {
String name = "get" + "#" + marker;
sd = Filter.Database.toSourceData(new JSONObject().put("connector", c.getQName()).put("document", d.getQName()).put("queryview", view).put("verb", "get").put("marker", marker).put("includeDocs", includeDocs));
tvv.add(new TVObject(name, d, sd, jsonInfo));
}
}
} catch (JSONException e) {
e.printStackTrace();
}
}
}
try {
sd = Filter.Database.toSourceData(new JSONObject().put("connector", c.getQName()).put("document", d.getQName()).put("queryview", view).put("verb", "view"));
} catch (JSONException e) {
e.printStackTrace();
}
tvv.add(new TVObject("view", d, sd));
infos = map.get(key + ".view");
if (infos != null) {
for (String info : infos) {
try {
JSONObject jsonInfo = new JSONObject(info);
boolean includeDocs = false;
if (jsonInfo.has("include_docs")) {
includeDocs = Boolean.valueOf(jsonInfo.getString("include_docs")).booleanValue();
}
if (jsonInfo.has("marker")) {
String marker = jsonInfo.getString("marker");
if (!marker.isEmpty()) {
String name = "view" + "#" + marker;
sd = Filter.Database.toSourceData(new JSONObject().put("connector", c.getQName()).put("document", d.getQName()).put("queryview", view).put("verb", "view").put("marker", marker).put("includeDocs", includeDocs));
tvv.add(new TVObject(name, d, sd, jsonInfo));
}
}
} catch (JSONException e) {
e.printStackTrace();
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
}
}
}
}
}
}
Aggregations