"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/app/core/data/entity-type.service.ts" between
dspace-angular-dspace-7.0.tar.gz and dspace-angular-dspace-7.1.tar.gz

About: dspace-angular is the Angular-based frontend of DSpace, a digital repository system to capture, store, index, preserve and redistribute an organization’s research material in digital formats.

entity-type.service.ts  (dspace-angular-dspace-7.0):entity-type.service.ts  (dspace-angular-dspace-7.1)
skipping to change at line 13 skipping to change at line 13
import { RequestService } from './request.service'; import { RequestService } from './request.service';
import { RemoteDataBuildService } from '../cache/builders/remote-data-build.serv ice'; import { RemoteDataBuildService } from '../cache/builders/remote-data-build.serv ice';
import { Store } from '@ngrx/store'; import { Store } from '@ngrx/store';
import { CoreState } from '../core.reducers'; import { CoreState } from '../core.reducers';
import { HALEndpointService } from '../shared/hal-endpoint.service'; import { HALEndpointService } from '../shared/hal-endpoint.service';
import { ObjectCacheService } from '../cache/object-cache.service'; import { ObjectCacheService } from '../cache/object-cache.service';
import { NotificationsService } from '../../shared/notifications/notifications.s ervice'; import { NotificationsService } from '../../shared/notifications/notifications.s ervice';
import { HttpClient } from '@angular/common/http'; import { HttpClient } from '@angular/common/http';
import { DefaultChangeAnalyzer } from './default-change-analyzer.service'; import { DefaultChangeAnalyzer } from './default-change-analyzer.service';
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { FindListOptions } from './request.models';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { switchMap, take, map } from 'rxjs/operators'; import { filter, map, switchMap, take } from 'rxjs/operators';
import { RemoteData } from './remote-data'; import { RemoteData } from './remote-data';
import { RelationshipType } from '../shared/item-relationships/relationship-type .model'; import { RelationshipType } from '../shared/item-relationships/relationship-type .model';
import { PaginatedList } from './paginated-list.model'; import { PaginatedList } from './paginated-list.model';
import { ItemType } from '../shared/item-relationships/item-type.model'; import { ItemType } from '../shared/item-relationships/item-type.model';
import { getRemoteDataPayload, getFirstSucceededRemoteData } from '../shared/ope rators'; import { getFirstSucceededRemoteData, getRemoteDataPayload } from '../shared/ope rators';
import { RelationshipTypeService } from './relationship-type.service'; import { RelationshipTypeService } from './relationship-type.service';
/** /**
* Service handling all ItemType requests * Service handling all ItemType requests
*/ */
@Injectable() @Injectable()
export class EntityTypeService extends DataService<ItemType> { export class EntityTypeService extends DataService<ItemType> {
protected linkPath = 'entitytypes'; protected linkPath = 'entitytypes';
skipping to change at line 59 skipping to change at line 60
*/ */
getRelationshipTypesEndpoint(entityTypeId: string): Observable<string> { getRelationshipTypesEndpoint(entityTypeId: string): Observable<string> {
return this.halService.getEndpoint(this.linkPath).pipe( return this.halService.getEndpoint(this.linkPath).pipe(
switchMap((href) => this.halService.getEndpoint('relationshiptypes', `${hr ef}/${entityTypeId}`)) switchMap((href) => this.halService.getEndpoint('relationshiptypes', `${hr ef}/${entityTypeId}`))
); );
} }
/** /**
* Check whether a given entity type is the left type of a given relationship type, as an observable boolean * Check whether a given entity type is the left type of a given relationship type, as an observable boolean
* @param relationshipType the relationship type for which to check whether t he given entity type is the left type * @param relationshipType the relationship type for which to check whether t he given entity type is the left type
* @param entityType the entity type for which to check whether it is the lef t type of the given relationship type * @param itemType the entity type for which to check whether it is the left type of the given relationship type
*/ */
isLeftType(relationshipType: RelationshipType, itemType: ItemType): Observable <boolean> { isLeftType(relationshipType: RelationshipType, itemType: ItemType): Observable <boolean> {
return relationshipType.leftType.pipe( return relationshipType.leftType.pipe(
getFirstSucceededRemoteData(), getFirstSucceededRemoteData(),
getRemoteDataPayload(), getRemoteDataPayload(),
map((leftType) => leftType.uuid === itemType.uuid), map((leftType) => leftType.uuid === itemType.uuid),
); );
} }
/** /**
* Returns a list of entity types for which there is at least one collection i
n which the user is authorized to submit
*
* @param {FindListOptions} options
*/
getAllAuthorizedRelationshipType(options: FindListOptions = {}): Observable<Re
moteData<PaginatedList<ItemType>>> {
const searchHref = 'findAllByAuthorizedCollection';
return this.searchBy(searchHref, options).pipe(
filter((type: RemoteData<PaginatedList<ItemType>>) => !type.isResponsePend
ing));
}
/**
* Used to verify if there are one or more entities available
*/
hasMoreThanOneAuthorized(): Observable<boolean> {
const findListOptions: FindListOptions = {
elementsPerPage: 2,
currentPage: 1
};
return this.getAllAuthorizedRelationshipType(findListOptions).pipe(
map((result: RemoteData<PaginatedList<ItemType>>) => {
let output: boolean;
if (result.payload) {
output = ( result.payload.page.length > 1 );
} else {
output = false;
}
return output;
})
);
}
/**
* It returns a list of entity types for which there is at least one collectio
n
* in which the user is authorized to submit supported by at least one externa
l data source provider
*
* @param {FindListOptions} options
*/
getAllAuthorizedRelationshipTypeImport(options: FindListOptions = {}): Observa
ble<RemoteData<PaginatedList<ItemType>>> {
const searchHref = 'findAllByAuthorizedExternalSource';
return this.searchBy(searchHref, options).pipe(
filter((type: RemoteData<PaginatedList<ItemType>>) => !type.isResponsePend
ing));
}
/**
* Used to verify if there are one or more entities available. To use with ext
ernal source import.
*/
hasMoreThanOneAuthorizedImport(): Observable<boolean> {
const findListOptions: FindListOptions = {
elementsPerPage: 2,
currentPage: 1
};
return this.getAllAuthorizedRelationshipTypeImport(findListOptions).pipe(
map((result: RemoteData<PaginatedList<ItemType>>) => {
let output: boolean;
if (result.payload) {
output = ( result.payload.page.length > 1 );
} else {
output = false;
}
return output;
})
);
}
/**
* Get the allowed relationship types for an entity type * Get the allowed relationship types for an entity type
* @param entityTypeId * @param entityTypeId
* @param useCachedVersionIfAvailable If this is true, the request will only b e sent if there's * @param useCachedVersionIfAvailable If this is true, the request will only b e sent if there's
* no valid cached version. Defaults to tru e * no valid cached version. Defaults to tru e
* @param reRequestOnStale Whether or not the request should automa tically be re- * @param reRequestOnStale Whether or not the request should automa tically be re-
* requested after the response becomes sta le * requested after the response becomes sta le
* @param linksToFollow List of {@link FollowLinkConfig} that in dicate which * @param linksToFollow List of {@link FollowLinkConfig} that in dicate which
* {@link HALLink}s should be automatically resolved * {@link HALLink}s should be automatically resolved
*/ */
getEntityTypeRelationships(entityTypeId: string, useCachedVersionIfAvailable = true, reRequestOnStale = true, ...linksToFollow: FollowLinkConfig<RelationshipT ype>[]): Observable<RemoteData<PaginatedList<RelationshipType>>> { getEntityTypeRelationships(entityTypeId: string, useCachedVersionIfAvailable = true, reRequestOnStale = true, ...linksToFollow: FollowLinkConfig<RelationshipT ype>[]): Observable<RemoteData<PaginatedList<RelationshipType>>> {
 End of changes. 5 change blocks. 
3 lines changed or deleted 79 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)