protected String readable( Object obj ) { return valueFactories.getStringFactory().create(obj); }
/** * {@inheritDoc} */ @Override public String toString() { StringBuilder sb = new StringBuilder(); ValueFactory<String> strings = factories.getStringFactory(); for (Map.Entry<Path, List<PropertyValue>> entry : this.data.entrySet()) { sb.append(strings.create(entry.getKey())).append(" = "); List<PropertyValue> values = entry.getValue(); if (values.size() == 1) { sb.append(strings.create(values.get(0))); } else { boolean first = true; sb.append('['); for (PropertyValue value : values) { if (first) first = false; else sb.append(", "); sb.append(strings.create(value)); } sb.append(']'); } sb.append('\n'); } return sb.toString(); }
private String getPropertyString( Property property ) { // Surround property value in double quotes so final property looks like: // color = "blue" (single valued property) // colors = ["blue", "red", "green"] (multi-valued property) StringBuilder sb = new StringBuilder(); sb.append(getContext().getValueFactories().getStringFactory().create(property.getName())); sb.append(" = "); if (property.isEmpty()) { sb.append("null"); } else if (property.isSingle()) { String valueStr = getContext().getValueFactories().getStringFactory().create(property.getValues().next()); sb.append('\"').append(valueStr).append('\"'); } else { sb.append('['); boolean first = true; for (Object value : property.getValuesAsArray()) { if (first) first = false; else sb.append(","); String valueStr = getContext().getValueFactories().getStringFactory().create(value); sb.append('\"').append(valueStr).append('\"'); } if (property.isMultiple()) sb.append(']'); } return sb.toString(); } }
@Override public Set<PathExpression> getPathExpressions() { Set<PathExpression> expressions = new HashSet<PathExpression>(); try { Property existingExpressions = getProperty(ModeShapeLexicon.PATH_EXPRESSION); if (existingExpressions != null) { for (Object existing : existingExpressions.getValuesAsArray()) { String existingExpression = context.getValueFactories().getStringFactory().create(existing); expressions.add(PathExpression.compile(existingExpression)); } } } catch (PathNotFoundException e) { // Nothing saved yet ... } return expressions; }
private String getNodeString( ExecutionContext context, Location location ) { StringBuilder sb = new StringBuilder(); sb.append('<'); // Bracket the node ValueFactory<String> strings = context.getValueFactories().getStringFactory(); String name = ""; if (location.getPath().getLastSegment() != null) { name = strings.create(location.getPath().getLastSegment()); } else { name = strings.create(location.getPath()); } if (name.startsWith("{")) { // Remove {xxxx} namespace prefix int end = name.indexOf('}'); name = name.substring(end + 1, name.length()); } // Surround name in double quotes sb.append("name = ").append('\"').append(name).append('\"').append(" "); boolean first = true; if (getProperties() != null) { for (Property entry : getProperties()) { if (first) { first = false; } else sb.append(" "); sb.append(getPropertyString(entry)); } } sb.append(">\n"); return sb.toString(); }
@Override public String getDescription() { Property property = getProperty(ModeShapeLexicon.DESCRIPTION); if (property != null && !property.isEmpty()) { return context.getValueFactories().getStringFactory().create(property.getFirstValue()); } return null; }
this.defaultTypeName = PropertyType.STRING.getName().toUpperCase(); Map<PropertyType, TypeFactory<?>> factories = new HashMap<PropertyType, TypeFactory<?>>(); this.stringValueFactory = valueFactories.getStringFactory(); this.stringFactory = new Factory<String>(stringValueFactory) {
ValueFactory<String> stringFactory = store.getContext().getValueFactories().getStringFactory(); PathFactory pathFactory = store.getContext().getValueFactories().getPathFactory(); Subgraph nsGraph = store.getSubgraphOfDepth(2).at(parentOfNamespaceNodes);
protected String string( Object value ) { if (value instanceof Property) value = ((Property)value).getFirstValue(); return context.getValueFactories().getStringFactory().create(value); }
ValueFactory<String> stringFactory = this.context.getValueFactories().getStringFactory();
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()); }
if (value instanceof String) { append(SINGLE_QUOTE); String str = factories.getStringFactory().create(value); append(str); append(SINGLE_QUOTE); String str = factories.getStringFactory().create(value); append("CAST('").append(str).append("' AS ").append(typeName.toUpperCase()).append(')');
protected boolean doUnregister( String uri ) { // Read the store ... ValueFactory<String> stringFactory = store.getContext().getValueFactories().getStringFactory(); boolean result = false; try { Subgraph nsGraph = store.getSubgraphOfDepth(2).at(parentOfNamespaceNodes); // Iterate over the existing mappings, looking for one that uses the prefix and uri ... Set<Location> locationsToRemove = new HashSet<Location>(); for (Location nsLocation : nsGraph.getRoot().getChildren()) { Node ns = nsGraph.getNode(nsLocation); String actualUri = stringFactory.create(ns.getProperty(uriPropertyName).getFirstValue()); if (actualUri.equals(uri)) { locationsToRemove.add(ns.getLocation()); result = true; } } // Remove any other nodes that have the same URI ... Graph.Batch batch = store.batch(); for (Location namespaceToRemove : locationsToRemove) { batch.delete(namespaceToRemove).and(); } // Execute all these changes ... batch.execute(); } catch (PathNotFoundException e) { // Nothing stored yet, so do nothing ... } return result; }
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()); }
protected String readUriFor( String prefix ) { // Read the store ... try { PathFactory pathFactory = store.getContext().getValueFactories().getPathFactory(); Path pathToNamespaceNode = pathFactory.create(parentOfNamespaceNodes, prefix); Property uri = store.getProperty(uriPropertyName).on(pathToNamespaceNode); // Get the URI property value ... ValueFactory<String> stringFactory = store.getContext().getValueFactories().getStringFactory(); return stringFactory.create(uri.getFirstValue()); } catch (PathNotFoundException e) { // Nothing to read return null; } }
String actualValue = context.getValueFactories().getStringFactory().create(intervalProp.getFirstValue()); problems.addError(RepositoryI18n.unableToUseGarbageCollectionIntervalValue, actualValue);
ValueFactory<String> stringFactory = store.getContext().getValueFactories().getStringFactory(); ValueFactory<Boolean> booleanFactory = store.getContext().getValueFactories().getBooleanFactory(); Set<String> generatedPrefixes = null;
ValueFactory<String> stringFactory = store.getContext().getValueFactories().getStringFactory(); for (Location nsLocation : nsGraph.getRoot().getChildren()) { Node ns = nsGraph.getNode(nsLocation);
RepositoryConnectionFactory connectionFactory = repositoryContext.getRepositoryConnectionFactory(); ValueFactories valueFactories = executionContext.getValueFactories(); ValueFactory<String> strings = valueFactories.getStringFactory(); ValueFactory<Long> longs = valueFactories.getLongFactory(); ProjectionParser projectionParser = ProjectionParser.getInstance();
ProjectionParser projectionParser, Node node ) { ValueFactory<String> strings = context.getValueFactories().getStringFactory();