@Override public Observable<Application> refreshAsync() { return super.refreshAsync().map(new Func1<Application, Application>() { @Override public Application call(Application application) { ApplicationImpl impl = (ApplicationImpl) application; impl.applicationPackages.refresh(); return impl; } }); }
/** * Add a creatable dependency for this model. * * @param creatable the creatable dependency. * @return the key to be used as parameter to taskResult(string) method to retrieve created dependency */ @SuppressWarnings("unchecked") protected String addDependency(Creatable<? extends Indexable> creatable) { TaskGroup.HasTaskGroup dependency = (TaskGroup.HasTaskGroup) creatable; return this.addDependency(dependency); }
/** * Add an appliable "post-run" dependent for this model. * * @param appliable the appliable "post-run" dependent. * @return the key to be used as parameter to taskResult(string) method to retrieve updated "post-run" dependent */ @SuppressWarnings("unchecked") protected String addPostRunDependent(Appliable<? extends Indexable> appliable) { TaskGroup.HasTaskGroup dependency = (TaskGroup.HasTaskGroup) appliable; return this.addPostRunDependent(dependency); }
/** * Prepare the given model of an external child resource for inline removal (along with the definition or update of parent resource). * * @param model the model representing child resource to remove */ protected final void prepareInlineRemove(FluentModelTImpl model) { FluentModelTImpl childResource = find(model.childResourceKey()); if (childResource != null) { throw new IllegalArgumentException(pendingOperationMessage(model.name(), model.childResourceKey())); } model.setPendingOperation(ExternalChildResourceImpl.PendingOperation.ToBeRemoved); this.childCollection.put(model.childResourceKey(), model); super.prepareForFutureCommitOrPostRun(model); }
/** * @return the key of this child resource in the collection maintained by ExternalChildResourceCollectionImpl */ public String childResourceKey() { return name(); }
@Override public FluentModelT apply() { return applyAsync().toBlocking().last(); }
@Override public FluentModelT create() { return Utils.<FluentModelT>rootResource(createAsync()).toBlocking().single(); }
@Override public Observable<FluentModelT> refreshAsync() { final ExternalChildResourceImpl<FluentModelT, InnerModelT, ParentImplT, ParentT> self = this; return this.getInnerAsync().map(new Func1<InnerModelT, FluentModelT>() { @Override public FluentModelT call(InnerModelT innerModelT) { self.setInner(innerModelT); return (FluentModelT) self; } }); }
/** * Initializes the external child resource collection. */ protected void cacheCollection() { this.clear(); for (FluentModelTImpl childResource : this.listChildResources()) { this.childCollection.put(childResource.childResourceKey(), childResource); } }
/** * Clear the child collection. */ public void clear() { for (FluentModelTImpl child : childCollection.values()) { child.clear(); } this.childCollection.clear(); }
/** * Prepare the given model of an external child resource for inline create (along with the definition or update of parent resource). * * @param model the model to track create changes * @return the external child resource prepared for create */ protected final FluentModelTImpl prepareInlineDefine(FluentModelTImpl model) { FluentModelTImpl childResource = find(model.childResourceKey()); if (childResource != null) { throw new IllegalArgumentException(pendingOperationMessage(model.name(), model.childResourceKey())); } model.setPendingOperation(ExternalChildResourceImpl.PendingOperation.ToBeCreated); this.childCollection.put(model.childResourceKey(), model); return super.prepareForFutureCommitOrPostRun(model); }
/** * @return the key of this child resource in the collection maintained by ExternalChildResourceCollectionImpl */ public String childResourceKey() { return name(); }
@Override public ServiceFuture<FluentModelT> applyAsync(ServiceCallback<FluentModelT> callback) { return ServiceFuture.fromBody(applyAsync(), callback); }
@Override public FluentModelT create() { return Utils.<FluentModelT>rootResource(createAsync()).toBlocking().single(); }
@Override public Observable<FluentModelT> refreshAsync() { final ExternalChildResourceImpl<FluentModelT, InnerModelT, ParentImplT, ParentT> self = this; return this.getInnerAsync().map(new Func1<InnerModelT, FluentModelT>() { @Override public FluentModelT call(InnerModelT innerModelT) { self.setInner(innerModelT); return (FluentModelT) self; } }); }
/** * Initializes the external child resource collection. */ protected void cacheCollection() { this.clear(); for (FluentModelTImpl childResource : this.listChildResources()) { this.childCollection.put(childResource.childResourceKey(), childResource); } }
/** * Clear the child collection. */ public void clear() { for (FluentModelTImpl child : childCollection.values()) { child.clear(); } this.childCollection.clear(); }
/** * Prepare the given model of an external child resource for inline removal (along with the definition or update of parent resource). * * @param model the model representing child resource to remove */ protected final void prepareInlineRemove(FluentModelTImpl model) { FluentModelTImpl childResource = find(model.childResourceKey()); if (childResource != null) { throw new IllegalArgumentException(pendingOperationMessage(model.name(), model.childResourceKey())); } model.setPendingOperation(ExternalChildResourceImpl.PendingOperation.ToBeRemoved); this.childCollection.put(model.childResourceKey(), model); super.prepareForFutureCommitOrPostRun(model); }
@Override public Observable<CdnEndpoint> refreshAsync() { final CdnEndpointImpl self = this; return super.refreshAsync().flatMap(new Func1<CdnEndpoint, Observable<CdnEndpoint>>() { @Override public Observable<CdnEndpoint> call(CdnEndpoint cdnEndpoint) { self.customDomainList.clear(); self.deletedCustomDomainList.clear(); return self.parent().manager().inner().customDomains().listByEndpointAsync( self.parent().resourceGroupName(), self.parent().name(), self.name()) .flatMap(new Func1<Page<CustomDomainInner>, Observable<CdnEndpoint>>() { @Override public Observable<CdnEndpoint> call(Page<CustomDomainInner> customDomainInnerPage) { self.customDomainList.addAll(customDomainInnerPage.items()); return Observable.just((CdnEndpoint) self); } }); } }); }
/** * Add an appliable dependency for this model. * * @param appliable the appliable dependency. * @return the key to be used as parameter to taskResult(string) method to retrieve updated dependency */ @SuppressWarnings("unchecked") protected String addeDependency(Appliable<? extends Indexable> appliable) { TaskGroup.HasTaskGroup dependency = (TaskGroup.HasTaskGroup) appliable; return this.addDependency(dependency); }