Beispiel #1
0
        /// <summary>
        /// Gets the mutable objects V20.
        /// </summary>
        /// <param name="input">
        /// The input.
        /// </param>
        /// <param name="dataflowPrincipal">
        /// The dataflow principal.
        /// </param>
        /// <returns>
        /// The <see cref="IMutableObjects"/>.
        /// </returns>
        /// <exception cref="SdmxSemmanticException">
        /// Operation not accepted
        /// </exception>
        private IMutableObjects GetMutableObjectsV21(IReadableDataLocation input, DataflowPrincipal dataflowPrincipal)
        {
            IQueryWorkspace queryWorkspace = this._manager.ParseQueries(input);

            if (queryWorkspace == null)
            {
                // throw new SdmxSemmanticException(Properties.Resources.MissingRegistryOrInvalidSoap);
                throw new SdmxSemmanticException(Resources.ErrorOperationNotAccepted);
            }

            IMutableObjects mutableObjects = dataflowPrincipal != null
                                                 ? this._authStructureSearchManager.GetMaintainables(queryWorkspace.ComplexStructureQuery, dataflowPrincipal.AllowedDataflows.ToList())
                                                 : this._structureSearchManager.GetMaintainables(queryWorkspace.ComplexStructureQuery);

            return(mutableObjects);
        }
Beispiel #2
0
        private void Main_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (e.CloseReason != CloseReason.UserClosing)
            {
                return;
            }

            foreach (TabPage tabPage in mainTabControl.TabPages)
            {
                mainTabControl.SelectedTab = tabPage;
                IQueryWorkspace workspace         = getQueryWorkspaceReference(tabPage);
                var             isWorkspaceClosed = workspace.Close(this, false);
                if (!isWorkspaceClosed)
                {
                    e.Cancel = true;
                    break;
                }
            }
        }
Beispiel #3
0
        /// <summary>
        /// build SdmxParsingObject from IQueryWorkspace
        /// </summary>
        /// <param name="workspace">return object of CommonApi.parse request</param>
        /// <returns>SdmxParsingObject</returns>
        public static SdmxParsingObject Parse(IQueryWorkspace workspace)
        {
            try
            {
                if (workspace == null)
                {
                    throw new SdmxException(typeof(SdmxParsingObject), FlyExceptionObject.FlyExceptionTypeEnum.ParsingQueryError);
                }

                SdmxParsingObject parsedObject = null;

                if (workspace.ComplexStructureQuery != null)
                {
                    IComplexStructureReferenceObject workspaceRef = workspace.ComplexStructureQuery.StructureReference as IComplexStructureReferenceObject;

                    parsedObject = new SdmxParsingObject(workspaceRef.ReferencedStructureType)
                    {
                        MaintainableId    = workspaceRef.Id == null ? null : workspaceRef.Id.SearchParameter,
                        AgencyId          = workspaceRef.AgencyId == null ? null : workspaceRef.AgencyId.SearchParameter,
                        _version          = workspaceRef.VersionReference == null ? null : workspaceRef.VersionReference.Version,
                        QueryDetail       = (StructureQueryDetailEnumType)workspace.ComplexStructureQuery.StructureQueryMetadata.StructureQueryDetail.EnumType,
                        References        = workspace.ComplexStructureQuery.StructureQueryMetadata.StructureReferenceDetail.EnumType,
                        SpecificReference = workspace.ComplexStructureQuery.StructureQueryMetadata.ReferenceSpecificStructures != null?workspace.ComplexStructureQuery.StructureQueryMetadata.ReferenceSpecificStructures.ToList() : null,
                    };
                    if (workspaceRef.ReferencedStructureType.EnumType == SdmxStructureEnumType.CodeList)
                    {
                        //Constrin 2.1

                        /*
                         * <query:CodeWhere>
                         * <query:Annotation>
                         * <query:Title>DataflowConstrain</query:Title>
                         * <query:Text>ISTAT+DF+1.0+Concept</query:Text>
                         * </query:Annotation>
                         * </query:CodeWhere>
                         * */
                        try
                        {
                            if (workspaceRef.ChildReference != null && workspaceRef.ChildReference.AnnotationReference != null)
                            {
                                string Title = workspaceRef.ChildReference.AnnotationReference.TitleReference.SearchParameter;
                                string Text  = workspaceRef.ChildReference.AnnotationReference.TextReference.SearchParameter;
                                if (!string.IsNullOrEmpty(Title) && XDocument.Parse(Title).Root.Value.Trim() == "DataflowConstrain" && !string.IsNullOrEmpty(Text))
                                {
                                    string[] DataflowConstrin = XDocument.Parse(Text).Root.Value.Trim().Split('+');
                                    if (DataflowConstrin.Length == 4)
                                    {
                                        parsedObject.ConstrainDataFlowAgency  = DataflowConstrin[0];
                                        parsedObject.ConstrainDataFlow        = DataflowConstrin[1];
                                        parsedObject.ConstrainDataFlowVersion = DataflowConstrin[2];
                                        parsedObject.ConstrainConcept         = DataflowConstrin[3];
                                    }
                                }
                            }
                        }
                        catch (Exception)
                        {//Non metto la Costrain
                        }
                    }
                }
                else if (workspace.SimpleStructureQueries != null && workspace.SimpleStructureQueries.Count > 0)
                {
                    IStructureReference workspaceRef = workspace.SimpleStructureQueries[0] as IStructureReference;
                    parsedObject = new SdmxParsingObject(workspaceRef.MaintainableStructureEnumType.EnumType)
                    {
                        MaintainableId         = workspaceRef.MaintainableId,
                        AgencyId               = workspaceRef.AgencyId,
                        _version               = workspaceRef.Version,
                        ResolveReferenceSdmx20 = workspace.ResolveReferences,
                        QueryDetail            = StructureQueryDetailEnumType.Full
                    };

                    if (workspace.SimpleStructureQueries.Count == 2 &&
                        workspaceRef.MaintainableStructureEnumType.EnumType == SdmxStructureEnumType.CodeList &&
                        workspace.SimpleStructureQueries[1] is ConstrainableStructureReference &&
                        ((ConstrainableStructureReference)workspace.SimpleStructureQueries[1]).MaintainableStructureEnumType.EnumType == SdmxStructureEnumType.Dataflow &&
                        ((ConstrainableStructureReference)workspace.SimpleStructureQueries[1]).ConstraintObject != null)
                    {
                        ConstrainableStructureReference workspaceDF = workspace.SimpleStructureQueries[1] as ConstrainableStructureReference;
                        Org.Sdmx.Resources.SdmxMl.Schemas.V20.common.ConstraintType ct = ((ConstrainableStructureReference)workspace.SimpleStructureQueries[1]).ConstraintObject;
                        parsedObject.ConstrainDataFlow        = workspaceDF.MaintainableId;
                        parsedObject.ConstrainDataFlowAgency  = workspaceDF.AgencyId;
                        parsedObject.ConstrainDataFlowVersion = workspaceDF.Version;
                        if (ct.CubeRegion != null && ct.CubeRegion.Count > 0 && ct.CubeRegion[0].Member != null && ct.CubeRegion[0].Member.Count > 0 && !string.IsNullOrEmpty(workspaceRef.MaintainableId))
                        {
                            parsedObject.ConstrainConcept = ct.CubeRegion[0].Member[0].ComponentRef;
                            if (ct.CubeRegion[0].Member.Count > 1)
                            {
                                parsedObject.ContrainConceptREF = new Dictionary <string, IList <MemberValueType> >();
                                for (int i = 1; i < ct.CubeRegion[0].Member.Count; i++)
                                {
                                    parsedObject.ContrainConceptREF[ct.CubeRegion[0].Member[i].ComponentRef] = ct.CubeRegion[0].Member[i].MemberValue;
                                }
                            }
                        }
                        parsedObject.OtherRegistry = new List <ISdmxParsingObject>()
                        {
                            new SdmxParsingObject(workspaceDF.MaintainableStructureEnumType.EnumType)
                            {
                                MaintainableId         = workspaceDF.MaintainableId,
                                AgencyId               = workspaceDF.AgencyId,
                                _version               = workspaceDF.Version,
                                ResolveReferenceSdmx20 = workspace.ResolveReferences,
                                QueryDetail            = StructureQueryDetailEnumType.Full
                            }
                        };
                    }
                    else if (workspace.SimpleStructureQueries.Count > 1)
                    {
                        parsedObject.OtherRegistry = new List <ISdmxParsingObject>();

                        for (int i = 1; i < workspace.SimpleStructureQueries.Count; i++)
                        {
                            workspaceRef = workspace.SimpleStructureQueries[i] as IStructureReference;
                            parsedObject.OtherRegistry.Add(new SdmxParsingObject(workspaceRef.MaintainableStructureEnumType.EnumType)
                            {
                                MaintainableId         = workspaceRef.MaintainableId,
                                AgencyId               = workspaceRef.AgencyId,
                                _version               = workspaceRef.Version,
                                ResolveReferenceSdmx20 = workspace.ResolveReferences,
                                QueryDetail            = StructureQueryDetailEnumType.Full
                            });
                        }
                    }
                }

                if (parsedObject == null)
                {
                    throw new SdmxException(typeof(SdmxParsingObject), FlyExceptionObject.FlyExceptionTypeEnum.StructureNotFound);
                }

                return(parsedObject);
            }
            catch (SdmxException) { throw; }
            catch (Exception ex)
            {
                throw new SdmxException(typeof(SdmxParsingObject), FlyExceptionObject.FlyExceptionTypeEnum.ParsingQueryError, ex);
            }
        }