Ejemplo n.º 1
0
 /// <summary>Default Constructor</summary>
 public NaveNodrizaInstance(ONContext onContext)
     : base(onContext, "NaveNodriza", "Clas_1347649273856884_Alias")
 {
     Oid = new NaveNodrizaOid();
     Nombre_NaveNodrizaAttr = ONString.Null;
     StateObjAttrTemp = null;
 }
Ejemplo n.º 2
0
 /// <summary>Default Constructor</summary>
 public PasajeroInstance(ONContext onContext)
     : base(onContext, "Pasajero", "Clas_1348178542592658_Alias")
 {
     Oid = new PasajeroOid();
     NombreAttr = null;
     PasajeroAeronaveRoleTemp = null;
     StateObjAttrTemp = null;
 }
Ejemplo n.º 3
0
 /// <summary>Default Constructor</summary>
 public RevisionInstance(ONContext onContext)
     : base(onContext, "Revision", "Clas_1348178542592347_Alias")
 {
     Oid = new RevisionOid();
     NombreRevisorAttr = ONString.Null;
     FechaRevisionAttr = ONDate.Null;
     Id_AeronaveAttr = ONString.Null;
     RevisionPasajeroRoleTemp = null;
     StateObjAttrTemp = null;
 }
 /// <summary>Default Constructor</summary>
 public RevisionPasajeroInstance(ONContext onContext)
     : base(onContext, "RevisionPasajero", "Clas_1348178673664478_Alias")
 {
     Oid = new RevisionPasajeroOid();
     RevisionRoleTemp = null;
     RevisionRoleOidTemp = null;
     PasajeroAeronaveRoleTemp = null;
     PasajeroAeronaveRoleOidTemp = null;
     StateObjAttrTemp = null;
 }
Ejemplo n.º 5
0
 /// <summary>Default Constructor</summary>
 public AeronaveInstance(ONContext onContext)
     : base(onContext, "Aeronave", "Clas_1348178411520734_Alias")
 {
     Oid = new AeronaveOid();
     NombreAttr = null;
     MaximoPasajerosAttr = ONInt.Null;
     OrigenAttr = null;
     DestinoAttr = null;
     PasajeroAeronaveRoleTemp = null;
     StateObjAttrTemp = null;
 }
 /// <summary>Default Constructor</summary>
 public PasajeroAeronaveInstance(ONContext onContext)
     : base(onContext, "PasajeroAeronave", "Clas_1348178542592177_Alias")
 {
     Oid = new PasajeroAeronaveOid();
     NombreAeronaveAttr = ONString.Null;
     NombrePasajeroAttr = ONString.Null;
     RevisionPasajeroRoleTemp = null;
     AeronaveRoleTemp = null;
     AeronaveRoleOidTemp = null;
     PasajeroRoleTemp = null;
     PasajeroRoleOidTemp = null;
     StateObjAttrTemp = null;
 }
Ejemplo n.º 7
0
        public bool IsVisible(ONContext onContext)
        {
            char[] lDelimiter = {','};
            string[] lAgents = Visibility.Split(lDelimiter);

            for (int i = 0; i < lAgents.Length; i++)
            {
                if (onContext.LeafActiveAgentFacets.Contains(lAgents[i].Trim()))
                    return true;
            }

            return false;
        }
        /// <summary>
        /// Checks if the horizontal visibility filter must be executed in memory.
        /// In case there are more than one active facet for the connected agent with at least
        /// one not optimizable conjunction, the hole filter must be executed in memory.
        /// </summary>
        protected override bool IsUnableToFilterInData(ONContext onContext)
        {
            StringCollection lActiveFacets = onContext.LeafActiveAgentFacets;

            // Agent facets with empty HV formula
            if (lActiveFacets.Contains("Administrador"))
            {
                InMemory = false;
                return true;
            }

            return mIsUnableToFilterInData;
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Default Constructor
        /// </summary>
        public ONDBData(ONContext onContext)
            : base(onContext, "")
        {
            // Create connection
            if (OnContext == null)
                mSqlConnection = GetConnection();
            else
            {
                if (OnContext.SqlConnection == null)
                    OnContext.SqlConnection = GetConnection();

                mSqlConnection = OnContext.SqlConnection as ONSQLConnection;
            }
            mSqlCommand = null;
        }
Ejemplo n.º 10
0
        /// <summary>
        /// This method recovers an instance with the OID
        /// </summary>
        /// <param name="onContext">Recovers the context of the execution of the service</param>
        /// <param name="linkedTo">List to reach the class to retrieve the related instance</param>
        /// <param name="comparer">Order Criteria that must be followed</param>
        /// <param name="${startRowOid}">OID frontier</param>
        /// <param name="blockSize">Number of instances to be returned</param>
        /// <returns>The instance</returns>
        public override ONCollection FilterInLegacy(ONContext onContext, ONLinkedToList linkedTo, ONOrderCriteria comparer, ONOid startRowOID, int blockSize)
        {
            if (InData)
                return null;

            // Add parameters
            object[] lParameters = new object[2];
            lParameters[0] = onContext;
            lParameters[1] = mOid;
            ONCollection lCollection = ONContext.GetComponent_Collection(mOid.ClassName, onContext);
            ONInstance lInstance = ONContext.InvoqueMethod(ONContext.GetType_LV(mOid.ClassName), "QueryByOid", lParameters) as ONInstance;
            if (lInstance != null)
                lCollection.Add(lInstance);
            return lCollection;
        }
Ejemplo n.º 11
0
        /// <summary>
        /// This method recovers all the population of the database
        /// </summary>
        /// <param name="onContext">Recovers the context of the execution of the service</param>
        /// <param name="linkedTo">List to reach the class to retrieve the related instance</param>
        /// <param name="comparer">Order Criteria that must be followed</param>
        /// <param name="${startRowOid}">OID frontier</param>
        /// <param name="blockSize">Number of instances to be returned</param>
        /// <returns>The population</returns>
        public override ONCollection FilterInLegacy(ONContext onContext, ONLinkedToList linkedTo, ONOrderCriteria comparer, ONOid startRowOID, int blockSize)
        {
            if (InData)
                return null;
            ONLinkedToList lLinkedToList = new ONLinkedToList();
            // Add linkedToList to the new list
            foreach (KeyValuePair<ONPath, ONOid> lDictionaryEntry in linkedTo)
                lLinkedToList.mLinkedToList.Add(lDictionaryEntry.Key, lDictionaryEntry.Value);
            // Add relatedOid to the new list
            if (mRelatedOid != null)
                lLinkedToList.mLinkedToList.Add(ONPath, mRelatedOid);
            // Add parameters
            object[] lParameters = new object[5];
            lParameters[0] = onContext;
            lParameters[1] = linkedTo;
            lParameters[2] = comparer;
            lParameters[3] = startRowOID;
            lParameters[4] = blockSize;

            return ONContext.InvoqueMethod(ONContext.GetType_LV(ClassName), "QueryByRelated", lParameters) as ONCollection;
        }
Ejemplo n.º 12
0
 public new RevisionInstance GetInstance(ONContext onContext)
 {
     return GetInstance(onContext, new ONFilterList());
 }
Ejemplo n.º 13
0
 /// <summary>
 /// Constructor of the specific Data class
 /// </summary>
 /// <param name="onContext">Current context</param>
 public NaveNodrizaData(ONContext onContext)
     : base(onContext, "NaveNodriza")
 {
 }
Ejemplo n.º 14
0
        public static string RetrieveInstances(ONSqlSelect onSql, ONDisplaySet displaySet, ONPath onPath, ONContext onContext)
        {
            string       lAlias    = onSql.CreateAlias(CtesBD.TBL_REVISION, onPath, "Revision");
            ONDisplaySet lSourceDS = null;

            if (displaySet != null)
            {
                lSourceDS = new ONDisplaySet(displaySet);
                displaySet.Clear();
            }
            if (displaySet == null)
            {
                onSql.AddSelect(lAlias + "." + CtesBD.FLD_REVISION_ID_REVISARAERONAVE + ", " + lAlias + "." + CtesBD.FLD_REVISION_ESTADOOBJ + ", " + lAlias + "." + CtesBD.FLD_REVISION_FUM + ", " + lAlias + "." + CtesBD.FLD_REVISION_NOMBREREVISOR + ", " + lAlias + "." + CtesBD.FLD_REVISION_FECHAREVISION + ", " + lAlias + "." + CtesBD.FLD_REVISION_ID_AERONAVE);
            }
            else
            {
                displaySet.Add(new ONDisplaySetItem(CtesBD.FLD_REVISION_ID_REVISARAERONAVE));
                onSql.AddSelect(lAlias + "." + CtesBD.FLD_REVISION_ID_REVISARAERONAVE);

                displaySet.Add(new ONDisplaySetItem(CtesBD.FLD_REVISION_ESTADOOBJ));
                onSql.AddSelect(lAlias + "." + CtesBD.FLD_REVISION_ESTADOOBJ);

                displaySet.Add(new ONDisplaySetItem(CtesBD.FLD_REVISION_FUM));
                onSql.AddSelect(lAlias + "." + CtesBD.FLD_REVISION_FUM);

                displaySet.Add(new ONDisplaySetItem(CtesBD.FLD_REVISION_NOMBREREVISOR));
                onSql.AddSelect(lAlias + "." + CtesBD.FLD_REVISION_NOMBREREVISOR);

                displaySet.Add(new ONDisplaySetItem(CtesBD.FLD_REVISION_FECHAREVISION));
                onSql.AddSelect(lAlias + "." + CtesBD.FLD_REVISION_FECHAREVISION);

                displaySet.Add(new ONDisplaySetItem(CtesBD.FLD_REVISION_ID_AERONAVE));
                onSql.AddSelect(lAlias + "." + CtesBD.FLD_REVISION_ID_AERONAVE);
            }


            // Related attributes
            if (displaySet != null)
            {
                foreach (ONDisplaySetItem lDisplaySetItem in lSourceDS)
                {
                    if ((lDisplaySetItem.Path.IndexOf(".") > 0) && (lDisplaySetItem.InData) && (!lDisplaySetItem.HasHV))
                    {
                        displaySet.Add(lDisplaySetItem);

                        string lPath      = lDisplaySetItem.Path.Substring(0, lDisplaySetItem.Path.LastIndexOf("."));
                        string lFacetName = RevisionInstance.GetTargetClass(onContext, typeof(RevisionInstance), new ONPath(lDisplaySetItem.Path));
                        onSql.AddSelect(AddPath(onSql, JoinType.LeftJoin, lFacetName, new ONPath(lPath), onPath, "", false) + "." + ONInstance.GetFieldNameOfAttribute(typeof(RevisionInstance), new ONPath(lDisplaySetItem.Path)));
                    }
                }
            }
            return(lAlias);
        }
Ejemplo n.º 15
0
        /// <summary>
        /// Treatment of the XML message that has a service request
        /// </summary>
        /// <param name="agentOID">OID of the agent connected to the system</param>
        /// <param name="xmlReader">Variable with the message XML to be treated</param>
        /// <param name="xmlWriter">Variable with the message XML to response</param>
        /// <param name="dtdVersion">Version of the DTD that follows the XML message</param>
        public void XMLRequestService(ref string ticket, ONOid agentOID, XmlTextReader xmlReader, out XmlTextWriter xmlWriter, double dtdVersion, string clientName)
        {
            try
            {
                // Read Response
                string lService = xmlReader.GetAttribute("Service");
                xmlReader.ReadStartElement("Service.Request");

                // Create XMLWriterRequest
                MemoryStream lXMLMemoryStream = new MemoryStream();
                xmlWriter = new XmlTextWriter(lXMLMemoryStream, new UTF8Encoding());

                MemoryStream  lXMLMemoryStreamService = new MemoryStream();
                XmlTextWriter lXmlWriterService       = new XmlTextWriter(lXMLMemoryStreamService, new UTF8Encoding());

                // Set Service Parameters
                object[] lParameters = new object[6];
                lParameters[0] = ticket;
                lParameters[1] = agentOID;
                lParameters[2] = xmlReader;
                lParameters[3] = lXmlWriterService;
                lParameters[4] = dtdVersion;
                lParameters[5] = clientName;

                // Execute
                ONContext.InvoqueMethod(this, typeof(ONServiceXMLAttribute), "<Service>" + lService + "</Service>", lParameters);
                ticket = lParameters[0] as string;

                // Read Request
                xmlReader.ReadEndElement();                 // Service.Request
                xmlReader.ReadEndElement();                 // Request

                // Write Response
                xmlWriter.WriteStartElement("Service.Response");
                xmlWriter.WriteStartElement("Error");
                xmlWriter.WriteAttributeString("Type", "Model");
                xmlWriter.WriteAttributeString("Number", "0");
                if (dtdVersion > 2)
                {
                    xmlWriter.WriteElementString("Error.Message", "");
                    xmlWriter.WriteElementString("Error.Params", "");
                    xmlWriter.WriteElementString("Error.Trace", "");
                }
                xmlWriter.WriteEndElement();                 // Error

                // Write Outbound Arguments
                lXmlWriterService.Flush();
                lXMLMemoryStreamService.Flush();
                lXMLMemoryStreamService.Position = 0;
                xmlWriter.WriteRaw(new StreamReader(lXMLMemoryStreamService).ReadToEnd());

                // Write Response
                xmlWriter.WriteEndElement();                 // Service.Response
            }
            catch (ONException e)
            {
                MemoryStream lXMLMemoryStream = new MemoryStream();
                xmlWriter = new XmlTextWriter(lXMLMemoryStream, new UTF8Encoding());

                // Write Response
                xmlWriter.WriteStartElement("Service.Response");
                CreateXMLError(xmlWriter, e, dtdVersion);
                xmlWriter.WriteEndElement();                 // Service.Response

                return;
            }
            catch (Exception e)
            {
                string       message          = e.Message;
                MemoryStream lXMLMemoryStream = new MemoryStream();
                xmlWriter = new XmlTextWriter(lXMLMemoryStream, new UTF8Encoding());

                // Write Response
                xmlWriter.WriteStartElement("Service.Response");
                xmlWriter.WriteStartElement("Error");
                xmlWriter.WriteAttributeString("Type", "External");
                xmlWriter.WriteAttributeString("Number", "999");
                if (dtdVersion <= 2)
                {
                    xmlWriter.WriteString(e.Message);
                }
                else
                {
                    if (e is ONSystemException)
                    {
                        ArrayList trace = ((ONSystemException)e).mTraceInformation;
                        xmlWriter.WriteElementString("Error.Message", message);
                        xmlWriter.WriteStartElement("Error.Trace");
                        int length = trace.Count;
                        int i      = 0;
                        while (length > 0)
                        {
                            string mensaje = (string)trace[length - 1];
                            xmlWriter.WriteStartElement("Error.TraceItem");
                            xmlWriter.WriteAttributeString("Type", "External");
                            xmlWriter.WriteAttributeString("Number", i.ToString());
                            xmlWriter.WriteStartElement("Error.Message");
                            xmlWriter.WriteString(mensaje);
                            xmlWriter.WriteEndElement(); // Error.Message
                            xmlWriter.WriteElementString("Error.Params", "");
                            xmlWriter.WriteEndElement(); // Error.TraceItem
                            i      += 1;
                            length -= 1;
                        }
                        xmlWriter.WriteEndElement(); // Error.Trace
                    }
                    else
                    {
                        xmlWriter.WriteElementString("Error.Message", message);
                        xmlWriter.WriteElementString("Error.Params", "");
                        xmlWriter.WriteElementString("Error.Trace", "");
                    }
                }

                xmlWriter.WriteEndElement();                 // Error
                xmlWriter.WriteEndElement();                 // Service.Response

                return;
            }
        }
Ejemplo n.º 16
0
        /// <summary>
        /// Adds an instance to the collection in the order that the Order Criteria sets.
        /// </summary>
        /// <param name="instance">Instance to add</param>
        /// <param name="comparer">Order criteria to apply</param>
        /// <param name="onContext">context of the query</param>
        public void AddOrdered(ONInstance instance, ONOrderCriteria comparer, ONContext onContext)
        {
            // Empty lists
            if (Count == 0)
            {
                Add(instance);
                return;
            }

            int i            = 0;
            int j            = 0;
            int lComparation = 0;

            // Clone and clear collection
            ONCollection lList = Clone() as ONCollection;

            this.Clear();

            // Create data component for default comparation
            ONData lData = null;

            if (comparer == null)
            {
                lData = ONContext.GetComponent_Data(ClassName, onContext);
            }

            ONInstance lInstance1 = lList.Array[i];

            while ((i < lList.Count) && (j < 1))
            {
                if (comparer != null)
                {
                    lComparation = comparer.CompareUnion(lInstance1, instance);
                }
                else
                {
                    lComparation = lData.CompareUnionOID(lInstance1, instance);
                }

                if (lComparation < 0)
                {
                    Add(lInstance1);
                    i += 1;
                    if (lList.Count > i)
                    {
                        lInstance1 = lList.Array[i];
                    }
                }
                else if (lComparation > 0)
                {
                    Add(instance);
                    j += 1;
                }
                else
                {
                    Add(lInstance1);
                    Add(instance);
                    i += 1;
                    j += 1;
                }
            }

            AddRange(lList);
            if (j == 0)
            {
                Add(instance);
            }
        }
Ejemplo n.º 17
0
 /// <summary>
 /// Constructor of the specific Data class
 /// </summary>
 /// <param name="onContext">Current context</param>
 public RevisionData(ONContext onContext)
     : base(onContext, "Revision")
 {
 }
Ejemplo n.º 18
0
        public override ONCollection QueryByRelated(ref string ticket, ref ONOid agentOid, XmlReader xmlReader, ONDisplaySet displaySet, out ONOid startRowOID, out int blockSize, double dtdVersion, string clientName)
        {
            ONLinkedToList lLinkedTo = null;
            ONFilterList   lFilters  = new ONFilterList();

            // Read Request
            blockSize = int.Parse(xmlReader.GetAttribute("BlockSize"));
            if (!xmlReader.IsEmptyElement)
            {
                xmlReader.ReadStartElement("Query.Related");
                if (xmlReader.IsStartElement("StartRow"))
                {
                    xmlReader.ReadStartElement("StartRow");
                    startRowOID = XML2ON(xmlReader, dtdVersion);
                    xmlReader.ReadEndElement();                     // StartRow
                }
                else
                {
                    startRowOID = null;
                }

                // Fill relations
                lLinkedTo = GetLinkedTo(xmlReader, dtdVersion);

                // Read Request
                xmlReader.ReadEndElement();                 // Query.Related
            }
            else
            {
                xmlReader.ReadStartElement("Query.Related");
                lLinkedTo   = new ONLinkedToList();
                startRowOID = null;
            }

            // Read Order Criteria
            string lOrderCriteria = "";

            if (xmlReader.IsStartElement("Sort"))
            {
                lOrderCriteria = xmlReader.GetAttribute("Criterium");
                xmlReader.Skip();                 // Sort
            }

            //Read Navigational Filter
            string lNavFilterId    = "";
            ONOid  lSelectedObject = null;

            if (xmlReader.IsStartElement("NavFilt"))
            {
                xmlReader.ReadStartElement("NavFilt");
                if (xmlReader.IsStartElement("NavFilt.SelectedObject"))
                {
                    lNavFilterId = xmlReader.GetAttribute("NavFilterID");
                    xmlReader.ReadStartElement("NavFilt.SelectedObject");
                    string lClassName = xmlReader.GetAttribute("Class");
                    if (lClassName == "")
                    {
                        lClassName = "GlobalTransaction";
                    }
                    object[] lArgs = new object[2];
                    lArgs[0]        = xmlReader;
                    lArgs[1]        = dtdVersion;
                    lSelectedObject = ONContext.InvoqueMethod(ONContext.GetType_XML(lClassName), "XML2ON", lArgs) as ONOid;

                    lArgs    = new Object[1];
                    lArgs[0] = lSelectedObject;

                    lFilters.Add(lNavFilterId, ONContext.GetComponent_NavigationalFilter(lNavFilterId, lArgs) as ONFilter);
                }
                else if (xmlReader.IsStartElement("NavFilt.Argument"))
                {
                    string lClassName = xmlReader.GetAttribute("Class");
                    if (lClassName == "")
                    {
                        lClassName = "GlobalTransaction";
                    }
                    string lServiceName  = xmlReader.GetAttribute("Service");
                    string lArgumentName = xmlReader.GetAttribute("Argument");
                    xmlReader.ReadStartElement("NavFilt.Argument");

                    string lFilterName = lClassName + "_" + lServiceName + "Service_" + lArgumentName + "_NavigationalFilter";
                    if (xmlReader.IsStartElement("Arguments"))
                    {
                        object[] lArgs = new object[3];
                        lArgs[0] = xmlReader;
                        lArgs[1] = dtdVersion;
                        lArgs[2] = lArgumentName;

                        lFilters.Add(lFilterName, ONContext.InvoqueMethod(ONContext.GetComponent_XML(lClassName), typeof(ONNavigationalFilterXMLAttribute), "<Filter>" + lServiceName + "</Filter>", lArgs) as ONFilter);
                    }
                    else
                    {
                        lFilters.Add(lFilterName, ONContext.GetComponent_Filter(lFilterName, null) as ONFilter);
                    }

                    xmlReader.ReadEndElement();                     //NavFilt.Argument
                }
                else if (xmlReader.IsStartElement("NavFilt.ServiceIU"))
                {
                    lNavFilterId = xmlReader.GetAttribute("NavFilterID");
                    xmlReader.ReadStartElement("NavFilt.ServiceIU");

                    if (xmlReader.IsStartElement("Arguments"))
                    {
                        object[] lArgs = new object[2];
                        lArgs[0] = xmlReader;
                        lArgs[1] = dtdVersion;

                        ONServiceInfo lSInfo = new ONServiceInfo("", "", "", "");
                        lSInfo.XML2ON(xmlReader, dtdVersion, false);

                        HybridDictionary lArguments = new HybridDictionary(true);
                        foreach (ONArgumentInfo lArgument in lSInfo.mArgumentList.Values)
                        {
                            lArguments.Add(lArgument.Name, lArgument.Value);
                        }
                        lFilters.Add(lNavFilterId, ONContext.GetComponent_NavigationalFilter(lNavFilterId, new object[1] {
                            lArguments
                        }) as ONFilter);
                    }
                    else
                    {
                        lFilters.Add(lNavFilterId, ONContext.GetComponent_NavigationalFilter(lNavFilterId, null) as ONFilter);
                    }

                    xmlReader.ReadEndElement();                     //NavFilt.ServiceIU
                }
                else if (xmlReader.IsStartElement("NavFilt.Variable"))
                {
                    string lClassName        = xmlReader.GetAttribute("Class");
                    string lSourceFilterName = xmlReader.GetAttribute("Filter");
                    string lVariableName     = xmlReader.GetAttribute("Variable");

                    xmlReader.ReadStartElement("NavFilt.Variable");
                    string lFilterName = lClassName + "_" + lSourceFilterName + "Filter_" + lVariableName + "_NavigationalFilter";
                    if (xmlReader.IsStartElement("Filter.Variables"))
                    {
                        object[] lArgs = new object[3];
                        lArgs[0] = xmlReader;
                        lArgs[1] = dtdVersion;
                        lArgs[2] = lVariableName;

                        lFilters.Add(lFilterName, ONContext.InvoqueMethod(ONContext.GetComponent_XML(lClassName), typeof(ONNavigationalFilterXMLAttribute), "<Filter>" + lSourceFilterName + "</Filter>", lArgs) as ONFilter);
                    }
                    else
                    {
                        lFilters.Add(lFilterName, ONContext.GetComponent_Filter(lFilterName, null) as ONFilter);
                    }

                    xmlReader.ReadEndElement();                     //NavFilt.Variable
                }
            }

            // Create Context
            ONContext lOnContext = new ONContext();

            lOnContext.OidAgent = agentOid;

            foreach (ONFilter lFilter in lFilters.Values)
            {
                lFilter.CheckFilterVariables(lOnContext);
            }

            // Execute
            lOnContext.CalculateQueryInstancesNumber = true;
            AeronaveQuery lQuery      = new AeronaveQuery(lOnContext);
            ONCollection  lCollection = lQuery.QueryByFilter(lLinkedTo, lFilters, displaySet, lOrderCriteria, startRowOID, blockSize);

            ticket = lOnContext.GetTicket(dtdVersion, clientName);

            return(lCollection);
        }
Ejemplo n.º 19
0
        public override ONCollection QueryByRelated(ref string ticket, ref ONOid agentOid, XmlReader xmlReader, ONDisplaySet displaySet, out ONOid startRowOID, out int blockSize, double dtdVersion, string clientName)
        {
            ONLinkedToList lLinkedTo = null;
            ONFilterList lFilters = new ONFilterList();

            // Read Request
            blockSize = int.Parse(xmlReader.GetAttribute("BlockSize"));
            if (!xmlReader.IsEmptyElement)
            {
                xmlReader.ReadStartElement("Query.Related");
                if (xmlReader.IsStartElement("StartRow"))
                {
                    xmlReader.ReadStartElement("StartRow");
                    startRowOID = XML2ON(xmlReader, dtdVersion);
                    xmlReader.ReadEndElement(); // StartRow
                }
                else
                    startRowOID = null;

                // Fill relations
                lLinkedTo = GetLinkedTo(xmlReader, dtdVersion);

                // Read Request
                xmlReader.ReadEndElement(); // Query.Related
            }
            else
            {
                xmlReader.ReadStartElement("Query.Related");
                lLinkedTo = new ONLinkedToList();
                startRowOID = null;
            }

            // Read Order Criteria
            string lOrderCriteria = "";
            if (xmlReader.IsStartElement("Sort"))
            {
                lOrderCriteria = xmlReader.GetAttribute("Criterium");
                xmlReader.Skip(); // Sort
            }

            //Read Navigational Filter
            string lNavFilterId = "";
            ONOid lSelectedObject = null;
            if (xmlReader.IsStartElement("NavFilt"))
            {
                xmlReader.ReadStartElement("NavFilt");
                if (xmlReader.IsStartElement("NavFilt.SelectedObject"))
                {
                        lNavFilterId = xmlReader.GetAttribute("NavFilterID");
                    xmlReader.ReadStartElement("NavFilt.SelectedObject");
                    string lClassName = xmlReader.GetAttribute("Class");
                    if (lClassName == "")
                        lClassName = "GlobalTransaction";
                    object[] lArgs = new object[2];
                    lArgs[0] = xmlReader;
                    lArgs[1] = dtdVersion;
                    lSelectedObject = ONContext.InvoqueMethod(ONContext.GetType_XML(lClassName), "XML2ON", lArgs) as ONOid;

                    lArgs = new Object[1];
                    lArgs[0] = lSelectedObject;

                    lFilters.Add(lNavFilterId, ONContext.GetComponent_NavigationalFilter(lNavFilterId, lArgs) as ONFilter);
                }
                else if (xmlReader.IsStartElement("NavFilt.Argument"))
                {
                    string lClassName = xmlReader.GetAttribute("Class");
                    if (lClassName == "")
                        lClassName = "GlobalTransaction";
                    string lServiceName = xmlReader.GetAttribute("Service");
                    string lArgumentName = xmlReader.GetAttribute("Argument");
                    xmlReader.ReadStartElement("NavFilt.Argument");

                    string lFilterName = lClassName + "_" + lServiceName + "Service_" + lArgumentName + "_NavigationalFilter";
                    if (xmlReader.IsStartElement("Arguments"))
                    {
                        object[] lArgs = new object[3];
                        lArgs[0] = xmlReader;
                        lArgs[1] = dtdVersion;
                        lArgs[2] = lArgumentName;

                        lFilters.Add(lFilterName, ONContext.InvoqueMethod(ONContext.GetComponent_XML(lClassName), typeof(ONNavigationalFilterXMLAttribute), "<Filter>" + lServiceName + "</Filter>", lArgs) as ONFilter);
                    }
                    else
                    {
                        lFilters.Add(lFilterName, ONContext.GetComponent_Filter(lFilterName, null) as ONFilter);

                    }

                    xmlReader.ReadEndElement(); //NavFilt.Argument
                }
                else if (xmlReader.IsStartElement("NavFilt.ServiceIU"))
                {
                    lNavFilterId = xmlReader.GetAttribute("NavFilterID");
                    xmlReader.ReadStartElement("NavFilt.ServiceIU");

                    if (xmlReader.IsStartElement("Arguments"))
                    {
                        object[] lArgs = new object[2];
                        lArgs[0] = xmlReader;
                        lArgs[1] = dtdVersion;

                        ONServiceInfo lSInfo = new ONServiceInfo("", "", "", "");
                        lSInfo.XML2ON(xmlReader, dtdVersion, false);

                        HybridDictionary lArguments = new HybridDictionary(true);
                        foreach (ONArgumentInfo lArgument in lSInfo.mArgumentList.Values)
                        {
                            lArguments.Add(lArgument.Name, lArgument.Value);
                        }
                        lFilters.Add(lNavFilterId, ONContext.GetComponent_NavigationalFilter(lNavFilterId, new object[1] { lArguments }) as ONFilter);
                    }
                    else
                        lFilters.Add(lNavFilterId, ONContext.GetComponent_NavigationalFilter(lNavFilterId, null) as ONFilter);

                    xmlReader.ReadEndElement(); //NavFilt.ServiceIU
                }
                else if (xmlReader.IsStartElement("NavFilt.Variable"))
                {
                    string lClassName = xmlReader.GetAttribute("Class");
                    string lSourceFilterName = xmlReader.GetAttribute("Filter");
                    string lVariableName = xmlReader.GetAttribute("Variable");

                    xmlReader.ReadStartElement("NavFilt.Variable");
                    string lFilterName = lClassName + "_" + lSourceFilterName + "Filter_" + lVariableName + "_NavigationalFilter";
                    if (xmlReader.IsStartElement("Filter.Variables"))
                    {
                        object[] lArgs = new object[3];
                        lArgs[0] = xmlReader;
                        lArgs[1] = dtdVersion;
                        lArgs[2] = lVariableName;

                        lFilters.Add(lFilterName, ONContext.InvoqueMethod(ONContext.GetComponent_XML(lClassName), typeof(ONNavigationalFilterXMLAttribute), "<Filter>" + lSourceFilterName + "</Filter>", lArgs) as ONFilter);
                    }
                    else
                    {
                        lFilters.Add(lFilterName, ONContext.GetComponent_Filter(lFilterName, null) as ONFilter);

                    }

                    xmlReader.ReadEndElement(); //NavFilt.Variable
                }
            }

            // Create Context
            ONContext lOnContext = new ONContext();
            lOnContext.OidAgent = agentOid;

            foreach (ONFilter lFilter in lFilters.Values)
            {
                lFilter.CheckFilterVariables(lOnContext);
            }

            // Execute
            lOnContext.CalculateQueryInstancesNumber = true;
            PasajeroQuery lQuery = new PasajeroQuery(lOnContext);
            ONCollection lCollection = lQuery.QueryByFilter(lLinkedTo, lFilters, displaySet, lOrderCriteria, startRowOID, blockSize);
            ticket = lOnContext.GetTicket(dtdVersion, clientName);

            return lCollection;
        }
Ejemplo n.º 20
0
 /// <summary>Load the data retrieved from the Data Base to components of the application</summary>
 /// <param name="onContext">This parameter has the current context</param>
 /// <param name="oid">OID of the instance whose text attribute value is wanted to be loaded</param>
 public static ONText LoadTextOrigen(ONContext onContext, AeronaveOid oid)
 {
     return(AeronaveData.LoadTextOrigen(onContext, oid));
 }
Ejemplo n.º 21
0
 /// <summary>Load the data retrieved from the Data Base to components of the application</summary>
 /// <param name="onContext">This parameter has the current context</param>
 /// <param name="oid">OID of the instance whose text attribute value is wanted to be loaded</param>
 public static ONText LoadTextDestino(ONContext onContext, AeronaveOid oid)
 {
     return(AeronaveData.LoadTextDestino(onContext, oid));
 }
Ejemplo n.º 22
0
 public virtual string InhRetrieveInstances(ONSqlSelect onSql, ONDisplaySet displaySet, ONPath onPath, ONContext onContext)
 {
     return("");
 }
Ejemplo n.º 23
0
        /// <summary>
        /// Retrieve all the instances of a determinate class that fulfil a determinate formula of searching
        /// </summary>
        /// <param name="linkedTo">List to reach the class to retrieve the related instance</param>
        /// <param name="filters">Formula to search concrete instances</param>
        /// <param name="comparer">Order Criteria that must be followed by the query</param>
        /// <param name="startRowOID">OID frontier</param>
        /// <param name="blockSize">Number of instances to be returned</param>
        public override ONCollection ExecuteQuery(ONLinkedToList linkedTo, ONFilterList filters, ONDisplaySet displaySet, ONOrderCriteria comparer, ONOid startRowOid, int blockSize)
        {
            try
            {
                ONCollection lInstances    = null;
                Type         lTypeInstance = ONContext.GetType_Instance(ClassName);
                Type         lTypeQuery    = ONContext.GetType_Query(ClassName);

                // Initialize the list of related queries
                if (linkedTo == null)
                {
                    linkedTo = new ONLinkedToList();
                }

                // Initialize the filter list
                if (filters == null)
                {
                    filters = new ONFilterList();
                }

                ONLinkedToList lLinkedToLegacy = new ONLinkedToList();
                ONLinkedToList lLinkedToLocal  = new ONLinkedToList();
                ONLinkedToList lLinkedToMixed  = new ONLinkedToList();

                #region Treatment of LinkedTo
                foreach (KeyValuePair <ONPath, ONOid> lDictionaryEntry in linkedTo)
                {
                    ONPath lPath = lDictionaryEntry.Key as ONPath;
                    ONOid  lOid  = lDictionaryEntry.Value as ONOid;

                    ONPath lInversePath             = new ONPath(ONInstance.InversePath(lTypeInstance, lPath));
                    Type   lTypeTargetClassInstance = ONContext.GetType_Instance(ONInstance.GetTargetClass(OnContext, lTypeInstance, lPath));
                    if ((lInversePath.Count == 0) || (!ONInstance.IsVisible(lTypeTargetClassInstance, lInversePath, OnContext)))
                    {
                        return(ONContext.GetComponent_Collection(ClassName, OnContext));
                    }

                    bool   lexistLV = false;
                    ONData lData    = ONContext.GetComponent_Data(InhGetTargetClassName(lPath), OnContext);

                    if (lData.GetType().BaseType == typeof(ONLVData))
                    {
                        if (!lOid.Exist(OnContext, null))
                        {
                            return(ONContext.GetComponent_Collection(ClassName, OnContext));
                        }
                    }

                    foreach (string lRole in lInversePath.Roles)
                    {
                        lData = ONContext.GetComponent_Data(lData.InhGetTargetClassName(new ONPath(lRole)), OnContext);
                        if (lData.GetType().BaseType == typeof(ONLVData))
                        {
                            lexistLV = true;
                        }
                    }
                    if (!lexistLV)
                    {
                        lLinkedToLocal.mLinkedToList.Add(lPath, lOid);
                    }
                    else
                    {
                        lLinkedToMixed.mLinkedToList.Add(lPath, lOid);
                    }
                }
                #endregion

                #region displaySet
                if (!filters.PreloadRelatedAttributes)
                {
                    displaySet = null;
                }
                #endregion displaySet

                #region No link item
                if ((linkedTo.mLinkedToList.Count == 0) || (lLinkedToMixed.mLinkedToList.Count > 0))
                {
                    if ((GetType().BaseType != typeof(ONLVData)) || (filters.InData))
                    {
                        lInstances = SolveQuery(new ONLinkedToList(), filters, displaySet, comparer, startRowOid, blockSize);
                    }
                }
                #endregion

                #region Local Link
                if (lLinkedToLocal.mLinkedToList.Count > 0)
                {
                    ONCollection lInstancesAux = SolveQuery(lLinkedToLocal, filters, displaySet, comparer, startRowOid, blockSize);
                    if (lInstances != null)
                    {
                        lInstances.Intersection(lInstancesAux);
                    }
                    else
                    {
                        lInstances = lInstancesAux;
                    }
                }
                #endregion

                #region Hybrid Link
                if (lLinkedToMixed.mLinkedToList.Count > 0)
                {
                    ONCollection lInstancesAux = null;

                    foreach (KeyValuePair <ONPath, ONOid> lDictionaryEntry in lLinkedToMixed)
                    {
                        ONPath lPath = lDictionaryEntry.Key as ONPath;
                        ONOid  lOid  = lDictionaryEntry.Value as ONOid;

                        if (lPath.Roles.Count == 1)
                        {
                            ONLinkedToList lLinked = new ONLinkedToList();
                            lLinked[lPath] = lOid;
                            ONCollection lInstanceColl = SolveQuery(lLinked, filters, displaySet, comparer, startRowOid, blockSize);
                            if (lInstances != null)
                            {
                                lInstances.Intersection(lInstanceColl);
                            }
                            else
                            {
                                lInstances = lInstanceColl;
                            }
                            continue;
                        }

                        #region Optimized Path
                        ONLinkedToList linkedToOptimized    = new ONLinkedToList();
                        ONPath         lInversePath         = new ONPath(ONInstance.InversePath(lTypeInstance, lPath));
                        ONPath         lOptimizedRole       = new ONPath(lInversePath.RemoveHead() as string);
                        Type           lTypeInstanceDestiny = ONContext.GetType_Instance(InhGetTargetClassName(lPath));

                        bool   lBeginIsLegacy = (ONInstance.IsLegacy(lTypeInstanceDestiny, lOptimizedRole));
                        bool   lEnterLoop     = true;
                        ONData lData          = ONContext.GetComponent_Data(InhGetTargetClassName(lPath), OnContext);
                        if (lData.GetType().BaseType != typeof(ONLVData))
                        {
                            if (ONContext.GetType_Data(lData.InhGetTargetClassName(lOptimizedRole)).BaseType == typeof(ONLVData))
                            {
                                lEnterLoop = false;
                            }
                        }

                        lPath.RemoveTail();
                        if (lEnterLoop)
                        {
                            while (lInversePath.Roles.Count > 0)
                            {
                                lData = ONContext.GetComponent_Data(InhGetTargetClassName(lPath), OnContext);
                                if ((!lBeginIsLegacy) && (ONContext.GetType_Data(lData.InhGetTargetClassName(new ONPath(lInversePath.Roles[0]))).BaseType == typeof(ONLVData)))
                                {
                                    break;
                                }
                                if ((lBeginIsLegacy) && (ONContext.GetType_Data(lData.InhGetTargetClassName(new ONPath(lInversePath.Roles[0]))).BaseType != typeof(ONLVData)))
                                {
                                    break;
                                }

                                lOptimizedRole.Roles.Add(lInversePath.RemoveHead());
                                lPath.RemoveTail();
                            }
                        }

                        linkedToOptimized[ONInstance.InversePath(lTypeInstanceDestiny, lOptimizedRole)] = lOid;
                        if ((lPath.Count > 0) || (lBeginIsLegacy))
                        {
                            // It is not the last role or it is leged
                            lInstancesAux = ONContext.GetComponent_Data(InhGetTargetClassName(lPath), OnContext).ExecuteQuery(linkedToOptimized, null, null, comparer, startRowOid, blockSize);
                        }
                        else
                        {
                            // It is the last role and it is local
                            lInstancesAux = ONContext.GetComponent_Data(InhGetTargetClassName(lPath), OnContext).ExecuteQuery(linkedToOptimized, null, displaySet, comparer, startRowOid, blockSize);
                        }
                        #endregion

                        #region Rest of the path
                        lInstancesAux = lInstancesAux[lInversePath] as ONCollection;
                        #endregion

                        if (lInstances != null)
                        {
                            lInstances.Intersection(lInstancesAux);
                        }
                        else
                        {
                            lInstances = lInstancesAux;
                        }
                    }
                }
                #endregion

                return(lInstances);
            }
            catch (Exception e)
            {
                string ltraceItem = "Method: SolveQuery, Component: ONDBData";
                if (e is ONSystemException)
                {
                    ONSystemException lException = e as ONSystemException;
                    lException.addTraceInformation(ltraceItem);
                    throw lException;
                }
                throw new ONSystemException(e, ltraceItem);
            }
        }
Ejemplo n.º 24
0
 /// <summary>Default Constructor</summary>
 public NaveNodrizaInstance(ONContext onContext) : base(onContext, "NaveNodriza", "Clas_1347649273856884_Alias")
 {
     Oid = new NaveNodrizaOid();
     Nombre_NaveNodrizaAttr = ONString.Null;
     StateObjAttrTemp       = null;
 }
Ejemplo n.º 25
0
 public new NaveNodrizaInstance GetInstance(ONContext onContext, ONFilterList onFilterList)
 {
     return(InhGetInstance(onContext, onFilterList) as NaveNodrizaInstance);
 }
Ejemplo n.º 26
0
        public ONCollection QueryByFilter_LMD(ref string ticket, ref ONOid agentOid, XmlReader xmlReader, ONDisplaySet displaySet, out ONOid startRowOID, out int blockSize, double dtdVersion, string clientName)
        {
            ONLinkedToList lLinkedTo = null;
            ONFilterList   lFilters  = new ONFilterList();

            // Read Request
            blockSize = int.Parse(xmlReader.GetAttribute("BlockSize"));
            if (!xmlReader.IsEmptyElement)
            {
                xmlReader.ReadStartElement("Query.Filter");
                if (xmlReader.IsStartElement("StartRow"))
                {
                    xmlReader.ReadStartElement("StartRow");
                    startRowOID = XML2ON(xmlReader, dtdVersion);
                    xmlReader.ReadEndElement();                     // StartRow
                }
                else
                {
                    startRowOID = null;
                }

                // Fill relations
                lLinkedTo = GetLinkedTo(xmlReader, dtdVersion);

                // Fill filter variables
                lFilters["LMD"] = GetFilter_LMD(xmlReader, dtdVersion);

                // Read Request
                xmlReader.ReadEndElement();                 // Query.Filter
            }
            else
            {
                xmlReader.ReadStartElement("Query.Filter");
                lLinkedTo   = new ONLinkedToList();
                startRowOID = null;
            }

            // Read Order Criteria
            string lOrderCriteria = "";

            if (xmlReader.IsStartElement("Sort"))
            {
                lOrderCriteria = xmlReader.GetAttribute("Criterium");
                xmlReader.Skip();                 // Sort
            }

            //Read Filter Navigation
            if (xmlReader.IsStartElement("NavFilt"))
            {
                xmlReader.Skip();
            }

            // Create Context
            ONContext lOnContext = new ONContext();

            lOnContext.OidAgent = agentOid;

            // Execute
            lOnContext.CalculateQueryInstancesNumber = true;
            AeronaveQuery lQuery      = new AeronaveQuery(lOnContext);
            ONCollection  lCollection = lQuery.QueryByFilter(lLinkedTo, lFilters, displaySet, lOrderCriteria, startRowOID, blockSize);

            ticket = lOnContext.GetTicket(dtdVersion, clientName);

            return(lCollection);
        }
Ejemplo n.º 27
0
        public ONCollection QueryByFilter_LMD(ref string ticket, ref ONOid agentOid, XmlReader xmlReader, ONDisplaySet displaySet, out ONOid startRowOID, out int blockSize, double dtdVersion, string clientName)
        {
            ONLinkedToList lLinkedTo = null;
            ONFilterList lFilters = new ONFilterList();

            // Read Request
            blockSize = int.Parse(xmlReader.GetAttribute("BlockSize"));
            if (!xmlReader.IsEmptyElement)
            {
                xmlReader.ReadStartElement("Query.Filter");
                if (xmlReader.IsStartElement("StartRow"))
                {
                    xmlReader.ReadStartElement("StartRow");
                    startRowOID = XML2ON(xmlReader, dtdVersion);
                    xmlReader.ReadEndElement(); // StartRow
                }
                else
                    startRowOID = null;

                // Fill relations
                lLinkedTo = GetLinkedTo(xmlReader, dtdVersion);

                // Fill filter variables
                lFilters["LMD"] = GetFilter_LMD(xmlReader, dtdVersion);

                // Read Request
                xmlReader.ReadEndElement(); // Query.Filter
            }
            else
            {
                xmlReader.ReadStartElement("Query.Filter");
                lLinkedTo = new ONLinkedToList();
                startRowOID = null;
            }

            // Read Order Criteria
            string lOrderCriteria = "";
            if (xmlReader.IsStartElement("Sort"))
            {
                lOrderCriteria = xmlReader.GetAttribute("Criterium");
                xmlReader.Skip(); // Sort
            }

            //Read Filter Navigation
            if (xmlReader.IsStartElement("NavFilt"))
                xmlReader.Skip();

            // Create Context
            ONContext lOnContext = new ONContext();
            lOnContext.OidAgent = agentOid;

            // Execute
            lOnContext.CalculateQueryInstancesNumber = true;
            PasajeroQuery lQuery = new PasajeroQuery(lOnContext);
            ONCollection lCollection = lQuery.QueryByFilter(lLinkedTo, lFilters, displaySet, lOrderCriteria, startRowOID, blockSize);
            ticket = lOnContext.GetTicket(dtdVersion, clientName);

            return lCollection;
        }
Ejemplo n.º 28
0
 /// <summary>
 /// Checks if the attributes of a determinate class are visible according to the agent connected
 /// </summary>
 /// <param name="typeInstance">Type fo the class to check the visibility</param>
 /// <param name="attributeVisibility">Attribute to be checked</param>
 /// <param name="onContext">Request context </param>
 public static bool IsVisibleInv(Type typeInstance, string attributeVisibility, ONContext onContext)
 {
     return(IsVisibleInv(typeInstance, new ONPath(attributeVisibility), onContext));
 }
Ejemplo n.º 29
0
 /// <summary>Constructor</summary>
 /// <param name="onContext">This parameter has the current context</param>
 public GlobalTransactionData(ONContext onContext) : base(onContext, "")
 {
 }
Ejemplo n.º 30
0
 public new AeronaveInstance GetInstance(ONContext onContext)
 {
     return GetInstance(onContext, new ONFilterList());
 }
Ejemplo n.º 31
0
 /// <summary>
 /// Check Horizontal Visibility of the filter variables and arguments (in Navigational filters)
 /// </summary>
 /// <param name="onContext">Context to obtain the instance and connected agent</param>
 public virtual void CheckFilterVariables(ONContext onContext)
 {
 }
Ejemplo n.º 32
0
 protected override ONInstance InhGetInstance(ONContext onContext)
 {
     return InhGetInstance(onContext, new ONFilterList());
 }
Ejemplo n.º 33
0
        /// <summary>This method adds to the SQL statement any path that appears in a formula</summary>
        /// <param name="onSql">This parameter has the current SQL statement</param>
        /// <param name="joinType">This parameter has the type of join</param>
        /// <param name="facet">First class, the beginning of the path</param>
        /// <param name="onPath">Path to add to SQL statement</param>
        /// <param name="processedOnPath">Path pocessed until the call of this method</param>
        /// <param name="initialClass">Domain of the object valued argument, object valued filter variables or AGENT when it should be necessary</param>
        /// <param name="forceLastAlias">Create almost the last alias in the sql</param>
        /// <param name="isLinkedTo">The alias belongs to a role in a linked To element</param>
        public static string AddPath(ONSqlSelect onSql, JoinType joinType, string facet, ONPath onPath, ONPath processedOnPath, string initialClass, bool forceLastAlias, bool isLinkedTo)
        {
            // initialClass is used for Object-valued arguments, object-valued filter variables, agent instance, ...
            ONPath lProcessedOnPath = new ONPath(processedOnPath);
            ONPath lOnPath          = new ONPath(onPath);
            bool   lOnPathExist     = true;

            object[] lParameters = new object[8];

            if (initialClass != "")
            {
                string lRol = lOnPath.RemoveHead();
                lProcessedOnPath += lRol;
                // Solve path with initialPath
                lParameters[0] = onSql;
                lParameters[1] = joinType;
                lParameters[2] = facet;
                lParameters[3] = lOnPath;
                lParameters[4] = lProcessedOnPath;
                lParameters[5] = "";
                lParameters[6] = forceLastAlias;
                lParameters[7] = isLinkedTo;

                return(ONContext.InvoqueMethod(ONContext.GetType_Data(initialClass), "AddPath", lParameters) as string);
            }

            // Search max solved path
            ONPath lMaxSolvedPath       = new ONPath(onPath);
            string lMaxSolvedPathDomain = facet;

            while ((lMaxSolvedPath.Count > 0) && (onSql.GetAlias(lMaxSolvedPathDomain, lProcessedOnPath + lMaxSolvedPath, isLinkedTo) == ""))
            {
                lMaxSolvedPath.RemoveTail();
                lMaxSolvedPathDomain = GetTargetClassName(lMaxSolvedPath);
            }
            if (lMaxSolvedPath.Count > 0)
            {
                lProcessedOnPath += lMaxSolvedPath;
                for (int i = 0; i < lMaxSolvedPath.Count; i++)
                {
                    lOnPath.RemoveHead();
                }

                lParameters[0] = onSql;
                lParameters[1] = joinType;
                lParameters[2] = facet;
                lParameters[3] = lOnPath;
                lParameters[4] = lProcessedOnPath;
                lParameters[5] = "";
                lParameters[6] = forceLastAlias;
                lParameters[7] = isLinkedTo;

                return(ONContext.InvoqueMethod(ONContext.GetType_Data(lMaxSolvedPathDomain), "AddPath", lParameters) as string);
            }

            // Create inheritance path
            if ((onPath == null) || (onPath.Count == 0))
            {
                if (forceLastAlias)
                {
                    return(RevisionFacetAddSql(joinType, onSql, processedOnPath, forceLastAlias, isLinkedTo));
                }

                if ((processedOnPath == null) || (processedOnPath.Count == 0))
                {
                    return(onSql.CreateAlias(joinType, "", CtesBD.TBL_REVISION, null, "Revision", false, isLinkedTo));
                }
                else
                {
                    return(onSql.CreateAlias(joinType, "", CtesBD.TBL_REVISION, processedOnPath, "Revision", false, isLinkedTo));
                }
            }

            // Calculate processed path
            string lRole = lOnPath.RemoveHead() as string;

            lProcessedOnPath += lRole;

            // Search Path
            if (lOnPath.Count == 0)
            {
                string lAlias = onSql.GetAlias(facet, lProcessedOnPath, isLinkedTo);
                if ((lAlias != "") && (!forceLastAlias))
                {
                    return(lAlias);
                }
                else
                {
                    lOnPathExist = false;
                }
            }
            else
            {
                string lTargetClass = GetTargetClassName(new ONPath(lRole));

                // Agent & OV Argument Control
                if ((lTargetClass == "") && (initialClass != ""))
                {
                    lTargetClass = initialClass;
                }

                string lAlias = onSql.GetAlias(lTargetClass, lProcessedOnPath, isLinkedTo);
                if (lAlias == "")
                {
                    lOnPathExist = false;
                }
            }

            // Create path
            if (string.Compare(lRole, "RevisionPasajero", true) == 0)
            {
                if (lOnPathExist)
                {
                    return(RevisionPasajeroData.AddPath(onSql, joinType, facet, lOnPath, lProcessedOnPath, "", forceLastAlias, isLinkedTo));
                }
                else
                {
                    return(RevisionPasajeroRoleAddSql(onSql, joinType, facet, lOnPath, processedOnPath, lRole, forceLastAlias, isLinkedTo));
                }
            }

            initialClass = "Revision";

            // Solve path with initialPath
            lParameters[0] = onSql;
            lParameters[1] = joinType;
            lParameters[2] = facet;
            lParameters[3] = lOnPath;
            lParameters[4] = lProcessedOnPath;
            lParameters[5] = "";
            lParameters[6] = forceLastAlias;
            lParameters[7] = isLinkedTo;

            return(ONContext.InvoqueMethod(ONContext.GetType_Data(initialClass), "AddPath", lParameters) as string);
        }
Ejemplo n.º 34
0
        /// <summary>This method adds to the SQL statement any path that appears in a formula</summary>
        /// <param name="onSql">This parameter has the current SQL statement</param>
        /// <param name="joinType">This parameter has the type of join</param>
        /// <param name="facet">First class, the beginning of the path</param>
        /// <param name="onPath">Path to add to SQL statement</param>
        /// <param name="processedOnPath">Path pocessed until the call of this method</param>
        /// <param name="initialClass">Domain of the object valued argument, object valued filter variables or AGENT when it should be necessary</param>
        /// <param name="forceLastAlias">Create almost the last alias in the sql</param>
        public static string AddPath(ONSqlSelect onSql, JoinType joinType, string facet, ONPath onPath, ONPath processedOnPath, string initialClass, bool forceLastAlias)
        {
            // initialClass is used for Object-valued arguments, object-valued filter variables, agent instance, ...
            ONPath lProcessedOnPath = new ONPath(processedOnPath);
            ONPath lOnPath          = new ONPath(onPath);

            // Calculate processed path
            string lRole = lOnPath.RemoveHead() as string;

            lProcessedOnPath += lRole;

            // Search Path
            if (lOnPath.Count == 0)
            {
                string lAlias = onSql.GetAlias(facet, lProcessedOnPath);
                if ((lAlias != "") && (!forceLastAlias))
                {
                    return(lAlias);
                }
            }
            // Create path
            if (initialClass == "")             // Simple paths
            {
                if (string.Compare(lRole, "NaveNodriza", true) == 0)
                {
                    return(NaveNodrizaData.AddPath(onSql, joinType, facet, lOnPath, lProcessedOnPath, "", forceLastAlias));
                }
                if (string.Compare(lRole, "Aeronave", true) == 0)
                {
                    return(AeronaveData.AddPath(onSql, joinType, facet, lOnPath, lProcessedOnPath, "", forceLastAlias));
                }
                if (string.Compare(lRole, "Pasajero", true) == 0)
                {
                    return(PasajeroData.AddPath(onSql, joinType, facet, lOnPath, lProcessedOnPath, "", forceLastAlias));
                }
                if (string.Compare(lRole, "PasajeroAeronave", true) == 0)
                {
                    return(PasajeroAeronaveData.AddPath(onSql, joinType, facet, lOnPath, lProcessedOnPath, "", forceLastAlias));
                }
                if (string.Compare(lRole, "Revision", true) == 0)
                {
                    return(RevisionData.AddPath(onSql, joinType, facet, lOnPath, lProcessedOnPath, "", forceLastAlias));
                }
                if (string.Compare(lRole, "RevisionPasajero", true) == 0)
                {
                    return(RevisionPasajeroData.AddPath(onSql, joinType, facet, lOnPath, lProcessedOnPath, "", forceLastAlias));
                }
                if (string.Compare(lRole, "Administrador", true) == 0)
                {
                    return(AdministradorData.AddPath(onSql, joinType, facet, lOnPath, lProcessedOnPath, "", forceLastAlias));
                }
            }

            // Solve path with initialPath
            object[] lParameters = new object[6];
            lParameters[0] = onSql;
            lParameters[1] = facet;
            lParameters[2] = lOnPath;
            lParameters[3] = lProcessedOnPath;
            lParameters[4] = "";
            lParameters[5] = forceLastAlias;

            return(ONContext.InvoqueMethod(ONContext.GetType_Data(initialClass), "AddPath", lParameters) as string);
        }
Ejemplo n.º 35
0
        public void LoadRelated(ONContext onContext, ONDisplaySet displaySet, object[] columns, int index, ONInstance instance)
        {
            // Related attributes
            for (; index < displaySet.ElementsInData; index++)
            {
                ONDisplaySetItem lDSItem = displaySet[index];
                string lTypeName = ONInstance.GetTypeOfAttribute(instance.GetType(), new ONPath(lDSItem.Path));

                instance.RelatedValues.Add(lDSItem.Path, ONDBData.GetBasicTypeFromDB(lTypeName, columns[index]));
            }
        }
 public AdministradorCollection(ONContext onContext)
     : base(onContext, "Administrador", false)
 {
 }
Ejemplo n.º 37
0
        /// <summary>
        /// Treatment of the XML message that has a query request
        /// </summary>
        /// <param name="agentOID">OID of the agent connected to the system</param>
        /// <param name="xmlReader">Variable with the message XML to be treated</param>
        /// <param name="xmlWriter">Variable with the message XML to response</param>
        /// <param name="dtdVersion">Version of the DTD that follows the XML message</param>
        public void XMLRequestQuery(ref string ticket, ONOid agentOID, XmlTextReader xmlReader, out XmlTextWriter xmlWriter, double dtdVersion, string clientName)
        {
            try
            {
                // Read Request
                ONDisplaySet lDisplaySet;
                using (ONContext lOnContext = new ONContext())
                {
                    lOnContext.OidAgent = agentOID;
                    lDisplaySet         = new ONDisplaySet(ClassName, xmlReader.GetAttribute("DisplaySet"), lOnContext.LeafActiveAgentFacets);
                }
                ONDisplaySet lDSRequested = new ONDisplaySet(lDisplaySet);
                xmlReader.ReadStartElement("Query.Request");

                // Create XMLWriterRequest
                MemoryStream lXMLMemoryStream = new MemoryStream();
                xmlWriter = new XmlTextWriter(lXMLMemoryStream, new UTF8Encoding());

                // Write Response
                xmlWriter.WriteStartElement("Query.Response");

                // Get start row & block size
                ONCollection lCollection  = null;
                ONOid        lStartRowOID = null;
                int          lBlockSize   = 1;

                // Execute
                if (xmlReader.IsStartElement("Query.Instance"))                 // QueryByOID
                {
                    // Read Request
                    xmlReader.ReadStartElement("Query.Instance");
                    if (xmlReader.IsStartElement(ONXml.XMLTAG_ALTERNATEKEY))
                    {
                        lCollection = QueryByAlternateKey(ref ticket, ref agentOID, xmlReader, lDisplaySet, dtdVersion, clientName);
                    }
                    else
                    {
                        lCollection = QueryByOid(ref ticket, ref agentOID, xmlReader, lDisplaySet, dtdVersion, clientName);
                    }
                }
                else if (xmlReader.IsStartElement("Query.Related"))                 // QueryByRelated
                {
                    lCollection = QueryByRelated(ref ticket, ref agentOID, xmlReader, lDisplaySet, out lStartRowOID, out lBlockSize, dtdVersion, clientName);
                }
                else if (xmlReader.IsStartElement("Query.Filter"))                 // QueryByFilter
                {
                    // Read Request
                    string lFilterName = xmlReader.GetAttribute("Name");

                    object[] ParametersList = new object[8];
                    ParametersList[0] = ticket;
                    ParametersList[1] = agentOID;
                    ParametersList[2] = xmlReader;
                    ParametersList[3] = lDisplaySet;
                    ParametersList[4] = lStartRowOID;
                    ParametersList[5] = lBlockSize;
                    ParametersList[6] = dtdVersion;
                    ParametersList[7] = clientName;
                    // Execute
                    lCollection  = ONContext.InvoqueMethod(this, typeof(ONFilterXMLAttribute), "<Filter>" + lFilterName + "</Filter>", ParametersList) as ONCollection;
                    ticket       = ParametersList[0] as string;
                    agentOID     = ParametersList[1] as ONOid;
                    lStartRowOID = ParametersList[4] as ONOid;
                    lBlockSize   = (int)ParametersList[5];
                }

                // Generate response
                ONQuery2XML(agentOID, xmlWriter, lCollection, lStartRowOID, lBlockSize, lDSRequested, dtdVersion);
                lCollection.Dispose();

                // Read Request
                xmlReader.ReadEndElement();                 // Query.Request

                // Write Response
                xmlWriter.WriteEndElement();                 // Query.Response
            }
            catch (ONException e)
            {
                MemoryStream lXMLMemoryStream = new MemoryStream();
                xmlWriter = new XmlTextWriter(lXMLMemoryStream, new UTF8Encoding());

                // Write Response
                xmlWriter.WriteStartElement("Query.Response");
                CreateXMLError(xmlWriter, e, dtdVersion);
                xmlWriter.WriteEndElement();                 // Query.Response

                return;
            }
            catch (Exception e)
            {
                string message = e.Message;

                MemoryStream lXMLMemoryStream = new MemoryStream();
                xmlWriter = new XmlTextWriter(lXMLMemoryStream, new UTF8Encoding());

                // Write Response
                xmlWriter.WriteStartElement("Query.Response");
                xmlWriter.WriteStartElement("Error");
                xmlWriter.WriteAttributeString("Type", "External");
                xmlWriter.WriteAttributeString("Number", "999");
                if (dtdVersion <= 2)
                {
                    xmlWriter.WriteString(e.Message);
                }
                else
                {
                    if ((e is ONSystemException) || (e.InnerException is ONSystemException))
                    {
                        ONSystemException lException = null;
                        if (e is ONSystemException)
                        {
                            lException = e as ONSystemException;
                        }
                        else
                        {
                            lException = e.InnerException as ONSystemException;
                        }
                        ArrayList trace = lException.mTraceInformation;
                        xmlWriter.WriteElementString("Error.Message", message);
                        xmlWriter.WriteElementString("Error.Params", "");
                        xmlWriter.WriteStartElement("Error.Trace");
                        int length = trace.Count;
                        int i      = 0;
                        while (length > 0)
                        {
                            string mensaje = (string)trace[length - 1];
                            xmlWriter.WriteStartElement("Error.TraceItem");
                            xmlWriter.WriteAttributeString("Type", "External");
                            xmlWriter.WriteAttributeString("Number", i.ToString());
                            xmlWriter.WriteStartElement("Error.Message");
                            xmlWriter.WriteString(mensaje);
                            xmlWriter.WriteEndElement(); // Error.Message
                            xmlWriter.WriteElementString("Error.Params", "");
                            xmlWriter.WriteEndElement(); // Error.TraceItem
                            i      += 1;
                            length -= 1;
                        }
                        xmlWriter.WriteEndElement(); // Error.Trace
                    }
                    else
                    {
                        xmlWriter.WriteElementString("Error.Message", message);
                        xmlWriter.WriteElementString("Error.Params", "");
                        xmlWriter.WriteElementString("Error.Trace", "");
                    }
                }

                xmlWriter.WriteEndElement();                 // Error
                xmlWriter.WriteEndElement();                 // Query.Response

                return;
            }
        }
Ejemplo n.º 38
0
        /// <summary>Load the data retrieved from the Data Base to components of the application</summary>
        /// <param name="onContext">This parameter has the current context</param>
        /// <param name="oid">OID of the instance whose text attribute value is wanted to be loaded</param>
        public static ONText LoadTextOrigen(ONContext onContext, AeronaveOid oid)
        {
            ONSqlSelect lOnSql = new ONSqlSelect();

            lOnSql.CreateAlias(CtesBD.TBL_AERONAVE, null, "Aeronave");
            lOnSql.AddSelect(CtesBD.FLD_AERONAVE_ORIGEN);

            FixInstance(lOnSql, null, null, oid);

            // Create Data Component
            AeronaveData lData = new AeronaveData(onContext);

            // Execute query
            ArrayList lSqlParameters;
            ONText lReturn = new ONText((string) lData.ExecuteScalar(lOnSql.GenerateSQL(out lSqlParameters), lSqlParameters));
            return lReturn;
        }
Ejemplo n.º 39
0
 public new RevisionInstance GetInstance(ONContext onContext, ONFilterList onFilterList)
 {
     return InhGetInstance(onContext, onFilterList) as RevisionInstance;
 }
Ejemplo n.º 40
0
        public static string RetrieveInstances(ONSqlSelect onSql, ONDisplaySet displaySet, ONPath onPath, ONContext onContext)
        {
            string lAlias = onSql.CreateAlias(CtesBD.TBL_AERONAVE, onPath, "Aeronave");
            ONDisplaySet lSourceDS = null;
            if(displaySet != null)
            {
                lSourceDS = new ONDisplaySet(displaySet);
                displaySet.Clear();
            }
            if (displaySet == null)
                onSql.AddSelect(lAlias + "." + CtesBD.FLD_AERONAVE_ID_AERONAVE + ", " + lAlias + "." + CtesBD.FLD_AERONAVE_ESTADOOBJ + ", " + lAlias + "." + CtesBD.FLD_AERONAVE_FUM + ", " + lAlias + "." + CtesBD.FLD_AERONAVE_MAXIMOPASAJEROS);
            else
            {
                displaySet.Add(new ONDisplaySetItem(CtesBD.FLD_AERONAVE_ID_AERONAVE));
                onSql.AddSelect(lAlias + "." + CtesBD.FLD_AERONAVE_ID_AERONAVE);

                displaySet.Add(new ONDisplaySetItem(CtesBD.FLD_AERONAVE_ESTADOOBJ));
                onSql.AddSelect(lAlias + "." + CtesBD.FLD_AERONAVE_ESTADOOBJ);

                displaySet.Add(new ONDisplaySetItem(CtesBD.FLD_AERONAVE_FUM));
                onSql.AddSelect(lAlias + "." + CtesBD.FLD_AERONAVE_FUM);

                displaySet.Add(new ONDisplaySetItem(CtesBD.FLD_AERONAVE_MAXIMOPASAJEROS));
                onSql.AddSelect(lAlias + "." + CtesBD.FLD_AERONAVE_MAXIMOPASAJEROS);

                if (lSourceDS.Contains(CtesBD.FLD_AERONAVE_NOMBRE))
                {
                    displaySet.Add(new ONDisplaySetItem(CtesBD.FLD_AERONAVE_NOMBRE));
                    onSql.AddSelect(lAlias + "." + CtesBD.FLD_AERONAVE_NOMBRE);
                }

                if (lSourceDS.Contains(CtesBD.FLD_AERONAVE_ORIGEN))
                {
                    displaySet.Add(new ONDisplaySetItem(CtesBD.FLD_AERONAVE_ORIGEN));
                    onSql.AddSelect(lAlias + "." + CtesBD.FLD_AERONAVE_ORIGEN);
                }

                if (lSourceDS.Contains(CtesBD.FLD_AERONAVE_DESTINO))
                {
                    displaySet.Add(new ONDisplaySetItem(CtesBD.FLD_AERONAVE_DESTINO));
                    onSql.AddSelect(lAlias + "." + CtesBD.FLD_AERONAVE_DESTINO);
                }

            }

            // Related attributes
            if (displaySet != null)
            {
                foreach (ONDisplaySetItem lDisplaySetItem in lSourceDS)
                {
                    if((lDisplaySetItem.Path.IndexOf(".") > 0) && (lDisplaySetItem.InData) && (! lDisplaySetItem.HasHV))
                    {
                        displaySet.Add(lDisplaySetItem);

                        string lPath = lDisplaySetItem.Path.Substring(0, lDisplaySetItem.Path.LastIndexOf("."));
                        string lFacetName = AeronaveInstance.GetTargetClass(onContext, typeof(AeronaveInstance), new ONPath(lDisplaySetItem.Path));
                        onSql.AddSelect(AddPath(onSql, JoinType.LeftJoin, lFacetName, new ONPath(lPath), onPath, "", false) + "." + ONInstance.GetFieldNameOfAttribute(typeof(AeronaveInstance), new ONPath(lDisplaySetItem.Path)));
                    }
                }
            }
            return (lAlias);
        }
Ejemplo n.º 41
0
        /// <summary>
        /// Checks if the attributes of a determinate class are visible according to the agent connected
        /// </summary>
        /// <param name="typeInstance">Type fo the class to check the visibility</param>
        /// <param name="attributeVisibility">Attribute to be checked, it is not owned to the class that is being checked</param>
        /// <param name="onContext">Request context </param>
        public static bool IsVisibleInv(Type typeInstance, ONPath attributeVisibility, ONContext onContext)
        {
            if (attributeVisibility.Count == 0)
            {
                return(true);
            }

            ONPath lAttributeVisibility = new ONPath(attributeVisibility);
            string lRol = lAttributeVisibility.RemoveHead();

            // Attributes
            if (lAttributeVisibility.Count == 0)
            {
                ONAttributeAttribute lAttributeAttribute = ONContext.GetAttributeInProperty(typeInstance, typeof(ONAttributeAttribute), "<Attribute>" + lRol + "</Attribute>") as ONAttributeAttribute;
                if (lAttributeAttribute != null)
                {
                    return(lAttributeAttribute.IsVisible(onContext));
                }
            }

            // Roles
            ONRoleAttribute lRoleAttribute = ONContext.GetAttributeInProperty(typeInstance, typeof(ONRoleAttribute), "<Role>" + lRol + "</Role>") as ONRoleAttribute;

            if (lRoleAttribute != null)
            {
                Type lTypeInstanceInv = ONContext.GetType_Instance(lRoleAttribute.Domain);
                return(IsVisible(lTypeInstanceInv, lRoleAttribute.RoleInv, onContext) && IsVisibleInv(lTypeInstanceInv, lAttributeVisibility, onContext));
            }

            return(false);
        }
Ejemplo n.º 42
0
 public new NaveNodrizaInstance GetInstance(ONContext onContext)
 {
     return(GetInstance(onContext, new ONFilterList()));
 }
Ejemplo n.º 43
0
 public new AeronaveInstance GetInstance(ONContext onContext, ONFilterList onFilterList)
 {
     return InhGetInstance(onContext, onFilterList) as AeronaveInstance;
 }
Ejemplo n.º 44
0
 /// <summary>
 /// Comprobation that instance exists in the persistence tier
 /// </summary>
 public bool Exist(ONFilterList onFilterList)
 {
     return(ONContext.GetComponent_Data(ClassName, OnContext).Exist(Oid, onFilterList));
 }
Ejemplo n.º 45
0
        protected override ONInstance InhGetInstance(ONContext onContext, ONFilterList onFilterList)
        {
            // Add oid filter to the list
            ONFilterList lOnFilterList = new ONFilterList(onFilterList);
            lOnFilterList.Add("QueryByOid", new QueryByOidFilter(this));

            // Search Instance
            ONInstance lInstance = new AeronaveInstance(onContext);
            lInstance.Oid = this;
            lInstance = lInstance.Find(lOnFilterList);
            if (lInstance == null)
                lInstance = new AeronaveInstance(onContext);

            return lInstance;
        }
Ejemplo n.º 46
0
 public ArrayList GetFacets()
 {
     return(ONContext.GetPropertiesWithAttribute(this, typeof(ONFacetAttribute)));
 }
 public NaveNodrizaCollection(ONContext onContext)
     : base(onContext, "NaveNodriza", false)
 {
 }
Ejemplo n.º 48
0
 /// <summary>
 /// Constructor of the specific Data class
 /// </summary>
 /// <param name="onContext">Current context</param>
 public AdministradorData(ONContext onContext)
     : base(onContext, "Administrador")
 {
 }
Ejemplo n.º 49
0
        /// <summary>
        /// Load the data retrieved from the Data Base to components of the application
        /// </summary>
        /// <param name="onContext">This parameter has the current context</param>
        /// <param name="columns">This parameter has the data collected from the database</param>
        /// <param name="index">This parameter has the position of the first data to fix in the application</param>
        public static AeronaveInstance LoadFacet(ONContext onContext, ONDisplaySet displaySet, object[] columns, ref int index)
        {
            AeronaveInstance lInstance = new AeronaveInstance(onContext);
            lInstance.Oid = new AeronaveOid();

            // Field 'id_Aeronave'
            lInstance.Oid.Id_AeronaveAttr = new ONInt(Convert.ToInt32(columns[index++]));
            lInstance.StateObj = new ONString(((string) columns[index++]).TrimEnd());
            lInstance.Lmd = new ONDateTime((DateTime) columns[index++]);
            // Field 'MaximoPasajeros'
            lInstance.MaximoPasajerosAttr = new ONInt(Convert.ToInt32(columns[index++]));
            if ((displaySet != null) && (displaySet.Contains("Nombre")))
            {
                lInstance.NombreAttr = new ONText((string) columns[index++]);
            }
            if ((displaySet != null) && (displaySet.Contains("Origen")))
            {
                lInstance.OrigenAttr = new ONText((string) columns[index++]);
            }
            if ((displaySet != null) && (displaySet.Contains("Destino")))
            {
                lInstance.DestinoAttr = new ONText((string) columns[index++]);
            }

            lInstance.Modified = false;
            return lInstance;
        }
Ejemplo n.º 50
0
        public static string RetrieveInstances(ONSqlSelect onSql, ONDisplaySet displaySet, ONPath onPath, ONContext onContext)
        {
            string       lAlias    = onSql.CreateAlias(CtesBD.TBL_ADMINISTRADOR, onPath, "Administrador");
            ONDisplaySet lSourceDS = null;

            if (displaySet != null)
            {
                lSourceDS = new ONDisplaySet(displaySet);
                displaySet.Clear();
            }
            if (displaySet == null)
            {
                onSql.AddSelect(lAlias + "." + CtesBD.FLD_ADMINISTRADOR_ID_ADMINISTRADOR + ", " + lAlias + "." + CtesBD.FLD_ADMINISTRADOR_PASSWORD + ", " + lAlias + "." + CtesBD.FLD_ADMINISTRADOR_ESTADOOBJ + ", " + lAlias + "." + CtesBD.FLD_ADMINISTRADOR_FUM);
            }
            else
            {
                displaySet.Add(new ONDisplaySetItem(CtesBD.FLD_ADMINISTRADOR_ID_ADMINISTRADOR));
                onSql.AddSelect(lAlias + "." + CtesBD.FLD_ADMINISTRADOR_ID_ADMINISTRADOR);

                displaySet.Add(new ONDisplaySetItem(CtesBD.FLD_ADMINISTRADOR_PASSWORD));
                onSql.AddSelect(lAlias + "." + CtesBD.FLD_ADMINISTRADOR_PASSWORD);

                displaySet.Add(new ONDisplaySetItem(CtesBD.FLD_ADMINISTRADOR_ESTADOOBJ));
                onSql.AddSelect(lAlias + "." + CtesBD.FLD_ADMINISTRADOR_ESTADOOBJ);

                displaySet.Add(new ONDisplaySetItem(CtesBD.FLD_ADMINISTRADOR_FUM));
                onSql.AddSelect(lAlias + "." + CtesBD.FLD_ADMINISTRADOR_FUM);
            }


            // Related attributes
            if (displaySet != null)
            {
                foreach (ONDisplaySetItem lDisplaySetItem in lSourceDS)
                {
                    if ((lDisplaySetItem.Path.IndexOf(".") > 0) && (lDisplaySetItem.InData) && (!lDisplaySetItem.HasHV))
                    {
                        displaySet.Add(lDisplaySetItem);

                        string lPath      = lDisplaySetItem.Path.Substring(0, lDisplaySetItem.Path.LastIndexOf("."));
                        string lFacetName = AdministradorInstance.GetTargetClass(onContext, typeof(AdministradorInstance), new ONPath(lDisplaySetItem.Path));
                        onSql.AddSelect(AddPath(onSql, JoinType.LeftJoin, lFacetName, new ONPath(lPath), onPath, "", false) + "." + ONInstance.GetFieldNameOfAttribute(typeof(AdministradorInstance), new ONPath(lDisplaySetItem.Path)));
                    }
                }
            }
            return(lAlias);
        }
Ejemplo n.º 51
0
 /// <summary>
 /// Constructor of the specific Data class
 /// </summary>
 /// <param name="onContext">Current context</param>
 public AeronaveData(ONContext onContext)
     : base(onContext, "Aeronave")
 {
 }
Ejemplo n.º 52
0
 public override string InhRetrieveInstances(ONSqlSelect onSql, ONDisplaySet displaySet, ONPath onPath, ONContext onContext)
 {
     return(RetrieveInstances(onSql, displaySet, onPath, onContext));
 }
Ejemplo n.º 53
0
 public override string InhRetrieveInstances(ONSqlSelect onSql, ONDisplaySet displaySet, ONPath onPath, ONContext onContext)
 {
     return RetrieveInstances(onSql, displaySet, onPath, onContext);
 }
Ejemplo n.º 54
0
 public new RevisionPasajeroInstance GetInstance(ONContext onContext)
 {
     return(GetInstance(onContext, new ONFilterList()));
 }
Ejemplo n.º 55
0
        /// <summary>
        /// Process the request dedicated to loof for an instance with an OID given
        /// </summary>
        /// <param name="agentOid">OID with the agent connected to the system</param>
        /// <param name="xmlReader">XML with the request message</param>
        /// <param name="dtdVersion">Version of DTD that follows the XML message</param>
        public override ONCollection QueryByOid(ref string ticket, ref ONOid agentOid, XmlReader xmlReader, ONDisplaySet displaySet, double dtdVersion, string clientName)
        {
            // Get OID class
            string lClass = xmlReader.GetAttribute("Class");

            // Set OID parameter
            ONOid lOID = XML2ON(xmlReader, dtdVersion);

            // Read Request
            xmlReader.ReadEndElement(); // Query.Instance

            // Read Order Criteria
            if (xmlReader.IsStartElement("Sort")) // Sort
                xmlReader.Skip();

            //Read Filter Navigation
            if (xmlReader.IsStartElement("NavFilt"))
                xmlReader.Skip();

            // Create Context
            ONContext lOnContext = new ONContext();
            lOnContext.OidAgent = agentOid;

            // Execute
            PasajeroQuery lQuery = new PasajeroQuery(lOnContext);
            ONCollection lCollection = lQuery.QueryByOid(lOID, displaySet);
            ticket = lOnContext.GetTicket(dtdVersion, clientName);

            return lCollection;
        }
Ejemplo n.º 56
0
 public new RevisionPasajeroInstance GetInstance(ONContext onContext, ONFilterList onFilterList)
 {
     return(InhGetInstance(onContext, onFilterList) as RevisionPasajeroInstance);
 }
Ejemplo n.º 57
0
 /// <summary>Load the data retrieved from the Data Base to components of the application</summary>
 /// <param name="onContext">This parameter has the current context</param>
 /// <param name="oid">OID of the instance whose text attribute value is wanted to be loaded</param>
 public static ONText LoadTextNombre(ONContext onContext, PasajeroOid oid)
 {
     return PasajeroData.LoadTextNombre(onContext,oid);
 }
Ejemplo n.º 58
0
 protected override ONInstance InhGetInstance(ONContext onContext)
 {
     return(InhGetInstance(onContext, new ONFilterList()));
 }
Ejemplo n.º 59
0
        /// <summary>
        /// Treatment of the XML message that has a query request
        /// </summary>
        /// <param name="agentOID">OID of the agent connected to the system</param>
        /// <param name="xmlReader">Variable with the message XML to be treated</param>
        /// <param name="xmlWriter">Variable with the message XML to response</param>
        /// <param name="dtdVersion">Version of the DTD that follows the XML message</param>
        public void XMLRequestQuery(ref string ticket, ONOid agentOID, XmlTextReader xmlReader, out XmlTextWriter xmlWriter, double dtdVersion, string clientName)
        {
            try
            {
                // Read Request
                ONDisplaySet lDisplaySet;
                using (ONContext lOnContext = new ONContext())
                {
                    lOnContext.OidAgent = agentOID;
                    lDisplaySet = new ONDisplaySet(ClassName, xmlReader.GetAttribute("DisplaySet"), lOnContext.LeafActiveAgentFacets);
                }
                ONDisplaySet lDSRequested = new ONDisplaySet(lDisplaySet);
                xmlReader.ReadStartElement("Query.Request");

                // Create XMLWriterRequest
                MemoryStream lXMLMemoryStream = new MemoryStream();
                xmlWriter = new XmlTextWriter(lXMLMemoryStream, new UTF8Encoding());

                // Write Response
                xmlWriter.WriteStartElement("Query.Response");

                // Get start row & block size
                ONCollection lCollection = null;
                ONOid lStartRowOID = null;
                int lBlockSize = 1;

                // Execute
                if (xmlReader.IsStartElement("Query.Instance")) // QueryByOID
                {
                    // Read Request
                    xmlReader.ReadStartElement("Query.Instance");
                    if (xmlReader.IsStartElement(ONXml.XMLTAG_ALTERNATEKEY))
                        lCollection = QueryByAlternateKey(ref ticket, ref agentOID, xmlReader, lDisplaySet, dtdVersion, clientName);
                    else
                        lCollection = QueryByOid(ref ticket, ref agentOID, xmlReader, lDisplaySet, dtdVersion, clientName);
                }
                else if (xmlReader.IsStartElement("Query.Related")) // QueryByRelated
                    lCollection = QueryByRelated(ref ticket, ref agentOID, xmlReader, lDisplaySet, out lStartRowOID, out lBlockSize, dtdVersion, clientName);
                else if (xmlReader.IsStartElement("Query.Filter")) // QueryByFilter
                {
                    // Read Request
                    string lFilterName = xmlReader.GetAttribute("Name");

                    object[] ParametersList = new object[8];
                    ParametersList[0] = ticket;
                    ParametersList[1] = agentOID;
                    ParametersList[2] = xmlReader;
                    ParametersList[3] = lDisplaySet;
                    ParametersList[4] = lStartRowOID;
                    ParametersList[5] = lBlockSize;
                    ParametersList[6] = dtdVersion;
                    ParametersList[7] = clientName;
                    // Execute
                    lCollection = ONContext.InvoqueMethod(this, typeof (ONFilterXMLAttribute), "<Filter>" + lFilterName + "</Filter>", ParametersList) as ONCollection;
                    ticket = ParametersList[0] as string;
                    agentOID = ParametersList[1] as ONOid;
                    lStartRowOID = ParametersList[4] as ONOid;
                    lBlockSize = (int) ParametersList[5];
                }

                // Generate response
                ONQuery2XML(agentOID, xmlWriter, lCollection, lStartRowOID, lBlockSize, lDSRequested, dtdVersion);
                lCollection.Dispose();

                // Read Request
                xmlReader.ReadEndElement(); // Query.Request

                // Write Response
                xmlWriter.WriteEndElement(); // Query.Response

            }
            catch (ONException e)
            {

                MemoryStream lXMLMemoryStream = new MemoryStream();
                xmlWriter = new XmlTextWriter(lXMLMemoryStream, new UTF8Encoding());

                // Write Response
                xmlWriter.WriteStartElement("Query.Response");
                CreateXMLError(xmlWriter, e, dtdVersion);
                xmlWriter.WriteEndElement(); // Query.Response

                return;
            }
            catch (Exception e)
            {
                string message = e.Message;

                MemoryStream lXMLMemoryStream = new MemoryStream();
                xmlWriter = new XmlTextWriter(lXMLMemoryStream, new UTF8Encoding());

                // Write Response
                xmlWriter.WriteStartElement("Query.Response");
                xmlWriter.WriteStartElement("Error");
                xmlWriter.WriteAttributeString("Type", "External");
                xmlWriter.WriteAttributeString("Number", "999");
                if (dtdVersion <= 2)
                {
                    xmlWriter.WriteString(e.Message);
                }
                else
                {
                     if ((e is ONSystemException) || (e.InnerException is ONSystemException))
                    {
                        ONSystemException lException = null;
                        if (e is ONSystemException)
                            lException = e as ONSystemException;
                        else
                            lException = e.InnerException as ONSystemException;
                        ArrayList trace = lException.mTraceInformation;
                        xmlWriter.WriteElementString("Error.Message", message);
                        xmlWriter.WriteElementString("Error.Params", "");
                        xmlWriter.WriteStartElement("Error.Trace");
                        int length = trace.Count;
                        int i = 0;
                        while (length > 0)
                        {
                            string mensaje = (string)trace[length - 1];
                            xmlWriter.WriteStartElement("Error.TraceItem");
                            xmlWriter.WriteAttributeString("Type", "External");
                            xmlWriter.WriteAttributeString("Number", i.ToString());
                            xmlWriter.WriteStartElement("Error.Message");
                            xmlWriter.WriteString(mensaje);
                            xmlWriter.WriteEndElement(); // Error.Message
                            xmlWriter.WriteElementString("Error.Params", "");
                            xmlWriter.WriteEndElement(); // Error.TraceItem
                            i += 1;
                            length -= 1;
                        }
                        xmlWriter.WriteEndElement(); // Error.Trace
                    }
                    else
                    {
                        xmlWriter.WriteElementString("Error.Message", message);
                        xmlWriter.WriteElementString("Error.Params", "");
                        xmlWriter.WriteElementString("Error.Trace", "");
                    }
                }

                xmlWriter.WriteEndElement(); // Error
                xmlWriter.WriteEndElement(); // Query.Response

                return;
            }
        }
Ejemplo n.º 60
0
 /// <summary>
 /// Checks if the horizontal visibility filter must be executed in memory.
 /// In case there are more than one active facet for the connected agent with at least
 /// one not optimizable conjunction, the hole filter must be executed in memory.
 /// </summary>
 protected virtual bool IsUnableToFilterInData(ONContext onContext)
 {
     return(false);
 }