static List<TagCreate> mapTagFromRequest(final EntityFactory entityFactory, final Collection<MgmtTagRequestBodyPut> tags) { return tags.stream() .map(tagRest -> entityFactory.tag().create().name(tagRest.getName()) .description(tagRest.getDescription()).colour(tagRest.getColour())) .collect(Collectors.toList()); }
/** * Creates {@link DistributionSetTag}s in repository. * * @param number * of {@link DistributionSetTag}s * * @return the persisted {@link DistributionSetTag}s */ public List<DistributionSetTag> createDistributionSetTags(final int number) { final List<TagCreate> result = Lists.newArrayListWithExpectedSize(number); for (int i = 0; i < number; i++) { result.add( entityFactory.tag().create().name("tag" + i).description("tagdesc" + i).colour(String.valueOf(i))); } return distributionSetTagManagement.create(result); }
@Override public ResponseEntity<MgmtTag> updateTargetTag(@PathVariable("targetTagId") final Long targetTagId, @RequestBody final MgmtTagRequestBodyPut restTargetTagRest) { LOG.debug("update {} target tag", restTargetTagRest); final TargetTag updateTargetTag = tagManagement .update(entityFactory.tag().update(targetTagId).name(restTargetTagRest.getName()) .description(restTargetTagRest.getDescription()).colour(restTargetTagRest.getColour())); LOG.debug("target tag updated"); final MgmtTag response = MgmtTagMapper.toResponse(updateTargetTag); MgmtTagMapper.addLinks(updateTargetTag, response); return ResponseEntity.ok(response); }
@Override public ResponseEntity<MgmtTag> updateDistributionSetTag( @PathVariable("distributionsetTagId") final Long distributionsetTagId, @RequestBody final MgmtTagRequestBodyPut restDSTagRest) { final DistributionSetTag distributionSetTag = distributionSetTagManagement .update(entityFactory.tag().update(distributionsetTagId).name(restDSTagRest.getName()) .description(restDSTagRest.getDescription()).colour(restDSTagRest.getColour())); final MgmtTag response = MgmtTagMapper.toResponse(distributionSetTag); MgmtTagMapper.addLinks(distributionSetTag, response); return ResponseEntity.ok(response); }
TargetTagFilterButtons(final UIEventBus eventBus, final ManagementUIState managementUIState, final ManagementViewClientCriterion managementViewClientCriterion, final VaadinMessageSource i18n, final UINotification notification, final SpPermissionChecker permChecker, final EntityFactory entityFactory, final TargetTagManagement targetTagManagement) { super(eventBus, new TargetTagFilterButtonClick(eventBus, managementUIState), i18n); this.managementUIState = managementUIState; this.managementViewClientCriterion = managementViewClientCriterion; this.uiNotification = notification; this.permChecker = permChecker; this.entityFactory = entityFactory; this.targetTagManagement = targetTagManagement; addNewTargetTag(entityFactory.tag().create().name(getNoTagLabel()).build()); }
TargetTagFilterButtons(final UIEventBus eventBus, final ManagementUIState managementUIState, final ManagementViewClientCriterion managementViewClientCriterion, final VaadinMessageSource i18n, final UINotification notification, final SpPermissionChecker permChecker, final EntityFactory entityFactory, final TargetTagManagement targetTagManagement) { super(eventBus, new TargetTagFilterButtonClick(eventBus, managementUIState), i18n); this.managementUIState = managementUIState; this.managementViewClientCriterion = managementViewClientCriterion; this.uiNotification = notification; this.permChecker = permChecker; this.entityFactory = entityFactory; this.targetTagManagement = targetTagManagement; addNewTargetTag(entityFactory.tag().create().name(getNoTagLabel()).build()); }
private TargetTag createTargetTagEntitiy(final String name) { final TargetTag updateTargetTag = targetTagManagement.create(entityFactory.tag().create().name(name)); return targetTagManagement.update(entityFactory.tag().update(updateTargetTag.getId()) .description("My name is " + name).colour("default")); }
@Override public void refreshTable() { removeGeneratedColumn(FILTER_BUTTON_COLUMN); ((LazyQueryContainer) getContainerDataSource()).refresh(); removeUpdateAndDeleteColumn(); addNewTargetTag(entityFactory.tag().create().name(getNoTagLabel()).build()); addColumn(); }
@Override public void refreshTable() { removeGeneratedColumn(FILTER_BUTTON_COLUMN); ((LazyQueryContainer) getContainerDataSource()).refresh(); removeUpdateAndDeleteColumn(); addNewTargetTag(entityFactory.tag().create().name(getNoTagLabel()).build()); addColumn(); }
@Override public void refreshTable() { ((LazyQueryContainer) getContainerDataSource()).refresh(); removeGeneratedColumn(FILTER_BUTTON_COLUMN); removeUpdateAndDeleteColumn(); addNewTag(entityFactory.tag().create().name(getNoTagLabel()).build()); addColumn(); }
@Override public void refreshTable() { ((LazyQueryContainer) getContainerDataSource()).refresh(); removeGeneratedColumn(FILTER_BUTTON_COLUMN); removeUpdateAndDeleteColumn(); addNewTag(entityFactory.tag().create().name(getNoTagLabel()).build()); addColumn(); }
private DistributionSetTag createDistributionSetTag() { final DistributionSetTag updateTag = distributionSetTagManagement .create(entityFactory.tag().create().name("DsTag")); return distributionSetTagManagement.update(entityFactory.tag().update(updateTag.getId()) .description("My name is " + updateTag.getName()).colour("default")); }
private void createNewTag() { if (!StringUtils.isEmpty(getTagName().getValue())) { setColorPicked(ColorPickerHelper.getColorPickedString(getColorPickerLayout().getSelPreview())); String colour = ColorPickerConstants.START_COLOR.getCSS(); if (!StringUtils.isEmpty(getColorPicked())) { colour = getColorPicked(); } final TargetTag newTargetTag = getTargetTagManagement().create(getEntityFactory().tag().create() .name(getTagName().getValue()).description(getTagDesc().getValue()).colour(colour)); getEventBus().publish(this, new TargetTagTableEvent(BaseEntityEventType.ADD_ENTITY, newTargetTag)); displaySuccess(newTargetTag.getName()); } else { displayValidationError(getI18n().getMessage(getMessageErrorMissingTagname())); } }
private void createNewTag() { if (!StringUtils.isEmpty(getTagName().getValue())) { setColorPicked(ColorPickerHelper.getColorPickedString(getColorPickerLayout().getSelPreview())); String colour = ColorPickerConstants.START_COLOR.getCSS(); if (!StringUtils.isEmpty(getColorPicked())) { colour = getColorPicked(); } final DistributionSetTag newDistTag = getDistributionSetTagManagement().create(getEntityFactory().tag() .create().name(getTagName().getValue()).description(getTagDesc().getValue()).colour(colour)); getEventBus().publish(this, new DistributionSetTagTableEvent(BaseEntityEventType.ADD_ENTITY, newDistTag)); displaySuccess(newDistTag.getName()); } else { displayValidationError(getI18n().getMessage(getMessageErrorMissingTagname())); } }
private void createNewTag() { if (!StringUtils.isEmpty(getTagName().getValue())) { setColorPicked(ColorPickerHelper.getColorPickedString(getColorPickerLayout().getSelPreview())); String colour = ColorPickerConstants.START_COLOR.getCSS(); if (!StringUtils.isEmpty(getColorPicked())) { colour = getColorPicked(); } final DistributionSetTag newDistTag = getDistributionSetTagManagement().create(getEntityFactory().tag() .create().name(getTagName().getValue()).description(getTagDesc().getValue()).colour(colour)); getEventBus().publish(this, new DistributionSetTagTableEvent(BaseEntityEventType.ADD_ENTITY, newDistTag)); displaySuccess(newDistTag.getName()); } else { displayValidationError(getI18n().getMessage(getMessageErrorMissingTagname())); } }
private void createNewTag() { if (!StringUtils.isEmpty(getTagName().getValue())) { setColorPicked(ColorPickerHelper.getColorPickedString(getColorPickerLayout().getSelPreview())); String colour = ColorPickerConstants.START_COLOR.getCSS(); if (!StringUtils.isEmpty(getColorPicked())) { colour = getColorPicked(); } final TargetTag newTargetTag = getTargetTagManagement().create(getEntityFactory().tag().create() .name(getTagName().getValue()).description(getTagDesc().getValue()).colour(colour)); getEventBus().publish(this, new TargetTagTableEvent(BaseEntityEventType.ADD_ENTITY, newTargetTag)); displaySuccess(newTargetTag.getName()); } else { displayValidationError(getI18n().getMessage(getMessageErrorMissingTagname())); } }
private void updateExistingTag(final Tag targetObj) { final TagUpdate update = getEntityFactory().tag().update(targetObj.getId()).name(getTagName().getValue()) .description(getTagDesc().getValue()) .colour(ColorPickerHelper.getColorPickedString(getColorPickerLayout().getSelPreview())); getTargetTagManagement().update(update); getEventBus().publish(this, new TargetTagTableEvent(BaseEntityEventType.UPDATED_ENTITY, (TargetTag) targetObj)); getUiNotification().displaySuccess(getI18n().getMessage("message.update.success", targetObj.getName())); }
private void updateExistingTag(final Tag targetObj) { final TagUpdate update = getEntityFactory().tag().update(targetObj.getId()).name(getTagName().getValue()) .description(getTagDesc().getValue()) .colour(ColorPickerHelper.getColorPickedString(getColorPickerLayout().getSelPreview())); getDistributionSetTagManagement().update(update); getEventBus().publish(this, new DistributionSetTagTableEvent(BaseEntityEventType.UPDATED_ENTITY, (DistributionSetTag) targetObj)); getUiNotification().displaySuccess(getI18n().getMessage("message.update.success", targetObj.getName())); }
private void updateExistingTag(final Tag targetObj) { final TagUpdate update = getEntityFactory().tag().update(targetObj.getId()).name(getTagName().getValue()) .description(getTagDesc().getValue()) .colour(ColorPickerHelper.getColorPickedString(getColorPickerLayout().getSelPreview())); getTargetTagManagement().update(update); getEventBus().publish(this, new TargetTagTableEvent(BaseEntityEventType.UPDATED_ENTITY, (TargetTag) targetObj)); getUiNotification().displaySuccess(getI18n().getMessage("message.update.success", targetObj.getName())); }
private void updateExistingTag(final Tag targetObj) { final TagUpdate update = getEntityFactory().tag().update(targetObj.getId()).name(getTagName().getValue()) .description(getTagDesc().getValue()) .colour(ColorPickerHelper.getColorPickedString(getColorPickerLayout().getSelPreview())); getDistributionSetTagManagement().update(update); getEventBus().publish(this, new DistributionSetTagTableEvent(BaseEntityEventType.UPDATED_ENTITY, (DistributionSetTag) targetObj)); getUiNotification().displaySuccess(getI18n().getMessage("message.update.success", targetObj.getName())); }