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(EmailPerson input, Guid accountId) { if (input == null) { throw new ArgumentNullException(nameof(input)); } var clue = _factory.Create(EntityType.Person, input.email, accountId); clue.ValidationRuleSuppressions.Add(Constants.Validation.Rules.ENTITYTYPE_001_Person_MustNotBeUsedDirectly); var data = clue.Data.EntityData; data.Name = string.IsNullOrWhiteSpace(input.firstName + input.lastName) ? input.email : $"{input.firstName} {input.lastName}"; data.Aliases.Add(input.email); data.Properties[HubSpotVocabulary.EmailPerson.Email] = input.email; data.Properties[HubSpotVocabulary.EmailPerson.FirstName] = input.firstName; data.Properties[HubSpotVocabulary.EmailPerson.LastName] = input.lastName; if (input.lastName != null) { data.Name = input.firstName != null ? $"{input.firstName} {input.lastName}" : input.lastName; } else { data.Name = input.email; } 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(SiteMap input, Guid accountId) { if (input == null) { throw new ArgumentNullException(nameof(input)); } var clue = _factory.Create(EntityType.News, input.id.ToString(), accountId); clue.ValidationRuleSuppressions.Add(Constants.Validation.Rules.EDGES_001_Outgoing_Edge_MustExist); clue.ValidationRuleSuppressions.Add(Constants.Validation.Rules.EDGES_002_Incoming_Edge_ShouldNotExist); clue.ValidationRuleSuppressions.Add(Constants.Validation.Rules.METADATA_002_Uri_MustBeSet); var data = clue.Data.EntityData; data.Name = input.name; data.Properties[HubSpotVocabulary.SiteMap.Created] = input.created.PrintIfAvailable(); data.Properties[HubSpotVocabulary.SiteMap.DeletedAt] = input.deleted_at.PrintIfAvailable(); data.Properties[HubSpotVocabulary.SiteMap.PagesTree] = input.pages_tree.PrintIfAvailable(JsonUtility.Serialize); data.Properties[HubSpotVocabulary.SiteMap.PortalId] = input.portal_id.PrintIfAvailable(); data.Properties[HubSpotVocabulary.SiteMap.Updated] = input.updated.PrintIfAvailable(); 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(ReturnMessage 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.Key.ToString(), accountId); // TODO: Populate clue data var data = clue.Data.EntityData; var vocab = new _SampleFile_Vocabulary(); data.Name = input.Value.PrintIfAvailable(); 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(Keyword value, Guid accountId) { if (value == null) { throw new ArgumentNullException(nameof(value)); } var clue = _factory.Create(EntityType.Tag, value.keyword_guid, accountId); clue.ValidationRuleSuppressions.Add(CluedIn.Core.Constants.Validation.Rules.EDGES_001_Outgoing_Edge_MustExist); clue.ValidationRuleSuppressions.Add(CluedIn.Core.Constants.Validation.Rules.EDGES_002_Incoming_Edge_ShouldNotExist); var data = clue.Data.EntityData; data.Name = value.keyword; data.CreatedDate = DateUtilities.EpochRef.AddMilliseconds(value.created_at); data.Properties[HubSpotVocabulary.Keyword.Contacts] = value.contacts.PrintIfAvailable(); data.Properties[HubSpotVocabulary.Keyword.Country] = value.country.PrintIfAvailable(); data.Properties[HubSpotVocabulary.Keyword.Leads] = value.leads.PrintIfAvailable(); data.Properties[HubSpotVocabulary.Keyword.Visits] = value.visits.PrintIfAvailable(); return(clue); }
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(BroadcastMessage input, Guid accountId) { if (input == null) { throw new ArgumentNullException(nameof(input)); } var clue = _factory.Create(EntityType.Announcement, input.broadcastGuid, accountId); clue.ValidationRuleSuppressions.Add(Constants.Validation.Rules.EDGES_001_Outgoing_Edge_MustExist); clue.ValidationRuleSuppressions.Add(Constants.Validation.Rules.EDGES_002_Incoming_Edge_ShouldNotExist); clue.ValidationRuleSuppressions.Add(Constants.Validation.Rules.METADATA_002_Uri_MustBeSet); clue.ValidationRuleSuppressions.Add(Constants.Validation.Rules.METADATA_001_Name_MustBeSet); clue.ValidationRuleSuppressions.Add(Constants.Validation.Rules.PROPERTIES_003_Value_ShouldNotBeQuoted); var data = clue.Data.EntityData; data.Name = input.message; if (input.createdAt != null) { data.CreatedDate = DateUtilities.EpochRef.AddMilliseconds(input.createdAt.Value); } if (input.messageUrl != null && Uri.TryCreate(input.messageUrl, UriKind.Absolute, out var uri)) { data.Uri = uri; } data.Properties[HubSpotVocabulary.Broadcast.BroadcastGuid] = input.broadcastGuid; data.Properties[HubSpotVocabulary.Broadcast.CampaignGuid] = input.campaignGuid; data.Properties[HubSpotVocabulary.Broadcast.Clicks] = input.clicks.PrintIfAvailable(); data.Properties[HubSpotVocabulary.Broadcast.ClientTag] = input.clientTag.PrintIfAvailable(JsonUtility.Serialize);; data.Properties[HubSpotVocabulary.Broadcast.CreatedBy] = input.createdBy.PrintIfAvailable(); data.Properties[HubSpotVocabulary.Broadcast.FinishedAt] = input.finishedAt.PrintIfAvailable(v => DateUtilities.EpochRef.AddMilliseconds(v.Value)); data.Properties[HubSpotVocabulary.Broadcast.ForeignId] = input.foreignId; data.Properties[HubSpotVocabulary.Broadcast.GroupGuid] = input.groupGuid; data.Properties[HubSpotVocabulary.Broadcast.InteractionCounts] = input.interactionCounts.PrintIfAvailable(JsonUtility.Serialize); data.Properties[HubSpotVocabulary.Broadcast.Interactions] = input.interactions.PrintIfAvailable(JsonUtility.Serialize); data.Properties[HubSpotVocabulary.Broadcast.LinkGuid] = input.linkGuid; data.Properties[HubSpotVocabulary.Broadcast.LinkTaskQueueId] = input.linkTaskQueueId; data.Properties[HubSpotVocabulary.Broadcast.RemoteContentId] = input.remoteContentId.PrintIfAvailable(); data.Properties[HubSpotVocabulary.Broadcast.RemoteContentType] = input.remoteContentType.PrintIfAvailable(); data.Properties[HubSpotVocabulary.Broadcast.Status] = input.status; data.Properties[HubSpotVocabulary.Broadcast.TaskQueued] = input.taskQueueId; data.Properties[HubSpotVocabulary.Broadcast.TriggerAt] = input.triggerAt.PrintIfAvailable(v => DateUtilities.EpochRef.AddMilliseconds(v.Value)); data.Properties[HubSpotVocabulary.Broadcast.UpdatedBy] = input.updatedBy.PrintIfAvailable(); if (input.channelGuid != null) { _factory.CreateIncomingEntityReference(clue, EntityType.Channel, EntityEdgeType.PartOf, input, s => s.channelGuid); } if (input.portalId != null) { _factory.CreateIncomingEntityReference(clue, EntityType.Infrastructure.Site, EntityEdgeType.PartOf, input, s => s.portalId.ToString(), s => "HubSpot"); } return(clue); }
protected override Clue MakeClueImpl([NotNull] EstimateItemCategory 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; // Estimate messages has no uri data.Uri = new Uri("https://harvestapp.com/estimates/configure/item_categories"); data.Name = input.name; data.CreatedDate = input.created_at; data.ModifiedDate = input.updated_at; var vocab = new EstimateItemCategoryVocabulary(); //_factory.CreateOutgoingEntityReference(clue, EntityType.Person, EntityEdgeType.AttachedTo, item.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(UrlMapping value, Guid accountId) { if (value == null) { throw new ArgumentNullException(nameof(value)); } var clue = _factory.Create(EntityType.Note, value.id.ToString(), accountId); clue.ValidationRuleSuppressions.Add(Constants.Validation.Rules.EDGES_001_Outgoing_Edge_MustExist); clue.ValidationRuleSuppressions.Add(Constants.Validation.Rules.EDGES_002_Incoming_Edge_ShouldNotExist); clue.ValidationRuleSuppressions.Add(Constants.Validation.Rules.METADATA_002_Uri_MustBeSet); clue.ValidationRuleSuppressions.Add(Constants.Validation.Rules.METADATA_001_Name_MustBeSet); var data = clue.Data.EntityData; data.Name = value.name; data.Properties[HubSpotVocabulary.UrlMapping.ContentGroupId] = value.contentGroupId.PrintIfAvailable(); data.Properties[HubSpotVocabulary.UrlMapping.Created] = value.created.PrintIfAvailable(); data.Properties[HubSpotVocabulary.UrlMapping.DeletedAt] = value.deletedAt.PrintIfAvailable(); data.Properties[HubSpotVocabulary.UrlMapping.Destination] = value.destination; data.Properties[HubSpotVocabulary.UrlMapping.IsMatchFullUrl] = value.isMatchFullUrl.PrintIfAvailable(); data.Properties[HubSpotVocabulary.UrlMapping.IsMatchQueryString] = value.isMatchQueryString.PrintIfAvailable(); data.Properties[HubSpotVocabulary.UrlMapping.IsOnlyAfterNotFound] = value.isOnlyAfterNotFound.PrintIfAvailable(); data.Properties[HubSpotVocabulary.UrlMapping.IsPattern] = value.isPattern.PrintIfAvailable(); data.Properties[HubSpotVocabulary.UrlMapping.IsRegex] = value.isRegex.PrintIfAvailable(); data.Properties[HubSpotVocabulary.UrlMapping.PortalId] = value.portalId.PrintIfAvailable(); data.Properties[HubSpotVocabulary.UrlMapping.Precedence] = value.precedence.PrintIfAvailable(); data.Properties[HubSpotVocabulary.UrlMapping.RedirectStyle] = value.redirectStyle.PrintIfAvailable(); data.Properties[HubSpotVocabulary.UrlMapping.RoutePrefix] = value.routePrefix; data.Properties[HubSpotVocabulary.UrlMapping.Updated] = value.updated.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(SmtpToken input, Guid accountId) { if (input == null) { throw new ArgumentNullException(nameof(input)); } var clue = _factory.Create(EntityType.Activity, input.emailCampaignId.ToString(), accountId); clue.ValidationRuleSuppressions.Add(CluedIn.Core.Constants.Validation.Rules.EDGES_001_Outgoing_Edge_MustExist); clue.ValidationRuleSuppressions.Add(CluedIn.Core.Constants.Validation.Rules.EDGES_002_Incoming_Edge_ShouldNotExist); var data = clue.Data.EntityData; data.Properties[HubSpotVocabulary.SmtpToken.AppId] = input.appId.PrintIfAvailable(); data.Properties[HubSpotVocabulary.SmtpToken.CampaignName] = input.campaignName; data.Properties[HubSpotVocabulary.SmtpToken.CreatedAt] = input.createdAt.PrintIfAvailable(); data.Properties[HubSpotVocabulary.SmtpToken.CreatedBy] = input.createdBy; data.Properties[HubSpotVocabulary.SmtpToken.Deleted] = input.deleted.PrintIfAvailable(); data.Properties[HubSpotVocabulary.SmtpToken.EmailCampaignId] = input.emailCampaignId.PrintIfAvailable(); data.Properties[HubSpotVocabulary.SmtpToken.PortalId] = input.portalId.PrintIfAvailable(); data.Properties[HubSpotVocabulary.SmtpToken.UserName] = input.userName; 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(EngagementObject input, Guid accountId) { if (input == null) { throw new ArgumentNullException(nameof(input)); } var clue = _factory.Create(EntityType.Activity, input.engagement.id.ToString(), accountId); clue.ValidationRuleSuppressions.Add(Constants.Validation.Rules.METADATA_001_Name_MustBeSet); var data = clue.Data.EntityData; data.Name = input.metadata.body ?? $"{input.engagement.type ?? "Engagement " + input.engagement.id}"; data.CreatedDate = DateUtilities.EpochRef.AddMilliseconds(input.engagement.createdAt); data.ModifiedDate = DateUtilities.EpochRef.AddMilliseconds(input.engagement.lastUpdated); data.Properties[HubSpotVocabulary.Engagement.Active] = input.engagement.active.PrintIfAvailable(); data.Properties[HubSpotVocabulary.Engagement.TimeStamp] = input.engagement.timestamp.PrintIfAvailable(v => DateUtilities.EpochRef.AddMilliseconds(v)); data.Properties[HubSpotVocabulary.Engagement.Type] = input.engagement.type; if (input.engagement.ownerId != null) { _factory.CreateIncomingEntityReference(clue, EntityType.Person, EntityEdgeType.Owns, input, s => s.engagement.ownerId.Value.ToString()); } if (input.engagement.portalId != null) { _factory.CreateIncomingEntityReference(clue, EntityType.Infrastructure.Site, EntityEdgeType.PartOf, input, s => s.engagement.portalId.ToString(), s => "Hubspot"); } 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([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] 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(_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(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(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(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(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(FolderMetadata input, Guid accountId) { if (input == null) { throw new ArgumentNullException(nameof(input)); } var type = input.IsFolder ? EntityType.Files.Directory : EntityType.Files.File; var clue = _factory.Create(type, input.PathLower, accountId); var data = clue.Data.EntityData; if (input.Name != null) { if (input.PathLower == "/") { data.Name = input.Name; data.DisplayName = "Root Folder"; data.Properties[DropBoxVocabulary.File.ItemName] = "Root Folder"; _factory.CreateOutgoingEntityReference(clue, EntityType.Files.Directory, EntityEdgeType.Parent, _providerRoot, _providerRoot.Id.ToString()); } else { data.Name = input.Name; data.DisplayName = input.Name; data.Properties[DropBoxVocabulary.Folder.ItemName] = input.Name; } } try { data.Uri = _uriBuilder.GetUri(input); } catch (Exception exc) { _log.Warn(() => "Could not create Uri for Dropbox File", exc); //Handle error } data.Properties[DropBoxVocabulary.Folder.IsDeleted] = input.IsDeleted.ToString(); data.Properties[DropBoxVocabulary.Folder.IsDirectory] = input.IsFolder.ToString(); if (input.PathLower != null) { if (input.PathLower != "/") { data.Properties[DropBoxVocabulary.Folder.Path] = input.PathLower; _factory.CreateOutgoingEntityReference(clue, EntityType.Files.Directory, EntityEdgeType.Parent, input, "/" + VirtualPathUtility.GetDirectory(input.PathLower).Trim(_trimChars)); } } if (input.ParentSharedFolderId != null) { data.Properties[DropBoxVocabulary.File.ParentSharedFolderId] = input.ParentSharedFolderId; } _factory.CreateOutgoingEntityReference(clue, EntityType.Provider.Root, EntityEdgeType.ManagedIn, _providerRoot, _providerRoot.OriginEntityCode.Value); 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] 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] 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); }