/** * Returns if an entity with the given key exists or not. * * @param key the Storable key * @return true if the entity with given key exists, false otherwise */ default boolean exists(StorableKey key) { return get(key) != null; }
@Override public <T extends Storable> Collection<T> find(String namespace, List<QueryParam> queryParams) throws StorageException { //Adding workaround methods that calls dao until we figure out what needs to be in caching so the topologies can work. return dao.find(namespace, queryParams); }
public AbstractStorableSqlQuery(Storable storable) { this.storable = storable; StorableKey storableKey = storable.getStorableKey(); tableName = storableKey.getNameSpace(); primaryKey = storableKey.getPrimaryKey(); columns = storable.getSchema().getFields(); }
public TopologyVersion removeTopologyVersionInfo(Long versionId) { TopologyVersion topologyVersion = new TopologyVersion(); topologyVersion.setId(versionId); return dao.remove(new StorableKey(TOPOLOGY_VERSIONINFO_NAMESPACE, topologyVersion.getPrimaryKey())); }
public Component getComponent(Long componentId) { Component component = new Component(); component.setId(componentId); return this.dao.get(new StorableKey(COMPONENT_NAMESPACE, component.getPrimaryKey())); }
@Test public void testFind_NullQueryParams_AllEntries() { for (StorableTest test : storableTests) { test.addAllToStorage(); Collection<Storable> allExisting = getStorageManager().list(test.getNameSpace()); Collection<Storable> allMatchingQueryParamsFilter = getStorageManager().find(test.getNameSpace(), null); assertIterators(allExisting, allMatchingQueryParamsFilter); } }
protected void doTestNextId_AutoincrementColumn_IdPlusOne(StorableTest test) throws SQLException { Long actualNextId = getStorageManager().nextId(test.getNameSpace()); Long expectedNextId = actualNextId; Assert.assertEquals(expectedNextId, actualNextId); addAndAssertNextId(test, 0, ++expectedNextId); addAndAssertNextId(test, 2, ++expectedNextId); addAndAssertNextId(test, 2, expectedNextId); addAndAssertNextId(test, 3, ++expectedNextId); }
public void addAllToStorage() { for (Storable storable : storableList) { getStorageManager().addOrUpdate(storable); } }
@Before public void setup() { setStorableTests(); for (StorableTest test : storableTests) { test.setStorageManager(getStorageManager()); } }
public void close() { getStorageManager().cleanup(); }
public Dashboard removeDashboard(Long dashboardId) { Dashboard dashboard = new Dashboard(); dashboard.setId(dashboardId); return dao.remove(new StorableKey(DASHBOARD_NAMESPACE, dashboard.getPrimaryKey())); }
public Cluster getCluster(Long clusterId) { Cluster cluster = new Cluster(); cluster.setId(clusterId); return this.dao.get(new StorableKey(CLUSTER_NAMESPACE, cluster.getPrimaryKey())); }
/** * Returns if an entity with the given key exists or not. * * @param key the Storable key * @return true if the entity with given key exists, false otherwise */ default boolean exists(StorableKey key) { return get(key) != null; }
@Override public <T extends Storable> Collection<T> find(String namespace, List<QueryParam> queryParams) throws StorageException { //Adding workaround methods that calls dao until we figure out what needs to be in caching so the topologies can work. return dao.find(namespace, queryParams); }
public Service removeService(Long serviceId) { Service service = new Service(); service.setId(serviceId); return dao.remove(new StorableKey(SERVICE_NAMESPACE, service.getPrimaryKey())); }
public ServiceConfiguration getServiceConfiguration(Long configurationId) { ServiceConfiguration serviceConfiguration = new ServiceConfiguration(); serviceConfiguration.setId(configurationId); return this.dao.get(new StorableKey(SERVICE_CONFIGURATION_NAMESPACE, serviceConfiguration.getPrimaryKey())); }
public void removeComponentProcess(Long componentProcessId) { ComponentProcess componentProcess = new ComponentProcess(); componentProcess.setId(componentProcessId); this.dao.remove(new StorableKey(NAMESPACE_COMPONENT_PROCESS, componentProcess.getPrimaryKey())); }
public Namespace getNamespace(Long namespaceId) { Namespace namespace = new Namespace(); namespace.setId(namespaceId); return this.dao.get(new StorableKey(NAMESPACE_NAMESPACE, namespace.getPrimaryKey())); }
public File removeFile(Long fileId) { File file = new File(); file.setId(fileId); return dao.remove(new StorableKey(FILE_NAMESPACE, file.getPrimaryKey())); }
public UserRole removeUserRole(Long userId, Long roleId) { UserRole userRole = new UserRole(); userRole.setUserId(userId); userRole.setRoleId(roleId); return dao.remove(new StorableKey(UserRole.NAMESPACE, userRole.getPrimaryKey())); }