/** * Register predelivered view. * * @param viewModelPath * the view model path * @throws IOException * Signals that an I/O exception has occurred. */ public void registerPredeliveredView(String viewModelPath) throws IOException { String json = loadResourceContent(viewModelPath); DataStructureViewModel viewModel = dataStructuresCoreService.parseView(json); viewModel.setLocation(viewModelPath); VIEWS_PREDELIVERED.put(viewModelPath, viewModel); }
private static void setViewAttributes(String location, DataStructureSchemaModel result, JsonObject structure, String type, DataStructureViewModel view) { view.setLocation(location); view.setName(structure.get("name").getAsString()); view.setType(type); view.setQuery(structure.get("columns").getAsJsonArray().get(0).getAsJsonObject().get("query").getAsString()); view.setCreatedAt(result.getCreatedAt()); view.setCreatedBy(result.getCreatedBy()); view.setHash(result.getHash()); }
@Override public DataStructureViewModel createView(String location, String name, String hash) throws DataStructuresException { DataStructureViewModel viewModel = new DataStructureViewModel(); viewModel.setLocation(location); viewModel.setName(name); viewModel.setType(IDataStructureModel.TYPE_VIEW); viewModel.setHash(hash); viewModel.setCreatedBy(UserFacade.getName()); viewModel.setCreatedAt(new Timestamp(new java.util.Date().getTime())); try { Connection connection = null; try { connection = dataSource.getConnection(); viewPersistenceManager.insert(connection, viewModel); return viewModel; } finally { if (connection != null) { connection.close(); } } } catch (SQLException e) { throw new DataStructuresException(e); } }
viewModel.setLocation(registryPath); synchronizeView(viewModel); return;