Search in sources :

Example 16 with Outcome

use of org.cristalise.kernel.persistency.outcome.Outcome in project kernel by cristal-ise.

the class XMLClusterStorage method get.

@Override
public C2KLocalObject get(ItemPath itemPath, String path) throws PersistencyException {
    try {
        ClusterType type = ClusterStorage.getClusterType(path);
        String filePath = getFilePath(itemPath, path) + fileExtension;
        String objString = FileStringUtility.file2String(filePath);
        if (objString.length() == 0)
            return null;
        Logger.debug(9, "XMLClusterStorage.get() - objString:" + objString);
        if (type == ClusterType.OUTCOME)
            return new Outcome(path, objString);
        else
            return (C2KLocalObject) Gateway.getMarshaller().unmarshall(objString);
    } catch (Exception e) {
        Logger.msg(3, "XMLClusterStorage.get() - The path " + path + " from " + itemPath + " does not exist: " + e.getMessage());
        Logger.error(e);
        throw new PersistencyException(e.getMessage());
    }
}
Also used : Outcome(org.cristalise.kernel.persistency.outcome.Outcome) PersistencyException(org.cristalise.kernel.common.PersistencyException) ClusterType(org.cristalise.kernel.persistency.ClusterType) IOException(java.io.IOException) PersistencyException(org.cristalise.kernel.common.PersistencyException)

Example 17 with Outcome

use of org.cristalise.kernel.persistency.outcome.Outcome in project kernel by cristal-ise.

the class OutcomeTest method testGetAllRecords.

@Test
public void testGetAllRecords() throws Exception {
    Outcome patients = getOutcome("allPatients.xml");
    compareListOfRecord(patients.getAllRecords("/AllPatients/PatientDetails"));
    String[] names = { "InsuranceNumber", "DateOfBirth", "Gender", "Weight" };
    compareListOfRecord2(patients.getAllRecords("/AllPatients/PatientDetails", Arrays.asList(names)));
}
Also used : Outcome(org.cristalise.kernel.persistency.outcome.Outcome) Test(org.junit.Test) MainTest(org.cristalise.kernel.test.process.MainTest)

Example 18 with Outcome

use of org.cristalise.kernel.persistency.outcome.Outcome in project kernel by cristal-ise.

the class OutcomeTest method testStorageDetails.

@Test
public void testStorageDetails() throws Exception {
    Outcome storage = getOutcome("storageDetails1", "StorageDetails");
    storage.setField("Type", "SECTION");
    storage.setField("Capacity", "55000");
    storage.setField("Commodity", null);
    storage.setField("Grade", null, true);
    storage.setField("Note", "");
    storage.validateAndCheck();
    assertNotNull(storage.getData());
    Logger.msg(storage.getData());
    assertTrue(storage.isIdentical(getOutcome("storageDetails1_updated.xml")));
}
Also used : Outcome(org.cristalise.kernel.persistency.outcome.Outcome) Test(org.junit.Test) MainTest(org.cristalise.kernel.test.process.MainTest)

Example 19 with Outcome

use of org.cristalise.kernel.persistency.outcome.Outcome in project kernel by cristal-ise.

the class OutcomeTest method testSite.

@Test
public void testSite() throws Exception {
    Outcome site1 = getOutcome("site1", "NewSite");
    Logger.msg(site1.getData());
    Map<String, String> record = new HashMap<>();
    record.put("Name", "kovax");
    site1.setRecord(record);
    site1.validateAndCheck();
}
Also used : HashMap(java.util.HashMap) Outcome(org.cristalise.kernel.persistency.outcome.Outcome) Test(org.junit.Test) MainTest(org.cristalise.kernel.test.process.MainTest)

Aggregations

Outcome (org.cristalise.kernel.persistency.outcome.Outcome)19 InvalidDataException (org.cristalise.kernel.common.InvalidDataException)6 PersistencyException (org.cristalise.kernel.common.PersistencyException)6 Viewpoint (org.cristalise.kernel.persistency.outcome.Viewpoint)6 MainTest (org.cristalise.kernel.test.process.MainTest)6 Test (org.junit.Test)6 Schema (org.cristalise.kernel.persistency.outcome.Schema)5 History (org.cristalise.kernel.events.History)4 CollectionArrayList (org.cristalise.kernel.collection.CollectionArrayList)3 ObjectNotFoundException (org.cristalise.kernel.common.ObjectNotFoundException)3 Event (org.cristalise.kernel.events.Event)3 Workflow (org.cristalise.kernel.lifecycle.instance.Workflow)3 DomainPath (org.cristalise.kernel.lookup.DomainPath)3 HashMap (java.util.HashMap)2 XPathExpressionException (javax.xml.xpath.XPathExpressionException)2 TraceableEntity (org.cristalise.kernel.entity.TraceableEntity)2 InvalidItemPathException (org.cristalise.kernel.lookup.InvalidItemPathException)2 ItemPath (org.cristalise.kernel.lookup.ItemPath)2 ClusterType (org.cristalise.kernel.persistency.ClusterType)2 Property (org.cristalise.kernel.property.Property)2