use of org.collectionspace.chain.csp.schema.Spec in project application by collectionspace.
the class TestServiceThroughWebapp method getAdminPassword.
private String getAdminPassword() {
Spec spec = tester.getSpec(jetty);
String pwd = spec.getAdminData().getAuthPass();
return pwd;
}
use of org.collectionspace.chain.csp.schema.Spec in project application by collectionspace.
the class TestServiceThroughWebapp method getAdminUsername.
private String getAdminUsername() {
Spec spec = tester.getSpec(jetty);
String username = spec.getAdminData().getAuthUser();
return username;
}
use of org.collectionspace.chain.csp.schema.Spec in project application by collectionspace.
the class TestData method getSpec.
public final Spec getSpec(ServletTester tester) {
if (this.spec == null) {
CSPManager cspm = new CSPManagerImpl();
cspm.register(new CoreConfig());
cspm.register(new Spec());
try {
cspm.go();
tester.getAttribute("config-filename");
String filename = (String) tester.getAttribute("config-filename");
cspm.configure(getSource(filename), new ConfigFinder(null), false);
} catch (CSPDependencyException e) {
log.info("CSPManagerImpl failed");
log.info(tester.getAttribute("config-filename").toString());
log.info(e.getLocalizedMessage());
}
ConfigRoot root = cspm.getConfigRoot();
Spec spec = (Spec) root.getRoot(Spec.SPEC_ROOT);
this.spec = spec;
}
return this.spec;
}
use of org.collectionspace.chain.csp.schema.Spec in project application by collectionspace.
the class ServiceBindingsGeneration method doServiceProperties.
private boolean doServiceProperties(Record record, Element props, Namespace types, boolean isAuthority) {
boolean result = false;
Record r = record;
//
if (isAuthority == true) {
Spec spec = r.getSpec();
r = spec.getRecord(BASE_AUTHORITY_RECORD);
}
FieldSet objNameProp = r.getMiniSummary();
if (objNameProp != null) {
String serviceFieldAlias = objNameProp.getServiceFieldAlias();
if (serviceFieldAlias != null) {
objNameProp = r.getField(serviceFieldAlias);
}
this.addServiceProperty(props, objNameProp, OBJECT_NAME_PROPERTY, types, isAuthority);
result = true;
}
FieldSet objNumberProp = r.getMiniNumber();
if (objNumberProp != null) {
this.addServiceProperty(props, objNumberProp, OBJECT_NUMBER_PROPERTY, types, isAuthority);
result = true;
}
return result;
}
use of org.collectionspace.chain.csp.schema.Spec in project application by collectionspace.
the class ServiceBindingsGeneration method createInitFieldList.
/*
* Returns true if we end up creating service binding entries for field initialization.
*/
private boolean createInitFieldList(Element paramsElement, Namespace namespace, Record record, Boolean isAuthority) {
boolean result = false;
// Loop through each field to see if we need to create a service binding entry
for (FieldSet f : record.getAllFieldFullList("")) {
boolean createdEntry = false;
if (f.isASelfRenderer() == true) {
//
// Self rendered fields are essentially sub-records
//
String fieldSetServicesType = f.getServicesType(NOT_NAMESPACED);
Spec spec = f.getRecord().getSpec();
// find a record that corresponds to the fieldset's service type
Record subRecord = spec.getRecord(fieldSetServicesType);
// make a recursive call with the subrecord
createdEntry = createInitFieldList(paramsElement, namespace, subRecord, isAuthority);
} else {
// Create a service binding for the field
createdEntry = createInitFieldEntry(paramsElement, namespace, record, f, isAuthority);
}
//
if (createdEntry == true) {
result = true;
}
}
return result;
}
Aggregations