Beispiel #1
0
        /// <summary>
        /// Read object matching the type, folder, owner, name of the given user object
        /// </summary>
        /// <param name="uo"></param>
        /// <returns>The requested user object or null if no matching user object is found.</returns>

        public static UserObject Read(UserObject uo)
        {
            if (ServiceFacade.UseRemoteServices)
            {
                _sUo = uo.SerializeBinary();
                Mobius.Services.Native.INativeSession       nativeClient = ServiceFacade.CreateNativeSessionProxy();
                Services.Native.NativeMethodTransportObject resultObject =
                    ServiceFacade.InvokeNativeMethod(nativeClient,
                                                     (int)Services.Native.ServiceCodes.MobiusUserObjectService,
                                                     (int)Services.Native.ServiceOpCodes.MobiusUserObjectService.Read2,
                                                     new Services.Native.NativeMethodTransportObject(new object[] { _sUo }));
                ((System.ServiceModel.IClientChannel)nativeClient).Close();
                if (resultObject == null || resultObject.Value == null)
                {
                    return(null);
                }
                uo = UserObject.DeserializeBinary((byte[])resultObject.Value);
                return(uo);
            }

            else
            {
                return(UAL.UserObjectDao.Read(uo));
            }
        }
Beispiel #2
0
        /// <summary>
        /// Read object matching the type, folder, owner, name
        /// </summary>
        /// <param name="type">type of object</param>
        /// <param name="owner">userid of object owner</param>
        /// <param name="folderId">folder that it's in</param>
        /// <param name="name">name of object</param>
        /// <returns></returns>

        public static UserObject Read(
            UserObjectType type,
            string owner,
            string folderId,
            string name)
        {
            if (ServiceFacade.UseRemoteServices)
            {
                Mobius.Services.Native.INativeSession       nativeClient = ServiceFacade.CreateNativeSessionProxy();
                Services.Native.NativeMethodTransportObject resultObject =
                    ServiceFacade.InvokeNativeMethod(nativeClient,
                                                     (int)Services.Native.ServiceCodes.MobiusUserObjectService,
                                                     (int)Services.Native.ServiceOpCodes.MobiusUserObjectService.Read3,
                                                     new Services.Native.NativeMethodTransportObject(new object[] { (int)type, owner, folderId, name }));
                ((System.ServiceModel.IClientChannel)nativeClient).Close();
                if (resultObject == null || resultObject.Value == null)
                {
                    return(null);
                }
                _uo = UserObject.DeserializeBinary((byte[])resultObject.Value);
                return(_uo);
            }

            else
            {
                return(UAL.UserObjectDao.Read(type, owner, folderId, name));
            }
        }
Beispiel #3
0
        static void SetUserParameterThreadMethod(object parmArray)
        {
            try
            {
                DateTime t0 = DateTime.Now;

                object[] parms    = parmArray as object[];
                string   userId   = parms[0] as string;
                string   parmName = parms[1] as string;
                string   value    = parms[2] as string;

                if (ServiceFacade.UseRemoteServices)
                {
                    Mobius.Services.Native.INativeSession       nativeClient = ServiceFacade.CreateNativeSessionProxy();
                    Services.Native.NativeMethodTransportObject resultObject =
                        ServiceFacade.InvokeNativeMethod(nativeClient,
                                                         (int)Services.Native.ServiceCodes.MobiusUserObjectService,
                                                         (int)Services.Native.ServiceOpCodes.MobiusUserObjectService.SetUserParameter,
                                                         new Services.Native.NativeMethodTransportObject(new object[] { userId, parmName, value }));
                    ((System.ServiceModel.IClientChannel)nativeClient).Close();
                }
                else
                {
                    UAL.UserObjectDao.SetUserParameter(userId, parmName, value);
                }

                //DebugLog.TimeMessage("SetUserParameterThreadMethod " + parmName + " = " + value + ", Time(ms):", t0);
            }

            catch (Exception ex)             // log any exception since any thrown exception for thread can't be caught
            {
                DebugLog.Message(ex);
            }
        }
Beispiel #4
0
        /// <summary>
        /// Update the update date & count columns
        /// </summary>
        /// <param name="objectId"></param>
        /// <param name="updateDateTime"></param>
        /// <param name="count"></param>

        public static void UpdateUpdateDateAndCount(
            int objectId,
            DateTime updateDateTime,
            int count)
        {
            if (ServiceFacade.UseRemoteServices)
            {
                Mobius.Services.Native.INativeSession       nativeClient = ServiceFacade.CreateNativeSessionProxy();
                Services.Native.NativeMethodTransportObject resultObject =
                    ServiceFacade.InvokeNativeMethod(nativeClient,
                                                     (int)Services.Native.ServiceCodes.MobiusUserObjectService,
                                                     (int)Services.Native.ServiceOpCodes.MobiusUserObjectService.UpdateUpdateDateAndCount,
                                                     new Services.Native.NativeMethodTransportObject(new object[] { objectId, updateDateTime, count }));
                ((System.ServiceModel.IClientChannel)nativeClient).Close();
                bool updateSucceeded = (bool)resultObject.Value;

                if (!updateSucceeded)
                {
                    throw new Exception("UpdateUpdateDateAndCount failed.");
                }
            }

            else
            {
                UAL.UserObjectDao.UpdateUpdateDateAndCount(objectId, updateDateTime, count);
            }
        }
Beispiel #5
0
        /// <summary>
        /// Get a user profile parameter
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="parm"></param>
        /// <param name="defaultValue"></param>
        /// <returns></returns>

        public static string GetUserParameter(         //
            string userId,
            string parm,
            string defaultValue)
        {
            if (ServiceFacade.UseRemoteServices)
            {
                Mobius.Services.Native.INativeSession       nativeClient = ServiceFacade.CreateNativeSessionProxy();
                Services.Native.NativeMethodTransportObject resultObject =
                    ServiceFacade.InvokeNativeMethod(nativeClient,
                                                     (int)Services.Native.ServiceCodes.MobiusUserObjectService,
                                                     (int)Services.Native.ServiceOpCodes.MobiusUserObjectService.GetUserParameter,
                                                     new Services.Native.NativeMethodTransportObject(new object[] { userId, parm, defaultValue }));
                ((System.ServiceModel.IClientChannel)nativeClient).Close();
                if (resultObject == null || resultObject.Value == null)
                {
                    return(null);
                }
                string result = (string)resultObject.Value;
                return(result);
            }

            else
            {
                return(UAL.UserObjectDao.GetUserParameter(userId, parm, defaultValue));
            }
        }
Beispiel #6
0
        /// <summary>
        /// Fetch UserObject info for a list of object ids
        /// </summary>
        /// <param name="includeContent"></param>
        /// <returns>Set of user objects ordered by folderType, parentFolder, and (case insensitively) obj name</returns>

        public static List <UserObject> ReadMultiple(
            List <int> uoIds,
            bool includeContent)
        {
            if (ServiceFacade.UseRemoteServices)
            {
                Mobius.Services.Native.INativeSession nativeClient = ServiceFacade.CreateNativeSessionProxy();

                int[] uoIdsArray = uoIds.ToArray();                 // convert ids to array for serialization
                Services.Native.NativeMethodTransportObject resultObject =
                    ServiceFacade.InvokeNativeMethod(nativeClient,
                                                     (int)Services.Native.ServiceCodes.MobiusUserObjectService,
                                                     (int)Services.Native.ServiceOpCodes.MobiusUserObjectService.ReadMultiple5,
                                                     new Services.Native.NativeMethodTransportObject(
                                                         new object[] { uoIdsArray, includeContent }));
                ((System.ServiceModel.IClientChannel)nativeClient).Close();
                if (resultObject == null || resultObject.Value == null)
                {
                    return(null);
                }
                _uoList = UserObject.DeserializeListBinary((byte[])resultObject.Value);
                return(_uoList);
            }

            else
            {
                return(UAL.UserObjectDao.ReadMultiple(uoIds, includeContent));
            }
        }
Beispiel #7
0
        /// <summary>
        /// Check that each of the numbers in the list exist in the database
        /// </summary>
        /// <param name="listText">String form of list as entered by user</param>
        /// <param name="rootTableName">Root table to check against</param>
        /// <returns></returns>

        public static string ValidateList(
            string listText,
            string rootTableName)
        {
            if (ServiceFacade.UseRemoteServices)
            {
                Mobius.Services.Native.INativeSession       nativeClient = ServiceFacade.CreateNativeSessionProxy();
                Services.Native.NativeMethodTransportObject resultObject =
                    ServiceFacade.InvokeNativeMethod(nativeClient,
                                                     (int)Services.Native.ServiceCodes.MobiusCompoundUtilService,
                                                     (int)Services.Native.ServiceOpCodes.MobiusCompoundUtilService.ValidateList,
                                                     new Services.Native.NativeMethodTransportObject(new object[] { listText, rootTableName }));
                ((System.ServiceModel.IClientChannel)nativeClient).Close();
                if (resultObject == null)
                {
                    return(null);
                }
                string result = (string)resultObject.Value;
                return(result);
            }

            else
            {
                return(Qel.CompoundIdUtil.ValidateList(listText, rootTableName));
            }
        }
Beispiel #8
0
        /// <summary>
        /// Fetch info for the set of objects of a given object type visible to the specified user, optionally includes publicly visible objects as well.
        /// </summary>
        /// <param name="type">Object type</param>
        /// <param name="userId"></param>
        /// <param name="includeShared"></param>
        /// <returns>Set of user objects ordered by folderType, folderId, & (case insensitively) obj name</returns>

        public static List <UserObject> ReadMultiple(
            UserObjectType type,
            string userId,
            bool includeShared,
            bool includeContent)
        {
            if (ServiceFacade.UseRemoteServices)
            {
                Mobius.Services.Native.INativeSession       nativeClient = ServiceFacade.CreateNativeSessionProxy();
                Services.Native.NativeMethodTransportObject resultObject =
                    ServiceFacade.InvokeNativeMethod(nativeClient,
                                                     (int)Services.Native.ServiceCodes.MobiusUserObjectService,
                                                     (int)Services.Native.ServiceOpCodes.MobiusUserObjectService.ReadMultiple2,
                                                     new Services.Native.NativeMethodTransportObject(
                                                         new object[] { (int)type, userId, includeShared, includeContent, false }));
                ((System.ServiceModel.IClientChannel)nativeClient).Close();
                if (resultObject == null || resultObject.Value == null)
                {
                    return(null);
                }
                _uoList = UserObject.DeserializeListBinary((byte[])resultObject.Value);
                return(_uoList);
            }
            else
            {
                return(UAL.UserObjectDao.ReadMultiple(type, userId, includeShared, includeContent));
            }
        }
Beispiel #9
0
        /// <summary>
        /// Create a Spotfire Analysis Document displaying data for the specified
        /// query using the template and other formatting info in the SpotfireParms.
        /// </summary>
        /// <param name="q"></param>
        /// <param name="stp"></param>
        /// <returns></returns>

        public static string CreateSpotfireAnalysisDocument(
            Query q,
            TargetSummaryOptions trvp)
        {
            string serializedQuery = q.Serialize();
            string serializedTrvp  = trvp.Serialize();

            if (ServiceFacade.UseRemoteServices)
            {
                Mobius.Services.Native.INativeSession       nativeClient = ServiceFacade.CreateNativeSessionProxy();
                Services.Native.NativeMethodTransportObject resultObject =
                    ServiceFacade.InvokeNativeMethod(nativeClient,
                                                     (int)Services.Native.ServiceCodes.MobiusTargetResultsViewerService,
                                                     (int)Services.Native.ServiceOpCodes.MobiusTargetResultsViewerService.CreateSpotfireAnalysisDocument,
                                                     new Services.Native.NativeMethodTransportObject(new object[] { serializedQuery, serializedTrvp }));
                ((System.ServiceModel.IClientChannel)nativeClient).Close();
                if (resultObject == null || resultObject.Value == null)
                {
                    return(null);
                }
                string path = resultObject.Value.ToString();
                return(path);
            }

            else
            {
                q    = Query.Deserialize(serializedQuery);
                trvp = TargetSummaryOptions.Deserialize(serializedTrvp);
                string path = Mobius.ToolServices.TargetResultsViewerService.CreateSpotfireAnalysisDocument(q, trvp);
                return(path);
            }
        }
Beispiel #10
0
        /// <summary>
        /// Build MetaTable
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>

        public MetaTable GetMetaTable(string name)
        {
            MetaTable mt;

            if (ServiceFacade.UseRemoteServices)
            {
                Services.Native.INativeSession nativeClient = ServiceFacade.CreateNativeSessionProxy();
                Services.Native.NativeMethodTransportObject resultObject = ServiceFacade.InvokeNativeMethod(nativeClient,
                                                                                                            (int)Services.Native.ServiceCodes.MobiusMetaTableService,
                                                                                                            (int)Services.Native.ServiceOpCodes.MobiusMetaTableService.GetMetaTable,
                                                                                                            new Services.Native.NativeMethodTransportObject(new object[] { name }));
                ((System.ServiceModel.IClientChannel)nativeClient).Close();

                if (resultObject == null || resultObject.Value == null)
                {
                    return(null);
                }
                string serializedMt = resultObject.Value.ToString();
                mt = MetaTable.Deserialize(serializedMt);
                return(mt);
            }
            else
            {
                int t0 = TimeOfDay.Milliseconds();
                mt = MetaTableFactoryInstance.GetMetaTable(name);
                //DebugLog.TimeMessage("MetaTableFactory.GetMetaTable " + name + ", time = ", t0);
                return(mt);
            }
        }
Beispiel #11
0
        /// <summary>
        /// Select a list of molecule strings MoleculeMx objects for a compound id
        /// </summary>
        /// <param name="cid"></param>
        /// <param name="mt">MetaTable used to get root table to select structures from</param>
        /// <returns></returns>

        public static Dictionary <string, MoleculeMx> SelectChemicalStructuresForCidList(
            List <string> cidList,
            MetaTable mt = null)
        {
            Dictionary <string, MoleculeMx> csDict = null;
            Stopwatch sw = Stopwatch.StartNew();

            if (ServiceFacade.UseRemoteServices)
            {
                string mtName = mt?.Name;
                Mobius.Services.Native.INativeSession       nativeClient = ServiceFacade.CreateNativeSessionProxy();
                Services.Native.NativeMethodTransportObject resultObject =
                    ServiceFacade.InvokeNativeMethod(nativeClient,
                                                     (int)Services.Native.ServiceCodes.MobiusCompoundUtilService,
                                                     (int)Services.Native.ServiceOpCodes.MobiusCompoundUtilService.SelectMoleculesForCidList,
                                                     new Services.Native.NativeMethodTransportObject(new object[] { cidList, mtName }));
                ((System.ServiceModel.IClientChannel)nativeClient).Close();

                csDict = (resultObject != null) ? (Dictionary <string, MoleculeMx>)resultObject.Value : null;
            }

            else             // local
            {
                csDict = QEL.MoleculeUtil.SelectMoleculesForCidList(cidList, mt);
            }

            long ms = sw.ElapsedMilliseconds;

            return(csDict);
        }
Beispiel #12
0
        /// <summary>
        /// Read the list of ids for a compound library
        /// </summary>
        /// <param name="libId"></param>
        /// <returns></returns>

        public static CidList ReadLibrary(
            int libId)
        {
            if (ServiceFacade.UseRemoteServices)
            {
                Mobius.Services.Native.INativeSession       nativeClient = ServiceFacade.CreateNativeSessionProxy();
                Services.Native.NativeMethodTransportObject resultObject =
                    ServiceFacade.InvokeNativeMethod(nativeClient,
                                                     (int)Services.Native.ServiceCodes.MobiusCidListService,
                                                     (int)Services.Native.ServiceOpCodes.MobiusCidListService.ReadLibrary,
                                                     new Services.Native.NativeMethodTransportObject(new object[] { libId }));
                ((System.ServiceModel.IClientChannel)nativeClient).Close();
                if (resultObject == null || resultObject.Value == null)
                {
                    return(null);
                }
                UserObject uo      = UserObject.DeserializeBinary((byte[])resultObject.Value);
                MetaTable  mt      = MetaTableCollection.Get(MetaTable.PrimaryRootTable);
                CidList    cidList = CidList.Deserialize(uo, mt);
                return(cidList);
            }

            else
            {
                return(UAL.CidListDao.ReadLibrary(libId));
            }
        }
Beispiel #13
0
        /// <summary>
/// Get image & coordinates file from KEGG FTP
/// </summary>
/// <param name="pathwayId"></param>
/// <returns></returns>

        public static TargetMap GetKeggPathway(
            string pathwayId)
        {
            if (ServiceFacade.UseRemoteServices)
            {
                Mobius.Services.Native.INativeSession       nativeClient = ServiceFacade.CreateNativeSessionProxy();
                Services.Native.NativeMethodTransportObject resultObject =
                    ServiceFacade.InvokeNativeMethod(nativeClient,
                                                     (int)Services.Native.ServiceCodes.MobiusTargetMapService,
                                                     (int)Services.Native.ServiceOpCodes.MobiusTargetMapService.GetKeggPathway,
                                                     new Services.Native.NativeMethodTransportObject(new object[] { pathwayId }));
                ((System.ServiceModel.IClientChannel)nativeClient).Close();
                if (resultObject == null)
                {
                    return(null);
                }
                ServiceTypes.TargetMap serviceTargetMap = (ServiceTypes.TargetMap)resultObject.Value;
                TargetMap targetMap =
                    ServiceFacade.TypeConversionHelper.Convert <ServiceTypes.TargetMap, TargetMap>(serviceTargetMap);
                return(targetMap);
            }
            else
            {
                return(UAL.TargetMapDao.GetKeggPathway(pathwayId));
            }
        }
Beispiel #14
0
        /// <summary>
        /// Select row for specified result id
        /// </summary>
        /// <param name="rsltId"></param>
        /// <returns></returns>

        public AnnotationVo Select(
            long rsltId)
        {
            if (ServiceFacade.UseRemoteServices)
            {
                Mobius.Services.Native.INativeSession       nativeClient = ServiceFacade.CreateNativeSessionProxy();
                Services.Native.NativeMethodTransportObject resultObject =
                    ServiceFacade.InvokeNativeMethod(nativeClient,
                                                     (int)Services.Native.ServiceCodes.MobiusAnnotationService,
                                                     (int)Services.Native.ServiceOpCodes.MobiusAnnotationService.SelectByResultId,
                                                     new Services.Native.NativeMethodTransportObject(new object[] { instanceId, rsltId }));
                ((System.ServiceModel.IClientChannel)nativeClient).Close();
                if (resultObject == null)
                {
                    return(null);
                }
                ServiceTypes.AnnotationVo serviceAnnotationVo =
                    (ServiceTypes.AnnotationVo)resultObject.Value;
                AnnotationVo annotationVo =
                    ServiceFacade.TypeConversionHelper.Convert <ServiceTypes.AnnotationVo, AnnotationVo>(serviceAnnotationVo);
                return(annotationVo);
            }
            else
            {
                return(Instance.Select(rsltId));
            }
        }
Beispiel #15
0
        /// <summary>
        /// Select all rows for a method and compoundId
        /// </summary>
        /// <param name="mthdVrsnId"></param>
        /// <param name="cmpndId"></param>
        /// <returns></returns>

        public List <AnnotationVo> Select(
            int mthdVrsnId,
            string cmpndId)
        {
            if (ServiceFacade.UseRemoteServices)
            {
                Mobius.Services.Native.INativeSession       nativeClient = ServiceFacade.CreateNativeSessionProxy();
                Services.Native.NativeMethodTransportObject resultObject =
                    ServiceFacade.InvokeNativeMethod(nativeClient,
                                                     (int)Services.Native.ServiceCodes.MobiusAnnotationService,
                                                     (int)Services.Native.ServiceOpCodes.MobiusAnnotationService.Select,
                                                     new Services.Native.NativeMethodTransportObject(new object[] { instanceId, mthdVrsnId, cmpndId }));
                ((System.ServiceModel.IClientChannel)nativeClient).Close();
                if (resultObject == null)
                {
                    return(null);
                }
                List <ServiceTypes.AnnotationVo> serviceAnnotationVos =
                    (List <ServiceTypes.AnnotationVo>)resultObject.Value;
                List <AnnotationVo> annotationVos =
                    ServiceFacade.TypeConversionHelper.Convert <List <ServiceTypes.AnnotationVo>, List <AnnotationVo> >(serviceAnnotationVos);
                return(annotationVos);
            }
            else
            {
                return(Instance.Select(mthdVrsnId, cmpndId));
            }
        }
Beispiel #16
0
        /// <summary>
        /// Perform a deep clone of an annotation table UserObject including the underlying data
        /// </summary>
        /// <param name="uo"></param>
        /// <returns></returns>

        public static UserObject DeepClone(UserObject uo)
        {
            if (ServiceFacade.UseRemoteServices)
            {
                ServiceTypes.UserObjectNode serviceUONode =
                    ServiceFacade.TypeConversionHelper.Convert <UserObject, ServiceTypes.UserObjectNode>(uo);
                Mobius.Services.Native.INativeSession       nativeClient = ServiceFacade.CreateNativeSessionProxy();
                Services.Native.NativeMethodTransportObject resultObject =
                    ServiceFacade.InvokeNativeMethod(nativeClient,
                                                     (int)Services.Native.ServiceCodes.MobiusAnnotationService,
                                                     (int)Services.Native.ServiceOpCodes.MobiusAnnotationService.DeepClone,
                                                     new Services.Native.NativeMethodTransportObject(new object[] { serviceUONode }));
                ((System.ServiceModel.IClientChannel)nativeClient).Close();

                if (resultObject == null)
                {
                    return(null);
                }

                ServiceTypes.UserObjectNode uoNode = (ServiceTypes.UserObjectNode)resultObject.Value;
                UserObject uo2 = ServiceFacade.TypeConversionHelper.Convert <ServiceTypes.UserObjectNode, UserObject>(uoNode);
                return(uo2);
            }

            else
            {
                return(UAL.AnnotationDao.DeepClone(uo));
            }
        }
Beispiel #17
0
/// <summary>
/// Get list of related structures using the supplied compound id for the query structure
/// </summary>
/// <param name="cid"></param>
/// <param name="type"></param>
/// <returns></returns>

        public static string GetRelatedMatchCounts(
            string cid,
            string mtName,
            string chime,
            StructureSearchType searchTypes,
            int searchId)
        {
            if (ServiceFacade.UseRemoteServices)
            {
                Mobius.Services.Native.INativeSession       nativeClient = ServiceFacade.CreateNativeSessionProxy();
                Services.Native.NativeMethodTransportObject resultObject =
                    ServiceFacade.InvokeNativeMethod(nativeClient,
                                                     (int)Services.Native.ServiceCodes.MobiusCompoundUtilService,
                                                     (int)Services.Native.ServiceOpCodes.MobiusCompoundUtilService.GetRelatedCompoundIds,
                                                     //new Services.Native.NativeMethodTransportObject(new object[] { cid, mtName, chime, (int)searchTypes, searchId }));
                                                     new Services.Native.NativeMethodTransportObject(new object[] { cid, mtName, chime, searchId }));
                ((System.ServiceModel.IClientChannel)nativeClient).Close();
                string result = (resultObject != null) ? (string)resultObject.Value : null;
                return(result);
            }

            else
            {
                return(QEL.MoleculeUtil.GetRelatedMatchCounts(cid, mtName, chime, searchTypes, searchId));
            }
        }
Beispiel #18
0
        /// <summary>
        /// Select the header information for all of the databases owned by a user
        /// </summary>
        /// <param name="ownerUserName"></param>
        /// <returns></returns>

        public UcdbDatabase[] SelectDatabaseHeaders(
            string ownerUserName)
        {
            if (ServiceFacade.UseRemoteServices)
            {
                Mobius.Services.Native.INativeSession       nativeClient = ServiceFacade.CreateNativeSessionProxy();
                Services.Native.NativeMethodTransportObject resultObject =
                    ServiceFacade.InvokeNativeMethod(nativeClient,
                                                     (int)Services.Native.ServiceCodes.MobiusUserCmpndDbService,
                                                     (int)Services.Native.ServiceOpCodes.MobiusUserCmpndDbService.SelectDatabaseHeadersByOwner,
                                                     new Services.Native.NativeMethodTransportObject(new object[] { ownerUserName }));
                ((System.ServiceModel.IClientChannel)nativeClient).Close();
                if (resultObject == null)
                {
                    return(null);
                }
                ServiceTypes.UcdbDatabase[] serviceUcdbDatabases =
                    (ServiceTypes.UcdbDatabase[])resultObject.Value;
                UcdbDatabase[] ucdbDatabases =
                    ServiceFacade.TypeConversionHelper.Convert <ServiceTypes.UcdbDatabase[], UcdbDatabase[]>(serviceUcdbDatabases);
                return(ucdbDatabases);
            }
            else
            {
                return(Instance.SelectDatabaseHeaders(ownerUserName));
            }
        }
Beispiel #19
0
        /// <summary>
        /// Read user object given the object id
        /// </summary>
        /// <param name="objectId">id of item to read</param>
        /// <returns>The requested user object or null if no matching user object is found.</returns>

        public static UserObject ReadQueryWithMetaTables(int objectId)
        {
            if (ServiceFacade.UseRemoteServices)
            {
                Mobius.Services.Native.INativeSession       nativeClient = ServiceFacade.CreateNativeSessionProxy();
                Services.Native.NativeMethodTransportObject resultObject =
                    ServiceFacade.InvokeNativeMethod(nativeClient,
                                                     (int)Services.Native.ServiceCodes.MobiusUserObjectService,
                                                     (int)Services.Native.ServiceOpCodes.MobiusUserObjectService.ReadQueryWithMetaTables1,
                                                     new Services.Native.NativeMethodTransportObject(new object[] { objectId }));
                ((System.ServiceModel.IClientChannel)nativeClient).Close();
                if (resultObject == null || resultObject.Value == null)
                {
                    return(null);
                }

                UserObject uo = UserObject.DeserializeBinary((byte[])resultObject.Value);
                return(uo);
            }

            else
            {
                return(Mobius.QueryEngineLibrary.QueryUserObjectReader.ReadQueryWithMetaTables(objectId));
            }
        }
Beispiel #20
0
        /// <summary>
        /// Calculate metatable statistics for each broker type
        /// </summary>
        /// <param name="factoryName"></param>
        /// <returns></returns>

        public static int UpdateStats(
            string factoryName)
        {
            if (ServiceFacade.UseRemoteServices)
            {
                Mobius.Services.Native.INativeSession       nativeClient = ServiceFacade.CreateNativeSessionProxy();
                Services.Native.NativeMethodTransportObject resultObject =
                    ServiceFacade.InvokeNativeMethod(nativeClient,
                                                     (int)Services.Native.ServiceCodes.MobiusMetaTableService,
                                                     (int)Services.Native.ServiceOpCodes.MobiusMetaTableService.UpdateStats,
                                                     new Services.Native.NativeMethodTransportObject(new object[] { factoryName }));
                ((System.ServiceModel.IClientChannel)nativeClient).Close();

                if (resultObject == null || resultObject.Value == null)
                {
                    return(-1);
                }
                else
                {
                    return((int)resultObject.Value);
                }
            }

            else
            {
                return(Mobius.MetaFactoryNamespace.MetaTableFactory.UpdateStats(factoryName));
            }
        }
Beispiel #21
0
/// <summary>
/// Write entry to specified file
/// </summary>
/// <param name="msg"></param>
/// <param name="logFileName"></param>

        public static void Message(
            string msg,
            string logFileName)
        {
            if (ServiceFacade.UseRemoteServices)
            {
                if (!msg.StartsWith("["))                 // include local method info if needed
                {
                    string prefix = DebugLog.GetCallingClassAndMethodPrefix();
                    msg = prefix + msg;
                }

                Mobius.Services.Native.INativeSession       nativeClient = ServiceFacade.CreateNativeSessionProxy();
                Services.Native.NativeMethodTransportObject resultObject =
                    ServiceFacade.InvokeNativeMethod(nativeClient,
                                                     (int)Services.Native.ServiceCodes.MobiusServerLogFileService,
                                                     (int)Services.Native.ServiceOpCodes.MobiusServerLogFileService.LogMessage,
                                                     new Services.Native.NativeMethodTransportObject(new object[] { msg, logFileName }));
                ((System.ServiceModel.IClientChannel)nativeClient).Close();
            }

            else                                    // just log locally
            {
                if (Lex.IsNullOrEmpty(logFileName)) // assign default name
                {
                    logFileName = CommonConfigInfo.ServicesLogFileName;
                }

                logFileName = Path.GetFileName(logFileName);
                //if (!logFileName.Contains(":") && !logFileName.StartsWith(@"\\")) // include directory if none defined
                logFileName = ServicesDirs.LogDir + @"\" + logFileName;

                DebugLog.MessageDirect(msg, logFileName);
            }
        }
Beispiel #22
0
        /// <summary>
        /// Build MetaTable from a dictionary in oracle
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>

        public static MetaTable GetMetaTableFromDatabaseDictionary(string mtName)
        {
            MetaTable mt;

            if (ServiceFacade.UseRemoteServices)
            {
                Mobius.Services.Native.INativeSession       nativeClient = ServiceFacade.CreateNativeSessionProxy();
                Services.Native.NativeMethodTransportObject resultObject =
                    ServiceFacade.InvokeNativeMethod(nativeClient,
                                                     (int)Services.Native.ServiceCodes.MobiusMetaTableService,
                                                     (int)Services.Native.ServiceOpCodes.MobiusMetaTableService.GetMetaTableFromDatabaseDictionary,
                                                     new Services.Native.NativeMethodTransportObject(new object[] { mtName }));
                ((System.ServiceModel.IClientChannel)nativeClient).Close();

                if (resultObject == null || resultObject.Value == null)
                {
                    return(null);
                }
                string serializedMt = resultObject.Value.ToString();
                mt = MetaTable.Deserialize(serializedMt);
                return(mt);
            }

            else
            {
                return(Mobius.MetaFactoryNamespace.MetaTableFactory.GetMetaTableFromDatabaseDictionary(mtName));
            }
        }
Beispiel #23
0
        /// <summary>
        /// Read database header for a database id
        /// </summary>
        /// <param name="databaseId"></param>
        /// <returns></returns>

        public UcdbDatabase SelectDatabaseHeader(
            long databaseId)
        {
            if (ServiceFacade.UseRemoteServices)
            {
                Mobius.Services.Native.INativeSession       nativeClient = ServiceFacade.CreateNativeSessionProxy();
                Services.Native.NativeMethodTransportObject resultObject =
                    ServiceFacade.InvokeNativeMethod(nativeClient,
                                                     (int)Services.Native.ServiceCodes.MobiusUserCmpndDbService,
                                                     (int)Services.Native.ServiceOpCodes.MobiusUserCmpndDbService.SelectDatabaseHeaderByDatabaseId,
                                                     new Services.Native.NativeMethodTransportObject(new object[] { databaseId }));
                ((System.ServiceModel.IClientChannel)nativeClient).Close();
                if (resultObject == null)
                {
                    return(null);
                }
                ServiceTypes.UcdbDatabase serviceUcdbDatabase =
                    (ServiceTypes.UcdbDatabase)resultObject.Value;
                UcdbDatabase ucdbDatabase =
                    ServiceFacade.TypeConversionHelper.Convert <ServiceTypes.UcdbDatabase, UcdbDatabase>(serviceUcdbDatabase);
                return(ucdbDatabase);
            }
            else
            {
                return(Instance.SelectDatabaseHeader(databaseId));
            }
        }
Beispiel #24
0
        /// <summary>
        /// Build query to fetch all summarized (by target) assay data for a target
        /// </summary>
        /// <param name="geneSymbol"></param>
        /// <returns></returns>

        public static Query BuildTargetAssaySummarizedDataQuery(
            string geneSymbol)
        {
            if (ServiceFacade.UseRemoteServices)
            {
                Mobius.Services.Native.INativeSession       nativeClient = ServiceFacade.CreateNativeSessionProxy();
                Services.Native.NativeMethodTransportObject resultObject =
                    ServiceFacade.InvokeNativeMethod(nativeClient,
                                                     (int)Services.Native.ServiceCodes.MobiusTargetAssayService,
                                                     (int)Services.Native.ServiceOpCodes.MobiusTargetAssayService.BuildTargetAssaySummarizedDataQuery,
                                                     new Services.Native.NativeMethodTransportObject(new object[] { geneSymbol }));
                ((System.ServiceModel.IClientChannel)nativeClient).Close();
                if (resultObject == null)
                {
                    return(null);
                }
                string serializedQuery = (string)resultObject.Value;
                Query  query           = Query.Deserialize(serializedQuery);
                return(query);
            }
            else
            {
                return(Qel.MultiDbAssayMetaBroker.BuildTargetAssaySummarizedDataQuery(geneSymbol));
            }
        }
Beispiel #25
0
        /// <summary>
        /// Update the compounds for a database
        /// </summary>
        /// <param name="ucdb"></param>
        /// <param name="cpds"></param>
        /// <returns>New number of compounds in database</returns>

        public void UpdateDatabaseCompounds(
            UcdbDatabase ucdb,
            UcdbCompound[] cpds)
        {
            if (ServiceFacade.UseRemoteServices)
            {
                ServiceTypes.UcdbDatabase serviceUcdbDatabase =
                    ServiceFacade.TypeConversionHelper.Convert <UcdbDatabase, ServiceTypes.UcdbDatabase>(ucdb);
                ServiceTypes.UcdbCompound[] serviceUcdbCompounds =
                    ServiceFacade.TypeConversionHelper.Convert <UcdbCompound[], ServiceTypes.UcdbCompound[]>(cpds);

                Mobius.Services.Native.INativeSession       nativeClient = ServiceFacade.CreateNativeSessionProxy();
                Services.Native.NativeMethodTransportObject resultObject =
                    ServiceFacade.InvokeNativeMethod(nativeClient,
                                                     (int)Services.Native.ServiceCodes.MobiusUserCmpndDbService,
                                                     (int)Services.Native.ServiceOpCodes.MobiusUserCmpndDbService.UpdateDatabaseCompounds,
                                                     new Services.Native.NativeMethodTransportObject(new object[] { serviceUcdbDatabase, serviceUcdbCompounds }));
                ((System.ServiceModel.IClientChannel)nativeClient).Close();
                UpdateUcdb(resultObject, ucdb);
            }

            else
            {
                Instance.UpdateDatabaseCompounds(ucdb, cpds);
            }
        }
Beispiel #26
0
        /// <summary>
        /// Select database compound data for a databaseId and expCmpndIdTxt
        /// </summary>
        /// <param name="databaseId"></param>
        /// <param name="extCmpndIdTxt"></param>
        /// <returns></returns>

        public UcdbCompound SelectDatabaseCompound(
            long databaseId,
            string extCmpndIdTxt)
        {
            if (ServiceFacade.UseRemoteServices)
            {
                Mobius.Services.Native.INativeSession       nativeClient = ServiceFacade.CreateNativeSessionProxy();
                Services.Native.NativeMethodTransportObject resultObject =
                    ServiceFacade.InvokeNativeMethod(nativeClient,
                                                     (int)Services.Native.ServiceCodes.MobiusUserCmpndDbService,
                                                     (int)Services.Native.ServiceOpCodes.MobiusUserCmpndDbService.SelectDatabaseCompound,
                                                     new Services.Native.NativeMethodTransportObject(new object[] { databaseId, extCmpndIdTxt }));
                ((System.ServiceModel.IClientChannel)nativeClient).Close();
                if (resultObject == null)
                {
                    return(null);
                }
                ServiceTypes.UcdbCompound serviceUcdbCompound =
                    (ServiceTypes.UcdbCompound)resultObject.Value;
                UcdbCompound ucdbCompound =
                    ServiceFacade.TypeConversionHelper.Convert <ServiceTypes.UcdbCompound, UcdbCompound>(serviceUcdbCompound);
                return(ucdbCompound);
            }
            else
            {
                return(Instance.SelectDatabaseCompound(databaseId, extCmpndIdTxt));
            }
        }
Beispiel #27
0
        /// <summary>
        /// Get list of database string compound ids
        /// </summary>
        /// <param name="databaseId"></param>
        /// <returns></returns>

        public string[] SelectDatabaseExtStringCids(
            long databaseId)
        {
            if (ServiceFacade.UseRemoteServices)
            {
                string[] sa;
                Mobius.Services.Native.INativeSession       nativeClient = ServiceFacade.CreateNativeSessionProxy();
                Services.Native.NativeMethodTransportObject resultObject =
                    ServiceFacade.InvokeNativeMethod(nativeClient,
                                                     (int)Services.Native.ServiceCodes.MobiusUserCmpndDbService,
                                                     (int)Services.Native.ServiceOpCodes.MobiusUserCmpndDbService.SelectDatabaseExtStringCids,
                                                     new Services.Native.NativeMethodTransportObject(new object[] { databaseId }));
                ((System.ServiceModel.IClientChannel)nativeClient).Close();
                if (resultObject == null)
                {
                    return(null);
                }
                string[] extStringIds = resultObject.ToStringArray();
                return(extStringIds);
            }
            else
            {
                return(Instance.SelectDatabaseExtStringCids(databaseId));
            }
        }
Beispiel #28
0
        /// <summary>
        /// Insert a list of rows
        /// </summary>
        /// <param name="vo"></param>
        /// <returns></returns>

        public bool Insert(List <AnnotationVo> voList)
        {
            if (voList == null || voList.Count == 0)
            {
                return(true);                                                 // nothing to do
            }
            if (ServiceFacade.UseRemoteServices)
            {
                List <ServiceTypes.AnnotationVo> serviceVoList =
                    ServiceFacade.TypeConversionHelper.Convert <List <AnnotationVo>, List <ServiceTypes.AnnotationVo> >(voList);
                Mobius.Services.Native.INativeSession       nativeClient = ServiceFacade.CreateNativeSessionProxy();
                Services.Native.NativeMethodTransportObject resultObject =
                    ServiceFacade.InvokeNativeMethod(nativeClient,
                                                     (int)Services.Native.ServiceCodes.MobiusAnnotationService,
                                                     (int)Services.Native.ServiceOpCodes.MobiusAnnotationService.Insert,
                                                     new Services.Native.NativeMethodTransportObject(new object[] { instanceId, serviceVoList }));
                ((System.ServiceModel.IClientChannel)nativeClient).Close();
                bool succeeded = (bool)resultObject.Value;
                return(succeeded);
            }
            else
            {
                return(Instance.Insert(voList));
            }
        }
Beispiel #29
0
        /// <summary>
        /// Select a MoleculeMx object for a compound id
        /// </summary>
        /// <param name="cid"></param>
        /// <param name="mt"></param>
        /// <returns></returns>

        public static MoleculeMx SelectMoleculeForCid(
            string cid,
            MetaTable mt = null)
        {
            MoleculeMx mol = null;
            Stopwatch  sw  = Stopwatch.StartNew();

            mol = MoleculeCache.Get(cid);             // see if molecule in cache
            if (mol != null)
            {
                return(mol);
            }

            if (ServiceFacade.UseRemoteServices)
            {
                string mtName = mt?.Name;

                Mobius.Services.Native.INativeSession       nativeClient = ServiceFacade.CreateNativeSessionProxy();
                Services.Native.NativeMethodTransportObject resultObject =
                    ServiceFacade.InvokeNativeMethod(nativeClient,
                                                     (int)Services.Native.ServiceCodes.MobiusCompoundUtilService,
                                                     (int)Services.Native.ServiceOpCodes.MobiusCompoundUtilService.SelectMoleculeFromCid,
                                                     new Services.Native.NativeMethodTransportObject(new object[] { cid, mtName }));            // , setStereoChemistryComments
                ((System.ServiceModel.IClientChannel)nativeClient).Close();

                if (resultObject == null)
                {
                    return(null);
                }
                byte[] ba = resultObject.Value as byte[];
                if (ba != null && ba.Length > 0)
                {
                    MobiusDataType mdt = MobiusDataType.DeserializeBinarySingle(ba);
                    mol = mdt as MoleculeMx;
                }
            }

            else
            {
                mol = QEL.MoleculeUtil.SelectMoleculeForCid(cid, mt);
            }

            if (MoleculeMx.IsDefined(mol))
            {
                bool isUcdb = (mt != null && mt.Root.IsUserDatabaseStructureTable);                 // user compound database
                if (!isUcdb)
                {
                    MoleculeCache.AddMolecule(cid, mol);                          // add to cache
                }
            }

            long ms = sw.ElapsedMilliseconds;

            return(mol);
        }
Beispiel #30
0
        /// <summary>
        /// Delete a user object by id.
        /// Optionally calls IUDUserObject.UserObjectDeleted to trigger content tree updates
        /// </summary>
        /// <param name="objectId">id of user object</param>
        /// <param name="notifyUi">if true notify any associated UI of change</param>
        /// <returns>True if successful, false otherwise.</returns>

        public static bool Delete(
            int objectId,
            bool notifyUi)
        {
            if (ServiceFacade.UseRemoteServices)
            {
                bool deleteSucceeded = false;
                Mobius.Services.Native.INativeSession       nativeClient = ServiceFacade.CreateNativeSessionProxy();
                Services.Native.NativeMethodTransportObject resultObject =
                    ServiceFacade.InvokeNativeMethod(nativeClient,
                                                     (int)Services.Native.ServiceCodes.MobiusUserObjectService,
                                                     (int)Services.Native.ServiceOpCodes.MobiusUserObjectService.ReadHeader1,
                                                     new Services.Native.NativeMethodTransportObject(new object[] { objectId }));
                _sUo = (byte[])resultObject.Value;
                if (_sUo != null)
                {
                    _uo = UserObject.DeserializeBinary(_sUo);
                    if (_uo != null)
                    {
                        resultObject =
                            ServiceFacade.InvokeNativeMethod(nativeClient,
                                                             (int)Services.Native.ServiceCodes.MobiusUserObjectService,
                                                             (int)Services.Native.ServiceOpCodes.MobiusUserObjectService.Delete,
                                                             new Services.Native.NativeMethodTransportObject(new object[] { objectId }));
                        deleteSucceeded = (bool)resultObject.Value;
                    }

                    if (deleteSucceeded && notifyUi && IUserObjectIUD != null && _uo.ParentFolderType != 0)                     // notify other object of change
                    {
                        IUserObjectIUD.UserObjectDeleted(_uo);
                    }
                }
                ((System.ServiceModel.IClientChannel)nativeClient).Close();
                return(deleteSucceeded);
            }

            else             // non-service mode
            {
                UserObject uo = ReadHeader(objectId);
                if (uo == null)
                {
                    return(false);
                }

                bool result = UAL.UserObjectDao.Delete(objectId);
                if (notifyUi && IUserObjectIUD != null && uo.ParentFolderType != 0)                 // notify other object of change
                {
                    IUserObjectIUD.UserObjectDeleted(uo);
                }

                return(result);
            }
        }