/** * Create an instance of {@link ModelsLibrary } * */ public ModelsLibrary createModelsLibrary() { return new ModelsLibrary(); }
public List<NodeModel> findAllNodeModels(String configurationFile) { List<NodeModel> ret = new ArrayList<NodeModel>(); ModelsLibrary modelsLibrary = modelLibrary.get(configurationFile); if (modelsLibrary != null) { ret.addAll(modelsLibrary.getNodeModel()); } return ret; }
public List<WayNodeModel> findAllWayNodeModels(String configurationFile) { List<WayNodeModel> ret = new ArrayList<WayNodeModel>(); ModelsLibrary modelsLibrary = modelLibrary.get(configurationFile); if (modelsLibrary != null) { ret.addAll(modelsLibrary.getWayNodeModel()); } return ret; }
public static void saveXml(ModelsLibrary modelsLibrary, File file) throws JAXBException, FileNotFoundException { JAXBContext jaxbContext = JAXBContext.newInstance(XSD_PACKAGE, ModelsLibraryService.class.getClassLoader()); Marshaller marshaller = jaxbContext.createMarshaller(); marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); ObjectFactory factory = new ObjectFactory(); ModelsLibrary pointModels = factory.createModelsLibrary(); pointModels.getNodeModel().addAll(modelsLibrary.getNodeModel()); pointModels.getWayNodeModel().addAll(modelsLibrary.getWayNodeModel()); JAXBElement<ModelsLibrary> gl = factory.createModelsLibrary(pointModels); marshaller.marshal(gl, new FileOutputStream(file)); } }
public ModelsLibrary loadXml(String fileKey) throws ModelLibraryLoadException { try { URL url = resourceManager.resourceToUrl(fileKey); if (!UrlUtil.existUrl(url)) { log.warn("cant load point motel configuration from: " + fileKey + " url don't exist: " + url); return new ModelsLibrary(); } return loadXml(url); } catch (Exception e) { throw new ModelLibraryLoadException("cant load model library from file key: " + fileKey, e); } }
public List<NodeModel> findAllNodeModels() { List<NodeModel> ret = new ArrayList<NodeModel>(); for (String fileKey : modelLibrary.keySet()) { ret.addAll(modelLibrary.get(fileKey).getNodeModel()); } return ret; }
public List<WayNodeModel> findAllWayNodeModels() { List<WayNodeModel> ret = new ArrayList<WayNodeModel>(); for (String fileKey : modelLibrary.keySet()) { ret.addAll(modelLibrary.get(fileKey).getWayNodeModel()); } return ret; }
public List<NodeModel> findNodeModels(String fileKey) { if (GLOBAL.equals(fileKey)) { return findAllNodeModels(); } return modelLibrary.get(fileKey).getNodeModel(); }