use of org.collectionspace.chain.csp.schema.FieldSet in project application by collectionspace.
the class DataGenerator method repeatItem.
/**
* Data generator specific code for repeats
* @param out
* @param r
* @param context
* @throws JSONException
*/
private void repeatItem(JSONObject out, Repeat r, UISpecRunContext context) throws JSONException {
String selector = getSelector(r, context);
JSONArray arr = new JSONArray();
for (Integer i = 0; i < repeatnum; i++) {
repeataffix = i.toString() + " - ";
JSONObject protoTree = new JSONObject();
for (FieldSet child : r.getChildren("POST")) {
whatIsThisFieldSet(protoTree, child, context);
}
arr.put(protoTree);
repeataffix = "";
}
out.put(selector, arr);
}
use of org.collectionspace.chain.csp.schema.FieldSet in project application by collectionspace.
the class SchemaStructure method actualSelfRenderer.
/**
* render the mark up needed by the UISpec for self renderers
*
* @param fs
* @param context
* @param subexpander
* @param subitems
* @param options
* @throws JSONException
*/
protected void actualSelfRenderer(FieldSet fs, UISpecRunContext context, JSONObject subexpander, Record subitems) throws JSONException {
Boolean truerepeat = false;
FieldParent fsp = fs.getParent();
if (fsp instanceof Repeat && !(fsp instanceof Group)) {
// remove bogus repeats used in search
Repeat rp = (Repeat) fsp;
if (isATrueRepeat(rp)) {
truerepeat = true;
for (FieldSet fs2 : subitems.getAllFieldTopLevel("")) {
whatIsThisFieldSet(subexpander, fs2, context);
}
makeAllRecordMessageKey(context, subexpander, subitems);
}
}
if (!truerepeat) {
for (FieldSet fs2 : subitems.getAllFieldTopLevel("")) {
whatIsThisFieldSet(subexpander, fs2, context);
}
makeAllRecordMessageKey(context, subexpander, subitems);
}
}
use of org.collectionspace.chain.csp.schema.FieldSet in project application by collectionspace.
the class SchemaStructure method makeAGroupEntry.
/**
* Do all the magic to make a Group thing
*
* @param out
* @param fs
* @param contexts
* @throws JSONException
*/
protected void makeAGroupEntry(JSONObject out, FieldSet fs, UISpecRunContext context) throws JSONException {
Group g = (Group) fs;
JSONObject contents = new JSONObject();
for (FieldSet child : g.getChildren("")) {
whatIsThisFieldSet(contents, child, context);
}
// make the item
if (fs.isASelfRenderer()) {
JSONObject renderedcontents = new JSONObject();
actualSelfRenderer(renderedcontents, contents);
contents = renderedcontents;
} else if (isAGroupField(fs)) {
contents = makeAGroupField(g, context);
}
actualGroupEntry(fs, out, context, contents);
}
use of org.collectionspace.chain.csp.schema.FieldSet in project application by collectionspace.
the class SchemaStructure method makeARepeatSiblingEntry.
/**
* @param out
* @param context
* @param r
* @param row
* @param children
* @throws JSONException
*/
protected void makeARepeatSiblingEntry(JSONObject out, Repeat r, UISpecRunContext context) throws JSONException {
JSONObject contents = new JSONObject();
for (FieldSet child : r.getChildren("")) {
whatIsThisFieldSet(contents, child, context);
}
JSONArray children = new JSONArray();
children.put(contents);
actualRepeatSiblingEntry(out, r, context, children);
}
use of org.collectionspace.chain.csp.schema.FieldSet in project application by collectionspace.
the class ServicesXsd method generateSearchList.
@SuppressWarnings("null")
private void generateSearchList(Element root, Namespace ns) {
Element ele = root.addElement(new QName("complexType", ns));
ele.addAttribute("name", "abstractCommonList");
Element aele = ele.addElement(new QName("annotation", ns));
Element appele = aele.addElement(new QName("appinfo", ns));
Element jxb = appele.addElement(new QName("class", new Namespace("jaxb", "")));
jxb.addAttribute("ref", "org.collectionspace.services.jaxb.AbstractCommonList");
String[] listpath = record.getServicesListPath().split("/");
Element lele = root.addElement(new QName("element", ns));
lele.addAttribute("name", listpath[0]);
Element clele = lele.addElement(new QName("complexType", ns));
Element cplele = clele.addElement(new QName("complexContent", ns));
Element exlele = cplele.addElement(new QName("extension", ns));
exlele.addAttribute("base", "abstractCommmonList");
Element sexlele = exlele.addElement(new QName("sequence", ns));
Element slele = sexlele.addElement(new QName("element", ns));
slele.addAttribute("name", listpath[1]);
slele.addAttribute("maxOccurs", "unbounded");
Element cslele = slele.addElement(new QName("complexType", ns));
Element scslele = cslele.addElement(new QName("sequence", ns));
Set<String> searchflds = new HashSet();
for (String minis : record.getAllMiniDataSets()) {
if (minis != null && !minis.equals("")) {
for (FieldSet flds : record.getMiniDataSetByName(minis)) {
searchflds.add(flds.getServicesTag());
log.info(flds.getServicesTag());
}
}
}
Iterator iter = searchflds.iterator();
while (iter.hasNext()) {
Element sfld = scslele.addElement(new QName("element", ns));
sfld.addAttribute("name", (String) iter.next());
sfld.addAttribute("type", "xs:string");
sfld.addAttribute("minOccurs", "1");
}
/*standard fields */
Element stfld1 = scslele.addElement(new QName("element", ns));
stfld1.addAttribute("name", "uri");
stfld1.addAttribute("type", "xs:string");
stfld1.addAttribute("minOccurs", "1");
Element stfld2 = scslele.addElement(new QName("element", ns));
stfld2.addAttribute("name", "csid");
stfld2.addAttribute("type", "xs:string");
stfld2.addAttribute("minOccurs", "1");
}
Aggregations