/** * Gets the OpenNMS bean. * * @param itemId the item id * @return the OpenNMS bean */ public T getOnmsBean(Object itemId) { BeanItem<T> item = getItem(itemId); return item == null ? null : item.getBean(); }
/** * Gets the group. * * @return the group */ public Group getGroup() { return groupEditor.getItemDataSource().getBean(); }
/** * Gets the resource type. * * @param resourceTypeId the resourceType ID (the Item ID associated with the container) * @return the resource type */ public ResourceType getResourceType(Object resourceTypeId) { return container.getItem(resourceTypeId).getBean(); }
/** * Gets the resource type. * * @return the resource type */ public ResourceType getResourceType() { return resourceTypeEditor.getItemDataSource().getBean(); }
/** * Gets the SNMP collection. * * @param snmpCollectionId the SNMP collection ID (the Item ID associated with the container) * @return the SNMP collection */ public SnmpCollection getSnmpCollection(Object snmpCollectionId) { return container.getItem(snmpCollectionId).getBean(); }
/** * Gets the event. * * @return the OpenNMS event */ public org.opennms.netmgt.xml.eventconf.Event getEvent() { return eventEditor.getItemDataSource().getBean(); }
/** * Gets the SNMP Collection. * * @return the SNMP Collection */ public SnmpCollection getSnmpCollection() { return snmpCollectionEditor.getItemDataSource().getBean(); }
/** * Gets the system definition. * * @return the system definition */ public SystemDef getSystemDef() { return systemDefEditor.getItemDataSource().getBean(); }
/** * Gets the group. * * @param groupId the group ID (the Item ID associated with the container) * @return the event */ public Group getGroup(Object groupId) { return container.getItem(groupId).getBean(); }
@Override public Object generateCell(Table source, Object itemId, Object columnId) { return container.getItem(itemId).getBean().getMibObjs().size(); } });
public PingRequest getPingRequest() throws FieldGroup.CommitException { binder.commit(); // we must commit before to ensure there are no errors return item.getBean() .withRetries(0); }
/** * Adds a nested property to the item. The property must not exist in the * item already and must of form "field1.field2" where field2 is a field in * the object referenced to by field1. If an intermediate property returns * null, the property will return a null value * * @param nestedPropertyId * property id to add. */ public void addNestedProperty(String nestedPropertyId) { addItemProperty(nestedPropertyId, new NestedMethodProperty<Object>(getBean(), nestedPropertyId)); }
@Override public Object generateCell(Table source, Object itemId, Object columnId) { final SystemDef s = container.getItem(itemId).getBean(); return s.getCollect() == null ? 0 : s.getCollect().getIncludeGroups().size(); } });
private void applyExpandState(com.google.common.collect.Table<Long, Optional<Long>, Boolean> collapseState, List<BusinessServiceRow> rows) { for (BusinessServiceRow row : rows) { Boolean wasCollapsed = collapseState.get(row.getBusinessService().getId(), Optional.ofNullable(row.getParentBusinessServiceId())); setCollapsed(row.getRowId(), wasCollapsed != null ? wasCollapsed : true); // Collapse by default if (hasChildren(row.getRowId())) { applyExpandState(collapseState, getChildren(row.getRowId()).stream() .map(itemId -> getItem(itemId).getBean()) .collect(Collectors.toList())); } } }
private com.google.common.collect.Table<Long, Optional<Long>, Boolean> getCurrentExpandState() { // Gather the current collapse state final com.google.common.collect.Table<Long, Optional<Long>, Boolean> collapseState = HashBasedTable.create(); for (Object itemId : getItemIds()) { final BusinessServiceRow row = getItem(itemId).getBean(); collapseState.put(row.getBusinessService().getId(), Optional.ofNullable(row.getParentBusinessServiceId()), isCollapsed(itemId)); } return collapseState; }
@Override public Object generateCell(Table source, Object itemId, Object columnId) { final SystemDef s = container.getItem(itemId).getBean(); final String value = s.getSysoid() == null ? s.getSysoidMask() : s.getSysoid(); return value == null ? "N/A" : value; } });
@Override public void onFieldGroupChange(MBeanFieldGroup beanFieldGroup) { if (beanFieldGroup.getItemDataSource().getBean() == newInstance) { if (!getFieldGroupFor(newInstance).valueEditor.isValid()) { return; } getAndEnsureValue().put(newInstance, null); fireEvent(new ElementAddedEvent(MapField.this, newInstance)); setPersisted(newInstance, true); onElementAdded(); } // TODO could optimize for only repainting on changed validity fireValueChange(false); } };
@Override public void onFieldGroupChange(MBeanFieldGroup beanFieldGroup) { if (beanFieldGroup.getItemDataSource().getBean() == newInstance) { if (!getFieldGroupFor(newInstance).isValid()) { return; } getAndEnsureValue().add(newInstance); fireEvent(new ElementAddedEvent(AbstractElementCollection.this, newInstance)); setPersisted(newInstance, true); onElementAdded(); } // TODO could optimize for only repainting on changed validity fireValueChange(false); } };
@Override protected StorageStrategy getInternalValue() { StorageStrategy strategy = new StorageStrategy(); if (combo.getValue() != null) { strategy.setClazz((String) combo.getValue()); } for (Object itemId: container.getItemIds()) { strategy.addParameter(container.getItem(itemId).getBean()); } return strategy; }
@Override protected PersistenceSelectorStrategy getInternalValue() { PersistenceSelectorStrategy strategy = new PersistenceSelectorStrategy(); if (combo.getValue() != null) { strategy.setClazz((String) combo.getValue()); } for (Object itemId: container.getItemIds()) { strategy.addParameter(container.getItem(itemId).getBean()); } return strategy; }