Search in sources :

Example 1 with TenantKVModelDao

use of org.killbill.billing.tenant.dao.TenantKVModelDao in project killbill by killbill.

the class DefaultTenantUserApi method searchTenantKeyValues.

@Override
public Map<String, List<String>> searchTenantKeyValues(String searchKey, TenantContext context) throws TenantApiException {
    final InternalTenantContext internalContext = internalCallContextFactory.createInternalTenantContextWithoutAccountRecordId(context);
    final List<TenantKVModelDao> daoResult = tenantDao.searchTenantKeyValues(searchKey, internalContext);
    final Map<String, List<String>> result = new HashMap<String, List<String>>();
    for (final TenantKVModelDao cur : daoResult) {
        if (!result.containsKey(cur.getTenantKey())) {
            result.put(cur.getTenantKey(), new ArrayList<String>());
        }
        result.get(cur.getTenantKey()).add(cur.getTenantValue());
    }
    return result;
}
Also used : TenantKVModelDao(org.killbill.billing.tenant.dao.TenantKVModelDao) HashMap(java.util.HashMap) InternalTenantContext(org.killbill.billing.callcontext.InternalTenantContext) ArrayList(java.util.ArrayList) ImmutableList(com.google.common.collect.ImmutableList) List(java.util.List)

Aggregations

ImmutableList (com.google.common.collect.ImmutableList)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1 InternalTenantContext (org.killbill.billing.callcontext.InternalTenantContext)1 TenantKVModelDao (org.killbill.billing.tenant.dao.TenantKVModelDao)1