@JsonIgnore public Optional<TypeExtensionTO> getTypeExtension(final String anyType) { return typeExtensions.stream().filter( typeExtension -> anyType != null && anyType.equals(typeExtension.getAnyType())). findFirst(); }
@JsonIgnore public Optional<TypeExtensionTO> getTypeExtension(final String anyType) { return typeExtensions.stream().filter( typeExtension -> anyType != null && anyType.equals(typeExtension.getAnyType())). findFirst(); }
@JsonIgnore public Optional<TypeExtensionTO> getTypeExtension(final String anyType) { return typeExtensions.stream().filter( typeExtension -> anyType != null && anyType.equals(typeExtension.getAnyType())).findFirst(); }
@JsonIgnore public Optional<TypeExtensionTO> getTypeExtension(final String anyType) { return typeExtensions.stream().filter( typeExtension -> anyType != null && anyType.equals(typeExtension.getAnyType())).findFirst(); }
@Override protected Serializable onApplyInternal(final TypeExtensionTO modelObject) { List<TypeExtensionTO> typeExtensions = groupTO.getTypeExtensions().stream(). filter(typeExt -> !typeExt.getAnyType().equals(modelObject.getAnyType())).collect(Collectors.toList()); typeExtensions.add(modelObject); groupTO.getTypeExtensions().clear(); groupTO.getTypeExtensions().addAll(typeExtensions); return groupTO; }
@Override public void onClick(final AjaxRequestTarget target, final TypeExtensionTO ignore) { groupTO.getTypeExtension(typeExtension.getAnyType()).ifPresent(typeExt -> { groupTO.getTypeExtensions().remove(typeExt); target.add(container); }); } }, ActionLink.ActionType.DELETE, StringUtils.EMPTY, true);
public Details(final TypeExtensionTO typeExtensionTO) { super(); setOutputMarkupId(true); add(new Label("anyType.label", anyTypeLabel)); if (typeExtensionTO.getAnyType() == null) { List<String> anyTypes = new AnyTypeRestClient().list(); anyTypes.remove(AnyTypeKind.GROUP.name()); anyTypes.removeAll(anyTypes.stream(). filter(anyType -> groupTO.getTypeExtension(anyType).isPresent()).collect(Collectors.toList())); AjaxDropDownChoicePanel<String> anyTypeComponent = new AjaxDropDownChoicePanel<>( "anyType.component", "anyType", new PropertyModel<>(typeExtensionTO, "anyType")); anyTypeComponent.setChoices(anyTypes); anyTypeComponent.addRequiredLabel(); add(anyTypeComponent.hideLabel().setOutputMarkupId(true)); } else { AjaxTextFieldPanel anyTypeComponent = new AjaxTextFieldPanel( "anyType.component", "anyType", new PropertyModel<>(typeExtensionTO, "anyType")); anyTypeComponent.setEnabled(false); add(anyTypeComponent.hideLabel()); } add(new Label("auxClasses.label", auxClassesLabel)); List<String> anyTypeClasses = new AnyTypeClassRestClient().list().stream(). map(EntityTO::getKey).collect(Collectors.toList()); AjaxPalettePanel<String> auxClassesPalette = new AjaxPalettePanel.Builder<String>().build( "auxClasses.palette", new PropertyModel<List<String>>(typeExtensionTO, "auxClasses"), new ListModel<>(anyTypeClasses)); add(auxClassesPalette.hideLabel().setOutputMarkupId(true)); } }
AnyType anyType = anyTypeDAO.find(typeExtTO.getAnyType()); if (anyType == null) { LOG.warn("Ignoring invalid {}: {}", AnyType.class.getSimpleName(), typeExtTO.getAnyType()); } else { TypeExtension typeExt = group.getTypeExtension(anyType).orElse(null);
AnyType anyType = anyTypeDAO.find(typeExtTO.getAnyType()); if (anyType == null) { LOG.warn("Ignoring invalid {}: {}", AnyType.class.getSimpleName(), typeExtTO.getAnyType()); } else { TypeExtension typeExt = entityFactory.newEntity(TypeExtension.class);