Package org.apache.syncope.common.to

Examples of org.apache.syncope.common.to.VirtualSchemaTO


    public AbstractVirSchema update(final VirtualSchemaTO virSchemaTO, final AbstractVirSchema virSchema) {
        return populate(virSchema, virSchemaTO);
    }

    public <T extends AbstractVirSchema> VirtualSchemaTO getVirtualSchemaTO(final T virSchema) {
        VirtualSchemaTO virtualSchemaTO = new VirtualSchemaTO();
        BeanUtils.copyProperties(virSchema, virtualSchemaTO);

        return virtualSchemaTO;
    }
View Full Code Here


        AbstractVirSchema virSchema = virSchemaDAO.find(virtualSchemaName, reference);
        if (virSchema == null) {
            throw new NotFoundException("Virtual schema '" + virtualSchemaName + "'");
        }

        VirtualSchemaTO schemaToDelete = binder.getVirtualSchemaTO(virSchema);
        virSchemaDAO.delete(virtualSchemaName, getAttributableUtil(kind));

        auditManager.audit(Category.schema, SchemaSubCategory.deleteVirtual, Result.success,
                "Successfully deleted virtual schema: " + kind + "/" + virSchema.getName());
        return schemaToDelete;
View Full Code Here

        }
    }

    @Test
    public void read() {
        VirtualSchemaTO vSchemaTO = schemaService.read(AttributableType.MEMBERSHIP, SchemaType.VIRTUAL,
                "mvirtualdata");
        assertNotNull(vSchemaTO);
    }
View Full Code Here

        assertNotNull(vSchemaTO);
    }

    @Test
    public void create() {
        VirtualSchemaTO schema = new VirtualSchemaTO();
        schema.setName("virtual");

        Response response = createSchema(AttributableType.USER, SchemaType.VIRTUAL, schema);
        VirtualSchemaTO actual = getObject(response, VirtualSchemaTO.class, schemaService);
        assertNotNull(actual);

        actual = schemaService.read(AttributableType.USER, SchemaType.VIRTUAL, actual.getName());
        assertNotNull(actual);
    }
View Full Code Here

        assertNotNull(actual);
    }

    @Test
    public void delete() {
        VirtualSchemaTO schema = schemaService.read(AttributableType.ROLE, SchemaType.VIRTUAL,
                "rvirtualdata");
        assertNotNull(schema);

        schemaService.delete(AttributableType.ROLE, SchemaType.VIRTUAL,
                schema.getName());

        Throwable t = null;
        try {
            schemaService.read(AttributableType.ROLE, SchemaType.VIRTUAL, "rvirtualdata");
        } catch (SyncopeClientCompositeErrorException e) {
View Full Code Here

        assertNotNull(t);
    }

    @Test
    public void issueSYNCOPE323() {
        VirtualSchemaTO actual = schemaService.read(AttributableType.MEMBERSHIP, SchemaType.VIRTUAL, "mvirtualdata");
        assertNotNull(actual);

        try {
            createSchema(AttributableType.MEMBERSHIP, SchemaType.VIRTUAL, actual);
            fail();
        } catch (SyncopeClientCompositeErrorException scce) {
            assertEquals(HttpStatus.CONFLICT, scce.getStatusCode());
            assertTrue(scce.hasException(SyncopeClientExceptionType.EntityExists));
        }

        actual.setName(null);
        try {
            createSchema(AttributableType.MEMBERSHIP, SchemaType.VIRTUAL, actual);
            fail();
        } catch (SyncopeClientCompositeErrorException scce) {
            assertEquals(HttpStatus.BAD_REQUEST, scce.getStatusCode());
View Full Code Here

     * Delete an already existent user virtual schema by its name.
     *
     * @param name (e.g.:surname)
     */
    public VirtualSchemaTO deleteVirtualSchema(final AttributableType type, final String name) {
        VirtualSchemaTO schemaTO = getService(SchemaService.class).read(type, SchemaType.VIRTUAL, name);
        getService(SchemaService.class).delete(type, SchemaType.VIRTUAL, name);
        return schemaTO;
    }
View Full Code Here

    @Override
    public void setSchemaModalPage(final PageReference pageRef, final ModalWindow window,
            AbstractBaseBean schema, final boolean createFlag) {

        if (schema == null) {
            schema = new VirtualSchemaTO();
        }

        final Form schemaForm = new Form("form");

        schemaForm.setModel(new CompoundPropertyModel(schema));

        final AjaxTextFieldPanel name = new AjaxTextFieldPanel("name", getString("name"), new PropertyModel<String>(
                schema, "name"));
        name.addRequiredLabel();

        name.setEnabled(createFlag);

        final AjaxCheckBoxPanel readonly = new AjaxCheckBoxPanel("readonly", getString("readonly"),
                new PropertyModel<Boolean>(schema, "readonly"));

        final AjaxButton submit = new IndicatingAjaxButton("apply", new ResourceModel("submit")) {

            private static final long serialVersionUID = -958724007591692537L;

            @Override
            protected void onSubmit(final AjaxRequestTarget target, final Form form) {
                VirtualSchemaTO schemaTO = (VirtualSchemaTO) form.getDefaultModelObject();
                try {
                    if (createFlag) {
                        restClient.createVirtualSchema(kind, schemaTO);
                    } else {
                        restClient.updateVirtualSchema(kind, schemaTO);
View Full Code Here

                if (attributeTO.getValues().isEmpty()) {
                    attributeTO.addValue("");
                }

                if (attributeTO.getSchema() != null) {
                    VirtualSchemaTO attributeSchema = schemas.getObject().get(attributeTO.getSchema());
                    if (attributeSchema != null) {
                        attributeTO.setReadonly(attributeSchema.isReadonly());
                    }
                }

                final AjaxTextFieldPanel panel;
                final MultiValueSelectorPanel multiPanel;
                if (templateMode) {
                    panel = new AjaxTextFieldPanel("values", "values", new Model<String>());
                    panel.setReadOnly(attributeTO.isReadonly());
                    multiPanel = null;
                } else {
                    panel = new AjaxTextFieldPanel("panel", "values", new Model<String>(null));
                    panel.setReadOnly(attributeTO.isReadonly());
                    multiPanel = new MultiValueSelectorPanel("values", new PropertyModel<List<String>>(attributeTO,
                            "values"), panel);
                }

                final DropDownChoice<String> schemaChoice = new DropDownChoice<String>("schema",
                        new PropertyModel<String>(attributeTO, "schema"), virtualSchemaNames,
                        new ChoiceRenderer<String>() {

                    private static final long serialVersionUID = 3109256773218160485L;

                    @Override
                    public Object getDisplayValue(final String object) {
                        final StringBuilder text = new StringBuilder(object);
                        if (templateMode) {
                            text.append(" (JEXL)");
                        }
                        return text.toString();
                    }
                });

                schemaChoice.add(new AjaxFormComponentUpdatingBehavior("onblur") {

                    private static final long serialVersionUID = -1107858522700306810L;

                    @Override
                    protected void onUpdate(final AjaxRequestTarget target) {

                        attributeTO.setSchema(schemaChoice.getModelObject());

                        VirtualSchemaTO attributeSchema =
                                schemas.getObject().get(attributeTO.getSchema());
                        if (attributeSchema != null) {
                            attributeTO.setReadonly(attributeSchema.isReadonly());
                            panel.setReadOnly(attributeTO.isReadonly());
                        }

                        if (multiPanel != null) {
                            multiPanel.getView().setEnabled(false);
View Full Code Here

        AbstractVirSchema virSchema = virSchemaDAO.find(virtualSchemaName, reference);
        if (virSchema == null) {
            throw new NotFoundException("Virtual schema '" + virtualSchemaName + "'");
        }

        VirtualSchemaTO schemaToDelete = binder.getVirtualSchemaTO(virSchema);
        virSchemaDAO.delete(virtualSchemaName, getAttributableUtil(kind));
        return schemaToDelete;
    }
View Full Code Here

TOP

Related Classes of org.apache.syncope.common.to.VirtualSchemaTO

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.