Search in sources :

Example 1 with IgnoreLogginAspect

use of com.icthh.xm.commons.logging.aop.IgnoreLogginAspect in project xm-ms-entity by xm-online.

the class XmEntitySpecService method getAllKeys.

/**
 * Transforms all XmEntity Specification keys into the thin structure based
 * in maps and sets.
 *
 * @return thin structure based in maps and sets
 */
@IgnoreLogginAspect
public Map<String, Map<String, Set<String>>> getAllKeys() {
    Map<String, Map<String, Set<String>>> result = Maps.newHashMap();
    for (TypeSpec typeSpec : findAllTypes()) {
        Map<String, Set<String>> subKeys = Maps.newHashMap();
        getKeys(subKeys, AttachmentSpec.class, typeSpec.getAttachments(), AttachmentSpec::getKey);
        getKeys(subKeys, CalendarSpec.class, typeSpec.getCalendars(), CalendarSpec::getKey);
        getKeys(subKeys, LinkSpec.class, typeSpec.getLinks(), LinkSpec::getKey);
        getKeys(subKeys, LocationSpec.class, typeSpec.getLocations(), LocationSpec::getKey);
        getKeys(subKeys, RatingSpec.class, typeSpec.getRatings(), RatingSpec::getKey);
        getKeys(subKeys, StateSpec.class, typeSpec.getStates(), StateSpec::getKey);
        getKeys(subKeys, TagSpec.class, typeSpec.getTags(), TagSpec::getKey);
        result.put(typeSpec.getKey(), subKeys);
    }
    return result;
}
Also used : AttachmentSpec(com.icthh.xm.ms.entity.domain.spec.AttachmentSpec) LocationSpec(com.icthh.xm.ms.entity.domain.spec.LocationSpec) Set(java.util.Set) RatingSpec(com.icthh.xm.ms.entity.domain.spec.RatingSpec) StateSpec(com.icthh.xm.ms.entity.domain.spec.StateSpec) TagSpec(com.icthh.xm.ms.entity.domain.spec.TagSpec) LinkSpec(com.icthh.xm.ms.entity.domain.spec.LinkSpec) CalendarSpec(com.icthh.xm.ms.entity.domain.spec.CalendarSpec) Map(java.util.Map) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) TypeSpec(com.icthh.xm.ms.entity.domain.spec.TypeSpec) IgnoreLogginAspect(com.icthh.xm.commons.logging.aop.IgnoreLogginAspect)

Example 2 with IgnoreLogginAspect

use of com.icthh.xm.commons.logging.aop.IgnoreLogginAspect in project xm-ms-entity by xm-online.

the class EntityCustomPrivilegeService method onEntitySpecUpdate.

@IgnoreLogginAspect
@Override
public void onEntitySpecUpdate(Map<String, TypeSpec> specs, String tenantKey) {
    XmEntityTenantConfig xmEntityTenantConfig = tenantConfigService.getXmEntityTenantConfig(tenantKey);
    Boolean disableDynamicPrivilegesGeneration = xmEntityTenantConfig.getDisableDynamicPrivilegesGeneration();
    if (Boolean.TRUE.equals(disableDynamicPrivilegesGeneration)) {
        log.warn("Dynamic privilege generation disabled.");
        return;
    }
    String privilegesPath = resolvePathWithTenant(tenantKey, CUSTOMER_PRIVILEGES_PATH);
    log.info("Get config from {}", privilegesPath);
    List<String> paths = asList(privilegesPath);
    Map<String, Configuration> configs = commonConfigRepository.getConfig(null, paths);
    configs = configs == null ? new HashMap<>() : configs;
    updateCustomPrivileges(specs, privilegesPath, configs.get(privilegesPath), tenantKey);
}
Also used : Configuration(com.icthh.xm.commons.config.domain.Configuration) HashMap(java.util.HashMap) XmEntityTenantConfig(com.icthh.xm.ms.entity.config.XmEntityTenantConfigService.XmEntityTenantConfig) IgnoreLogginAspect(com.icthh.xm.commons.logging.aop.IgnoreLogginAspect)

Aggregations

IgnoreLogginAspect (com.icthh.xm.commons.logging.aop.IgnoreLogginAspect)2 HashMap (java.util.HashMap)2 Configuration (com.icthh.xm.commons.config.domain.Configuration)1 XmEntityTenantConfig (com.icthh.xm.ms.entity.config.XmEntityTenantConfigService.XmEntityTenantConfig)1 AttachmentSpec (com.icthh.xm.ms.entity.domain.spec.AttachmentSpec)1 CalendarSpec (com.icthh.xm.ms.entity.domain.spec.CalendarSpec)1 LinkSpec (com.icthh.xm.ms.entity.domain.spec.LinkSpec)1 LocationSpec (com.icthh.xm.ms.entity.domain.spec.LocationSpec)1 RatingSpec (com.icthh.xm.ms.entity.domain.spec.RatingSpec)1 StateSpec (com.icthh.xm.ms.entity.domain.spec.StateSpec)1 TagSpec (com.icthh.xm.ms.entity.domain.spec.TagSpec)1 TypeSpec (com.icthh.xm.ms.entity.domain.spec.TypeSpec)1 LinkedHashMap (java.util.LinkedHashMap)1 Map (java.util.Map)1 Set (java.util.Set)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1