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

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


            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 void saveEncoded(final ObjectData data, final String associationId, final ObjectAdapter associatedObject, final boolean isEmpty) {
        if (associatedObject == null || isEmpty) {
            data.saveValue(associationId, isEmpty, null);
        } else {
            final EncodableFacet facet = associatedObject.getSpecification().getFacet(EncodableFacet.class);
            final String encodedValue = facet.toEncodedString(associatedObject);
            data.saveValue(associationId, isEmpty, encodedValue);
        }
    }
View Full Code Here

            return NULL_ARG;
        }
       
        ObjectSpecification objSpec = adapter.getSpecification();
        if(objSpec.isEncodeable()) {
            EncodableFacet encodeable = objSpec.getFacet(EncodableFacet.class);
            return encodeable.toEncodedString(adapter);
        }
       
        return adapter.getOid().enStringNoVersion(getOidMarshaller());
    }
View Full Code Here

        if(NULL_ARG.equals(encoded)) {
            return null;
        }
       
        if(objSpec.isEncodeable()) {
            EncodableFacet encodeable = objSpec.getFacet(EncodableFacet.class);
            return encodeable.fromEncodedString(encoded);
        }
       
        try {
            final RootOid oid = RootOidDefault.deStringEncoded(encoded, getOidMarshaller());
            return getAdapterManager().adapterFor(oid);
View Full Code Here

        Object assocData;
        if (objectAssoc.isOneToManyAssociation()) {
            final ObjectAdapter collAdapter = objectAssoc.get(adapter);
            assocData = createCollectionData(collAdapter);
        } else if (objectAssoc.getSpecification().isEncodeable()) {
            final EncodableFacet facet = objectAssoc.getSpecification().getFacet(EncodableFacet.class);
            final ObjectAdapter value = objectAssoc.get(adapter);
            assocData = facet.toEncodedString(value);
        } else if (objectAssoc.isOneToOneAssociation()) {
            final ObjectAdapter referencedAdapter = ((OneToOneAssociation) objectAssoc).get(adapter);
            assocData = createReferenceData(referencedAdapter);
        } else {
            throw new UnknownTypeException(objectAssoc);
View Full Code Here

        if (objectAssoc.isOneToManyAssociation()) {
            updateOneToManyAssociation(objectAdapter, (OneToManyAssociation) objectAssoc, (CollectionData) fieldData);

        } else if (objectAssoc.getSpecification().containsFacet(EncodableFacet.class)) {
            final EncodableFacet facet = objectAssoc.getSpecification().getFacet(EncodableFacet.class);
            final ObjectAdapter value = facet.fromEncodedString((String) fieldData);
            ((OneToOneAssociation) objectAssoc).initAssociation(objectAdapter, value);

        } else if (objectAssoc.isOneToOneAssociation()) {
            updateOneToOneAssociation(objectAdapter, (OneToOneAssociation) objectAssoc, (Data) fieldData);
        }
View Full Code Here

                renderer.render();
            }
            return ResultType.LIST;
        }

        final EncodableFacet encodableFacet = returnType.getFacet(EncodableFacet.class);
        if (encodableFacet != null) {
            // scalar

            if(returnedAdapter != null) {
                final ScalarValueReprRenderer renderer = new ScalarValueReprRenderer(rendererContext, null, result);
View Full Code Here

                    final ObjectAdapter adapter = getAdapterManager().adapterFor(object);
                    Oid oid = adapter.getOid();
                    return oid != null? oid.enString(getOidMarshaller()): encodedValueOf(adapter);
                }
                private String encodedValueOf(ObjectAdapter adapter) {
                    EncodableFacet facet = adapter.getSpecification().getFacet(EncodableFacet.class);
                    return facet != null? facet.toEncodedString(adapter): adapter.toString();
                }
                @Override
                public String classNameOf(Object object) {
                    final ObjectAdapter adapter = getAdapterManager().adapterFor(object);
                    final String className = adapter.getSpecification().getFullIdentifier();
View Full Code Here

    public void testFacetPickedUp() {

        facetFactory.process(new ProcessClassContext(MyEncodableUsingEncoderDecoderName.class, methodRemover, facetedMethod));

        final EncodableFacet facet = facetedMethod.getFacet(EncodableFacet.class);
        assertNotNull(facet);
        assertTrue(facet instanceof EncodableFacetAbstract);
    }
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.