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] TimeEntry 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.Form, 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("https://harvestapp.com/time/"); data.CreatedDate = input.created_at; data.ModifiedDate = input.updated_at; data.Name = string.Format("Time entry by {0} {1}, for project: {2}", input.user.first_name, input.user.last_name, input.project.name); var vocab = new TimeEntryVocabulary(); if (input.invoice != null) { data.Properties[vocab.AssociatedInvoice] = ("https://harvestapp.com/time_entries/" + input.invoice.id.ToString().PrintIfAvailable()); } data.Properties[vocab.Billable] = input.billable.PrintIfAvailable(); data.Properties[vocab.BillableRate] = input.billable_rate.PrintIfAvailable(); data.Properties[vocab.ClientName] = input.client?.name.PrintIfAvailable(); data.Properties[vocab.CostRate] = input.cost_rate.PrintIfAvailable(); data.Properties[vocab.CountsInBudget] = input.budgeted.PrintIfAvailable(); data.Properties[vocab.Hours] = input.hours.PrintIfAvailable(); data.Properties[vocab.IsBilled] = input.is_billed.PrintIfAvailable(); data.Properties[vocab.IsClosed] = input.is_closed.PrintIfAvailable(); data.Properties[vocab.IsLocked] = input.is_locked.PrintIfAvailable(); data.Properties[vocab.LockedReason] = input.locked_reason.PrintIfAvailable(); data.Properties[vocab.Notes] = input.notes.PrintIfAvailable(); data.Properties[vocab.ProjectName] = input.project?.name.PrintIfAvailable(); DateTime date; DateTime.TryParse(input.spent_date, out date); data.Properties[vocab.SpentDate] = date.PrintIfAvailable(); data.Properties[vocab.TaskName] = input.task?.name.PrintIfAvailable(); data.Properties[vocab.UserName] = string.Format("{0} {1}", input.user?.first_name.PrintIfAvailable(), input.user?.last_name).PrintIfAvailable(); _factory.CreateOutgoingEntityReference(clue, EntityType.Person, EntityEdgeType.CreatedBy, input.user?.id.ToString(), input.user?.id.ToString()); _factory.CreateOutgoingEntityReference(clue, EntityType.Organization, EntityEdgeType.Involves, input.client?.id.ToString(), input.client?.id.ToString()); 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([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] UserAssignment 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.Activity, 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/projects/{0}?tab=tasks", input.project?.id)); if (input.user != null) { data.Name = string.Format("User assignment for {0} {1}", input.user.first_name, input.user.last_name); } else if (input.project != null) { data.Name = string.Format("User assignment, project: {0}", input.project.name); } else { data.Name = "User assignment"; } data.CreatedDate = input.created_at; data.ModifiedDate = input.updated_at; var vocab = new UserAssignmentVocabulary(); data.Properties[vocab.Budget] = input.budget.PrintIfAvailable(); data.Properties[vocab.HourlyRate] = input.hourly_rate.PrintIfAvailable(); data.Properties[vocab.IsActive] = input.is_active.PrintIfAvailable(); data.Properties[vocab.ProjectName] = input.project?.name.PrintIfAvailable(); data.Properties[vocab.IsProjectManager] = input.is_project_manager.PrintIfAvailable(); data.Properties[vocab.UserName] = (input.user?.first_name + " " + input.user?.last_name).PrintIfAvailable(); if (input.time_entry_ids != null) { foreach (var timeEntryId in input.time_entry_ids) { _factory.CreateOutgoingEntityReference(clue, EntityType.Form, EntityEdgeType.Has, timeEntryId.ToString(), timeEntryId.ToString()); } } _factory.CreateOutgoingEntityReference(clue, EntityType.Process, EntityEdgeType.PartOf, input.project?.id.ToString(), input.project?.id.ToString()); _factory.CreateOutgoingEntityReference(clue, EntityType.Person, EntityEdgeType.WorkedOnBy, input.user?.id.ToString(), input.user?.id.ToString()); 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([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(Report 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.LastViewedDate != null) { data.Properties[SalesforceVocabulary.Document.LastViewedDate] = DateUtilities.GetFormattedDateString(value.LastViewedDate); } _factory.CreateEntityRootReference(clue, EntityEdgeType.ManagedIn); 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.Document.SystemModstamp] = value.SystemModstamp; } return(clue); }
protected override Clue MakeClueImpl(PurchasingPurchaseOrderDetail input, Guid id) { var clue = _factory.Create("/PurchasingPurchaseOrderDetail", $"{input.PurchaseOrderID}.{input.PurchaseOrderDetailID}", id); var data = clue.Data.EntityData; //add edges if (input.PurchaseOrderID != null && !string.IsNullOrEmpty(input.PurchaseOrderID.ToString())) { _factory.CreateOutgoingEntityReference(clue, "/PurchasingPurchaseOrderHeader", EntityEdgeType.AttachedTo, input.PurchaseOrderID, input.PurchaseOrderID.ToString()); } if (input.ProductID != null && !string.IsNullOrEmpty(input.ProductID.ToString())) { _factory.CreateOutgoingEntityReference(clue, "/ProductionProduct", EntityEdgeType.AttachedTo, input.ProductID, input.ProductID.ToString()); } if (!data.OutgoingEdges.Any()) { _factory.CreateEntityRootReference(clue, EntityEdgeType.PartOf); } var vocab = new PurchasingPurchaseOrderDetailVocabulary(); data.Properties[vocab.PurchaseOrderID] = input.PurchaseOrderID.PrintIfAvailable(); data.Properties[vocab.PurchaseOrderDetailID] = input.PurchaseOrderDetailID.PrintIfAvailable(); data.Properties[vocab.DueDate] = input.DueDate.PrintIfAvailable(); data.Properties[vocab.OrderQty] = input.OrderQty.PrintIfAvailable(); data.Properties[vocab.ProductID] = input.ProductID.PrintIfAvailable(); data.Properties[vocab.UnitPrice] = input.UnitPrice.PrintIfAvailable(); data.Properties[vocab.LineTotal] = input.LineTotal.PrintIfAvailable(); data.Properties[vocab.ReceivedQty] = input.ReceivedQty.PrintIfAvailable(); data.Properties[vocab.RejectedQty] = input.RejectedQty.PrintIfAvailable(); data.Properties[vocab.StockedQty] = input.StockedQty.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(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(HumanResourcesEmployeeDepartmentHistory input, Guid id) { var clue = _factory.Create("/HumanResourcesEmployeeDepartmentHistory", $"{input.BusinessEntityID}.{input.DepartmentID}.{input.ShiftID}.{input.StartDate}", 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 (input.DepartmentID != null && !string.IsNullOrEmpty(input.DepartmentID.ToString())) { _factory.CreateOutgoingEntityReference(clue, "/HumanResourcesDepartment", EntityEdgeType.AttachedTo, input.DepartmentID, input.DepartmentID.ToString()); } if (input.ShiftID != null && !string.IsNullOrEmpty(input.ShiftID.ToString())) { _factory.CreateOutgoingEntityReference(clue, "/HumanResourcesShift", EntityEdgeType.AttachedTo, input.ShiftID, input.ShiftID.ToString()); } if (!data.OutgoingEdges.Any()) { _factory.CreateEntityRootReference(clue, EntityEdgeType.PartOf); } var vocab = new HumanResourcesEmployeeDepartmentHistoryVocabulary(); data.Properties[vocab.BusinessEntityID] = input.BusinessEntityID.PrintIfAvailable(); data.Properties[vocab.DepartmentID] = input.DepartmentID.PrintIfAvailable(); data.Properties[vocab.ShiftID] = input.ShiftID.PrintIfAvailable(); data.Properties[vocab.StartDate] = input.StartDate.PrintIfAvailable(); data.Properties[vocab.EndDate] = input.EndDate.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] TaskAssignment 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.Activity, 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; var uriString = "https://harvestapp.com/projects"; if (input.project != null) { uriString = string.Format("https://harvestapp.com/projects/{0}?tab=tasks", input.project?.id); } data.Uri = new Uri(uriString); data.Name = string.Format("Task assignment for: {0}", input.task.name); data.CreatedDate = input.created_at; data.ModifiedDate = input.updated_at; var vocab = new TaskAssignmentVocabulary(); data.Properties[vocab.Budget] = input.budget.PrintIfAvailable(); data.Properties[vocab.HourlyRate] = input.hourly_rate.PrintIfAvailable(); data.Properties[vocab.IsActive] = input.is_active.PrintIfAvailable(); data.Properties[vocab.IsBillable] = input.billable.PrintIfAvailable(); data.Properties[vocab.ProjectName] = input.project?.name.PrintIfAvailable(); if (input.time_entry_ids != null) { foreach (var timeEntryId in input.time_entry_ids) { _factory.CreateOutgoingEntityReference(clue, EntityType.Form, EntityEdgeType.Has, timeEntryId.ToString(), timeEntryId.ToString()); } } _factory.CreateOutgoingEntityReference(clue, EntityType.Process, EntityEdgeType.PartOf, input.project?.id.ToString(), input.project?.id.ToString()); _factory.CreateOutgoingEntityReference(clue, EntityType.Task, EntityEdgeType.Has, input.task?.id.ToString(), input.task?.id.ToString()); return(clue); }
protected override Clue MakeClueImpl(Interaction input, Guid accountId) { if (input == null) { throw new ArgumentNullException(nameof(input)); } var clue = _factory.Create(_vocabulary.Grouping, input.Id.ToString(), accountId); var data = clue.Data.EntityData; data.Name = data.DisplayName = input.ToString(); data.Properties[_vocabulary.StartDateTime] = input.StartDateTime.ToShortDateString(); data.Properties[_vocabulary.Duration] = input.Duration.TotalMinutes.ToString(); data.Properties[_vocabulary.Id] = input.Id.ToString(); data.Properties[_vocabulary.UserAgent] = input.UserAgent.PrintIfAvailable(); data.Properties[_vocabulary.EngagementValue] = input.EngagementValue.PrintIfAvailable(); clue.ValidationRuleSuppressions.AddRange(new[] { RuleConstants.METADATA_002_Uri_MustBeSet, RuleConstants.METADATA_003_Author_Name_MustBeSet, RuleConstants.METADATA_005_PreviewImage_RawData_MustBeSet }); _factory.CreateOutgoingEntityReference(clue, EntityType.Infrastructure.Contact, EntityEdgeType.RequestedBy, input.ContactId.ToString(), input.ContactId.ToString()); return(clue); }
protected override Clue MakeClueImpl(_SampleFile_ 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.File, input.Id.ToString(), accountId); // TODO: Populate clue data var data = clue.Data.EntityData; var vocab = new _SampleFile_Vocabulary(); data.Properties[vocab.Id] = input.Id.PrintIfAvailable(); data.Name = input.Name.PrintIfAvailable(); data.Properties[vocab.Name] = input.Name.PrintIfAvailable(); data.Uri = input.Uri; data.Properties[vocab.Uri] = input.Uri.ToString(); _factory.CreateOutgoingEntityReference(clue, EntityType.Files.Directory, EntityEdgeType.PartOf, input.FolderId.ToString(), input.FolderId.ToString()); clue.ValidationRuleSuppressions.AddRange(new[] { RuleConstants.DATA_001_File_MustBeIndexed, //TODO this should not be necessary - we are setting the URI RuleConstants.METADATA_002_Uri_MustBeSet, RuleConstants.METADATA_003_Author_Name_MustBeSet }); return(clue); }
protected override Clue MakeClueImpl([NotNull] AttendeeByMeeting 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("GoToMeetingAttendee_{0}_{1}", input.name, input.attendeeEmail); var clue = _factory.Create(EntityType.Infrastructure.User, id, accountId); clue.ValidationRuleSupressions.Add(Constants.Validation.Rules.METADATA_002_Uri_MustBeSet); // TODO: Populate clue dat6a var data = clue.Data.EntityData; data.DisplayName = input.attendeeName; data.Name = input.attendeeName; var vocab = new AttendeeVocabulary(); data.Properties[vocab.Email] = input.attendeeEmail.PrintIfAvailable(); _factory.CreateOutgoingEntityReference(clue, EntityType.Planning, EntityEdgeType.Attended, input.meetingId, input.meetingId.ToString()); return(clue); }
protected override Clue MakeClueImpl([NotNull] Role 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.Skill, 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 = input.name; // Each role does not have its own page data.Uri = new Uri("https://harvestapp.com/roles"); data.CreatedDate = input.created_at; data.ModifiedDate = input.updated_at; var vocab = new RoleVocabulary(); foreach (int usr in input.user_ids) { _factory.CreateOutgoingEntityReference(clue, EntityType.Person, EntityEdgeType.WorkedOnBy, usr.ToString(), usr.ToString()); } return(clue); }
protected override Clue MakeClueImpl(ProductionProductModelProductDescriptionCulture input, Guid id) { var clue = _factory.Create("/ProductionProductModelProductDescriptionCulture", $"{input.ProductModelID}.{input.ProductDescriptionID}.{input.CultureID}", id); var data = clue.Data.EntityData; //add edges if (input.ProductModelID != null && !string.IsNullOrEmpty(input.ProductModelID.ToString())) { _factory.CreateOutgoingEntityReference(clue, "/ProductionProductModel", EntityEdgeType.AttachedTo, input.ProductModelID, input.ProductModelID.ToString()); } if (input.ProductDescriptionID != null && !string.IsNullOrEmpty(input.ProductDescriptionID.ToString())) { _factory.CreateOutgoingEntityReference(clue, "/ProductionProductDescription", EntityEdgeType.AttachedTo, input.ProductDescriptionID, input.ProductDescriptionID.ToString()); } if (input.CultureID != null && !string.IsNullOrEmpty(input.CultureID.ToString())) { _factory.CreateOutgoingEntityReference(clue, "/ProductionCulture", EntityEdgeType.AttachedTo, input.CultureID, input.CultureID.ToString()); } if (!data.OutgoingEdges.Any()) { _factory.CreateEntityRootReference(clue, EntityEdgeType.PartOf); } var vocab = new ProductionProductModelProductDescriptionCultureVocabulary(); data.Properties[vocab.ProductModelID] = input.ProductModelID.PrintIfAvailable(); data.Properties[vocab.ProductDescriptionID] = input.ProductDescriptionID.PrintIfAvailable(); data.Properties[vocab.CultureID] = input.CultureID.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(SalesCurrencyRate input, Guid id) { var clue = _factory.Create("/SalesCurrencyRate", $"{input.CurrencyRateID}", id); var data = clue.Data.EntityData; //add edges if (input.FromCurrencyCode != null && !string.IsNullOrEmpty(input.FromCurrencyCode.ToString())) { _factory.CreateOutgoingEntityReference(clue, "/SalesCurrency", EntityEdgeType.AttachedTo, input.FromCurrencyCode, input.FromCurrencyCode.ToString()); } if (input.ToCurrencyCode != null && !string.IsNullOrEmpty(input.ToCurrencyCode.ToString())) { _factory.CreateOutgoingEntityReference(clue, "/SalesCurrency", EntityEdgeType.AttachedTo, input.ToCurrencyCode, input.ToCurrencyCode.ToString()); } if (!data.OutgoingEdges.Any()) { _factory.CreateEntityRootReference(clue, EntityEdgeType.PartOf); } var vocab = new SalesCurrencyRateVocabulary(); data.Properties[vocab.CurrencyRateID] = input.CurrencyRateID.PrintIfAvailable(); data.Properties[vocab.CurrencyRateDate] = input.CurrencyRateDate.PrintIfAvailable(); data.Properties[vocab.FromCurrencyCode] = input.FromCurrencyCode.PrintIfAvailable(); data.Properties[vocab.ToCurrencyCode] = input.ToCurrencyCode.PrintIfAvailable(); data.Properties[vocab.AverageRate] = input.AverageRate.PrintIfAvailable(); data.Properties[vocab.EndOfDayRate] = input.EndOfDayRate.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] ProjectAssignment 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.Activity, 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; var uriString = "https://harvestapp.com/projects/"; if (input.project != null) { uriString = string.Format("https://harvestapp.com/projects/{0}", input.project?.id.ToString()); } data.Uri = new Uri(uriString); data.Name = string.Format("Project assignment for: {0}, client: {1}", input.project?.name, input.client?.name); data.CreatedDate = input.created_at; data.ModifiedDate = input.updated_at; var vocab = new ProjectAssignmentVocabulary(); data.Properties[vocab.Budget] = input.budget.PrintIfAvailable(); data.Properties[vocab.ClientName] = input.client?.name.PrintIfAvailable(); data.Properties[vocab.HourlyRate] = input.hourly_rate.PrintIfAvailable(); data.Properties[vocab.IsActive] = input.is_active.PrintIfAvailable(); data.Properties[vocab.IsProjectManager] = input.is_project_manager.PrintIfAvailable(); data.Properties[vocab.ProjectName] = input.project?.name.PrintIfAvailable(); _factory.CreateOutgoingEntityReference(clue, EntityType.Project, EntityEdgeType.Has, input.project?.id.ToString(), input.project?.id.ToString()); _factory.CreateOutgoingEntityReference(clue, EntityType.Organization, EntityEdgeType.For, input.client?.id.ToString(), input.client?.id.ToString()); foreach (TaskAssignment tskAsg in input.task_assignments) { _factory.CreateOutgoingEntityReference(clue, EntityType.Activity, EntityEdgeType.Has, tskAsg.id.ToString(), tskAsg.id.ToString()); } return(clue); }
protected override Clue MakeClueImpl([NotNull] Appointment 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 AppointmentVocabulary(); data.Properties[vocab.Id] = input.Id.PrintIfAvailable(); data.Properties[vocab.ConsultantId] = input.ConsultantId.PrintIfAvailable(); data.Properties[vocab.End] = input.End.PrintIfAvailable(); data.Properties[vocab.LeadId] = input.LeadId.PrintIfAvailable(); data.Properties[vocab.Start] = input.Start.PrintIfAvailable(); data.Properties[vocab.Status] = input.Status.PrintIfAvailable(); if (!string.IsNullOrWhiteSpace(input.Status)) { data.Tags.Add(new Tag(input.Status)); } if (input.LeadId != default) { _factory.CreateOutgoingEntityReference(clue, EntityType.Sales.Lead, EntityEdgeType.PartOf, input, input.LeadId.ToString()); } if (input.ConsultantId != default) { _factory.CreateOutgoingEntityReference(clue, EntityType.Person, EntityEdgeType.PartOf, input, input.ConsultantId.ToString()); } 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(Site value, Guid id) { var clue = _factory.Create(EntityType.Infrastructure.Site, value.ID, id); var data = clue.Data.EntityData; if (value.Name != null) { data.Name = value.Name; data.DisplayName = value.Name; } //data.Uri = new Uri($"{this.state.JobData.Token.Data}/{value.ID}"); //data.Properties[SalesforceVocabulary.Site.EditUrl] = $"{this.state.JobData.Token.Data}/{value.ID}"; data.Properties[SalesforceVocabulary.Site.Status] = value.Status; 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); } data.ModifiedDate = DateTime.Parse(value.LastModifiedDate); data.Properties[SalesforceVocabulary.Site.SystemModstamp] = value.SystemModstamp; _factory.CreateEntityRootReference(clue, EntityEdgeType.ManagedIn); return(clue); }
protected override Clue MakeClueImpl([NotNull] Sale input, Guid accountId) { if (input == null) { throw new ArgumentNullException(nameof(input)); } var clue = _factory.Create(EntityType.Sales.Sale, input.Id.ToString(), accountId); var data = clue.Data.EntityData; if (!string.IsNullOrWhiteSpace(input.Id.ToString())) { data.Name = input.Id.ToString(); } var vocab = new SaleVocabulary(); data.Properties[vocab.CampaignId] = input.Campaignid.PrintIfAvailable(); data.Properties[vocab.Currency] = input.Currency.PrintIfAvailable(); data.Properties[vocab.Id] = input.Id.PrintIfAvailable(); data.Properties[vocab.LeadId] = input.Leadid.PrintIfAvailable(); data.Properties[vocab.Lines] = input.Lines.PrintIfAvailable(); data.Properties[vocab.State] = input.State.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 (!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)); } // 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] 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(SharedFolderMetadata input, Guid accountId) { if (input == null) { throw new ArgumentNullException(nameof(input)); } var clue = _factory.Create(EntityType.Files.Directory, input.SharedFolderId.ToString(CultureInfo.InvariantCulture), accountId); clue.ValidationRuleSuppressions.Add(Constants.Validation.Rules.METADATA_002_Uri_MustBeSet); var data = clue.Data.EntityData; if (input.Name != null) { data.Name = input.Name; data.DisplayName = input.Name; } if (input.OwnerTeam != null) { data.Properties[DropBoxVocabulary.SharedFolder.Owner] = input.OwnerTeam.Name; try { _factory.CreateOutgoingEntityReference(clue, EntityType.Infrastructure.Group, EntityEdgeType.Owns, input.OwnerTeam, input.OwnerTeam.Id); } catch (Exception) { _log.Warn(() => "Could not parse Owner for Dropbox Shared Folder"); } } if (input.PathLower != null) { data.Properties[DropBoxVocabulary.SharedFolder.FolderPath] = input.PathLower; } _factory.CreateOutgoingEntityReference(clue, EntityType.Provider.Root, EntityEdgeType.ManagedIn, _providerRoot, _providerRoot.OriginEntityCode.Value); 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] 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); }
protected override Clue MakeClueImpl([NotNull] CampaignEfficiency input, Guid accountId) { if (input == null) { throw new ArgumentNullException(nameof(input)); } var clue = _factory.Create("/CampaignEfficiency", string.Format("{0}|{1}|{2}|{3}", input.UserId, input.TotalConversationSeconds, input.TotalPauseSeconds, input.TotalWaitingSeconds), accountId); var data = clue.Data.EntityData; data.Name = input.UserId.ToString(); var vocab = new CampaignEfficiencyVocabulary(); data.Properties[vocab.UserId] = input.UserId.PrintIfAvailable(); data.Properties[vocab.TotalWaitingSeconds] = input.TotalWaitingSeconds.PrintIfAvailable(); data.Properties[vocab.TotalPauseSeconds] = input.TotalPauseSeconds.PrintIfAvailable(); data.Properties[vocab.TotalConversationSeconds] = input.TotalConversationSeconds.PrintIfAvailable(); if (input.UserId != default) { _factory.CreateOutgoingEntityReference(clue, EntityType.Infrastructure.User, EntityEdgeType.PartOf, input, input.UserId.ToString()); } 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); }