private void assertMixins( List<String> nodeMixins, AbstractJcrNode node ) throws ItemNotFoundException, InvalidItemStateException { if (nodeMixins != null && !nodeMixins.isEmpty()) { for (Name mixinName : node.getMixinTypeNames()) { assertTrue("Mixin not expected:" + mixinName.getString(), nodeMixins.contains(mixinName.getString())); } } }
@Override public void createProjection( String absNodePath, String sourceName, String externalPath, String alias ) throws RepositoryException { AbstractJcrNode node = session.getNode(absNodePath); if (session.nodeTypeManager().nodeTypes().isUnorderedCollection(node.getPrimaryTypeName(), node.getMixinTypeNames())) { throw new ConstraintViolationException(JcrI18n.operationNotSupportedForUnorderedCollections.text("create projection")); } NodeKey parentNodeToBecomeFederatedKey = node.key(); String projectionAlias = !StringUtil.isBlank(alias) ? alias : externalPath; if (projectionAlias.endsWith("/")) { projectionAlias = projectionAlias.substring(0, projectionAlias.length() - 1); } if (projectionAlias.contains("/")) { projectionAlias = projectionAlias.substring(projectionAlias.lastIndexOf("/") + 1); } if (StringUtil.isBlank(projectionAlias)) { // we cannot create an external projection without a valid alias return; } SessionCache sessionCache = this.session.spawnSessionCache(false); SessionCache systemSession = session.repository.createSystemSession(session.context(), false); String externalNodeKey = documentStore.createExternalProjection(parentNodeToBecomeFederatedKey.toString(), sourceName, externalPath, projectionAlias, systemSession); MutableCachedNode mutable = sessionCache.mutable(parentNodeToBecomeFederatedKey); mutable.addFederatedSegment(externalNodeKey, projectionAlias); systemSession.save(sessionCache, null); }
@Override public void createProjection( String absNodePath, String sourceName, String externalPath, String alias ) throws RepositoryException { AbstractJcrNode node = session.getNode(absNodePath); if (session.nodeTypeManager().nodeTypes().isUnorderedCollection(node.getPrimaryTypeName(), node.getMixinTypeNames())) { throw new ConstraintViolationException(JcrI18n.operationNotSupportedForUnorderedCollections.text("create projection")); } NodeKey parentNodeToBecomeFederatedKey = node.key(); String projectionAlias = !StringUtil.isBlank(alias) ? alias : externalPath; if (projectionAlias.endsWith("/")) { projectionAlias = projectionAlias.substring(0, projectionAlias.length() - 1); } if (projectionAlias.contains("/")) { projectionAlias = projectionAlias.substring(projectionAlias.lastIndexOf("/") + 1); } if (StringUtil.isBlank(projectionAlias)) { // we cannot create an external projection without a valid alias return; } SessionCache sessionCache = this.session.spawnSessionCache(false); SessionCache systemSession = session.repository.createSystemSession(session.context(), false); String externalNodeKey = documentStore.createExternalProjection(parentNodeToBecomeFederatedKey.toString(), sourceName, externalPath, projectionAlias, systemSession); MutableCachedNode mutable = sessionCache.mutable(parentNodeToBecomeFederatedKey); mutable.addFederatedSegment(externalNodeKey, projectionAlias); systemSession.save(sessionCache, null); }
/** * Get the property definition ID. * * @return the cached property definition ID; never null * @throws ItemNotFoundException if the node that contains this property doesn't exist anymore * @throws ConstraintViolationException if no valid property definition could be found * @throws InvalidItemStateException if the node has been removed in this session's transient state */ final PropertyDefinitionId propertyDefinitionId() throws ItemNotFoundException, ConstraintViolationException, InvalidItemStateException { CachedDefinition defn = cachedDefn; NodeTypes nodeTypes = session.nodeTypes(); if (defn == null || nodeTypes.getVersion() > defn.nodeTypesVersion) { Name primaryType = node.getPrimaryTypeName(); Set<Name> mixinTypes = node.getMixinTypeNames(); PropertyDefinitionId id = node.propertyDefinitionFor(property(), primaryType, mixinTypes, nodeTypes).getId(); setPropertyDefinitionId(id, nodeTypes.getVersion()); return id; } return defn.propDefnId; }
/** * Get the property definition ID. * * @return the cached property definition ID; never null * @throws ItemNotFoundException if the node that contains this property doesn't exist anymore * @throws ConstraintViolationException if no valid property definition could be found * @throws InvalidItemStateException if the node has been removed in this session's transient state */ final PropertyDefinitionId propertyDefinitionId() throws ItemNotFoundException, ConstraintViolationException, InvalidItemStateException { CachedDefinition defn = cachedDefn; NodeTypes nodeTypes = session.nodeTypes(); if (defn == null || nodeTypes.getVersion() > defn.nodeTypesVersion) { Name primaryType = node.getPrimaryTypeName(); Set<Name> mixinTypes = node.getMixinTypeNames(); PropertyDefinitionId id = node.propertyDefinitionFor(property(), primaryType, mixinTypes, nodeTypes).getId(); setPropertyDefinitionId(id, nodeTypes.getVersion()); return id; } return defn.propDefnId; }
/** * Get the definition for this property. * * @return the cached property definition ID; never null * @throws ItemNotFoundException if the node that contains this property doesn't exist anymore * @throws ConstraintViolationException if no valid property definition could be found * @throws InvalidItemStateException if the node has been removed in this session's transient state */ final JcrPropertyDefinition propertyDefinition() throws ItemNotFoundException, ConstraintViolationException, InvalidItemStateException { CachedDefinition defn = cachedDefn; NodeTypes nodeTypes = session.nodeTypes(); if (defn == null || nodeTypes.getVersion() > defn.nodeTypesVersion) { Name primaryType = node.getPrimaryTypeName(); Set<Name> mixinTypes = node.getMixinTypeNames(); JcrPropertyDefinition propDefn = node.propertyDefinitionFor(property(), primaryType, mixinTypes, nodeTypes); PropertyDefinitionId id = propDefn.getId(); setPropertyDefinitionId(id, nodeTypes.getVersion()); return propDefn; } return nodeTypes.getPropertyDefinition(defn.propDefnId); }
/** * Get the definition for this property. * * @return the cached property definition ID; never null * @throws ItemNotFoundException if the node that contains this property doesn't exist anymore * @throws ConstraintViolationException if no valid property definition could be found * @throws InvalidItemStateException if the node has been removed in this session's transient state */ final JcrPropertyDefinition propertyDefinition() throws ItemNotFoundException, ConstraintViolationException, InvalidItemStateException { CachedDefinition defn = cachedDefn; NodeTypes nodeTypes = session.nodeTypes(); if (defn == null || nodeTypes.getVersion() > defn.nodeTypesVersion) { Name primaryType = node.getPrimaryTypeName(); Set<Name> mixinTypes = node.getMixinTypeNames(); JcrPropertyDefinition propDefn = node.propertyDefinitionFor(property(), primaryType, mixinTypes, nodeTypes); PropertyDefinitionId id = propDefn.getId(); setPropertyDefinitionId(id, nodeTypes.getVersion()); return propDefn; } return nodeTypes.getPropertyDefinition(defn.propDefnId); }
Set<Name> mixinTypeNames = node.getMixinTypeNames(); props.add(factory.create(JcrLexicon.PRIMARY_TYPE, JcrNtLexicon.FROZEN_NODE)); props.add(factory.create(JcrLexicon.FROZEN_PRIMARY_TYPE, primaryTypeName));
Set<Name> mixinTypeNames = node.getMixinTypeNames(); props.add(factory.create(JcrLexicon.PRIMARY_TYPE, JcrNtLexicon.FROZEN_NODE)); props.add(factory.create(JcrLexicon.FROZEN_PRIMARY_TYPE, primaryTypeName));
private void fireSequencingFailureEvent( AbstractJcrNode sequencedNode, JcrSession inputSession, Throwable cause, String sequencerName ) throws RepositoryException { assert sequencedNode != null; assert inputSession != null; Name primaryType = sequencedNode.getPrimaryTypeName(); Set<Name> mixinTypes = sequencedNode.getMixinTypeNames(); final ExecutionContext context = inputSession.context(); RecordingChanges sequencingChanges = new RecordingChanges(inputSession.sessionId(), context.getProcessId(), inputSession.getRepository().repositoryKey(), inputSession.workspaceName(), inputSession.getRepository() .journalId()); sequencingChanges.nodeSequencingFailure(sequencedNode.key(), sequencedNode.path(), primaryType, mixinTypes, work.getOutputPath(), work.getUserId(), work.getSelectedPath(), sequencerName, cause); repository.changeBus().notify(sequencingChanges); }
private void fireSequencingFailureEvent( AbstractJcrNode sequencedNode, JcrSession inputSession, Throwable cause, String sequencerName ) throws RepositoryException { assert sequencedNode != null; assert inputSession != null; Name primaryType = sequencedNode.getPrimaryTypeName(); Set<Name> mixinTypes = sequencedNode.getMixinTypeNames(); final ExecutionContext context = inputSession.context(); RecordingChanges sequencingChanges = new RecordingChanges(inputSession.sessionId(), context.getProcessId(), inputSession.getRepository().repositoryKey(), inputSession.workspaceName(), inputSession.getRepository() .journalId()); sequencingChanges.nodeSequencingFailure(sequencedNode.key(), sequencedNode.path(), primaryType, mixinTypes, work.getOutputPath(), work.getUserId(), work.getSelectedPath(), sequencerName, cause); repository.changeBus().notify(sequencingChanges); }
parentMixinTypes = parentNode.getMixinTypeNames(); } catch (RepositoryException e) { if (LOGGER.isDebugEnabled()) {
parentMixinTypes = parentNode.getMixinTypeNames(); } catch (RepositoryException e) { if (LOGGER.isDebugEnabled()) {
private void fireSequencingEvent( AbstractJcrNode sequencedNode, List<AbstractJcrNode> outputNodes, JcrSession outputSession, String sequencerName ) throws RepositoryException { final ExecutionContext context = outputSession.context(); RecordingChanges sequencingChanges = new RecordingChanges(outputSession.sessionId(), context.getProcessId(), outputSession.getRepository().repositoryKey(), outputSession.workspaceName(), outputSession.getRepository() .journalId()); Name primaryType = sequencedNode.getPrimaryTypeName(); Set<Name> mixinTypes = sequencedNode.getMixinTypeNames(); for (AbstractJcrNode outputNode : outputNodes) { sequencingChanges.nodeSequenced(sequencedNode.key(), sequencedNode.path(), primaryType, mixinTypes, outputNode.key(), outputNode.path(), work.getOutputPath(), work.getUserId(), work.getSelectedPath(), sequencerName); } sequencingChanges.freeze(outputSession.getUserID(), null, context.getValueFactories().getDateFactory().create()); repository.changeBus().notify(sequencingChanges); }
private void fireSequencingEvent( AbstractJcrNode sequencedNode, List<AbstractJcrNode> outputNodes, JcrSession outputSession, String sequencerName ) throws RepositoryException { final ExecutionContext context = outputSession.context(); RecordingChanges sequencingChanges = new RecordingChanges(outputSession.sessionId(), context.getProcessId(), outputSession.getRepository().repositoryKey(), outputSession.workspaceName(), outputSession.getRepository() .journalId()); Name primaryType = sequencedNode.getPrimaryTypeName(); Set<Name> mixinTypes = sequencedNode.getMixinTypeNames(); for (AbstractJcrNode outputNode : outputNodes) { sequencingChanges.nodeSequenced(sequencedNode.key(), sequencedNode.path(), primaryType, mixinTypes, outputNode.key(), outputNode.path(), work.getOutputPath(), work.getUserId(), work.getSelectedPath(), sequencerName); } sequencingChanges.freeze(outputSession.getUserID(), null, context.getValueFactories().getDateFactory().create()); repository.changeBus().notify(sequencingChanges); }
boolean isNodeUnorderedCollection = nodeTypes.isUnorderedCollection(getPrimaryTypeName(), getMixinTypeNames()); if ((isExternal() || isNodeUnorderedCollection) && session().nodeTypes().isVersionable(mixinNameObj)) { return false;
boolean isNodeUnorderedCollection = nodeTypes.isUnorderedCollection(getPrimaryTypeName(), getMixinTypeNames()); if ((isExternal() || isNodeUnorderedCollection) && session().nodeTypes().isVersionable(mixinNameObj)) { return false;
if (nodeTypes.isUnorderedCollection(sourceNode.getPrimaryTypeName(), sourceNode.getMixinTypeNames())) { throw new ConstraintViolationException(JcrI18n.operationNotSupportedForUnorderedCollections.text("copy"));
MutableCachedNode mutableDestParent = destParentNode.mutable(); if (mutableSrcParent.equals(mutableDestParent)) { if (nodeTypeManager().nodeTypes().isUnorderedCollection(srcParent.getPrimaryTypeName(), srcParent.getMixinTypeNames())) { throw new ConstraintViolationException(JcrI18n.operationNotSupportedForUnorderedCollections.text("rename"));
MutableCachedNode mutableDestParent = destParentNode.mutable(); if (mutableSrcParent.equals(mutableDestParent)) { if (nodeTypeManager().nodeTypes().isUnorderedCollection(srcParent.getPrimaryTypeName(), srcParent.getMixinTypeNames())) { throw new ConstraintViolationException(JcrI18n.operationNotSupportedForUnorderedCollections.text("rename"));