public PackageBuilder WithOrigin(string origin) { if (null == this.attributes) { this.attributes = new DocumentPackageAttributes(); } this.attributes.Append(ORIGIN_KEY, origin); return(this); }
public PackageBuilder WithAttributes(DocumentPackageAttributes attributes) { if (null == this.attributes) { this.attributes = new DocumentPackageAttributes(); } this.attributes.Append(attributes); return(this); }
public void buildWithSpecifiedValues() { DocumentPackageAttributesBuilder documentPackageAttributesBuilder = new DocumentPackageAttributesBuilder() .withAttribute("First Name", "Adam") .withAttribute("Last Name", "Smith"); DocumentPackageAttributes documentPackageAttributes = documentPackageAttributesBuilder.build(); Assert.AreEqual("Adam", documentPackageAttributes.Contents["First Name"]); Assert.AreEqual("Smith", documentPackageAttributes.Contents["Last Name"]); }
internal PackageBuilder(Silanis.ESL.API.Package package) { this.id = new PackageId(package.Id); this.packageName = package.Name; this.autocomplete = package.Autocomplete; this.description = package.Description; this.expiryDate = package.Due; this.status = ConvertPackageStatus(package.Status); this.emailMessage = package.EmailMessage; this.settings = new DocumentPackageSettingsBuilder(package.Settings).build(); this.senderInfo = new SenderConverter(package.Sender).ToSDKSenderInfo(); this.attributes = new DocumentPackageAttributes(package.Data); foreach (Silanis.ESL.API.Role role in package.Roles) { if (role.Signers.Count == 0) { continue; } if (role.Signers[0].Group != null) { WithSigner(SignerBuilder.NewSignerFromGroup(new GroupId(role.Signers[0].Group.Id))); } else { WithSigner(SignerBuilder.NewSignerFromAPISigner(role).Build()); if (role.Type == Silanis.ESL.API.RoleType.SENDER) { Silanis.ESL.API.Signer senderSigner = role.Signers[0]; WithSenderInfo(SenderInfoBuilder.NewSenderInfo(senderSigner.Email) .WithName(senderSigner.FirstName, senderSigner.LastName) .WithCompany(senderSigner.Company) .WithTitle(senderSigner.Title)); } } } foreach (Silanis.ESL.API.Document apiDocument in package.Documents) { Document document = DocumentBuilder.NewDocumentFromAPIDocument(apiDocument, package).Build(); WithDocument(document); } }
public void VerifyResult() { DocumentPackageAttributesExample example = new DocumentPackageAttributesExample(Props.GetInstance()); example.Run(); DocumentPackage documentPackage = example.RetrievedPackage; DocumentPackageAttributes attributes = documentPackage.Attributes; IDictionary <string, object> attributeMap = attributes.Contents; Assert.IsTrue(attributeMap.ContainsKey(example.ATTRIBUTE_KEY_1)); Assert.IsTrue(attributeMap.ContainsKey(example.ATTRIBUTE_KEY_2)); Assert.IsTrue(attributeMap.ContainsKey(example.ATTRIBUTE_KEY_3)); Assert.AreEqual(attributeMap[example.ATTRIBUTE_KEY_1], example.ATTRIBUTE_1); Assert.AreEqual(attributeMap[example.ATTRIBUTE_KEY_2], example.ATTRIBUTE_2); Assert.AreEqual(attributeMap[example.ATTRIBUTE_KEY_3], example.ATTRIBUTE_3); }
internal PackageBuilder (Silanis.ESL.API.Package package) { this.id = new PackageId( package.Id ); this.packageName = package.Name; this.autocomplete = package.Autocomplete; this.description = package.Description; this.expiryDate = package.Due; this.status = ConvertPackageStatus(package.Status); this.emailMessage = package.EmailMessage; this.settings = new DocumentPackageSettingsBuilder(package.Settings).build(); this.senderInfo = new SenderConverter(package.Sender).ToSDKSenderInfo(); this.attributes = new DocumentPackageAttributes(package.Data); foreach ( Silanis.ESL.API.Role role in package.Roles ) { if ( role.Signers.Count == 0 ) { continue; } if (role.Signers[0].Group != null) { WithSigner(SignerBuilder.NewSignerFromGroup(new GroupId(role.Signers[0].Group.Id))); } else { WithSigner(SignerBuilder.NewSignerFromAPISigner(role).Build()); if (role.Type == Silanis.ESL.API.RoleType.SENDER) { Silanis.ESL.API.Signer senderSigner = role.Signers[0]; WithSenderInfo( SenderInfoBuilder.NewSenderInfo(senderSigner.Email) .WithName(senderSigner.FirstName, senderSigner.LastName) .WithCompany(senderSigner.Company) .WithTitle(senderSigner.Title)); } } } foreach ( Silanis.ESL.API.Document apiDocument in package.Documents ) { Document document = DocumentBuilder.NewDocumentFromAPIDocument( apiDocument, package ).Build(); WithDocument( document ); } }
public void VerifyResult() { DocumentPackageAttributesExample example = new DocumentPackageAttributesExample(); example.Run(); DocumentPackage documentPackage = example.RetrievedPackage; DocumentPackageAttributes attributes = documentPackage.Attributes; IDictionary <string, object> attributeMap = attributes.Contents; Assert.IsTrue(attributeMap.ContainsKey(ORIGIN_KEY)); Assert.IsTrue(attributeMap.ContainsKey(example.ATTRIBUTE_KEY_1)); Assert.IsTrue(attributeMap.ContainsKey(example.ATTRIBUTE_KEY_2)); Assert.IsTrue(attributeMap.ContainsKey(example.ATTRIBUTE_KEY_3)); Assert.AreEqual(example.DYNAMICS_2015, attributeMap[ORIGIN_KEY]); Assert.AreEqual(example.ATTRIBUTE_1, attributeMap[example.ATTRIBUTE_KEY_1]); Assert.AreEqual(example.ATTRIBUTE_2, attributeMap[example.ATTRIBUTE_KEY_2]); Assert.AreEqual(example.ATTRIBUTE_3, attributeMap[example.ATTRIBUTE_KEY_3]); }
public PackageBuilder withAttributes(DocumentPackageAttributes attributes) { return(WithAttributes(attributes)); }
public PackageBuilder WithAttributes(DocumentPackageAttributes attributes) { this.attributes = attributes; return(this); }
public PackageBuilder withAttributes( DocumentPackageAttributes attributes) { return WithAttributes( attributes ); }
public PackageBuilder WithAttributes(DocumentPackageAttributes attributes) { this.attributes = attributes; return this; }