Skip to content

Commit 0fbd48e

Browse files
authored
Merge pull request #1475 from 4Science/CST-4506_item_embargo
Add submission section for item embargo
2 parents 3d7fcef + 67d6c6f commit 0fbd48e

35 files changed

+1379
-84
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/**
2+
* Model class for an Item Access Condition
3+
*/
4+
export class AccessesConditionOption {
5+
6+
/**
7+
* The name for this Access Condition
8+
*/
9+
name: string;
10+
11+
/**
12+
* The groupName for this Access Condition
13+
*/
14+
groupName: string;
15+
16+
/**
17+
* A boolean representing if this Access Condition has a start date
18+
*/
19+
hasStartDate: boolean;
20+
21+
/**
22+
* A boolean representing if this Access Condition has an end date
23+
*/
24+
hasEndDate: boolean;
25+
26+
/**
27+
* Maximum value of the start date
28+
*/
29+
endDateLimit?: string;
30+
31+
/**
32+
* Maximum value of the end date
33+
*/
34+
startDateLimit?: string;
35+
36+
/**
37+
* Maximum value of the start date
38+
*/
39+
maxStartDate?: string;
40+
41+
/**
42+
* Maximum value of the end date
43+
*/
44+
maxEndDate?: string;
45+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import { autoserialize, deserialize, inheritSerialization } from 'cerialize';
2+
import { typedObject } from '../../cache/builders/build-decorators';
3+
import { ConfigObject } from './config.model';
4+
import { AccessesConditionOption } from './config-accesses-conditions-options.model';
5+
import { SUBMISSION_ACCESSES_TYPE } from './config-type';
6+
import { HALLink } from '../../shared/hal-link.model';
7+
8+
/**
9+
* Class for the configuration describing the item accesses condition
10+
*/
11+
@typedObject
12+
@inheritSerialization(ConfigObject)
13+
export class SubmissionAccessModel extends ConfigObject {
14+
static type = SUBMISSION_ACCESSES_TYPE;
15+
16+
/**
17+
* A list of available item access conditions
18+
*/
19+
@autoserialize
20+
accessConditionOptions: AccessesConditionOption[];
21+
22+
/**
23+
* Boolean that indicates whether the current item must be findable via search or browse.
24+
*/
25+
@autoserialize
26+
discoverable: boolean;
27+
28+
/**
29+
* Boolean that indicates whether or not the user can change the discoverable flag.
30+
*/
31+
@autoserialize
32+
canChangeDiscoverable: boolean;
33+
34+
/**
35+
* The links to all related resources returned by the rest api.
36+
*/
37+
@deserialize
38+
_links: {
39+
self: HALLink
40+
};
41+
42+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { inheritSerialization } from 'cerialize';
2+
import { typedObject } from '../../cache/builders/build-decorators';
3+
import { SUBMISSION_ACCESSES_TYPE } from './config-type';
4+
import { SubmissionAccessModel } from './config-submission-access.model';
5+
6+
@typedObject
7+
@inheritSerialization(SubmissionAccessModel)
8+
export class SubmissionAccessesModel extends SubmissionAccessModel {
9+
static type = SUBMISSION_ACCESSES_TYPE;
10+
}

src/app/core/config/models/config-type.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,5 @@ export const SUBMISSION_SECTION_TYPE = new ResourceType('submissionsection');
1515
export const SUBMISSION_UPLOADS_TYPE = new ResourceType('submissionuploads');
1616

1717
export const SUBMISSION_UPLOAD_TYPE = new ResourceType('submissionupload');
18+
19+
export const SUBMISSION_ACCESSES_TYPE = new ResourceType('submissionaccessoption');
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import { Injectable } from '@angular/core';
2+
import { ConfigService } from './config.service';
3+
import { RequestService } from '../data/request.service';
4+
import { HALEndpointService } from '../shared/hal-endpoint.service';
5+
import { ObjectCacheService } from '../cache/object-cache.service';
6+
import { dataService } from '../cache/builders/build-decorators';
7+
import { SUBMISSION_ACCESSES_TYPE } from './models/config-type';
8+
import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service';
9+
import { Store } from '@ngrx/store';
10+
import { CoreState } from '../core.reducers';
11+
import { NotificationsService } from '../../shared/notifications/notifications.service';
12+
import { HttpClient } from '@angular/common/http';
13+
import { DefaultChangeAnalyzer } from '../data/default-change-analyzer.service';
14+
import { ConfigObject } from './models/config.model';
15+
import { SubmissionAccessesModel } from './models/config-submission-accesses.model';
16+
import { RemoteData } from '../data/remote-data';
17+
import { Observable } from 'rxjs';
18+
import { FollowLinkConfig } from '../../shared/utils/follow-link-config.model';
19+
20+
/**
21+
* Provides methods to retrieve, from REST server, bitstream access conditions configurations applicable during the submission process.
22+
*/
23+
@Injectable()
24+
@dataService(SUBMISSION_ACCESSES_TYPE)
25+
export class SubmissionAccessesConfigService extends ConfigService {
26+
constructor(
27+
protected requestService: RequestService,
28+
protected rdbService: RemoteDataBuildService,
29+
protected store: Store<CoreState>,
30+
protected objectCache: ObjectCacheService,
31+
protected halService: HALEndpointService,
32+
protected notificationsService: NotificationsService,
33+
protected http: HttpClient,
34+
protected comparator: DefaultChangeAnalyzer<SubmissionAccessesModel>
35+
) {
36+
super(requestService, rdbService, null, objectCache, halService, notificationsService, http, comparator, 'submissionaccessoptions');
37+
}
38+
39+
findByHref(href: string, useCachedVersionIfAvailable = true, reRequestOnStale = true, ...linksToFollow): Observable<RemoteData<SubmissionAccessesModel>> {
40+
return super.findByHref(href, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow as FollowLinkConfig<ConfigObject>[]) as Observable<RemoteData<SubmissionAccessesModel>>;
41+
}
42+
}

src/app/core/core.module.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,7 @@ import { CommonModule } from '@angular/common';
22
import { HttpClient } from '@angular/common/http';
33
import { ModuleWithProviders, NgModule, Optional, SkipSelf } from '@angular/core';
44

5-
import {
6-
DynamicFormLayoutService,
7-
DynamicFormService,
8-
DynamicFormValidationService
9-
} from '@ng-dynamic-forms/core';
5+
import { DynamicFormLayoutService, DynamicFormService, DynamicFormValidationService } from '@ng-dynamic-forms/core';
106
import { EffectsModule } from '@ngrx/effects';
117

128
import { Action, StoreConfig, StoreModule } from '@ngrx/store';
@@ -165,6 +161,7 @@ import { Root } from './data/root.model';
165161
import { SearchConfig } from './shared/search/search-filters/search-config.model';
166162
import { SequenceService } from './shared/sequence.service';
167163
import { GroupDataService } from './eperson/group-data.service';
164+
import { SubmissionAccessesModel } from './config/models/config-submission-accesses.model';
168165

169166
/**
170167
* When not in production, endpoint responses can be mocked for testing purposes
@@ -347,7 +344,8 @@ export const models =
347344
Registration,
348345
UsageReport,
349346
Root,
350-
SearchConfig
347+
SearchConfig,
348+
SubmissionAccessesModel
351349
];
352350

353351
@NgModule({
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/**
2+
* An interface to represent an access condition.
3+
*/
4+
export class AccessConditionObject {
5+
6+
/**
7+
* The access condition id
8+
*/
9+
id: string;
10+
11+
/**
12+
* The access condition name
13+
*/
14+
name: string;
15+
16+
/**
17+
* Possible start date of the access condition
18+
*/
19+
startDate: string;
20+
21+
/**
22+
* Possible end date of the access condition
23+
*/
24+
endDate: string;
25+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { ResourceType } from '../../shared/resource-type';
2+
3+
/**
4+
* The resource type for Accesses section
5+
*
6+
* Needs to be in a separate file to prevent circular
7+
* dependencies in webpack.
8+
*/
9+
export const SUBMISSION_ACCESSES = new ResourceType('submissionaccesses');
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { AccessConditionObject } from './access-condition.model';
2+
3+
/**
4+
* An interface to represent item's access condition.
5+
*/
6+
export class SubmissionItemAccessConditionObject extends AccessConditionObject {
7+
8+
}
Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,8 @@
1+
import { AccessConditionObject } from './access-condition.model';
2+
13
/**
24
* An interface to represent bitstream's access condition.
35
*/
4-
export class SubmissionUploadFileAccessConditionObject {
5-
6-
/**
7-
* The access condition id
8-
*/
9-
id: string;
10-
11-
/**
12-
* The access condition name
13-
*/
14-
name: string;
15-
16-
/**
17-
* Possible start date of the access condition
18-
*/
19-
startDate: string;
6+
export class SubmissionUploadFileAccessConditionObject extends AccessConditionObject {
207

21-
/**
22-
* Possible end date of the access condition
23-
*/
24-
endDate: string;
258
}

0 commit comments

Comments
 (0)