protected void deleteAttrs(final PlainSchema schema) { for (AnyTypeKind anyTypeKind : AnyTypeKind.values()) { AnyUtils anyUtils = anyUtilsFactory.getInstance(anyTypeKind); findAttrs(schema, anyUtils.plainAttrClass()).forEach(attr -> { plainAttrDAO.delete(attr); }); } }
events.add(new EventCategory(EventCategoryType.PUSH)); for (AnyTypeKind anyTypeKind : AnyTypeKind.values()) { resourceDAO.findAll().forEach(resource -> { EventCategory propEventCategory = new EventCategory(EventCategoryType.PROPAGATION);
@Override public PlainSchema update(final PlainSchemaTO schemaTO, final PlainSchema schema) { SyncopeClientCompositeException scce = SyncopeClientException.buildComposite(); boolean hasAttrs = false; for (AnyTypeKind anyTypeKind : AnyTypeKind.values()) { AnyUtils anyUtils = anyUtilsFactory.getInstance(anyTypeKind); hasAttrs |= plainSchemaDAO.findAttrs(schema, anyUtils.plainAttrClass()).isEmpty(); } if (hasAttrs) { if (schema.getType() != schemaTO.getType()) { SyncopeClientException e = SyncopeClientException.build(ClientExceptionType.InvalidPlainSchema); e.getElements().add("Cannot change type since " + schema.getKey() + " has attributes"); scce.addException(e); } if (schema.isUniqueConstraint() != schemaTO.isUniqueConstraint()) { SyncopeClientException e = SyncopeClientException.build(ClientExceptionType.InvalidPlainSchema); e.getElements().add("Cannot alter unique contraint since " + schema.getKey() + " has attributes"); scce.addException(e); } } if (scce.hasExceptions()) { throw scce; } return fill(schema, schemaTO); }
public AnyTypeDetailsPanel(final String id, final AnyTypeTO anyTypeTO) { super(id); final WebMarkupContainer container = new WebMarkupContainer("container"); container.setOutputMarkupId(true); add(container); final Form<AnyTypeTO> form = new Form<>("form"); form.setModel(new CompoundPropertyModel<>(anyTypeTO)); container.add(form); final AjaxTextFieldPanel key = new AjaxTextFieldPanel("key", getString("key"), new PropertyModel<>(anyTypeTO, "key")); key.addRequiredLabel(); key.setEnabled(key.getModelObject() == null || key.getModelObject().isEmpty()); form.add(key); final AjaxDropDownChoicePanel<AnyTypeKind> kind = new AjaxDropDownChoicePanel<>( "kind", getString("kind"), new PropertyModel<>(anyTypeTO, "kind")); kind.setChoices(Arrays.asList(AnyTypeKind.values())); kind.setOutputMarkupId(true); if (anyTypeTO.getKind() == null) { kind.setModelObject(AnyTypeKind.ANY_OBJECT); } kind.setEnabled(false); form.add(kind); form.add(new AjaxPalettePanel.Builder<String>().setAllowOrder(true).build("classes", new PropertyModel<List<String>>(anyTypeTO, "classes"), new ListModel<>(getAvailableAnyTypeClasses())).hideLabel().setOutputMarkupId(true)); }