/** * {@inheritDoc} * * @see org.modeshape.graph.property.ValueTypeSystem.Factory#create(java.lang.String) */ @Override public DateTime create( String value ) throws ValueFormatException { DateTime result = valueFactory.create(value); // Convert the timestamp to UTC, since that's how everything should be queried ... return result.toUtcTimeZone(); } };
private String stringValueOf( Node node, Name propertyName ) { Property property = node.getProperty(propertyName); if (property == null) { // Check whether the property exists with no namespace ... property = node.getProperty(context.getValueFactories().getNameFactory().create(propertyName.getLocalName())); if (property == null) return null; } if (property.isEmpty()) return null; return context.getValueFactories().getStringFactory().create(property.getFirstValue()); }
private String[] stringValuesOf( Node node, Name propertyName ) { Property property = node.getProperty(propertyName); if (property == null) { // Check whether the property exists with no namespace ... property = node.getProperty(context.getValueFactories().getNameFactory().create(propertyName.getLocalName())); if (property == null) return null; } return context.getValueFactories().getStringFactory().create(property.getValuesAsArray()); }
public PathNode createNode( ExecutionContext context, String pathToNewNode, Map<Name, Property> properties, NodeConflictBehavior conflictBehavior ) { PathFactory pathFactory = context.getValueFactories().getPathFactory(); Path newPath = pathFactory.create(pathToNewNode); return createNode(context, getNode(newPath.getParent()), newPath.getLastSegment().getName(), properties, conflictBehavior); }
protected Property createProperty( String name, Object... values ) { return propertyFactory.create(valueFactories.getNameFactory().create(name), values); }
protected String getPrefixFor( Path path ) { Path.Segment lastSegment = path.getLastSegment(); String localName = lastSegment.getName().getLocalName(); int index = lastSegment.getIndex(); return getPrefixFor(localName, index); }
public Object evaluate( Object[] tuple ) { Location location = (Location)tuple[locationIndex]; if (location == null) return null; Path path = location.getPath(); assert path != null; return path.isRoot() ? "" : location.getPath().getLastSegment().getName().getLocalName(); } };
protected long longValue( Object value ) { if (value instanceof Property) value = ((Property)value).getFirstValue(); return context.getValueFactories().getLongFactory().create(value); }
/** * {@inheritDoc} * * @see org.modeshape.graph.property.ValueTypeSystem.Factory#asReadableString(java.lang.Object) */ @Override public String asReadableString( Object value ) { return stringValueFactory.create(value); } };
/** * {@inheritDoc} * * @see org.modeshape.graph.property.Path#isRoot() */ public boolean isRoot() { if (child.isParentReference()) return parent.isRoot(); return false; }
/** * Get the name of the property. * * @return the propert name; never null */ public Name getName() { return property.getName(); }
protected Factory( ValueFactory<T> valueFactory ) { this.valueFactory = valueFactory; this.type = this.valueFactory.getPropertyType(); this.typeName = type.getName().toUpperCase(); }
/** * {@inheritDoc} * * @see org.modeshape.graph.property.NamespaceRegistry#getRegisteredNamespaceUris() */ public Set<String> getRegisteredNamespaceUris() { // Do not include the aliases in the namespace URIs ... return delegate.getRegisteredNamespaceUris(); }
/** * {@inheritDoc} * * @see org.modeshape.graph.query.model.TypeSystem.TypeFactory#getType() */ @SuppressWarnings( "unchecked" ) public Class<T> getType() { return (Class<T>)type.getValueClass(); }
/** * {@inheritDoc} * * @see org.modeshape.graph.query.model.TypeSystem#asString(java.lang.Object) */ public String asString( Object value ) { return stringValueFactory.create(value); }
/** * {@inheritDoc} * * @see org.modeshape.graph.query.model.TypeSystem.TypeFactory#create(java.lang.String) */ public T create( String value ) throws ValueFormatException { return valueFactory.create(value); }
/** * {@inheritDoc} * * @see org.modeshape.graph.query.model.TypeSystem.TypeFactory#create(java.lang.Object) */ public T create( Object value ) throws ValueFormatException { return valueFactory.create(value); }