Skip to content

Commit 4baf993

Browse files
committed
Updated APIs descriptions for OpenAPI generation.
1 parent e9202c5 commit 4baf993

File tree

104 files changed

+767
-2059
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+767
-2059
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ dist/
8484
downloads/
8585
eggs/
8686
.eggs/
87-
lib/
87+
#lib/
8888
lib64/
8989
parts/
9090
sdist/

cape-dashboard/src/app/pages/services/linkedServices/linkedServiceInfoRender.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ export class LinkedServiceInfoRenderComponent {
4242
serviceUri: this.value.service_uri,
4343
slrId: this.value.link_id,
4444
serviceId: serviceDescription.serviceId,
45-
description: localizedHumanReadableDescription[0].description,
45+
description: localizedHumanReadableDescription[0]?.description,
4646
iconUrl: serviceDescription.serviceIconUrl !== '' ? serviceDescription.serviceIconUrl : 'assets/images/app/no_image.png',
47-
keywords: localizedHumanReadableDescription[0].keywords,
47+
keywords: localizedHumanReadableDescription[0]?.keywords,
4848
provider: serviceDescription.serviceInstance.serviceProvider.name,
4949
processings: serviceDescription.processingBases,
5050
datasetsMap: this.mapDatasetsConcept(serviceDescription.isDescribedAt),

cape-online-services/src/app/cape-sdk-angular/cape-sdk-angular.service.ts

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,17 +132,33 @@ export class CapeSdkAngularService {
132132
const userSurrogateLink: UserSurrogateIdLink = await this.linkSurrogateId(sdkUrl, serviceUserId, surrogateId, serviceId, operatorId);
133133
}
134134

135-
async automaticLinkFromService(sdkUrl: string, operatorId: string, serviceId: string, serviceUserId: string, returnUrl: string) {
135+
async automaticLinkFromService(
136+
sdkUrl: string,
137+
operatorId: string,
138+
serviceId: string,
139+
serviceUserId: string,
140+
serviceUserEmail: string,
141+
locale: string,
142+
returnUrl: string
143+
) {
136144
const surrogateIdResponse = await this.generateSurrogateId(sdkUrl, operatorId, serviceUserId);
137145
const surrogateId = surrogateIdResponse.surrogate_id;
138146

139147
// Get Linking Session Code for automatic Linking
140148
const sessionCode = await this.getServiceLinkingSessionCode(sdkUrl, serviceUserId, surrogateId, serviceId, returnUrl);
141149
console.log(sessionCode);
142150

143-
// Start Service Linking with retrieved Linking Session Code
144-
const linkingResponse: LinkingResponseData = await this.startServiceLinking(sdkUrl, sessionCode, surrogateId, operatorId, serviceId, returnUrl);
145-
151+
try {
152+
// Start Service Linking with retrieved Linking Session Code
153+
const linkingResponse: LinkingResponseData = await this.startServiceLinking(sdkUrl, sessionCode, surrogateId, operatorId, serviceId, returnUrl);
154+
} catch (error) {
155+
if (error?.error.innerError.innerError.error == 'it.eng.opsi.cape.exception.AccountNotFoundException') {
156+
// Call SDK API to Create Account using as accountId the accountId of the Service
157+
await this.createCapeAccount(sdkUrl, serviceUserId, serviceUserEmail, locale);
158+
// Once the Cape Account has been created, retry automaticLinking
159+
return await this.automaticLinkFromService(sdkUrl, operatorId, serviceId, serviceUserId, serviceUserEmail, locale, returnUrl);
160+
} else this.errorDialogService.openErrorDialog(error);
161+
}
146162
// Once the Service Link is done, save the userId - surrogateId association
147163
const userSurrogateLink: UserSurrogateIdLink = await this.linkSurrogateId(sdkUrl, serviceUserId, surrogateId, serviceId, operatorId);
148164

@@ -184,7 +200,7 @@ export class CapeSdkAngularService {
184200
}
185201

186202
public generateSurrogateId(sdkUrl: string, operatorId: string, serviceUserId: string): Promise<SurrogateIdResponse> {
187-
return this.http.get<SurrogateIdResponse>(`${sdkUrl}/api/v2/slr/surrogate_id?operatorId=${operatorId}&userId=${serviceUserId}`).toPromise();
203+
return this.http.get<SurrogateIdResponse>(`${sdkUrl}/api/v2/slr/linking/surrogateId?operatorId=${operatorId}&userId=${serviceUserId}`).toPromise();
188204
}
189205

190206
public linkSurrogateId(sdkUrl: string, serviceUserId: string, surrogateId: string, serviceId: string, operatorId: string): Promise<UserSurrogateIdLink> {

cape-online-services/src/app/pages/services/services.component.html

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,9 @@ <h5 style="color: white">Manifestazione d’interesse on line servizi asilo nido
9999
<div class="row justify-content-left"></div>
100100
</nb-card-body>
101101
<nb-card-footer class="d-flex justify-content-center"
102-
><button nbButton status="primary" (click)="onClickGo('GE_1', 'Reuse_1')">{{ 'general.services.goButton' | translate }}</button></nb-card-footer
102+
><button nbButton status="primary" (click)="onClickGo('GE_1', 'Iscrizioni servizi 0-6', 'Reuse_1')">
103+
{{ 'general.services.goButton' | translate }}
104+
</button></nb-card-footer
103105
>
104106
</nb-card>
105107
</div>
@@ -126,7 +128,9 @@ <h5 style="color: white">Servizio di info e allerta tramite messagistica e BOT</
126128
<div class="row justify-content-left"></div>
127129
</nb-card-body>
128130
<nb-card-footer class="d-flex justify-content-center"
129-
><button nbButton status="primary" (click)="onClickGo('GE_2', 'Reuse_1')">{{ 'general.services.goButton' | translate }}</button></nb-card-footer
131+
><button nbButton status="primary" (click)="onClickGo('GE_2', 'Protezione Civile Iscrizione allerta', 'Reuse_1')">
132+
{{ 'general.services.goButton' | translate }}
133+
</button></nb-card-footer
130134
>
131135
</nb-card>
132136
</div>

cape-online-services/src/app/pages/services/services.component.ts

Lines changed: 48 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,7 @@ export class ServicesComponent implements OnInit {
3232
public sdkUrl: string;
3333
public operatorId: string;
3434
public dashboardUrl: string;
35-
public serviceId: string;
36-
public serviceName: string;
37-
public serviceUrl: string;
3835
public returnUrl: string;
39-
public purposeId: string;
40-
public sourceDatasetId: string;
41-
public sourceServiceId: string;
4236
public capeLinkStatus: SlStatusEnum;
4337
public capeConsentStatus: ConsentStatusEnum;
4438
public checkConsentAtOperator: boolean;
@@ -75,20 +69,20 @@ export class ServicesComponent implements OnInit {
7569
this.translateService.use(this.locale);
7670
}
7771

78-
async onClickGo(serviceId: string, purposeId: string) {
72+
async onClickGo(serviceId: string, serviceName: string, purposeId: string) {
7973
if (!(await this.authService.isAuthenticatedOrRefresh().toPromise())) {
8074
this.router.navigate(['/login']);
8175
} else {
82-
this.checkAndGo(serviceId, purposeId);
76+
this.checkAndGo(serviceId, serviceName, purposeId);
8377

8478
/* this.dialogService.open(DialogPersonalAttributesComponent)
8579
.onClose.subscribe(() => this.checkAndGo(service, purpose));*/
8680
}
8781
}
8882

89-
checkAndGo = async (serviceId: string, purposeId: string) => {
83+
checkAndGo = async (serviceId: string, serviceName: string, purposeId: string) => {
9084
try {
91-
var checkLinking = await this.onCheckLinking(serviceId);
85+
var checkLinking = await this.onCheckLinking(serviceId, serviceName);
9286
console.log(checkLinking);
9387

9488
if (checkLinking) {
@@ -113,7 +107,7 @@ export class ServicesComponent implements OnInit {
113107
}
114108
};
115109

116-
onCheckLinking = async (serviceId: string): Promise<boolean> => {
110+
onCheckLinking = async (serviceId: string, serviceName: string): Promise<boolean> => {
117111
let linkSurrogateId;
118112

119113
try {
@@ -130,12 +124,34 @@ export class ServicesComponent implements OnInit {
130124
if (linkSurrogateId) {
131125
console.log('checking SLR status');
132126

133-
var serviceLinkStatus = await this.capeService.getServiceLinkStatus(this.sdkUrl, this.serviceAccountId, serviceId, this.operatorId);
134-
console.log('checking SLR status...OK' + serviceLinkStatus);
127+
const serviceLinkRecord = await this.capeService.getServiceLinkRecordByUserIdAndServiceId(
128+
this.sdkUrl,
129+
this.serviceAccountId,
130+
serviceId,
131+
this.operatorId
132+
);
135133

136-
return serviceLinkStatus === SlStatusEnum.Active;
134+
// Auto activate existing SLR but in Removed status
135+
if (serviceLinkRecord.serviceLinkStatuses.pop().payload.sl_status == SlStatusEnum.Removed)
136+
await this.capeService.enableServiceLink(
137+
this.sdkUrl,
138+
serviceLinkRecord.payload.link_id,
139+
serviceLinkRecord.payload.surrogate_id,
140+
serviceId,
141+
serviceName
142+
);
143+
144+
return true;
137145
} else {
138-
linkSurrogateId = await this.capeService.automaticLinkFromService(this.sdkUrl, this.operatorId, serviceId, this.serviceAccountId, this.returnUrl);
146+
linkSurrogateId = await this.capeService.automaticLinkFromService(
147+
this.sdkUrl,
148+
this.operatorId,
149+
serviceId,
150+
this.serviceAccountId,
151+
this.serviceAccountEmail,
152+
this.locale,
153+
this.returnUrl
154+
);
139155
if (linkSurrogateId) return true;
140156
}
141157
} catch (error) {
@@ -144,16 +160,25 @@ export class ServicesComponent implements OnInit {
144160
} else if (error.status === 404) {
145161
console.log('No ServiceLink for service: ' + serviceId + '...starting service linking');
146162
try {
147-
linkSurrogateId = await this.capeService.automaticLinkFromService(this.sdkUrl, this.operatorId, serviceId, this.serviceAccountId, this.returnUrl);
163+
linkSurrogateId = await this.capeService.automaticLinkFromService(
164+
this.sdkUrl,
165+
this.operatorId,
166+
serviceId,
167+
this.serviceAccountId,
168+
this.serviceAccountEmail,
169+
this.locale,
170+
this.returnUrl
171+
);
148172
return linkSurrogateId ? true : false;
149173
} catch (error) {
150-
if (error?.error.cause == 'it.eng.opsi.cape.exception.AccountNotFoundException') {
151-
// Call SDK API to Create Account using as accountId the accountId of the Service
152-
await this.capeService.createCapeAccount(this.sdkUrl, this.serviceAccountId, this.serviceAccountEmail, this.locale);
153-
this.capeAccountId = this.serviceAccountId;
154-
// Once the Cape Account has been created, retry automaticLinking
155-
linkSurrogateId = await this.capeService.automaticLinkFromService(this.sdkUrl, this.operatorId, serviceId, this.serviceAccountId, this.returnUrl);
156-
} else this.errorDialogService.openErrorDialog(error);
174+
// if (error?.error.cause == 'it.eng.opsi.cape.exception.AccountNotFoundException') {
175+
// // Call SDK API to Create Account using as accountId the accountId of the Service
176+
// await this.capeService.createCapeAccount(this.sdkUrl, this.serviceAccountId, this.serviceAccountEmail, this.locale);
177+
// this.capeAccountId = this.serviceAccountId;
178+
// // Once the Cape Account has been created, retry automaticLinking
179+
// linkSurrogateId = await this.capeService.automaticLinkFromService(this.sdkUrl, this.operatorId, serviceId, this.serviceAccountId, this.returnUrl);
180+
// } else
181+
this.errorDialogService.openErrorDialog(error);
157182
}
158183
} else throw error;
159184
}

cape-online-services/src/assets/serviceOnlineGE_2_description.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"serviceId": "GE_2",
3-
"name": "Protezione Civile Iscrizione alerta",
3+
"name": "Protezione Civile Iscrizione allerta",
44
"identifier": "https://www.cape-suite.eu/cape-online-services/pages/services",
55
"issued": "",
66
"createdByUserId": "",

cape-online-services/src/assets/serviceOnlineGE_2_description_dev.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"serviceId": "GE_2",
3-
"name": "Protezione Civile Iscrizione alerta",
3+
"name": "Protezione Civile Iscrizione allerta",
44
"identifier": "https://localhost:83/cape-online-services/pages/services",
55
"issued": "",
66
"createdByUserId": "",

cape-playground/.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ src/assets/config.json
1010
/bazel-out
1111

1212
# dependencies
13-
/node_modules
14-
13+
/**/node_modules
1514
# profiling files
1615
chrome-profiler-events*.json
1716
speed-measure-plugin*.json

cape-sdk/service-sdk/docker-compose.prod.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ services:
4444
networks:
4545
- cape-sdk-network
4646
service-sdk-mongo:
47-
image: mongo:4.2
47+
image: mongo:4.4.6
4848
restart: always
4949
ports:
5050
- "27025:27017"

cape-sdk/service-sdk/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ services:
4444
networks:
4545
- cape-sdk-network
4646
service-sdk-mongo:
47-
image: mongo:4.2
47+
image: mongo:4.4.6
4848
restart: always
4949
ports:
5050
- "27025:27017"

0 commit comments

Comments
 (0)