Package org.apache.jackrabbit.ocm.exception

Examples of org.apache.jackrabbit.ocm.exception.JcrMappingException


     */
    public void save() {
        try {
            this.session.save();
        } catch (NoSuchNodeTypeException nsnte) {
            throw new JcrMappingException("Cannot persist current session changes. An unknown node type was used.", nsnte);
        } catch (javax.jcr.version.VersionException ve) {
            throw new VersionException("Cannot persist current session changes. Attempt to overwrite checked-in node", ve);
        } catch (LockException le) {
            throw new ObjectContentManagerException("Cannot persist current session changes. Violation of a lock detected", le);
        } catch (RepositoryException e) {
View Full Code Here


    public static ManageableObjects getManageableObjects(String manageableObjectsClassName) {
        try {
            return (ManageableObjects) ReflectionUtils.newInstance(manageableObjectsClassName);
        }
        catch (Exception e) {
            throw new JcrMappingException("Cannot create manageable collection : "
                                           + manageableObjectsClassName,
                                           e);
        }
    }
View Full Code Here

          {

            Class defaultImplementation  = ReflectionUtils.getDefaultImplementation(manageableObjectsClass);
            if (defaultImplementation == null)
            {
              throw new JcrMappingException("No default implementation for the interface " + manageableObjectsClass);
            }
            else
            {
              manageableObjectsClass = defaultImplementation;
            }
          }

          //if the class is implementing the Collection interface
          if (ReflectionUtils.implementsInterface(manageableObjectsClass, Collection.class))
          {
            return new ManageableCollectionImpl((Collection) ReflectionUtils.newInstance(manageableObjectsClass));
          }

          //if the class is implementing the Map interface
          if (ReflectionUtils.implementsInterface(manageableObjectsClass, Map.class))
          {
            return new ManageableMapImpl((Map) ReflectionUtils.newInstance(manageableObjectsClass));
          }


            Object manageableObjects = manageableObjectsClass.newInstance();
            if (!(manageableObjects instanceof ManageableObjects)) {
                throw new JcrMappingException("Unsupported collection type :"
                                               + manageableObjectsClass.getName());
            }
            else {
                return (ManageableObjects) manageableObjects;
            }
        }
        catch (Exception e) {
            throw new JcrMappingException("Cannot create manageable objects (Collection or Map)", e);
        }
    }
View Full Code Here

          }


        }
        catch (Exception e) {
            throw new JcrMappingException("Impossible to create the manageable collection", e);
        }

        throw new JcrMappingException("Unsupported collection type :" + object.getClass().getName());
    }
View Full Code Here

            // For collection of bean references, only Collections are supported
            if (! (objects instanceof ManageableCollection))
            {

              throw new JcrMappingException("Impossible to retrieve the attribute "
                  + collectionDescriptor.getFieldName() + " in the class "
                  + collectionDescriptor.getClassDescriptor().getClassName()
                  " because it is not a collection");
            }
View Full Code Here

          ClassDescriptor classDescriptor = mapper.getClassDescriptorByClass(object.getClass());

          FieldDescriptor fieldDescriptor = classDescriptor.getUuidFieldDescriptor();
          if (fieldDescriptor == null)
          {
            throw new JcrMappingException("The bean doesn't have an uuid - classdescriptor : "
                                  + classDescriptor.getClassName());
          }

          String uuid = (String) ReflectionUtils.getNestedProperty(object, fieldDescriptor.getFieldName());
          values[i] = valueFactory.createValue(uuid, PropertyType.REFERENCE);
View Full Code Here

                                      ManageableObjects objects) throws RepositoryException {

        // For maps of bean references, only Maps are supported
        if (!(objects instanceof ManageableMap)) {

            throw new JcrMappingException("Impossible to retrieve the attribute "
                    + collectionDescriptor.getFieldName() + " in the class "
                    + collectionDescriptor.getClassDescriptor().getClassName()
                    + " because it is not a map");
        }
View Full Code Here

                                      ManageableObjects objects) throws RepositoryException {

      // For maps of bean references, only Maps are supported
        if (!(objects instanceof ManageableMap)) {

            throw new JcrMappingException("Impossible to retrieve the attribute "
                    + collectionDescriptor.getFieldName() + " in the class "
                    + collectionDescriptor.getClassDescriptor().getClassName()
                    + " because it is not a map");
        }
        String jcrName = getCollectionJcrName(collectionDescriptor);
View Full Code Here

            ManageableObjects objects = ManageableObjectsUtil.getManageableObjects(collectionFieldClass);

            // For maps of bean references, only Maps are supported
            if (!(objects instanceof ManageableMap)) {

                throw new JcrMappingException("Impossible to retrieve the attribute "
                        + collectionDescriptor.getFieldName() + " in the class "
                        + collectionDescriptor.getClassDescriptor().getClassName()
                        + " because it is not a map");
            }
View Full Code Here

                if (object != null) {
                    ClassDescriptor classDescriptor = mapper.getClassDescriptorByClass(object.getClass());

                    FieldDescriptor fieldDescriptor = classDescriptor.getUuidFieldDescriptor();
                    if (fieldDescriptor == null) {
                        throw new JcrMappingException("The bean doesn't have an uuid - classdescriptor : "
                                + classDescriptor.getClassName());
                    }

                    String uuid = (String) ReflectionUtils.getNestedProperty(object, fieldDescriptor.getFieldName());
                    values[i] = valueFactory.createValue(MapReferenceValueEncoder.encodeKeyAndReference(key, uuid), PropertyType.STRING);
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.ocm.exception.JcrMappingException

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.