List<LoggedEntity> list = q.getResultList(); for (LoggedEntity loggedEntity : list) { if (loggedEntity.getName() == null) { throw new IllegalStateException("Unable to initialize EntityLog: empty LoggedEntity.name"); for (LoggedAttribute loggedAttribute : loggedEntity.getAttributes()) { if (loggedAttribute.getName() == null) { throw new IllegalStateException("Unable to initialize EntityLog: empty LoggedAttribute.name"); if (BooleanUtils.isTrue(loggedEntity.getAuto())) entitiesAuto.put(loggedEntity.getName(), attributes); if (BooleanUtils.isTrue(loggedEntity.getManual())) entitiesManual.put(loggedEntity.getName(), attributes);
public void create() { LoggedEntity entity = metadata.create(LoggedEntity.class); entity.setAuto(false); entity.setManual(false); setSelectAllCheckBox(false); loggedEntityDs.addItem(entity); loggedEntityTable.setEditable(true); loggedEntityTable.setSelected(entity); enableControls(); entityNameField.setEditable(true); entityNameField.focus(); }
@Override public void actionPerform(Component component) { LoggedEntity selectedEntity = loggedEntityTable.getSelected().iterator().next(); Set<LoggedAttribute> enabledAttributes = selectedEntity.getAttributes(); for (Component c : attributesBoxScroll.getComponents()) { CheckBox currentCheckBox = (CheckBox) c; if (currentCheckBox.getId().equals(SELECT_ALL_CHECK_BOX)) continue; Boolean currentCheckBoxValue = currentCheckBox.getValue(); if (currentCheckBoxValue && !isEntityHaveAttribute(currentCheckBox.getId(), enabledAttributes)) { //add attribute if checked and not exist in table LoggedAttribute newLoggedAttribute = metadata.create(LoggedAttribute.class); newLoggedAttribute.setName(currentCheckBox.getId()); newLoggedAttribute.setEntity(selectedEntity); loggedAttrDs.addItem(newLoggedAttribute); } if (!currentCheckBoxValue && isEntityHaveAttribute(currentCheckBox.getId(), enabledAttributes)) { //remove attribute if unchecked and exist in table LoggedAttribute removeAtr = getLoggedAttribute(currentCheckBox.getId(), enabledAttributes); if (removeAtr != null) loggedAttrDs.removeItem(removeAtr); } } getDsContext().commit(); loggedEntityDs.refresh(); disableControls(); loggedEntityTable.setEnabled(true); loggedEntityTable.focus(); logService.invalidateCache(); } }
fillAttributes(e.getItem().getName(), e.getItem(), false); checkAllCheckboxes(); } else {
Set<LoggedAttribute> enabledAttr = null; if (item != null) enabledAttr = item.getAttributes(); for (MetaProperty property : metaProperties) { if (allowLogProperty(property, null)) {