use of org.summerb.microservices.properties.api.exceptions.PropertyServiceUnexpectedException in project summerb by skarpushin.
the class PropertyServiceImpl method putSubjectsProperty.
@Transactional(rollbackFor = Throwable.class)
@Override
public void putSubjectsProperty(String appName, String domainName, List<String> subjectsIds, String name, String value) {
if (CollectionUtils.isEmpty(subjectsIds)) {
return;
}
checkArgumentsHaveText(appName, domainName, name);
try {
long appId = appNameAlias.getAliasFor(appName);
long domainId = domainNameAlias.getAliasFor(domainName);
long propertyNameId = propertyNameAlias.getAliasFor(name);
for (String subjectId : subjectsIds) {
propertyDao.putProperty(appId, domainId, subjectId, propertyNameId, value);
}
} catch (Throwable t) {
propagatePropertyNameIfTruncationError(t, name);
throw new PropertyServiceUnexpectedException("Failed to put subjects property", t);
}
}
use of org.summerb.microservices.properties.api.exceptions.PropertyServiceUnexpectedException in project summerb by skarpushin.
the class PropertyServiceImpl method findSubjectsProperties.
@Override
public Map<String, Map<String, String>> findSubjectsProperties(String appName, String domainName, List<String> subjectsIds) {
if (CollectionUtils.isEmpty(subjectsIds)) {
return new HashMap<String, Map<String, String>>();
}
checkArgumentsHaveText(appName, domainName);
try {
long appId = appNameAlias.getAliasFor(appName);
long domainId = domainNameAlias.getAliasFor(domainName);
Map<String, Map<String, String>> ret = new HashMap<String, Map<String, String>>();
for (String subjectId : subjectsIds) {
Map<String, String> properties = internalFindSubjectProperties(appId, domainId, subjectId);
if (properties != null && properties.size() > 0) {
ret.put(subjectId, properties);
}
}
return ret;
} catch (Throwable t) {
throw new PropertyServiceUnexpectedException("Failed to find subjects properties", t);
}
}
use of org.summerb.microservices.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);
}
}
use of org.summerb.microservices.properties.api.exceptions.PropertyServiceUnexpectedException in project summerb by skarpushin.
the class PropertyServiceImpl method deleteSubjectProperties.
@Override
@Transactional(rollbackFor = Throwable.class)
public void deleteSubjectProperties(String appName, String domainName, String subjectId) {
checkArgumentsHaveText(appName, domainName, subjectId);
try {
long appId = appNameAlias.getAliasFor(appName);
long domainId = domainNameAlias.getAliasFor(domainName);
propertyDao.deleteSubjectProperties(appId, domainId, subjectId);
} catch (Throwable t) {
throw new PropertyServiceUnexpectedException("Failed to delete subject properties", t);
}
}
use of org.summerb.microservices.properties.api.exceptions.PropertyServiceUnexpectedException in project summerb by skarpushin.
the class PropertyServiceImpl method putSubjectProperty.
@Override
@Transactional(rollbackFor = Throwable.class)
public void putSubjectProperty(String appName, String domainName, String subjectId, String name, String value) {
checkArgumentsHaveText(appName, domainName, subjectId, name);
try {
long appId = appNameAlias.getAliasFor(appName);
long domainId = domainNameAlias.getAliasFor(domainName);
long propertyNameId = propertyNameAlias.getAliasFor(name);
propertyDao.putProperty(appId, domainId, subjectId, propertyNameId, value);
} catch (Throwable t) {
propagatePropertyNameIfTruncationError(t, name);
throw new PropertyServiceUnexpectedException("Failed to put property", t);
}
}
Aggregations