Search in sources :

Example 11 with FieldMapping

use of org.apache.stanbol.entityhub.servicesapi.mapping.FieldMapping in project stanbol by apache.

the class CacheUtils method writeFieldConfig.

/**
 * Serialises all {@link FieldMapping}s of the parsed {@link FieldMapper}
 * and stores them in the {@value Cache#FIELD_MAPPING_CONFIG_FIELD} of the
 * parsed {@link Representation}
 * @param config the representation to store the field mapping configuration
 * @param mapper the field mapper with the configuration to store
 */
private static void writeFieldConfig(Representation config, FieldMapper mapper) {
    StringBuilder builder = new StringBuilder();
    for (FieldMapping mapping : mapper.getMappings()) {
        builder.append(FieldMappingUtils.serialiseFieldMapping(mapping));
        builder.append('\n');
    }
    config.set(Cache.FIELD_MAPPING_CONFIG_FIELD, builder.toString());
}
Also used : FieldMapping(org.apache.stanbol.entityhub.servicesapi.mapping.FieldMapping)

Aggregations

FieldMapping (org.apache.stanbol.entityhub.servicesapi.mapping.FieldMapping)11 ArrayList (java.util.ArrayList)4 DefaultFieldMapperImpl (org.apache.stanbol.entityhub.core.mapping.DefaultFieldMapperImpl)4 TextConstraint (org.apache.stanbol.entityhub.servicesapi.query.TextConstraint)4 FieldMapper (org.apache.stanbol.entityhub.servicesapi.mapping.FieldMapper)3 ValueConstraint (org.apache.stanbol.entityhub.servicesapi.query.ValueConstraint)3 Constraint (org.apache.stanbol.entityhub.servicesapi.query.Constraint)2 Date (java.util.Date)1 HashSet (java.util.HashSet)1 Pattern (java.util.regex.Pattern)1 Activate (org.apache.felix.scr.annotations.Activate)1 ReferencedSiteConfigurationImpl (org.apache.stanbol.entityhub.core.site.ReferencedSiteConfigurationImpl)1 ManagedEntityState (org.apache.stanbol.entityhub.servicesapi.model.ManagedEntityState)1 SiteConfiguration (org.apache.stanbol.entityhub.servicesapi.site.SiteConfiguration)1 Cache (org.apache.stanbol.entityhub.servicesapi.yard.Cache)1 ServiceReference (org.osgi.framework.ServiceReference)1 ConfigurationException (org.osgi.service.cm.ConfigurationException)1 ServiceTracker (org.osgi.util.tracker.ServiceTracker)1 ServiceTrackerCustomizer (org.osgi.util.tracker.ServiceTrackerCustomizer)1