All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.nemerosa.ontrack.model.support.PropertyServiceHelper Maven / Gradle / Ivy

There is a newer version: 4.4.5
Show newest version
package net.nemerosa.ontrack.model.support;

import net.nemerosa.ontrack.model.exceptions.PropertyTypeNotFoundException;
import net.nemerosa.ontrack.model.structure.ProjectEntity;
import net.nemerosa.ontrack.model.structure.Property;
import net.nemerosa.ontrack.model.structure.PropertyService;
import org.apache.commons.lang3.StringUtils;

public class PropertyServiceHelper {

    public static boolean hasProperty(PropertyService propertyService,
                                      ProjectEntity entity,
                                      String propertyTypeName,
                                      String propertyValue) {
        try {
            Property property = propertyService.getProperty(entity, propertyTypeName);
            return !property.isEmpty()
                    && (
                    StringUtils.isBlank(propertyValue)
                            || property.containsValue(propertyValue));
        } catch (PropertyTypeNotFoundException ex) {
            return false;
        }
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy