@Override public void handleGet(Operation op) { ServiceDocument state = new ServiceDocument(); state.documentSelfLink = SELF_LINK; op.setBody(state).complete(); } }
o = visitor.getServiceDocumentBuiltInContentOnly(); } else { ServiceDocument stateClone = new ServiceDocument(); state.copyTo(stateClone); o = stateClone;
if (!ServiceDocument.equals(desc, stateA, stateB)) { results.add(DocumentRelationship.IN_CONFLICT);
@Override public void copyTo(ServiceDocument target) { super.copyTo(target); if (target instanceof MultiTenantDocument) { MultiTenantDocument mtd = (MultiTenantDocument)target; mtd.tenantLinks = this.tenantLinks; } } }
@Override public void accept(ServiceDocumentQueryElementResult<SslTrustCertificateState> result) { if (result.hasException()) { Utils.logWarning("Exception during ssl trust cert loading: %s", (result.getException() instanceof CancellationException) ? result.getException().getClass().getName() : Utils.toString(result.getException())); } else if (result.hasResult()) { SslTrustCertificateState sslTrustCert = result.getResult(); self.host.log(Level.FINE, "Adding certificate %s", sslTrustCert.fingerprint); if (ServiceDocument.isDeleted(sslTrustCert)) { deleteCertificate(sslTrustCert.getAlias()); } else { loadCertificate(sslTrustCert); } } }
if (ServiceDocument.isDeleted(t.state)) { Operation.failServiceMarkedDeleted(t.state.documentSelfLink, op); return; .compare(selectedState, t.state, t.stateDescription, Utils.getTimeComparisonEpsilonMicros()) .contains(ServiceDocument.DocumentRelationship.EQUAL_VERSION); if (ServiceDocument.isDeleted(selectedState)) { Operation.failServiceMarkedDeleted(t.state.documentSelfLink, op);
@Override public boolean shouldSkipField(FieldAttributes fieldAttributes) { return ServiceDocument.isBuiltInDocumentField(fieldAttributes.getName()); } }
public void copyTo(ResourceState target) { super.copyTo(target); target.id = this.id; target.name = this.name; target.customProperties = this.customProperties; target.tenantLinks = this.tenantLinks; target.groupLinks = this.groupLinks; target.tagLinks = this.tagLinks; target.creationTimeMicros = this.creationTimeMicros; target.regionId = this.regionId; }
SubscriptionNotification<T> notification = new SubscriptionNotification<>(); notification.result = r.getResult(); notification.operation = ServiceDocument.isDeleted(r .getResult()) ? NotificationOperation.DELETE : NotificationOperation.UPDATE;
/** * Perform merge of Objects using the given strategy * * @param copyTo * @param copyFrom * @param fieldMergeStrategy */ public static void mergeObjects(Object copyTo, Object copyFrom, BinaryOperator<Object> fieldMergeStrategy) { for (Field field : copyFrom.getClass().getFields()) { // skip framework and static fields if (ServiceDocument.isBuiltInDocumentField(field.getName()) || Modifier.isStatic(field.getModifiers())) { continue; } try { Object value = field.get(copyFrom); Object oldValue = field.get(copyTo); field.set(copyTo, fieldMergeStrategy.apply(oldValue, value)); } catch (IllegalArgumentException | IllegalAccessException e) { throw new RuntimeException(e); } } }
public static Operation createNodeGroupPostOp( ServiceHost host, String groupName) { ServiceDocument d = new ServiceDocument(); d.documentSelfLink = groupName; return Operation .createPost(UriUtils.buildUri(host, NodeGroupFactoryService.class)) .setBody(d); }
ServiceDocument stateClone = new ServiceDocument(); state.copyTo(stateClone); rsp.documents.put(link, stateClone); } else if (state == null) {
TagState currentState = getState(patch); if (!ServiceDocument.equals(getStateDescription(), currentState, patchState)) { patch.fail(new UnsupportedOperationException("Tags may not be modified")); return;
@Override public void copyTo(ServiceDocument target) { super.copyTo(target); if (target instanceof ServiceDocumentQueryResult) { ServiceDocumentQueryResult sdqr = (ServiceDocumentQueryResult) target; sdqr.documentLinks = this.documentLinks; sdqr.documents = this.documents; sdqr.selectedLinksPerDocument = this.selectedLinksPerDocument; sdqr.selectedLinks = this.selectedLinks; sdqr.documentCount = this.documentCount; sdqr.prevPageLink = this.prevPageLink; sdqr.nextPageLink = this.nextPageLink; sdqr.nextPageLinksPerGroup = this.nextPageLinksPerGroup; sdqr.queryTimeMicros = this.queryTimeMicros; sdqr.continuousResults = this.continuousResults; } }
assertTrue(ServiceDocument.isDeleted(descs.get(0)));
EnumSet<PropertyUsageOption> usageOptions = cd.propertyDescription.usageOptions; if (!ServiceDocument.isBuiltInDocumentField(propertyName) && cd.parent == null && !indexingOptions.contains(PropertyIndexingOption.STORE_ONLY)) {
protected void doDelete(URI uri, boolean expectFailure, Map<String, String> requestHeaders) throws Throwable { doOperation(new ServiceDocument(), uri, ServiceDocument.class, expectFailure, Action.DELETE, requestHeaders); }
ServiceDocument one = new ServiceDocument(); one.documentAuthPrincipalLink = UUID.randomUUID().toString(); one.documentDescription = null; one.documentVersion = Utils.getNowMicrosUtc(); ServiceDocument two = new ServiceDocument(); one.copyTo(two);
@Override public void handlePut(Operation put) { TagState currentState = getState(put); TagState newTagState = put.getBody(TagState.class); if (!ServiceDocument.equals(getStateDescription(), currentState, newTagState)) { put.fail(new UnsupportedOperationException("Tags may not be modified")); return; } // check if the tag has to be turned from external to local boolean modified = false; if (newTagState.external != null) { if (currentState.external == null || (Boolean.TRUE.equals(currentState.external) && Boolean.FALSE.equals(newTagState.external))) { currentState.external = newTagState.external; modified = true; } } if (!modified) { put.setStatusCode(Operation.STATUS_CODE_NOT_MODIFIED); } put.setBody(currentState); put.complete(); }