/** * {@inheritDoc} */ @Override public void execute() { InterMineModelParser parser = new InterMineModelParser(); try { Model merged = ModelFileMerger.mergeModelFromFiles(inputModelFile, additionsFiles, parser); FileWriter writer = new FileWriter(outputModelFile); writer.write(merged.toString()); writer.close(); } catch (MetaDataException e) { throw new BuildException("Failed to parse model from input files", e); } catch (IOException e) { throw new BuildException("failed to write model file: " + outputModelFile, e); } } }
/** * {@inheritDoc} */ @Override public void execute() { InterMineModelParser parser = new InterMineModelParser(); try { Model merged = ModelFileMerger.mergeModelFromFiles(inputModelFile, additionsFiles, parser); FileWriter writer = new FileWriter(outputModelFile); writer.write(merged.toString()); writer.close(); } catch (MetaDataException e) { throw new BuildException("Failed to parse model from input files", e); } catch (IOException e) { throw new BuildException("failed to write model file: " + outputModelFile, e); } } }
/** * Save a model, in serialized form, to the specified directory * @param model the model * @param destDir the destination directory * @throws IOException if an error occurs */ public static void saveModel(Model model, File destDir) throws IOException { write(model.toString(), new File(destDir, getFilename(MODEL, model.getName()))); }
/** * Save a model, in serialized form, to the specified directory * @param model the model * @param destDir the destination directory * @throws IOException if an error occurs */ public static void saveModel(Model model, File destDir) throws IOException { write(model.toString(), new File(destDir, getFilename(MODEL, model.getName()))); }
public void testToString3() throws Exception { Model model = Model.getInstanceByName("basicmodel"); InputStream is = getClass().getResourceAsStream("expected_model.xml"); String modelString = IOUtils.toString(is).replaceAll("\n$", ""); assertEquals(modelString, model.toString().replaceAll("\t", " ")); }
MetadataManager.store(db, MetadataManager.MODEL, model.toString());
MetadataManager.store(db, MetadataManager.MODEL, model.toString());
public void testToString() throws Exception { String packageName = cdMaker.getPackageName(); ClassDescriptor cld1 = cdMaker.makeClass("Class1"); ClassDescriptor cld2 = cdMaker.makeClass("Class2"); Model model = new Model("model", packageName, Arrays.asList(cld1, cld2)); String expected = "<model name=\"model\" package=\"" + packageName + "\">" + ENDL + "<class name=\"Class1\" is-interface=\"false\"></class>" + ENDL + "<class name=\"Class2\" is-interface=\"false\"></class>" + ENDL + "</model>"; assertEquals(expected, model.toString()); }