public AddValue<Graph> addValue( Object value ) { return new AddValueAction<Graph>(this, this.getCurrentWorkspaceName(), value) { @Override protected Graph submit( String workspaceName, Location on, Name property, List<Object> values ) { requests.addValues(workspaceName, on, property, values); return nextGraph.and(); } }; }
public RemoveValue<Graph> removeValue( Object value ) { return new RemoveValueAction<Graph>(this, this.getCurrentWorkspaceName(), value) { @Override protected Graph submit( String workspaceName, Location on, Name property, List<Object> values ) { requests.removeValues(workspaceName, on, property, values); return nextGraph.and(); } }; }
/*package*/CopyAction( T afterConjunction, Location from ) { super(afterConjunction); this.from = new Locations(from); this.fromWorkspaceName = Graph.this.getCurrentWorkspaceName(); }
public Conjunction<Graph> on( Location location ) { requests.setProperties(location, getCurrentWorkspaceName(), properties); return nextGraph; }
public Conjunction<Graph> on( Location location ) { requests.removeProperties(location, getCurrentWorkspaceName(), propertyNames); return nextGraph; }
public Conjunction<Graph> node( String name, Iterable<Property> properties ) { Name child = nameFactory.create(name); requests.createNode(parent, getCurrentWorkspaceName(), child, properties.iterator()); return nextGraph; } };
public Conjunction<Graph> node( String name, Property... properties ) { Name child = nameFactory.create(name); requests.createNode(parent, getCurrentWorkspaceName(), child, properties); return nextGraph; }
@Override protected Conjunction<Graph> submit( Location target, org.modeshape.graph.request.LockBranchRequest.LockScope lockScope, long lockTimeoutInMillis ) { String workspaceName = getCurrentWorkspaceName(); requests.lockBranch(workspaceName, target, lockScope, lockTimeoutInMillis); return and(); } };
/** * {@inheritDoc} * * @see org.modeshape.graph.Graph.To#to(org.modeshape.graph.Location) */ public Map<String, Serializable> to( Location desiredLocation ) { return requests.applyFunction(function, inputs, desiredLocation, getCurrentWorkspaceName()).outputs(); }
public Conjunction<Graph> node( String name, Iterator<Property> properties ) { Name child = nameFactory.create(name); requests.createNode(parent, getCurrentWorkspaceName(), child, properties); return nextGraph; }
public Map<Location, Map<Name, Property>> on( Collection<Location> locations ) { CheckArg.isNotNull(locations, "locations"); final List<ReadPropertyRequest> requests = new LinkedList<ReadPropertyRequest>(); String workspace = getCurrentWorkspaceName(); for (Location location : locations) { if (location == null) continue; for (Name propertyName : names) { if (propertyName == null) continue; requests.add(new ReadPropertyRequest(location, workspace, propertyName)); } } return execute(requests); }
public Map<Location, Property> on( Location first, Location... additional ) { CheckArg.isNotNull(first, "first"); final List<ReadPropertyRequest> requests = new LinkedList<ReadPropertyRequest>(); String workspace = getCurrentWorkspaceName(); requests.add(new ReadPropertyRequest(first, workspace, name)); for (Location location : additional) { requests.add(new ReadPropertyRequest(location, workspace, name)); } return execute(requests); }
public Map<Location, Property> on( UUID first, UUID... additional ) { CheckArg.isNotNull(first, "first"); final List<ReadPropertyRequest> requests = new LinkedList<ReadPropertyRequest>(); String workspace = getCurrentWorkspaceName(); requests.add(new ReadPropertyRequest(Location.create(first), workspace, name)); for (UUID uuid : additional) { requests.add(new ReadPropertyRequest(Location.create(uuid), workspace, name)); } return execute(requests); }
public Map<Location, Property> on( String first, String... additional ) { CheckArg.isNotNull(first, "first"); final List<ReadPropertyRequest> requests = new LinkedList<ReadPropertyRequest>(); String workspace = getCurrentWorkspaceName(); requests.add(new ReadPropertyRequest(Location.create(createPath(first)), workspace, name)); for (String path : additional) { requests.add(new ReadPropertyRequest(Location.create(createPath(path)), workspace, name)); } return execute(requests); }
@Override protected Conjunction<Graph> submit( Locations from, Location into, Location before, Name newName ) { String workspaceName = getCurrentWorkspaceName(); do { requests.moveBranch(from.getLocation(), into, before, workspaceName, newName); } while ((from = from.next()) != null); return and(); } };
@Test public void shouldIncludeTimeLoadedInReadNodeRequests() { String workspaceName = graph.getCurrentWorkspaceName(); // Don't use the graph so that we can obtain and interrogate the request ... CacheableRequest request = new ReadNodeRequest(location("/"), workspaceName); execute(request); assertThat(request.getTimeLoaded(), is(notNullValue())); }
@Test public void shouldIncludeTimeLoadedInReadAllPropertiesRequests() { String workspaceName = graph.getCurrentWorkspaceName(); // Don't use the graph so that we can obtain and interrogate the request ... CacheableRequest request = new ReadAllPropertiesRequest(location("/"), workspaceName); execute(request); assertThat(request.getTimeLoaded(), is(notNullValue())); }
@Test public void shouldIncludeTimeLoadedInReadAllChildrenRequests() { String workspaceName = graph.getCurrentWorkspaceName(); // Don't use the graph so that we can obtain and interrogate the request ... CacheableRequest request = new ReadAllChildrenRequest(location("/"), workspaceName); execute(request); assertThat(request.getTimeLoaded(), is(notNullValue())); }
@Test public void shouldIncludeTimeLoadedInReadBranchRequests() { String workspaceName = graph.getCurrentWorkspaceName(); // Don't use the graph so that we can obtain and interrogate the request ... CacheableRequest request = new ReadBranchRequest(location("/"), workspaceName, 2); execute(request); assertThat(request.getTimeLoaded(), is(notNullValue())); }
@FixFor( "MODE-1182" ) @Test public void shouldBeAbleToCreateThenDestroyThenRecreateWorkspace() throws Exception { if (source.getCapabilities().supportsCreatingWorkspaces()) { String defaultWorkspaceName = graph.getCurrentWorkspaceName(); String validWorkspaceName = generateNonExistantWorkspaceName(); graph.createWorkspace().named(validWorkspaceName); graph.useWorkspace(defaultWorkspaceName); graph.destroyWorkspace().named(validWorkspaceName); graph.createWorkspace().named(validWorkspaceName); } }