Package org.apache.isis.applib.value

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


        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


    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

        final ObjectAdapter objectAdapter = getModel().getObject();
        final Object value = objectAdapter.getObject();
        final String label;
       
        if(value instanceof Clob) {
            final Clob clob = (Clob) value;
            ResourceStreamRequestHandler handler =
                new ResourceStreamRequestHandler(new StringResourceStream(clob.getChars(), clob.getMimeType().toString()), clob.getName());
            handler.setContentDisposition(ContentDisposition.ATTACHMENT);
            getRequestCycle().scheduleRequestHandlerAfterCurrent(handler);
            label = "Downloading: " + clob.getName();
        } else if(value instanceof Blob) {
            final Blob blob = (Blob) value;
            ResourceRequestHandler handler =
                    new ResourceRequestHandler(new ByteArrayResource(blob.getMimeType().toString(), blob.getBytes(), blob.getName()), null);
            getRequestCycle().scheduleRequestHandlerAfterCurrent(handler);
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

        addColumns(ClassNameConstants.JAVA_LANG_CHARACTER_ARRAY); // 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());
        }
    }
View Full Code Here

        }

        String name = getDatastoreMapping(0).getString(resultSet, exprIndex[0]);
        String mimeTypeBase = getDatastoreMapping(1).getString(resultSet, exprIndex[1]);
        char[] chars = (char[]) getDatastoreMapping(2).getObject(resultSet,exprIndex[2]);
        return new Clob(name, mimeTypeBase, chars);
    }
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.