@Override public String getPath(Session session, Object object) { return super.getPath(session, object); }
@Override public void insert(Session session, Node parentNode, String nodeName, Object object) { super.insert(session, parentNode, nodeName, object); }
@Override public void update(Session session, Object object) { super.update(session, object); }
public void update(Session session, Node objectNode, Object object) { ClassDescriptor classDescriptor = mapper.getClassDescriptorByClass(ReflectionUtils.getBeanClass(object)); checkNodeType(session, classDescriptor); checkCompatiblePrimaryNodeTypes(session, objectNode, classDescriptor, false); simpleFieldsHelp.storeSimpleFields(session, object, classDescriptor, objectNode); updateBeanFields(session, object, classDescriptor, objectNode); updateCollectionFields(session, object, classDescriptor, objectNode); simpleFieldsHelp.refreshUuidPath(session, classDescriptor, objectNode, object); }
ClassDescriptor classDescriptor = getClassDescriptor(clazz); checkNodeType(session, classDescriptor); node = getActualNode(session,node); checkCompatiblePrimaryNodeTypes(session, node, classDescriptor, true); if (node.hasProperty(ManagerConstant.DISCRIMINATOR_CLASS_NAME_PROPERTY)) { String className = node.getProperty(ManagerConstant.DISCRIMINATOR_CLASS_NAME_PROPERTY).getValue().getString(); alternativeDescriptor = getClassDescriptor(ReflectionUtils.forName(className)); retrieveBeanFields(session, classDescriptor, node, object, false); retrieveCollectionFields(session, classDescriptor, node, object, false);
public void insert(Session session, Object object) { String path = this.getPath(session, object); try { String parentPath = NodeUtil.getParentPath(path); String nodeName = NodeUtil.getNodeName(path); Node parentNode = session.getNode(parentPath); this.insert(session, parentNode, nodeName, object); } catch (PathNotFoundException pnfe) { throw new ObjectContentManagerException("Impossible to insert the object at '" + path + "'", pnfe); } catch (RepositoryException re) { throw new org.apache.jackrabbit.ocm.exception.RepositoryException("Impossible to insert the object at '" + path + "'", re); } }
public void update(Session session, Object object) { String path = this.getPath(session, object); try { String parentPath = NodeUtil.getParentPath(path); String nodeName = NodeUtil.getNodeName(path); Node parentNode = session.getNode(parentPath); this.update(session, parentNode, nodeName, object); } catch (PathNotFoundException pnfe) { throw new ObjectContentManagerException("Impossible to update the object at '" + path + "'", pnfe); } catch (RepositoryException re) { throw new org.apache.jackrabbit.ocm.exception.RepositoryException("Impossible to update the object at '" + path + "'", re); } }
public void update(Session session, Node parentNode, String nodeName, Object object) { try { ClassDescriptor classDescriptor = mapper.getClassDescriptorByClass(ReflectionUtils.getBeanClass(object)); Node objectNode = getNode(parentNode,classDescriptor,nodeName,object); update(session, objectNode, object); } catch (PathNotFoundException pnfe) { throw new ObjectContentManagerException("Impossible to update the object: " + nodeName + " at node : " + parentNode, pnfe); } catch (RepositoryException re) { throw new org.apache.jackrabbit.ocm.exception.RepositoryException("Impossible to update the object: " + nodeName + " at node : " + parentNode, re); } }
public void retrieveAllMappedAttributes(Session session, Object object) { String path = null; try { ClassDescriptor classDescriptor = getClassDescriptor(object.getClass()); String pathFieldName = classDescriptor.getPathFieldDescriptor().getFieldName(); path = (String) ReflectionUtils.getNestedProperty(object, pathFieldName); Node node = session.getNode(path); retrieveBeanFields(session, classDescriptor, node, object, true); retrieveCollectionFields(session, classDescriptor, node, object, true); } catch (PathNotFoundException pnfe) { throw new ObjectContentManagerException("Impossible to get the object at " + path, pnfe); } catch (RepositoryException re) { throw new org.apache.jackrabbit.ocm.exception.RepositoryException("Impossible to get the object at " + path, re); } }
ClassDescriptor classDescriptor = null; try { classDescriptor = getClassDescriptor(object.getClass()); String pathFieldName = classDescriptor.getPathFieldDescriptor().getFieldName(); path = (String) ReflectionUtils.getNestedProperty(object, pathFieldName); if (beanDescriptor != null) this.retrieveBeanField(session, beanDescriptor, node, object, true); if (collectionDescriptor != null) this.retrieveCollectionField(session, collectionDescriptor, node, object, true);
addDiscriminatorProperty(object, objectNode); insertBeanFields(session, object, classDescriptor, objectNode); insertCollectionFields(session, object, classDescriptor, objectNode); simpleFieldsHelp.refreshUuidPath(session, classDescriptor, objectNode, object);
/** * @see org.apache.sling.jcr.ocm.ObjectContentManagerFactory#getObjectContentManager(javax.jcr.Session) */ public ObjectContentManager getObjectContentManager(Session session) { ValueFactory valueFactory; try { valueFactory = session.getValueFactory(); } catch (RepositoryException re) { log.info( "getObjectContentManager: Cannot get ValueFactory from Session (" + session.getUserID() + "), using default factory", re); valueFactory = ValueFactoryImpl.getInstance(); } ObjectCache objectCache = new ObservingObjectCache(session); QueryManager queryManager = new QueryManagerImpl(mapper, converterProvider.getAtomicTypeConverters(), valueFactory); ObjectConverter objectConverter = new ObjectConverterImpl(mapper, converterProvider, new ProxyManagerImpl(), objectCache); return new ObjectContentManagerImpl(mapper, objectConverter, queryManager, objectCache, session); }
NodeType nodeType = node.getPrimaryNodeType(); boolean compatible = checkCompatibleNodeTypes(nodeType, classDescriptor); nodeType = ntMgr.getNodeType(node.getProperty(ManagerConstant.FROZEN_PRIMARY_TYPE_PROPERTY).getString()); compatible = checkCompatibleNodeTypes(nodeType, classDescriptor);
ClassDescriptor classDescriptor = getClassDescriptor(clazz); checkNodeType(session, classDescriptor); node = getActualNode(session,node); checkCompatiblePrimaryNodeTypes(session, node, classDescriptor, true); if (node.hasProperty(ManagerConstant.DISCRIMINATOR_CLASS_NAME_PROPERTY)) { String className = node.getProperty(ManagerConstant.DISCRIMINATOR_CLASS_NAME_PROPERTY).getValue().getString(); alternativeDescriptor = getClassDescriptor(ReflectionUtils.forName(className)); retrieveBeanFields(session, classDescriptor, node, path, object, false); retrieveCollectionFields(session, classDescriptor, node, object, false);
/** * * @see org.apache.jackrabbit.ocm.manager.objectconverter.ObjectConverter#update(javax.jcr.Session, * javax.jcr.Node, java.lang.Object) */ public void update(Session session, Node objectNode, Object object) { ClassDescriptor classDescriptor = mapper.getClassDescriptorByClass(ReflectionUtils.getBeanClass(object)); checkNodeType(session, classDescriptor); checkCompatiblePrimaryNodeTypes(session, objectNode, classDescriptor, false); simpleFieldsHelp.storeSimpleFields(session, object, classDescriptor, objectNode); updateBeanFields(session, object, classDescriptor, objectNode); updateCollectionFields(session, object, classDescriptor, objectNode); simpleFieldsHelp.refreshUuidPath(session, classDescriptor, objectNode, object); }
/** * @see org.apache.jackrabbit.ocm.manager.objectconverter.ObjectConverter#insert(javax.jcr.Session, * java.lang.Object) */ public void insert(Session session, Object object) { String path = this.getPath(session, object); try { String parentPath = NodeUtil.getParentPath(path); String nodeName = NodeUtil.getNodeName(path); Node parentNode = (Node) session.getItem(parentPath); this.insert(session, parentNode, nodeName, object); } catch (PathNotFoundException pnfe) { throw new ObjectContentManagerException("Impossible to insert the object at '" + path + "'", pnfe); } catch (RepositoryException re) { throw new org.apache.jackrabbit.ocm.exception.RepositoryException("Impossible to insert the object at '" + path + "'", re); } }
/** * @see org.apache.jackrabbit.ocm.manager.objectconverter.ObjectConverter#update(javax.jcr.Session, * java.lang.Object) */ public void update(Session session, Object object) { String path = this.getPath(session, object); try { String parentPath = NodeUtil.getParentPath(path); String nodeName = NodeUtil.getNodeName(path); Node parentNode = (Node) session.getItem(parentPath); this.update(session, parentNode, nodeName, object); } catch (PathNotFoundException pnfe) { throw new ObjectContentManagerException("Impossible to update the object at '" + path + "'", pnfe); } catch (RepositoryException re) { throw new org.apache.jackrabbit.ocm.exception.RepositoryException("Impossible to update the object at '" + path + "'", re); } }
/** * * @see org.apache.jackrabbit.ocm.manager.objectconverter.ObjectConverter#update(javax.jcr.Session, * javax.jcr.Node, java.lang.String, java.lang.Object) */ public void update(Session session, Node parentNode, String nodeName, Object object) { try { ClassDescriptor classDescriptor = mapper.getClassDescriptorByClass(ReflectionUtils.getBeanClass(object)); Node objectNode = getNode(parentNode,classDescriptor,nodeName,object); update(session, objectNode, object); } catch (PathNotFoundException pnfe) { throw new ObjectContentManagerException("Impossible to update the object: " + nodeName + " at node : " + parentNode, pnfe); } catch (RepositoryException re) { throw new org.apache.jackrabbit.ocm.exception.RepositoryException("Impossible to update the object: " + nodeName + " at node : " + parentNode, re); } }
public void retrieveAllMappedAttributes(Session session, Object object) { String path = null; try { ClassDescriptor classDescriptor = getClassDescriptor(object.getClass()); String pathFieldName = classDescriptor.getPathFieldDescriptor().getFieldName(); path = (String) ReflectionUtils.getNestedProperty(object, pathFieldName); Node node = (Node) session.getItem(path); retrieveBeanFields(session, classDescriptor, node, path, object, true); retrieveCollectionFields(session, classDescriptor, node, object, true); } catch (PathNotFoundException pnfe) { throw new ObjectContentManagerException("Impossible to get the object at " + path, pnfe); } catch (RepositoryException re) { throw new org.apache.jackrabbit.ocm.exception.RepositoryException("Impossible to get the object at " + path, re); } }
ClassDescriptor classDescriptor = null; try { classDescriptor = getClassDescriptor(object.getClass()); String pathFieldName = classDescriptor.getPathFieldDescriptor().getFieldName(); path = (String) ReflectionUtils.getNestedProperty(object, pathFieldName); if (beanDescriptor != null) this.retrieveBeanField(session, beanDescriptor, node, path, object, true); if (collectionDescriptor != null) this.retrieveCollectionField(session, collectionDescriptor, node, object, true);