From 884859acc5dfd51f94b54344d5ed78ae063a7e1c Mon Sep 17 00:00:00 2001
From: RIHTARSIC Joze <joze.rihtarsic@ext.ec.europa.eu>
Date: Wed, 19 Apr 2023 07:56:52 +0200
Subject: [PATCH] fix oracle bamboo plan init stripts

---
 pom.xml                                       |   4 +-
 smp-angular/src/app/app.module.ts             |   6 +
 .../edit-resource.component.html              |  10 +-
 .../subresource-dialog.component.css          |   0
 .../subresource-dialog.component.html         |  60 ++++++
 .../subresource-dialog.component.ts           | 153 ++++++++++++++
 .../subresource-panel.component.html          |  83 ++++++++
 .../subresource-panel.component.scss          |  20 ++
 .../subresource-panel.component.ts            | 194 ++++++++++++++++++
 .../OasisSMPServiceGroup10Handler.java        |  16 +-
 smp-server-library/pom.xml                    |   4 +-
 .../resource/ResourceHandlerService.java      |   4 +-
 .../oracle-4.1_integration_test_data.sql      |  13 +-
 smp-soapui-tests/pom.xml                      |   2 +-
 14 files changed, 542 insertions(+), 27 deletions(-)
 create mode 100644 smp-angular/src/app/edit/edit-resources/subresource-panel/resource-dialog/subresource-dialog.component.css
 create mode 100644 smp-angular/src/app/edit/edit-resources/subresource-panel/resource-dialog/subresource-dialog.component.html
 create mode 100644 smp-angular/src/app/edit/edit-resources/subresource-panel/resource-dialog/subresource-dialog.component.ts
 create mode 100644 smp-angular/src/app/edit/edit-resources/subresource-panel/subresource-panel.component.html
 create mode 100644 smp-angular/src/app/edit/edit-resources/subresource-panel/subresource-panel.component.scss
 create mode 100644 smp-angular/src/app/edit/edit-resources/subresource-panel/subresource-panel.component.ts

diff --git a/pom.xml b/pom.xml
index e27acb17c..97bcf0b59 100644
--- a/pom.xml
+++ b/pom.xml
@@ -269,7 +269,7 @@
                 <artifactId>h2</artifactId>
                 <version>${h2.version}</version>
             </dependency>
-            <dependency>
+            <!-- dependency>
                 <groupId>javax.xml.bind</groupId>
                 <artifactId>jaxb-api</artifactId>
                 <version>${jaxb-api.version}</version>
@@ -283,7 +283,7 @@
                 <groupId>com.sun.xml.bind</groupId>
                 <artifactId>jaxb-core</artifactId>
                 <version>${jaxb.version}</version>
-            </dependency>
+            </dependency -->
             <dependency>
                 <groupId>org.springframework</groupId>
                 <artifactId>spring-core</artifactId>
diff --git a/smp-angular/src/app/app.module.ts b/smp-angular/src/app/app.module.ts
index 0b8fa350e..3301b0fd6 100644
--- a/smp-angular/src/app/app.module.ts
+++ b/smp-angular/src/app/app.module.ts
@@ -162,10 +162,16 @@ import { CodemirrorModule } from '@ctrl/ngx-codemirror';
 import {
   DocumentWizardDialogComponent
 } from "./edit/edit-resources/document-wizard-dialog/document-wizard-dialog.component";
+import {SubresourcePanelComponent} from "./edit/edit-resources/subresource-panel/subresource-panel.component";
+import {
+  SubresourceDialogComponent
+} from "./edit/edit-resources/subresource-panel/resource-dialog/subresource-dialog.component";
 
 
 @NgModule({
   declarations: [
+    SubresourceDialogComponent,
+    SubresourcePanelComponent,
     DocumentWizardDialogComponent,
     AccessTokenGenerationDialogComponent,
     AccessTokenPanelComponent,
diff --git a/smp-angular/src/app/edit/edit-resources/edit-resource.component.html b/smp-angular/src/app/edit/edit-resources/edit-resource.component.html
index 532a7898c..a8ab5a1ca 100644
--- a/smp-angular/src/app/edit/edit-resources/edit-resource.component.html
+++ b/smp-angular/src/app/edit/edit-resources/edit-resource.component.html
@@ -29,17 +29,17 @@
 
         ></domain-member-panel>
       </mat-tab>
-      <!-- mat-tab>
+      <mat-tab *ngIf="false">
         <ng-template mat-tab-label>
-          <smp-label icon="description" label="Resources"></smp-label>
+          <smp-label icon="description" label="Subresources"></smp-label>
         </ng-template>
-        <group-resource-panel
+        <subresource-panel
           [domainResourceDefs]="_selectedDomainResourceDef"
           [domain]="selectedDomain"
           [group]="selectedGroup"
           [resource]="selectedResource"
-        ></group-resource-panel>
-      </mat-tab -->
+        ></subresource-panel>
+      </mat-tab>
     </mat-tab-group>
   </data-panel>
 </div>
diff --git a/smp-angular/src/app/edit/edit-resources/subresource-panel/resource-dialog/subresource-dialog.component.css b/smp-angular/src/app/edit/edit-resources/subresource-panel/resource-dialog/subresource-dialog.component.css
new file mode 100644
index 000000000..e69de29bb
diff --git a/smp-angular/src/app/edit/edit-resources/subresource-panel/resource-dialog/subresource-dialog.component.html b/smp-angular/src/app/edit/edit-resources/subresource-panel/resource-dialog/subresource-dialog.component.html
new file mode 100644
index 000000000..6acdab838
--- /dev/null
+++ b/smp-angular/src/app/edit/edit-resources/subresource-panel/resource-dialog/subresource-dialog.component.html
@@ -0,0 +1,60 @@
+<h2 mat-dialog-title>{{formTitle}}</h2>
+<mat-dialog-content style="width:700px">
+  <form [formGroup]="resourceForm">
+    <b *ngIf="newMode">To create a new resource enter unique identifier and scheme and click save.</b>
+    <mat-form-field style="width:100%">
+      <mat-label>Selected resource type</mat-label>
+      <mat-select placeholder="Select resource type for the resource"
+                  matTooltip="Select type for the resource."
+                  id="resourceTypeIdentifier"
+                  formControlName="resourceTypeIdentifier"
+                  required>
+        <mat-option *ngFor="let resDef of domainResourceDefs"
+                    [value]="resDef.identifier">
+          {{resDef.name}} ({{resDef.identifier}})
+        </mat-option>
+
+      </mat-select>
+    </mat-form-field>
+    <mat-form-field  style="width: 100%">
+      <mat-label>Resource identifier</mat-label>
+      <input id="identifierValue_id" type="text" matInput #identifierValue
+             formControlName="identifierValue"
+             required auto-focus-directive>
+    </mat-form-field>
+
+    <mat-form-field  style="width: 100%">
+      <mat-label>Resource scheme</mat-label>
+      <input id="identifierScheme_id" type="text" matInput
+             formControlName="identifierScheme"
+             >
+    </mat-form-field>
+
+
+    <mat-form-field style="width:100%">
+      <mat-label>Resource visibility</mat-label>
+      <mat-select placeholder="Resource visibility"
+                  formControlName="visibility"
+                  matTooltip="Resource visibility."
+                  id="visibility_id" required>
+        <mat-option *ngFor="let visibility of groupVisibilityOptions"
+                    [value]="visibility.value">
+          {{visibility.key}}
+        </mat-option>
+      </mat-select>
+      <mat-hint>Choose resource visibility</mat-hint>
+    </mat-form-field>
+  </form>
+</mat-dialog-content>
+<mat-dialog-actions>
+  <button mat-raised-button color="primary" (click)="closeDialog()">
+    <mat-icon>cancel</mat-icon>
+    <span>Close</span>
+  </button>
+  <button id="saveButton" mat-raised-button (click)="onSaveButtonClicked()" color="primary"
+          [disabled]="!submitButtonEnabled">
+    <mat-icon>save</mat-icon>
+    <span>Save</span>
+  </button>
+</mat-dialog-actions>
+
diff --git a/smp-angular/src/app/edit/edit-resources/subresource-panel/resource-dialog/subresource-dialog.component.ts b/smp-angular/src/app/edit/edit-resources/subresource-panel/resource-dialog/subresource-dialog.component.ts
new file mode 100644
index 000000000..165c7d037
--- /dev/null
+++ b/smp-angular/src/app/edit/edit-resources/subresource-panel/resource-dialog/subresource-dialog.component.ts
@@ -0,0 +1,153 @@
+import {Component, ElementRef, Inject, Input, ViewChild} from '@angular/core';
+import {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material/dialog';
+import {FormBuilder, FormControl, FormGroup} from "@angular/forms";
+import {AlertMessageService} from "../../../../common/alert-message/alert-message.service";
+import {VisibilityEnum} from "../../../../common/enums/visibility.enum";
+import {GroupRo} from "../../../../common/model/group-ro.model";
+import {ResourceRo} from "../../../../common/model/resource-ro.model";
+import {DomainRo} from "../../../../common/model/domain-ro.model";
+import {ResourceDefinitionRo} from "../../../../system-settings/admin-extension/resource-definition-ro.model";
+import {EditGroupService} from "../../../edit-group/edit-group.service";
+
+
+
+@Component({
+  templateUrl: './subresource-dialog.component.html',
+  styleUrls: ['./subresource-dialog.component.css']
+})
+export class SubresourceDialogComponent {
+
+  readonly groupVisibilityOptions = Object.keys(VisibilityEnum)
+    .filter(el => el !== "Private").map(el => {
+      return {key: el, value: VisibilityEnum[el]}
+    });
+  formTitle = "Resource dialog";
+  resourceForm: FormGroup;
+  message: string;
+  messageType: string = "alert-error";
+  group: GroupRo;
+  _resource: ResourceRo
+  domain:DomainRo;
+  domainResourceDefs:ResourceDefinitionRo[];
+
+  @ViewChild('identifierValue', {static: false}) identifierValue: ElementRef;
+  constructor(@Inject(MAT_DIALOG_DATA) public data: any,
+              public dialogRef: MatDialogRef<SubresourceDialogComponent>,
+              private editGroupService: EditGroupService,
+              private alertService: AlertMessageService,
+              private formBuilder: FormBuilder
+  ) {
+    dialogRef.disableClose = true;//disable default close operation
+    this.formTitle = data.formTitle;
+
+
+    this.resourceForm = formBuilder.group({
+      'identifierValue': new FormControl({value: null}),
+      'identifierScheme': new FormControl({value: null}),
+      'visibility': new FormControl({value: null}),
+      'resourceTypeIdentifier': new FormControl({value: null}),
+      '': new FormControl({value: null})
+    });
+    this.resource = data.resource;
+    this.group = data.group;
+    this.domain = data.domain;
+    this.domainResourceDefs = data.domainResourceDefs;
+
+
+  }
+
+  get newMode(): boolean {
+    return !this._resource?.resourceId
+  }
+
+  get resource(): ResourceRo {
+    let resource = {...this._resource};
+    resource.identifierScheme = this.resourceForm.get('identifierScheme').value;
+    resource.identifierValue = this.resourceForm.get('identifierValue').value;
+    resource.resourceTypeIdentifier = this.resourceForm.get('resourceTypeIdentifier').value;
+    resource.visibility = this.resourceForm.get('visibility').value;
+    return resource;
+  }
+
+  @Input() set resource(value: ResourceRo) {
+    this._resource = value;
+
+    if (!!value) {
+      this.resourceForm.enable();
+      this.resourceForm.controls['identifierValue'].setValue(value.identifierValue);
+      this.resourceForm.controls['identifierScheme'].setValue(value.identifierScheme);
+      this.resourceForm.controls['resourceTypeIdentifier'].setValue(value.resourceTypeIdentifier);
+      // control disable enable did not work??
+      if (this.newMode) {
+        this.resourceForm.controls['identifierValue'].enable();
+        this.resourceForm.controls['identifierScheme'].enable();
+        this.resourceForm.controls['resourceTypeIdentifier'].enable();
+      } else {
+        this.resourceForm.controls['identifierValue'].disable();
+        this.resourceForm.controls['identifierScheme'].disable();
+        this.resourceForm.controls['resourceTypeIdentifier'].disable();
+      }
+
+      this.resourceForm.controls['visibility'].setValue(value.visibility);
+
+    } else {
+      this.resourceForm.disable();
+      this.resourceForm.controls['identifierValue'].setValue("");
+      this.resourceForm.controls['identifierScheme'].setValue("");
+      this.resourceForm.controls['visibility'].setValue("");
+      this.resourceForm.controls['resourceTypeIdentifier'].setValue("");
+    }
+
+    this.resourceForm.markAsPristine();
+  }
+
+  clearAlert() {
+    this.message = null;
+    this.messageType = null;
+  }
+
+
+  closeDialog() {
+    this.dialogRef.close()
+  }
+
+  get submitButtonEnabled(): boolean {
+    return this.resourceForm.valid && this.resourceForm.dirty;
+  }
+
+  public onSaveButtonClicked() {
+
+    let resource = this.resource;
+    if (this.newMode) {
+      this.createResource(resource);
+    } else {
+      this.saveResource(resource);
+    }
+  }
+
+  public createResource(resource: ResourceRo) {
+
+        this.editGroupService.createResourceForGroup(this.resource, this.group, this.domain).subscribe((result: ResourceRo) => {
+          if (!!result) {
+            this.closeDialog();
+          }
+        }, (error) => {
+          this.alertService.error(error.error?.errorDescription)
+        });
+
+  }
+
+  public saveResource(resource: ResourceRo) {
+    this.editGroupService.updateResourceForGroup(this.resource, this.group, this.domain).subscribe((result: ResourceRo) => {
+      if (!!result) {
+        this.closeDialog();
+      }
+    }, (error) => {
+      this.alertService.error(error.error?.errorDescription)
+    });
+  }
+
+  public setFocus() {
+    setTimeout(() => this.identifierValue.nativeElement.focus());
+  }
+}
diff --git a/smp-angular/src/app/edit/edit-resources/subresource-panel/subresource-panel.component.html b/smp-angular/src/app/edit/edit-resources/subresource-panel/subresource-panel.component.html
new file mode 100644
index 000000000..4f370901c
--- /dev/null
+++ b/smp-angular/src/app/edit/edit-resources/subresource-panel/subresource-panel.component.html
@@ -0,0 +1,83 @@
+<div id="edit-resource-panel" class="mat-elevation-z2">
+  <mat-toolbar class="mat-elevation-z2">
+    <mat-toolbar-row class="smp-toolbar-row">
+      <button id="addMemberButton" mat-raised-button (click)="onCreateResourceButtonClicked()" color="primary"
+              [disabled]="createResourceDisabled"
+              matTooltip="Create"
+      >
+        <mat-icon>people</mat-icon>
+        <span>Create</span>
+      </button>
+      <button id="editButton" mat-raised-button (click)="onEditSelectedButtonClicked()" color="primary"
+              [disabled]="!selected"
+              matTooltip="Edit"
+      >
+        <mat-icon>edit</mat-icon>
+        <span>Edit</span>
+      </button>
+      <button id="deleteButton" mat-raised-button (click)="onDeleteSelectedButtonClicked()" color="primary"
+              matTooltip="Delete selected resource"
+              [disabled]="!selected">
+        <mat-icon>delete</mat-icon>
+        <span>Delete</span>
+      </button>
+    </mat-toolbar-row>
+  </mat-toolbar>
+  <h3>{{title}}</h3>
+  <div class="edit-resource-container mat-elevation-z2">
+    <div class="edit-resource-loading-shade"
+         *ngIf="isLoadingResults">
+      <mat-spinner *ngIf="isLoadingResults"></mat-spinner>
+    </div>
+
+    <div class="edit-resource-table-container">
+
+      <mat-form-field id="edit-resource-filter" style="width: 100%">
+        <mat-label>Resource filter</mat-label>
+        <input matInput (keyup)="applyResourceFilter($event)"
+               placeholder="Resource filter"
+               [disabled]="disabledForm"
+               #inputDomainMemberFilter>
+      </mat-form-field>
+
+      <table class="mat-elevation-z2" mat-table [dataSource]="data">
+
+        <ng-container matColumnDef="identifierScheme">
+          <th mat-header-cell *matHeaderCellDef>Scheme</th>
+          <td mat-cell *matCellDef="let row">{{row.identifierScheme}}</td>
+        </ng-container>
+
+        <ng-container matColumnDef="identifierValue">
+          <th mat-header-cell *matHeaderCellDef>Identifier</th>
+          <td mat-cell *matCellDef="let row">{{row.identifierValue}}</td>
+        </ng-container>
+
+
+
+        <tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
+        <tr mat-row *matRowDef="let odd = odd; let row; columns: displayedColumns;"
+            (click)="onResourceSelected(row)"
+            (dblclick)="showResourceEditDialog(row)"
+            [ngClass]="{'datatable-row-selected': row==selected,'datatable-row-odd': odd}"
+        ></tr>
+
+        <tr class="mat-row" *matNoDataRow>
+          <td *ngIf="inputDomainMemberFilter.value;else noDataFound" class="mat-cell" colspan="2">No resources
+            matching the filter
+            "{{inputDomainMemberFilter.value}}"
+          </td>
+          <ng-template #noDataFound>
+            <td class="mat-cell" colspan="2">No direct members for the domain</td>
+          </ng-template>
+        </tr>
+      </table>
+    </div>
+
+    <mat-paginator class="mat-elevation-z2" [length]="resultsLength"
+                   (page)="onPageChanged($event)"
+                   [pageSize]="5"
+                   [pageSizeOptions]="[5, 10, 25]"
+                   [disabled]="disabledForm"
+                   aria-label="Select pages"></mat-paginator>
+  </div>
+</div>
diff --git a/smp-angular/src/app/edit/edit-resources/subresource-panel/subresource-panel.component.scss b/smp-angular/src/app/edit/edit-resources/subresource-panel/subresource-panel.component.scss
new file mode 100644
index 000000000..ea6216a48
--- /dev/null
+++ b/smp-angular/src/app/edit/edit-resources/subresource-panel/subresource-panel.component.scss
@@ -0,0 +1,20 @@
+
+
+
+.edit-resource-loading-shade {
+  position: absolute;
+  top: 0;
+  left: 0;
+  bottom: 56px;
+  right: 0;
+  background: rgba(0, 0, 0, 0.15);
+  z-index: 1;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+}
+
+#dit-resource-filter {
+  width: 100%;
+  padding-top: 1em;
+}
diff --git a/smp-angular/src/app/edit/edit-resources/subresource-panel/subresource-panel.component.ts b/smp-angular/src/app/edit/edit-resources/subresource-panel/subresource-panel.component.ts
new file mode 100644
index 000000000..6f7d80dc1
--- /dev/null
+++ b/smp-angular/src/app/edit/edit-resources/subresource-panel/subresource-panel.component.ts
@@ -0,0 +1,194 @@
+import {Component, Input, ViewChild,} from '@angular/core';
+import {MatDialog} from "@angular/material/dialog";
+import {BeforeLeaveGuard} from "../../../window/sidenav/navigation-on-leave-guard";
+import {MatPaginator, PageEvent} from "@angular/material/paginator";
+import {GroupRo} from "../../../common/model/group-ro.model";
+import {ResourceRo} from "../../../common/model/resource-ro.model";
+import {AlertMessageService} from "../../../common/alert-message/alert-message.service";
+import {finalize} from "rxjs/operators";
+import {TableResult} from "../../../common/model/table-result.model";
+import {ConfirmationDialogComponent} from "../../../common/dialogs/confirmation-dialog/confirmation-dialog.component";
+import {SubresourceDialogComponent} from "./resource-dialog/subresource-dialog.component";
+import {DomainRo} from "../../../common/model/domain-ro.model";
+import {ResourceDefinitionRo} from "../../../system-settings/admin-extension/resource-definition-ro.model";
+import {VisibilityEnum} from "../../../common/enums/visibility.enum";
+import {EditGroupService} from "../../edit-group/edit-group.service";
+
+
+@Component({
+  selector: 'subresource-panel',
+  templateUrl: './subresource-panel.component.html',
+  styleUrls: ['./subresource-panel.component.scss']
+})
+export class SubresourcePanelComponent implements BeforeLeaveGuard {
+
+
+
+  title: string = "Subresources";
+  private _group: GroupRo;
+  @Input() resource: ResourceRo;
+  @Input() domain: DomainRo;
+  @Input() domainResourceDefs: ResourceDefinitionRo[];
+  displayedColumns: string[] = ['identifierValue', 'identifierScheme'];
+  data: ResourceRo[] = [];
+  selected: ResourceRo;
+  filter: any = {};
+  resultsLength = 0;
+  isLoadingResults = false;
+  @ViewChild(MatPaginator) paginator: MatPaginator;
+
+  constructor(private editGroupService: EditGroupService,
+              private alertService: AlertMessageService,
+              private dialog: MatDialog) {
+  }
+
+
+  @Input() set group(value: GroupRo) {
+    if (this._group == value) {
+      return;
+    }
+    this._group = value;
+    this.title = "Group resources" + (!!this._group?": [" +this._group.groupName+"]":"")
+    if (!!this._group) {
+      this.loadGroupResources();
+    } else {
+      this.isLoadingResults = false;
+    }
+  }
+
+  get group(){
+    return this._group;
+  }
+
+  onPageChanged(page: PageEvent) {
+    this.loadGroupResources();
+  }
+
+  loadGroupResources() {
+    if (!this._group) {
+      return;
+    }
+
+    this.isLoadingResults = true;
+    this.editGroupService.getGroupResourcesForGroupAdminObservable(this._group,this.domain, this.filter, this.paginator.pageIndex, this.paginator.pageSize)
+      .pipe(
+        finalize(() => {
+          this.isLoadingResults = false;
+        }))
+      .subscribe((result: TableResult<ResourceRo>) => {
+          this.data = [...result.serviceEntities];
+          this.resultsLength = result.count;
+          this.isLoadingResults = false;
+        }
+      );
+  }
+
+
+  applyResourceFilter(event: Event) {
+    const filterValue = (event.target as HTMLInputElement).value;
+    this.filter["filter"] = filterValue.trim().toLowerCase();
+    this.refresh();
+  }
+
+  get createResourceDisabled(): boolean {
+    return !this._group;
+  }
+
+  public onCreateResourceButtonClicked() {
+    this.showResourceEditDialog(this.crateResource());
+  }
+
+  crateResource ():ResourceRo {
+    return {
+      resourceTypeIdentifier: !!this.domainResourceDefs && this.domainResourceDefs.length>0 ? this.domainResourceDefs[0].identifier:"",
+      identifierValue: "",
+      smlRegistered: false,
+      visibility: VisibilityEnum.Public
+
+    }
+  }
+
+  public refresh() {
+    if (this.paginator) {
+      this.paginator.firstPage();
+    }
+    this.loadGroupResources();
+  }
+  public onEditSelectedButtonClicked() {
+    this.showResourceEditDialog(this.selected)
+  }
+  public showResourceEditDialog(resource: ResourceRo) {
+    this.dialog.open(SubresourceDialogComponent, {
+      data: {
+        resource: resource,
+        group: this._group,
+        domain: this.domain,
+        domainResourceDefs: this.domainResourceDefs,
+        formTitle: "Resource details dialog"
+      }
+    }).afterClosed().subscribe(value => {
+      this.refresh();
+    });
+  }
+
+  public onDeleteSelectedButtonClicked() {
+    if (!this._group || !this._group.groupId) {
+      this.alertService.error("Can not delete group because of invalid domain data. Is group selected?");
+      return;
+    }
+
+    if (!this.selected || !this.selected.resourceId) {
+      this.alertService.error("Can not delete resource because of invalid resource data. Is resource selected?");
+      return;
+    }
+
+    this.dialog.open(ConfirmationDialogComponent, {
+      data: {
+        title: "Delete Resource with scheme from DomiSMP",
+        description: "Action will permanently delete resource  [" + this.selected.identifierScheme + "] and identifier: [" + this.selected.identifierValue + "]! " +
+          "Do you wish to continue?"
+      }
+    }).afterClosed().subscribe(result => {
+      if (result) {
+        this.deleteResource(this.group, this.selected);
+      }
+    });
+  }
+
+  deleteResource(group: GroupRo, resource: ResourceRo) {
+    this.isLoadingResults = true;
+    this.editGroupService.deleteResourceFromGroup(resource, this._group, this.domain)
+      .pipe(
+        finalize(() => {
+          this.refresh();
+          this.isLoadingResults = false;
+        }))
+      .subscribe((result: ResourceRo) => {
+          if(result) {
+            this.alertService.success("Resource  [" + this.selected.identifierScheme + "] and identifier: [" + this.selected.identifierValue + "] deleted.");
+          }
+        }, (error)=> {
+          this.alertService.error(error.error?.errorDescription);
+        }
+      );
+  }
+
+
+  public onResourceSelected(resource: ResourceRo) {
+    this.selected = resource;
+  }
+
+  get disabledForm(): boolean {
+    return !this._group;
+  }
+
+  isDirty(): boolean {
+    return false
+  }
+}
+
+
+
+
+
+
diff --git a/smp-resource-extensions/oasis-smp-spi/src/main/java/eu/europa/ec/smp/spi/handler/OasisSMPServiceGroup10Handler.java b/smp-resource-extensions/oasis-smp-spi/src/main/java/eu/europa/ec/smp/spi/handler/OasisSMPServiceGroup10Handler.java
index 5e0e96e97..5f1792b9a 100644
--- a/smp-resource-extensions/oasis-smp-spi/src/main/java/eu/europa/ec/smp/spi/handler/OasisSMPServiceGroup10Handler.java
+++ b/smp-resource-extensions/oasis-smp-spi/src/main/java/eu/europa/ec/smp/spi/handler/OasisSMPServiceGroup10Handler.java
@@ -80,12 +80,11 @@ public class OasisSMPServiceGroup10Handler extends AbstractOasisSMPHandler {
             return;
         }
 
-
         ServiceGroup serviceGroup = null;
         try {
             serviceGroup = reader.parseNative(resourceData.getResourceInputStream());
         } catch (TechnicalException e) {
-            throw new ResourceException(PARSE_ERROR, "Can not pase service group xml for indentifier: [" + identifier + "]. Error: " + ExceptionUtils.getRootCauseMessage(e), e);
+            throw new ResourceException(PARSE_ERROR, "Can not pase service group xml for identifier: [" + identifier + "]. Error: " + ExceptionUtils.getRootCauseMessage(e), e);
         }
         // get references
         serviceGroup.setServiceMetadataReferenceCollection(new ServiceMetadataReferenceCollectionType());
@@ -153,13 +152,13 @@ public class OasisSMPServiceGroup10Handler extends AbstractOasisSMPHandler {
         serviceGroup.getParticipantIdentifier().setScheme(resourceData.getResourceIdentifier().getScheme());
 
         try {
-            StreamUtils.copy(inputStream, responseData.getOutputStream());
-            //reader.serializeNative(serviceGroup, responseData.getOutputStream(), false);
-        } catch (IOException e) {
+            //inputStream.reset();
+            //StreamUtils.copy(inputStream, responseData.getOutputStream());
+            // need to save serviceGroup because of the update on the resource identifier values
+            reader.serializeNative(serviceGroup, responseData.getOutputStream(), true);
+        } catch ( TechnicalException e) {
             throw new ResourceException(PARSE_ERROR, "Error occurred while copying the ServiceGroup", e);
         }
-
-
     }
 
     /**
@@ -169,7 +168,6 @@ public class OasisSMPServiceGroup10Handler extends AbstractOasisSMPHandler {
      */
     @Override
     public void validateResource(RequestData resourceData) throws ResourceException {
-
         validateAndParse(resourceData);
     }
 
@@ -190,7 +188,7 @@ public class OasisSMPServiceGroup10Handler extends AbstractOasisSMPHandler {
         ServiceGroup serviceGroup = null;
         try {
             serviceGroup = reader.parseNative(new ByteArrayInputStream(bytearray));
-        } catch (TechnicalException e) {
+        } catch ( TechnicalException e) {
             throw new ResourceException(INVALID_RESOURCE, "Error occurred while parsing Oasis SMP 1.0 ServiceGroup with error: " + ExceptionUtils.getRootCauseMessage(e), e);
         }
         final ParticipantIdentifierType participantId = serviceGroup.getParticipantIdentifier();
diff --git a/smp-server-library/pom.xml b/smp-server-library/pom.xml
index 06200a4b4..68b085503 100644
--- a/smp-server-library/pom.xml
+++ b/smp-server-library/pom.xml
@@ -151,14 +151,14 @@
             <artifactId>httpclient</artifactId>
             <version>4.5.14</version>
         </dependency>
-        <dependency>
+        <!-- dependency>
             <groupId>com.sun.xml.bind</groupId>
             <artifactId>jaxb-impl</artifactId>
         </dependency>
         <dependency>
             <groupId>com.sun.xml.bind</groupId>
             <artifactId>jaxb-core</artifactId>
-        </dependency>
+        </dependency -->
         <!-- dependency>
             <groupId>org.bouncycastle</groupId>
             <artifactId>bcprov-jdk15on</artifactId>
diff --git a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/resource/ResourceHandlerService.java b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/resource/ResourceHandlerService.java
index 21b7b3def..ed8d673ef 100644
--- a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/resource/ResourceHandlerService.java
+++ b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/resource/ResourceHandlerService.java
@@ -113,11 +113,11 @@ public class ResourceHandlerService extends AbstractResourceHandler {
         } catch (ResourceException e) {
             switch (e.getErrorCode()) {
                 case INVALID_PARAMETERS:
-                    throw new BadRequestException(ErrorBusinessCode.WRONG_FIELD, ExceptionUtils.getRootCauseMessage(e));
+                    throw new BadRequestException(ErrorBusinessCode.WRONG_FIELD, e.getMessage());
                 case INVALID_RESOURCE:
                     throw new SMPRuntimeException(ErrorCode.INVALID_EXTENSION_FOR_SG, resource.getIdentifierValue(),
                             resource.getIdentifierScheme(),
-                            ExceptionUtils.getRootCauseMessage(e));
+                            e.getMessage());
                 default:
                     throw new SMPRuntimeException(ErrorCode.INTERNAL_ERROR, "Error occurred while reading the resource!", e);
             }
diff --git a/smp-soapui-tests/groovy/oracle-4.1_integration_test_data.sql b/smp-soapui-tests/groovy/oracle-4.1_integration_test_data.sql
index 4000c0c21..ad7006732 100644
--- a/smp-soapui-tests/groovy/oracle-4.1_integration_test_data.sql
+++ b/smp-soapui-tests/groovy/oracle-4.1_integration_test_data.sql
@@ -101,6 +101,10 @@ insert into SMP_CERTIFICATE (ID, CERTIFICATE_ID, SUBJECT, ISSUER, SERIALNUMBER,V
 insert into SMP_DOMAIN (ID, DOMAIN_CODE, VISIBILITY, SML_SUBDOMAIN, SML_SMP_ID, SIGNATURE_KEY_ALIAS, SML_CLIENT_CERT_AUTH,SML_REGISTERED, CREATED_ON, LAST_UPDATED_ON) values
 (1, 'testdomain','PUBLIC', 'test-domain', 'CEF-SMP-002','sample_key',1,0, sysdate,  sysdate);
 
+insert into SMP_GROUP (ID, FK_DOMAIN_ID, NAME, VISIBILITY, CREATED_ON, LAST_UPDATED_ON) values
+(1, 1, 'Test group', 'PUBLIC', sysdate,  sysdate);
+
+
 insert into SMP_EXTENSION ( ID, IDENTIFIER,  IMPLEMENTATION_NAME, NAME, VERSION, DESCRIPTION, CREATED_ON, LAST_UPDATED_ON) values
 (1, 'edelivery-oasis-smp-extension',  'OasisSMPExtension','Oasis SMP 1.0 and 2.0','1.0', 'Oasis SMP 1.0 and 2.0 extension',  sysdate, sysdate);
 
@@ -126,8 +130,8 @@ insert into SMP_DOCUMENT (ID, CURRENT_VERSION, MIME_TYPE, NAME,CREATED_ON, LAST_
 insert into SMP_DOCUMENT_VERSION (ID, FK_DOCUMENT_ID, VERSION, DOCUMENT_CONTENT, CREATED_ON, LAST_UPDATED_ON) values
 (2,2,  1, utl_raw.cast_to_raw('<ServiceMetadata xmlns="http://docs.oasis-open.org/bdxr/ns/SMP/2016/05"><Redirect href="http://localhost:8080/url"><CertificateUID/></Redirect></ServiceMetadata>') , sysdate,  sysdate);
 
-insert into SMP_RESOURCE ( ID, FK_DOCUMENT_ID, FK_DOREDEF_ID,  IDENTIFIER_SCHEME, IDENTIFIER_VALUE, SML_REGISTERED, VISIBILITY, CREATED_ON, LAST_UPDATED_ON) values
-(1, 1, 1, 'iso6523-actorid-upis', '0088:777002abzz777', 0, 'PUBLIC', sysdate,  sysdate);
+insert into SMP_RESOURCE ( ID, FK_DOCUMENT_ID, FK_GROUP_ID, FK_DOREDEF_ID,  IDENTIFIER_SCHEME, IDENTIFIER_VALUE, SML_REGISTERED, VISIBILITY, CREATED_ON, LAST_UPDATED_ON) values
+(1, 1, 1, 1, 'iso6523-actorid-upis', '0088:777002abzz777', 0, 'PUBLIC', sysdate,  sysdate);
 
 insert into SMP_SUBRESOURCE (ID, FK_RESOURCE_ID,FK_SUREDEF_ID, FK_DOCUMENT_ID, IDENTIFIER_VALUE, IDENTIFIER_SCHEME, CREATED_ON, LAST_UPDATED_ON) values
 (1, 1, 1, 2, 'service-value', 'service-schema', sysdate,  sysdate);
@@ -136,11 +140,8 @@ insert into SMP_SUBRESOURCE (ID, FK_RESOURCE_ID,FK_SUREDEF_ID, FK_DOCUMENT_ID, I
 (2, 1, 1, 2, 'service-value2', 'service-schema2', sysdate,  sysdate);
 
 
-insert into SMP_GROUP (ID, FK_DOMAIN_ID, NAME, VISIBILITY, CREATED_ON, LAST_UPDATED_ON) values
-(1, 1, 'Test group', 'PUBLIC', sysdate,  sysdate);
 
-insert into  SMP_GROUP_RESOURCE (FK_GROUP_ID, FK_RESOURCE_ID) values
-(1, 1);
+
 
 insert into SMP_RESOURCE_MEMBER (ID, FK_RESOURCE_ID, FK_USER_ID, MEMBERSHIP_ROLE, CREATED_ON, LAST_UPDATED_ON) values
 (1, 1, 2, 'ADMIN', sysdate,  sysdate);
diff --git a/smp-soapui-tests/pom.xml b/smp-soapui-tests/pom.xml
index 24c577385..43c6f7b8a 100644
--- a/smp-soapui-tests/pom.xml
+++ b/smp-soapui-tests/pom.xml
@@ -63,7 +63,7 @@
                             <!--If you want to execute single test case -->
                             <!-- testCase>SMP001-Create ServiceGroup-Basic Flow-Admin Service Group specified</testCase -->
                             <!-- testCase>SMP063-EDELIVERY-364 slash encoding-Tomcat</testCase -->
-                            <testCase>SMP022-Create ServiceMetadata-Basic Flow</testCase>
+                            <!-- testCase>SMP022-Create ServiceMetadata-Basic Flow</testCase -->
                             <projectProperties>
                                 <value>url=${url}</value>
                                 <value>SMPAdminUser=${SMPAdminUser}</value>
-- 
GitLab