Package org.modeshape.jcr.value

Examples of org.modeshape.jcr.value.Name


    @Override
    public boolean equals( Object obj ) {
        if (obj == this) return true;
        if (obj instanceof Name) {
            Name that = (Name)obj;
            if (!this.getLocalName().equals(that.getLocalName())) return false;
            if (!this.getNamespaceUri().equals(that.getNamespaceUri())) return false;
            return true;
        }
        return false;
    }
View Full Code Here


        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(),
View Full Code Here

                                             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()
View Full Code Here

        char firstChar = trimmedValue.charAt(0);
        if (firstChar == Path.IDENTIFIER_LEADING_TERMINAL && trimmedValue.charAt(length - 1) == Path.IDENTIFIER_TRAILING_TERMINAL) {
            // This is an identifier path, so read the identifier ...
            String id = trimmedValue.substring(1, length - 1);
            // And create a name and segment ...
            Name idName = getNameValueFactory().create(id);
            return new IdentifierPath(new IdentifierPathSegment(idName));
        }

        // Remove the leading delimiter ...
        if (firstChar == Path.DELIMITER) {
View Full Code Here

        if (endBracketNdx < 0) {
            throw new IllegalArgumentException(GraphI18n.missingEndBracketInSegmentName.text(segmentName));
        }
        if (startBracketNdx == 0 && endBracketNdx == (segmentName.length() - 1)) {
            // This is an identifier segment ...
            Name id = getNameValueFactory().create(segmentName.substring(1, endBracketNdx));
            return new IdentifierPathSegment(id);
        }
        String ndx = segmentName.substring(startBracketNdx + 1, endBracketNdx);
        try {
            return new BasicPathSegment(getNameValueFactory().create(segmentName.substring(0, startBracketNdx), decoder),
View Full Code Here

    private final void addDefinitions( JcrNodeType nodeType ) {
        Set<Name> namesFromThisType = new HashSet<Name>();

        for (JcrNodeDefinition definition : nodeType.childNodeDefinitions()) {
            Name name = definition.getInternalName();

            /*
             * If the child node was already defined in the type hierarchy at some other level, ignore the definition
             * - it was overridden by the previous definition.  This relies on the fact that TypeA.getTypeAndSupertypes()
             * always returns TypeX before TypeY if TypeX is closer to TypeA on the inheritance graph than TypeY is...
             *
             * ...UNLESS this is a residual definition, in which case side-by-side definitions must be allowed per 6.7.8
             * of the 1.0.1 specification.
             */
            if (allChildNodeDefinitions.containsKey(name) && !namesFromThisType.contains(name)
                && !JcrNodeType.RESIDUAL_NAME.equals(name)) {
                continue;
            }

            if (definition.allowsSameNameSiblings()) {
                childNodeDefinitionsThatAllowSns.put(name, definition);
            } else {
                childNodeDefinitionsThatAllowNoSns.put(name, definition);
            }
            allChildNodeDefinitions.put(name, definition);
            namesFromThisType.add(name);
        }

        namesFromThisType.clear();
        for (JcrPropertyDefinition definition : nodeType.propertyDefinitions()) {
            Name name = definition.getInternalName();

            /*
             * If the property was already defined in the type hierarchy at some other level, ignore the definition
             * - it was overridden by the previous definition.  This relies on the fact that TypeA.getTypeAndSupertypes()
             * always returns TypeX before TypeY if TypeX is closer to TypeA on the inheritance graph than TypeY is...
View Full Code Here

        String childDefinitionNameString = parts[1];
        Name[] requiredPrimaryTypes = new Name[parts.length - 2];
        for (int i = 2, j = 0; i != parts.length; ++i, ++j) {
            requiredPrimaryTypes[j] = factory.create(parts[i]);
        }
        Name nodeTypeName = factory.create(nodeTypeNameString);
        Name childDefinitionName = factory.create(childDefinitionNameString);
        return new NodeDefinitionId(nodeTypeName, childDefinitionName, requiredPrimaryTypes);
    }
View Full Code Here

                assert originalValue instanceof JcrValue;
                JcrValue jcrValue = ((JcrValue)originalValue);
                this.defaultValues[i] = new JcrValue(jcrValue.factories(), jcrValue.getType(), jcrValue.value());
                switch (jcrValue.getType()) {
                    case PropertyType.NAME:
                        Name nameValue = original.getContext().getValueFactories().getNameFactory().create(jcrValue.value());
                        JcrItemDefinitionTemplate.registerMissingNamespaces(original.getContext(), context, nameValue);
                        break;
                    case PropertyType.PATH:
                        Path pathValue = original.getContext().getValueFactories().getPathFactory().create(jcrValue.value());
                        JcrItemDefinitionTemplate.registerMissingNamespaces(original.getContext(), context, pathValue);
                        break;
                }
            }
        }

        //check if there are constraints of type Name, for which additional namespaces may need registration
        boolean shouldCheckForNameConstraints = requiredType == PropertyType.NAME ||
                                                requiredType == PropertyType.REFERENCE ||
                                                requiredType == PropertyType.WEAKREFERENCE ||
                                                requiredType == org.modeshape.jcr.api.PropertyType.SIMPLE_REFERENCE;
        if (this.valueConstraints != null && this.valueConstraints.length > 0 && shouldCheckForNameConstraints) {
            for (String constraintValue : original.getValueConstraints()) {
                Name nameValue = original.getContext().getValueFactories().getNameFactory().create(constraintValue);
                JcrItemDefinitionTemplate.registerMissingNamespaces(original.getContext(), context, nameValue);
            }
        }
    }
View Full Code Here

    }

    @Test
    public void shouldNotFindInvalidPropertyDefinition() throws Exception {
        // This property name is not defined for any of our test types
        Name badName = nameFactory.create("undefinedName");
        JcrPropertyDefinition propDef;

        propDef = nodeTypes().findPropertyDefinition(session,
                                                     NODE_TYPE_A,
                                                     Collections.<Name>emptyList(),
View Full Code Here

            for (NodeTypeDefinition nodeTypeDefn : nodeTypeDefns) {
                if (nodeTypeDefn instanceof JcrNodeTypeTemplate) {
                    // Switch to use this context, so names are properly prefixed ...
                    nodeTypeDefn = ((JcrNodeTypeTemplate)nodeTypeDefn).with(context);
                }
                Name internalName = nodeTypes.nameFactory().create(nodeTypeDefn.getName());
                if (internalName == null || internalName.getLocalName().length() == 0) {
                    throw new InvalidNodeTypeDefinitionException(JcrI18n.invalidNodeTypeName.text());
                }

                boolean found = nodeTypes.hasNodeType(internalName);
                if (found && failIfNodeTypeDefinitionsExist) {
View Full Code Here

TOP

Related Classes of org.modeshape.jcr.value.Name

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.