Search in sources :

Example 1 with PropertyTypeNotFoundException

use of net.nemerosa.ontrack.model.exceptions.PropertyTypeNotFoundException in project ontrack by nemerosa.

the class EventController method computeData.

protected Map<String, ?> computeData(Event event) {
    // Result
    Map<String, ? super Object> result = new HashMap<>();
    // Any property in values?
    NameValue property = event.getValues().get("property");
    if (property != null) {
        String propertyName = property.getName();
        // Gets the property type by name
        try {
            PropertyType<?> propertyType = propertyService.getPropertyTypeByName(propertyName);
            result.put("property", PropertyTypeDescriptor.of(propertyType));
        } catch (PropertyTypeNotFoundException ignored) {
            // Logs and ignores
            logger.warn("[event] Could not find property type for {}", propertyName);
        }
    }
    // OK
    return result;
}
Also used : NameValue(net.nemerosa.ontrack.model.support.NameValue) HashMap(java.util.HashMap) PropertyTypeNotFoundException(net.nemerosa.ontrack.model.exceptions.PropertyTypeNotFoundException)

Aggregations

HashMap (java.util.HashMap)1 PropertyTypeNotFoundException (net.nemerosa.ontrack.model.exceptions.PropertyTypeNotFoundException)1 NameValue (net.nemerosa.ontrack.model.support.NameValue)1