Search in sources :

Example 1 with PropertyType

use of org.apache.unomi.api.PropertyType in project unomi by apache.

the class CopyPropertiesActionIT method initializePropertyType.

private void initializePropertyType() {
    Metadata metadata = new Metadata();
    metadata.setSystemTags(new HashSet<>(Arrays.asList("urlParameters")));
    metadata.setId(ARRAY_PARAM_NAME);
    metadata.setName("Array parameter");
    PropertyType propertyType1 = new PropertyType();
    propertyType1.setItemId(ARRAY_PARAM_NAME);
    propertyType1.setMetadata(metadata);
    propertyType1.setTarget("profiles");
    propertyType1.setValueTypeId("string");
    propertyType1.setMultivalued(true);
    Metadata metadata2 = new Metadata();
    metadata2.setSystemTags(new HashSet<>(Arrays.asList("urlParameters")));
    metadata2.setId(SINGLE_PARAM_NAME);
    metadata2.setName("Single parameters");
    PropertyType propertyType2 = new PropertyType();
    propertyType2.setItemId(SINGLE_PARAM_NAME);
    propertyType2.setMetadata(metadata2);
    propertyType2.setTarget("profiles");
    propertyType2.setValueTypeId("string");
    propertyType2.setMultivalued(false);
    profileService.setPropertyType(propertyType1);
    profileService.setPropertyType(propertyType2);
}
Also used : Metadata(org.apache.unomi.api.Metadata) PropertyType(org.apache.unomi.api.PropertyType)

Example 2 with PropertyType

use of org.apache.unomi.api.PropertyType in project unomi by apache.

the class CopyPropertiesActionIT method initializePropertyTypeWithMapping.

private void initializePropertyTypeWithMapping() {
    Metadata metadata = new Metadata();
    metadata.setId(MAPPED_PROPERTY);
    metadata.setName("single parameter");
    PropertyType propertyType1 = new PropertyType();
    propertyType1.setItemId(MAPPED_PROPERTY);
    propertyType1.setMetadata(metadata);
    propertyType1.setTarget("profiles");
    propertyType1.setValueTypeId("string");
    propertyType1.setMultivalued(false);
    propertyType1.setAutomaticMappingsFrom(new HashSet<>(Arrays.asList(PROPERTY_TO_MAP)));
    profileService.setPropertyType(propertyType1);
}
Also used : Metadata(org.apache.unomi.api.Metadata) PropertyType(org.apache.unomi.api.PropertyType)

Example 3 with PropertyType

use of org.apache.unomi.api.PropertyType in project unomi by apache.

the class CopyPropertiesActionIT method initializePropertyTypeWithDifferentSystemTag.

private void initializePropertyTypeWithDifferentSystemTag() {
    Metadata metadata = new Metadata();
    metadata.setSystemTags(new HashSet<>(Arrays.asList("shouldBeAbsent")));
    metadata.setId(ARRAY_PARAM_NAME);
    metadata.setName("Array parameter");
    PropertyType propertyType1 = new PropertyType();
    propertyType1.setItemId(ARRAY_PARAM_NAME);
    propertyType1.setMetadata(metadata);
    propertyType1.setTarget("profiles");
    propertyType1.setValueTypeId("string");
    propertyType1.setMultivalued(true);
    profileService.setPropertyType(propertyType1);
}
Also used : Metadata(org.apache.unomi.api.Metadata) PropertyType(org.apache.unomi.api.PropertyType)

Example 4 with PropertyType

use of org.apache.unomi.api.PropertyType in project unomi by apache.

the class PatchIT method testOverride.

@Test
public void testOverride() throws IOException, InterruptedException {
    PropertyType gender = profileService.getPropertyType("gender");
    try {
        Patch patch = CustomObjectMapper.getObjectMapper().readValue(bundleContext.getBundle().getResource("patch2.json"), Patch.class);
        PropertyType newGender = (PropertyType) patchService.patch(patch);
        Assert.assertEquals("foo", newGender.getDefaultValue());
        profileService.refresh();
        newGender = profileService.getPropertyType("gender");
        Assert.assertEquals("foo", newGender.getDefaultValue());
    } finally {
        profileService.setPropertyType(gender);
    }
}
Also used : PropertyType(org.apache.unomi.api.PropertyType) Patch(org.apache.unomi.api.Patch) Test(org.junit.Test)

Example 5 with PropertyType

use of org.apache.unomi.api.PropertyType in project unomi by apache.

the class CDPPropertyInterface method tags.

@GraphQLField
default Set<String> tags() {
    final PropertyType type = getType();
    if (type == null) {
        return null;
    }
    final Metadata meta = type.getMetadata();
    return meta != null ? meta.getTags() : null;
}
Also used : Metadata(org.apache.unomi.api.Metadata) PropertyType(org.apache.unomi.api.PropertyType) GraphQLField(graphql.annotations.annotationTypes.GraphQLField)

Aggregations

PropertyType (org.apache.unomi.api.PropertyType)34 Metadata (org.apache.unomi.api.Metadata)11 HashMap (java.util.HashMap)8 Profile (org.apache.unomi.api.Profile)6 Test (org.junit.Test)6 GraphQLField (graphql.annotations.annotationTypes.GraphQLField)5 ArrayList (java.util.ArrayList)5 Patch (org.apache.unomi.api.Patch)5 LinkedHashSet (java.util.LinkedHashSet)4 List (java.util.List)4 Map (java.util.Map)4 ImportConfiguration (org.apache.unomi.router.api.ImportConfiguration)4 File (java.io.File)3 IOException (java.io.IOException)3 HashSet (java.util.HashSet)3 LinkedHashMap (java.util.LinkedHashMap)3 Objects (java.util.Objects)3 Set (java.util.Set)3 Segment (org.apache.unomi.api.segments.Segment)3 ProfileService (org.apache.unomi.api.services.ProfileService)3