Package org.apache.isis.core.metamodel.facets.object.encodeable

Examples of org.apache.isis.core.metamodel.facets.object.encodeable.EncodableFacet


                    isisMetaModel.setAttributesForValue(xmlValueElement, valueNos.getShortIdentifier());

                    // return parsed string, else encoded string, else title.
                    String valueStr;
                    final ParseableFacet parseableFacet = fieldNos.getFacet(ParseableFacet.class);
                    final EncodableFacet encodeableFacet = fieldNos.getFacet(EncodableFacet.class);
                    if (parseableFacet != null) {
                        valueStr = parseableFacet.parseableTitle(value);
                    } else if (encodeableFacet != null) {
                        valueStr = encodeableFacet.toEncodedString(value);
                    } else {
                        valueStr = value.titleString();
                    }

                    final boolean notEmpty = (valueStr.length() > 0);
View Full Code Here


    }

    @Test
    public void testSetValue() {
        final TestProxySpecification specf = system.getSpecification(String.class);
        specf.addFacet(new EncodableFacet() {
            @Override
            public String toEncodedString(final ObjectAdapter object) {
                return null;
            }
View Full Code Here

        Assert.assertNotNull(adapter);
        return (ReferenceData) serializeObject2(adapter, depth, knownObjects);
    }

    public final EncodableObjectData serializeEncodeable(final ObjectAdapter adapter) {
        final EncodableFacet facet = adapter.getSpecification().getFacet(EncodableFacet.class);
        return this.dataFactory.createValueData(adapter.getSpecification().getFullIdentifier(), facet.toEncodedString(adapter));
    }
View Full Code Here

        system.addSpecification(new MovieSpecification());
        system.addSpecification(new PersonSpecification());

        system.getSpecification(String.class).setupIsEncodeable();
        system.getSpecification(String.class).addFacet(new EncodableFacet() {

            @Override
            public String toEncodedString(final ObjectAdapter object) {
                return object.getObject().toString();
            }
View Full Code Here

    private ObjectAdapter deserializeObjectFromEncodableObjectData(final EncodableObjectData encodeableObjectData) {
        if (encodeableObjectData.getEncodedObjectData() == null) {
            return null;
        }
        final ObjectSpecification spec = getSpecificationLoader().loadSpecification(encodeableObjectData.getType());
        final EncodableFacet encoder = spec.getFacet(EncodableFacet.class);
        final ObjectAdapter adapter = encoder.fromEncodedString(encodeableObjectData.getEncodedObjectData());
        return adapter;
    }
View Full Code Here

        String value;
        if (data instanceof NullData) {
            field.initAssociation(adapter, null);
        } else {
            value = ((EncodableObjectData) data).getEncodedObjectData();
            final EncodableFacet encoder = field.getSpecification().getFacet(EncodableFacet.class);
            final ObjectAdapter valueAdapter = encoder.fromEncodedString(value);
            if (LOG.isDebugEnabled()) {
                LOG.debug("setting value for field " + field.getId() + ": " + valueAdapter);
            }
            field.initAssociation(adapter, valueAdapter);
        }
View Full Code Here

        Assert.assertNotNull(obj);
        return obj;
    }

    private ObjectAdapter restoreLeafObject(final String encodedObject, final ObjectSpecification specification) {
        final EncodableFacet encoder = specification.getFacet(EncodableFacet.class);
        if (encoder == null) {
            throw new IsisException("No encoder for " + specification.getFullIdentifier());
        }
        final ObjectAdapter object = encoder.fromEncodedString(encodedObject);
        return object;
    }
View Full Code Here

            return o;
        } else if (o instanceof Boolean) {
            return o;
        } else {
            if (columnType().contains("CHAR")) {
                final EncodableFacet facet = value.getSpecification().getFacet(EncodableFacet.class);
                final String encodedString = facet.toEncodedString(value);
                return encodedString;
            } else {
                return o;
            }
        }
View Full Code Here

    public ObjectAdapter setFromDBColumn(final Results results, final String columnName, final ObjectAssociation field) {
        final String encodedValue = results.getString(columnName);
        if (encodedValue == null) {
            return null;
        }
        final EncodableFacet facet = field.getSpecification().getFacet(EncodableFacet.class);
        return facet.fromEncodedString(encodedValue);
    }
View Full Code Here

    private final OneToOneAssociation value;
    private final ObjectAdapter object;
    private final String oldValue;

    public SetValueCommand(final ObjectAdapter object, final OneToOneAssociation value) {
        final EncodableFacet facet = value.getFacet(EncodableFacet.class);
        this.oldValue = facet.toEncodedString(object);
        this.object = object;
        this.value = value;

        this.description = "reset the value to " + oldValue;
    }
View Full Code Here

TOP

Related Classes of org.apache.isis.core.metamodel.facets.object.encodeable.EncodableFacet

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.