/** * @return the template's title, or its name if it has no title. */ @Override public String getTitle() { String title = super.getTitle(); if (title == null || "".equals(title)) { return getName(); } return title; }
/** * @return the template's title, or its name if it has no title. */ @Override public String getTitle() { String title = super.getTitle(); if (title == null || "".equals(title)) { return getName(); } return title; }
/** @return the attributes that should go in the head of a JSON object. **/ protected Map<String, Object> getHeadAttributes() { Map<String, Object> ret = new LinkedHashMap<String, Object>(); ret.put("title", getTitle()); ret.put("description", getDescription()); ret.put("select", getView()); // LOGIC - only if there is some. Just logic = A is dumb. String constraintLogic = getConstraintLogic(); if (constraintLogic != null && constraintLogic.length() > 1) { ret.put("constraintLogic", constraintLogic); } return ret; }
/** @return the attributes that should go in the head of a JSON object. **/ protected Map<String, Object> getHeadAttributes() { Map<String, Object> ret = new LinkedHashMap<String, Object>(); ret.put("title", getTitle()); ret.put("description", getDescription()); ret.put("select", getView()); // LOGIC - only if there is some. Just logic = A is dumb. String constraintLogic = getConstraintLogic(); if (constraintLogic != null && constraintLogic.length() > 1) { ret.put("constraintLogic", constraintLogic); } return ret; }
/** * Parse PathQueries from JSON * * @param reader the saved queries * @param model The model to use in preference. May be null. * @return a Map from query name to PathQuery */ public static Map<String, PathQuery> unmarshalJSONPathQueries(Reader reader, Model model) { Map<String, PathQuery> queries = new LinkedHashMap<String, PathQuery>(); try { String jsonQueries = IOUtils.toString(reader); JSONObject obj = new JSONObject(jsonQueries); JSONArray jsonQueryArray = obj.getJSONArray("queries"); for (int i = 0; i < jsonQueryArray.length(); i++) { JSONObject jsonQuery = jsonQueryArray.getJSONObject(i); PathQuery pathQuery = unmarshalJSONPathQuery(model, jsonQuery.toString()); queries.put(pathQuery.getTitle(), pathQuery); } } catch (Exception e) { throw new RuntimeException(e.getMessage(), e); } return queries; }
/** * Parse PathQueries from JSON * * @param reader the saved queries * @param model The model to use in preference. May be null. * @return a Map from query name to PathQuery */ public static Map<String, PathQuery> unmarshalJSONPathQueries(Reader reader, Model model) { Map<String, PathQuery> queries = new LinkedHashMap<String, PathQuery>(); try { String jsonQueries = IOUtils.toString(reader); JSONObject obj = new JSONObject(jsonQueries); JSONArray jsonQueryArray = obj.getJSONArray("queries"); for (int i = 0; i < jsonQueryArray.length(); i++) { JSONObject jsonQuery = jsonQueryArray.getJSONObject(i); PathQuery pathQuery = unmarshalJSONPathQuery(model, jsonQuery.toString()); queries.put(pathQuery.getTitle(), pathQuery); } } catch (Exception e) { throw new RuntimeException(e.getMessage(), e); } return queries; }
public void testHeaderAttributes() { PathQuery query = createQuery("HeaderAttributes.xml"); assertEquals(Collections.EMPTY_LIST, query.verifyQuery()); assertEquals(query.getTitle(), "Query Title"); assertEquals(query.getDescription(), "Query Description"); }