handle plan import error when blueprint is not finalized
This commit is contained in:
parent
6bb095a62d
commit
5d460ea5e5
|
@ -508,4 +508,14 @@ public class ErrorThesaurusProperties {
|
|||
public void setDescriptionTemplateTypeImportDraft(ErrorDescription descriptionTemplateTypeImportDraft) {
|
||||
this.descriptionTemplateTypeImportDraft = descriptionTemplateTypeImportDraft;
|
||||
}
|
||||
|
||||
private ErrorDescription planBlueprintImportDraft;
|
||||
|
||||
public ErrorDescription getPlanBlueprintImportDraft() {
|
||||
return planBlueprintImportDraft;
|
||||
}
|
||||
|
||||
public void setPlanBlueprintImportDraft(ErrorDescription planBlueprintImportDraft) {
|
||||
this.planBlueprintImportDraft = planBlueprintImportDraft;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1944,15 +1944,16 @@ public class PlanServiceImpl implements PlanService {
|
|||
|
||||
private UUID xmlPlanBlueprintToPersist(PlanImportExport planXml) throws JAXBException, InvalidApplicationException, ParserConfigurationException, IOException, TransformerException, InstantiationException, IllegalAccessException, SAXException {
|
||||
if (planXml.getBlueprint() != null){
|
||||
PlanBlueprintEntity planBlueprintEntity = this.queryFactory.query(PlanBlueprintQuery.class).disableTracking().ids(planXml.getBlueprint().getId()).first();
|
||||
if (planBlueprintEntity == null) planBlueprintEntity = this.queryFactory.query(PlanBlueprintQuery.class).disableTracking().groupIds(planXml.getBlueprint().getGroupId()).versionStatuses(PlanBlueprintVersionStatus.Current).isActive(IsActive.Active).statuses(PlanBlueprintStatus.Finalized).first();
|
||||
PlanBlueprintEntity planBlueprintEntity = planXml.getBlueprint().getId() != null ? this.queryFactory.query(PlanBlueprintQuery.class).disableTracking().ids(planXml.getBlueprint().getId()).first() : null;
|
||||
if (planBlueprintEntity == null) planBlueprintEntity = planXml.getBlueprint().getGroupId() != null ? this.queryFactory.query(PlanBlueprintQuery.class).disableTracking().groupIds(planXml.getBlueprint().getGroupId()).versionStatuses(PlanBlueprintVersionStatus.Current).isActive(IsActive.Active).statuses(PlanBlueprintStatus.Finalized).first() : null;
|
||||
if (planBlueprintEntity != null){
|
||||
return planBlueprintEntity.getId();
|
||||
} else {
|
||||
planBlueprintEntity = this.queryFactory.query(PlanBlueprintQuery.class).disableTracking().codes(planXml.getBlueprint().getCode()).first();
|
||||
planBlueprintEntity = !this.conventionService.isNullOrEmpty(planXml.getBlueprint().getCode()) ? this.queryFactory.query(PlanBlueprintQuery.class).disableTracking().codes(planXml.getBlueprint().getCode()).first() : null;
|
||||
if (planBlueprintEntity == null) {
|
||||
throw new MyValidationException(this.errors.getPlanBlueprintImportNotFound().getCode(), planXml.getBlueprint().getCode());
|
||||
} else {
|
||||
if (!planBlueprintEntity.getStatus().equals(PlanBlueprintStatus.Finalized)) throw new MyValidationException(this.errors.getPlanBlueprintImportDraft().getCode(), planBlueprintEntity.getCode());
|
||||
return planBlueprintEntity.getId();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -158,3 +158,6 @@ error-thesaurus:
|
|||
descriptionTemplateTypeImportDraft:
|
||||
code: 156
|
||||
message: Description template type is not finalised
|
||||
planBlueprintImportDraft:
|
||||
code: 157
|
||||
message: Plan blueprint is not finalised
|
|
@ -52,6 +52,7 @@ export enum ResponseErrorCode {
|
|||
blueprintDescriptionTemplateImportDraft = 154,
|
||||
planDescriptionTemplateImportDraft = 155,
|
||||
descriptionTemplateTypeImportDraft = 156,
|
||||
planBlueprintImportDraft = 157,
|
||||
|
||||
// Notification & Annotation Errors
|
||||
InvalidApiKey = 200,
|
||||
|
@ -188,6 +189,8 @@ export class ResponseErrorCodeHelper {
|
|||
return language.instant("GENERAL.BACKEND-ERRORS.PLAN-DESCRIPTION-TEMPLATE-IMPORT-DRAFT");
|
||||
case ResponseErrorCode.descriptionTemplateTypeImportDraft:
|
||||
return language.instant("GENERAL.BACKEND-ERRORS.DESCRIPTION-TEMPLATE-TYPE-IMPORT-DRAFT");
|
||||
case ResponseErrorCode.planBlueprintImportDraft:
|
||||
return language.instant("GENERAL.BACKEND-ERRORS.PLAN-BLUEPRINT-IMPORT-DRAFT");
|
||||
|
||||
default:
|
||||
return language.instant("GENERAL.SNACK-BAR.NOT-FOUND");
|
||||
|
|
|
@ -91,7 +91,8 @@
|
|||
"PLAN-BLUEPRINT-IMPORT-NOT-FOUND": "Plan blueprint with code '{{planBlueprintLabel}}' not found.",
|
||||
"BLUEPRINT-DESCRIPTION-TEMPLATE-IMPORT-DRAFT": "Description template with code '{{descriptionTemplateLabel}}' is not finalized yet.",
|
||||
"PLAN-DESCRIPTION-TEMPLATE-IMPORT-DRAFT": "Description template with code '{{descriptionTemplateLabel}}' is not finalized yet.",
|
||||
"DESCRIPTION-TEMPLATE-TYPE-IMPORT-DRAFT": "Description template type with code '{{descriptionTemplateTypeCode}}' is not finalized yet."
|
||||
"DESCRIPTION-TEMPLATE-TYPE-IMPORT-DRAFT": "Description template type with code '{{descriptionTemplateTypeCode}}' is not finalized yet.",
|
||||
"PLAN-BLUEPRINT-IMPORT-DRAFT": "Plan Blueprint with code '{{planBlueprintCode}}' is not finalized yet."
|
||||
},
|
||||
"FORM-VALIDATION-DISPLAY-DIALOG": {
|
||||
"WARNING": "Kontuz!",
|
||||
|
|
|
@ -91,7 +91,8 @@
|
|||
"PLAN-BLUEPRINT-IMPORT-NOT-FOUND": "Plan blueprint with code '{{planBlueprintLabel}}' not found.",
|
||||
"BLUEPRINT-DESCRIPTION-TEMPLATE-IMPORT-DRAFT": "Description template with code '{{descriptionTemplateLabel}}' is not finalized yet.",
|
||||
"PLAN-DESCRIPTION-TEMPLATE-IMPORT-DRAFT": "Description template with code '{{descriptionTemplateLabel}}' is not finalized yet.",
|
||||
"DESCRIPTION-TEMPLATE-TYPE-IMPORT-DRAFT": "Description template type with code '{{descriptionTemplateTypeCode}}' is not finalized yet."
|
||||
"DESCRIPTION-TEMPLATE-TYPE-IMPORT-DRAFT": "Description template type with code '{{descriptionTemplateTypeCode}}' is not finalized yet.",
|
||||
"PLAN-BLUEPRINT-IMPORT-DRAFT": "Plan Blueprint with code '{{planBlueprintCode}}' is not finalized yet."
|
||||
},
|
||||
"FORM-VALIDATION-DISPLAY-DIALOG": {
|
||||
"WARNING": "Warnung!",
|
||||
|
|
|
@ -91,7 +91,8 @@
|
|||
"PLAN-BLUEPRINT-IMPORT-NOT-FOUND": "Plan blueprint with code '{{planBlueprintLabel}}' not found.",
|
||||
"BLUEPRINT-DESCRIPTION-TEMPLATE-IMPORT-DRAFT": "Description template with code '{{descriptionTemplateLabel}}' is not finalized yet.",
|
||||
"PLAN-DESCRIPTION-TEMPLATE-IMPORT-DRAFT": "Description template with code '{{descriptionTemplateLabel}}' is not finalized yet.",
|
||||
"DESCRIPTION-TEMPLATE-TYPE-IMPORT-DRAFT": "Description template type with code '{{descriptionTemplateTypeCode}}' is not finalized yet."
|
||||
"DESCRIPTION-TEMPLATE-TYPE-IMPORT-DRAFT": "Description template type with code '{{descriptionTemplateTypeCode}}' is not finalized yet.",
|
||||
"PLAN-BLUEPRINT-IMPORT-DRAFT": "Plan Blueprint with code '{{planBlueprintCode}}' is not finalized yet."
|
||||
},
|
||||
"FORM-VALIDATION-DISPLAY-DIALOG": {
|
||||
"WARNING": "Warning!",
|
||||
|
|
|
@ -91,7 +91,8 @@
|
|||
"PLAN-BLUEPRINT-IMPORT-NOT-FOUND": "Plan blueprint with code '{{planBlueprintLabel}}' not found.",
|
||||
"BLUEPRINT-DESCRIPTION-TEMPLATE-IMPORT-DRAFT": "Description template with code '{{descriptionTemplateLabel}}' is not finalized yet.",
|
||||
"PLAN-DESCRIPTION-TEMPLATE-IMPORT-DRAFT": "Description template with code '{{descriptionTemplateLabel}}' is not finalized yet.",
|
||||
"DESCRIPTION-TEMPLATE-TYPE-IMPORT-DRAFT": "Description template type with code '{{descriptionTemplateTypeCode}}' is not finalized yet."
|
||||
"DESCRIPTION-TEMPLATE-TYPE-IMPORT-DRAFT": "Description template type with code '{{descriptionTemplateTypeCode}}' is not finalized yet.",
|
||||
"PLAN-BLUEPRINT-IMPORT-DRAFT": "Plan Blueprint with code '{{planBlueprintCode}}' is not finalized yet."
|
||||
},
|
||||
"FORM-VALIDATION-DISPLAY-DIALOG": {
|
||||
"WARNING": "Atención!",
|
||||
|
|
|
@ -91,7 +91,8 @@
|
|||
"PLAN-BLUEPRINT-IMPORT-NOT-FOUND": "Plan blueprint with code '{{planBlueprintLabel}}' not found.",
|
||||
"BLUEPRINT-DESCRIPTION-TEMPLATE-IMPORT-DRAFT": "Description template with code '{{descriptionTemplateLabel}}' is not finalized yet.",
|
||||
"PLAN-DESCRIPTION-TEMPLATE-IMPORT-DRAFT": "Description template with code '{{descriptionTemplateLabel}}' is not finalized yet.",
|
||||
"DESCRIPTION-TEMPLATE-TYPE-IMPORT-DRAFT": "Description template type with code '{{descriptionTemplateTypeCode}}' is not finalized yet."
|
||||
"DESCRIPTION-TEMPLATE-TYPE-IMPORT-DRAFT": "Description template type with code '{{descriptionTemplateTypeCode}}' is not finalized yet.",
|
||||
"PLAN-BLUEPRINT-IMPORT-DRAFT": "Plan Blueprint with code '{{planBlueprintCode}}' is not finalized yet."
|
||||
},
|
||||
"FORM-VALIDATION-DISPLAY-DIALOG": {
|
||||
"WARNING": "Προσοχή!",
|
||||
|
|
|
@ -91,7 +91,8 @@
|
|||
"PLAN-BLUEPRINT-IMPORT-NOT-FOUND": "Plan blueprint with code '{{planBlueprintLabel}}' not found.",
|
||||
"BLUEPRINT-DESCRIPTION-TEMPLATE-IMPORT-DRAFT": "Description template with code '{{descriptionTemplateLabel}}' is not finalized yet.",
|
||||
"PLAN-DESCRIPTION-TEMPLATE-IMPORT-DRAFT": "Description template with code '{{descriptionTemplateLabel}}' is not finalized yet.",
|
||||
"DESCRIPTION-TEMPLATE-TYPE-IMPORT-DRAFT": "Description template type with code '{{descriptionTemplateTypeCode}}' is not finalized yet."
|
||||
"DESCRIPTION-TEMPLATE-TYPE-IMPORT-DRAFT": "Description template type with code '{{descriptionTemplateTypeCode}}' is not finalized yet.",
|
||||
"PLAN-BLUEPRINT-IMPORT-DRAFT": "Plan Blueprint with code '{{planBlueprintCode}}' is not finalized yet."
|
||||
},
|
||||
"FORM-VALIDATION-DISPLAY-DIALOG": {
|
||||
"WARNING": "Oprez!",
|
||||
|
|
|
@ -91,7 +91,8 @@
|
|||
"PLAN-BLUEPRINT-IMPORT-NOT-FOUND": "Plan blueprint with code '{{planBlueprintLabel}}' not found.",
|
||||
"BLUEPRINT-DESCRIPTION-TEMPLATE-IMPORT-DRAFT": "Description template with code '{{descriptionTemplateLabel}}' is not finalized yet.",
|
||||
"PLAN-DESCRIPTION-TEMPLATE-IMPORT-DRAFT": "Description template with code '{{descriptionTemplateLabel}}' is not finalized yet.",
|
||||
"DESCRIPTION-TEMPLATE-TYPE-IMPORT-DRAFT": "Description template type with code '{{descriptionTemplateTypeCode}}' is not finalized yet."
|
||||
"DESCRIPTION-TEMPLATE-TYPE-IMPORT-DRAFT": "Description template type with code '{{descriptionTemplateTypeCode}}' is not finalized yet.",
|
||||
"PLAN-BLUEPRINT-IMPORT-DRAFT": "Plan Blueprint with code '{{planBlueprintCode}}' is not finalized yet."
|
||||
},
|
||||
"FORM-VALIDATION-DISPLAY-DIALOG": {
|
||||
"WARNING": "Ostrzeżenie!",
|
||||
|
|
|
@ -91,7 +91,8 @@
|
|||
"PLAN-BLUEPRINT-IMPORT-NOT-FOUND": "Plan blueprint with code '{{planBlueprintLabel}}' not found.",
|
||||
"BLUEPRINT-DESCRIPTION-TEMPLATE-IMPORT-DRAFT": "Description template with code '{{descriptionTemplateLabel}}' is not finalized yet.",
|
||||
"PLAN-DESCRIPTION-TEMPLATE-IMPORT-DRAFT": "Description template with code '{{descriptionTemplateLabel}}' is not finalized yet.",
|
||||
"DESCRIPTION-TEMPLATE-TYPE-IMPORT-DRAFT": "Description template type with code '{{descriptionTemplateTypeCode}}' is not finalized yet."
|
||||
"DESCRIPTION-TEMPLATE-TYPE-IMPORT-DRAFT": "Description template type with code '{{descriptionTemplateTypeCode}}' is not finalized yet.",
|
||||
"PLAN-BLUEPRINT-IMPORT-DRAFT": "Plan Blueprint with code '{{planBlueprintCode}}' is not finalized yet."
|
||||
},
|
||||
"FORM-VALIDATION-DISPLAY-DIALOG": {
|
||||
"WARNING": "Atenção!",
|
||||
|
|
|
@ -91,7 +91,8 @@
|
|||
"PLAN-BLUEPRINT-IMPORT-NOT-FOUND": "Plan blueprint with code '{{planBlueprintLabel}}' not found.",
|
||||
"BLUEPRINT-DESCRIPTION-TEMPLATE-IMPORT-DRAFT": "Description template with code '{{descriptionTemplateLabel}}' is not finalized yet.",
|
||||
"PLAN-DESCRIPTION-TEMPLATE-IMPORT-DRAFT": "Description template with code '{{descriptionTemplateLabel}}' is not finalized yet.",
|
||||
"DESCRIPTION-TEMPLATE-TYPE-IMPORT-DRAFT": "Description template type with code '{{descriptionTemplateTypeCode}}' is not finalized yet."
|
||||
"DESCRIPTION-TEMPLATE-TYPE-IMPORT-DRAFT": "Description template type with code '{{descriptionTemplateTypeCode}}' is not finalized yet.",
|
||||
"PLAN-BLUEPRINT-IMPORT-DRAFT": "Plan Blueprint with code '{{planBlueprintCode}}' is not finalized yet."
|
||||
},
|
||||
"FORM-VALIDATION-DISPLAY-DIALOG": {
|
||||
"WARNING": "Upozornenie!",
|
||||
|
|
|
@ -91,7 +91,8 @@
|
|||
"PLAN-BLUEPRINT-IMPORT-NOT-FOUND": "Plan blueprint with code '{{planBlueprintLabel}}' not found.",
|
||||
"BLUEPRINT-DESCRIPTION-TEMPLATE-IMPORT-DRAFT": "Description template with code '{{descriptionTemplateLabel}}' is not finalized yet.",
|
||||
"PLAN-DESCRIPTION-TEMPLATE-IMPORT-DRAFT": "Description template with code '{{descriptionTemplateLabel}}' is not finalized yet.",
|
||||
"DESCRIPTION-TEMPLATE-TYPE-IMPORT-DRAFT": "Description template type with code '{{descriptionTemplateTypeCode}}' is not finalized yet."
|
||||
"DESCRIPTION-TEMPLATE-TYPE-IMPORT-DRAFT": "Description template type with code '{{descriptionTemplateTypeCode}}' is not finalized yet.",
|
||||
"PLAN-BLUEPRINT-IMPORT-DRAFT": "Plan Blueprint with code '{{planBlueprintCode}}' is not finalized yet."
|
||||
},
|
||||
"FORM-VALIDATION-DISPLAY-DIALOG": {
|
||||
"WARNING": "Oprez!",
|
||||
|
|
|
@ -91,7 +91,8 @@
|
|||
"PLAN-BLUEPRINT-IMPORT-NOT-FOUND": "Plan blueprint with code '{{planBlueprintLabel}}' not found.",
|
||||
"BLUEPRINT-DESCRIPTION-TEMPLATE-IMPORT-DRAFT": "Description template with code '{{descriptionTemplateLabel}}' is not finalized yet.",
|
||||
"PLAN-DESCRIPTION-TEMPLATE-IMPORT-DRAFT": "Description template with code '{{descriptionTemplateLabel}}' is not finalized yet.",
|
||||
"DESCRIPTION-TEMPLATE-TYPE-IMPORT-DRAFT": "Description template type with code '{{descriptionTemplateTypeCode}}' is not finalized yet."
|
||||
"DESCRIPTION-TEMPLATE-TYPE-IMPORT-DRAFT": "Description template type with code '{{descriptionTemplateTypeCode}}' is not finalized yet.",
|
||||
"PLAN-BLUEPRINT-IMPORT-DRAFT": "Plan Blueprint with code '{{planBlueprintCode}}' is not finalized yet."
|
||||
},
|
||||
"FORM-VALIDATION-DISPLAY-DIALOG": {
|
||||
"WARNING": "Uyarı!",
|
||||
|
|
|
@ -33,6 +33,8 @@ export class HttpErrorHandlingService {
|
|||
this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.BACKEND-ERRORS.PLAN-DESCRIPTION-TEMPLATE-IMPORT-DRAFT', { 'descriptionTemplateLabel': errorResponse.error.error }), SnackBarNotificationLevel.Error);
|
||||
} else if (errorResponse.error.code === ResponseErrorCode.descriptionTemplateTypeImportDraft){
|
||||
this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.BACKEND-ERRORS.DESCRIPTION-TEMPLATE-TYPE-IMPORT-DRAFT', { 'descriptionTemplateTypeCode': errorResponse.error.error }), SnackBarNotificationLevel.Error);
|
||||
} else if (errorResponse.error.code === ResponseErrorCode.planBlueprintImportDraft){
|
||||
this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.BACKEND-ERRORS.PLAN-BLUEPRINT-IMPORT-DRAFT', { 'planBlueprintCode': errorResponse.error.error }), SnackBarNotificationLevel.Error);
|
||||
} else {
|
||||
this.uiNotificationService.snackBarNotification(ResponseErrorCodeHelper.getErrorMessageByBackendStatusCode(errorResponse.error.code, this.language), SnackBarNotificationLevel.Error);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue