/** * Add a request to remove the property with the supplied name from the given node. Supplying a name for a property that does * not exist will not cause an error. * * @param on the location of the node to be read * @param workspaceName the name of the workspace containing the node * @param propertyName the name of the property that is to be removed * @return this builder for method chaining; never null * @throws IllegalArgumentException if the location or workspace name is null or if there are no properties to remove */ public BatchRequestBuilder removeProperty( Location on, String workspaceName, Name propertyName ) { // If there's a pending request ... if (pendingRequest != null) { // Compare the supplied location with that of the pending request if (pendingRequest.location.isSame(on)) { // They are the same location, so we can add the properties to the pending request ... pendingRequest.pendingProperties.put(propertyName, null); return this; } // Not the exact same location, so push the existing pending request ... addPending(); } // Record this operation as a pending change ... pendingRequest = new NodeChange(on, workspaceName); pendingRequest.pendingProperties.put(propertyName, null); return this; }
if (pendingRequest != null) { Request newRequest = pendingRequest.toRequest(); if (number == 0) {
/** * Add a request to update the property on the node at the supplied location. This request will create the property if it does * not yet exist. * * @param on the location of the node to be read * @param workspaceName the name of the workspace containing the node * @param property the new property on the node * @return this builder for method chaining; never null * @throws IllegalArgumentException if the location or workspace name is null or if there are no properties to update */ public BatchRequestBuilder setProperty( Location on, String workspaceName, Property property ) { // If there's a pending request ... if (pendingRequest != null) { // Compare the supplied location with that of the pending request if (pendingRequest.location.isSame(on)) { // They are the same location, so we can add the properties to the pending request ... pendingRequest.pendingProperties.put(property.getName(), property); return this; } // Not the exact same location, so push the existing pending request ... addPending(); } // Record this operation as a pending change ... pendingRequest = new NodeChange(on, workspaceName); pendingRequest.pendingProperties.put(property.getName(), property); return this; }
pendingRequest = new NodeChange(on, workspaceName); for (Property property : properties) { if (property == null) continue;
pendingRequest = new NodeChange(on, workspaceName); for (Property property : properties) { if (property == null) continue;
pendingRequest = new NodeChange(on, workspaceName); for (Name propertyName : propertyNames) { pendingRequest.pendingProperties.put(propertyName, null);
protected final BatchRequestBuilder addPending() { if (pendingRequest != null) { requests.add(pendingRequest.toRequest()); pendingRequest = null; } return this; }
/** * Finish any pending request */ public void finishPendingRequest() { if (pendingRequest != null) { // There's a pending request, we need to build it ... add(pendingRequest.toRequest()); pendingRequest = null; } }