initial memcached integration
This commit is contained in:
committed by
Keith Woodlock
parent
e67ab7cf88
commit
0410ab14ea
@@ -161,7 +161,10 @@ dependencies {
|
||||
[group: 'org.mnode.ical4j', name: 'ical4j', version: '1.0.4'],
|
||||
[group: 'com.googlecode.flyway', name: 'flyway-maven-plugin', version: '2.1.1'],
|
||||
[group: 'org.quartz-scheduler', name: 'quartz', version: '2.1.7'],
|
||||
[group: 'com.amazonaws', name: 'aws-java-sdk', version: '1.2.1']
|
||||
[group: 'com.amazonaws', name: 'aws-java-sdk', version: '1.2.1'],
|
||||
|
||||
[group: 'com.google.code.simple-spring-memcached', name: 'xmemcached-provider', version: '3.2.0'],
|
||||
[group: 'com.google.code.simple-spring-memcached', name: 'spring-cache', version: '3.2.0']
|
||||
)
|
||||
|
||||
testCompile 'junit:junit:4.10',
|
||||
|
||||
+3
-1
@@ -5,10 +5,12 @@
|
||||
*/
|
||||
package org.mifosplatform.infrastructure.codes.data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Immutable data object representing a code.
|
||||
*/
|
||||
public class CodeData {
|
||||
public class CodeData implements Serializable {
|
||||
|
||||
private final Long id;
|
||||
@SuppressWarnings("unused")
|
||||
|
||||
+3
-1
@@ -5,10 +5,12 @@
|
||||
*/
|
||||
package org.mifosplatform.infrastructure.codes.data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Immutable data object represent code-value data in system.
|
||||
*/
|
||||
public class CodeValueData {
|
||||
public class CodeValueData implements Serializable{
|
||||
|
||||
private final Long id;
|
||||
|
||||
|
||||
+2
@@ -14,6 +14,7 @@ import org.mifosplatform.infrastructure.codes.exception.CodeNotFoundException;
|
||||
import org.mifosplatform.infrastructure.core.service.RoutingDataSource;
|
||||
import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.dao.EmptyResultDataAccessException;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.jdbc.core.RowMapper;
|
||||
@@ -49,6 +50,7 @@ public class CodeReadPlatformServiceImpl implements CodeReadPlatformService {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Cacheable(value = "codes", key = "T(org.mifosplatform.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier()")
|
||||
public Collection<CodeData> retrieveAllCodes() {
|
||||
context.authenticatedUser();
|
||||
|
||||
|
||||
+2
@@ -13,6 +13,7 @@ import org.mifosplatform.infrastructure.codes.data.CodeValueData;
|
||||
import org.mifosplatform.infrastructure.core.service.RoutingDataSource;
|
||||
import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.jdbc.core.RowMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -59,6 +60,7 @@ public class CodeValueReadPlatformServiceImpl implements CodeValueReadPlatformSe
|
||||
}
|
||||
|
||||
@Override
|
||||
@Cacheable(value = "code_values", key = "T(org.mifosplatform.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier().concat(#codeId)")
|
||||
public Collection<CodeValueData> retrieveAllCodeValues(Long codeId) {
|
||||
|
||||
context.authenticatedUser();
|
||||
|
||||
+4
@@ -22,6 +22,7 @@ import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.dao.DataIntegrityViolationException;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -50,6 +51,7 @@ public class CodeValueWritePlatformServiceJpaRepositoryImpl implements CodeValue
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
@CacheEvict(value = "code_values", allEntries = true)
|
||||
public CommandProcessingResult createCodeValue(final JsonCommand command) {
|
||||
|
||||
try {
|
||||
@@ -93,6 +95,7 @@ public class CodeValueWritePlatformServiceJpaRepositoryImpl implements CodeValue
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
@CacheEvict(value = "code_values", allEntries = true)
|
||||
public CommandProcessingResult updateCodeValue(final Long codeValueId, final JsonCommand command) {
|
||||
|
||||
try {
|
||||
@@ -123,6 +126,7 @@ public class CodeValueWritePlatformServiceJpaRepositoryImpl implements CodeValue
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
@CacheEvict(value = "code_values", allEntries = true)
|
||||
public CommandProcessingResult deleteCodeValue(final Long codeId, final Long codeValueId) {
|
||||
|
||||
try {
|
||||
|
||||
+4
@@ -20,6 +20,7 @@ import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.dao.DataIntegrityViolationException;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -43,6 +44,7 @@ public class CodeWritePlatformServiceJpaRepositoryImpl implements CodeWritePlatf
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
@CacheEvict(value = "codes", key = "T(org.mifosplatform.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier()")
|
||||
public CommandProcessingResult createCode(final JsonCommand command) {
|
||||
|
||||
try {
|
||||
@@ -62,6 +64,7 @@ public class CodeWritePlatformServiceJpaRepositoryImpl implements CodeWritePlatf
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
@CacheEvict(value = "codes", key = "T(org.mifosplatform.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier()")
|
||||
public CommandProcessingResult updateCode(final Long codeId, final JsonCommand command) {
|
||||
|
||||
try {
|
||||
@@ -89,6 +92,7 @@ public class CodeWritePlatformServiceJpaRepositoryImpl implements CodeWritePlatf
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
@CacheEvict(value = "codes", key = "T(org.mifosplatform.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier()")
|
||||
public CommandProcessingResult deleteCode(final Long codeId) {
|
||||
|
||||
context.authenticatedUser();
|
||||
|
||||
+2
@@ -8,6 +8,7 @@ package org.mifosplatform.infrastructure.security.service;
|
||||
import org.mifosplatform.infrastructure.security.domain.PlatformUser;
|
||||
import org.mifosplatform.infrastructure.security.domain.PlatformUserRepository;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
import org.springframework.security.core.userdetails.UserDetailsService;
|
||||
@@ -24,6 +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)")
|
||||
public UserDetails loadUserByUsername(final String username) throws UsernameNotFoundException, DataAccessException {
|
||||
|
||||
final PlatformUser appUser = this.platformUserRepository.findByUsername(username);
|
||||
|
||||
+2
-1
@@ -5,6 +5,7 @@
|
||||
*/
|
||||
package org.mifosplatform.organisation.office.data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@@ -13,7 +14,7 @@ import org.joda.time.LocalDate;
|
||||
/**
|
||||
* Immutable data object for office data.
|
||||
*/
|
||||
public class OfficeData {
|
||||
public class OfficeData implements Serializable {
|
||||
|
||||
private final Long id;
|
||||
private final String name;
|
||||
|
||||
+7
@@ -22,6 +22,7 @@ import org.mifosplatform.organisation.office.data.OfficeTransactionData;
|
||||
import org.mifosplatform.organisation.office.exception.OfficeNotFoundException;
|
||||
import org.mifosplatform.useradministration.domain.AppUser;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.dao.EmptyResultDataAccessException;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.jdbc.core.RowMapper;
|
||||
@@ -126,6 +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())")
|
||||
public Collection<OfficeData> retrieveAllOffices() {
|
||||
|
||||
AppUser currentUser = context.authenticatedUser();
|
||||
@@ -140,6 +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())")
|
||||
public Collection<OfficeData> retrieveAllOfficesForDropdown() {
|
||||
final AppUser currentUser = context.authenticatedUser();
|
||||
|
||||
@@ -224,4 +227,8 @@ public class OfficeReadPlatformServiceImpl implements OfficeReadPlatformService
|
||||
|
||||
return OfficeTransactionData.template(new LocalDate(), parentLookups, currencyOptions);
|
||||
}
|
||||
|
||||
public PlatformSecurityContext getContext() {
|
||||
return this.context;
|
||||
}
|
||||
}
|
||||
+12
@@ -28,6 +28,8 @@ import org.mifosplatform.useradministration.domain.AppUser;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.cache.annotation.Caching;
|
||||
import org.springframework.dao.DataIntegrityViolationException;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -60,6 +62,9 @@ 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())") })
|
||||
public CommandProcessingResult createOffice(final JsonCommand command) {
|
||||
|
||||
try {
|
||||
@@ -95,6 +100,9 @@ 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())") })
|
||||
public CommandProcessingResult updateOffice(final Long officeId, final JsonCommand command) {
|
||||
|
||||
try {
|
||||
@@ -230,4 +238,8 @@ public class OfficeWritePlatformServiceJpaRepositoryImpl implements OfficeWriteP
|
||||
|
||||
return officeToReturn;
|
||||
}
|
||||
|
||||
public PlatformSecurityContext getContext() {
|
||||
return this.context;
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -5,6 +5,7 @@
|
||||
*/
|
||||
package org.mifosplatform.portfolio.charge.data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
@@ -16,7 +17,7 @@ import org.mifosplatform.portfolio.loanaccount.data.LoanChargeData;
|
||||
/**
|
||||
* Immutable data object for charge data.
|
||||
*/
|
||||
public class ChargeData implements Comparable<ChargeData> {
|
||||
public class ChargeData implements Comparable<ChargeData>, Serializable {
|
||||
|
||||
private final Long id;
|
||||
private final String name;
|
||||
|
||||
+2
@@ -21,6 +21,7 @@ import org.mifosplatform.portfolio.charge.data.ChargeData;
|
||||
import org.mifosplatform.portfolio.charge.domain.ChargeAppliesTo;
|
||||
import org.mifosplatform.portfolio.charge.exception.ChargeNotFoundException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.dao.EmptyResultDataAccessException;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.jdbc.core.RowMapper;
|
||||
@@ -45,6 +46,7 @@ public class ChargeReadPlatformServiceImpl implements ChargeReadPlatformService
|
||||
}
|
||||
|
||||
@Override
|
||||
@Cacheable(value = "charges", key = "T(org.mifosplatform.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier()")
|
||||
public Collection<ChargeData> retrieveAllCharges() {
|
||||
this.context.authenticatedUser();
|
||||
|
||||
|
||||
+4
@@ -26,6 +26,7 @@ import org.mifosplatform.portfolio.loanproduct.domain.LoanProductRepository;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.dao.DataIntegrityViolationException;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -56,6 +57,7 @@ public class ChargeWritePlatformServiceJpaRepositoryImpl implements ChargeWriteP
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
@CacheEvict(value = "charges", key = "T(org.mifosplatform.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier()")
|
||||
public CommandProcessingResult createCharge(final JsonCommand command) {
|
||||
try {
|
||||
this.context.authenticatedUser();
|
||||
@@ -74,6 +76,7 @@ public class ChargeWritePlatformServiceJpaRepositoryImpl implements ChargeWriteP
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
@CacheEvict(value = "charges", key = "T(org.mifosplatform.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier()")
|
||||
public CommandProcessingResult updateCharge(final Long chargeId, final JsonCommand command) {
|
||||
|
||||
try {
|
||||
@@ -99,6 +102,7 @@ public class ChargeWritePlatformServiceJpaRepositoryImpl implements ChargeWriteP
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
@CacheEvict(value = "charges", key = "T(org.mifosplatform.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier()")
|
||||
public CommandProcessingResult deleteCharge(final Long chargeId) {
|
||||
|
||||
this.context.authenticatedUser();
|
||||
|
||||
@@ -5,10 +5,12 @@
|
||||
*/
|
||||
package org.mifosplatform.portfolio.fund.data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Immutable data object to represent fund data.
|
||||
*/
|
||||
public class FundData {
|
||||
public class FundData implements Serializable {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private Long id;
|
||||
|
||||
+2
@@ -14,6 +14,7 @@ import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext
|
||||
import org.mifosplatform.portfolio.fund.data.FundData;
|
||||
import org.mifosplatform.portfolio.fund.exception.FundNotFoundException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.dao.EmptyResultDataAccessException;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.jdbc.core.RowMapper;
|
||||
@@ -49,6 +50,7 @@ public class FundReadPlatformServiceImpl implements FundReadPlatformService {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Cacheable(value = "funds", key = "T(org.mifosplatform.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier()")
|
||||
public Collection<FundData> retrieveAllFunds() {
|
||||
|
||||
context.authenticatedUser();
|
||||
|
||||
+3
@@ -19,6 +19,7 @@ import org.mifosplatform.portfolio.fund.serialization.FundCommandFromApiJsonDese
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.dao.DataIntegrityViolationException;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -42,6 +43,7 @@ public class FundWritePlatformServiceJpaRepositoryImpl implements FundWritePlatf
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
@CacheEvict(value = "fund", key = "T(org.mifosplatform.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier()")
|
||||
public CommandProcessingResult createFund(final JsonCommand command) {
|
||||
|
||||
try {
|
||||
@@ -62,6 +64,7 @@ public class FundWritePlatformServiceJpaRepositoryImpl implements FundWritePlatf
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
@CacheEvict(value = "fund", key = "T(org.mifosplatform.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier()")
|
||||
public CommandProcessingResult updateFund(final Long fundId, final JsonCommand command) {
|
||||
|
||||
try {
|
||||
|
||||
+2
-1
@@ -5,6 +5,7 @@
|
||||
*/
|
||||
package org.mifosplatform.useradministration.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
@@ -26,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> {
|
||||
public class Role extends AbstractPersistable<Long> implements Serializable {
|
||||
|
||||
@Column(name = "name", unique = true, nullable = false, length = 100)
|
||||
private String name;
|
||||
|
||||
+4
@@ -33,6 +33,7 @@ import org.mifosplatform.useradministration.exception.UserNotFoundException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.dao.DataIntegrityViolationException;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -66,6 +67,7 @@ public class AppUserWritePlatformServiceJpaRepositoryImpl implements AppUserWrit
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
@CacheEvict(value = "users", allEntries = true)
|
||||
public CommandProcessingResult createUser(final JsonCommand command) {
|
||||
|
||||
try {
|
||||
@@ -109,6 +111,7 @@ public class AppUserWritePlatformServiceJpaRepositoryImpl implements AppUserWrit
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
@CacheEvict(value = "users", allEntries = true)
|
||||
public CommandProcessingResult updateUser(final Long userId, final JsonCommand command) {
|
||||
|
||||
try {
|
||||
@@ -169,6 +172,7 @@ public class AppUserWritePlatformServiceJpaRepositoryImpl implements AppUserWrit
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
@CacheEvict(value = "users", allEntries = true)
|
||||
public CommandProcessingResult deleteUser(final Long userId) {
|
||||
|
||||
final AppUser user = this.appUserRepository.findOne(userId);
|
||||
|
||||
+3
@@ -14,6 +14,8 @@ import org.mifosplatform.infrastructure.core.service.RoutingDataSource;
|
||||
import org.mifosplatform.useradministration.data.RoleData;
|
||||
import org.mifosplatform.useradministration.exception.RoleNotFoundException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.dao.EmptyResultDataAccessException;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.jdbc.core.RowMapper;
|
||||
@@ -32,6 +34,7 @@ public class RoleReadPlatformServiceImpl implements RoleReadPlatformService {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Cacheable(value = "roles", key = "T(org.mifosplatform.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier()")
|
||||
public Collection<RoleData> retrieveAll() {
|
||||
final String sql = "select " + roleRowMapper.schema() + " order by r.id";
|
||||
|
||||
|
||||
+4
@@ -25,6 +25,7 @@ import org.mifosplatform.useradministration.serialization.PermissionsCommandFrom
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.dao.DataIntegrityViolationException;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -52,6 +53,7 @@ public class RoleWritePlatformServiceJpaRepositoryImpl implements RoleWritePlatf
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
@CacheEvict(value = "roles", key = "T(org.mifosplatform.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier()")
|
||||
public CommandProcessingResult createRole(final JsonCommand command) {
|
||||
|
||||
try {
|
||||
@@ -97,6 +99,7 @@ public class RoleWritePlatformServiceJpaRepositoryImpl implements RoleWritePlatf
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
@CacheEvict(value = "roles", key = "T(org.mifosplatform.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier()")
|
||||
public CommandProcessingResult updateRole(final Long roleId, final JsonCommand command) {
|
||||
try {
|
||||
context.authenticatedUser();
|
||||
@@ -126,6 +129,7 @@ public class RoleWritePlatformServiceJpaRepositoryImpl implements RoleWritePlatf
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
@CacheEvict(value = "roles", key = "T(org.mifosplatform.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier()")
|
||||
public CommandProcessingResult updateRolePermissions(final Long roleId, final JsonCommand command) {
|
||||
context.authenticatedUser();
|
||||
|
||||
|
||||
@@ -12,16 +12,20 @@
|
||||
xmlns:jpa="http://www.springframework.org/schema/data/jpa"
|
||||
xmlns:sec="http://www.springframework.org/schema/security"
|
||||
xmlns:tx="http://www.springframework.org/schema/tx"
|
||||
xmlns:cache="http://www.springframework.org/schema/cache"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
|
||||
http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa.xsd
|
||||
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd
|
||||
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
|
||||
http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache.xsd">
|
||||
|
||||
<sec:global-method-security pre-post-annotations="enabled" />
|
||||
|
||||
<tx:annotation-driven />
|
||||
|
||||
<cache:annotation-driven />
|
||||
|
||||
<context:component-scan base-package="org.mifosplatform.accounting.*,
|
||||
org.mifosplatform.commands.handler.*,
|
||||
org.mifosplatform.commands.service.*,
|
||||
@@ -53,5 +57,7 @@
|
||||
<import resource="infrastructure.xml" />
|
||||
|
||||
<import resource="securityContext.xml" />
|
||||
|
||||
<import resource="memcached.xml" />
|
||||
|
||||
</beans>
|
||||
@@ -0,0 +1,200 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
|
||||
xmlns:tx="http://www.springframework.org/schema/tx"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
|
||||
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
|
||||
|
||||
<!-- Cache manager -->
|
||||
<bean name="cacheManager" class="com.google.code.ssm.spring.ExtendedSSMCacheManager">
|
||||
<property name="caches">
|
||||
<set>
|
||||
<bean class="com.google.code.ssm.spring.SSMCache">
|
||||
<constructor-arg name="cache" index="0" ref="users" />
|
||||
<constructor-arg name="expiration" index="1" value="0" />
|
||||
<constructor-arg name="allowClear" index="2" value="true" />
|
||||
</bean>
|
||||
<bean class="com.google.code.ssm.spring.SSMCache">
|
||||
<constructor-arg name="cache" index="0" ref="roles" />
|
||||
<constructor-arg name="expiration" index="1" value="0" />
|
||||
<constructor-arg name="allowClear" index="2" value="true" />
|
||||
</bean>
|
||||
<bean class="com.google.code.ssm.spring.SSMCache">
|
||||
<constructor-arg name="cache" index="0" ref="offices" />
|
||||
<constructor-arg name="expiration" index="1" value="0" />
|
||||
<constructor-arg name="allowClear" index="2" value="true" />
|
||||
</bean>
|
||||
<bean class="com.google.code.ssm.spring.SSMCache">
|
||||
<constructor-arg name="cache" index="0" ref="office_template" />
|
||||
<constructor-arg name="expiration" index="1" value="0" />
|
||||
<constructor-arg name="allowClear" index="2" value="true" />
|
||||
</bean>
|
||||
<bean class="com.google.code.ssm.spring.SSMCache">
|
||||
<constructor-arg name="cache" index="0" ref="charges" />
|
||||
<constructor-arg name="expiration" index="1" value="0" />
|
||||
<constructor-arg name="allowClear" index="2" value="true" />
|
||||
</bean>
|
||||
<bean class="com.google.code.ssm.spring.SSMCache">
|
||||
<constructor-arg name="cache" index="0" ref="funds" />
|
||||
<constructor-arg name="expiration" index="1" value="0" />
|
||||
<constructor-arg name="allowClear" index="2" value="true" />
|
||||
</bean>
|
||||
<bean class="com.google.code.ssm.spring.SSMCache">
|
||||
<constructor-arg name="cache" index="0" ref="code_values" />
|
||||
<constructor-arg name="expiration" index="1" value="0" />
|
||||
<constructor-arg name="allowClear" index="2" value="true" />
|
||||
</bean>
|
||||
<bean class="com.google.code.ssm.spring.SSMCache">
|
||||
<constructor-arg name="cache" index="0" ref="codes" />
|
||||
<constructor-arg name="expiration" index="1" value="0" />
|
||||
<constructor-arg name="allowClear" index="2" value="true" />
|
||||
</bean>
|
||||
</set>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean name="users" class="com.google.code.ssm.CacheFactory">
|
||||
<property name="cacheName" value="users" />
|
||||
<property name="cacheClientFactory">
|
||||
<bean name="cacheClientFactory"
|
||||
class="com.google.code.ssm.providers.xmemcached.MemcacheClientFactoryImpl" />
|
||||
</property>
|
||||
<property name="addressProvider">
|
||||
<bean class="com.google.code.ssm.config.DefaultAddressProvider">
|
||||
<property name="address" value="127.0.0.1:11211" />
|
||||
</bean>
|
||||
</property>
|
||||
<property name="configuration">
|
||||
<bean class="com.google.code.ssm.providers.CacheConfiguration">
|
||||
<property name="consistentHashing" value="true" />
|
||||
</bean>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean name="roles" class="com.google.code.ssm.CacheFactory">
|
||||
<property name="cacheName" value="roles" />
|
||||
<property name="cacheClientFactory">
|
||||
<bean name="cacheClientFactory"
|
||||
class="com.google.code.ssm.providers.xmemcached.MemcacheClientFactoryImpl" />
|
||||
</property>
|
||||
<property name="addressProvider">
|
||||
<bean class="com.google.code.ssm.config.DefaultAddressProvider">
|
||||
<property name="address" value="127.0.0.1:11211" />
|
||||
</bean>
|
||||
</property>
|
||||
<property name="configuration">
|
||||
<bean class="com.google.code.ssm.providers.CacheConfiguration">
|
||||
<property name="consistentHashing" value="true" />
|
||||
</bean>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean name="offices" class="com.google.code.ssm.CacheFactory">
|
||||
<property name="cacheName" value="offices"/>
|
||||
<property name="cacheClientFactory">
|
||||
<bean name="cacheClientFactory"
|
||||
class="com.google.code.ssm.providers.xmemcached.MemcacheClientFactoryImpl" />
|
||||
</property>
|
||||
<property name="addressProvider">
|
||||
<bean class="com.google.code.ssm.config.DefaultAddressProvider">
|
||||
<property name="address" value="127.0.0.1:11211" />
|
||||
</bean>
|
||||
</property>
|
||||
<property name="configuration">
|
||||
<bean class="com.google.code.ssm.providers.CacheConfiguration">
|
||||
<property name="consistentHashing" value="true" />
|
||||
</bean>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean name="office_template" class="com.google.code.ssm.CacheFactory">
|
||||
<property name="cacheName" value="office_template" />
|
||||
<property name="cacheClientFactory">
|
||||
<bean name="cacheClientFactory"
|
||||
class="com.google.code.ssm.providers.xmemcached.MemcacheClientFactoryImpl" />
|
||||
</property>
|
||||
<property name="addressProvider">
|
||||
<bean class="com.google.code.ssm.config.DefaultAddressProvider">
|
||||
<property name="address" value="127.0.0.1:11211" />
|
||||
</bean>
|
||||
</property>
|
||||
<property name="configuration">
|
||||
<bean class="com.google.code.ssm.providers.CacheConfiguration">
|
||||
<property name="consistentHashing" value="true" />
|
||||
</bean>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean name="charges" class="com.google.code.ssm.CacheFactory">
|
||||
<property name="cacheName" value="charges" />
|
||||
<property name="cacheClientFactory">
|
||||
<bean name="cacheClientFactory"
|
||||
class="com.google.code.ssm.providers.xmemcached.MemcacheClientFactoryImpl" />
|
||||
</property>
|
||||
<property name="addressProvider">
|
||||
<bean class="com.google.code.ssm.config.DefaultAddressProvider">
|
||||
<property name="address" value="127.0.0.1:11211" />
|
||||
</bean>
|
||||
</property>
|
||||
<property name="configuration">
|
||||
<bean class="com.google.code.ssm.providers.CacheConfiguration">
|
||||
<property name="consistentHashing" value="true" />
|
||||
</bean>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean name="funds" class="com.google.code.ssm.CacheFactory">
|
||||
<property name="cacheName" value="funds" />
|
||||
<property name="cacheClientFactory">
|
||||
<bean name="cacheClientFactory"
|
||||
class="com.google.code.ssm.providers.xmemcached.MemcacheClientFactoryImpl" />
|
||||
</property>
|
||||
<property name="addressProvider">
|
||||
<bean class="com.google.code.ssm.config.DefaultAddressProvider">
|
||||
<property name="address" value="127.0.0.1:11211" />
|
||||
</bean>
|
||||
</property>
|
||||
<property name="configuration">
|
||||
<bean class="com.google.code.ssm.providers.CacheConfiguration">
|
||||
<property name="consistentHashing" value="true" />
|
||||
</bean>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean name="codes" class="com.google.code.ssm.CacheFactory">
|
||||
<property name="cacheName" value="codes" />
|
||||
<property name="cacheClientFactory">
|
||||
<bean name="cacheClientFactory"
|
||||
class="com.google.code.ssm.providers.xmemcached.MemcacheClientFactoryImpl" />
|
||||
</property>
|
||||
<property name="addressProvider">
|
||||
<bean class="com.google.code.ssm.config.DefaultAddressProvider">
|
||||
<property name="address" value="127.0.0.1:11211" />
|
||||
</bean>
|
||||
</property>
|
||||
<property name="configuration">
|
||||
<bean class="com.google.code.ssm.providers.CacheConfiguration">
|
||||
<property name="consistentHashing" value="true" />
|
||||
</bean>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean name="code_values" class="com.google.code.ssm.CacheFactory">
|
||||
<property name="cacheName" value="code_values" />
|
||||
<property name="cacheClientFactory">
|
||||
<bean name="cacheClientFactory"
|
||||
class="com.google.code.ssm.providers.xmemcached.MemcacheClientFactoryImpl" />
|
||||
</property>
|
||||
<property name="addressProvider">
|
||||
<bean class="com.google.code.ssm.config.DefaultAddressProvider">
|
||||
<property name="address" value="127.0.0.1:11211" />
|
||||
</bean>
|
||||
</property>
|
||||
<property name="configuration">
|
||||
<bean class="com.google.code.ssm.providers.CacheConfiguration">
|
||||
<property name="consistentHashing" value="true" />
|
||||
</bean>
|
||||
</property>
|
||||
</bean>
|
||||
</beans>
|
||||
Reference in New Issue
Block a user