public PluginCommandResponseMessage Execute(string args, UserDTO user) { var response = new ContentResponse(); var fileArgs = args.Deserialize<FileViewDiffArgs>(); try { var revision = _repository.GetRevisionId(fileArgs.TpRevisionId); if (revision != null) { var vcs = _vcsFactory.Get(revision.Profile); response.Content = vcs.GetTextFileContent(revision.RevisionId.RevisionId, fileArgs.Path).Replace("\t", " "); } return new PluginCommandResponseMessage { PluginCommandStatus = PluginCommandStatus.Succeed, ResponseData = response.Serialize() }; } catch { return new PluginCommandResponseMessage { PluginCommandStatus = PluginCommandStatus.Error, ResponseData = "Unable to connect to a remote repository" }; } }
public PluginCommandResponseMessage Execute(string args, UserDTO user) { var fileArgs = args.Deserialize<FileViewDiffArgs>(); try { var revision = _repository.GetRevisionId(fileArgs.TpRevisionId); var diff = new DiffResult(); if (revision != null) { var vcs = _vcsFactory.Get(revision.Profile); diff = vcs.GetDiff(revision.RevisionId.RevisionId, fileArgs.Path); } return new PluginCommandResponseMessage { PluginCommandStatus = PluginCommandStatus.Succeed, ResponseData = diff.Serialize() }; } catch(Exception e) { _logger.Error("ViewDiff error", e); return new PluginCommandResponseMessage { PluginCommandStatus = PluginCommandStatus.Error, ResponseData = "Unable to connect to a remote repository: {0}.".Fmt(e.Message) }; } }
public PluginCommandResponseMessage Execute(string args, UserDTO user) { var profileDtos = _profileCollection.Select(x => x.ConvertToDto()).ToArray(); return new PluginCommandResponseMessage {ResponseData = profileDtos.Serialize(), PluginCommandStatus = PluginCommandStatus.Succeed}; }
public PluginCommandResponseMessage Execute(string args, UserDTO user) { var mappingArgs = args.Deserialize<AutomapVcsToTpUsersCommandArgs>(); var alreadyMappedAuthors = mappingArgs.Connection.UserMapping.Select(x => x.Key); var vcs = _vcsFactory.Get(mappingArgs.Connection); var authors = vcs.RetrieveAuthors(new DateRange(CurrentDate.Value.AddMonths(-1), CurrentDate.Value)); authors = authors .Where(x => alreadyMappedAuthors.FirstOrDefault(y => y.Trim().ToLower() == x.Trim().ToLower()) == null) .ToArray(); var userLookups = new Dictionary<string, MappingLookup>(); foreach (var author in authors) { var userLookup = GetMatchedUserLookup(author, mappingArgs.TpUsers); if (userLookup != null) { userLookups.Add(author, userLookup); } } var result = new AutomapVcsToTpUsersCommandResponse {UserLookups = userLookups}; UpdateResultComment(result, authors); foreach (var mappingElement in mappingArgs.Connection.UserMapping) { result.UserLookups[mappingElement.Key] = mappingElement.Value; } return new PluginCommandResponseMessage {ResponseData = result.Serialize()}; }
public static UserLite Create(UserDTO userDto) { var userLite = new UserLite(); Mapper.DynamicMap(userDto, userLite); userLite.UserType = UserType.User; return userLite; }
public PluginCommandResponseMessage Execute(string args, UserDTO user) { return new PluginCommandResponseMessage { PluginCommandStatus = PluginCommandStatus.Succeed, ResponseData = BugzillaInfo.SupportedVersions.OrderBy(x => x).ToArray().Serialize() }; }
public PluginCommandResponseMessage Execute(string args, UserDTO user) { return new PluginCommandResponseMessage { ResponseData = _pluginCommandRepository.Select(x => x.Name).Where(x => x != DeleteUnusedQueuesCommand.Deleteunusedqueues).OrderBy(x => x).ToArray().Serialize(), PluginCommandStatus = PluginCommandStatus.Succeed }; }
public PluginCommandResponseMessage Execute(string args, UserDTO user) { var filter = args.Deserialize<ActivityFilter>(); var activity = _profile.Log.GetBy(filter); return new PluginCommandResponseMessage {ResponseData = activity.Serialize(), PluginCommandStatus = PluginCommandStatus.Succeed}; }
public PluginCommandResponseMessage Execute(string args, UserDTO user) { DeletePluginProfile(PluginContext.ProfileName); SendProfileChangedLocalMessage(new PluginProfile().Name, new ProfileDeletedMessage()); return new PluginCommandResponseMessage {ResponseData = string.Empty, PluginCommandStatus = PluginCommandStatus.Succeed}; }
public PluginCommandResponseMessage Execute(string args, UserDTO user) { return new PluginCommandResponseMessage { ResponseData = OnExecute(args), PluginCommandStatus = PluginCommandStatus.Succeed }; }
public PluginCommandResponseMessage Execute(string args, UserDTO user) { return new PluginCommandResponseMessage { ResponseData = _profileCollection[args].ConvertToDto().Serialize(), PluginCommandStatus = PluginCommandStatus.Succeed }; }
public PluginCommandResponseMessage Execute(string args, UserDTO user) { var responseData = _profileCollection.Select( x => new ProfileErrorCheckResult {ProfileName = x.Name.Value, ErrorsExist = x.Log.CheckForErrors()}).ToArray(). Serialize(); return new PluginCommandResponseMessage {ResponseData = responseData, PluginCommandStatus = PluginCommandStatus.Succeed}; }
public PluginCommandResponseMessage Execute(string args, UserDTO user) { var filter = args.Deserialize<ActivityFilter>(); _profile.Log.ClearBy(filter); return new PluginCommandResponseMessage {ResponseData = string.Empty, PluginCommandStatus = PluginCommandStatus.Succeed}; }
public PluginCommandResponseMessage Execute(string args, UserDTO user) { var source = args.Deserialize<MappingSource>(); return new PluginCommandResponseMessage { PluginCommandStatus = PluginCommandStatus.Succeed, ResponseData = _mapper.Map(source).Serialize() }; }
public PluginCommandResponseMessage Execute(string args, UserDTO user) { var bugIds = args.Deserialize<int[]>(); var repository = ObjectFactory.GetInstance<IRevisionStorageRepository>(); var revisions = repository.GetImportedTpIds(bugIds); return new PluginCommandResponseMessage {PluginCommandStatus = PluginCommandStatus.Succeed, ResponseData = revisions.Serialize()}; }
public PluginCommandResponseMessage Execute(string args, UserDTO user) { var bugIds = args.Deserialize<int[]>(); var repository = ObjectFactory.GetInstance<IBugzillaInfoStorageRepository>(); var bugs = repository.GetAllBugzillaBugs(bugIds); return new PluginCommandResponseMessage {PluginCommandStatus = PluginCommandStatus.Succeed, ResponseData = bugs.Serialize()}; }
public PluginCommandResponseMessage Execute(string args, UserDTO user) { var logger = ObjectFactory.GetInstance<ILogManager>(); var log = logger.GetLogger(GetType()); log.InfoFormat("TFS Legacy Profile '{0}' converting started", args); var profile = args.Deserialize<ProfileNameHolder>(); ObjectFactory.GetInstance<ILocalBus>().SendLocal(new ConvertLegacyProfileLocalMessage{LegacyProfileName = profile.ProfileName}); return new PluginCommandResponseMessage {PluginCommandStatus = PluginCommandStatus.Succeed}; }
public PluginCommandResponseMessage Execute(string args, UserDTO user) { var errors = new PluginProfileErrorCollection(); var profile = args.DeserializeProfile(); var settings = (BugzillaProfile) profile.Settings; var properties = GetBugzillaProperties(settings, errors); return errors.Any() ? new PluginCommandResponseMessage {PluginCommandStatus = PluginCommandStatus.Fail, ResponseData = errors.Serialize()} : new PluginCommandResponseMessage {PluginCommandStatus = PluginCommandStatus.Succeed, ResponseData = properties.Serialize()}; }
public PluginCommandResponseMessage Execute(string args, UserDTO user = null) { var name = args.Deserialize<MashupName>(); var mashup = ObjectFactory.GetInstance<IMashupScriptStorage>().GetMashup(name.Value); if (mashup != null) { return new PluginCommandResponseMessage {PluginCommandStatus = PluginCommandStatus.Succeed, ResponseData = mashup.Serialize()}; } return GetErrorResponse(string.Format("Mashup with name \"{0}\" doesn't exist", name.Value)); }
public PluginCommandResponseMessage Execute(string args, UserDTO user) { foreach (var account in _accountCollection) { if (!account.Profiles.Any()) { _msmqTransport.TryDeleteQueue(account.Name.Value); } _msmqTransport.TryDeleteUiQueue(account.Name.Value); } return new PluginCommandResponseMessage { ResponseData = string.Empty, PluginCommandStatus = PluginCommandStatus.Succeed }; }
public PluginCommandResponseMessage Execute(string _, UserDTO user = null) { bool wasNoProfile = _pluginContext.ProfileName.IsEmpty; var c = new AddOrUpdateProfileCommand(_bus, _profileCollection, _pluginContext, _pluginMetadata); var result = c.Execute(BuildProfileDto().Serialize()); if (result.PluginCommandStatus == PluginCommandStatus.Succeed && wasNoProfile) { _bus.SendLocalWithContext(new ProfileName(SearcherProfile.Name), _pluginContext.AccountName, new ExecutePluginCommandCommand { CommandName = SetEnableForTp2.CommandName, Arguments = bool.TrueString }); } return result; }
public PluginCommandResponseMessage Execute(string args, UserDTO user) { if (_pluginContext.ProfileName.IsEmpty) { throw new ApplicationException("'SyncNow' command should be executed for concrete profile only."); } if (_profileCollection[_pluginContext.ProfileName].IsNull) { throw new ApplicationException(string.Format("No profile with name '{0}' was found.", _pluginContext.ProfileName.Value)); } _localBus.SendLocal(new SyncNowMessage()); ObjectFactory.GetInstance<ILogManager>().GetLogger(GetType()).Info("SyncNowMessage sent"); return new PluginCommandResponseMessage {PluginCommandStatus = PluginCommandStatus.Succeed}; }
public PluginCommandResponseMessage Execute(string args, UserDTO user) { bool enable = false; if (args != null && !bool.TryParse(args, out enable)) // null means false { { return new PluginCommandResponseMessage { PluginCommandStatus = PluginCommandStatus.Error, ResponseData = "Invalid Value" }; } } if (this._profileCollection.All(x => x.Name != this._pluginContext.ProfileName)) { return new PluginCommandResponseMessage { PluginCommandStatus = PluginCommandStatus.Fail, ResponseData = "Profile {0} is not found".Fmt(this._pluginContext.ProfileName.Value) }; } var profile = this._profileCollection[this._pluginContext.ProfileName]; var settings = profile.Settings as SearcherProfile; if (settings == null) { settings = new SearcherProfile(); profile.Settings = settings; } settings.EnabledForTp2 = enable; profile.Save(); var message = "New search is " + (enable ? "enabled" : "disabled") + " for TP2"; this._log.Info(message); this._bus.SendLocal(new IPluginLocalMessage[] { new SendEnableForTp2Mashup() }); return new PluginCommandResponseMessage { PluginCommandStatus = PluginCommandStatus.Succeed, ResponseData = message.Serialize() }; }
public PluginCommandResponseMessage Execute(string args, UserDTO user) { if (_profile.IsNull) { return new PluginCommandResponseMessage { ResponseData = "Indexing was not started yet.", PluginCommandStatus = PluginCommandStatus.Fail }; } try { if(_documentIndexRebuilder.RebuildIfNeeded()) { return new PluginCommandResponseMessage { ResponseData = "Index rebuild is in progress.", PluginCommandStatus = PluginCommandStatus.Fail }; } var searchData = args.Deserialize<QueryData>(); QueryResult queryResult = _queryRunner.Run(searchData); QueryResultData queryResultData = CreateQueryResultData(queryResult); return new PluginCommandResponseMessage { ResponseData = queryResultData.Serialize(), PluginCommandStatus = PluginCommandStatus.Succeed }; } catch (DocumentIndexConcurrentAccessException e) { _logger.Error(e); return new PluginCommandResponseMessage { ResponseData = "Search failed because of concurrent access exception. Try again, please", PluginCommandStatus = PluginCommandStatus.Error }; } }
public PluginCommandResponseMessage Execute(string _, UserDTO user) { _bus.SendLocalWithContext(_pluginContext.ProfileName, _pluginContext.AccountName, new RepositoryRescanInitiatedMessage()); return new PluginCommandResponseMessage {PluginCommandStatus = PluginCommandStatus.Succeed, ResponseData = string.Empty}; }
public PluginCommandResponseMessage Execute(string args, UserDTO user = null) { var profileDto = args.DeserializeProfile(); return OnExecute(profileDto); }
public void HandleUpdateWithEmailChanged(int id, string login, string email) { var user = new UserDTO {ID = id, Login = login, Email = email, IsActive = true}; TransportMock.HandleMessageFromTp(Profile, new UserUpdatedMessage {Dto = user, ChangedFields = new[] {UserField.Email}}); }
public void HandleDelete(int id, string email) { var user = new UserDTO {ID = id, Email = email}; TransportMock.HandleMessageFromTp(Profile, new UserDeletedMessage {Dto = user}); }
public PluginCommandResponseMessage Execute(string arguments, UserDTO user) { Arguments = arguments; var pluginCustomCommandResponse = new PluginCommandResponseMessage {ResponseData = "Some Response"}; ResponseMessage = pluginCustomCommandResponse; return pluginCustomCommandResponse; }
public PluginCommandResponseMessage Execute(string args, UserDTO user) { throw new ApplicationException("Exception"); }