Package org.jahia.services.content.nodetypes

Examples of org.jahia.services.content.nodetypes.Name


                long lastModifiedTime = fileObject.getContent().getLastModifiedTime();
                if (lastModifiedTime > 0) {
                    ValueFactory valueFactory = session.getValueFactory();
                    Calendar calendar = Calendar.getInstance();
                    calendar.setTimeInMillis(lastModifiedTime);
                    properties.put(Constants.JCR_CREATED, new VFSPropertyImpl(new Name("created", org.apache.jackrabbit.spi.Name.NS_JCR_PREFIX, org.apache.jackrabbit.spi.Name.NS_JCR_URI), this, session, valueFactory.createValue(calendar)));
                    properties.put(Constants.JCR_LASTMODIFIED, new VFSPropertyImpl(new Name("lastModified", org.apache.jackrabbit.spi.Name.NS_JCR_PREFIX, org.apache.jackrabbit.spi.Name.NS_JCR_URI), this, session, valueFactory.createValue(calendar)));
                }
            }
        } catch (FileSystemException e) {
            e.printStackTrace()//To change body of catch statement use File | Settings | File Templates.
        } catch (UnsupportedRepositoryOperationException e) {
View Full Code Here


                OutputStream outputStream = content.getOutputStream();
                IOUtils.copy(inputStream, outputStream);
                outputStream.close();
                VFSValueFactoryImpl valueFactory = (VFSValueFactoryImpl) session.getValueFactory();
                Value value = valueFactory.createValue(new VFSBinaryImpl(content));
                return new DataPropertyImpl(new Name(s, "", ""), this, session, value);
            } catch (IOException e) {
                throw new RepositoryException("Cannot write to stream", e);
            }
        }
        throw new ConstraintViolationException("Unknown type");
View Full Code Here

    public Property getProperty(String s) throws PathNotFoundException, RepositoryException {
        VFSValueFactoryImpl valueFactory = (VFSValueFactoryImpl) session.getValueFactory();
        if (s.equals(Constants.JCR_DATA)) {
            Value value = null;
            value = valueFactory.createValue(new VFSBinaryImpl(content));
            return new VFSPropertyImpl(new Name(s, "", ""), this, session, value) {
                public long getLength() throws ValueFormatException, RepositoryException {
                    try {
                        return content.getSize();
                    } catch (FileSystemException e) {
                        return -1L;
                    }
                }

                public InputStream getStream() throws ValueFormatException, RepositoryException {
                    try {
                        return content.getInputStream();
                    } catch (FileSystemException e) {
                        return null;
                    }
                }

                public String getName() throws RepositoryException {
                    return Constants.JCR_DATA;
                }

                public PropertyDefinition getDefinition() throws RepositoryException {
                    return NodeTypeRegistry.getInstance().getNodeType(Constants.NT_RESOURCE).getPropertyDefinition(Constants.JCR_DATA);
                }
            };
        } else if (s.equals(Constants.JCR_MIMETYPE)) {
            String s1 = null;
            try {
                s1 = content.getContentInfo().getContentType();
            } catch (FileSystemException e) {
                throw new RepositoryException("Error while retrieving file's content type", e);
            }
            if (s1 == null) {
                s1 = MimetypesFileTypeMap.getDefaultFileTypeMap().getContentType("."+content.getFile().getName().getExtension());
            }
            Value value = valueFactory.createValue(s1);
            return new VFSPropertyImpl(new Name(s, "", ""), this, session, value) {
                public String getString() throws ValueFormatException, RepositoryException {
                    try {
                        String s1 = content.getContentInfo().getContentType();
                        if (s1 == null) {
                            return MimetypesFileTypeMap.getDefaultFileTypeMap().getContentType("."+content.getFile().getName().getExtension());
View Full Code Here

TOP

Related Classes of org.jahia.services.content.nodetypes.Name

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.