◆ createJsonItem()
JsonObjectBuilder org.turro.elephant.direct.AbstractDirectQuery.createJsonItem |
( |
String |
itemElement, |
|
|
Object |
item |
|
) |
| |
|
protected |
Definition at line 92 of file AbstractDirectQuery.java.
93 if(item instanceof String) {
94 return Json.createObjectBuilder().add(itemElement, (String) item);
95 }
else if(item instanceof Double) {
96 return Json.createObjectBuilder().add(itemElement, (Double) item);
97 }
else if(item instanceof Integer) {
98 return Json.createObjectBuilder().add(itemElement, (Integer) item);
99 }
else if(item instanceof Boolean) {
100 return Json.createObjectBuilder().add(itemElement, (Boolean) item);
102 return Json.createObjectBuilder().add(itemElement, item.toString());
◆ createQueryURL()
String org.turro.elephant.direct.AbstractDirectQuery.createQueryURL |
( |
String |
values | ) |
|
Definition at line 42 of file AbstractDirectQuery.java.
43 return ElephantContext.getRootWebPath() +
45 "?" + Actions.createRightNowAction(
"ds=true;" + values) +
"&q={query}";
abstract String getIdentifier()
◆ doSearch()
abstract List org.turro.elephant.direct.AbstractDirectQuery.doSearch |
( |
KeyValueMap |
map, |
|
|
String |
query |
|
) |
| |
|
abstractprotected |
◆ execute() [1/2]
void org.turro.elephant.direct.AbstractDirectQuery.execute |
( |
IConstructor |
constructor | ) |
|
Definition at line 65 of file AbstractDirectQuery.java.
66 KeyValueMap map = Actions.isRightNowAction(constructor) ?
67 Actions.getRightNowAction(constructor) :
68 Actions.getAction(constructor);
69 if(map !=
null &&
"true".equals(map.get(
"ds"))) {
70 if(map.containsKey(
"sroot") && map.containsKey(
"sitem")) {
74 doSearch(map, constructor.getParameter(
"q"));
String generateJson(String rootElement, String itemElement, List results)
void writeJsonResponse(HttpServletResponse response, String json)
abstract List doSearch(KeyValueMap map, String query)
◆ execute() [2/2]
void org.turro.elephant.direct.AbstractDirectQuery.execute |
( |
ServletContext |
context, |
|
|
HttpServletRequest |
request, |
|
|
HttpServletResponse |
response |
|
) |
| |
◆ generateJson()
String org.turro.elephant.direct.AbstractDirectQuery.generateJson |
( |
String |
rootElement, |
|
|
String |
itemElement, |
|
|
List |
results |
|
) |
| |
|
protected |
Definition at line 84 of file AbstractDirectQuery.java.
85 JsonObjectBuilder builder = Json.createObjectBuilder();
86 JsonArrayBuilder array = Json.createArrayBuilder();
88 builder.add(rootElement, array);
89 return builder.build().toString();
JsonObjectBuilder createJsonItem(String itemElement, Object item)
◆ getIdentifier()
abstract String org.turro.elephant.direct.AbstractDirectQuery.getIdentifier |
( |
| ) |
|
|
abstractprotected |
◆ itsMe()
boolean org.turro.elephant.direct.AbstractDirectQuery.itsMe |
( |
String |
id | ) |
|
◆ myTurn()
boolean org.turro.elephant.direct.AbstractDirectQuery.myTurn |
( |
HttpServletRequest |
request | ) |
|
◆ writeJsonResponse()
void org.turro.elephant.direct.AbstractDirectQuery.writeJsonResponse |
( |
HttpServletResponse |
response, |
|
|
String |
json |
|
) |
| |
|
protected |
Definition at line 106 of file AbstractDirectQuery.java.
108 response.setContentType(
"application/json");
110 response.getWriter().write(json);
111 }
catch (IOException ex) {
112 Logger.getLogger(AbstractDirectQuery.class.getName()).log(Level.SEVERE,
null, ex);
The documentation for this class was generated from the following file: