@Test public void testOPTGenerateLocatable2() throws Exception { I_ContentBuilder contentBuilder = I_ContentBuilder.getInstance(null, I_ContentBuilder.OPT, knowledge, "Weird Types 1"); Object generated = contentBuilder.generate(); TestCase.assertNotNull(generated); if (generated instanceof Composition) { EventContext context = ContextHelper.createDummyContext(); PartyIdentified partyIdentified = createComposer("Composer", "ETHERCIS", "1234-5678"); ((Composition) generated).setContext(context); ((Composition) generated).setComposer(partyIdentified); ((Composition) generated).setUid(new ObjectVersionID(UUID.randomUUID()+"::example.ethercis.com::1")); byte[] exportXml = contentBuilder.exportCanonicalXML((Composition)generated, true, true); TestCase.assertNotNull(exportXml); System.out.println(new String(exportXml)); Map<String, String> testRetMap = new EcisFlattener(true).render((Composition) generated); GsonBuilder builder = new GsonBuilder(); Gson gson = builder.setPrettyPrinting().disableHtmlEscaping().create(); String jsonString = gson.toJson(testRetMap); System.out.println(jsonString); } else if (generated instanceof Locatable){ byte[] exportXml = contentBuilder.exportCanonicalXML((Locatable)generated, true, true); TestCase.assertNotNull(exportXml); System.out.println(new String(exportXml)); Map<String, String> testRetMap = new EcisFlattener(true).render((Locatable)generated); GsonBuilder builder = new GsonBuilder(); Gson gson = builder.setPrettyPrinting().disableHtmlEscaping().create(); String jsonString = gson.toJson(testRetMap); System.out.println(jsonString); } }
@Override public byte[] exportCanonicalXML(String jsonData, boolean prettyPrint) throws Exception { byte[] data = null; Composition toSerializeComposition = buildCompositionFromJson(jsonData); if (toSerializeComposition == null){ throw new IllegalArgumentException("Could not build composition from available data..."); } data = exportCanonicalXML(toSerializeComposition, prettyPrint); return data; }
ContentBuilder implements I_ContentBuilder { @Override public byte[] exportCanonicalXML(String jsonData, boolean prettyPrint) throws Exception { byte[] data = null; Composition toSerializeComposition = buildCompositionFromJson(jsonData); if (toSerializeComposition == null){ throw new IllegalArgumentException("Could not build composition from available data..."); } data = exportCanonicalXML(toSerializeComposition, prettyPrint); return data; } }
ContentBuilder implements I_ContentBuilder { @Override public byte[] exportCanonicalXML(String jsonData, boolean prettyPrint) throws Exception { byte[] data = null; Composition toSerializeComposition = buildCompositionFromJson(jsonData); if (toSerializeComposition == null){ throw new IllegalArgumentException("Could not build composition from available data..."); } data = exportCanonicalXML(toSerializeComposition, prettyPrint); return data; } ContentBuilder(Map<SystemValue, Object> values, I_KnowledgeCache knowledge, String templateId); }
ContentBuilder implements I_ContentBuilder { @Override public byte[] exportCanonicalXML(String jsonData, boolean prettyPrint) throws Exception { byte[] data = null; Composition toSerializeComposition = buildCompositionFromJson(jsonData); if (toSerializeComposition == null){ throw new IllegalArgumentException("Could not build composition from available data..."); } data = exportCanonicalXML(toSerializeComposition, prettyPrint); return data; } ContentBuilder(Map<SystemValue, Object> values, I_KnowledgeCache knowledge, String templateId); @Override void setEntryData(Composition composition); @Override Object insertCloneInPath(Locatable locatable, Map<String, Object> definition, String path); @Override Composition importCanonicalXML(InputStream inputStream); @Override Composition importAsRM(Composition composition); @Override byte[] exportCanonicalXML(String jsonData, boolean prettyPrint); @Override byte[] exportCanonicalXML(Composition composition, boolean prettyPrint); @Override byte[] exportCanonicalXML(Composition composition, boolean prettyPrint, boolean anyElement); @Override byte[] exportCanonicalXML(Locatable locatable, boolean prettyPrint); @Override byte[] exportCanonicalXML(Locatable locatable, boolean prettyPrint, boolean anyElement); static byte[] canonicalExporter(Composition composition, boolean prettyPrint, boolean anyElement); static Locatable parseOtherDetailsXML(InputStream otherDetailsXmlStream); static byte[] canonicalExporter(Locatable locatable, boolean prettyPrint, boolean anyElement); @Override Composition buildCompositionFromJson(String jsonData); @Override Locatable buildLocatableFromJson(String jsonData); @Override void bindOtherContextFromJson(Composition composition, String jsonData); @Override void bindItemStructureFromJson(ItemStructure itemStructure, String jsonData); @Override String getEntry(); @Override String getTemplateId(); @Override void setTemplateId(String templateId); @Override Composition getComposition(); @Override String getRootArchetypeId(); @Override Map<String, String> getLtreeMap(); void setCompositionParameters(Map<SystemValue, Object> values); void setCompositionAttributes(Composition composition); @Override void setLenient(boolean lenient); @Override Boolean isLenient(); @Override ConstraintMapper getConstraintMapper(); @Override Map<String, Integer> getArrayItemPathMap(); }
ContentBuilder implements I_ContentBuilder { @Override public byte[] exportCanonicalXML(String jsonData, boolean prettyPrint) throws Exception { byte[] data = null; Composition toSerializeComposition = buildCompositionFromJson(jsonData); if (toSerializeComposition == null){ throw new IllegalArgumentException("Could not build composition from available data..."); } data = exportCanonicalXML(toSerializeComposition, prettyPrint); return data; } ContentBuilder(Map<SystemValue, Object> values, I_KnowledgeCache knowledge, String templateId); @Override void setEntryData(Composition composition); @Override Object insertCloneInPath(Locatable locatable, Map<String, Object> definition, String path); @Override Composition importCanonicalXML(InputStream inputStream); @Override Composition importAsRM(Composition composition); @Override byte[] exportCanonicalXML(String jsonData, boolean prettyPrint); @Override byte[] exportCanonicalXML(Composition composition, boolean prettyPrint); @Override byte[] exportCanonicalXML(Composition composition, boolean prettyPrint, boolean anyElement); @Override byte[] exportCanonicalXML(Locatable locatable, boolean prettyPrint); @Override byte[] exportCanonicalXML(Locatable locatable, boolean prettyPrint, boolean anyElement); static byte[] canonicalExporter(Composition composition, boolean prettyPrint, boolean anyElement); static Locatable parseOtherDetailsXML(InputStream otherDetailsXmlStream); static byte[] canonicalExporter(Locatable locatable, boolean prettyPrint, boolean anyElement); @Override Composition buildCompositionFromJson(String jsonData); @Override Locatable buildLocatableFromJson(String jsonData); @Override void bindOtherContextFromJson(Composition composition, String jsonData); @Override void bindItemStructureFromJson(ItemStructure itemStructure, String jsonData); @Override String getEntry(); @Override String getTemplateId(); @Override void setTemplateId(String templateId); @Override Composition getComposition(); @Override String getRootArchetypeId(); @Override Map<String, String> getLtreeMap(); void setCompositionParameters(Map<SystemValue, Object> values); void setCompositionAttributes(Composition composition); @Override void setLenient(boolean lenient); @Override Boolean isLenient(); @Override ConstraintMapper getConstraintMapper(); @Override Map<String, Integer> getArrayItemPathMap(); static final String SCHEMA_XSI; static final String SCHEMA_OPENEHR_ORG_V1; }