Package org.apache.chemistry.opencmis.client.mapper

Examples of org.apache.chemistry.opencmis.client.mapper.MapperException


                properties.put(PropertyIds.OBJECT_TYPE_ID, CFG.getDefaultDocumentType());
            } else {
                parser.reset();
                PropertyMapper mapper = CFG.getPropertyMapper(mimeType);
                if (null == mapper)
                    throw new MapperException("Unknown mime type (no configuration): " + mimeType);
                String typeId = mapper.getMappedTypeId();
                if (null == typeId)
                    throw new MapperException("No CMIS type configured for mime type" + mimeType);
                TypeDefinition td = session.getTypeDefinition(typeId);
                if (null == td)
                    throw new MapperException("CMIS type " + typeId + " does not exist on server.");

                LOG.info("Detected MIME type: "+ mimeType + " is mapped to CMIS type id: " + td.getId());
                parser.extractMetadata(f, td);
                properties = parser.getCmisProperties();
            }
View Full Code Here


                MetadataParserTika mpt = new MetadataParserTika();
                mpt.listMetadata(f);
            } else {
                PropertyMapper mapper = CFG.getPropertyMapper(mimeType);
                if (null == mapper)
                    throw new MapperException("Unknown mime type (no configuration): " + mimeType);
                String typeId = mapper.getMappedTypeId();
                if (null == typeId)
                    throw new MapperException("No CMIS type configured for mime type" + mimeType);
               
                // Session available? if yes do conversion
                TypeDefinition td = null;
                if (null!= session) {
                    session.getTypeDefinition(typeId);
                    if (null == td)
                        throw new MapperException("CMIS type " + typeId + " does not exist on server.");
                }
                LOG.info("Detected MIME type: "+ mimeType + " is mapped to CMIS type id: " + td.getId());
               
                parser.extractMetadata(f, td);
                Map<String, Object> properties = parser.getCmisProperties();
View Full Code Here

        String typeId = mapper.getMappedTypeId();
        cmisProperties = new HashMap<String, Object>();
        mapper.reset();

        if (null == typeId)
            throw new MapperException("No CMIS Type configured in this parser.");
        cmisProperties.put(PropertyIds.OBJECT_TYPE_ID, typeId);
    }
View Full Code Here

                    String propertyId = mapper.getMappedPropertyId(key);
                    if (null != propertyId && null != val) {
                        if (td != null) {
                            PropertyDefinition<?> propDef = td.getPropertyDefinitions().get(propertyId);
                            if (null == propDef)
                                throw new MapperException("Mapping error: unknown property "+ propertyId + " in type definition " + td.getId());
                            PropertyType propertyType = propDef.getPropertyType();
                            Object convVal = mapper.convertValue(propertyId, propDef, val);
                            if (null != convVal)
                                cmisProperties.put(propertyId, convVal);
                        } else
                            cmisProperties.put(propertyId, val); // omit conversion if no type definition is available
                    }
                }
            }

        } catch (Exception e) {
            LOG.error(e);
            throw new MapperException("Extracting metadata failed for file " + f.getAbsolutePath(), e);
        }
    }   
View Full Code Here

                LOG.info("Found metadata \'" + key + "\': " + val);     
            }

        } catch (Exception e) {
            LOG.error(e);
            throw new MapperException("Extracting metadata failed, file not found: " + f.getAbsolutePath(), e);
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.chemistry.opencmis.client.mapper.MapperException

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.