Skip to content

Commit

Permalink
KAA-420: Changed log message pattern.
Browse files Browse the repository at this point in the history
  • Loading branch information
Igor Khanenko committed Mar 23, 2015
1 parent 6f22d1d commit 99e7c0c
Show file tree
Hide file tree
Showing 21 changed files with 467 additions and 296 deletions.
Expand Up @@ -37,7 +37,7 @@ public interface EventClassDao<T> extends SqlDao<T> {
/** /**
* Find all Event Classes by Event Class Family id, version and type. * Find all Event Classes by Event Class Family id, version and type.
* *
* @param id the ecf id * @param ecfId the ecf id
* @param version the version * @param version the version
* @param type the type * @param type the type
* @return the list of event classes * @return the list of event classes
Expand Down
Expand Up @@ -57,11 +57,4 @@ public interface LogSchemaDao<T> extends SqlDao<T> {
*/ */
T findLatestLogSchemaByAppId(String applicationId); T findLatestLogSchemaByAppId(String applicationId);


/**
* Find vacant schemas by appender id.
*
* @param appenderId
* @return the list of vacant schemas
*/
List<T> findVacantSchemasByAppenderId(String appenderId);
} }

This file was deleted.

This file was deleted.

Expand Up @@ -53,15 +53,6 @@ public interface TopicDao<T> extends SqlDao<T> {
*/ */
List<T> findTopicsByIds(List<String> ids); List<T> findTopicsByIds(List<String> ids);


/**
* Find vacant topics by application id.
*
* @param appId the application id
* @param excludeIds the exclude ids
* @return the list of topics
*/
List<T> findVacantTopicsByAppId(String appId, List<String> excludeIds);

/** /**
* Removes the topics by application id. * Removes the topics by application id.
* *
Expand Down
Expand Up @@ -44,7 +44,7 @@ protected Class<Application> getEntityClass() {


@Override @Override
public List<Application> findByTenantId(String tenantId) { public List<Application> findByTenantId(String tenantId) {
LOG.debug("Searching applications by tenant id {}", tenantId); LOG.debug("Searching applications by tenant id [{}]", tenantId);
List<Application> applications = findListByCriterionWithAlias(TENANT_ENTITY_NAME, TENANT_ALIAS, Restrictions.eq(TENANT_REFERENCE, Long.valueOf(tenantId))); List<Application> applications = findListByCriterionWithAlias(TENANT_ENTITY_NAME, TENANT_ALIAS, Restrictions.eq(TENANT_REFERENCE, Long.valueOf(tenantId)));
if (LOG.isTraceEnabled()) { if (LOG.isTraceEnabled()) {
LOG.trace("[{}] Search result: {}.", tenantId, Arrays.toString(applications.toArray())); LOG.trace("[{}] Search result: {}.", tenantId, Arrays.toString(applications.toArray()));
Expand Down
Expand Up @@ -49,62 +49,77 @@ protected Class<ApplicationEventFamilyMap> getEntityClass() {
} }


@Override @Override
public List<ApplicationEventFamilyMap> findByApplicationId(String applicationId) { public List<ApplicationEventFamilyMap> findByApplicationId(String appId) {
LOG.debug("Find application event family maps by application id [{}] ", applicationId); LOG.debug("Searching application event family maps by application id [{}] ", appId);
List<ApplicationEventFamilyMap> applicationEventFamilyMaps = Collections.emptyList(); List<ApplicationEventFamilyMap> applicationEventFamilyMaps = Collections.emptyList();
if (isNotBlank(applicationId)) { if (isNotBlank(appId)) {
applicationEventFamilyMaps = findListByCriterionWithAlias(APPLICATION_PROPERTY, APPLICATION_ALIAS, Restrictions.eq(APPLICATION_REFERENCE, Long.valueOf(applicationId))); applicationEventFamilyMaps = findListByCriterionWithAlias(APPLICATION_PROPERTY, APPLICATION_ALIAS, Restrictions.eq(APPLICATION_REFERENCE, Long.valueOf(appId)));
} }
LOG.info("Found application event family maps {} by tenant id {} ", applicationEventFamilyMaps.size(), applicationId); if (LOG.isTraceEnabled()) {
if (LOG.isDebugEnabled()) { LOG.trace("[{}] Search result: {}.", appId, applicationEventFamilyMaps);
LOG.debug("Found application event family maps {} by tenant id {} ", Arrays.toString(applicationEventFamilyMaps.toArray()), applicationId); } else {
LOG.debug("[{}] Search result: {}.", appId, applicationEventFamilyMaps.size());
} }
return applicationEventFamilyMaps; return applicationEventFamilyMaps;
} }


@Override @Override
public List<ApplicationEventFamilyMap> findByIds(List<String> ids) { public List<ApplicationEventFamilyMap> findByIds(List<String> ids) {
LOG.debug("Find applicationEventFamilyMaps by ids [{}] ", ids);
List<ApplicationEventFamilyMap> applicationEventFamilyMaps = Collections.emptyList(); List<ApplicationEventFamilyMap> applicationEventFamilyMaps = Collections.emptyList();
String idsArray = "";
if (ids != null && !ids.isEmpty()) { if (ids != null && !ids.isEmpty()) {
idsArray = Arrays.toString(ids.toArray());
LOG.debug("Searching application event family maps by ids {} ", idsArray);
applicationEventFamilyMaps = findListByCriterion(Restrictions.in(ID_PROPERTY, toLongIds(ids))); applicationEventFamilyMaps = findListByCriterion(Restrictions.in(ID_PROPERTY, toLongIds(ids)));
} }
if (LOG.isTraceEnabled()) {
LOG.trace("{} Search result: {}.", idsArray, Arrays.toString(applicationEventFamilyMaps.toArray()));
} else {
LOG.debug("{} Search result: {}.", idsArray, applicationEventFamilyMaps.size());
}
return applicationEventFamilyMaps; return applicationEventFamilyMaps;
} }


@Override @Override
public void removeByApplicationId(String applicationId) { public void removeByApplicationId(String appId) {
LOG.debug("remove applicationEventFamilyMap by application id [{}] ", applicationId); if (isNotBlank(appId)) {
if (isNotBlank(applicationId)) {
List<ApplicationEventFamilyMap> eventClassFamilies = findListByCriterionWithAlias(APPLICATION_PROPERTY, APPLICATION_ALIAS, List<ApplicationEventFamilyMap> eventClassFamilies = findListByCriterionWithAlias(APPLICATION_PROPERTY, APPLICATION_ALIAS,
Restrictions.eq(APPLICATION_REFERENCE, Long.valueOf(applicationId))); Restrictions.eq(APPLICATION_REFERENCE, Long.valueOf(appId)));
removeList(eventClassFamilies); removeList(eventClassFamilies);
} }
LOG.debug("Removed application event family map by application id [{}] ", appId);
} }


@Override @Override
public boolean validateApplicationEventFamilyMap(String applicationId, public boolean validateApplicationEventFamilyMap(String appId, String ecfId, int version) {
String ecfId, int version) { LOG.debug("Validating application event family map by application id [{}], ecf id [{}], version [{}]", appId, ecfId, version);
LOG.debug("Validate application event family map, application id [{}], ecf id [{}], version [{}]", applicationId, ecfId, version);
Criteria criteria = getCriteria(); Criteria criteria = getCriteria();
criteria.createAlias(APPLICATION_PROPERTY, APPLICATION_ALIAS); criteria.createAlias(APPLICATION_PROPERTY, APPLICATION_ALIAS);
criteria.createAlias(ECF_PROPERTY, ECF_ALIAS); criteria.createAlias(ECF_PROPERTY, ECF_ALIAS);
criteria.add(Restrictions.and( criteria.add(Restrictions.and(
Restrictions.eq(APPLICATION_REFERENCE, Long.valueOf(applicationId)), Restrictions.eq(APPLICATION_REFERENCE, Long.valueOf(appId)),
Restrictions.eq(ECF_REFERENCE, Long.valueOf(ecfId)), Restrictions.eq(ECF_REFERENCE, Long.valueOf(ecfId)),
Restrictions.eq(VERSION_PROPERTY, version))); Restrictions.eq(VERSION_PROPERTY, version)));
Long count = (Long) criteria.setProjection(Projections.rowCount()).uniqueResult(); Long count = (Long) criteria.setProjection(Projections.rowCount()).uniqueResult();
return count == 0; boolean result = count != null ? count == 0 : false;
LOG.debug("[{},{},{}] Validation result: {}.", appId, ecfId, version, result);
return result;
} }


@Override @Override
public List<ApplicationEventFamilyMap> findByEcfIdAndVersion(String ecfId, int version) { public List<ApplicationEventFamilyMap> findByEcfIdAndVersion(String ecfId, int version) {
LOG.debug("Find applicationEventFamilyMap by eventClassFamilyId id [{}] and version {} ", ecfId, version); LOG.debug("Searching application event family maps by event class family id [{}] and version [{}] ", ecfId, version);
Criteria criteria = getCriteria(); Criteria criteria = getCriteria();
criteria.createAlias(ECF_PROPERTY, ECF_ALIAS); criteria.createAlias(ECF_PROPERTY, ECF_ALIAS);
criteria.add(Restrictions.and( criteria.add(Restrictions.and(
Restrictions.eq(ECF_REFERENCE, Long.valueOf(ecfId)), Restrictions.eq(ECF_REFERENCE, Long.valueOf(ecfId)),
Restrictions.eq(VERSION_PROPERTY, version))); Restrictions.eq(VERSION_PROPERTY, version)));
return findListByCriteria(criteria); List<ApplicationEventFamilyMap> maps = findListByCriteria(criteria);
if (LOG.isTraceEnabled()) {
LOG.trace("[{},{}] Search result: {}.", ecfId, version, Arrays.toString(maps.toArray()));
} else {
LOG.debug("[{},{}] Search result: {}.", ecfId, version, maps.size());
}
return maps;
} }
} }

0 comments on commit 99e7c0c

Please sign in to comment.