@Override public boolean containsId(Object itemId) { //noinspection unchecked return datasource.containsItem(itemId); }
@Override public boolean containsItem(E item) { return datasource.containsItem(item.getId()); }
public GroupInfo getParentGroup(T entity) { K id = entity.getId(); if (!datasource.containsItem(id)) { throw new IllegalArgumentException("Datasource doesn't contain passed entity"); } if (itemGroups == null) { return null; } return itemGroups.get(entity.getId()); }
public List<GroupInfo> getGroupPath(T entity) { K id = entity.getId(); if (!datasource.containsItem(id)) { throw new IllegalArgumentException("Datasource doesn't contain passed entity"); } if (itemGroups == null) { return Collections.emptyList(); } GroupInfo groupInfo = itemGroups.get(entity.getId()); if (groupInfo == null) { return Collections.emptyList(); } LinkedList<GroupInfo> parentGroups = new LinkedList<>(); parentGroups.add(groupInfo); GroupInfo parent = parents.get(groupInfo); while (parent != null) { parentGroups.addFirst(parent); parent = parents.get(parent); } return parentGroups; } }
@Override public void actionPerform(Component component) { if (lookupRolesDs.getItem() != null && !rolesDs.containsItem(lookupRolesDs.getItem().getId())) { rolesDs.addItem(lookupRolesDs.getItem()); } }
CollectionDatasource parentCollectionDs = (CollectionDatasource) parentDs; for (Entity item : itemsToCreate) { if (parentCollectionDs.containsItem(item.getId())) { parentCollectionDs.modifyItem(item); } else {
@Override public void applySettings(Settings settings) { super.applySettings(settings); if (settings.get().attribute(LAST_SELECTED_JMX_CONNECTION_ID) != null) { UUID lastJmxConnectionId = UUID.fromString( settings.get().attributeValue(LAST_SELECTED_JMX_CONNECTION_ID)); if (jmxInstancesDs.containsItem(lastJmxConnectionId)) { jmxConnectionField.setValue(jmxInstancesDs.getItem(lastJmxConnectionId)); } } if (settings.get().attribute(LAST_SELECTED_LOG_FILE_NAME) != null) { String lastFileName = settings.get().attributeValue(LAST_SELECTED_LOG_FILE_NAME); @SuppressWarnings("unchecked") List<String> logFileNamesList = logFileNameField.getOptionsList(); if (logFileNamesList.contains(lastFileName)) { logFileNameField.setValue(lastFileName); showLogTail(); } } }
if (ds.containsItem(item.getId())) { ds.modifyItem(item); } else {
if (item instanceof Entity) { Entity entity = (Entity) item; if (!ds.containsItem(entity.getId())) {
if (parentItem != null && !datasource.containsItem(parentItem.getId())) { parentItem = null;
&& !parentDs.getItemsToCreate().contains(item) && !parentDs.getItemsToUpdate().contains(item) && parentDs instanceof CollectionDatasource && ((CollectionDatasource) parentDs).containsItem(item.getId()) && !entityStates.isLoadedWithView(item, ds.getView())) { item = dataservice.reload(item, ds.getView(), ds.getMetaClass(), ds.getLoadDynamicAttributes());