use of org.collectionspace.chain.csp.schema.Spec in project application by collectionspace.
the class ServiceBindingsGeneration method doLists.
// defines fields to show in list results
private void doLists(Record record, Element el, Namespace thisns, boolean isAuthority) {
Record r = record;
//
if (isAuthority == true) {
Spec recordSpec = r.getSpec();
r = recordSpec.getRecord(BASE_AUTHORITY_RECORD);
}
FieldSet[] allMiniSummaryList = r.getAllMiniSummaryList();
if (allMiniSummaryList == null) {
log.error(String.format("Config Generation: '%s' - allMiniSummaryList for record '%s' is null.", getConfigFile().getName(), r.getRecordName()));
}
String section;
for (FieldSet fs : allMiniSummaryList) {
if ((fs.isInServices() && !fs.excludeFromServicesList()) || fs.isServicesDerived()) {
String fieldNamePath = this.getFullyQualifiedFieldPath(fs);
section = fs.getSection();
//
// Add the <ListResultField> element
//
Element lrf = el.addElement(new QName("ListResultField", thisns));
// the field is from the common part.)
if (!section.equals(Record.COLLECTIONSPACE_COMMON_PART_NAME)) {
Element slrf = lrf.addElement(new QName("schema", thisns));
slrf.addText(r.getServicesSchemaName(fs.getSection()));
} else {
log.isDebugEnabled();
}
Element elrf = lrf.addElement(new QName("element", thisns));
elrf.addText(fs.getServicesTag());
Element xlrf = lrf.addElement(new QName("xpath", thisns));
xlrf.addText(fieldNamePath);
String setter = fs.getServicesSetter();
if (setter != null && setter.trim().isEmpty() == false) {
Element slrf = lrf.addElement(new QName("setter", thisns));
slrf.addText(setter);
}
}
}
}
use of org.collectionspace.chain.csp.schema.Spec in project application by collectionspace.
the class ServiceBindingsGeneration method doInitHandler.
/**
* Define fields that needs to have indexes created in the Nuxeo DB
* @param r
* @param el
* @param thisns
* @param section
* @param isAuthority
*/
private void doInitHandler(Record record, Element el, Namespace thisns, Boolean isAuthority) {
Record r = record;
//
if (isAuthority == true) {
Spec spec = r.getSpec();
r = spec.getRecord(BASE_AUTHORITY_RECORD);
// Since all the authorities share the same "baseAuthority" record, we need to set the actual authority record; e.g., Person, Organization, etc...
r.setLastAuthorityProxy(record);
}
Element dhele = el.addElement(new QName("initHandler", thisns));
Element cele = dhele.addElement(new QName("classname", thisns));
cele.addText(this.tenantSpec.getIndexHandler());
Element paramsElement = dhele.addElement(new QName("params", thisns));
boolean createdIndexedFields = createInitFieldList(paramsElement, thisns, r, isAuthority);
if (createdIndexedFields == false) {
// Since there were no fields to index, we don't need this empty <initHandler> element
el.remove(dhele);
}
}
use of org.collectionspace.chain.csp.schema.Spec in project application by collectionspace.
the class ServiceConfigGeneration method createSpec.
private Spec createSpec(CSPManager cspm) {
ConfigRoot root = cspm.getConfigRoot();
Spec spec = (Spec) root.getRoot(Spec.SPEC_ROOT);
return spec;
}
use of org.collectionspace.chain.csp.schema.Spec in project application by collectionspace.
the class TestServices method getSpec.
private Spec getSpec(CSPManager cspm) {
ConfigRoot root = cspm.getConfigRoot();
Spec spec = (Spec) root.getRoot(Spec.SPEC_ROOT);
assertNotNull(spec);
return spec;
}
use of org.collectionspace.chain.csp.schema.Spec in project application by collectionspace.
the class TestServices method getServiceManager.
private CSPManager getServiceManager(String filename) {
CSPManager cspm = new CSPManagerImpl();
cspm.register(new CoreConfig());
cspm.register(new Spec());
cspm.register(new ServicesStorageGenerator());
try {
cspm.go();
cspm.configure(getSource(filename), new ConfigFinder(null), false);
} catch (CSPDependencyException e) {
log.error("CSPManagerImpl failed");
log.error(e.getLocalizedMessage());
}
return cspm;
}
Aggregations