Beispiel #1
0
        public ServerState GetState(string pid)
        {
            FieldSearchQuery           query      = new FieldSearchQuery();
            FieldSearchQueryConditions conditions = new FieldSearchQueryConditions();
            Condition c = new Condition();

            c.@operator          = ComparisonOperator.eq;
            c.property           = "pid";
            c.value              = pid;
            conditions.condition = new Condition[] { c };
            query.Item           = conditions;

            FieldSearchResult results = service.findObjects(new string[] { "pid", "state" }, "1", query);

            if (results != null && results.resultList.Length == 1)
            {
                switch (results.resultList[0].state)
                {
                case "A": return(ServerState.Active);

                case "I": return(ServerState.Inactive);

                case "D": return(ServerState.Deleted);

                default: return(ServerState.Unknown);
                }
            }
            else
            {
                return(ServerState.Unknown);
            }
        }
Beispiel #2
0
        public ObjectFields[] Search(string[] fields, int pageSize, FieldSearchQuery query)
        {
            ObjectFields[] objs;
            try
            {
                FieldSearchResult results = service.findObjects(fields, pageSize.ToString(), query);
                objs = results.resultList;

                while (results.listSession != null && results.listSession.token != null)
                {
                    results = service.resumeFindObjects(results.listSession.token);
                    objs    = objs.Concat(results.resultList).ToArray();
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Erro ao obter ficheiros com o critério de pesquisa: " + query.ToString(), ex);
            }
            return(objs);
        }
Beispiel #3
0
        public ObjectFields[] Search(string[] fields, int pageSize, FieldSearchQuery query)
        {
            ObjectFields[] objs;
            try
            {
                FieldSearchResult results = service.findObjects(fields, pageSize.ToString(), query);
                objs = results.resultList;

                while (results.listSession != null && results.listSession.token != null)
                {
                    results = service.resumeFindObjects(results.listSession.token);
                    objs = objs.Concat(results.resultList).ToArray();
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Erro ao obter ficheiros com o critério de pesquisa: " + query.ToString(), ex);
            }
            return objs;
        }
Beispiel #4
0
        public ServerState GetState(string pid)
        {
            FieldSearchQuery query = new FieldSearchQuery();
            FieldSearchQueryConditions conditions = new FieldSearchQueryConditions();
            Condition c = new Condition();
            c.@operator = ComparisonOperator.eq;
            c.property = "pid";
            c.value = pid;
            conditions.condition = new Condition[] { c };
            query.Item = conditions;

            FieldSearchResult results = service.findObjects(new string[] { "pid", "state" }, "1", query);
            if (results != null && results.resultList.Length == 1)
            {
                switch (results.resultList[0].state)
                {
                    case "A": return ServerState.Active;
                    case "I": return ServerState.Inactive;
                    case "D": return ServerState.Deleted;
                    default: return ServerState.Unknown;
                }
            } else return ServerState.Unknown;
        }