Package org.apache.isis.applib.value

Examples of org.apache.isis.applib.value.Clob


        final ObjectSpecification objectSpec = adapterFor.getSpecification();
       
        final LayoutMetadataReaderFromJson propertiesReader = new LayoutMetadataReaderFromJson();
        final String json = propertiesReader.asJson(objectSpec);
       
        return new Clob(objectSpec.getShortIdentifier() +".layout.json", mimeTypeApplicationJson, json);
    }
View Full Code Here


        return null;
    }

    public static IRequestHandler downloadHandler(final Object value) {
        if(value instanceof Clob) {
            Clob clob = (Clob)value;
            return handlerFor(resourceStreamFor(clob), clob);
        }
        if(value instanceof Blob) {
            Blob blob = (Blob)value;
            return handlerFor(resourceStreamFor(blob), blob);
View Full Code Here

    private Clob clob;
    private FacetHolder holder;

    @Before
    public void setUpObjects() throws Exception {
        clob = new Clob("myfile1.xml", "application", "xml", "abcdef");
        allowMockAdapterToReturn(clob);
        holder = new FacetHolderImpl();

        setValue(value = new ClobValueSemanticsProvider(holder, mockConfiguration, mockContext));
    }
View Full Code Here

    @Test
    public void testEncode_and_decode() {
        String encoded = value.toEncodedString(clob);
        assertEquals("myfile1.xml:application/xml:abcdef", encoded);
        Clob decoded = value.fromEncodedString(encoded);
        assertThat(decoded.getName(), is("myfile1.xml"));
        assertThat(decoded.getMimeType().getPrimaryType(), is("application"));
        assertThat(decoded.getMimeType().getSubType(), is("xml"));
        assertThat(decoded.getChars(), is((CharSequence)"abcdef"));
    }
View Full Code Here

        addColumns(ClassNameConstants.JAVA_LANG_STRING); // chars
    }

    public Object getValueForDatastoreMapping(NucleusContext nucleusCtx, int index, Object value)
    {
        Clob clob = ((Clob)value);
        switch (index) {
            case 0: return clob.getName();
            case 1: return clob.getMimeType().getBaseType();
            case 2: return clob.getChars();
        }
        throw new IndexOutOfBoundsException();
    }
View Full Code Here

        throw new IndexOutOfBoundsException();
    }

    public void setObject(ExecutionContext ec, PreparedStatement preparedStmt, int[] exprIndex, Object value)
    {
        Clob clob = ((Clob)value);
        if (clob == null) {
            getDatastoreMapping(0).setObject(preparedStmt, exprIndex[0], null);
            getDatastoreMapping(1).setObject(preparedStmt, exprIndex[1], null);
            getDatastoreMapping(2).setObject(preparedStmt, exprIndex[2], null);
        } else {
            getDatastoreMapping(0).setString(preparedStmt, exprIndex[0], clob.getName());
            getDatastoreMapping(1).setString(preparedStmt, exprIndex[1], clob.getMimeType().getBaseType());
            getDatastoreMapping(2).setObject(preparedStmt, exprIndex[2], clob.getChars().toString());
        }
    }
View Full Code Here

        final String mimeTypeBase = getDatastoreMapping(1).getString(resultSet, exprIndex[1]);
        final String str = getDatastoreMapping(2).getString(resultSet, exprIndex[2]);
        if(name == null || mimeTypeBase == null || str == null) {
            return null;
        }
        return new Clob(name, mimeTypeBase, str.toCharArray());
    }
View Full Code Here

    // EncoderDecoder
    // //////////////////////////////////////////////////////////////////

    @Override
    protected String doEncode(final Object object) {
        Clob clob = (Clob)object;
        return clob.getName() + ":" + clob.getMimeType().getBaseType() + ":" + clob.getChars();
    }
View Full Code Here

        final String name  = data.substring(0, colonIdx);
        final int colon2Idx  = data.indexOf(":", colonIdx+1);
        final String mimeTypeBase = data.substring(colonIdx+1, colon2Idx);
        final CharSequence chars = data.substring(colon2Idx+1);
        try {
            return new Clob(name, new MimeType(mimeTypeBase), chars);
        } catch (MimeTypeParseException e) {
            throw new RuntimeException(e);
        }
    }
View Full Code Here

        return null;
    }

    public static IRequestHandler downloadHandler(final Object value) {
        if(value instanceof Clob) {
            Clob clob = (Clob)value;
            return handlerFor(resourceStreamFor(clob), clob);
        }
        if(value instanceof Blob) {
            Blob blob = (Blob)value;
            return handlerFor(resourceStreamFor(blob), blob);
View Full Code Here

TOP

Related Classes of org.apache.isis.applib.value.Clob

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.