async onValidate()

in Source/SiteCommon/Web/pages-gallery/data-movement.ts [72:152]


    async onValidate(): Promise<boolean> {
        this.onInvalidate();

        switch (this.dataMovement) {
            case this.dataMovementType.Informatica:
                this.MS.DataStore.addToDataStore('InformaticaUsername', this.username, DataStoreType.Private);
                this.MS.DataStore.addToDataStore('InformaticaPassword', this.password, DataStoreType.Private);

                if (this.informaticaAccount === 'New') {
                    if (this.password !== this.passwordConfirmation) {
                        this.MS.ErrorService.set(this.MS.Translate.DATA_MOVEMENT_INFORMATICA_PASSWORD_MATCH);
                        break;
                    }

                    this.MS.DataStore.addToDataStore('InformaticaCompany', this.company, DataStoreType.Private);
                    this.MS.DataStore.addToDataStore('InformaticaNameFirst', this.nameFirst, DataStoreType.Private);
                    this.MS.DataStore.addToDataStore('InformaticaNameLast', this.nameLast, DataStoreType.Private);

                    if (await this.MS.HttpService.isExecuteSuccessAsync('Microsoft-RegisterInformaticaAccount')) {
                        this.informaticaAccount = 'Existing';
                        this.isRegistered = true;
                    } else {
                        break;
                    }
                }

                if (await this.MS.HttpService.isExecuteSuccessAsync('Microsoft-VerifyInformaticaCredentials')) {
                    if (this.MS.HttpService.isOnPremise) {
                        let informaticaRuntimeEnvironments: InformaticaRuntimeEnvironment[] = await this.MS.HttpService.getResponseAsync('Microsoft-GetInformaticaAgents');

                        let informaticaAgents: InformaticaAgent[] = [];

                        if (informaticaRuntimeEnvironments && informaticaRuntimeEnvironments.length > 0) {
                            for (let i = 0; i < informaticaRuntimeEnvironments.length; i++) {
                                let informaticaRuntimeEnvironment: InformaticaRuntimeEnvironment = informaticaRuntimeEnvironments[i];
                                if (informaticaRuntimeEnvironment && informaticaRuntimeEnvironment.agents && informaticaRuntimeEnvironment.agents.length > 0) {
                                    for (let j = 0; j < informaticaRuntimeEnvironment.agents.length; j++) {
                                        let informaticaAgent: InformaticaAgent = informaticaRuntimeEnvironment.agents[j];
                                        if (informaticaAgent && informaticaAgent.name !== 'Informatica Cloud Hosted Agent') {
                                            informaticaAgents.push(informaticaAgent);
                                        }
                                    }
                                }
                            }
                        }

                        this.informaticaAgents = informaticaAgents;

                        if (this.informaticaAgents && this.informaticaAgents.length > 0) {
                            this.informaticaAgentId = this.informaticaAgents[0].id;
                            this.setValidated();
                        } else {
                            this.informaticaAgentLocation = await this.MS.HttpService.getResponseAsync('Microsoft-GetInformaticaAgentLocation');
                        }
                    } else {
                        this.MS.DataStore.addToDataStore('InformaticaAgentName', 'Informatica Cloud Hosted Agent', DataStoreType.Public);
                        this.setValidated();
                    }
                }

                break;
            case this.dataMovementType.Scribe:
                this.MS.DataStore.addToDataStore('ScribeUsername', this.username, DataStoreType.Private);
                this.MS.DataStore.addToDataStore('ScribePassword', this.password, DataStoreType.Private);

                this.scribeOrganizations = await this.MS.HttpService.getResponseAsync('Microsoft-GetScribeOrganizations');
                if (this.scribeOrganizations && this.scribeOrganizations.length > 0) {
                    this.scribeOrganizationId = this.scribeOrganizations[0].id;
                    if (this.MS.HttpService.isOnPremise) {
                        this.OnScribeOrganizationChanged();
                    } else {
                        this.MS.DataStore.addToDataStore('ScribeAgentName', 'Cloud Agent', DataStoreType.Public);
                        this.setValidated();
                    }
                }

                break;
        }

        return this.isValidated;
    }