Search in sources :

Example 21 with Spec

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;
}
Also used : Spec(org.collectionspace.chain.csp.schema.Spec)

Example 22 with Spec

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;
}
Also used : Spec(org.collectionspace.chain.csp.schema.Spec)

Example 23 with Spec

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;
}
Also used : ConfigRoot(org.collectionspace.chain.csp.config.ConfigRoot) CSPManager(org.collectionspace.csp.api.container.CSPManager) CoreConfig(org.collectionspace.chain.csp.inner.CoreConfig) CSPDependencyException(org.collectionspace.csp.api.core.CSPDependencyException) CSPManagerImpl(org.collectionspace.csp.container.impl.CSPManagerImpl) Spec(org.collectionspace.chain.csp.schema.Spec) ConfigFinder(org.collectionspace.csp.helper.core.ConfigFinder) TestConfigFinder(org.collectionspace.csp.helper.test.TestConfigFinder)

Example 24 with 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;
}
Also used : FieldSet(org.collectionspace.chain.csp.schema.FieldSet) Record(org.collectionspace.chain.csp.schema.Record) TenantSpec(org.collectionspace.chain.csp.persistence.services.TenantSpec) Spec(org.collectionspace.chain.csp.schema.Spec)

Example 25 with Spec

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;
}
Also used : FieldSet(org.collectionspace.chain.csp.schema.FieldSet) Record(org.collectionspace.chain.csp.schema.Record) TenantSpec(org.collectionspace.chain.csp.persistence.services.TenantSpec) Spec(org.collectionspace.chain.csp.schema.Spec)

Aggregations

Spec (org.collectionspace.chain.csp.schema.Spec)31 ConfigRoot (org.collectionspace.chain.csp.config.ConfigRoot)12 TenantSpec (org.collectionspace.chain.csp.persistence.services.TenantSpec)10 CSPManager (org.collectionspace.csp.api.container.CSPManager)8 CSPManagerImpl (org.collectionspace.csp.container.impl.CSPManagerImpl)8 CoreConfig (org.collectionspace.chain.csp.inner.CoreConfig)7 Record (org.collectionspace.chain.csp.schema.Record)7 ConfigFinder (org.collectionspace.csp.helper.core.ConfigFinder)7 FieldSet (org.collectionspace.chain.csp.schema.FieldSet)5 WebUI (org.collectionspace.chain.csp.webui.main.WebUI)5 CSPDependencyException (org.collectionspace.csp.api.core.CSPDependencyException)5 UI (org.collectionspace.csp.api.ui.UI)4 TestConfigFinder (org.collectionspace.csp.helper.test.TestConfigFinder)4 Element (org.dom4j.Element)4 JSONObject (org.json.JSONObject)4 ServicesStorageGenerator (org.collectionspace.chain.csp.persistence.services.ServicesStorageGenerator)3 QName (org.dom4j.QName)3 ByteArrayInputStream (java.io.ByteArrayInputStream)2 InputStream (java.io.InputStream)2 StringWriter (java.io.StringWriter)2