Beispiel #1
0
        /// <summary>
        /// <para>FindAsync用レスポンス処理</para>
        /// <para>_mergeFromServerを呼びレスポンスデータ(JSONテキスト)からNCMBObject(リスト)を作成する</para>
        /// </summary>
        private ArrayList _convertFindResponse(Dictionary <string, object> response)
        {
            ArrayList     answer  = new ArrayList();
            List <object> results = (List <object>)response ["results"];

            if (results == null)
            {
                Debug.Log("null results in find response");
            }
            else
            {
                object objectClassName = null;
                string resultClassName = null;
                if (response.TryGetValue("className", out objectClassName))
                {
                    resultClassName = (string)objectClassName;
                }

                if (resultClassName == null)
                {
                    resultClassName = this._className;
                }

                for (int i = 0; i < results.Count; i++)
                {
                    NCMBObject obj = null;
                    if (resultClassName.Equals("user"))
                    {
                        obj = new NCMBUser();
                    }
                    else if (resultClassName.Equals("role"))
                    {
                        obj = new NCMBRole();
                    }
                    else if (resultClassName.Equals("installation"))
                    {
                        obj = new NCMBInstallation();

                        /*
                         * } else if (resultClassName.Equals ("push")) {
                         *      obj = new NCMBPush ();
                         */
                    }
                    else if (resultClassName.Equals("file"))
                    {
                        obj = new NCMBFile();
                    }
                    else
                    {
                        obj = new NCMBObject(resultClassName);
                    }
                    obj._mergeFromServer((Dictionary <string, object>)results [i], true);
                    answer.Add(obj);
                }
            }
            return(answer);
        }
Beispiel #2
0
        /// <summary>
        /// 各型毎のURL作成
        /// </summary>
        private string _getSearchUrl(string className)
        {
            string url = "";

            if (className == null || className.Equals(""))
            {
                throw new ArgumentException("Not class name error. Please be sure to specify the class name.");

                /*
                 * } else if (className.Equals ("push")) {
                 *      // プッシュ検索API
                 *      url = new NCMBPush ()._getBaseUrl ();
                 */
            }
            else if (className.Equals("installation"))
            {
                // 配信端末検索API
                url = new NCMBInstallation()._getBaseUrl();
            }
            else if (className.Equals("file"))
            {
                // ファイル検索API
                url = new NCMBFile()._getBaseUrl();
            }
            else if (className.Equals("user"))
            {
                // 会員検索API
                //url = new NCMBUser().getBaseUrl(NCMBUser.URL_TYPE_USER);
                url = new NCMBUser()._getBaseUrl();
            }
            else if (className.Equals("role"))
            {
                // ロール検索API
                url = new NCMBRole()._getBaseUrl();
            }
            else
            {
                // オブジェクト検索API
                url = new NCMBObject(_className)._getBaseUrl();
            }
            return(url);
        }