use of org.summerb.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.properties.api.exceptions.PropertyServiceUnexpectedException in project summerb by skarpushin.
the class PropertyServiceImpl method findSubjectProperties.
@Override
public Map<String, String> findSubjectProperties(String appName, String domainName, String subjectId) {
checkArgumentsHaveText(appName, domainName, subjectId);
try {
long appId = appNameAlias.getAliasFor(appName);
long domainId = domainNameAlias.getAliasFor(domainName);
return internalFindSubjectProperties(appId, domainId, subjectId);
} catch (Throwable t) {
throw new PropertyServiceUnexpectedException("Failed to find subject properties", t);
}
}
use of org.summerb.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);
}
}
use of org.summerb.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.properties.api.exceptions.PropertyServiceUnexpectedException in project summerb by skarpushin.
the class StringIdAliasServiceEagerImpl method loadAllAliases.
protected final BiMap<String, Long> loadAllAliases() {
try {
BiMap<String, Long> ret = HashBiMap.create();
long maxOffset = -2;
for (long offset = 0; maxOffset == -2 || offset < maxOffset; offset = offset + EAGER_LOAD_BATCH_SIZE) {
PagerParams pagerParams = new PagerParams(offset, EAGER_LOAD_BATCH_SIZE);
PaginatedList<AliasEntry> loadedAliases = stringIdAliasDao.loadAllAliases(pagerParams);
maxOffset = loadedAliases.getTotalResults() - 1;
for (Entry<String, Long> entry : loadedAliases.getItems()) {
ret.put(entry.getKey(), entry.getValue());
}
}
return ret;
} catch (Throwable t) {
String msg = "Failed to eagerly load alias map";
log.error(msg, t);
throw new PropertyServiceUnexpectedException(msg, t);
}
}
Aggregations