/** * Returns the id of the associated item of this <code>EventState</code>. * * @return the <code>ItemId</code> or <code>null</code> for {@link Event#PERSIST} events */ ItemId getTargetId() { if (type == Event.PERSIST) { return null; } else if (childId == null) { // property event return new PropertyId(parentId, childRelPath.getName()); } else { // node event return childId; } }
/** * {@inheritDoc} */ public void writePropertyId(PropertyId propertyId) throws JournalException { writeNodeId(propertyId.getParentId()); writeQName(propertyId.getName()); }
public boolean equals(Object object) { if (object instanceof PropertyEntry) { PropertyEntry that = (PropertyEntry) object; return id.equals(that.id) && type == that.type && multiValued == that.multiValued && Arrays.equals(values, that.values); } else { return false; } }
/** * Retrieves the property state for the given id * * @param id * @return * @throws NoSuchItemStateException * @throws ItemStateException */ protected VirtualPropertyState internalGetPropertyState(PropertyId id) throws NoSuchItemStateException, ItemStateException { // get parent state NodeState parent = (NodeState) getItemState(id.getParentId()); // handle some default prop states if (parent instanceof VirtualNodeState) { return ((VirtualNodeState) parent).getProperty(id.getName()); } throw new NoSuchItemStateException(id.toString()); }
/** * {@inheritDoc} */ public NodeId getParentId() { return id.getParentId(); }
/** * {@inheritDoc} */ @Override public Name getQName() { return ((PropertyId) id).getName(); }
/** * {@inheritDoc} */ public String createId(PropertyId id, int index) { // the blobId is a simple string concatenation of id plus index StringBuilder sb = new StringBuilder(); sb.append(id.toString()); sb.append('['); sb.append(index); sb.append(']'); return sb.toString(); }
/** * Deserializes a <code>NodeReferences</code> object from the given * binary <code>stream</code>. * * @param refs object to deserialize * @param stream the stream where the object should be deserialized from * @throws Exception if an error occurs during the deserialization * @see #serialize(NodeReferences, OutputStream) */ public static void deserialize(NodeReferences refs, InputStream stream) throws Exception { DataInputStream in = new DataInputStream(stream); refs.clearAllReferences(); // references int count = in.readInt(); // count for (int i = 0; i < count; i++) { refs.addReference(PropertyId.valueOf(in.readUTF())); // propertyId } } }
/** * {@inheritDoc} */ public NodeId getParentId() { return id.getParentId(); }
/** * Retrieves the property state for the given id * * @param id * @return * @throws NoSuchItemStateException * @throws ItemStateException */ protected VirtualPropertyState internalGetPropertyState(PropertyId id) throws NoSuchItemStateException, ItemStateException { // get parent state NodeState parent = (NodeState) getItemState(id.getParentId()); // handle some default prop states if (parent instanceof VirtualNodeState) { return ((VirtualNodeState) parent).getProperty(id.getName()); } throw new NoSuchItemStateException(id.toString()); }
/** * Returns the property name * @return the property name */ public Name getName() { return id.getName(); }
/** * {@inheritDoc} */ public String createId(PropertyId id, int index) { // the blobId is a simple string concatenation of id plus index StringBuilder sb = new StringBuilder(); sb.append(id.toString()); sb.append('['); sb.append(index); sb.append(']'); return sb.toString(); }
/** * Deserializes a <code>NodeReferences</code> object from the given * binary <code>stream</code>. * * @param refs object to deserialize * @param stream the stream where the object should be deserialized from * @throws Exception if an error occurs during the deserialization * @see #serialize(NodeReferences, OutputStream) */ public static void deserialize(NodeReferences refs, InputStream stream) throws Exception { DataInputStream in = new DataInputStream(stream); refs.clearAllReferences(); // references int count = in.readInt(); // count for (int i = 0; i < count; i++) { refs.addReference(PropertyId.valueOf(in.readUTF())); // propertyId } } }
/** * Returns the id of the associated item of this <code>EventState</code>. * * @return the <code>ItemId</code> or <code>null</code> for {@link Event#PERSIST} events */ ItemId getTargetId() { if (type == Event.PERSIST) { return null; } else if (childId == null) { // property event return new PropertyId(parentId, childRelPath.getName()); } else { // node event return childId; } }
/** * {@inheritDoc} */ public void writePropertyId(PropertyId propertyId) throws JournalException { writeNodeId(propertyId.getParentId()); writeQName(propertyId.getName()); }
@Override public boolean hasItemState(ItemId id) { if (id instanceof HippoNodeId || id instanceof ParameterizedNodeId) { return true; } else if (id instanceof PropertyId && ((PropertyId)id).getParentId() instanceof HippoNodeId) { return true; } return super.hasItemState(id); }
NodePropBundle bundle = getBundle(id.getParentId()); if (bundle != null) { PropertyState state = createNew(id); PropertyEntry p = bundle.getPropertyEntry(id.getName()); if (p != null) { state.setMultiValued(p.isMultiValued()); state.setValues(p.getValues()); state.setModCount(p.getModCount()); } else if (id.getName().equals(JCR_UUID)) { state.setType(PropertyType.STRING); state.setMultiValued(false); state.setValues(new InternalValue[] { InternalValue.create(id.getParentId().toString()) }); } else if (id.getName().equals(JCR_PRIMARYTYPE)) { state.setType(PropertyType.NAME); state.setMultiValued(false); state.setValues(new InternalValue[] { InternalValue.create(bundle.getNodeTypeName()) }); } else if (id.getName().equals(JCR_MIXINTYPES)) { state.setType(PropertyType.NAME); state.setMultiValued(true); mixins.toArray(new Name[mixins.size()]))); } else { throw new NoSuchItemStateException(id.toString()); throw new NoSuchItemStateException(id.toString());
/** * Returns the name of this property. * * @return the name of this property. */ public Name getName() { return id.getName(); }
/** * Serializes the specified <code>NodeReferences</code> object to the given * binary <code>stream</code>. * * @param refs object to serialize * @param stream the stream where the object should be serialized to * @throws Exception if an error occurs during the serialization * @see #deserialize(NodeReferences, InputStream) */ public static void serialize(NodeReferences refs, OutputStream stream) throws Exception { DataOutputStream out = new DataOutputStream(stream); // references Collection<PropertyId> c = refs.getReferences(); out.writeInt(c.size()); // count for (Iterator<PropertyId> iter = c.iterator(); iter.hasNext();) { PropertyId propId = iter.next(); out.writeUTF(propId.toString()); // propertyId } }
id = PropertyId.valueOf(s);