introduce cache zone identifier to keys

This commit is contained in:
Anuruddha Premalal
2013-09-11 00:08:32 +01:00
committed by Keith Woodlock
parent 0410ab14ea
commit 72ceb5340f
14 changed files with 26 additions and 25 deletions
@@ -50,7 +50,7 @@ public class CodeReadPlatformServiceImpl implements CodeReadPlatformService {
}
@Override
@Cacheable(value = "codes", key = "T(org.mifosplatform.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier()")
@Cacheable(value = "codes", key = "T(org.mifosplatform.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier().concat('CD')")
public Collection<CodeData> retrieveAllCodes() {
context.authenticatedUser();
@@ -60,7 +60,7 @@ public class CodeValueReadPlatformServiceImpl implements CodeValueReadPlatformSe
}
@Override
@Cacheable(value = "code_values", key = "T(org.mifosplatform.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier().concat(#codeId)")
@Cacheable(value = "code_values", key = "T(org.mifosplatform.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier().concat(#codeId+'cv')")
public Collection<CodeValueData> retrieveAllCodeValues(Long codeId) {
context.authenticatedUser();
@@ -44,7 +44,7 @@ public class CodeWritePlatformServiceJpaRepositoryImpl implements CodeWritePlatf
@Transactional
@Override
@CacheEvict(value = "codes", key = "T(org.mifosplatform.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier()")
@CacheEvict(value = "codes", key = "T(org.mifosplatform.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier().concat('cv')")
public CommandProcessingResult createCode(final JsonCommand command) {
try {
@@ -64,7 +64,7 @@ public class CodeWritePlatformServiceJpaRepositoryImpl implements CodeWritePlatf
@Transactional
@Override
@CacheEvict(value = "codes", key = "T(org.mifosplatform.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier()")
@CacheEvict(value = "codes", key = "T(org.mifosplatform.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier().concat('cv')")
public CommandProcessingResult updateCode(final Long codeId, final JsonCommand command) {
try {
@@ -92,7 +92,7 @@ public class CodeWritePlatformServiceJpaRepositoryImpl implements CodeWritePlatf
@Transactional
@Override
@CacheEvict(value = "codes", key = "T(org.mifosplatform.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier()")
@CacheEvict(value = "codes", key = "T(org.mifosplatform.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier().concat('cv')")
public CommandProcessingResult deleteCode(final Long codeId) {
context.authenticatedUser();
@@ -25,7 +25,7 @@ public class TenantAwareJpaPlatformUserDetailsService implements PlatformUserDet
private PlatformUserRepository platformUserRepository;
@Override
@Cacheable(value = "users", key = "T(org.mifosplatform.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier().concat(#username)")
@Cacheable(value = "users", key = "T(org.mifosplatform.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier().concat(#username+'un')")
public UserDetails loadUserByUsername(final String username) throws UsernameNotFoundException, DataAccessException {
final PlatformUser appUser = this.platformUserRepository.findByUsername(username);
@@ -127,7 +127,7 @@ public class OfficeReadPlatformServiceImpl implements OfficeReadPlatformService
}
@Override
@Cacheable(value = "offices", key = "T(org.mifosplatform.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier().concat(#root.target.context.authenticatedUser().getOffice().getHierarchy())")
@Cacheable(value = "offices", key = "T(org.mifosplatform.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier().concat(#root.target.context.authenticatedUser().getOffice().getHierarchy()+'of')")
public Collection<OfficeData> retrieveAllOffices() {
AppUser currentUser = context.authenticatedUser();
@@ -142,7 +142,7 @@ public class OfficeReadPlatformServiceImpl implements OfficeReadPlatformService
}
@Override
@Cacheable(value = "office_template", key = "T(org.mifosplatform.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier().concat(#root.target.context.authenticatedUser().getOffice().getHierarchy())")
@Cacheable(value = "office_template", key = "T(org.mifosplatform.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier().concat(#root.target.context.authenticatedUser().getOffice().getHierarchy()+'oft')")
public Collection<OfficeData> retrieveAllOfficesForDropdown() {
final AppUser currentUser = context.authenticatedUser();
@@ -63,8 +63,8 @@ public class OfficeWritePlatformServiceJpaRepositoryImpl implements OfficeWriteP
@Transactional
@Override
@Caching(evict = {
@CacheEvict(value = "offices", key = "T(org.mifosplatform.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier().concat(#root.target.context.authenticatedUser().getOffice().getHierarchy())"),
@CacheEvict(value = "office_template", key = "T(org.mifosplatform.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier().concat(#root.target.context.authenticatedUser().getOffice().getHierarchy())") })
@CacheEvict(value = "offices", key = "T(org.mifosplatform.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier().concat(#root.target.context.authenticatedUser().getOffice().getHierarchy()+'of')"),
@CacheEvict(value = "office_template", key = "T(org.mifosplatform.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier().concat(#root.target.context.authenticatedUser().getOffice().getHierarchy()+'oft')") })
public CommandProcessingResult createOffice(final JsonCommand command) {
try {
@@ -101,8 +101,8 @@ public class OfficeWritePlatformServiceJpaRepositoryImpl implements OfficeWriteP
@Transactional
@Override
@Caching(evict = {
@CacheEvict(value = "offices", key = "T(org.mifosplatform.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier().concat(#root.target.context.authenticatedUser().getOffice().getHierarchy())"),
@CacheEvict(value = "office_template", key = "T(org.mifosplatform.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier().concat(#root.target.context.authenticatedUser().getOffice().getHierarchy())") })
@CacheEvict(value = "offices", key = "T(org.mifosplatform.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier().concat(#root.target.context.authenticatedUser().getOffice().getHierarchy()+'of')"),
@CacheEvict(value = "office_template", key = "T(org.mifosplatform.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier().concat(#root.target.context.authenticatedUser().getOffice().getHierarchy()+'oft')") })
public CommandProcessingResult updateOffice(final Long officeId, final JsonCommand command) {
try {
@@ -46,7 +46,7 @@ public class ChargeReadPlatformServiceImpl implements ChargeReadPlatformService
}
@Override
@Cacheable(value = "charges", key = "T(org.mifosplatform.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier()")
@Cacheable(value = "charges", key = "T(org.mifosplatform.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier().concat('ch')")
public Collection<ChargeData> retrieveAllCharges() {
this.context.authenticatedUser();
@@ -57,7 +57,7 @@ public class ChargeWritePlatformServiceJpaRepositoryImpl implements ChargeWriteP
@Transactional
@Override
@CacheEvict(value = "charges", key = "T(org.mifosplatform.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier()")
@CacheEvict(value = "charges", key = "T(org.mifosplatform.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier().concat('ch')")
public CommandProcessingResult createCharge(final JsonCommand command) {
try {
this.context.authenticatedUser();
@@ -76,7 +76,7 @@ public class ChargeWritePlatformServiceJpaRepositoryImpl implements ChargeWriteP
@Transactional
@Override
@CacheEvict(value = "charges", key = "T(org.mifosplatform.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier()")
@CacheEvict(value = "charges", key = "T(org.mifosplatform.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier().concat('c')")
public CommandProcessingResult updateCharge(final Long chargeId, final JsonCommand command) {
try {
@@ -102,7 +102,7 @@ public class ChargeWritePlatformServiceJpaRepositoryImpl implements ChargeWriteP
@Transactional
@Override
@CacheEvict(value = "charges", key = "T(org.mifosplatform.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier()")
@CacheEvict(value = "charges", key = "T(org.mifosplatform.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier().concat('ch')")
public CommandProcessingResult deleteCharge(final Long chargeId) {
this.context.authenticatedUser();
@@ -50,7 +50,7 @@ public class FundReadPlatformServiceImpl implements FundReadPlatformService {
}
@Override
@Cacheable(value = "funds", key = "T(org.mifosplatform.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier()")
@Cacheable(value = "funds", key = "T(org.mifosplatform.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier().concat('fn')")
public Collection<FundData> retrieveAllFunds() {
context.authenticatedUser();
@@ -43,7 +43,7 @@ public class FundWritePlatformServiceJpaRepositoryImpl implements FundWritePlatf
@Transactional
@Override
@CacheEvict(value = "fund", key = "T(org.mifosplatform.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier()")
@CacheEvict(value = "funds", key = "T(org.mifosplatform.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier().concat('fn')")
public CommandProcessingResult createFund(final JsonCommand command) {
try {
@@ -64,7 +64,7 @@ public class FundWritePlatformServiceJpaRepositoryImpl implements FundWritePlatf
@Transactional
@Override
@CacheEvict(value = "fund", key = "T(org.mifosplatform.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier()")
@CacheEvict(value = "funds", key = "T(org.mifosplatform.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier().concat('fn')")
public CommandProcessingResult updateFund(final Long fundId, final JsonCommand command) {
try {
@@ -5,12 +5,13 @@
*/
package org.mifosplatform.useradministration.data;
import java.io.Serializable;
import java.util.Collection;
/**
* Immutable data object for role data.
*/
public class RoleData {
public class RoleData implements Serializable {
private final Long id;
private final String name;
@@ -27,7 +27,7 @@ import org.springframework.data.jpa.domain.AbstractPersistable;
@Entity
@Table(name = "m_role", uniqueConstraints = { @UniqueConstraint(columnNames = { "name" }, name = "unq_name")})
public class Role extends AbstractPersistable<Long> implements Serializable {
public class Role extends AbstractPersistable<Long> {
@Column(name = "name", unique = true, nullable = false, length = 100)
private String name;
@@ -34,7 +34,7 @@ public class RoleReadPlatformServiceImpl implements RoleReadPlatformService {
}
@Override
@Cacheable(value = "roles", key = "T(org.mifosplatform.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier()")
@Cacheable(value = "roles", key = "T(org.mifosplatform.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier().concat('rl')")
public Collection<RoleData> retrieveAll() {
final String sql = "select " + roleRowMapper.schema() + " order by r.id";
@@ -53,7 +53,7 @@ public class RoleWritePlatformServiceJpaRepositoryImpl implements RoleWritePlatf
@Transactional
@Override
@CacheEvict(value = "roles", key = "T(org.mifosplatform.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier()")
@CacheEvict(value = "roles", key = "T(org.mifosplatform.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier().concat('rl')")
public CommandProcessingResult createRole(final JsonCommand command) {
try {
@@ -99,7 +99,7 @@ public class RoleWritePlatformServiceJpaRepositoryImpl implements RoleWritePlatf
@Transactional
@Override
@CacheEvict(value = "roles", key = "T(org.mifosplatform.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier()")
@CacheEvict(value = "roles", key = "T(org.mifosplatform.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier().concat('rl')")
public CommandProcessingResult updateRole(final Long roleId, final JsonCommand command) {
try {
context.authenticatedUser();
@@ -129,7 +129,7 @@ public class RoleWritePlatformServiceJpaRepositoryImpl implements RoleWritePlatf
@Transactional
@Override
@CacheEvict(value = "roles", key = "T(org.mifosplatform.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier()")
@CacheEvict(value = "roles", key = "T(org.mifosplatform.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier().concat('rl')")
public CommandProcessingResult updateRolePermissions(final Long roleId, final JsonCommand command) {
context.authenticatedUser();