use of org.cristalise.kernel.querying.Query in project kernel by cristal-ise.
the class DefaultResourceImportHandler method getCollections.
private CollectionArrayList getCollections(String name, Integer version, String xml) throws Exception {
if (type == SCHEMA_RESOURCE) {
return new Schema(name, version, null, xml).makeDescCollections();
} else if (type == SCRIPT_RESOURCE) {
return new Script(name, version, null, xml).makeDescCollections();
} else if (type == QUERY_RESOURCE) {
return new Query(name, version, null, xml).makeDescCollections();
} else {
DescriptionObject descObject = (DescriptionObject) Gateway.getMarshaller().unmarshall(xml);
descObject.setVersion(version);
return descObject.makeDescCollections();
}
}
use of org.cristalise.kernel.querying.Query in project kernel by cristal-ise.
the class CastorXMLTest method testQueryParsing.
@Test
public void testQueryParsing() throws Exception {
Query q = new Query(FileStringUtility.url2String(CastorXMLTest.class.getResource("/testQuery.xml")));
assertEquals("TestQuery", q.getName());
assertEquals(0, (int) q.getVersion());
assertEquals("existdb:xquery", q.getLanguage());
assertEquals(1, q.getParameters().size());
assertEquals("uuid", q.getParameters().get(0).getName());
assertEquals("java.lang.String", q.getParameters().get(0).getType().getName());
assertTrue(q.getQuery().startsWith("\n<TRList>"));
assertTrue(q.getQuery().endsWith("</TRList>\n "));
}
use of org.cristalise.kernel.querying.Query in project kernel by cristal-ise.
the class Job method getQuery.
public Query getQuery() throws ObjectNotFoundException, InvalidDataException {
if (hasQuery()) {
Query query = getTransition().getQuery(actProps);
query.setParemeterValues(itemPath.getUUID().toString(), getSchemaName(), actProps);
return query;
}
return null;
}
use of org.cristalise.kernel.querying.Query in project kernel by cristal-ise.
the class CastorXMLUtility method marshall.
/**
* Marshalls a mapped object to xml string. The mapping must be loaded before. See updateMapping().
*
* @param obj the object to be marshalled
* @return the xml string of the marshalled object
*/
public String marshall(Object obj) throws IOException, MappingException, MarshalException, ValidationException {
if (obj == null)
return "<NULL/>";
if (obj instanceof Outcome)
return ((Outcome) obj).getData();
StringWriter sWriter = new StringWriter();
Marshaller marshaller = mappingContext.createMarshaller();
marshaller.setWriter(sWriter);
marshaller.setMarshalAsDocument(false);
if (obj instanceof Query)
marshaller.addProcessingInstruction(Result.PI_DISABLE_OUTPUT_ESCAPING, "");
marshaller.marshal(obj);
return sWriter.toString();
}
Aggregations