1. return bad request when deposition failed and returned null
2. close modal with repositories after a successful deposition
This commit is contained in:
parent
976d0221ce
commit
749dbefc38
|
@ -53,7 +53,12 @@ public class DepositController extends BaseController {
|
||||||
ResponseEntity<ResponseItem<Doi>> createDoi(@RequestBody DepositRequest depositRequest, @ClaimedAuthorities(claims = {Authorities.ADMIN, Authorities.MANAGER, Authorities.USER, Authorities.ANONYMOUS}) Principal principal) {
|
ResponseEntity<ResponseItem<Doi>> createDoi(@RequestBody DepositRequest depositRequest, @ClaimedAuthorities(claims = {Authorities.ADMIN, Authorities.MANAGER, Authorities.USER, Authorities.ANONYMOUS}) Principal principal) {
|
||||||
try {
|
try {
|
||||||
Doi doi = this.depositManager.deposit(depositRequest, principal);
|
Doi doi = this.depositManager.deposit(depositRequest, principal);
|
||||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<Doi>().status(ApiMessageCode.SUCCESS_MESSAGE).message("Successfully created DOI for Data Datamanagement Plan in question.").payload(doi));
|
if(doi != null){
|
||||||
|
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<Doi>().status(ApiMessageCode.SUCCESS_MESSAGE).message("Successfully created DOI for Data Datamanagement Plan in question.").payload(doi));
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<Doi>().status(ApiMessageCode.ERROR_MESSAGE).message("Failed to create DOI for the Data Management Plan"));
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error(e.getMessage(), e);
|
logger.error(e.getMessage(), e);
|
||||||
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<Doi>().status(ApiMessageCode.ERROR_MESSAGE).message("Failed to create DOI for the Data Management Plan: " + e.getMessage()));
|
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<Doi>().status(ApiMessageCode.ERROR_MESSAGE).message("Failed to create DOI for the Data Management Plan: " + e.getMessage()));
|
||||||
|
|
|
@ -41,7 +41,10 @@ public class DepositManager {
|
||||||
List<RepositoryConfig> reposConfigModel = new ArrayList<>();
|
List<RepositoryConfig> reposConfigModel = new ArrayList<>();
|
||||||
for (RepositoryDeposit r: this.repositories) {
|
for (RepositoryDeposit r: this.repositories) {
|
||||||
RepositoryConfig repoModel = new RepositoryConfig();
|
RepositoryConfig repoModel = new RepositoryConfig();
|
||||||
reposConfigModel.add(repoModel.toModel(r.getConfiguration()));
|
RepositoryDepositConfiguration repoConf = r.getConfiguration();
|
||||||
|
if(repoConf != null) {
|
||||||
|
reposConfigModel.add(repoModel.toModel(repoConf));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return reposConfigModel;
|
return reposConfigModel;
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,10 +83,7 @@ export class DmpDepositDialogComponent extends BaseComponent implements OnInit {
|
||||||
.subscribe(doi =>{
|
.subscribe(doi =>{
|
||||||
this.onDOICallbackSuccess();
|
this.onDOICallbackSuccess();
|
||||||
this.outputRepos.push(doi);
|
this.outputRepos.push(doi);
|
||||||
this.inputRepos = this.inputRepos.filter(function(x) { return x.repositoryId !== repo.repositoryId; });
|
this.close();
|
||||||
if(this.inputRepos.length == 0){
|
|
||||||
this.close();
|
|
||||||
}
|
|
||||||
}, error => this.onDOICallbackError(error));
|
}, error => this.onDOICallbackError(error));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -99,10 +96,7 @@ export class DmpDepositDialogComponent extends BaseComponent implements OnInit {
|
||||||
.subscribe(doi =>{
|
.subscribe(doi =>{
|
||||||
this.onDOICallbackSuccess();
|
this.onDOICallbackSuccess();
|
||||||
this.outputRepos.push(doi);
|
this.outputRepos.push(doi);
|
||||||
this.inputRepos = this.inputRepos.filter(function(x) { return x.repositoryId !== repo.repositoryId; });
|
this.close();
|
||||||
if(this.inputRepos.length == 0){
|
|
||||||
this.close();
|
|
||||||
}
|
|
||||||
}, error => this.onDOICallbackError(error));
|
}, error => this.onDOICallbackError(error));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -129,10 +123,7 @@ export class DmpDepositDialogComponent extends BaseComponent implements OnInit {
|
||||||
.subscribe(doi =>{
|
.subscribe(doi =>{
|
||||||
this.onDOICallbackSuccess();
|
this.onDOICallbackSuccess();
|
||||||
this.outputRepos.push(doi);
|
this.outputRepos.push(doi);
|
||||||
this.inputRepos = this.inputRepos.filter(function(x) { return x.repositoryId !== repo.repositoryId; });
|
this.close();
|
||||||
if(this.inputRepos.length == 0){
|
|
||||||
this.close();
|
|
||||||
}
|
|
||||||
}, error => this.onDOICallbackError(error));
|
}, error => this.onDOICallbackError(error));
|
||||||
});
|
});
|
||||||
this.oauthLock = true;
|
this.oauthLock = true;
|
||||||
|
|
Loading…
Reference in New Issue