Пример #1
0
        public override StringBuilder Execute(Dictionary <string, StringBuilder> values, IWorkspace theWorkspace)
        {
            var serializer = new Dev2JsonSerializer();

            try
            {
                if (values == null)
                {
                    throw new ArgumentNullException(nameof(values));
                }
                if (!values.ContainsKey("resourceId"))
                {
                    throw new ArgumentNullException(ErrorResource.NoResourceIdInTheIncomingData);
                }
                var id = Guid.Parse(values["resourceId"].ToString());
                Dev2Logger.Info("Get Versions. " + id, GlobalConstants.WarewolfInfo);
                var item = ServerVersionRepo.GetVersions(id);
                return(serializer.SerializeToBuilder(item));
            }
            catch (Exception e)
            {
                Dev2Logger.Error(e, GlobalConstants.WarewolfError);
                IExplorerRepositoryResult error = new ExplorerRepositoryResult(ExecStatus.Fail, e.Message);
                return(serializer.SerializeToBuilder(error));
            }
        }
Пример #2
0
        public StringBuilder Execute(Dictionary <string, StringBuilder> values, IWorkspace theWorkspace)
        {
            var serializer = new Dev2JsonSerializer();

            try
            {
                if (values == null)
                {
                    throw new ArgumentNullException("values");
                }
                if (!values.ContainsKey("resourceId"))
                {
// ReSharper disable NotResolvedInText
                    throw new ArgumentNullException("No resourceId was found in the incoming data");
// ReSharper restore NotResolvedInText
                }
                var id = Guid.Parse(values["resourceId"].ToString());
                Dev2Logger.Log.Info("Get Versions. " + id);
                var item = ServerVersionRepo.GetVersions(id);
                return(serializer.SerializeToBuilder(item));
            }
            catch (Exception e)
            {
                Dev2Logger.Log.Error(e);
                IExplorerRepositoryResult error = new ExplorerRepositoryResult(ExecStatus.Fail, e.Message);
                return(serializer.SerializeToBuilder(error));
            }
        }