/** @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; }
q.addView("Employee.name"); q.setDescription("Employee.name", "Flibble"); assertEquals("Flibble", q.getDescription("Employee.name")); assertEquals(Collections.EMPTY_LIST, q.verifyQuery()); assertEquals("<query name=\"test\" model=\"testmodel\" view=\"Employee.name\" longDescription=\"\"><pathDescription pathString=\"Employee.name\" description=\"Flibble\"/></query>", PathQueryBinding.marshal(q, "test", "testmodel", 1)); assertNull(q.getDescription("alkjhadlfkjh")); try { q.setDescription(null, "Flibble"); q.getDescription(null); fail("Expected NullPointerException"); } catch (NullPointerException e) { q.getDescription("Empsda adsfasdf"); fail("Expected IllegalArgumentException"); } catch (IllegalArgumentException e) {
/** @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; }
assertEquals("CEO name", queryUpdated.getDescription("CEO.name"));
private String getIntro(WebserviceCodeGenInfo info) { final String src = info.getProjectTitle(); final String author = info.isLoggedIn() ? info.getUserName() : src; StringBuffer sb = new StringBuffer(); sb.append("/**" + endl); sb.append(" * This is a Java program to run a query from " + src + "." + endl); sb.append(" * It was automatically generated at " + new Date().toString() + endl); sb.append(" *" + endl); if (StringUtils.isNotBlank(info.getQuery().getDescription())) { sb.append(" * " + info.getQuery().getDescription() + endl + endl); } sb.append(" * " + "@author " + author + endl); sb.append(" *" + endl); sb.append(" */" + endl); return sb.toString(); }
private String getIntro(WebserviceCodeGenInfo info) { final String src = info.getProjectTitle(); final String author = info.isLoggedIn() ? info.getUserName() : src; StringBuffer sb = new StringBuffer(); sb.append("/**" + endl); sb.append(" * This is a Java program to run a query from " + src + "." + endl); sb.append(" * It was automatically generated at " + new Date().toString() + endl); sb.append(" *" + endl); if (StringUtils.isNotBlank(info.getQuery().getDescription())) { sb.append(" * " + info.getQuery().getDescription() + endl + endl); } sb.append(" * " + "@author " + author + endl); sb.append(" *" + endl); sb.append(" */" + endl); return sb.toString(); }
writer.writeAttribute("model", modelName); writer.writeAttribute("view", StringUtil.join(query.getView(), " ")); if (query.getDescription() != null) { writer.writeAttribute("longDescription", query.getDescription()); } else { writer.writeAttribute("longDescription", "");
writer.writeAttribute("model", modelName); writer.writeAttribute("view", StringUtil.join(query.getView(), " ")); if (query.getDescription() != null) { writer.writeAttribute("longDescription", query.getDescription()); } else { writer.writeAttribute("longDescription", "");
private String handlePathQuery(StringBuffer sb, PathQuery query, List<String> rootLessViews) { if (StringUtils.isNotBlank(query.getDescription())) { sb.append("# query description - " + query.getDescription() + endl + endl);
private String handlePathQuery(StringBuffer sb, PathQuery query, List<String> rootLessViews) { if (StringUtils.isNotBlank(query.getDescription())) { sb.append("# query description - " + query.getDescription() + endl + endl);
private void appendPathQuery(StringBuffer sb, PathQuery query) throws InvalidQueryException { if (query.getDescription() != null && !"".equals(query.getDescription())) { sb.append("# query description - " + query.getDescription() + endl + endl);
private void appendPathQuery(StringBuffer sb, PathQuery query) throws InvalidQueryException { if (query.getDescription() != null && !"".equals(query.getDescription())) { sb.append("# query description - " + query.getDescription() + endl + endl);
if (StringUtils.isNotBlank(query.getDescription())) { printLine(sb, "# ", "Description: " + query.getDescription()); sb.append(endl);
if (StringUtils.isNotBlank(query.getDescription())) { printLine(sb, "# ", "Description: " + query.getDescription()); sb.append(endl);
public void testHeaderAttributes() { PathQuery query = createQuery("HeaderAttributes.xml"); assertEquals(Collections.EMPTY_LIST, query.verifyQuery()); assertEquals(query.getTitle(), "Query Title"); assertEquals(query.getDescription(), "Query Description"); }