@JsonIgnore public Optional<TypeExtensionTO> getTypeExtension(final String anyType) { return typeExtensions.stream().filter( typeExtension -> anyType != null && anyType.equals(typeExtension.getAnyType())). findFirst(); }
@Override public TypeExtensionTO getTypeExtensionTO(final TypeExtension typeExt) { TypeExtensionTO typeExtTO = new TypeExtensionTO(); typeExtTO.setAnyType(typeExt.getAnyType().getKey()); typeExtTO.getAuxClasses().addAll( typeExt.getAuxClasses().stream().map(Entity::getKey).collect(Collectors.toList())); return typeExtTO; }
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); for (String name : typeExtTO.getAuxClasses()) { AnyTypeClass anyTypeClass = anyTypeClassDAO.find(name); if (anyTypeClass == null) { removeIf(anyTypeClass -> !typeExtTO.getAuxClasses().contains(anyTypeClass.getKey()));
protected List<String> getMembershipAuxClasses(final MembershipTO membershipTO, final String anyType) { try { final GroupTO groupTO = groupRestClient.read(membershipTO.getGroupKey()); return groupTO.getTypeExtension(anyType).get().getAuxClasses(); } catch (Exception e) { return Collections.emptyList(); } }
protected TypeExtensionDirectoryPanel( final BaseModal<Serializable> baseModal, final GroupTO groupTO, final PageReference pageRef) { super(BaseModal.CONTENT_ID, pageRef, false); this.baseModal = baseModal; this.groupTO = groupTO; TypeExtensionWizardBuilder builder = new TypeExtensionWizardBuilder( groupTO, new TypeExtensionTO(), new StringResourceModel("anyType", this).getObject(), new StringResourceModel("auxClasses", this).getObject(), pageRef); this.addNewItemPanelBuilder(builder, true); setShowResultPage(false); initResultTable(); }
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); group.add(typeExt); typeExtTO.getAuxClasses().forEach(name -> { AnyTypeClass anyTypeClass = anyTypeClassDAO.find(name); if (anyTypeClass == null) {
TypeExtensionTO typeExt = SyncopeEnduserSession.get(). getService(SyncopeService.class).readUserTypeExtension(group); classes = typeExt.getAuxClasses(); } catch (Exception e) { LOG.error("Could not read User type extension for Group {}", group);
@JsonIgnore public Optional<TypeExtensionTO> getTypeExtension(final String anyType) { return typeExtensions.stream().filter( typeExtension -> anyType != null && anyType.equals(typeExtension.getAnyType())). findFirst(); }
TypeExtensionTO typeExt = SyncopeEnduserSession.get(). getService(SyncopeService.class).readUserTypeExtension(group); classes = typeExt.getAuxClasses(); } catch (Exception e) { LOG.error("Could not read User type extension for Group {}", group);
@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)); } }