protected override Clue MakeClueImpl(Education input, Guid id) { var clue = _factory.Create("/Education", input.Id.ToString(), id); var data = clue.Data.EntityData; var vocab = new EducationVocabulary(); if (!string.IsNullOrEmpty(input.Degree)) { data.Name = input.Degree; } data.Properties[vocab.Degree] = input.Degree.PrintIfAvailable(); data.Properties[vocab.EndDate] = input.EndDate.PrintIfAvailable(); data.Properties[vocab.Discipline] = input.Discipline.PrintIfAvailable(); data.Properties[vocab.StartDate] = input.StartDate.PrintIfAvailable(); data.Properties[vocab.SchoolName] = input.SchoolName.PrintIfAvailable(); if (!data.OutgoingEdges.Any()) { _factory.CreateEntityRootReference(clue, EntityEdgeType.PartOf); } return(clue); }
protected override Clue MakeClueImpl(PersonBusinessEntity input, Guid id) { var clue = _factory.Create("/PersonBusinessEntity", $"{input.BusinessEntityID}", id); var data = clue.Data.EntityData; //add edges if (!data.OutgoingEdges.Any()) _factory.CreateEntityRootReference(clue, EntityEdgeType.PartOf); var vocab = new PersonBusinessEntityVocabulary(); data.Properties[vocab.BusinessEntityID] = input.BusinessEntityID.PrintIfAvailable(); data.Properties[vocab.Rowguid] = input.Rowguid.PrintIfAvailable(); data.Properties[vocab.ModifiedDate] = input.ModifiedDate.PrintIfAvailable(); clue.ValidationRuleSuppressions.AddRange(new[] { RuleConstants.METADATA_001_Name_MustBeSet, RuleConstants.PROPERTIES_001_MustExist, RuleConstants.METADATA_002_Uri_MustBeSet, RuleConstants.METADATA_003_Author_Name_MustBeSet, RuleConstants.METADATA_005_PreviewImage_RawData_MustBeSet }); return clue; }
protected override Clue MakeClueImpl([NotNull] Organization input, Guid accountId) { if (input == null) { throw new ArgumentNullException(nameof(input)); } var clue = _factory.Create(EntityType.Organization, input.Id.ToString(), accountId); var data = clue.Data.EntityData; if (!string.IsNullOrWhiteSpace(input.Name)) { data.Name = input.Name.ToString(); } var vocab = new OrganizationVocabulary(); data.Properties[vocab.Id] = input.Id.PrintIfAvailable(); if (!data.OutgoingEdges.Any()) { _factory.CreateEntityRootReference(clue, EntityEdgeType.PartOf); } return(clue); }
protected override Clue MakeClueImpl([NotNull] Contact input, Guid accountId) { if (input == null) { throw new ArgumentNullException(nameof(input)); } var clue = _factory.Create(EntityType.Infrastructure.User, input.ContactId, accountId); var data = clue.Data.EntityData; if (!string.IsNullOrWhiteSpace(input.FullName)) { data.Name = input.FullName; } var vocab = new ContactVocabulary(); if (!data.OutgoingEdges.Any()) { _factory.CreateEntityRootReference(clue, EntityEdgeType.PartOf); } data.Properties[vocab.AccountId] = input.AccountId.PrintIfAvailable(); data.Properties[vocab.AccountIdName] = input.AccountIdName.PrintIfAvailable(); data.Properties[vocab.AccountIdYomiName] = input.AccountIdYomiName.PrintIfAvailable(); data.Properties[vocab.AccountRoleCode] = input.AccountRoleCode.PrintIfAvailable(); data.Properties[vocab.AccountRoleCodeName] = input.AccountRoleCodeName.PrintIfAvailable(); data.Properties[vocab.ContactId] = input.ContactId.PrintIfAvailable(); data.Properties[vocab.Description] = input.Description.PrintIfAvailable(); data.Properties[vocab.FullName] = input.FullName.PrintIfAvailable(); data.Properties[vocab.NickName] = input.NickName.PrintIfAvailable(); return(clue); }
protected override Clue MakeClueImpl([NotNull] _SampleFolder_ input, Guid accountId) { if (input == null) { throw new ArgumentNullException(nameof(input)); } // TODO: Create clue specifying the type of entity it is and ID var clue = _factory.Create(EntityType.Files.Directory, input.Id.ToString(), accountId); // TODO: Populate clue data var data = clue.Data.EntityData; var vocab = new _SampleFolder_Vocabulary(); data.Properties[vocab.Id] = input.Id.PrintIfAvailable(); data.Properties[vocab.Name] = input.Name.PrintIfAvailable(); data.Name = input.Name.PrintIfAvailable(); clue.ValidationRuleSuppressions.AddRange(new[] { RuleConstants.METADATA_002_Uri_MustBeSet, RuleConstants.METADATA_003_Author_Name_MustBeSet, RuleConstants.METADATA_005_PreviewImage_RawData_MustBeSet }); //since all clues need at least one edge //folder is connected to the provider itself _factory.CreateEntityRootReference(clue, EntityEdgeType.PartOf); return(clue); }
protected override Clue MakeClueImpl(Attachment input, Guid id) { var clue = _factory.Create(EntityType.Files.File, input.Url.ToString(), id); var data = clue.Data.EntityData; if (!string.IsNullOrEmpty(input.Filename)) { data.Name = input.Filename; } if (!string.IsNullOrEmpty(input.Url)) { data.Uri = new Uri(input.Url); } var download = new RestClient().DownloadData(new RestRequest(input.Url)); this.Index(download, input.Filename, clue); if (!data.OutgoingEdges.Any()) { _factory.CreateEntityRootReference(clue, EntityEdgeType.PartOf); } return(clue); }
protected override Clue MakeClueImpl(Application input, Guid id) { var clue = _factory.Create("/Application", input.Id.ToString(), id); var data = clue.Data.EntityData; var vocab = new ApplicationVocabulary(); data.Properties[vocab.Status] = input.Status.PrintIfAvailable(); data.Properties[vocab.RejectionReason] = input.RejectionReason.PrintIfAvailable(); data.Properties[vocab.RejectionDetails] = input.RejectionDetails.PrintIfAvailable(); data.Properties[vocab.RejectedAt] = input.RejectedAt.ToString().PrintIfAvailable(); data.Properties[vocab.ProspectiveOffice] = input.ProspectiveOffice.PrintIfAvailable(); data.Properties[vocab.ProspectiveDepartment] = input.ProspectiveDepartment.PrintIfAvailable(); data.Properties[vocab.Prospect] = input.Prospect.PrintIfAvailable(); data.Properties[vocab.Location] = input.Location.PrintIfAvailable(); data.Properties[vocab.LastActivityAt] = input.LastActivityAt.PrintIfAvailable(); data.Properties[vocab.CandidateId] = input.CandidateId.ToString().PrintIfAvailable(); data.Properties[vocab.AppliedAt] = input.AppliedAt.PrintIfAvailable(); if (!data.OutgoingEdges.Any()) { _factory.CreateEntityRootReference(clue, EntityEdgeType.PartOf); } return(clue); }
protected override Clue MakeClueImpl([NotNull] Organizer input, Guid accountId) { if (input == null) { throw new ArgumentNullException(nameof(input)); } // TODO: Create clue specifying the type of entity it is and ID var id = string.Format("GoToMeetingOrganizer_{0}", input.organizerKey.ToString()); var clue = _factory.Create(EntityType.Infrastructure.User, id, accountId); clue.ValidationRuleSupressions.Add(Constants.Validation.Rules.METADATA_002_Uri_MustBeSet); // TODO: Populate clue data var data = clue.Data.EntityData; data.Name = string.Format("{0} {1}", input.firstName, input.lastName); var vocab = new OrganizerVocabulary(); data.Properties[vocab.Email] = input.email.PrintIfAvailable(); data.Properties[vocab.MaxNumAttendeesAllowed] = input.maxNumAttendeesAllowed.PrintIfAvailable(); data.Properties[vocab.Status] = input.status.PrintIfAvailable(); data.Properties[vocab.Products] = string.Join(",", input.products).PrintIfAvailable(); //_factory.CreateOutgoingEntityReference(clue, EntityType.Planning, EntityEdgeType.Attended, input.meetingId, input.meetingId.ToString()); _factory.CreateEntityRootReference(clue, "parent"); //TODO Change return(clue); }
protected override Clue MakeClueImpl(ProductionUnitMeasure input, Guid id) { var clue = _factory.Create("/ProductionUnitMeasure", $"{input.UnitMeasureCode}", id); var data = clue.Data.EntityData; //add edges if (!data.OutgoingEdges.Any()) { _factory.CreateEntityRootReference(clue, EntityEdgeType.PartOf); } var vocab = new ProductionUnitMeasureVocabulary(); data.Properties[vocab.UnitMeasureCode] = input.UnitMeasureCode.PrintIfAvailable(); data.Properties[vocab.Name] = input.Name.PrintIfAvailable(); data.Properties[vocab.ModifiedDate] = input.ModifiedDate.PrintIfAvailable(); clue.ValidationRuleSuppressions.AddRange(new[] { RuleConstants.METADATA_001_Name_MustBeSet, RuleConstants.PROPERTIES_001_MustExist, RuleConstants.METADATA_002_Uri_MustBeSet, RuleConstants.METADATA_003_Author_Name_MustBeSet, RuleConstants.METADATA_005_PreviewImage_RawData_MustBeSet }); return(clue); }
protected override Clue MakeClueImpl(CollaborationGroup value, Guid id) { var clue = _factory.Create(EntityType.Infrastructure.Group, value.ID, id); var data = clue.Data.EntityData; if (value.Name != null) { data.Name = value.Name; data.DisplayName = value.Name; } if (value.OwnerId != null) { _factory.CreateOutgoingEntityReference(clue, EntityType.Person, EntityEdgeType.CreatedBy, value, value.OwnerId); var createdBy = new PersonReference(new EntityCode(EntityType.Person, SalesforceConstants.CodeOrigin, value.OwnerId)); data.Authors.Add(createdBy); } if (value.CreatedDate != null) { DateTimeOffset createdDate; if (DateTimeOffset.TryParse(value.CreatedDate, out createdDate)) { data.CreatedDate = createdDate; } } if (value.LastModifiedDate != null) { DateTimeOffset modifiedDate; if (DateTimeOffset.TryParse(value.LastModifiedDate, out modifiedDate)) { data.ModifiedDate = modifiedDate; } } if (value.CreatedById != null) { _factory.CreateOutgoingEntityReference(clue, EntityType.Person, EntityEdgeType.CreatedBy, value, value.CreatedById); var createdBy = new PersonReference(new EntityCode(EntityType.Person, SalesforceConstants.CodeOrigin, value.CreatedById)); data.Authors.Add(createdBy); } if (value.LastModifiedById != null) { _factory.CreateOutgoingEntityReference(clue, EntityType.Person, EntityEdgeType.ModifiedBy, value, value.LastModifiedById); var createdBy = new PersonReference(new EntityCode(EntityType.Person, SalesforceConstants.CodeOrigin, value.LastModifiedById)); data.Authors.Add(createdBy); } if (value.SystemModstamp != null) { data.Properties[SalesforceVocabulary.Group.SystemModstamp] = value.SystemModstamp; } _factory.CreateEntityRootReference(clue, EntityEdgeType.ManagedIn); return(clue); }
protected override Clue MakeClueImpl(PriceBook2 value, Guid id) { var clue = _factory.Create(EntityType.Note, value.ID, id); var data = clue.Data.EntityData; if (value.Name != null) { data.Name = value.Name; data.DisplayName = value.Name; data.Aliases.Add(value.Name); } //data.Uri = new Uri($"{this.state.JobData.Token.Data}/{value.ID}"); if (value.Description != null) { data.Description = value.Description; } if (value.IsActive != null) { data.Properties[SalesforceVocabulary.Product.IsActive] = value.IsActive; } if (value.IsDeleted != null) { data.Properties[SalesforceVocabulary.Product.IsDeleted] = value.IsDeleted; } if (value.CreatedDate != null) { data.CreatedDate = DateTime.Parse(value.CreatedDate); } if (value.CreatedById != null) { _factory.CreateOutgoingEntityReference(clue, EntityType.Person, EntityEdgeType.CreatedBy, value, value.CreatedById); var createdBy = new PersonReference(new EntityCode(EntityType.Person, SalesforceConstants.CodeOrigin, value.CreatedById)); data.Authors.Add(createdBy); } if (value.LastModifiedById != null) { _factory.CreateOutgoingEntityReference(clue, EntityType.Person, EntityEdgeType.ModifiedBy, value, value.LastModifiedById); var createdBy = new PersonReference(new EntityCode(EntityType.Person, SalesforceConstants.CodeOrigin, value.LastModifiedById)); data.Authors.Add(createdBy); } if (value.LastModifiedDate != null) { data.ModifiedDate = DateTime.Parse(value.LastModifiedDate); } if (value.SystemModstamp != null) { data.Properties[SalesforceVocabulary.Product.SystemModstamp] = value.SystemModstamp; } _factory.CreateEntityRootReference(clue, EntityEdgeType.ManagedIn); return(clue); }
protected override Clue MakeClueImpl([NotNull] Task input, Guid accountId) { if (input == null) { throw new ArgumentNullException(nameof(input)); } // TODO: Create clue specifying the type of entity it is and ID var clue = _factory.Create(EntityType.Task, input.id.ToString(), accountId); clue.ValidationRuleSupressions.Add(Constants.Validation.Rules.METADATA_002_Uri_MustBeSet); clue.ValidationRuleSupressions.Add(Constants.Validation.Rules.METADATA_003_Author_Name_MustBeSet); // TODO: Populate clue data var data = clue.Data.EntityData; // Each tasks does not have its own page data.Uri = new Uri("https://harvestapp.com/tasks/"); data.CreatedDate = input.created_at; data.ModifiedDate = input.updated_at; if (!string.IsNullOrEmpty(input.name)) { data.Name = input.name; } var vocab = new TaskVocabulary(); data.Properties[vocab.Name] = input.name.PrintIfAvailable(); data.Properties[vocab.BillableByDefault] = input.billable_by_default.PrintIfAvailable(); data.Properties[vocab.DefaultHourlyRate] = input.default_hourly_rate.PrintIfAvailable(); data.Properties[vocab.IsActive] = input.is_active.PrintIfAvailable(); bool hasConnection = false; if (input.task_assignment_ids != null) { foreach (var tskAsg in input.task_assignment_ids) { _factory.CreateOutgoingEntityReference(clue, EntityType.Form, EntityEdgeType.Has, tskAsg.ToString(), tskAsg.ToString()); hasConnection = true; } } if (input.time_entry_ids != null) { foreach (var tmEty in input.time_entry_ids) { _factory.CreateOutgoingEntityReference(clue, EntityType.Form, EntityEdgeType.Has, tmEty.ToString(), tmEty.ToString()); hasConnection = true; } } if (!hasConnection) { _factory.CreateEntityRootReference(clue, EntityEdgeType.Parent); } return(clue); }
protected override Clue MakeClueImpl([NotNull] Client input, Guid accountId) { if (input == null) { throw new ArgumentNullException(nameof(input)); } // TODO: Create clue specifying the type of entity it is and ID var clue = _factory.Create(EntityType.Organization, input.id.ToString(), accountId); clue.ValidationRuleSupressions.Add(Constants.Validation.Rules.METADATA_002_Uri_MustBeSet); clue.ValidationRuleSupressions.Add(Constants.Validation.Rules.METADATA_003_Author_Name_MustBeSet); // TODO: Populate clue data var data = clue.Data.EntityData; if (!String.IsNullOrEmpty(input.name)) { data.Name = input.name; } data.Uri = new Uri(string.Format("https://harvestapp.com/clients/{0}", input.id.ToString())); data.CreatedDate = input.created_at; data.ModifiedDate = input.updated_at; data.Name = input.name; var vocab = new ClientVocabulary(); data.Properties[vocab.IsActive] = input.is_active.PrintIfAvailable(); data.Properties[vocab.Address] = input.address.PrintIfAvailable(); data.Properties[vocab.Currency] = input.currency.PrintIfAvailable(); bool hasConnection = false; //_factory.CreateOutgoingEntityReference(clue, EntityType..Directory, EntityEdgeType.Parent, input, input.ToString()); if (input.project_ids != null) { foreach (var entry in input.project_ids) { _factory.CreateOutgoingEntityReference(clue, EntityType.Project, EntityEdgeType.Has, entry.ToString(), entry.ToString()); hasConnection = true; } } if (input.time_entry_ids != null) { foreach (var entry in input.time_entry_ids) { _factory.CreateOutgoingEntityReference(clue, EntityType.Form, "Pays for", entry.ToString(), entry.ToString()); hasConnection = true; } } if (!hasConnection) { _factory.CreateEntityRootReference(clue, EntityEdgeType.Parent); } return(clue); }
protected override Clue MakeClueImpl([NotNull] Tweet input, Guid accountId) { if (input == null) { throw new ArgumentNullException(nameof(input)); } var clue = _factory.Create(EntityType.Announcement, input.id.ToString(), accountId); var data = clue.Data.EntityData; if (!string.IsNullOrEmpty(input.text)) { data.Name = input.text.ToString(); } if (!string.IsNullOrEmpty(input.created_at)) { if (DateTimeOffset.TryParse(input.created_at, out var createdDate)) { data.CreatedDate = createdDate; } } if (!string.IsNullOrEmpty(input.createdByScreenName)) { _factory.CreateIncomingEntityReference(clue, EntityType.Infrastructure.User, EntityEdgeType.Created, input, input.createdByScreenName.ToLowerInvariant()); } var vocab = new TwitterTweetVocabulary(); if (!data.OutgoingEdges.Any()) { _factory.CreateEntityRootReference(clue, EntityEdgeType.PartOf); } data.Properties[vocab.created_at] = input.created_at.PrintIfAvailable(); data.Properties[vocab.id] = input.id.PrintIfAvailable(); data.Properties[vocab.id_str] = input.id_str.PrintIfAvailable(); data.Properties[vocab.text] = input.text.PrintIfAvailable(); data.Properties[vocab.display_text_range] = input.display_text_range.PrintIfAvailable(); data.Properties[vocab.truncated] = input.truncated.PrintIfAvailable(); data.Properties[vocab.user] = input.user.id.PrintIfAvailable(); data.Properties[vocab.extended_tweet] = input.extended_tweet.PrintIfAvailable(); if (input.entities != null) { if (input.entities.urls.Count > 0) { data.Properties[vocab.url] = input.entities.urls.Last().url; } } //data.Properties[vocab.entities] = input.entities.PrintIfAvailable(); data.Properties[vocab.place] = input.place.PrintIfAvailable(); return(clue); }
protected override Clue MakeClueImpl(StreamingChannel value, Guid id) { var clue = _factory.Create(EntityType.Channel, value.ID, id); var data = clue.Data.EntityData; if (value.Name != null) { data.Name = value.Name; } if (value.Description != null) { data.Description = value.Description; } //data.Uri = new Uri($"{this.state.JobData.Token.Data}/{value.ID}"); if (value.LastReferencedDate != null) { data.Properties[SalesforceVocabulary.Solution.LastReferencedDate] = DateUtilities.GetFormattedDateString(value.LastReferencedDate); } if (value.LastViewedDate != null) { data.Properties[SalesforceVocabulary.Solution.LastViewedDate] = DateUtilities.GetFormattedDateString(value.LastViewedDate); } if (value.CreatedDate != null) { data.CreatedDate = DateTime.Parse(value.CreatedDate); } if (value.CreatedById != null) { _factory.CreateOutgoingEntityReference(clue, EntityType.Person, EntityEdgeType.CreatedBy, value, value.CreatedById); var createdBy = new PersonReference(new EntityCode(EntityType.Person, SalesforceConstants.CodeOrigin, value.CreatedById)); data.Authors.Add(createdBy); } if (value.LastModifiedById != null) { _factory.CreateOutgoingEntityReference(clue, EntityType.Person, EntityEdgeType.ModifiedBy, value, value.LastModifiedById); var createdBy = new PersonReference(new EntityCode(EntityType.Person, SalesforceConstants.CodeOrigin, value.LastModifiedById)); data.Authors.Add(createdBy); } if (value.LastModifiedDate != null) { data.ModifiedDate = DateTime.Parse(value.LastModifiedDate); } if (value.SystemModstamp != null) { data.Properties[SalesforceVocabulary.Solution.SystemModstamp] = value.SystemModstamp; } _factory.CreateEntityRootReference(clue, EntityEdgeType.ManagedIn); return(clue); }
protected override Clue MakeClueImpl([NotNull] CDR input, Guid accountId) { if (input == null) { throw new ArgumentNullException(nameof(input)); } var clue = _factory.Create(EntityType.Calendar.Event, input.Id.ToString(), accountId); var data = clue.Data.EntityData; data.Name = input.Id.ToString(); var vocab = new CDRVocabulary(); data.Properties[vocab.Id] = input.Id.PrintIfAvailable(); data.Properties[vocab.AnswerTime] = input.AnswerTime.PrintIfAvailable(); data.Properties[vocab.CampaignId] = input.CampaignId.PrintIfAvailable(); data.Properties[vocab.ConversationSeconds] = input.ConversationSeconds.PrintIfAvailable(); data.Properties[vocab.Destination] = input.Destination.PrintIfAvailable(); data.Properties[vocab.Disposition] = input.Disposition.PrintIfAvailable(); data.Properties[vocab.DurationSeconds] = input.DurationSeconds.PrintIfAvailable(); data.Properties[vocab.EndTime] = input.EndTime.PrintIfAvailable(); data.Properties[vocab.LeadId] = input.LeadId.PrintIfAvailable(); //data.Properties[vocab.Recording] = input.Links?.Recording.PrintIfAvailable(); data.Properties[vocab.SessionId] = input.SessionId.PrintIfAvailable(); data.Properties[vocab.StartTime] = input.StartTime.PrintIfAvailable(); data.Properties[vocab.UserId] = input.UserId.PrintIfAvailable(); if (input.LeadId != default) { _factory.CreateOutgoingEntityReference(clue, EntityType.Sales.Lead, EntityEdgeType.PartOf, input, input.LeadId.ToString()); } if (input.UserId != default) { _factory.CreateOutgoingEntityReference(clue, EntityType.Infrastructure.User, EntityEdgeType.PartOf, input, input.UserId.ToString()); } if (!string.IsNullOrWhiteSpace(input.SessionId)) { _factory.CreateOutgoingEntityReference(clue, EntityType.Person, EntityEdgeType.PartOf, input, input.SessionId); } if (!string.IsNullOrWhiteSpace(input.CampaignId)) { _factory.CreateOutgoingEntityReference(clue, EntityType.Marketing.Campaign, EntityEdgeType.PartOf, input, input.CampaignId); } if (!data.OutgoingEdges.Any()) { _factory.CreateEntityRootReference(clue, EntityEdgeType.PartOf); } return(clue); }
protected override Clue MakeClueImpl([NotNull] LineItem input, Guid accountId) { if (input == null) { throw new ArgumentNullException(nameof(input)); } // TODO: Create clue specifying the type of entity it is and ID var clue = _factory.Create(EntityType.Component, input.id.ToString(), accountId); clue.ValidationRuleSupressions.Add(Constants.Validation.Rules.METADATA_002_Uri_MustBeSet); clue.ValidationRuleSupressions.Add(Constants.Validation.Rules.METADATA_003_Author_Name_MustBeSet); // TODO: Populate clue data var data = clue.Data.EntityData; data.Name = string.Format("Lineitem: {0}", input.kind); if (!string.IsNullOrEmpty(input.description)) { data.Description = input.description; } if (input.is_child_of_estimate) { data.Uri = new Uri(string.Format("https://harvestapp.com/estimates/{0}", input.parent_id.ToString())); } else { data.Uri = new Uri(string.Format("https://harvestapp.com/invoices/{0}", input.parent_id.ToString())); } var vocab = new LineItemVocabulary(); data.Properties[vocab.Amount] = input.amount.PrintIfAvailable(); data.Properties[vocab.IsTaxed] = input.taxed.PrintIfAvailable(); data.Properties[vocab.ProjectName] = input.project?.name.PrintIfAvailable(); data.Properties[vocab.Quantity] = input.quantity.PrintIfAvailable(); data.Properties[vocab.UnitPrice] = input.unit_price.PrintIfAvailable(); var hasEdge = false; if (!string.IsNullOrEmpty(input.parent_id.ToString())) { _factory.CreateOutgoingEntityReference(clue, EntityType.Form, EntityEdgeType.Has, input.parent_id.ToString(), input.parent_id.ToString()); } if (!hasEdge) { _factory.CreateEntityRootReference(clue, "Parent"); } return(clue); }
protected override Clue MakeClueImpl(PurchasingPurchaseOrderHeader input, Guid id) { var clue = _factory.Create("/PurchasingPurchaseOrderHeader", $"{input.PurchaseOrderID}", id); var data = clue.Data.EntityData; //add edges if (input.EmployeeID != null && !string.IsNullOrEmpty(input.EmployeeID.ToString())) { _factory.CreateOutgoingEntityReference(clue, "/PersonBusinessEntity", EntityEdgeType.AttachedTo, input.EmployeeID, input.EmployeeID.ToString()); } if (input.VendorID != null && !string.IsNullOrEmpty(input.VendorID.ToString())) { _factory.CreateOutgoingEntityReference(clue, "/PersonBusinessEntity", EntityEdgeType.AttachedTo, input.VendorID, input.VendorID.ToString()); } if (input.ShipMethodID != null && !string.IsNullOrEmpty(input.ShipMethodID.ToString())) { _factory.CreateOutgoingEntityReference(clue, "/PurchasingShipMethod", EntityEdgeType.AttachedTo, input.ShipMethodID, input.ShipMethodID.ToString()); } if (!data.OutgoingEdges.Any()) { _factory.CreateEntityRootReference(clue, EntityEdgeType.PartOf); } var vocab = new PurchasingPurchaseOrderHeaderVocabulary(); data.Properties[vocab.PurchaseOrderID] = input.PurchaseOrderID.PrintIfAvailable(); data.Properties[vocab.RevisionNumber] = input.RevisionNumber.PrintIfAvailable(); data.Properties[vocab.Status] = input.Status.PrintIfAvailable(); data.Properties[vocab.EmployeeID] = input.EmployeeID.PrintIfAvailable(); data.Properties[vocab.VendorID] = input.VendorID.PrintIfAvailable(); data.Properties[vocab.ShipMethodID] = input.ShipMethodID.PrintIfAvailable(); data.Properties[vocab.OrderDate] = input.OrderDate.PrintIfAvailable(); data.Properties[vocab.ShipDate] = input.ShipDate.PrintIfAvailable(); data.Properties[vocab.SubTotal] = input.SubTotal.PrintIfAvailable(); data.Properties[vocab.TaxAmt] = input.TaxAmt.PrintIfAvailable(); data.Properties[vocab.Freight] = input.Freight.PrintIfAvailable(); data.Properties[vocab.TotalDue] = input.TotalDue.PrintIfAvailable(); data.Properties[vocab.ModifiedDate] = input.ModifiedDate.PrintIfAvailable(); clue.ValidationRuleSuppressions.AddRange(new[] { RuleConstants.METADATA_001_Name_MustBeSet, RuleConstants.PROPERTIES_001_MustExist, RuleConstants.METADATA_002_Uri_MustBeSet, RuleConstants.METADATA_003_Author_Name_MustBeSet, RuleConstants.METADATA_005_PreviewImage_RawData_MustBeSet }); return(clue); }
protected override Clue MakeClueImpl(PurchasingProductVendor input, Guid id) { var clue = _factory.Create("/PurchasingProductVendor", $"{input.ProductID}.{input.BusinessEntityID}", id); var data = clue.Data.EntityData; //add edges if (input.ProductID != null && !string.IsNullOrEmpty(input.ProductID.ToString())) { _factory.CreateOutgoingEntityReference(clue, "/ProductionProduct", EntityEdgeType.AttachedTo, input.ProductID, input.ProductID.ToString()); } if (input.BusinessEntityID != null && !string.IsNullOrEmpty(input.BusinessEntityID.ToString())) { _factory.CreateOutgoingEntityReference(clue, "/PersonBusinessEntity", EntityEdgeType.AttachedTo, input.BusinessEntityID, input.BusinessEntityID.ToString()); } if (input.UnitMeasureCode != null && !string.IsNullOrEmpty(input.UnitMeasureCode.ToString())) { _factory.CreateOutgoingEntityReference(clue, "/ProductionUnitMeasure", EntityEdgeType.AttachedTo, input.UnitMeasureCode, input.UnitMeasureCode.ToString()); } if (!data.OutgoingEdges.Any()) { _factory.CreateEntityRootReference(clue, EntityEdgeType.PartOf); } var vocab = new PurchasingProductVendorVocabulary(); data.Properties[vocab.ProductID] = input.ProductID.PrintIfAvailable(); data.Properties[vocab.BusinessEntityID] = input.BusinessEntityID.PrintIfAvailable(); data.Properties[vocab.AverageLeadTime] = input.AverageLeadTime.PrintIfAvailable(); data.Properties[vocab.StandardPrice] = input.StandardPrice.PrintIfAvailable(); data.Properties[vocab.LastReceiptCost] = input.LastReceiptCost.PrintIfAvailable(); data.Properties[vocab.LastReceiptDate] = input.LastReceiptDate.PrintIfAvailable(); data.Properties[vocab.MinOrderQty] = input.MinOrderQty.PrintIfAvailable(); data.Properties[vocab.MaxOrderQty] = input.MaxOrderQty.PrintIfAvailable(); data.Properties[vocab.OnOrderQty] = input.OnOrderQty.PrintIfAvailable(); data.Properties[vocab.UnitMeasureCode] = input.UnitMeasureCode.PrintIfAvailable(); data.Properties[vocab.ModifiedDate] = input.ModifiedDate.PrintIfAvailable(); clue.ValidationRuleSuppressions.AddRange(new[] { RuleConstants.METADATA_001_Name_MustBeSet, RuleConstants.PROPERTIES_001_MustExist, RuleConstants.METADATA_002_Uri_MustBeSet, RuleConstants.METADATA_003_Author_Name_MustBeSet, RuleConstants.METADATA_005_PreviewImage_RawData_MustBeSet }); return(clue); }
protected override Clue MakeClueImpl([NotNull] Lead input, Guid accountId) { if (input == null) { throw new ArgumentNullException(nameof(input)); } var clue = _factory.Create(EntityType.Sales.Lead, input.Id.ToString(), accountId); var data = clue.Data.EntityData; data.Name = input.Id.ToString(); var vocab = new LeadVocabulary(); data.Properties[vocab.Id] = input.Id.PrintIfAvailable(); data.Properties[vocab.CampaignId] = input.CampaignId.PrintIfAvailable(); data.Properties[vocab.ContactAttempts] = input.ContactAttempts.PrintIfAvailable(); data.Properties[vocab.ExternalId] = input.ExternalId.PrintIfAvailable(); data.Properties[vocab.LastContactedBy] = input.LastContactedBy.PrintIfAvailable(); data.Properties[vocab.LastModifiedTime] = input.LastModifiedTime.PrintIfAvailable(); if (input.LastModifiedTime != null) { data.ModifiedDate = input.LastModifiedTime; } data.Properties[vocab.MasterData] = input.MasterData.PrintIfAvailable(); data.Properties[vocab.NextContactTime] = input.NextContactTime.PrintIfAvailable(); data.Properties[vocab.ResultData] = input.ResultData.PrintIfAvailable(); data.Properties[vocab.Status] = input.Status.PrintIfAvailable(); if (!string.IsNullOrWhiteSpace(input.Status)) { data.Tags.Add(new Tag(input.Status)); } if (input.CampaignId != default) { _factory.CreateOutgoingEntityReference(clue, EntityType.Marketing.Campaign, EntityEdgeType.PartOf, input, input.CampaignId.ToString()); } if (!string.IsNullOrWhiteSpace(input.ExternalId)) { data.Codes.Add(new EntityCode(EntityType.Infrastructure.Contact, CodeOrigin.CluedIn, input.ExternalId)); } if (!data.OutgoingEdges.Any()) { _factory.CreateEntityRootReference(clue, EntityEdgeType.PartOf); } return(clue); }
protected override Clue MakeClueImpl(SalesSalesOrderDetail input, Guid id) { var clue = _factory.Create("/SalesSalesOrderDetail", $"{input.SalesOrderID}.{input.SalesOrderDetailID}", id); var data = clue.Data.EntityData; //add edges if (input.SalesOrderID != null && !string.IsNullOrEmpty(input.SalesOrderID.ToString())) { _factory.CreateOutgoingEntityReference(clue, "/SalesSalesOrderHeader", EntityEdgeType.AttachedTo, input.SalesOrderID, input.SalesOrderID.ToString()); } if (input.ProductID != null && !string.IsNullOrEmpty(input.ProductID.ToString())) { _factory.CreateOutgoingEntityReference(clue, "/ProductionProduct", EntityEdgeType.AttachedTo, input.ProductID, input.ProductID.ToString()); } if (input.SpecialOfferID != null && !string.IsNullOrEmpty(input.SpecialOfferID.ToString())) { _factory.CreateOutgoingEntityReference(clue, "/SalesSpecialOffer", EntityEdgeType.AttachedTo, input.SpecialOfferID, input.SpecialOfferID.ToString()); } if (!data.OutgoingEdges.Any()) { _factory.CreateEntityRootReference(clue, EntityEdgeType.PartOf); } var vocab = new SalesSalesOrderDetailVocabulary(); data.Properties[vocab.SalesOrderID] = input.SalesOrderID.PrintIfAvailable(); data.Properties[vocab.SalesOrderDetailID] = input.SalesOrderDetailID.PrintIfAvailable(); data.Properties[vocab.CarrierTrackingNumber] = input.CarrierTrackingNumber.PrintIfAvailable(); data.Properties[vocab.OrderQty] = input.OrderQty.PrintIfAvailable(); data.Properties[vocab.ProductID] = input.ProductID.PrintIfAvailable(); data.Properties[vocab.SpecialOfferID] = input.SpecialOfferID.PrintIfAvailable(); data.Properties[vocab.UnitPrice] = input.UnitPrice.PrintIfAvailable(); data.Properties[vocab.UnitPriceDiscount] = input.UnitPriceDiscount.PrintIfAvailable(); data.Properties[vocab.LineTotal] = input.LineTotal.PrintIfAvailable(); data.Properties[vocab.Rowguid] = input.Rowguid.PrintIfAvailable(); data.Properties[vocab.ModifiedDate] = input.ModifiedDate.PrintIfAvailable(); clue.ValidationRuleSuppressions.AddRange(new[] { RuleConstants.METADATA_001_Name_MustBeSet, RuleConstants.PROPERTIES_001_MustExist, RuleConstants.METADATA_002_Uri_MustBeSet, RuleConstants.METADATA_003_Author_Name_MustBeSet, RuleConstants.METADATA_005_PreviewImage_RawData_MustBeSet }); return(clue); }
protected override Clue MakeClueImpl([NotNull] Contact input, Guid accountId) { if (input == null) { throw new ArgumentNullException(nameof(input)); } // TODO: Create clue specifying the type of entity it is and ID var clue = _factory.Create(EntityType.Infrastructure.User, input.id.ToString(), accountId); clue.ValidationRuleSupressions.Add(Constants.Validation.Rules.METADATA_002_Uri_MustBeSet); clue.ValidationRuleSupressions.Add(Constants.Validation.Rules.METADATA_003_Author_Name_MustBeSet); // TODO: Populate clue data var data = clue.Data.EntityData; if (!String.IsNullOrEmpty(input.first_name)) { var name = input.first_name; if (!string.IsNullOrEmpty(input.last_name)) { name += " " + input.last_name; } data.Name = name; } //Contacts have no uri data.Uri = new Uri("https://harvestapp.com/"); data.CreatedDate = input.created_at; data.ModifiedDate = input.updated_at; var vocab = new ContactVocabulary(); data.Properties[vocab.ClientName] = input.client?.name.PrintIfAvailable(); data.Properties[vocab.Email] = input.email.PrintIfAvailable(); data.Properties[vocab.Fax] = input.fax.PrintIfAvailable(); data.Properties[vocab.PhoneMobile] = input.phone_mobile.PrintIfAvailable(); data.Properties[vocab.PhoneOffice] = input.phone_office.PrintIfAvailable(); data.Properties[vocab.Title] = input.title.PrintIfAvailable(); bool hasConnection = false; if (input.client?.id != null) { _factory.CreateOutgoingEntityReference(clue, EntityType.Organization, EntityEdgeType.PartOf, input.client.id.ToString(), input.client.id.ToString()); hasConnection = true; } if (!hasConnection) { _factory.CreateEntityRootReference(clue, EntityEdgeType.Parent); } return(clue); }
protected override Clue MakeClueImpl([NotNull] SMS input, Guid accountId) { if (input == null) { throw new ArgumentNullException(nameof(input)); } var clue = _factory.Create(EntityType.Sms, input.Id.ToString(), accountId); var data = clue.Data.EntityData; if (!string.IsNullOrWhiteSpace(input.Id.ToString())) { data.Name = input.Id.ToString(); } var vocab = new SMSVocabulary(); data.Properties[vocab.CampaignId] = input.CampaignId.PrintIfAvailable(); data.Properties[vocab.Content] = input.Content.PrintIfAvailable(); data.Properties[vocab.Receiver] = input.Receiver.PrintIfAvailable(); data.Properties[vocab.Id] = input.Id.PrintIfAvailable(); data.Properties[vocab.LeadId] = input.LeadId.PrintIfAvailable(); data.Properties[vocab.Sender] = input.Sender.PrintIfAvailable(); data.Properties[vocab.Timestamp] = input.Timestamp.PrintIfAvailable(); data.Properties[vocab.Status] = input.Status.PrintIfAvailable(); data.Properties[vocab.UserId] = input.UserId.PrintIfAvailable(); data.Properties[vocab.Type] = input.Type.PrintIfAvailable(); data.Properties[vocab.Units] = input.Units.PrintIfAvailable(); if (input.LeadId != default) { _factory.CreateOutgoingEntityReference(clue, EntityType.Sales.Lead, EntityEdgeType.PartOf, input, input.LeadId.ToString()); } if (input.CampaignId != default) { _factory.CreateOutgoingEntityReference(clue, EntityType.Marketing.Campaign, EntityEdgeType.PartOf, input, input.CampaignId.ToString()); } if (input.UserId != default) { _factory.CreateOutgoingEntityReference(clue, EntityType.Infrastructure.User, EntityEdgeType.PartOf, input, input.UserId.ToString()); } if (!data.OutgoingEdges.Any()) { _factory.CreateEntityRootReference(clue, EntityEdgeType.PartOf); } return(clue); }
protected override Clue MakeClueImpl([NotNull] MeetingWithOrganizerAndAttendees input, Guid accountId) { if (input == null) { throw new ArgumentNullException(nameof(input)); } // TODO: Create clue specifying the type of entity it is and ID var id = string.Format("GoToMeetingMeeting_{0}", input.Meeting.meetingId.ToString()); var clue = _factory.Create(EntityType.Planning, id, accountId); clue.ValidationRuleSupressions.Add(Constants.Validation.Rules.METADATA_002_Uri_MustBeSet); // TODO: Populate clue data var data = clue.Data.EntityData; data.Name = string.Format("GoToMeeting, start time: {0}, subject: {1}", input.Meeting.startTime, input.Meeting.subject); var vocab = new MeetingVocabulary(); data.Properties[vocab.ConferenceCallInfo] = input.Meeting.conferenceCallInfo.PrintIfAvailable(); data.Properties[vocab.Duration] = input.Meeting.duration.PrintIfAvailable(); data.Properties[vocab.EndTime] = input.Meeting.endTime.PrintIfAvailable(); data.Properties[vocab.MaxParticipants] = input.Meeting.maxParticipants.PrintIfAvailable(); data.Properties[vocab.MeetingType] = input.Meeting.meetingId.PrintIfAvailable(); data.Properties[vocab.PasswordRequired] = input.Meeting.passwordRequired.PrintIfAvailable(); data.Properties[vocab.StartTime] = input.Meeting.startTime.PrintIfAvailable(); data.Properties[vocab.Status] = input.Meeting.status.PrintIfAvailable(); data.Properties[vocab.Subject] = input.Meeting.subject.PrintIfAvailable(); bool hasEdge = false; if (input.Organizer != null) { _factory.CreateOutgoingEntityReference(clue, EntityType.Infrastructure.User, EntityEdgeType.CreatedBy, input.Organizer.organizerKey, input.Organizer.organizerKey.ToString()); hasEdge = true; } foreach (var attendee in input.Attendees) { var attendeeString = string.Format("GoToMeetingAttendee{0}", attendee.attendeeEmail); _factory.CreateOutgoingEntityReference(clue, EntityType.Infrastructure.User, EntityEdgeType.Has, attendeeString, attendeeString); hasEdge = true; } if (!hasEdge) { _factory.CreateEntityRootReference(clue, "Parent"); } return(clue); }
protected override Clue MakeClueImpl(ProductionBillOfMaterials input, Guid id) { var clue = _factory.Create("/ProductionBillOfMaterials", $"{input.BillOfMaterialsID}", id); var data = clue.Data.EntityData; //add edges if (input.ProductAssemblyID != null && !string.IsNullOrEmpty(input.ProductAssemblyID.ToString())) { _factory.CreateOutgoingEntityReference(clue, "/ProductionProduct", EntityEdgeType.AttachedTo, input.ProductAssemblyID, input.ProductAssemblyID.ToString()); } if (input.ComponentID != null && !string.IsNullOrEmpty(input.ComponentID.ToString())) { _factory.CreateOutgoingEntityReference(clue, "/ProductionProduct", EntityEdgeType.AttachedTo, input.ComponentID, input.ComponentID.ToString()); } if (input.UnitMeasureCode != null && !string.IsNullOrEmpty(input.UnitMeasureCode.ToString())) { _factory.CreateOutgoingEntityReference(clue, "/ProductionUnitMeasure", EntityEdgeType.AttachedTo, input.UnitMeasureCode, input.UnitMeasureCode.ToString()); } if (!data.OutgoingEdges.Any()) { _factory.CreateEntityRootReference(clue, EntityEdgeType.PartOf); } var vocab = new ProductionBillOfMaterialsVocabulary(); data.Properties[vocab.BillOfMaterialsID] = input.BillOfMaterialsID.PrintIfAvailable(); data.Properties[vocab.ProductAssemblyID] = input.ProductAssemblyID.PrintIfAvailable(); data.Properties[vocab.ComponentID] = input.ComponentID.PrintIfAvailable(); data.Properties[vocab.StartDate] = input.StartDate.PrintIfAvailable(); data.Properties[vocab.EndDate] = input.EndDate.PrintIfAvailable(); data.Properties[vocab.UnitMeasureCode] = input.UnitMeasureCode.PrintIfAvailable(); data.Properties[vocab.BOMLevel] = input.BOMLevel.PrintIfAvailable(); data.Properties[vocab.PerAssemblyQty] = input.PerAssemblyQty.PrintIfAvailable(); data.Properties[vocab.ModifiedDate] = input.ModifiedDate.PrintIfAvailable(); clue.ValidationRuleSuppressions.AddRange(new[] { RuleConstants.METADATA_001_Name_MustBeSet, RuleConstants.PROPERTIES_001_MustExist, RuleConstants.METADATA_002_Uri_MustBeSet, RuleConstants.METADATA_003_Author_Name_MustBeSet, RuleConstants.METADATA_005_PreviewImage_RawData_MustBeSet }); return(clue); }
protected override Clue MakeClueImpl(ProductionWorkOrderRouting input, Guid id) { var clue = _factory.Create("/ProductionWorkOrderRouting", $"{input.WorkOrderID}.{input.ProductID}.{input.OperationSequence}", id); var data = clue.Data.EntityData; //add edges if (input.WorkOrderID != null && !string.IsNullOrEmpty(input.WorkOrderID.ToString())) { _factory.CreateOutgoingEntityReference(clue, "/ProductionWorkOrder", EntityEdgeType.AttachedTo, input.WorkOrderID, input.WorkOrderID.ToString()); } if (input.LocationID != null && !string.IsNullOrEmpty(input.LocationID.ToString())) { _factory.CreateOutgoingEntityReference(clue, "/ProductionLocation", EntityEdgeType.AttachedTo, input.LocationID, input.LocationID.ToString()); } if (!data.OutgoingEdges.Any()) { _factory.CreateEntityRootReference(clue, EntityEdgeType.PartOf); } var vocab = new ProductionWorkOrderRoutingVocabulary(); data.Properties[vocab.WorkOrderID] = input.WorkOrderID.PrintIfAvailable(); data.Properties[vocab.ProductID] = input.ProductID.PrintIfAvailable(); data.Properties[vocab.OperationSequence] = input.OperationSequence.PrintIfAvailable(); data.Properties[vocab.LocationID] = input.LocationID.PrintIfAvailable(); data.Properties[vocab.ScheduledStartDate] = input.ScheduledStartDate.PrintIfAvailable(); data.Properties[vocab.ScheduledEndDate] = input.ScheduledEndDate.PrintIfAvailable(); data.Properties[vocab.ActualStartDate] = input.ActualStartDate.PrintIfAvailable(); data.Properties[vocab.ActualEndDate] = input.ActualEndDate.PrintIfAvailable(); data.Properties[vocab.ActualResourceHrs] = input.ActualResourceHrs.PrintIfAvailable(); data.Properties[vocab.PlannedCost] = input.PlannedCost.PrintIfAvailable(); data.Properties[vocab.ActualCost] = input.ActualCost.PrintIfAvailable(); data.Properties[vocab.ModifiedDate] = input.ModifiedDate.PrintIfAvailable(); clue.ValidationRuleSuppressions.AddRange(new[] { RuleConstants.METADATA_001_Name_MustBeSet, RuleConstants.PROPERTIES_001_MustExist, RuleConstants.METADATA_002_Uri_MustBeSet, RuleConstants.METADATA_003_Author_Name_MustBeSet, RuleConstants.METADATA_005_PreviewImage_RawData_MustBeSet }); return(clue); }
protected override Clue MakeClueImpl(HumanResourcesEmployee input, Guid id) { var clue = _factory.Create("/HumanResourcesEmployee", $"{input.BusinessEntityID}", id); var data = clue.Data.EntityData; //add edges if (input.BusinessEntityID != null && !string.IsNullOrEmpty(input.BusinessEntityID.ToString())) { _factory.CreateOutgoingEntityReference(clue, "/PersonBusinessEntity", EntityEdgeType.AttachedTo, input.BusinessEntityID, input.BusinessEntityID.ToString()); } if (!data.OutgoingEdges.Any()) { _factory.CreateEntityRootReference(clue, EntityEdgeType.PartOf); } var vocab = new HumanResourcesEmployeeVocabulary(); data.Properties[vocab.BusinessEntityID] = input.BusinessEntityID.PrintIfAvailable(); data.Properties[vocab.NationalIDNumber] = input.NationalIDNumber.PrintIfAvailable(); data.Properties[vocab.LoginID] = input.LoginID.PrintIfAvailable(); data.Properties[vocab.OrganizationNode] = input.OrganizationNode.PrintIfAvailable(); data.Properties[vocab.OrganizationLevel] = input.OrganizationLevel.PrintIfAvailable(); data.Properties[vocab.JobTitle] = input.JobTitle.PrintIfAvailable(); data.Properties[vocab.BirthDate] = input.BirthDate.PrintIfAvailable(); data.Properties[vocab.MaritalStatus] = input.MaritalStatus.PrintIfAvailable(); data.Properties[vocab.Gender] = input.Gender.PrintIfAvailable(); data.Properties[vocab.HireDate] = input.HireDate.PrintIfAvailable(); data.Properties[vocab.SalariedFlag] = input.SalariedFlag.PrintIfAvailable(); data.Properties[vocab.VacationHours] = input.VacationHours.PrintIfAvailable(); data.Properties[vocab.SickLeaveHours] = input.SickLeaveHours.PrintIfAvailable(); data.Properties[vocab.CurrentFlag] = input.CurrentFlag.PrintIfAvailable(); data.Properties[vocab.Rowguid] = input.Rowguid.PrintIfAvailable(); data.Properties[vocab.ModifiedDate] = input.ModifiedDate.PrintIfAvailable(); clue.ValidationRuleSuppressions.AddRange(new[] { RuleConstants.METADATA_001_Name_MustBeSet, RuleConstants.PROPERTIES_001_MustExist, RuleConstants.METADATA_002_Uri_MustBeSet, RuleConstants.METADATA_003_Author_Name_MustBeSet, RuleConstants.METADATA_005_PreviewImage_RawData_MustBeSet }); return(clue); }
protected override Clue MakeClueImpl([NotNull] InvoicePayment input, Guid accountId) { if (input == null) { throw new ArgumentNullException(nameof(input)); } // TODO: Create clue specifying the type of entity it is and ID var clue = _factory.Create(EntityType.Accounting, input.id.ToString(), accountId); clue.ValidationRuleSupressions.Add(Constants.Validation.Rules.METADATA_002_Uri_MustBeSet); clue.ValidationRuleSupressions.Add(Constants.Validation.Rules.METADATA_003_Author_Name_MustBeSet); // TODO: Populate clue data var data = clue.Data.EntityData; data.Uri = new Uri(string.Format("https://harvestapp.com/invoices/{0}", input.invoice_id.ToString())); data.CreatedDate = input.created_at; data.ModifiedDate = input.updated_at; data.Name = string.Format("Invoice payment, transaction id: {0}", input.transaction_id); var vocab = new InvoicePaymentVocabulary(); data.Properties[vocab.Amount] = input.amount.PrintIfAvailable(); data.Properties[vocab.Notes] = input.notes.PrintIfAvailable(); data.Properties[vocab.PaidAt] = input.paid_date.PrintIfAvailable(); data.Properties[vocab.PaymentGateway] = input.payment_gateway?.name.PrintIfAvailable(); data.Properties[vocab.RecordedBy] = input.recorded_by.PrintIfAvailable(); data.Properties[vocab.RecordedByEmail] = input.recorded_by_email.PrintIfAvailable(); data.Properties[vocab.TransactionId] = input.transaction_id?.ToString().PrintIfAvailable(); var hasEdge = false; if (input.invoice_id != null) { _factory.CreateOutgoingEntityReference(clue, EntityType.Form, EntityEdgeType.AttachedTo, input.invoice_id.ToString(), input.invoice_id.ToString()); hasEdge = true; } if (input.payment_gateway?.id != null) { _factory.CreateOutgoingEntityReference(clue, EntityType.Accounting, EntityEdgeType.Involves, input.payment_gateway.id.ToString()); hasEdge = true; } if (!hasEdge) { _factory.CreateEntityRootReference(clue, "Parent"); } return(clue); }
protected override Clue MakeClueImpl(SalesCustomer input, Guid id) { var clue = _factory.Create("/SalesCustomer", $"{input.CustomerID}", id); var data = clue.Data.EntityData; //add edges if (input.PersonID != null && !string.IsNullOrEmpty(input.PersonID.ToString())) { _factory.CreateOutgoingEntityReference(clue, "/PersonBusinessEntity", EntityEdgeType.AttachedTo, input.PersonID, input.PersonID.ToString()); } if (input.StoreID != null && !string.IsNullOrEmpty(input.StoreID.ToString())) { _factory.CreateOutgoingEntityReference(clue, "/PersonBusinessEntity", EntityEdgeType.AttachedTo, input.StoreID, input.StoreID.ToString()); } if (input.TerritoryID != null && !string.IsNullOrEmpty(input.TerritoryID.ToString())) { _factory.CreateOutgoingEntityReference(clue, "/SalesSalesTerritory", EntityEdgeType.AttachedTo, input.TerritoryID, input.TerritoryID.ToString()); } if (!data.OutgoingEdges.Any()) { _factory.CreateEntityRootReference(clue, EntityEdgeType.PartOf); } var vocab = new SalesCustomerVocabulary(); data.Properties[vocab.CustomerID] = input.CustomerID.PrintIfAvailable(); data.Properties[vocab.PersonID] = input.PersonID.PrintIfAvailable(); data.Properties[vocab.StoreID] = input.StoreID.PrintIfAvailable(); data.Properties[vocab.TerritoryID] = input.TerritoryID.PrintIfAvailable(); data.Properties[vocab.AccountNumber] = input.AccountNumber.PrintIfAvailable(); data.Properties[vocab.Rowguid] = input.Rowguid.PrintIfAvailable(); data.Properties[vocab.ModifiedDate] = input.ModifiedDate.PrintIfAvailable(); clue.ValidationRuleSuppressions.AddRange(new[] { RuleConstants.METADATA_001_Name_MustBeSet, RuleConstants.PROPERTIES_001_MustExist, RuleConstants.METADATA_002_Uri_MustBeSet, RuleConstants.METADATA_003_Author_Name_MustBeSet, RuleConstants.METADATA_005_PreviewImage_RawData_MustBeSet }); return(clue); }
protected override Clue MakeClueImpl([NotNull] Registrant input, Guid accountId) { if (input == null) { throw new ArgumentNullException(nameof(input)); } // TODO: Create clue specifying the type of entity it is and ID var id = string.Format("GoToWebinarRegistrant_{0}", input.RegistrantKey); var clue = _factory.Create(EntityType.Infrastructure.User, id, accountId); clue.ValidationRuleSupressions.Add(Constants.Validation.Rules.METADATA_003_Author_Name_MustBeSet); clue.ValidationRuleSupressions.Add(Constants.Validation.Rules.METADATA_002_Uri_MustBeSet); // TODO: Populate clue data var data = clue.Data.EntityData; data.Uri = new Uri(input.JoinUrl); data.Name = string.Format("{0} {1}", input.FirstName, input.LastName); data.CreatedDate = input.RegistrationDate; data.ModifiedDate = input.RegistrationDate; var vocab = new RegistrantVocabulary(); data.Properties[vocab.Email] = input.Email.PrintIfAvailable(); data.Properties[vocab.FirstName] = input.FirstName.PrintIfAvailable(); data.Properties[vocab.JoinUrl] = input.JoinUrl.PrintIfAvailable(); data.Properties[vocab.LastName] = input.LastName.PrintIfAvailable(); data.Properties[vocab.RegistrantKey] = input.RegistrantKey.PrintIfAvailable(); data.Properties[vocab.RegistrationDate] = input.RegistrationDate.PrintIfAvailable(); data.Properties[vocab.TimeZone] = input.TimeZone.PrintIfAvailable(); data.Properties[vocab.Status] = input.Status.PrintIfAvailable(); var hasConnection = false; if (!string.IsNullOrEmpty(input.WebinarId)) { hasConnection = true; var webinarId = string.Format("GoToWebinarWebinar_{0}", input.WebinarId); _factory.CreateOutgoingEntityReference(clue, EntityType.Discussion, "RegisteredTo", webinarId, webinarId); } if (!hasConnection) { _factory.CreateEntityRootReference(clue, "parent"); } return(clue); }