private static void AddUserExternalIds(MASchemaType type, IManagementAgentParameters config) { AdapterSubfield value = new AdapterSubfield { AttributeType = AttributeType.String, FieldName = "value", IsMultivalued = false, Operation = AttributeOperation.ImportExport, PropertyName = "Value", AttributeNamePart = null }; AdapterCustomTypeList <ExternalID> customType = new AdapterCustomTypeList <ExternalID> { Api = "user", AttributeName = "externalIds", Fields = new List <AdapterSubfield>() { value }, FieldName = "externalIds", PropertyName = "ExternalIds", KnownTypes = config.ExternalIDsAttributeFixedTypes?.ToList(), SupportsPatch = false }; type.AttributeAdapters.Add(customType); }
private void AddContactExternalIds(MASchemaType type, IManagementAgentParameters config) { AdapterSubfield value = new AdapterSubfield { AttributeType = AttributeType.String, FieldName = "value", IsMultivalued = false, Operation = AttributeOperation.ImportExport, PropertyName = "Value", AttributeNamePart = null }; AdapterGDataSimpleAttributeList <ExternalId> customType = new AdapterGDataSimpleAttributeList <ExternalId> { Api = "contact", AttributeName = "externalIds", Fields = new List <AdapterSubfield>() { value }, FieldName = "externalIds", PropertyName = "ExternalIds", KnownTypes = config.ExternalIDsAttributeFixedTypes?.ToList(), SupportsPatch = false, KnownRels = new HashSet <string>() { "account", "customer", "network", "organization" } }; type.AttributeAdapters.Add(customType); }
private static void AddUserPhonesAttributes(MASchemaType type, IManagementAgentParameters config) { AdapterSubfield phonesValue = new AdapterSubfield { AttributeType = AttributeType.String, FieldName = "value", IsMultivalued = false, Operation = AttributeOperation.ImportExport, PropertyName = "Value", AttributeNamePart = null }; AdapterCustomTypeList <Phone> phonesType = new AdapterCustomTypeList <Phone> { Api = "user", AttributeName = "phones", Fields = new List <AdapterSubfield>() { phonesValue }, FieldName = "phones", PropertyName = "Phones", IsPrimaryCandidateType = true, KnownTypes = config.PhonesAttributeFixedTypes?.ToList(), SupportsPatch = false }; type.AttributeAdapters.Add(phonesType); }
private void AddContactEmailAttributes(MASchemaType type, IManagementAgentParameters config) { AdapterSubfield address = new AdapterSubfield { AttributeType = AttributeType.String, FieldName = "address", IsMultivalued = false, Operation = AttributeOperation.ImportExport, PropertyName = "Address", AttributeNamePart = null }; AdapterGDataCommonAttributeList <EMail> customType = new AdapterGDataCommonAttributeList <EMail> { Api = "contact", AttributeName = "email", Fields = new List <AdapterSubfield>() { address }, FieldName = "email", PropertyName = "Emails", KnownTypes = config.EmailsAttributeFixedTypes?.ToList(), SupportsPatch = false, IsEmpty = (t) => string.IsNullOrWhiteSpace(t.Address), KnownRels = new Dictionary <string, string>() { { "http://schemas.google.com/g/2005#work", "work" }, { "http://schemas.google.com/g/2005#home", "home" }, { "http://schemas.google.com/g/2005#other", "other" } } }; type.AttributeAdapters.Add(customType); }
private void AddContactPhones(MASchemaType type, IManagementAgentParameters config) { AdapterSubfield phonesValue = new AdapterSubfield { AttributeType = AttributeType.String, FieldName = "value", IsMultivalued = false, Operation = AttributeOperation.ImportExport, PropertyName = "Value", AttributeNamePart = null }; AdapterGDataCommonAttributeList <PhoneNumber> phonesType = new AdapterGDataCommonAttributeList <PhoneNumber> { Api = "contact", AttributeName = "phones", Fields = new List <AdapterSubfield>() { phonesValue }, FieldName = "phones", PropertyName = "Phonenumbers", KnownTypes = config.PhonesAttributeFixedTypes?.ToList(), SupportsPatch = false, IsEmpty = (t) => string.IsNullOrWhiteSpace(t.Value), KnownRels = new Dictionary <string, string>() { { "http://schemas.google.com/g/2005#work_pager", "work_pager" }, { "http://schemas.google.com/g/2005#work_mobile", "work_mobile" }, { "http://schemas.google.com/g/2005#work", "work" }, { "http://schemas.google.com/g/2005#tty_tdd", "tty_tdd" }, { "http://schemas.google.com/g/2005#telex", "telex" }, { "http://schemas.google.com/g/2005#radio", "radio" }, { "http://schemas.google.com/g/2005#pager", "pager" }, { "http://schemas.google.com/g/2005#other_fax", "other_fax" }, { "http://schemas.google.com/g/2005#mobile", "mobile" }, { "http://schemas.google.com/g/2005#main", "main" }, { "http://schemas.google.com/g/2005#isdn", "isdn" }, { "http://schemas.google.com/g/2005#home_fax", "home_fax" }, { "http://schemas.google.com/g/2005#home", "home" }, { "http://schemas.google.com/g/2005#fax", "fax" }, { "http://schemas.google.com/g/2005#company_main", "company_main" }, { "http://schemas.google.com/g/2005#car", "car" }, { "http://schemas.google.com/g/2005#callback", "callback" }, { "http://schemas.google.com/g/2005#assistant", "assistant" }, } }; type.AttributeAdapters.Add(phonesType); }
private void AddContactNames(MASchemaType type) { AdapterSubfield givenName = new AdapterSubfield { AttributeType = AttributeType.String, FieldName = "givenName", IsMultivalued = false, Operation = AttributeOperation.ImportExport, PropertyName = "GivenName", AttributeNamePart = "givenName", NullValueRepresentation = NullValueRepresentation.NullPlaceHolder }; AdapterSubfield familyName = new AdapterSubfield { AttributeType = AttributeType.String, FieldName = "familyName", IsMultivalued = false, PropertyName = "FamilyName", Operation = AttributeOperation.ImportExport, AttributeNamePart = "familyName", NullValueRepresentation = NullValueRepresentation.NullPlaceHolder }; AdapterSubfield fullName = new AdapterSubfield { AttributeType = AttributeType.String, FieldName = "fullName", IsMultivalued = false, PropertyName = "FullName", Operation = AttributeOperation.ImportExport, AttributeNamePart = "fullName", NullValueRepresentation = NullValueRepresentation.NullPlaceHolder }; AdapterNestedType schemaItem = new AdapterNestedType { Api = "contact", AttributeName = "name", Fields = new List <AdapterSubfield>() { givenName, familyName, fullName }, FieldName = "name", PropertyName = "Name", SupportsPatch = false }; type.AttributeAdapters.Add(schemaItem); }
private void AddContactIms(MASchemaType type, IManagementAgentParameters config) { AdapterSubfield im = new AdapterSubfield { AttributeType = AttributeType.String, FieldName = "address", IsMultivalued = false, Operation = AttributeOperation.ImportExport, PropertyName = "Address", AttributeNamePart = "address" }; AdapterSubfield protocol = new AdapterSubfield { AttributeType = AttributeType.String, FieldName = "protocol", IsMultivalued = false, Operation = AttributeOperation.ImportExport, PropertyName = "Protocol", AttributeNamePart = "protocol" }; AdapterGDataCommonAttributeList <IMAddress> customType = new AdapterGDataCommonAttributeList <IMAddress> { Api = "contact", AttributeName = "ims", Fields = new List <AdapterSubfield>() { im, protocol }, FieldName = "ims", PropertyName = "IMs", KnownTypes = config.IMsAttributeFixedTypes?.ToList(), SupportsPatch = false, IsEmpty = (t) => string.IsNullOrWhiteSpace(t.Address), KnownRels = new Dictionary <string, string>() { { "http://schemas.google.com/g/2005#work", "work" }, { "http://schemas.google.com/g/2005#netmeeting", "netmeeting" }, { "http://schemas.google.com/g/2005#home", "home" } } }; type.AttributeAdapters.Add(customType); }
private static void AddUserIms(MASchemaType type, IManagementAgentParameters config) { AdapterSubfield im = new AdapterSubfield { AttributeType = AttributeType.String, FieldName = "im", IsMultivalued = false, Operation = AttributeOperation.ImportExport, PropertyName = "IMAddress", AttributeNamePart = "address" }; AdapterSubfield protocol = new AdapterSubfield { AttributeType = AttributeType.String, FieldName = "protocol", IsMultivalued = false, Operation = AttributeOperation.ImportExport, PropertyName = "Protocol", AttributeNamePart = "protocol" }; AdapterCustomTypeList <IM> customType = new AdapterCustomTypeList <IM> { Api = "user", AttributeName = "ims", Fields = new List <AdapterSubfield>() { im, protocol }, FieldName = "ims", PropertyName = "Ims", IsPrimaryCandidateType = true, KnownTypes = config.IMsAttributeFixedTypes?.ToList(), SupportsPatch = false }; type.AttributeAdapters.Add(customType); }
private static void AddUserWebSites(MASchemaType type, IManagementAgentParameters config) { AdapterSubfield webSiteValue = new AdapterSubfield { AttributeType = AttributeType.String, FieldName = "value", IsMultivalued = false, Operation = AttributeOperation.ImportExport, PropertyName = "Value", AttributeNamePart = null }; AdapterSubfield webSitePrimary = new AdapterSubfield { AttributeType = AttributeType.Boolean, FieldName = "primary", IsMultivalued = false, PropertyName = "Primary", Operation = AttributeOperation.ImportExport, AttributeNamePart = "primary" }; AdapterCustomTypeList <ManagedObjects.Website> webSiteType = new AdapterCustomTypeList <Website> { Api = "user", AttributeName = "websites", Fields = new List <AdapterSubfield>() { webSitePrimary, webSiteValue }, FieldName = "websites", PropertyName = "Websites", IsPrimaryCandidateType = true, KnownTypes = config.WebsitesAttributeFixedTypes?.ToList(), SupportsPatch = false }; type.AttributeAdapters.Add(webSiteType); }
private static void AddUserNotes(MASchemaType type) { AdapterSubfield notesValue = new AdapterSubfield { AttributeType = AttributeType.String, FieldName = "value", IsMultivalued = false, Operation = AttributeOperation.ImportExport, PropertyName = "Value", AttributeNamePart = "value", NullValueRepresentation = NullValueRepresentation.NullPlaceHolder }; AdapterSubfield notesContentType = new AdapterSubfield { AttributeType = AttributeType.String, FieldName = "contentType", IsMultivalued = false, PropertyName = "ContentType", Operation = AttributeOperation.ImportExport, AttributeNamePart = "contentType", NullValueRepresentation = NullValueRepresentation.NullPlaceHolder }; AdapterNestedType notesType = new AdapterNestedType { Api = "user", AttributeName = "notes", Fields = new List <AdapterSubfield>() { notesContentType, notesValue }, FieldName = "notes", PropertyName = "Notes", SupportsPatch = false }; type.AttributeAdapters.Add(notesType); }
public IEnumerable <MASchemaType> GetSchemaTypes(IManagementAgentParameters config) { MASchemaType type = new MASchemaType { AttributeAdapters = new List <IAttributeAdapter>(), Name = "building", AnchorAttributeNames = new[] { "id" }, SupportsPatch = true, }; type.ApiInterface = new ApiInterfaceBuilding(config.CustomerID, type, config); type.AttributeAdapters.Add(new AdapterPropertyValue { AttributeType = AttributeType.String, FieldName = "buildingId", IsMultivalued = false, Operation = AttributeOperation.ImportOnly, AttributeName = "id", PropertyName = "BuildingId", Api = "building", SupportsPatch = true, IsAnchor = true }); type.AttributeAdapters.Add(new AdapterPropertyValue { AttributeType = AttributeType.String, FieldName = "buildingName", IsMultivalued = false, Operation = AttributeOperation.ImportExport, AttributeName = "buildingName", PropertyName = "BuildingName", Api = "building", SupportsPatch = true, NullValueRepresentation = NullValueRepresentation.EmptyString, IsAnchor = false }); type.AttributeAdapters.Add(new AdapterPropertyValue { AttributeType = AttributeType.String, FieldName = "description", IsMultivalued = false, Operation = AttributeOperation.ImportExport, AttributeName = "description", PropertyName = "Description", Api = "building", SupportsPatch = true, NullValueRepresentation = NullValueRepresentation.EmptyString, IsAnchor = false }); type.AttributeAdapters.Add(new AdapterPropertyValue { AttributeType = AttributeType.String, FieldName = "floorNames", IsMultivalued = false, Operation = AttributeOperation.ImportExport, AttributeName = "floorNames", PropertyName = "FloorNames", Api = "building", SupportsPatch = true, NullValueRepresentation = NullValueRepresentation.EmptyString, CastForExport = i => ((string)i)?.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).ToList(), CastForImport = i => i == null ? null : string.Join(",", ((IList <string>)i)), IsAnchor = false }); AdapterSubfield latitude = new AdapterSubfield { AttributeType = AttributeType.String, FieldName = "latitude", IsMultivalued = false, Operation = AttributeOperation.ImportExport, PropertyName = "Latitude", AttributeNamePart = "latitude", NullValueRepresentation = NullValueRepresentation.DoubleZero, CastForExport = value => { if (value == null) { return(null); } return(double.Parse(value.ToString())); }, CastForImport = value => ((double?)value)?.ToString("R") }; AdapterSubfield longitude = new AdapterSubfield { AttributeType = AttributeType.String, FieldName = "longitude", IsMultivalued = false, PropertyName = "Longitude", Operation = AttributeOperation.ImportExport, AttributeNamePart = "longitude", NullValueRepresentation = NullValueRepresentation.DoubleZero, CastForExport = value => { if (value == null) { return(null); } return(double.Parse(value.ToString())); }, CastForImport = value => ((double?)value)?.ToString("R") }; AdapterNestedType schemaItem = new AdapterNestedType { Api = "building", AttributeName = "coordinates", Fields = new List <AdapterSubfield>() { latitude, longitude }, FieldName = "coordinates", PropertyName = "Coordinates", SupportsPatch = false }; type.AttributeAdapters.Add(schemaItem); yield return(type); }
private static void AddUserAddresses(MASchemaType type, IManagementAgentParameters config) { AdapterSubfield sourceIsStructured = new AdapterSubfield { AttributeType = AttributeType.Boolean, FieldName = "sourceIsStructured", IsMultivalued = false, Operation = AttributeOperation.ImportExport, PropertyName = "SourceIsStructured", AttributeNamePart = "sourceIsStructured" }; AdapterSubfield formatted = new AdapterSubfield { AttributeType = AttributeType.String, FieldName = "formatted", IsMultivalued = false, PropertyName = "Formatted", Operation = AttributeOperation.ImportExport, AttributeNamePart = "formatted" }; AdapterSubfield poBox = new AdapterSubfield { AttributeType = AttributeType.String, FieldName = "poBox", IsMultivalued = false, PropertyName = "POBox", Operation = AttributeOperation.ImportExport, AttributeNamePart = "poBox" }; AdapterSubfield extendedAddress = new AdapterSubfield { AttributeType = AttributeType.String, FieldName = "extendedAddress", IsMultivalued = false, PropertyName = "ExtendedAddress", Operation = AttributeOperation.ImportExport, AttributeNamePart = "extendedAddress" }; AdapterSubfield streetAddress = new AdapterSubfield { AttributeType = AttributeType.String, FieldName = "streetAddress", IsMultivalued = false, PropertyName = "StreetAddress", Operation = AttributeOperation.ImportExport, AttributeNamePart = "streetAddress" }; AdapterSubfield locality = new AdapterSubfield { AttributeType = AttributeType.String, FieldName = "locality", IsMultivalued = false, PropertyName = "Locality", Operation = AttributeOperation.ImportExport, AttributeNamePart = "locality" }; AdapterSubfield region = new AdapterSubfield { AttributeType = AttributeType.String, FieldName = "region", IsMultivalued = false, PropertyName = "Region", Operation = AttributeOperation.ImportExport, AttributeNamePart = "region" }; AdapterSubfield postalCode = new AdapterSubfield { AttributeType = AttributeType.String, FieldName = "postalCode", IsMultivalued = false, PropertyName = "PostalCode", Operation = AttributeOperation.ImportExport, AttributeNamePart = "postalCode" }; AdapterSubfield country = new AdapterSubfield { AttributeType = AttributeType.String, FieldName = "country", IsMultivalued = false, PropertyName = "Country", Operation = AttributeOperation.ImportExport, AttributeNamePart = "country" }; AdapterSubfield countryCode = new AdapterSubfield { AttributeType = AttributeType.String, FieldName = "countryCode", IsMultivalued = false, PropertyName = "CountryCode", Operation = AttributeOperation.ImportExport, AttributeNamePart = "countryCode" }; AdapterCustomTypeList <Address> customType = new AdapterCustomTypeList <Address> { Api = "user", AttributeName = "addresses", Fields = new List <AdapterSubfield>() { sourceIsStructured, formatted, poBox, extendedAddress, streetAddress, locality, region, postalCode, country, countryCode }, FieldName = "addresses", PropertyName = "Addresses", IsPrimaryCandidateType = true, KnownTypes = config.AddressesAttributeFixedTypes?.ToList(), SupportsPatch = false }; type.AttributeAdapters.Add(customType); }
private static void AddUserOrganizationsAttributes(MASchemaType type, IManagementAgentParameters config) { AdapterSubfield name = new AdapterSubfield { AttributeType = AttributeType.String, FieldName = "name", IsMultivalued = false, Operation = AttributeOperation.ImportExport, PropertyName = "Name", AttributeNamePart = "name" }; AdapterSubfield title = new AdapterSubfield { AttributeType = AttributeType.String, FieldName = "title", IsMultivalued = false, PropertyName = "Title", Operation = AttributeOperation.ImportExport, AttributeNamePart = "title" }; AdapterSubfield department = new AdapterSubfield { AttributeType = AttributeType.String, FieldName = "department", IsMultivalued = false, PropertyName = "Department", Operation = AttributeOperation.ImportExport, AttributeNamePart = "department" }; AdapterSubfield symbol = new AdapterSubfield { AttributeType = AttributeType.String, FieldName = "symbol", IsMultivalued = false, PropertyName = "Symbol", Operation = AttributeOperation.ImportExport, AttributeNamePart = "symbol" }; AdapterSubfield location = new AdapterSubfield { AttributeType = AttributeType.String, FieldName = "location", IsMultivalued = false, PropertyName = "Location", Operation = AttributeOperation.ImportExport, AttributeNamePart = "location" }; AdapterSubfield description = new AdapterSubfield { AttributeType = AttributeType.String, FieldName = "description", IsMultivalued = false, PropertyName = "Description", Operation = AttributeOperation.ImportExport, AttributeNamePart = "description" }; AdapterSubfield domain = new AdapterSubfield { AttributeType = AttributeType.String, FieldName = "domain", IsMultivalued = false, PropertyName = "Domain", Operation = AttributeOperation.ImportExport, AttributeNamePart = "domain" }; AdapterSubfield costCenter = new AdapterSubfield { AttributeType = AttributeType.String, FieldName = "costCenter", IsMultivalued = false, PropertyName = "CostCenter", Operation = AttributeOperation.ImportExport, AttributeNamePart = "costCenter" }; AdapterCustomTypeList <ManagedObjects.Organization> customType = new AdapterCustomTypeList <ManagedObjects.Organization> { Api = "user", AttributeName = "organizations", Fields = new List <AdapterSubfield>() { name, title, department, symbol, location, description, domain, costCenter }, FieldName = "organizations", PropertyName = "Organizations", IsPrimaryCandidateType = true, KnownTypes = config.OrganizationsAttributeFixedTypes?.ToList(), SupportsPatch = false }; type.AttributeAdapters.Add(customType); }
private void AddContactOrganizationsAttributes(MASchemaType type, IManagementAgentParameters config) { AdapterSubfield name = new AdapterSubfield { AttributeType = AttributeType.String, FieldName = "orgName", IsMultivalued = false, Operation = AttributeOperation.ImportExport, PropertyName = "Name", AttributeNamePart = "name" }; AdapterSubfield title = new AdapterSubfield { AttributeType = AttributeType.String, FieldName = "orgTitle", IsMultivalued = false, PropertyName = "Title", Operation = AttributeOperation.ImportExport, AttributeNamePart = "title" }; AdapterSubfield department = new AdapterSubfield { AttributeType = AttributeType.String, FieldName = "orgDepartment", IsMultivalued = false, PropertyName = "Department", Operation = AttributeOperation.ImportExport, AttributeNamePart = "department" }; AdapterSubfield symbol = new AdapterSubfield { AttributeType = AttributeType.String, FieldName = "orgSymbol", IsMultivalued = false, PropertyName = "Symbol", Operation = AttributeOperation.ImportExport, AttributeNamePart = "symbol" }; AdapterSubfield jobDescription = new AdapterSubfield { AttributeType = AttributeType.String, FieldName = "orgJobDescription", IsMultivalued = false, PropertyName = "JobDescription", Operation = AttributeOperation.ImportExport, AttributeNamePart = "jobDescription" }; AdapterSubfield location = new AdapterSubfield { AttributeType = AttributeType.String, FieldName = "where", IsMultivalued = false, PropertyName = "Location", Operation = AttributeOperation.ImportExport, AttributeNamePart = "location" }; AdapterGDataCommonAttributeList <Organization> customType = new AdapterGDataCommonAttributeList <Organization> { Api = "contact", AttributeName = "organizations", Fields = new List <AdapterSubfield>() { name, title, department, symbol, location, jobDescription }, FieldName = "organizations", PropertyName = "Organizations", KnownTypes = config.OrganizationsAttributeFixedTypes?.ToList(), SupportsPatch = false, IsEmpty = (t) => { return(string.IsNullOrWhiteSpace(t.Department) && string.IsNullOrWhiteSpace(t.JobDescription) && string.IsNullOrWhiteSpace(t.Name) && string.IsNullOrWhiteSpace(t.Title) && string.IsNullOrWhiteSpace(t.Symbol) && string.IsNullOrWhiteSpace(t.Location)); }, KnownRels = new Dictionary <string, string>() { { "http://schemas.google.com/g/2005#work", "work" } } }; type.AttributeAdapters.Add(customType); }