Package org.apache.jackrabbit.uuid

Examples of org.apache.jackrabbit.uuid.UUID


            if (!node.hasPropertyName(QName.JCR_VERSIONHISTORY)) {
                def = itemOps.findApplicablePropertyDefinition(QName.JCR_VERSIONHISTORY,
                        PropertyType.REFERENCE, false, node);
                prop = itemOps.createPropertyState(node, QName.JCR_VERSIONHISTORY,
                        PropertyType.REFERENCE, def);
                prop.setValues(new InternalValue[]{InternalValue.create(new UUID(vh.getUUID()))});
            }

            // jcr:baseVersion
            if (!node.hasPropertyName(QName.JCR_BASEVERSION)) {
                def = itemOps.findApplicablePropertyDefinition(QName.JCR_BASEVERSION,
                        PropertyType.REFERENCE, false, node);
                prop = itemOps.createPropertyState(node, QName.JCR_BASEVERSION,
                        PropertyType.REFERENCE, def);
                prop.setValues(new InternalValue[]{InternalValue.create(new UUID(vh.getRootVersion().getUUID()))});
            }

            // jcr:predecessors
            if (!node.hasPropertyName(QName.JCR_PREDECESSORS)) {
                def = itemOps.findApplicablePropertyDefinition(QName.JCR_PREDECESSORS,
                        PropertyType.REFERENCE, true, node);
                prop = itemOps.createPropertyState(node, QName.JCR_PREDECESSORS,
                        PropertyType.REFERENCE, def);
                prop.setValues(new InternalValue[]{InternalValue.create(new UUID(vh.getRootVersion().getUUID()))});
            }

            // jcr:isCheckedOut
            if (!node.hasPropertyName(QName.JCR_ISCHECKEDOUT)) {
                def = itemOps.findApplicablePropertyDefinition(QName.JCR_ISCHECKEDOUT,
View Full Code Here


                boolean modified = false;
                InternalValue[] values = prop.getValues();
                InternalValue[] newVals = new InternalValue[values.length];
                for (int i = 0; i < values.length; i++) {
                    InternalValue val = values[i];
                    UUID original = (UUID) val.internalValue();
                    UUID adjusted = refTracker.getMappedUUID(original);
                    if (adjusted != null) {
                        newVals[i] = InternalValue.create(adjusted);
                        modified = true;
                    } else {
                        // reference doesn't need adjusting, just copy old value
View Full Code Here

        PropertyState state = (PropertyState) getItemState();
        InternalValue val = state.getValues()[0];
        if (val.getType() == PropertyType.REFERENCE) {
            // reference, i.e. target UUID
            UUID targetUUID = (UUID) val.internalValue();
            return (Node) itemMgr.getItem(new NodeId(targetUUID));
        } else {
            throw new ValueFormatException("property must be of type REFERENCE");
        }
    }
View Full Code Here

        if (reqType == PropertyType.REFERENCE) {
            if (target instanceof NodeImpl) {
                NodeImpl targetNode = (NodeImpl) target;
                if (targetNode.isNodeType(QName.MIX_REFERENCEABLE)) {
                    InternalValue value = InternalValue.create(new UUID(targetNode.getUUID()));
                    internalSetValue(new InternalValue[]{value}, reqType);
                } else {
                    throw new ValueFormatException("target node must be of node type mix:referenceable");
                }
            } else {
View Full Code Here

                conflicting.remove();
            }
        }

        // add node
        UUID uuid = (id == null) ? null : id.getUUID();
        node = parent.addNode(nodeName, nodeTypeName, uuid);
        // add mixins
        if (mixinNames != null) {
            for (int i = 0; i < mixinNames.length; i++) {
                node.addMixin(mixinNames[i]);
View Full Code Here

            if (prop.getDefinition().isMultiple()) {
                Value[] values = prop.getValues();
                Value[] newVals = new Value[values.length];
                for (int i = 0; i < values.length; i++) {
                    Value val = values[i];
                    UUID original = UUID.fromString(val.getString());
                    UUID adjusted = refTracker.getMappedUUID(original);
                    if (adjusted != null) {
                        newVals[i] = new ReferenceValue(session.getNodeByUUID(adjusted));
                    } else {
                        // reference doesn't need adjusting, just copy old value
                        newVals[i] = val;
                    }
                }
                prop.setValue(newVals);
            } else {
                Value val = prop.getValue();
                UUID original = UUID.fromString(val.getString());
                UUID adjusted = refTracker.getMappedUUID(original);
                if (adjusted != null) {
                    prop.setValue(session.getNodeByUUID(adjusted));
                }
            }
        }
View Full Code Here

            case PropertyType.DOUBLE:
                return new InternalValue(value.getDouble());
            case PropertyType.LONG:
                return new InternalValue(value.getLong());
            case PropertyType.REFERENCE:
                return new InternalValue(new UUID(value.getString()));
            case PropertyType.NAME:
                try {
                    return new InternalValue(NameFormat.parse(value.getString(), nsResolver));
                } catch (IllegalNameException ine) {
                    throw new ValueFormatException(ine.getMessage());
View Full Code Here

            case PropertyType.DOUBLE:
                return new InternalValue(Double.valueOf(s).doubleValue());
            case PropertyType.LONG:
                return new InternalValue(Long.valueOf(s).longValue());
            case PropertyType.REFERENCE:
                return new InternalValue(new UUID(s));
            case PropertyType.PATH:
                return new InternalValue(Path.valueOf(s));
            case PropertyType.NAME:
                return new InternalValue(QName.valueOf(s));
            case PropertyType.STRING:
View Full Code Here

            PropertyState[] labels = labelNode.getProperties();
            for (int i = 0; i < labels.length; i++) {
                PropertyState pState = labels[i];
                if (pState.getType() == PropertyType.REFERENCE) {
                    QName name = pState.getName();
                    UUID ref = (UUID) pState.getValues()[0].internalValue();
                    InternalVersionImpl v = (InternalVersionImpl) getVersion(new NodeId(ref));
                    if (v != null) {
                        labelCache.put(name, v);
                        v.internalAddLabel(name);
                    } else {
View Full Code Here

        // copy predecessors from src node
        Value[] preds = src.getProperty(QName.JCR_PREDECESSORS).getValues();
        InternalValue[] predecessors = new InternalValue[preds.length];
        for (int i = 0; i < preds.length; i++) {
            UUID predId = UUID.fromString(preds[i].getString());
            // check if version exist
            if (!versionCache.containsKey(new NodeId(predId))) {
                throw new RepositoryException("invalid predecessor in source node");
            }
            predecessors[i] = InternalValue.create(predId);
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.uuid.UUID

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.