Package org.apache.isis.applib.value

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


    protected Clob getBlobOrClobFrom(final List<FileUpload> fileUploads) {
        final FileUpload fileUpload = fileUploads.get(0);
        final String contentType = fileUpload.getContentType();
        final String clientFileName = fileUpload.getClientFileName();
        final String str = new String(fileUpload.getBytes(), CHARSET);
        final Clob blob = new Clob(clientFileName, contentType, str);
        return 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

        final StringBuilder buf = new StringBuilder();
        buf.append(MetaModelRow.header()).append("\n");
        for (MetaModelRow row : rows) {
            buf.append(row.asTextCsv()).append("\n");
        }
        return new Clob("metamodel.csv", mimeTypeTextCsv, buf.toString().toCharArray());
    }
View Full Code Here

        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

    // 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

        final StringBuilder buf = new StringBuilder();
        buf.append(MetaModelRow.header()).append("\n");
        for (MetaModelRow row : rows) {
            buf.append(row.asTextCsv()).append("\n");
        }
        return new Clob("metamodel.csv", mimeTypeTextCsv, buf.toString().toCharArray());
    }
View Full Code Here

        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

        final StringBuilder buf = new StringBuilder();
        buf.append(MetaModelRow.header()).append("\n");
        for (MetaModelRow row : rows) {
            buf.append(row.asTextCsv()).append("\n");
        }
        return new Clob("metamodel.csv", mimeTypeTextCsv, buf.toString().toCharArray());
    }
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.