Example #1
0
        private ProcessesType MapToProcessEntity(ProcessTypeViewModel model, string requestId = "")
        {
            try
            {
                var entity = new ProcessesType();
                entity.Id          = model.Id ?? string.Empty;
                entity.ProcessStep = model.ProcessStep ?? string.Empty;
                entity.ProcessType = model.ProcessType ?? string.Empty;
                entity.Channel     = model.Channel ?? string.Empty;

                return(entity);
            }
            catch (Exception ex)
            {
                _logger.LogError($"RequestId: {requestId} - ToEntity Service Exception: {ex}");
                throw new ResponseException($"RequestId: {requestId} - ToEntity Service Exception: {ex}");
            }
        }
Example #2
0
        private ProcessTypeViewModel MapToProcessViewModel(ProcessesType entity, string requestId = "")
        {
            try
            {
                var model = new ProcessTypeViewModel();
                model.Id          = entity.Id ?? string.Empty;
                model.ProcessStep = entity.ProcessStep ?? string.Empty;
                model.ProcessType = entity.ProcessType ?? string.Empty;
                model.Channel     = entity.Channel ?? string.Empty;

                return(model);
            }
            catch (Exception ex)
            {
                _logger.LogError($"RequestId: {requestId} - ToViewModel Service Exception: {ex}");
                throw new ResponseException($"RequestId: {requestId} - ToViewModel Service Exception: {ex}");
            }
        }
 private ProcessTypeViewModel MapToProcessViewModel(ProcessesType entity, string requestId = "")
 {
     try
     {
         return(new ProcessTypeViewModel
         {
             Id = entity.Id ?? string.Empty,
             ProcessStep = entity.ProcessStep ?? string.Empty,
             ProcessType = entity.ProcessType ?? string.Empty,
             Channel = entity.Channel ?? string.Empty,
             RoleId = entity.RoleId ?? String.Empty,
             RoleName = entity.RoleName ?? String.Empty
         });
     }
     catch (Exception ex)
     {
         _logger.LogError($"RequestId: {requestId} - ToViewModel Service Exception: {ex}");
         throw new ResponseException($"RequestId: {requestId} - ToViewModel Service Exception: {ex}");
     }
 }
        private List <ProcessesType> getProcesses(string requestId = "")
        {
            _logger.LogInformation($"RequestId: {requestId} - SetupService_getProcesses called.");

            List <ProcessesType> processesTypes = new List <ProcessesType>();
            //Start Process
            ProcessesType startProcess = new ProcessesType();

            startProcess.ProcessType = "Base";
            startProcess.Channel     = "None";
            startProcess.ProcessStep = "Start Process";
            startProcess.RoleId      = "";
            startProcess.RoleName    = "";
            processesTypes.Add(startProcess);

            //Customer Descision
            ProcessesType customerDecision = new ProcessesType();

            customerDecision.Channel     = "Customer Decision";
            customerDecision.ProcessType = "customerDecisionTab";
            customerDecision.ProcessStep = "Customer Decision";
            customerDecision.RoleId      = "";
            customerDecision.RoleName    = "";
            processesTypes.Add(customerDecision);

            //Formal Proposal
            ProcessesType formalProposal = new ProcessesType();

            formalProposal.Channel     = "Formal Proposal";
            formalProposal.ProcessType = "proposalStatusTab";
            formalProposal.ProcessStep = "Formal Proposal";
            formalProposal.RoleId      = "";
            formalProposal.RoleName    = "";
            processesTypes.Add(formalProposal);

            return(processesTypes);
        }
Example #5
0
        private List <ProcessesType> getProcesses(string requestId = "")
        {
            _logger.LogInformation($"RequestId: {requestId} - SetupService_getProcesses called.");

            List <ProcessesType> processesTypes = new List <ProcessesType>();
            //Start Process
            ProcessesType startProcess = new ProcessesType();

            startProcess.ProcessType = "Base";
            startProcess.Channel     = "None";
            startProcess.ProcessStep = "Start Process";
            processesTypes.Add(startProcess);
            //New Opportunity
            ProcessesType newOpportunity = new ProcessesType();

            newOpportunity.ProcessType = "Base";
            newOpportunity.Channel     = "None";
            newOpportunity.ProcessStep = "New Opportunity";
            processesTypes.Add(newOpportunity);
            //Customer Descision
            ProcessesType customerDecision = new ProcessesType();

            customerDecision.Channel     = "CustomerDecision";
            customerDecision.ProcessType = "customerDecisionTab";
            customerDecision.ProcessStep = "Draft Proposal";
            processesTypes.Add(customerDecision);
            //Formal Proposal
            ProcessesType formalProposal = new ProcessesType();

            formalProposal.Channel     = "Formal Proposal";
            formalProposal.ProcessType = "ProposalStatusTab";
            formalProposal.ProcessStep = "None";
            processesTypes.Add(formalProposal);
            //Credit Check
            ProcessesType creditCheck = new ProcessesType();

            creditCheck.Channel     = "Credit Check";
            creditCheck.ProcessType = "CheckListTab";
            creditCheck.ProcessStep = "CreditCheck";
            processesTypes.Add(creditCheck);
            //Compliance
            ProcessesType compliance = new ProcessesType();

            compliance.Channel     = "Compliance";
            compliance.ProcessType = "CheckListTab";
            compliance.ProcessStep = "Compliance";
            processesTypes.Add(compliance);
            //UnderWriting
            ProcessesType underWriting = new ProcessesType();

            underWriting.Channel     = "Underwriting";
            underWriting.ProcessType = "CheckListTab";
            underWriting.ProcessStep = "Underwriting";
            processesTypes.Add(underWriting);
            //Risk Assessment
            ProcessesType riskAssessment = new ProcessesType();

            riskAssessment.Channel     = "Risk Assessment";
            riskAssessment.ProcessType = "CheckListTab";
            riskAssessment.ProcessStep = "RiskAssessment";
            processesTypes.Add(riskAssessment);

            return(processesTypes);
        }
 /// <summary>
 /// Process the processes.
 /// </summary>
 /// <param name="processesType">
 /// The processes type.
 /// </param>
 /// <param name="beans">
 /// The sdmxObjects.
 /// </param>
 /// <param name="urns">
 /// The URN.
 /// </param>
 /// <exception cref="MaintainableObjectException">
 /// Duplicate URN
 /// </exception>
 protected void ProcessProcesses(ProcessesType processesType, ISdmxObjects beans, ISet<Uri> urns)
 {
     if (processesType != null && processesType.Process != null)
     {
         /* foreach */
         foreach (ProcessType currentType14 in processesType.Process)
         {
             try
             {
                 this.AddIfNotDuplicateURN(beans, urns, new ProcessObjectCore(currentType14));
             }
             catch (Exception th15)
             {
                 throw new MaintainableObjectException(
                     th15,
                     SdmxStructureType.GetFromEnum(SdmxStructureEnumType.Process),
                     currentType14.agencyID,
                     currentType14.id,
                     currentType14.version);
             }
         }
     }
 }
        /// <summary>
        /// Build success response.
        /// </summary>
        /// <param name="buildFrom">
        /// The source sdmx objects.
        /// </param>
        /// <param name="warningMessage">
        /// The warning message.
        /// </param>
        /// <returns>
        /// The <see cref="RegistryInterface"/>.
        /// </returns>
        public RegistryInterface BuildSuccessResponse(ISdmxObjects buildFrom, string warningMessage)
        {

            // PLEASE NOTE. The code here is slightly different than in Java.
            // That is because of the differences between Java XmlBeans and .NET Linq2Xsd generated classes.
            // Please consult GIT log before making any changes.
            var responseType = new RegistryInterface();

            RegistryInterfaceType regInterface = responseType.Content;
            HeaderType headerType;

            if (buildFrom.Header != null)
            {
                headerType = this._headerXmlsBuilder.Build(buildFrom.Header);
                regInterface.Header = headerType;
            }
            else
            {
                headerType = new HeaderType();
                regInterface.Header = headerType;
                V2Helper.SetHeader(headerType, buildFrom);
            }
            
            var returnType = new QueryStructureResponseType();
            regInterface.QueryStructureResponse = returnType;

            var statusMessage = new StatusMessageType();
            returnType.StatusMessage = statusMessage;

            if (!string.IsNullOrWhiteSpace(warningMessage) || !ObjectUtil.ValidCollection(buildFrom.GetAllMaintainables()))
            {
                statusMessage.status = StatusTypeConstants.Warning;
                var tt = new TextType();
                statusMessage.MessageText.Add(tt);
                tt.TypedValue = !string.IsNullOrWhiteSpace(warningMessage)
                                    ? warningMessage
                                    : "No Structures Match The Query Parameters";
            }
            else
            {
                statusMessage.status = StatusTypeConstants.Success;
            }

            ISet<ICategorisationObject> categorisations = buildFrom.Categorisations;

            // GET CATEGORY SCHEMES
            if (buildFrom.CategorySchemes.Count > 0)
            {
                var catSchemesType = new CategorySchemesType();
                returnType.CategorySchemes = catSchemesType;

                /* foreach */
                foreach (ICategorySchemeObject cateogrySchemeBean in buildFrom.CategorySchemes)
                {
                    ISet<ICategorisationObject> matchingCategorisations = new HashSet<ICategorisationObject>();

                    /* foreach */
                    foreach (ICategorisationObject cat in categorisations)
                    {
                        if (MaintainableUtil<ICategorySchemeObject>.Match(cateogrySchemeBean, cat.CategoryReference))
                        {
                            matchingCategorisations.Add(cat);
                        }
                    }

                    catSchemesType.CategoryScheme.Add(
                        this._categorySchemeXmlBuilder.Build(cateogrySchemeBean, categorisations));
                }
            }

            // GET CODELISTS
            if (buildFrom.Codelists.Count > 0)
            {
                CodeListsType codeListsType = new CodeListsType();
                returnType.CodeLists = codeListsType;
                //CodeListsType codeListsType = returnType.CodeLists;

                /* foreach */
                foreach (ICodelistObject codelistBean in buildFrom.Codelists)
                {
                    codeListsType.CodeList.Add(this._codelistXmlBuilder.Build(codelistBean));
                }
            }

            // CONCEPT SCHEMES
            if (buildFrom.ConceptSchemes.Count > 0)
            {
                ConceptsType conceptsType =  new ConceptsType();
                returnType.Concepts = conceptsType;

                /* foreach */
                foreach (IConceptSchemeObject conceptSchemeBean in buildFrom.ConceptSchemes)
                {
                    conceptsType.ConceptScheme.Add(this._conceptSchemeXmlBuilder.Build(conceptSchemeBean));
                }
            }

            // DATAFLOWS
            if (buildFrom.Dataflows.Count > 0)
            {
                
                var dataflowsType =  new DataflowsType();
                returnType.Dataflows = dataflowsType;

                /* foreach */
                foreach (IDataflowObject currentBean in buildFrom.Dataflows)
                {
                    dataflowsType.Dataflow.Add(
                        this._dataflowXmlBuilder.Build(currentBean, GetCategorisations(currentBean, categorisations)));
                }
            }

            // HIERARCIC CODELIST
            if (buildFrom.HierarchicalCodelists.Count > 0)
            {
                HierarchicalCodelistsType hierarchicalCodelistsType = new HierarchicalCodelistsType();
                returnType.HierarchicalCodelists = hierarchicalCodelistsType;

                /* foreach */
                foreach (IHierarchicalCodelistObject currentBean0 in buildFrom.HierarchicalCodelists)
                {
                    hierarchicalCodelistsType.HierarchicalCodelist.Add(
                        this._hierarchicalCodelistXmlBuilder.Build(currentBean0));
                }
            }

            // KEY FAMILY
            if (buildFrom.DataStructures.Count > 0)
            {
                var keyFamiliesType = new KeyFamiliesType();
                returnType.KeyFamilies = keyFamiliesType;

                /* foreach */
                foreach (IDataStructureObject currentBean1 in buildFrom.DataStructures)
                {
                    keyFamiliesType.KeyFamily.Add(this._dataStructureXmlBuilder.Build(currentBean1));
                }
            }

            // METADATA FLOW
            if (buildFrom.Metadataflows.Count > 0)
            {
                var metadataflowsType = new MetadataflowsType();
                returnType.Metadataflows = metadataflowsType;

                /* foreach */
                foreach (IMetadataFlow currentBean2 in buildFrom.Metadataflows)
                {
                    metadataflowsType.Metadataflow.Add(
                        this._metadataflowXmlBuilder.Build(
                            currentBean2, GetCategorisations(currentBean2, categorisations)));
                }
            }

            // METADATA STRUCTURE
            if (buildFrom.MetadataStructures.Count > 0)
            {
                var msdsType = new MetadataStructureDefinitionsType();
                returnType.MetadataStructureDefinitions = msdsType;

                /* foreach */
                foreach (IMetadataStructureDefinitionObject currentBean3 in buildFrom.MetadataStructures)
                {
                    msdsType.MetadataStructureDefinition.Add(
                        this._metadataStructureDefinitionXmlsBuilder.Build(currentBean3));
                }
            }

            OrganisationSchemesType orgSchemesType = null;

            // AGENCY SCHEMES
            if (buildFrom.AgenciesSchemes.Count > 0)
            {
                orgSchemesType = new OrganisationSchemesType();
                returnType.OrganisationSchemes = orgSchemesType;

                /* foreach */
                foreach (IAgencyScheme currentBean4 in buildFrom.AgenciesSchemes)
                {
                    orgSchemesType.OrganisationScheme.Add(this._organisationSchemeXmlBuilder.Build(currentBean4));
                }
            }

            // DATA CONSUMER SCHEMES
            if (buildFrom.DataConsumerSchemes.Count > 0)
            {
                if (orgSchemesType == null)
                {
                    orgSchemesType = new OrganisationSchemesType();
                    returnType.OrganisationSchemes = orgSchemesType;
                }

                /* foreach */
                foreach (IDataConsumerScheme currentBean5 in buildFrom.DataConsumerSchemes)
                {
                    orgSchemesType.OrganisationScheme.Add(this._organisationSchemeXmlBuilder.Build(currentBean5));
                }
            }

            // DATA PROVIDER SCHEMES
            if (buildFrom.DataProviderSchemes.Count > 0)
            {
                if (orgSchemesType == null)
                {
                    orgSchemesType = new OrganisationSchemesType();
                    returnType.OrganisationSchemes = orgSchemesType;
                }

                /* foreach */
                foreach (IDataProviderScheme currentBean6 in buildFrom.DataProviderSchemes)
                {
                    orgSchemesType.OrganisationScheme.Add(this._organisationSchemeXmlBuilder.Build(currentBean6));
                }
            }

            // PROCESSES
            if (buildFrom.Processes.Count > 0)
            {
                var processesType = new ProcessesType();
                returnType.Processes = processesType;

                /* foreach */
                foreach (IProcessObject currentBean7 in buildFrom.Processes)
                {
                    processesType.Process.Add(this._processXmlBuilder.Build(currentBean7));
                }
            }

            // STRUCTURE SETS
            if (buildFrom.StructureSets.Count > 0)
            {
                var structureSetsType = new StructureSetsType();
                returnType.StructureSets = structureSetsType;

                /* foreach */
                foreach (IStructureSetObject currentBean8 in buildFrom.StructureSets)
                {
                    structureSetsType.StructureSet.Add(this._structureSetXmlBuilder.Build(currentBean8));
                }
            }

            // REPORTING TAXONOMIES
            if (buildFrom.ReportingTaxonomys.Count > 0)
            {
                var reportingTaxonomiesType = new ReportingTaxonomiesType();
                returnType.ReportingTaxonomies = reportingTaxonomiesType;

                /* foreach */
                foreach (IReportingTaxonomyObject currentBean9 in buildFrom.ReportingTaxonomys)
                {
                    reportingTaxonomiesType.ReportingTaxonomy.Add(this._reportingTaxonomyXmlBuilder.Build(currentBean9));
                }
            }

            if (buildFrom.AttachmentConstraints.Count > 0)
            {
                throw new SdmxNotImplementedException(
                    ExceptionCode.Unsupported, "Attachment Constraint at SMDX v2.0 - please use SDMX v2.1");
            }

            if (buildFrom.ContentConstraintObjects.Count > 0)
            {
                throw new SdmxNotImplementedException(
                    ExceptionCode.Unsupported, "Content Constraint at SMDX v2.0 - please use SDMX v2.1");
            }

            return responseType;
        }
 /// <summary>
 /// Creates Processes based on the input Processes
 /// </summary>
 /// <param name="processes">
 /// - if null will not add anything to the beans container
 /// </param>
 /// <param name="beans">
 /// - to add concepts to
 /// </param>
 private void ProcessProcesses(ProcessesType processes, ISdmxObjects beans)
 {
     var urns = new HashSet<Uri>();
     if (processes != null && processes.Process != null)
     {
         /* foreach */
         foreach (ProcessType currentType in processes.Process)
         {
             try
             {
                 this.AddIfNotDuplicateURN(beans, urns, new ProcessObjectCore(currentType));
             }
             catch (Exception th)
             {
                 throw new MaintainableObjectException(
                     th, 
                     SdmxStructureType.GetFromEnum(SdmxStructureEnumType.Process), 
                     currentType.agencyID, 
                     currentType.id, 
                     currentType.version);
             }
         }
     }
 }