/** * Returns all repository objects. * * @return an {@link Iterable} with all repository objects, never <code>null</code>. */ protected final Iterable<REPO_OBJ> getAllRepositoryObjects() { return getRepository().get(); }
@Override @SuppressWarnings({ "unchecked", "rawtypes" }) public void deleteRepositoryObject(String entityType, String entityId) { ObjectRepository objectRepository = getGenericObjectRepository(entityType); RepositoryObject repositoryObject = objectRepository.get(entityId); // ACE-239: avoid null entities being passed in... if (repositoryObject == null) { throw new IllegalArgumentException("Could not find repository object!"); } objectRepository.remove(repositoryObject); }
public void buttonClick(ClickEvent event) { repository.remove(object); } });
@Override public RepositoryObject createRepositoryObject(String entityType, Map<String, String> attributes, Map<String, String> tags) throws IllegalArgumentException { if (TARGET.equals(entityType)) { ObjectRepository<StatefulTargetObject> repo = getGenericObjectRepository(TARGET); StatefulTargetRepository statefulRepo = (StatefulTargetRepository) repo; return statefulRepo.preregister(attributes, tags); } else { prepareAssociationAttributes(entityType, attributes); ObjectRepository<?> repo = getGenericObjectRepository(entityType); return repo.create(attributes, tags); } }
/** * Called by the remove-item button to remove a repository object from the repository. * * @param itemID * the ID of the item to remove from the repository, cannot be <code>null</code>. */ protected void handleItemRemoveObject(Object itemID) { getRepository().remove(getFromId(itemID)); }
@Override public List<ArtifactObject> la(String filter) throws Exception { ObjectRepository<ArtifactObject> repo = getGenericObjectRepository(ARTIFACT); return repo.get(m_context.createFilter(filter)); }
@Override public RepositoryObject getRepositoryObject(String entityType, String entityId) { ObjectRepository<?> repo = getGenericObjectRepository(entityType); return repo.get(entityId); }
@Override public List<FeatureObject> lf(String filter) throws Exception { ObjectRepository<FeatureObject> repo = getGenericObjectRepository(FEATURE); return repo.get(m_context.createFilter(filter)); }
@Override public List<DistributionObject> ld(String filter) throws Exception { ObjectRepository<DistributionObject> repo = getGenericObjectRepository(DISTRIBUTION); return repo.get(m_context.createFilter(filter)); }
/** * Converts a table-id back to a concrete {@link RepositoryObject}. * * @param id * the identifier of the {@link RepositoryObject}, cannot be <code>null</code>. * @return a {@link RepositoryObject} instance for the given ID, can be <code>null</code> in case no such object is * found. */ protected final REPO_OBJ getFromId(Object id) { return getRepository().get((String) id); }
@Override public List<Feature2DistributionAssociation> lf2d(String filter) throws Exception { ObjectRepository<Feature2DistributionAssociation> repo = getGenericObjectRepository(FEATURE2DISTRIBUTION); return repo.get(m_context.createFilter(filter)); }
@Override public List<StatefulTargetObject> lt(String filter) throws Exception { ObjectRepository<StatefulTargetObject> repo = getGenericObjectRepository(TARGET); return repo.get(m_context.createFilter(filter)); }
private void resetModified(boolean fill) { m_workingState.clear(); if (fill) { for (ObjectRepository<? extends RepositoryObject> repo : m_repos) { for (RepositoryObject object : repo.get()) { m_workingState.put(object, WorkingState.Unchanged); } } } m_notifier.notifyChanged(RepositoryAdmin.TOPIC_STATUSCHANGED_SUFFIX, null); }
private <T extends RepositoryObject> List<T> getGenericRepositoryObjects(String entityType) { ObjectRepository<T> repo = getGenericObjectRepository(entityType); List<T> list = repo.get(); if (list != null) { return list; } else { return Collections.emptyList(); } }
@Override public List<Artifact2FeatureAssociation> la2f(String filter) throws Exception { ObjectRepository<Artifact2FeatureAssociation> repo = getGenericObjectRepository(ARTIFACT2FEATURE); return repo.get(m_context.createFilter(filter)); }
@Override public List<Distribution2TargetAssociation> ld2t(String filter) throws Exception { ObjectRepository<Distribution2TargetAssociation> repo = getGenericObjectRepository(DISTRIBUTION2TARGET); return repo.get(m_context.createFilter(filter)); }
@Override public RepositoryObject getRight(String entityType, String entityId) { if (ARTIFACT2FEATURE.equals(entityType)) { return getGenericObjectRepository(FEATURE).get(entityId); } else if (FEATURE2DISTRIBUTION.equals(entityType)) { return getGenericObjectRepository(DISTRIBUTION).get(entityId); } else if (DISTRIBUTION2TARGET.equals(entityType)) { return getGenericObjectRepository(TARGET).get(entityId); } else { // throws an exception in case of an illegal type! getGenericObjectRepository(entityType); } return null; }
@Override public RepositoryObject getLeft(String entityType, String entityId) { if (ARTIFACT2FEATURE.equals(entityType)) { return getGenericObjectRepository(ARTIFACT).get(entityId); } else if (FEATURE2DISTRIBUTION.equals(entityType)) { return getGenericObjectRepository(FEATURE).get(entityId); } else if (DISTRIBUTION2TARGET.equals(entityType)) { return getGenericObjectRepository(DISTRIBUTION).get(entityId); } else { // throws an exception in case of an illegal type! getGenericObjectRepository(entityType); } return null; }
public RepositoryObject lookup(Object value) { for (RepositoryObject object : m_repository.get()) { if (object instanceof StatefulGatewayObject) { StatefulGatewayObject sgo = (StatefulGatewayObject) object; if (sgo.isRegistered()) { object = sgo.getGatewayObject(); } else { object = null; } } if (object != null) { NamedObject namedObject = getNamedObject(object); if (namedObject != null) { if (namedObject.getName().equals(value)) { return object; } } } } return null; }
/** * Only call this after the repository has been deserialized. */ void loadPreferences() { Preferences workingNode = m_prefs.node(PREFS_LOCAL_WORKING_STATE); Map<String, WorkingState> entries = new HashMap<String, WorkingState>(); // First, get all nodes and their workingstate. try { for (String node : workingNode.childrenNames()) { String state = workingNode.node(node).get(PREFS_LOCAL_WORKING_STATE_VALUE, WorkingState.Unchanged.toString()); entries.put(node, WorkingState.valueOf(state)); } } catch (BackingStoreException e) { // Something went wrong reading from the store, just work with whatever we have in the map. e.printStackTrace(); } // Then, go through all objects and check whether they match a definition we know. // This prevents calling getDefinition more than once per object. for (ObjectRepository<RepositoryObject> repo : m_repos) { for (RepositoryObject o : repo.get()) { WorkingState state = entries.get(o.getDefinition()); if (state != null) { m_workingState.put(o, state); } } } }