Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS has been phased out. To see alternatives please check here

Skip to content
Snippets Groups Projects
Select Git revision
  • d954eb472f99abf0961c9b886995f2f991c9ac81
  • development default
  • bugfix/EDELIVERY-15385-smp-configuration-documentation-fixes
  • feature/EDELIVERY-13760-translate-server-side-error-messages
  • release/5.1.x
  • feature/EDELIVERY-12744-ui-domain-configuration-domain-specific-truststores
  • feature/EDELIVERY-15382-rest-api-jwt-authentication-for-dynamic-discovery-client
  • bugfix/EDELIVERY-14172-domismp-accepts-requests-with-wrong-domain-header-value
  • EDELIVERY-15372-upgrade-libraries-and-plugins-and-update-httpclient-to-httpclient5
  • EDELIVERY-15377-migrate-to-angular-20
  • bugfix/EDELIVERY-14196-select-domain-select-resource-dropdown-should-be-order-alphabetically
  • feature/EDELIVERY-12753-sml-integration-migration-to-different-smp
  • feature/EDELIVERY-13757-extend-session-dialog-should-have-an-active-counter
  • EDELIVERY-15144-sql-update
  • bugfix/EDELIVERY-14326-ui-edit-resource-filters
  • feature/EDELIVERY-15144-domismp-system-notification-generalize-time-expiration-alerts
  • bugfix/EDELIVERY-15102-alert-is-not-appearing-when-adding-duplicated-certificate
  • bugfix/EDELIVERY-15203-small-left-grid-shows-no-data-found-for-1-2-seconds-before-loading-the-data
  • EDELIVERY-15219-search-filter-with-understore-char-does-not-work
  • bugfix/EDELIVERY-15226-certificates-error-when-trying-to-delete-certificates
  • bugfix/EDELIVERY-15224-error-when-trying-to-update-info-from-profile-page
  • 5.1.1
  • 5.1
  • 5.1-TEST
  • 5.1-RC1
  • 5.0.1
  • 5.0
  • 5.0-RC1
  • 4.2
  • 4.2-RC1
  • 4.1.2
  • 4.1.1
  • 4.1.0
  • 4.1.0-RC1
  • 4.0.0
  • 4.0.0-RC1
  • 3.0.2
  • 3.0.1
  • 3.0.0
39 results

service-group-extension-wizard-dialog.component.ts

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    service-group-extension-wizard-dialog.component.ts 2.71 KiB
    import {Component} from '@angular/core';
    import {MatDialogRef} from '@angular/material';
    import {FormBuilder, FormControl, FormGroup} from "@angular/forms";
    
    @Component({
      selector: 'service-group-extension-wizard',
      templateUrl: './service-group-extension-wizard-dialog.component.html',
      styleUrls:  ['./service-group-extension-wizard-dialog.component.css']
    })
    export class ServiceGroupExtensionWizardDialogComponent  {
      dialogForm: FormGroup;
    
      dummyXML: string ="<!-- Custom element is mandatory by OASIS SMP schema.\n    Replace following element with your XML structure. -->\n<ext:example xmlns:ext=\"http://my.namespace.eu\">my mandatory content</ext:example>"
    
      elements: any[] = [
        {name:'ExtensionID', description:'An identifier for the Extension assigned by the creator of the extension.', type:'text'},
        {name:'ExtensionName', description:'A name for the Extension assigned by the creator of the extension.', type:'text'},
        {name:'ExtensionAgencyID', description:'An agency that maintains one or more Extensions.', type:'text'},
        {name:'ExtensionAgencyName', description:'The name of the agency that maintains the Extension.', type:'text'},
        {name:'ExtensionAgencyURI', description:'A URI for the Agency that maintains the Extension.', type:'url'},
        {name:'ExtensionVersionID', description:'The version of the Extension.', type:'text'},
        {name:'ExtensionURI', description:'A URI for the Extension.', type:'url'},
        {name:'ExtensionReasonCode', description:'A code for reason the Extension is being included.', type:'text'},
        {name:'ExtensionReason', description:'A description of the reason for the Extension.', type:'text'},
        ];
    
      constructor(public dialogRef: MatDialogRef<ServiceGroupExtensionWizardDialogComponent>,
                  private dialogFormBuilder: FormBuilder) {
    
        this.dialogForm = this.dialogFormBuilder.group({ });
    
        let arrayLength = this.elements.length;
        for (var i = 0; i < arrayLength; i++) {
          this.dialogForm.addControl(this.elements[i].name, new FormControl(''));
        }
      }
    
      getExtensionXML(){
        var xmlString = '<Extension xmlns="http://docs.oasis-open.org/bdxr/ns/SMP/2016/05">'
        let arrayLength = this.elements.length;
        for (var i = 0; i < arrayLength; i++) {
          let str = this.dialogForm.get(this.elements[i].name).value;
          if (str && 0 !== str.length) {
            xmlString = xmlString + '\n    <'+this.elements[i].name+'>' + this.xmlSpecialChars(str) + '</'+this.elements[i].name+'>';
          }
        }
        xmlString = xmlString+ '\n' +this.dummyXML+ '\n</Extension>'
    
        return xmlString;
      }
    
      xmlSpecialChars(unsafe) {
        return unsafe
          .replace(/&/g, "&amp;")
          .replace(/</g, "&lt;")
          .replace(/>/g, "&gt;")
          .replace(/"/g, "&quot;");
      }
    
    
    
    }