Search in sources :

Example 11 with PropertyServiceUnexpectedException

use of org.summerb.properties.api.exceptions.PropertyServiceUnexpectedException in project summerb by skarpushin.

the class PropertyServiceImpl method putSubjectProperties.

@Transactional(rollbackFor = Throwable.class)
@Override
public void putSubjectProperties(String appName, String domainName, String subjectId, List<NamedProperty> namedProperties) {
    if (CollectionUtils.isEmpty(namedProperties)) {
        return;
    }
    checkArgumentsHaveText(appName, domainName, subjectId);
    String currentPropertyName = null;
    try {
        long appId = appNameAlias.getAliasFor(appName);
        long domainId = domainNameAlias.getAliasFor(domainName);
        for (NamedProperty namedProperty : namedProperties) {
            currentPropertyName = namedProperty.getName();
            long propertyNameId = propertyNameAlias.getAliasFor(currentPropertyName);
            String value = namedProperty.getPropertyValue();
            propertyDao.putProperty(appId, domainId, subjectId, propertyNameId, value);
        }
    } catch (Throwable t) {
        propagatePropertyNameIfTruncationError(t, currentPropertyName);
        throw new PropertyServiceUnexpectedException("Failed to put subject properties", t);
    }
}
Also used : NamedProperty(org.summerb.properties.api.dto.NamedProperty) PropertyServiceUnexpectedException(org.summerb.properties.api.exceptions.PropertyServiceUnexpectedException) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

PropertyServiceUnexpectedException (org.summerb.properties.api.exceptions.PropertyServiceUnexpectedException)11 Transactional (org.springframework.transaction.annotation.Transactional)5 HashMap (java.util.HashMap)2 Map (java.util.Map)1 DuplicateKeyException (org.springframework.dao.DuplicateKeyException)1 PagerParams (org.summerb.easycrud.api.dto.PagerParams)1 NamedProperty (org.summerb.properties.api.dto.NamedProperty)1 AliasEntry (org.summerb.properties.impl.dao.AliasEntry)1