Examples of AttributeTO


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

     */
    public ConnObjectTO getConnObjectTO(final ConnectorObject connObject) {
        final ConnObjectTO connObjectTO = new ConnObjectTO();

        for (Attribute attr : connObject.getAttributes()) {
            AttributeTO attrTO = new AttributeTO();
            attrTO.setSchema(attr.getName());

            if (attr.getValue() != null) {
                for (Object value : attr.getValue()) {
                    if (value != null) {
                        if (value instanceof GuardedString || value instanceof GuardedByteArray) {
                            attrTO.addValue(getPassword(value));
                        } else {
                            attrTO.addValue(value.toString());
                        }
                    }
                }
            }

View Full Code Here

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

            }
        }
    }

    private AttributeTO evaluateAttrTemplate(final AbstractAttributableTO attributableTO, final AttributeTO template) {
        AttributeTO result = new AttributeTO();
        result.setSchema(template.getSchema());

        if (template.getValues() != null && !template.getValues().isEmpty()) {
            for (String value : template.getValues()) {
                String evaluated = jexlUtil.evaluate(value, attributableTO);
                if (StringUtils.isNotBlank(evaluated)) {
                    result.addValue(evaluated);
                }
            }
        }

        return result;
View Full Code Here

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

            private static final long serialVersionUID = -4804368561204623354L;

            @Override
            protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
                entityTO.addVirtualAttribute(new AttributeTO());
                target.add(attributesContainer);
            }

            @Override
            protected void onError(final AjaxRequestTarget target, final Form<?> form) {
                target.add(attributesContainer);
            }
        };

        add(addAttributeBtn.setDefaultFormProcessing(Boolean.FALSE));

        ListView<AttributeTO> attributes = new ListView<AttributeTO>("attributes",
                new PropertyModel<List<? extends AttributeTO>>(entityTO, "virtualAttributes")) {

            private static final long serialVersionUID = 9101744072914090143L;

            @Override
            protected void populateItem(final ListItem<AttributeTO> item) {
                final AttributeTO attributeTO = item.getModelObject();

                item.add(new AjaxDecoratedCheckbox("toRemove", new Model<Boolean>(Boolean.FALSE)) {

                    private static final long serialVersionUID = 7170946748485726506L;

                    @Override
                    protected void onUpdate(final AjaxRequestTarget target) {
                        entityTO.removeVirtualAttribute(attributeTO);
                        target.add(attributesContainer);
                    }

                    @Override
                    protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
                        super.updateAjaxAttributes(attributes);

                        final AjaxCallListener ajaxCallListener = new AjaxCallListener() {

                            private static final long serialVersionUID = 7160235486520935153L;

                            @Override
                            public CharSequence getPrecondition(final Component component) {
                                return "if (!confirm('" + getString("confirmDelete") + "')) return false;";
                            }
                        };
                        attributes.getAjaxCallListeners().add(ajaxCallListener);
                    }
                });

                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

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

                }
                schema = provider.getSort().getProperty().substring(hashPos + 1);
            }


            final AttributeTO attr;
            if (schemaType == null) {
                attr = this.attrs.get(schema);
            } else {
                switch (schemaType) {
                    case NORMAL:
                    default:
                        attr = this.attrs.get(schema);
                        break;

                    case DERIVED:
                        attr = this.derAttrs.get(schema);
                        break;

                    case VIRTUAL:
                        attr = this.virAttrs.get(schema);
                        break;
                }
            }

            Comparable result = null;

            List<String> values = attr == null ? null : attr.getValues();
            if (values != null && !values.isEmpty()) {
                result = values.iterator().next();
            }

            return result;
View Full Code Here

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

    private Boolean isEnabled(final ConnObjectTO objectTO) {
        final String STATUSATTR = "__ENABLE__";

        final Map<String, AttributeTO> attributeTOs = objectTO.getAttributeMap();

        final AttributeTO status = attributeTOs.get(STATUSATTR);

        return status != null && status.getValues() != null && !status.getValues().isEmpty()
                ? Boolean.parseBoolean(status.getValues().get(0))
                : null;
    }
View Full Code Here

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

        final Map<String, AttributeTO> attributeTOs = objectTO == null
                ? Collections.<String, AttributeTO>emptyMap()
                : objectTO.getAttributeMap();

        final AttributeTO name = attributeTOs.get(NAME);

        return name != null && name.getValues() != null && !name.getValues().isEmpty()
                ? name.getValues().get(0)
                : null;
    }
View Full Code Here

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

        for (String attrName : attrsToBeRemoved) {
            rwattrs.remove(attrName);
        }
        for (AttributeMod attrMod : attrsToBeUpdated) {
            if (rwattrs.containsKey(attrMod.getSchema())) {
                AttributeTO attrTO = rwattrs.get(attrMod.getSchema());
                attrTO.getValues().removeAll(attrMod.getValuesToBeRemoved());
                attrTO.getValues().addAll(attrMod.getValuesToBeAdded());
            } else {
                AttributeTO attrTO = new AttributeTO();
                attrTO.setSchema(attrMod.getSchema());
                attrTO.setValues(attrMod.getValuesToBeAdded());

                rwattrs.put(attrMod.getSchema(), attrTO);
            }
        }
View Full Code Here

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

        Map<String, AttributeTO> attrs = to.getDerivedAttributeMap();
        for (String attrName : mod.getDerivedAttributesToBeRemoved()) {
            attrs.remove(attrName);
        }
        for (String attrName : mod.getDerivedAttributesToBeAdded()) {
            AttributeTO attrTO = new AttributeTO();
            attrTO.setSchema(attrName);

            attrs.put(attrName, attrTO);
        }
        result.setDerivedAttributes(new ArrayList<AttributeTO>(attrs.values()));
View Full Code Here

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

        // 2. create an user with the role created above (as admin)
        UserTO userTO = UserTestITCase.getUniqueSampleTO("auth@test.org");

        MembershipTO membershipTO = new MembershipTO();
        membershipTO.setRoleId(authRoleTO.getId());
        AttributeTO testAttributeTO = new AttributeTO();
        testAttributeTO.setSchema("testAttribute");
        testAttributeTO.addValue("a value");
        membershipTO.addAttribute(testAttributeTO);
        userTO.addMembership(membershipTO);

        userTO = createUser(userTO);
        assertNotNull(userTO);
View Full Code Here

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

    public void testUserRead() {
        UserTO userTO = UserTestITCase.getUniqueSampleTO("testuserread@test.org");

        MembershipTO membershipTO = new MembershipTO();
        membershipTO.setRoleId(7L);
        AttributeTO testAttributeTO = new AttributeTO();
        testAttributeTO.setSchema("testAttribute");
        testAttributeTO.addValue("a value");
        membershipTO.addAttribute(testAttributeTO);
        userTO.addMembership(membershipTO);

        userTO = createUser(userTO);
        assertNotNull(userTO);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.