-
Type: Bug
-
Status: Closed
-
Priority: Major
-
Resolution: Applied
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: REST/AtomPub Binding
-
Labels:None
-
Proposal:
A simple change would facilitate consumption of the REST binding for non-ATOM clients.
For instance to create a query I currently need to do:
1. repoDoc = parse(http://...)
1. collections = repoDoc.getElementsByTagNameNS("http://www.w3.org/2007/app", "collection")
2. for (collection : collections)
1. if ("types".equals(collection.getAttributeNS("http://docs.oasis-open.org/ns/cmis/restatom/200901", "collectionType"))
1. typesUrl = collection.getAttribute("href");
3. templates = repoDoc.getElementsByTagNameNS("http://docs.oasis-open.org/ns/cmis/restatom/200901", "uritemplate")
4. for (template : templates)
1. if ("query".equals(template.getElementsByTagNameNS("http://docs.oasis-open.org/ns/cmis/restatom/200901", "type")[0].getText()))
1. queryTemplate = template.getElementsByTagNameNS("http://docs.oasis-open.org/ns/cmis/restatom/200901", "template")[0].getText()
2. typesDoc = parse(typesUrl)
1. types = typeDoc.getElementsByTagNameNS("http://www.w3.org/2005/Atom", "entry")
2. for (type : types)
1. links = type.getElementsByTagNameNS("http://www.w3.org/2005/Atom", "link")
2. for (link : links)
1. if ("application/cmistree+xml;type=feed".equals(link.getAttribute("type"))
1. descendantsUrl = link.getAttribute("href")
3. descendantsDoc = parse(descendantsUrl)
1. types = typeDoc.getElementsByTagNameNS("http://www.w3.org/2005/Atom", "entry")
2. for (type : types)
1. localName = type.getElementsByTagNameNS("http://docs.oasis-open.org/ns/cmis/core/200901", "localName")
2. if ("MyTypeName".equals(localName.getText())
1. links = type.getElementsByTagNameNS("http://www.w3.org/2005/Atom", "link")
2. for (link : links)
1. if ("self".equals(link.getAttribute("rel"))
1. myTypeUrl = link.getAttribute("href")
4. myTypeDoc = parse(myTypeUrl)
1. tableName = myTypeDoc.getElementsByTagNameNS("http://docs.oasis-open.org/ns/cmis/core/200901", "queryName")[0].getText()
2. propNames = type.getElementsByTagNameNS("http://docs.oasis-open.org/ns/cmis/core/200901", "localName")
3. for (propName : propNames) {
1. if ("myPropName".equals(propName.getText())
1. propQueryName = propName.getParenter.getElementsByTagNameNS("http://docs.oasis-open.org/ns/cmis/core/200901", "queryName")[0].getText()
5. query = "SELECT * FROM " + tableName + "WHERE " propQueryName + " = \"myValue\""
6. queryUrl.replace("
", query)
7. reultsDoc = parse(queryUrl)
1. Similarly parse the query response