93219: Simplify DataService feature interfaces

Get rid of optional methods
- createPatchFromCache is useful -> make required
- leave getFindAllHref and getSearchByHref out & use implementation directly or refactor usages
This commit is contained in:
Yury Bondarenko
2022-09-12 17:34:25 +02:00
parent c32e4ad7c7
commit 8b4dbbad55
23 changed files with 86 additions and 192 deletions

View File

@@ -108,23 +108,10 @@ export class WorkflowItemDataService extends IdentifiableDataService<WorkflowIte
public findByItem(uuid: string, useCachedVersionIfAvailable = false, reRequestOnStale = true, options: FindListOptions = {}, ...linksToFollow: FollowLinkConfig<WorkspaceItem>[]): Observable<RemoteData<WorkspaceItem>> {
const findListOptions = new FindListOptions();
findListOptions.searchParams = [new RequestParam('uuid', encodeURIComponent(uuid))];
const href$ = this.getSearchByHref(this.searchByItemLinkPath, findListOptions, ...linksToFollow);
const href$ = this.searchData.getSearchByHref(this.searchByItemLinkPath, findListOptions, ...linksToFollow);
return this.findByHref(href$, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow);
}
/**
* Create the HREF for a specific object's search method with given options object
*
* @param searchMethod The search method for the object
* @param options The [[FindListOptions]] object
* @return {Observable<string>}
* Return an observable that emits created HREF
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved
*/
public getSearchByHref(searchMethod: string, options?: FindListOptions, ...linksToFollow): Observable<string> {
return this.searchData.getSearchByHref(searchMethod, options, ...linksToFollow);
}
/**
* Make a new FindListRequest with given search method
*