public void Run(string json, PerformContext context) { _logger.LogInformation($"UpsertCandidateJob - Started ({AttemptInfo(context, _contextAdapter)})"); _logger.LogInformation($"UpsertCandidateJob - Payload {Redactor.RedactJson(json)}"); var candidate = json.DeserializeChangeTracked <Candidate>(); if (IsLastAttempt(context, _contextAdapter)) { var personalisation = new Dictionary <string, dynamic>(); // We fire and forget the email, ensuring the job succeeds. _notifyService.SendEmailAsync( candidate.Email, NotifyService.CandidateRegistrationFailedEmailTemplateId, personalisation); _logger.LogInformation("UpsertCandidateJob - Deleted"); } else { var registrations = ClearTeachingEventRegistrations(candidate); var phoneCall = ClearPhoneCall(candidate); SaveCandidate(candidate); SaveTeachingEventRegistrations(registrations, candidate); SavePhoneCall(phoneCall, candidate); IncrementCallbackBookingQuotaNumberOfBookings(phoneCall); _logger.LogInformation($"UpsertCandidateJob - Succeeded - {candidate.Id}"); } var duration = (DateTime.UtcNow - _contextAdapter.GetJobCreatedAt(context)).TotalSeconds; _metrics.HangfireJobQueueDuration.WithLabels(new[] { "UpsertCandidateJob" }).Observe(duration); }
static void Main(string[] args) { Documents document = new Documents("Contract"); document.Body = "Contract body..."; document.Footer = "Director: I. Ivanov"; document.Show(); Console.WriteLine(new string('-', 50)); Redactor redactor = new Redactor(); redactor.ChooseDocument("file.txt"); redactor.Open(); redactor.Change(); redactor.Save(); Console.WriteLine(new string('-', 50)); Player player = new Player(); player.Play(); (player as IPlayable).Stop(); player.Record(); (player as IRecodable).Stop(); Console.ReadKey(); }
/// <summary> /// configure redactions in XML and apply them to any document as a single redaction profile. /// </summary> public static void Redact_All() { //ExStart:ConfigurableRedaction_19.3 //Initialize RedactionPolicy RedactionPolicy policy = RedactionPolicy.Load(Common.MapSourceFilePath("Documents/Bulk/RedactionPolicy.xml")); foreach (var fileEntry in Directory.GetFiles(Common.MapSourceFilePath(Inbound_Path))) { using (Document doc = Redactor.Load(fileEntry)) { //Apply redaction RedactionSummary result = doc.RedactWith(policy.Redactions); // Set output directory path String resultFolder = result.Status != RedactionStatus.Failed ? Common.MapSourceFilePath(Outbound_Done_Path) : Common.MapSourceFilePath(Outbound_Failed_Path); // Save the ouput files after applying redactions using (Stream fileStream = File.Create(Path.Combine(resultFolder, Path.GetFileName(fileEntry)))) { doc.Save(fileStream, new SaveOptions() { RasterizeToPDF = false, RedactedFileSuffix = DateTime.Now.ToString() }); fileStream.Close(); } } } //ExEnd:ConfigurableRedaction_19.3 }
/// <summary> /// Loads document /// </summary> public static void LoadDocument() { using (Document doc = Redactor.Load(Common.MapSourceFilePath(FilePath))) { // Here we can use document instance to perform redactions } }
/// <summary> /// Performs a case sensitive exact phrase redaction /// </summary> public static void CaseSensitiveExactPhraseRedaction() { using (Document doc = Redactor.Load(Common.MapSourceFilePath(FilePath))) { doc.RedactWith(new ExactPhraseRedaction("John Doe", true /*isCaseSensitive*/, new ReplacementOptions("[personal]"))); doc.Save(); } }
public void Put(Redactor redactor) { if (ApplicationDbContext.applicationDbContext.Redactores.Count(e => e.Id == redactor.Id) == 0) { throw new NoEncontradoException("No he encontrado la entidad"); } ApplicationDbContext.applicationDbContext.Entry(redactor).State = EntityState.Modified; }
public void RedactJson_WithInvalidJson_ReturnsEmpty() { var invalidJson = "my password is 123456"; var result = Redactor.RedactJson(invalidJson); result.Should().Be(string.Empty); }
public void NoRedaction() { var redactor = new Redactor(); var actual = redactor.Redact("this is a test"); Assert.AreEqual("this is a test", actual); }
/// <summary> /// Colors redacted text /// </summary> public static void ColorRedactedText() { using (Document doc = Redactor.Load(Common.MapSourceFilePath(FilePath))) { doc.RedactWith(new ExactPhraseRedaction("John Doe", new ReplacementOptions(System.Drawing.Color.Black))); doc.Save(); } }
/// <summary> /// Removes sensitive information from specific annotations /// </summary> public static void RemoveSensitiveInformationFromAnnotation() { using (Document doc = Redactor.Load(Common.MapSourceFilePath(FilePath))) { doc.RedactWith(new AnnotationRedaction("(?im:john)", "[redacted]")); doc.Save(); } }
public override IScope this[string scopeName] { get { Logger.LogDebug("Fetching scope {scopeName}", Redactor.UserData(scopeName)); return(Scopes.GetOrAdd(scopeName, s => _scopeFactory.CreateScope(s, this))); } }
static void Redact(string input, string output, ArrayList rarr, Redactor.Appearance app) { using (PDFDoc doc = new PDFDoc(input)) { doc.InitSecurityHandler(); Redactor.Redact(doc, rarr, app, false, true); doc.Save(output, SDFDoc.SaveOptions.e_linearized); } }
public void Redaction() { var redactor = new Redactor(); redactor.Add("password123"); var actual = redactor.Redact("this is a password: password123"); Assert.AreEqual("this is a password: ***", actual); }
/// <summary> /// This method rejects or accepts specific changes during redaction process or keeps a full log of changes in the document /// </summary> public static void UseRedactionCallback() { using (Document doc = Redactor.Load(Common.MapSourceFilePath(FilePath))) { // Assign an instance before using Redactor Redactor.RedactionCallback = new RedactionDump(); doc.RedactWith(new ExactPhraseRedaction("John Doe", new ReplacementOptions("[personal]"))); doc.Save(); } }
/// <summary> /// Loads document using stream /// </summary> public static void LoadDocumentUsingStream() { using (Stream stream = File.Open(Common.MapSourceFilePath(FilePath), FileMode.Open, FileAccess.ReadWrite)) { using (Document doc = Redactor.Load(stream)) { // Here we can use document instance to make redactions } } }
public IHttpActionResult PostRedactor(Redactor redactor) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } redactor = redactorsService.Create(redactor); return(CreatedAtRoute("DefaultApi", new { id = redactor.Id }, redactor)); }
public IHttpActionResult GetRedactor(long id) { Redactor redactor = redactorsService.Get(id); if (redactor == null) { return(NotFound()); } return(Ok(redactor)); }
/// <summary> /// Opens and performs redaction in password proteced document /// </summary> public static void PasswordProtectedDocument() { LoadOptions loadOptions = new LoadOptions("mypassword"); using (Document doc = Redactor.Load(Common.MapSourceFilePath(ProtectedFilePath), loadOptions)) { // Here we can use document instance to perform redactions doc.RedactWith(new ExactPhraseRedaction("John Doe", new ReplacementOptions("[personal]"))); doc.Save(); } }
public override void ProcessSelection() { if (Word == null) { throw new NullReferenceException("Word can't be null"); } base.ProcessSelection(); Parent.ProcessSelection(); Redactor.LoadElement(Word); }
public void When_Full_Redaction_Redact_Everything() { var ctx = new ClusterContext(); ctx.ClusterOptions.RedactionLevel = RedactionLevel.Full; var redactor = new Redactor(ctx); Assert.Equal("<ud>user</ud>", redactor.UserData("user").ToString()); Assert.Equal("<md>meta</md>", redactor.MetaData("meta").ToString()); Assert.Equal("<sd>system</sd>", redactor.SystemData("system").ToString()); }
public override void ProcessMove(Point offset) { if (ParentVectorRedactor.RedactorState != RedactorStates.Dragging) { return; } Move(offset.X, offset.Y); UpdateData(); Redactor.InvalidateInterfaceBox(); }
public void When_Redaction_Disabled_No_Redaction_Occurs() { var ctx = new ClusterContext(); ctx.ClusterOptions.RedactionLevel = RedactionLevel.None; var redactor = new Redactor(ctx); Assert.Equal("1", redactor.UserData("1").ToString()); Assert.Null(redactor.MetaData(null)); Assert.Equal("system", redactor.SystemData("system").ToString()); }
public void When_User_Redaction_Redact_Partial() { var ctx = new ClusterContext(); ctx.ClusterOptions.RedactionLevel = RedactionLevel.Partial; var redactor = new Redactor(ctx); Assert.Equal("<ud>user</ud>", redactor.UserData("user").ToString()); Assert.Equal("meta", redactor.MetaData("meta").ToString()); Assert.Equal("system", redactor.SystemData("system").ToString()); }
public async Task <Redactor> CreateRedactor(ViewModelRedactor redactor) { var redactorDb = new Redactor() { Name = redactor.Name, Text = redactor.Text }; await _context.Redactor.AddAsync(redactorDb); return(redactorDb); }
public override IScope Scope(string scopeName) { if (scopeName == KeyValue.Scope.DefaultScopeName) { // Base will do the logging return(base.Scope(scopeName)); } // Log here so we have info when we hit the exception path Logger.LogDebug("Fetching scope {scopeName}", Redactor.MetaData(scopeName)); throw new NotSupportedException("Only the default Scope is supported by Memcached Buckets"); }
/// <summary> /// Cleans document metadata /// </summary> public static void CleanDocumentMetadata() { using (Document doc = Redactor.Load(Common.MapSourceFilePath(FilePath))) { doc.RedactWith(new EraseMetadataRedaction(MetadataFilter.All)); // Save the document to "*_Redacted.*" file in original format doc.Save(new SaveOptions() { AddSuffix = true, RasterizeToPDF = false }); } }
/// <summary> /// Performs a metadata search redaction /// </summary> public static void MetadataSearchRedaction() { using (Document doc = Redactor.Load(Common.MapSourceFilePath(FilePath))) { doc.RedactWith(new MetadataSearchRedaction("Company Ltd.", "--company--")); // Save the document to "*_Redacted.*" file in original format doc.Save(new SaveOptions() { AddSuffix = true, RasterizeToPDF = false }); } }
/// <summary> /// Performs Annotation Redaction /// </summary> public static void AnnotationRedaction() { using (Document doc = Redactor.Load(Common.MapSourceFilePath(FilePath))) { doc.RedactWith(new DeleteAnnotationRedaction("(?im:(use|show|describe))")); // Save the document to "*_Redacted.*" file in original format doc.Save(new SaveOptions() { AddSuffix = true, RasterizeToPDF = false }); } }
public Redactor Delete(long id) { Redactor redactor = ApplicationDbContext.applicationDbContext.Redactores.Find(id); if (redactor == null) { throw new NoEncontradoException("No he encontrado la entidad"); } ApplicationDbContext.applicationDbContext.Redactores.Remove(redactor); return(redactor); }
/// <summary> /// Performs a regular expression redaction /// </summary> public static void RegularExpressionRedaction() { using (Document doc = Redactor.Load(Common.MapSourceFilePath(FilePath))) { doc.RedactWith(new RegexRedaction("\\d{2}\\s*\\d{2}[^\\d]*\\d{6}", new ReplacementOptions(System.Drawing.Color.Blue))); // Save the document to "*_Redacted.*" file in original format doc.Save(new SaveOptions() { AddSuffix = true, RasterizeToPDF = false }); } }
public VectorRedactorRepository(Graphics canvas, Redactor redactor, VectorRedactorConfig config) { Canvas = canvas; _redactor = redactor; canvas.SmoothingMode = SmoothingMode.HighQuality; Layout = new Layout(canvas); WordConfig = new GlyphConfig(config.WordBrush, config.WordPen); LineConfig = new GlyphConfig(config.LineBrush, config.LinePen); RedactorState = RedactorStates.Default; MainGlyph = new CanvasGlyph(WordConfig) { Redactor = _redactor, ParentVectorRedactor = this }; MainGlyph.MainGlyph = MainGlyph; ActiveGlyph = MainGlyph; }