refactor: add lombok to entityaccess module

This commit is contained in:
Hemant Gupta
2022-10-12 12:32:38 +02:00
committed by Arnold Gálovics
parent bc289bcb4d
commit 8862f1f824
13 changed files with 114 additions and 211 deletions
@@ -18,31 +18,19 @@
*/ */
package org.apache.fineract.infrastructure.entityaccess.data; package org.apache.fineract.infrastructure.entityaccess.data;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.apache.fineract.infrastructure.entityaccess.domain.FineractEntity; import org.apache.fineract.infrastructure.entityaccess.domain.FineractEntity;
import org.apache.fineract.infrastructure.entityaccess.domain.FineractEntityAccessType; import org.apache.fineract.infrastructure.entityaccess.domain.FineractEntityAccessType;
@Data
@NoArgsConstructor
@Accessors(chain = true)
public class FineractEntityAccessData { public class FineractEntityAccessData {
private FineractEntity firstEntity; private FineractEntity firstEntity;
private FineractEntityAccessType accessType; private FineractEntityAccessType accessType;
private FineractEntity secondEntity; private FineractEntity secondEntity;
public FineractEntityAccessData(FineractEntity firstEntity, FineractEntityAccessType accessType, FineractEntity secondEntity) {
this.firstEntity = firstEntity;
this.accessType = accessType;
this.secondEntity = secondEntity;
}
public FineractEntity getFirstEntity() {
return this.firstEntity;
}
public FineractEntityAccessType getAccessType() {
return this.accessType;
}
public FineractEntity getSecondEntity() {
return this.secondEntity;
}
} }
@@ -19,28 +19,29 @@
package org.apache.fineract.infrastructure.entityaccess.data; package org.apache.fineract.infrastructure.entityaccess.data;
import java.io.Serializable; import java.io.Serializable;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
@Data
@NoArgsConstructor
@Accessors(chain = true)
public class FineractEntityRelationData implements Serializable { public class FineractEntityRelationData implements Serializable {
private static final long serialVersionUID = 1L;
@SuppressWarnings("unused") @SuppressWarnings("unused")
private final Long id; private Long id;
@SuppressWarnings("unused") @SuppressWarnings("unused")
private final Integer fromEntityType; private Integer fromEntityType;
@SuppressWarnings("unused") @SuppressWarnings("unused")
private final Integer toEntityType; private Integer toEntityType;
@SuppressWarnings("unused") @SuppressWarnings("unused")
private final String mappingTypes; private String mappingTypes;
public FineractEntityRelationData(final Long id, final Integer fromEntityType, final Integer toEntityType, final String mappingTypes) {
this.id = id;
this.fromEntityType = fromEntityType;
this.toEntityType = toEntityType;
this.mappingTypes = mappingTypes;
}
public static FineractEntityRelationData getMappingTypes(final Long id, final String mappingTypes) { public static FineractEntityRelationData getMappingTypes(final Long id, final String mappingTypes) {
Integer fromEntityType = null; Integer fromEntityType = null;
final Integer toEntityType = null; final Integer toEntityType = null;
return new FineractEntityRelationData(id, fromEntityType, toEntityType, mappingTypes); return new FineractEntityRelationData().setId(id).setFromEntityType(fromEntityType).setToEntityType(toEntityType)
.setMappingTypes(mappingTypes);
} }
} }
@@ -20,9 +20,16 @@ package org.apache.fineract.infrastructure.entityaccess.data;
import java.io.Serializable; import java.io.Serializable;
import java.time.LocalDate; import java.time.LocalDate;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
public final class FineractEntityToEntityMappingData implements Serializable { @Data
@NoArgsConstructor
@Accessors(chain = true)
public class FineractEntityToEntityMappingData implements Serializable {
private static final long serialVersionUID = 1L;
@SuppressWarnings("unused") @SuppressWarnings("unused")
private Long mapId; private Long mapId;
@@ -42,27 +49,16 @@ public final class FineractEntityToEntityMappingData implements Serializable {
private LocalDate endDate; private LocalDate endDate;
@SuppressWarnings("unused") @SuppressWarnings("unused")
private final String fromEntity; private String fromEntity;
@SuppressWarnings("unused") @SuppressWarnings("unused")
private final String toEntity; private String toEntity;
private FineractEntityToEntityMappingData(final Long mapId, final Long relationId, final Long fromId, final Long toId,
final LocalDate startDate, final LocalDate endDate, final String fromEntity, final String toEntity) {
this.mapId = mapId;
this.relationId = relationId;
this.fromId = fromId;
this.toId = toId;
this.startDate = startDate;
this.endDate = endDate;
this.fromEntity = fromEntity;
this.toEntity = toEntity;
}
public static FineractEntityToEntityMappingData getRelatedEntities(final Long mapId, final Long relationId, final Long fromId, public static FineractEntityToEntityMappingData getRelatedEntities(final Long mapId, final Long relationId, final Long fromId,
final Long toId, final LocalDate startDate, final LocalDate endDate, final String fromEntity, final String toEntity) { final Long toId, final LocalDate startDate, final LocalDate endDate, final String fromEntity, final String toEntity) {
return new FineractEntityToEntityMappingData(mapId, relationId, fromId, toId, startDate, endDate, fromEntity, toEntity); return new FineractEntityToEntityMappingData().setMapId(mapId).setRelationId(relationId).setFromId(fromId).setToId(toId)
.setStartDate(startDate).setEndDate(endDate).setFromEntity(fromEntity).setToEntity(toEntity);
} }
@@ -72,20 +68,8 @@ public final class FineractEntityToEntityMappingData implements Serializable {
final String fromEntity = null; final String fromEntity = null;
final String toEntity = null; final String toEntity = null;
return new FineractEntityToEntityMappingData(mapId, relationId, fromId, toId, startDate, endDate, fromEntity, toEntity); return new FineractEntityToEntityMappingData().setMapId(mapId).setRelationId(relationId).setFromId(fromId).setToId(toId)
.setStartDate(startDate).setEndDate(endDate).setFromEntity(fromEntity).setToEntity(toEntity);
}
public Long getRelationId() {
return relationId;
}
public Long getToId() {
return toId;
}
public String getFromEntity() {
return fromEntity;
} }
} }
@@ -18,24 +18,17 @@
*/ */
package org.apache.fineract.infrastructure.entityaccess.domain; package org.apache.fineract.infrastructure.entityaccess.domain;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.Accessors;
@Getter
@Setter
@NoArgsConstructor
@Accessors(chain = true)
public class FineractEntity { public class FineractEntity {
private Long entityId; private Long entityId;
private FineractEntityType type; private FineractEntityType type;
@SuppressWarnings("unused")
private FineractEntity() {}
public FineractEntity(Long entityId, FineractEntityType type) {
this.entityId = entityId;
this.type = type;
}
public Long getId() {
return this.entityId;
}
public FineractEntityType getType() {
return this.type;
}
} }
@@ -25,6 +25,10 @@ import javax.persistence.Entity;
import javax.persistence.JoinColumn; import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne; import javax.persistence.ManyToOne;
import javax.persistence.Table; import javax.persistence.Table;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.Accessors;
import org.apache.fineract.infrastructure.codes.domain.CodeValue; import org.apache.fineract.infrastructure.codes.domain.CodeValue;
import org.apache.fineract.infrastructure.core.api.JsonCommand; import org.apache.fineract.infrastructure.core.api.JsonCommand;
import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom; import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
@@ -32,6 +36,10 @@ import org.apache.fineract.infrastructure.entityaccess.FineractEntityAccessConst
@Entity @Entity
@Table(name = "m_entity_to_entity_access") @Table(name = "m_entity_to_entity_access")
@Getter
@Setter
@NoArgsConstructor
@Accessors(chain = true)
public class FineractEntityAccess extends AbstractPersistableCustom { public class FineractEntityAccess extends AbstractPersistableCustom {
@Column(name = "entity_type", length = 50) @Column(name = "entity_type", length = 50)
@@ -50,22 +58,10 @@ public class FineractEntityAccess extends AbstractPersistableCustom {
@Column(name = "second_entity_id") @Column(name = "second_entity_id")
private Long secondEntityId; private Long secondEntityId;
protected FineractEntityAccess() {
}
public static FineractEntityAccess createNew(final String entityType, final Long entityId, final CodeValue accessType, public static FineractEntityAccess createNew(final String entityType, final Long entityId, final CodeValue accessType,
final String secondEntityType, final Long secondEntityId) { final String secondEntityType, final Long secondEntityId) {
return new FineractEntityAccess(entityType, entityId, accessType, secondEntityType, secondEntityId); return new FineractEntityAccess().setEntityType(entityType).setEntityId(entityId).setAccessType(accessType)
} .setSecondEntityType(secondEntityType).setSecondEntityId(secondEntityId);
public FineractEntityAccess(final String entityType, final Long entityId, final CodeValue accessType, final String secondEntityType,
final Long secondEntityId) {
this.entityType = entityType;
this.entityId = entityId;
this.accessType = accessType;
this.secondEntityType = secondEntityType;
this.secondEntityId = secondEntityId;
} }
public static FineractEntityAccess fromJson(final CodeValue accessType, final JsonCommand command) { public static FineractEntityAccess fromJson(final CodeValue accessType, final JsonCommand command) {
@@ -78,7 +74,8 @@ public class FineractEntityAccess extends AbstractPersistableCustom {
final Long secondEntityId = command final Long secondEntityId = command
.longValueOfParameterNamed(FineractEntityAccessConstants.EntityAccessJSONinputParams.SECOND_ENTITY_ID.getValue()); .longValueOfParameterNamed(FineractEntityAccessConstants.EntityAccessJSONinputParams.SECOND_ENTITY_ID.getValue());
return new FineractEntityAccess(entityType, entityId, accessType, secondEntityType, secondEntityId); return new FineractEntityAccess().setEntityType(entityType).setEntityId(entityId).setAccessType(accessType)
.setSecondEntityType(secondEntityType).setSecondEntityId(secondEntityId);
} }
@@ -128,28 +125,4 @@ public class FineractEntityAccess extends AbstractPersistableCustom {
return actualChanges; return actualChanges;
} }
public String getEntityType() {
return this.entityType;
}
public Long getEntityId() {
return this.entityId;
}
public CodeValue getAccessType() {
return this.accessType;
}
public void updateAccessType(final CodeValue accessType) {
this.accessType = accessType;
}
public String getSecondEntityType() {
return this.secondEntityType;
}
public Long getSecondEntityId() {
return this.secondEntityId;
}
} }
@@ -18,23 +18,25 @@
*/ */
package org.apache.fineract.infrastructure.entityaccess.domain; package org.apache.fineract.infrastructure.entityaccess.domain;
public final class FineractEntityAccessType { import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.Accessors;
@Getter
@Setter
@NoArgsConstructor
@Accessors(chain = true)
public class FineractEntityAccessType {
private String str; private String str;
public static final FineractEntityAccessType OFFICE_ACCESS_TO_LOAN_PRODUCTS = new FineractEntityAccessType( public static final FineractEntityAccessType OFFICE_ACCESS_TO_LOAN_PRODUCTS = new FineractEntityAccessType()
"office_access_to_loan_products"); .setStr("office_access_to_loan_products");
public static final FineractEntityAccessType OFFICE_ACCESS_TO_SAVINGS_PRODUCTS = new FineractEntityAccessType( public static final FineractEntityAccessType OFFICE_ACCESS_TO_SAVINGS_PRODUCTS = new FineractEntityAccessType()
"office_access_to_savings_products"); .setStr("office_access_to_savings_products");
public static final FineractEntityAccessType OFFICE_ACCESS_TO_CHARGES = new FineractEntityAccessType("office_access_to_fees/charges"); public static final FineractEntityAccessType OFFICE_ACCESS_TO_CHARGES = new FineractEntityAccessType()
.setStr("office_access_to_fees/charges");
private FineractEntityAccessType(String str) {
this.str = str;
}
public String toStr() {
return this.str;
}
public static FineractEntityAccessType get(String type) { public static FineractEntityAccessType get(String type) {
@@ -25,10 +25,18 @@ import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.OneToMany; import javax.persistence.OneToMany;
import javax.persistence.Table; import javax.persistence.Table;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.Accessors;
import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom; import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
@Entity @Entity
@Table(name = "m_entity_relation") @Table(name = "m_entity_relation")
@Getter
@Setter
@NoArgsConstructor
@Accessors(chain = true)
public class FineractEntityRelation extends AbstractPersistableCustom { public class FineractEntityRelation extends AbstractPersistableCustom {
@OneToMany(cascade = CascadeType.ALL, mappedBy = "relationId", orphanRemoval = true) @OneToMany(cascade = CascadeType.ALL, mappedBy = "relationId", orphanRemoval = true)
@@ -48,10 +56,6 @@ public class FineractEntityRelation extends AbstractPersistableCustom {
* this.fromEntityType = fromEntityType; this.toEntityType = toEntityType; this.codeName = codeName; } * this.fromEntityType = fromEntityType; this.toEntityType = toEntityType; this.codeName = codeName; }
*/ */
public FineractEntityRelation() {
// TODO Auto-generated constructor stub
}
public Set<FineractEntityToEntityMapping> getFineractEntityToEntityMapping() { public Set<FineractEntityToEntityMapping> getFineractEntityToEntityMapping() {
return this.fineractEntityToEntityMapping; return this.fineractEntityToEntityMapping;
} }
@@ -60,28 +64,4 @@ public class FineractEntityRelation extends AbstractPersistableCustom {
this.fineractEntityToEntityMapping = fineractEntityToEntityMapping; this.fineractEntityToEntityMapping = fineractEntityToEntityMapping;
} }
public String getFromEntityType() {
return this.fromEntityType;
}
public void setFromEntityType(String fromEntityType) {
this.fromEntityType = fromEntityType;
}
public String getToEntityType() {
return this.toEntityType;
}
public void setToEntityType(String toEntityType) {
this.toEntityType = toEntityType;
}
public String getCodeName() {
return this.codeName;
}
public void setCodeName(String codeName) {
this.codeName = codeName;
}
} }
@@ -27,6 +27,10 @@ import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne; import javax.persistence.ManyToOne;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.UniqueConstraint; import javax.persistence.UniqueConstraint;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.Accessors;
import org.apache.fineract.infrastructure.core.api.JsonCommand; import org.apache.fineract.infrastructure.core.api.JsonCommand;
import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom; import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
import org.apache.fineract.infrastructure.entityaccess.api.FineractEntityApiResourceConstants; import org.apache.fineract.infrastructure.entityaccess.api.FineractEntityApiResourceConstants;
@@ -34,6 +38,10 @@ import org.apache.fineract.infrastructure.entityaccess.exception.FineractEntityT
@Entity @Entity
@Table(name = "m_entity_to_entity_mapping", uniqueConstraints = { @UniqueConstraint(columnNames = { "rel_id", "from_id", "to_id" }) }) @Table(name = "m_entity_to_entity_mapping", uniqueConstraints = { @UniqueConstraint(columnNames = { "rel_id", "from_id", "to_id" }) })
@Getter
@Setter
@NoArgsConstructor
@Accessors(chain = true)
public class FineractEntityToEntityMapping extends AbstractPersistableCustom { public class FineractEntityToEntityMapping extends AbstractPersistableCustom {
@ManyToOne @ManyToOne
@@ -52,24 +60,11 @@ public class FineractEntityToEntityMapping extends AbstractPersistableCustom {
@Column(name = "end_date", nullable = true) @Column(name = "end_date", nullable = true)
private LocalDate endDate; private LocalDate endDate;
private FineractEntityToEntityMapping(final FineractEntityRelation relationId, final Long fromId, final Long toId,
final LocalDate startDate, final LocalDate endDate) {
this.relationId = relationId;
this.fromId = fromId;
this.toId = toId;
this.startDate = startDate;
this.endDate = endDate;
}
public FineractEntityToEntityMapping() {
//
}
public static FineractEntityToEntityMapping newMap(FineractEntityRelation relationId, Long fromId, Long toId, LocalDate startDate, public static FineractEntityToEntityMapping newMap(FineractEntityRelation relationId, Long fromId, Long toId, LocalDate startDate,
LocalDate endDate) { LocalDate endDate) {
return new FineractEntityToEntityMapping(relationId, fromId, toId, startDate, endDate); return new FineractEntityToEntityMapping().setRelationId(relationId).setFromId(fromId).setToId(toId).setStartDate(startDate)
.setEndDate(endDate);
} }
@@ -110,14 +105,6 @@ public class FineractEntityToEntityMapping extends AbstractPersistableCustom {
} }
public FineractEntityRelation getRelationId() {
return this.relationId;
}
public void setRelationId(FineractEntityRelation relationId) {
this.relationId = relationId;
}
/* /*
* public Date getStartDate() { Date startDate = null; if (this.startDate != null) { startDate = * public Date getStartDate() { Date startDate = null; if (this.startDate != null) { startDate =
* Date.fromDateFields(this.startDate); } return startDate; } * Date.fromDateFields(this.startDate); } return startDate; }
@@ -18,36 +18,31 @@
*/ */
package org.apache.fineract.infrastructure.entityaccess.domain; package org.apache.fineract.infrastructure.entityaccess.domain;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.Accessors;
@Getter
@Setter
@NoArgsConstructor
@Accessors(chain = true)
public final class FineractEntityType { public final class FineractEntityType {
private String type; private String type;
private String description; private String description;
private String tableName; private String tableName;
public static final FineractEntityType OFFICE = new FineractEntityType("office", "Offices", "m_office"); public static final FineractEntityType OFFICE = new FineractEntityType().setType("office").setDescription("Offices")
public static final FineractEntityType LOAN_PRODUCT = new FineractEntityType("loan_product", "Loan Products", "m_product_loan"); .setTableName("m_office");
public static final FineractEntityType SAVINGS_PRODUCT = new FineractEntityType("savings_product", "Savings Products", public static final FineractEntityType LOAN_PRODUCT = new FineractEntityType().setType("loan_product").setDescription("Loan Products")
"m_savings_product"); .setTableName("m_product_loan");
public static final FineractEntityType CHARGE = new FineractEntityType("charge", "Fees/Charges", "m_charge"); public static final FineractEntityType SAVINGS_PRODUCT = new FineractEntityType().setType("savings_product")
public static final FineractEntityType SHARE_PRODUCT = new FineractEntityType("shares_product", "Shares Products", "m_share_product"); .setDescription("Savings Product").setTableName("m_savings_product");
public static final FineractEntityType CHARGE = new FineractEntityType().setType("charge").setDescription("Fees/Charges")
private FineractEntityType(String type, String description, String tableName) { .setTableName("m_charge");
this.type = type; public static final FineractEntityType SHARE_PRODUCT = new FineractEntityType().setType("shares_product")
this.description = description; .setDescription("Shares Product").setTableName("m_share_product");
this.tableName = tableName;
}
public String getType() {
return this.type;
}
public String getDescription() {
return this.description;
}
public String getTable() {
return this.tableName;
}
public static FineractEntityType get(String type) { public static FineractEntityType get(String type) {
@@ -27,7 +27,7 @@ public class FineractEntityAccessConfigurationException extends AbstractPlatform
public FineractEntityAccessConfigurationException(final Long firstEntityId, final FineractEntityType entityType1, public FineractEntityAccessConfigurationException(final Long firstEntityId, final FineractEntityType entityType1,
final FineractEntityAccessType accessType, final FineractEntityType entityType2) { final FineractEntityAccessType accessType, final FineractEntityType entityType2) {
super("error.msg.entityaccess.config", "Error while getting entity access configuration for " + entityType1.getType() + ":" super("error.msg.entityaccess.config", "Error while getting entity access configuration for " + entityType1.getType() + ":"
+ firstEntityId + " with type " + accessType.toStr() + " against " + entityType2.getType()); + firstEntityId + " with type " + accessType.getStr() + " against " + entityType2.getType());
} }
} }
@@ -122,7 +122,7 @@ public class FineractEntityAccessReadServiceImpl implements FineractEntityAccess
Collection<FineractEntityToEntityMappingData> entityAccessData = null; Collection<FineractEntityToEntityMappingData> entityAccessData = null;
GetOneEntityMapper mapper = new GetOneEntityMapper(); GetOneEntityMapper mapper = new GetOneEntityMapper();
if (includeAllSubOffices && firstEntityType.getTable().equals("m_office")) { if (includeAllSubOffices && firstEntityType.getTableName().equals("m_office")) {
sql += " where firstentity.hierarchy like ? order by firstEntity.hierarchy"; sql += " where firstentity.hierarchy like ? order by firstEntity.hierarchy";
entityAccessData = this.jdbcTemplate.query(sql, mapper, new Object[] { fromEntityId, fromEntityId, hierarchySearchString }); entityAccessData = this.jdbcTemplate.query(sql, mapper, new Object[] { fromEntityId, fromEntityId, hierarchySearchString });
} else { } else {
@@ -147,7 +147,7 @@ public class FineractEntityAccessReadServiceImpl implements FineractEntityAccess
FineractEntityType firstEntityType = FineractEntityType.OFFICE; FineractEntityType firstEntityType = FineractEntityType.OFFICE;
FineractEntityRelation fineractEntityRelation = fineractEntityRelationRepository FineractEntityRelation fineractEntityRelation = fineractEntityRelationRepository
.findOneByCodeName(FineractEntityAccessType.OFFICE_ACCESS_TO_LOAN_PRODUCTS.toStr()); .findOneByCodeName(FineractEntityAccessType.OFFICE_ACCESS_TO_LOAN_PRODUCTS.getStr());
Long relId = fineractEntityRelation.getId(); Long relId = fineractEntityRelation.getId();
return getSQLQueryInClause_WithListOfIDsForEntityAccess(firstEntityType, relId, officeId, includeAllOffices); return getSQLQueryInClause_WithListOfIDsForEntityAccess(firstEntityType, relId, officeId, includeAllOffices);
} }
@@ -157,7 +157,7 @@ public class FineractEntityAccessReadServiceImpl implements FineractEntityAccess
FineractEntityType firstEntityType = FineractEntityType.OFFICE; FineractEntityType firstEntityType = FineractEntityType.OFFICE;
FineractEntityRelation fineractEntityRelation = fineractEntityRelationRepository FineractEntityRelation fineractEntityRelation = fineractEntityRelationRepository
.findOneByCodeName(FineractEntityAccessType.OFFICE_ACCESS_TO_SAVINGS_PRODUCTS.toStr()); .findOneByCodeName(FineractEntityAccessType.OFFICE_ACCESS_TO_SAVINGS_PRODUCTS.getStr());
Long relId = fineractEntityRelation.getId(); Long relId = fineractEntityRelation.getId();
return getSQLQueryInClause_WithListOfIDsForEntityAccess(firstEntityType, relId, officeId, includeAllOffices); return getSQLQueryInClause_WithListOfIDsForEntityAccess(firstEntityType, relId, officeId, includeAllOffices);
@@ -168,7 +168,7 @@ public class FineractEntityAccessReadServiceImpl implements FineractEntityAccess
FineractEntityType firstEntityType = FineractEntityType.OFFICE; FineractEntityType firstEntityType = FineractEntityType.OFFICE;
FineractEntityRelation fineractEntityRelation = fineractEntityRelationRepository FineractEntityRelation fineractEntityRelation = fineractEntityRelationRepository
.findOneByCodeName(FineractEntityAccessType.OFFICE_ACCESS_TO_CHARGES.toStr()); .findOneByCodeName(FineractEntityAccessType.OFFICE_ACCESS_TO_CHARGES.getStr());
Long relId = fineractEntityRelation.getId(); Long relId = fineractEntityRelation.getId();
return getSQLQueryInClause_WithListOfIDsForEntityAccess(firstEntityType, relId, officeId, includeAllOffices); return getSQLQueryInClause_WithListOfIDsForEntityAccess(firstEntityType, relId, officeId, includeAllOffices);
@@ -90,7 +90,7 @@ public class FineractEntityAccessUtil {
LocalDate startDateFormapping = null; LocalDate startDateFormapping = null;
LocalDate endDateFormapping = null; LocalDate endDateFormapping = null;
FineractEntityRelation fineractEntityRelation = fineractEntityRelationRepositoryWrapper FineractEntityRelation fineractEntityRelation = fineractEntityRelationRepositoryWrapper
.findOneByCodeName(fineractEntityAccessType.toStr()); .findOneByCodeName(fineractEntityAccessType.getStr());
Long relId = fineractEntityRelation.getId(); Long relId = fineractEntityRelation.getId();
final FineractEntityRelation mapId = this.fineractEntityRelationRepositoryWrapper.findOneWithNotFoundDetection(relId); final FineractEntityRelation mapId = this.fineractEntityRelationRepositoryWrapper.findOneWithNotFoundDetection(relId);
final FineractEntityToEntityMapping newMap = FineractEntityToEntityMapping.newMap(mapId, officeId, productOrChargeId, final FineractEntityToEntityMapping newMap = FineractEntityToEntityMapping.newMap(mapId, officeId, productOrChargeId,
@@ -1693,7 +1693,7 @@ public class LoanApplicationWritePlatformServiceJpaRepositoryImpl implements Loa
.findOneByNameWithNotFoundDetection(FineractEntityAccessConstants.GLOBAL_CONFIG_FOR_OFFICE_SPECIFIC_PRODUCTS); .findOneByNameWithNotFoundDetection(FineractEntityAccessConstants.GLOBAL_CONFIG_FOR_OFFICE_SPECIFIC_PRODUCTS);
if (restrictToUserOfficeProperty.isEnabled()) { if (restrictToUserOfficeProperty.isEnabled()) {
FineractEntityRelation fineractEntityRelation = fineractEntityRelationRepository FineractEntityRelation fineractEntityRelation = fineractEntityRelationRepository
.findOneByCodeName(FineractEntityAccessType.OFFICE_ACCESS_TO_LOAN_PRODUCTS.toStr()); .findOneByCodeName(FineractEntityAccessType.OFFICE_ACCESS_TO_LOAN_PRODUCTS.getStr());
FineractEntityToEntityMapping officeToLoanProductMappingList = this.entityMappingRepository FineractEntityToEntityMapping officeToLoanProductMappingList = this.entityMappingRepository
.findListByProductId(fineractEntityRelation, productId, officeId); .findListByProductId(fineractEntityRelation, productId, officeId);
if (officeToLoanProductMappingList == null) { if (officeToLoanProductMappingList == null) {