AbstractJcrProperty( AbstractJcrNode node, Name name, int propertyType ) { super(node.session()); assert node != null; assert name != null; this.node = node; this.name = name; this.propertyType = propertyType; }
@Override public NodeType[] getMixinNodeTypes() throws RepositoryException { checkSession(); JcrNodeTypeManager nodeTypeManager = session().nodeTypeManager(); List<NodeType> mixinNodeTypes = new LinkedList<NodeType>(); for (Name mixinTypeName : node().getMixinTypes(sessionCache())) { NodeType nodeType = nodeTypeManager.getNodeType(mixinTypeName); if (nodeType != null) mixinNodeTypes.add(nodeType); } return mixinNodeTypes.toArray(new NodeType[mixinNodeTypes.size()]); }
@Override public NodeType[] getMixinNodeTypes() throws RepositoryException { checkSession(); JcrNodeTypeManager nodeTypeManager = session().nodeTypeManager(); List<NodeType> mixinNodeTypes = new LinkedList<NodeType>(); for (Name mixinTypeName : node().getMixinTypes(sessionCache())) { NodeType nodeType = nodeTypeManager.getNodeType(mixinTypeName); if (nodeType != null) mixinNodeTypes.add(nodeType); } return mixinNodeTypes.toArray(new NodeType[mixinNodeTypes.size()]); }
AbstractJcrProperty( AbstractJcrNode node, Name name, int propertyType ) { super(node.session()); assert node != null; assert name != null; this.node = node; this.name = name; this.propertyType = propertyType; }
@Override public JcrNodeType getPrimaryNodeType() throws RepositoryException { checkSession(); return session().nodeTypeManager().getNodeType(node().getPrimaryType(sessionCache())); }
@Override public final JcrSession getSession() { return session(); }
boolean isReferenceable() throws RepositoryException { SessionCache cache = sessionCache(); NodeTypes nodeTypes = session().nodeTypes(); try { CachedNode node = node(); return nodeTypes.isReferenceable(node.getPrimaryType(cache), node.getMixinTypes(cache)); } catch (ItemNotFoundException e) { // The node has been removed, so do nothing } return false; }
/** * Checks if this node is foreign for its current owning session * * @return boolean if this node is considered "foreign" to this session, or false otherwise * @see JcrSession#isForeignKey(org.modeshape.jcr.cache.NodeKey) */ protected final boolean isForeign() { return session().isForeignKey(key()); }
boolean isReferenceable() throws RepositoryException { SessionCache cache = sessionCache(); NodeTypes nodeTypes = session().nodeTypes(); try { CachedNode node = node(); return nodeTypes.isReferenceable(node.getPrimaryType(cache), node.getMixinTypes(cache)); } catch (ItemNotFoundException e) { // The node has been removed, so do nothing } return false; }
/** * Checks if this node is foreign for its current owning session * * @return boolean if this node is considered "foreign" to this session, or false otherwise * @see JcrSession#isForeignKey(org.modeshape.jcr.cache.NodeKey) */ protected final boolean isForeign() { return session().isForeignKey(key()); }
@Override public JcrNodeType getPrimaryNodeType() throws RepositoryException { checkSession(); return session().nodeTypeManager().getNodeType(node().getPrimaryType(sessionCache())); }
@Override public final String getIdentifier() { return session().nodeIdentifier(key()); }
protected AbstractJcrNode getNodeIfExists( Name childName ) throws RepositoryException { // It's just a name, so look for a child ... ChildReference ref = node().getChildReferences(sessionCache()).getChild(childName); return ref != null ? session().node(ref.getKey(), null, key()) : null; }
/** * Checks if this node belongs to an external source. * * @return true if the node is not repository-local */ protected final boolean isExternal() { return !key().getSourceKey().equals(session().cache().getRootKey().getSourceKey()); }
protected AbstractJcrNode getNodeIfExists( Name childName ) throws RepositoryException { // It's just a name, so look for a child ... ChildReference ref = node().getChildReferences(sessionCache()).getChild(childName); return ref != null ? session().node(ref.getKey(), null, key()) : null; }
private boolean canAddNode( String primaryNodeTypeName ) throws RepositoryException { if (isLockedByAnotherSession()) { return false; } // Determine the name for the primary node type if (primaryNodeTypeName != null) { if (!session().nodeTypeManager().hasNodeType(primaryNodeTypeName)) return false; JcrNodeType nodeType = session().nodeTypeManager().getNodeType(primaryNodeTypeName); if (nodeType.isAbstract()) return false; if (nodeType.isMixin()) return false; if (INTERNAL_NODE_TYPE_NAMES.contains(nodeType.getInternalName())) return false; } return true; }
AbstractJcrNode getNode( Name childName ) throws PathNotFoundException, RepositoryException { // It's just a name, so look for a child ... ChildReference ref = node().getChildReferences(sessionCache()).getChild(childName); if (ref == null) { String msg = JcrI18n.childNotFoundUnderNode.text(readable(childName), location(), session.workspaceName()); throw new PathNotFoundException(msg); } return session().node(ref.getKey(), null, key()); }
/** * Checks if this node belongs to an external source. * * @return true if the node is not repository-local */ protected final boolean isExternal() { return !key().getSourceKey().equals(session().cache().getRootKey().getSourceKey()); }
AbstractJcrNode getNode( Name childName ) throws PathNotFoundException, RepositoryException { // It's just a name, so look for a child ... ChildReference ref = node().getChildReferences(sessionCache()).getChild(childName); if (ref == null) { String msg = JcrI18n.childNotFoundUnderNode.text(readable(childName), location(), session.workspaceName()); throw new PathNotFoundException(msg); } return session().node(ref.getKey(), null, key()); }
void cancelMerge( AbstractJcrNode targetNode, Version version ) throws RepositoryException { targetNode.session().checkLive(); checkVersionable(targetNode); if (targetNode.isNew() || targetNode.isModified()) { throw new InvalidItemStateException(JcrI18n.noPendingChangesAllowedForNode.text()); } if (!targetNode.isNodeType(JcrMixLexicon.VERSIONABLE)) { throw new UnsupportedRepositoryOperationException(JcrI18n.requiresVersionable.text()); } removeVersionFromMergeFailedProperty(targetNode, version); targetNode.session().save(); }