download xml fixes

This commit is contained in:
CITE\spapacharalampous 2024-08-30 09:56:48 +03:00
parent 6e8eccecb1
commit ffe8b6b672
3 changed files with 5 additions and 5 deletions

View File

@ -509,7 +509,7 @@ public class PlanBlueprintServiceImpl implements PlanBlueprintService {
logger.debug(new MapLogEntry("export xml").And("id", id)); logger.debug(new MapLogEntry("export xml").And("id", id));
if (!ignoreAuthorize) this.authorizationService.authorizeForce(Permission.ExportPlanBlueprint); if (!ignoreAuthorize) this.authorizationService.authorizeForce(Permission.ExportPlanBlueprint);
PlanBlueprintEntity data = this.queryFactory.query(PlanBlueprintQuery.class).disableTracking().ids(id).authorize(AuthorizationFlags.AllExceptPublic).isActive(IsActive.Active).first(); PlanBlueprintEntity data = this.queryFactory.query(PlanBlueprintQuery.class).disableTracking().ids(id).authorize(AuthorizationFlags.AllExceptPublic).first();
if (data == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, PlanBlueprint.class.getSimpleName()}, LocaleContextHolder.getLocale())); if (data == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, PlanBlueprint.class.getSimpleName()}, LocaleContextHolder.getLocale()));
return this.definitionXmlToExport(data); return this.definitionXmlToExport(data);
@ -519,7 +519,7 @@ public class PlanBlueprintServiceImpl implements PlanBlueprintService {
@Override @Override
public ResponseEntity<byte[]> exportXml(UUID id) throws MyForbiddenException, MyNotFoundException, JAXBException, ParserConfigurationException, IOException, InstantiationException, IllegalAccessException, SAXException, TransformerException, InvalidApplicationException { public ResponseEntity<byte[]> exportXml(UUID id) throws MyForbiddenException, MyNotFoundException, JAXBException, ParserConfigurationException, IOException, InstantiationException, IllegalAccessException, SAXException, TransformerException, InvalidApplicationException {
logger.debug(new MapLogEntry("export xml").And("id", id)); logger.debug(new MapLogEntry("export xml").And("id", id));
PlanBlueprintEntity data = this.queryFactory.query(PlanBlueprintQuery.class).disableTracking().ids(id).authorize(AuthorizationFlags.AllExceptPublic).isActive(IsActive.Active).first(); PlanBlueprintEntity data = this.queryFactory.query(PlanBlueprintQuery.class).disableTracking().ids(id).authorize(AuthorizationFlags.AllExceptPublic).first();
if (data == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, PlanBlueprint.class.getSimpleName()}, LocaleContextHolder.getLocale())); if (data == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, PlanBlueprint.class.getSimpleName()}, LocaleContextHolder.getLocale()));
String xml = this.xmlHandlingService.toXml(this.getExportXmlEntity(id, false)); String xml = this.xmlHandlingService.toXml(this.getExportXmlEntity(id, false));

View File

@ -98,7 +98,7 @@
<mat-icon>library_books</mat-icon> <mat-icon>library_books</mat-icon>
{{'PLAN-BLUEPRINT-LISTING.ACTIONS.VIEW-VERSIONS' | translate}} {{'PLAN-BLUEPRINT-LISTING.ACTIONS.VIEW-VERSIONS' | translate}}
</button> </button>
<button mat-menu-item (click)="export($event, row.id)" *ngIf="canDownloadXML(row.id)"> <button mat-menu-item (click)="export($event, row.id)" *ngIf="canDownloadXML(row)">
<mat-icon>download</mat-icon>{{'PLAN-BLUEPRINT-LISTING.ACTIONS.DOWNLOAD-XML' | translate}} <mat-icon>download</mat-icon>{{'PLAN-BLUEPRINT-LISTING.ACTIONS.DOWNLOAD-XML' | translate}}
</button> </button>
<button *ngIf="canDelete(row)" mat-menu-item (click)="delete(row.id)"> <button *ngIf="canDelete(row)" mat-menu-item (click)="delete(row.id)">

View File

@ -108,7 +108,7 @@ export class PlanBlueprintListingComponent extends BaseListingComponent<PlanBlue
} }
protected canCreateNewVersion(blueprint: PlanBlueprint): boolean { protected canCreateNewVersion(blueprint: PlanBlueprint): boolean {
return blueprint?.belongsToCurrentTenant != false && (blueprint?.status === PlanBlueprintStatus.Finalized || blueprint?.status == null) return blueprint?.belongsToCurrentTenant != false && (blueprint?.status === PlanBlueprintStatus.Finalized || blueprint?.status == null) && blueprint?.isActive === IsActive.Active;
} }
protected canDelete(blueprint: PlanBlueprint): boolean { protected canDelete(blueprint: PlanBlueprint): boolean {
@ -116,7 +116,7 @@ export class PlanBlueprintListingComponent extends BaseListingComponent<PlanBlue
} }
protected canDownloadXML(blueprint: PlanBlueprint): boolean { protected canDownloadXML(blueprint: PlanBlueprint): boolean {
return this.authService.hasPermission(AppPermission.ExportPlanBlueprint) && this.isFinalized(blueprint); return this.authService.hasPermission(AppPermission.ExportPlanBlueprint);
} }
protected initializeLookup(): PlanBlueprintLookup { protected initializeLookup(): PlanBlueprintLookup {