Allow Dmps to un-finalize if they are not published or not having a DOI (ref #272)
This commit is contained in:
parent
2b9c2ee1e7
commit
62c61a8119
|
@ -266,6 +266,17 @@ public class DMPs extends BaseController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
@RequestMapping(method = RequestMethod.POST, value = {"/unfinalize/{id}"})
|
||||||
|
public ResponseEntity<ResponseItem<DMP>> undoFinalize(@PathVariable String id, Principal principal) {
|
||||||
|
try {
|
||||||
|
this.dataManagementPlanManager.undoFinalize(UUID.fromString(id), principal);
|
||||||
|
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DMP>().status(ApiMessageCode.SUCCESS_MESSAGE).message("Successfully Data Datamanagement Plan made active."));
|
||||||
|
} catch (Exception e) {
|
||||||
|
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<DMP>().status(ApiMessageCode.ERROR_MESSAGE).message(e.getMessage()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* DOI Generation
|
* DOI Generation
|
||||||
* */
|
* */
|
||||||
|
|
|
@ -794,7 +794,9 @@ public class DataManagementPlanManager {
|
||||||
});
|
});
|
||||||
UserInfo user = apiContext.getOperationsContext().getDatabaseRepository().getUserInfoDao().find(principal.getId());
|
UserInfo user = apiContext.getOperationsContext().getDatabaseRepository().getUserInfoDao().find(principal.getId());
|
||||||
sendNotification(dmp, user, NotificationType.DMP_PUBLISH);
|
sendNotification(dmp, user, NotificationType.DMP_PUBLISH);
|
||||||
this.createZenodoDoi(dmp.getId(), principal, null, true);
|
if (dmp.getDoi() != null && !dmp.getDoi().isEmpty()) {
|
||||||
|
this.createZenodoDoi(dmp.getId(), principal, null, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void makeFinalize(UUID id, Principal principal, DatasetsToBeFinalized datasetsToBeFinalized) throws Exception {
|
public void makeFinalize(UUID id, Principal principal, DatasetsToBeFinalized datasetsToBeFinalized) throws Exception {
|
||||||
|
@ -850,6 +852,17 @@ public class DataManagementPlanManager {
|
||||||
this.updateDatasetsIndex(indexDatasets);
|
this.updateDatasetsIndex(indexDatasets);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void undoFinalize(UUID id, Principal principal) throws Exception {
|
||||||
|
DMP dmp = this.apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().find(id);
|
||||||
|
if (!isUserOwnerOfDmp(dmp, principal))
|
||||||
|
throw new Exception("User does not have the privilege to do this action.");
|
||||||
|
if (dmp.getStatus().equals(DMP.DMPStatus.ACTIVE.getValue()))
|
||||||
|
throw new Exception("DMP is already Active");
|
||||||
|
dmp.setStatus(DMP.DMPStatus.ACTIVE.getValue());
|
||||||
|
apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().createOrUpdate(dmp);
|
||||||
|
this.updateIndex(dmp);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Export Data
|
* Export Data
|
||||||
* */
|
* */
|
||||||
|
|
|
@ -92,6 +92,10 @@ export class DmpService {
|
||||||
return this.http.post<DmpModel>(this.actionUrl + 'finalize/' + id, datasetsToBeFinalized, { headers: this.headers });
|
return this.http.post<DmpModel>(this.actionUrl + 'finalize/' + id, datasetsToBeFinalized, { headers: this.headers });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unfinalize( id: String): Observable<DmpModel> {
|
||||||
|
return this.http.post<DmpModel>(this.actionUrl + 'unfinalize/' + id, { headers: this.headers });
|
||||||
|
}
|
||||||
|
|
||||||
getDoi(id: string): Observable<string> {
|
getDoi(id: string): Observable<string> {
|
||||||
return this.http.post<string>(this.actionUrl + 'createZenodoDoi/' + id, { headers: this.headers });
|
return this.http.post<string>(this.actionUrl + 'createZenodoDoi/' + id, { headers: this.headers });
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-auto d-flex flex-wrap p-2">
|
<div class="col-auto d-flex flex-wrap p-2">
|
||||||
|
<button *ngIf="(isFinalizedDmp(dmp) && hasDoi(dmp) && !isPublishedDMP(dmp)) && isUserOwner" mat-raised-button class="lightblue-btn mt-2 ml-2" color="primary" (click)="reverse()" type="button">{{ 'DMP-LISTING.ACTIONS.UNFINALIZE' | translate }}</button>
|
||||||
<button *ngIf="isDraftDmp(dmp) && isUserOwner" mat-raised-button color="primary" (click)="editClicked(dmp)" class="lightblue-btn mt-2 ml-2">
|
<button *ngIf="isDraftDmp(dmp) && isUserOwner" mat-raised-button color="primary" (click)="editClicked(dmp)" class="lightblue-btn mt-2 ml-2">
|
||||||
<mat-icon>edit</mat-icon> {{ 'DMP-LISTING.ACTIONS.EDIT' | translate }}
|
<mat-icon>edit</mat-icon> {{ 'DMP-LISTING.ACTIONS.EDIT' | translate }}
|
||||||
</button>
|
</button>
|
||||||
|
|
|
@ -528,6 +528,17 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
|
||||||
return this.configurationService.doiLink + id;
|
return this.configurationService.doiLink + id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
reverse() {
|
||||||
|
this.dmpService.unfinalize(this.dmp.id).pipe(takeUntil(this._destroyed))
|
||||||
|
.subscribe(
|
||||||
|
complete => {
|
||||||
|
this.dmp.status = DmpStatus.Draft;
|
||||||
|
this.onCallbackSuccess()
|
||||||
|
},
|
||||||
|
error => this.onFinalizeCallbackError(error)
|
||||||
|
);;
|
||||||
|
}
|
||||||
|
|
||||||
// advancedClicked() {
|
// advancedClicked() {
|
||||||
// const dialogRef = this.dialog.open(ExportMethodDialogComponent, {
|
// const dialogRef = this.dialog.open(ExportMethodDialogComponent, {
|
||||||
// maxWidth: '500px',
|
// maxWidth: '500px',
|
||||||
|
|
|
@ -412,6 +412,7 @@
|
||||||
"EXPORT": "Export",
|
"EXPORT": "Export",
|
||||||
"PUBLISH": "Publish",
|
"PUBLISH": "Publish",
|
||||||
"FINALIZE": "Finalize",
|
"FINALIZE": "Finalize",
|
||||||
|
"UNFINALIZE": "Undo Finalization",
|
||||||
"ADV-EXP": "Advanced Export",
|
"ADV-EXP": "Advanced Export",
|
||||||
"EXP-AS": "Export As",
|
"EXP-AS": "Export As",
|
||||||
"DOWNLOAD-XML": "Download XML",
|
"DOWNLOAD-XML": "Download XML",
|
||||||
|
|
|
@ -412,6 +412,7 @@
|
||||||
"EXPORT": "Expertar",
|
"EXPORT": "Expertar",
|
||||||
"PUBLISH": "Publicar",
|
"PUBLISH": "Publicar",
|
||||||
"FINALIZE": "Finalizar",
|
"FINALIZE": "Finalizar",
|
||||||
|
"UNFINALIZE": "Undo Finalization",
|
||||||
"ADV-EXP": "Exportar avanzado",
|
"ADV-EXP": "Exportar avanzado",
|
||||||
"EXP-AS": "Exportar como",
|
"EXP-AS": "Exportar como",
|
||||||
"DOWNLOAD-XML": "Descargar XML",
|
"DOWNLOAD-XML": "Descargar XML",
|
||||||
|
|
|
@ -412,6 +412,7 @@
|
||||||
"EXPORT": "Εξαγωγή",
|
"EXPORT": "Εξαγωγή",
|
||||||
"PUBLISH": "Δημοσίευση",
|
"PUBLISH": "Δημοσίευση",
|
||||||
"FINALIZE": "Οριστικοποίηση",
|
"FINALIZE": "Οριστικοποίηση",
|
||||||
|
"UNFINALIZE": "Undo Finalization",
|
||||||
"ADV-EXP": "Προχωρημένη Εξαγωγή",
|
"ADV-EXP": "Προχωρημένη Εξαγωγή",
|
||||||
"EXP-AS": "Εξαγωγή ως",
|
"EXP-AS": "Εξαγωγή ως",
|
||||||
"DOWNLOAD-XML": "Λήψη XML",
|
"DOWNLOAD-XML": "Λήψη XML",
|
||||||
|
|
Loading…
Reference in New Issue