remove warnings about unused imports and make CodeValueData immutable.
This commit is contained in:
+2
-8
@@ -19,18 +19,13 @@ import javax.ws.rs.core.Response;
|
|||||||
import javax.ws.rs.core.UriInfo;
|
import javax.ws.rs.core.UriInfo;
|
||||||
|
|
||||||
import org.mifosng.platform.api.commands.ClientIdentifierCommand;
|
import org.mifosng.platform.api.commands.ClientIdentifierCommand;
|
||||||
import org.mifosng.platform.api.data.ClientData;
|
|
||||||
import org.mifosng.platform.api.data.ClientIdentifierData;
|
import org.mifosng.platform.api.data.ClientIdentifierData;
|
||||||
import org.mifosng.platform.api.data.ClientLookup;
|
|
||||||
import org.mifosng.platform.api.data.EntityIdentifier;
|
import org.mifosng.platform.api.data.EntityIdentifier;
|
||||||
import org.mifosng.platform.api.infrastructure.ApiDataConversionService;
|
import org.mifosng.platform.api.infrastructure.ApiDataConversionService;
|
||||||
import org.mifosng.platform.api.infrastructure.ApiJsonSerializerService;
|
import org.mifosng.platform.api.infrastructure.ApiJsonSerializerService;
|
||||||
import org.mifosng.platform.api.infrastructure.ApiParameterHelper;
|
import org.mifosng.platform.api.infrastructure.ApiParameterHelper;
|
||||||
import org.mifosng.platform.client.service.ClientReadPlatformService;
|
import org.mifosng.platform.client.service.ClientReadPlatformService;
|
||||||
import org.mifosng.platform.client.service.ClientWritePlatformService;
|
import org.mifosng.platform.client.service.ClientWritePlatformService;
|
||||||
import org.mifosng.platform.organisation.service.OfficeReadPlatformService;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@@ -40,8 +35,7 @@ import org.springframework.stereotype.Component;
|
|||||||
@Scope("singleton")
|
@Scope("singleton")
|
||||||
public class ClientIdentifiersApiResource {
|
public class ClientIdentifiersApiResource {
|
||||||
|
|
||||||
private final static Logger logger = LoggerFactory
|
// private final static Logger logger = LoggerFactory.getLogger(ClientIdentifiersApiResource.class);
|
||||||
.getLogger(ClientIdentifiersApiResource.class);
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ClientReadPlatformService clientReadPlatformService;
|
private ClientReadPlatformService clientReadPlatformService;
|
||||||
@@ -179,7 +173,7 @@ public class ClientIdentifiersApiResource {
|
|||||||
@Consumes({ MediaType.APPLICATION_JSON })
|
@Consumes({ MediaType.APPLICATION_JSON })
|
||||||
@Produces({ MediaType.APPLICATION_JSON })
|
@Produces({ MediaType.APPLICATION_JSON })
|
||||||
public Response deleteClientIdentifier(
|
public Response deleteClientIdentifier(
|
||||||
@PathParam("clientId") final Long clientId,
|
// @PathParam("clientId") final Long clientId,
|
||||||
@PathParam("identifierId") final Long clientIdentifierId) {
|
@PathParam("identifierId") final Long clientIdentifierId) {
|
||||||
|
|
||||||
this.clientWritePlatformService
|
this.clientWritePlatformService
|
||||||
|
|||||||
@@ -1,39 +1,25 @@
|
|||||||
package org.mifosng.platform.api.data;
|
package org.mifosng.platform.api.data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Immutable data object represent code-value data in system.
|
||||||
|
*/
|
||||||
public class CodeValueData {
|
public class CodeValueData {
|
||||||
|
|
||||||
private Long id;
|
@SuppressWarnings("unused")
|
||||||
private String name;
|
private final Long id;
|
||||||
private Integer position;
|
|
||||||
|
|
||||||
public CodeValueData(final Long id, final String name,
|
@SuppressWarnings("unused")
|
||||||
|
private final String name;
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
private final Integer position;
|
||||||
|
|
||||||
|
public CodeValueData(
|
||||||
|
final Long id,
|
||||||
|
final String name,
|
||||||
final Integer position) {
|
final Integer position) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
|
||||||
|
|
||||||
public Long getId() {
|
|
||||||
return this.id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return this.name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getPosition() {
|
|
||||||
return position;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPosition(Integer position) {
|
|
||||||
this.position = position;
|
this.position = position;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setId(Long id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
+8
-7
@@ -16,10 +16,12 @@ import org.mifosng.platform.user.domain.AppUser;
|
|||||||
@Table(name = "m_client_identifier")
|
@Table(name = "m_client_identifier")
|
||||||
public class ClientIdentifier extends AbstractAuditableCustom<AppUser, Long> {
|
public class ClientIdentifier extends AbstractAuditableCustom<AppUser, Long> {
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
@JoinColumn(name = "client_id", nullable = false)
|
@JoinColumn(name = "client_id", nullable = false)
|
||||||
private Client client;
|
private Client client;
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
@JoinColumn(name = "document_type_id", nullable = false)
|
@JoinColumn(name = "document_type_id", nullable = false)
|
||||||
private CodeValue documentType;
|
private CodeValue documentType;
|
||||||
@@ -39,14 +41,15 @@ public class ClientIdentifier extends AbstractAuditableCustom<AppUser, Long> {
|
|||||||
this.description = null;
|
this.description = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ClientIdentifier createNew(Client client,
|
public static ClientIdentifier createNew(
|
||||||
final CodeValue documentType, final String documentKey,
|
final Client client,
|
||||||
|
final CodeValue documentType,
|
||||||
|
final String documentKey,
|
||||||
final String description) {
|
final String description) {
|
||||||
return new ClientIdentifier(client, documentType, documentKey,
|
return new ClientIdentifier(client, documentType, documentKey, description);
|
||||||
description);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private ClientIdentifier(Client client, final CodeValue documentType,
|
private ClientIdentifier(final Client client, final CodeValue documentType,
|
||||||
final String documentKey, final String description) {
|
final String documentKey, final String description) {
|
||||||
this.client = client;
|
this.client = client;
|
||||||
this.documentType = documentType;
|
this.documentType = documentType;
|
||||||
@@ -69,7 +72,5 @@ public class ClientIdentifier extends AbstractAuditableCustom<AppUser, Long> {
|
|||||||
this.description = StringUtils.defaultIfEmpty(
|
this.description = StringUtils.defaultIfEmpty(
|
||||||
command.getDescription(), null);
|
command.getDescription(), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
+2
@@ -220,10 +220,12 @@ public class GenericDataServiceImpl implements GenericDataService {
|
|||||||
try {
|
try {
|
||||||
if (db_statement != null) {
|
if (db_statement != null) {
|
||||||
db_statement.close();
|
db_statement.close();
|
||||||
|
// parameter assignment in this case is ok.
|
||||||
db_statement = null;
|
db_statement = null;
|
||||||
}
|
}
|
||||||
if (db_connection != null) {
|
if (db_connection != null) {
|
||||||
db_connection.close();
|
db_connection.close();
|
||||||
|
// parameter assignment in this case is ok.
|
||||||
db_connection = null;
|
db_connection = null;
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
|
|||||||
+2
-3
@@ -11,7 +11,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.jdbc.core.JdbcTemplate;
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
import org.springframework.jdbc.core.RowMapper;
|
import org.springframework.jdbc.core.RowMapper;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class CodeValueReadPlatformServiceImpl implements CodeValueReadPlatformService {
|
public class CodeValueReadPlatformServiceImpl implements CodeValueReadPlatformService {
|
||||||
@@ -35,7 +34,7 @@ public class CodeValueReadPlatformServiceImpl implements CodeValueReadPlatformSe
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CodeValueData mapRow(final ResultSet rs, final int rowNum)
|
public CodeValueData mapRow(final ResultSet rs, @SuppressWarnings("unused") final int rowNum)
|
||||||
throws SQLException {
|
throws SQLException {
|
||||||
|
|
||||||
Long id = rs.getLong("id");
|
Long id = rs.getLong("id");
|
||||||
@@ -47,7 +46,7 @@ public class CodeValueReadPlatformServiceImpl implements CodeValueReadPlatformSe
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<CodeValueData> retrieveAllCodeValues(Long codeId) {
|
public Collection<CodeValueData> retrieveAllCodeValues(final Long codeId) {
|
||||||
context.authenticatedUser();
|
context.authenticatedUser();
|
||||||
|
|
||||||
CodeValueDataMapper rm = new CodeValueDataMapper();
|
CodeValueDataMapper rm = new CodeValueDataMapper();
|
||||||
|
|||||||
Reference in New Issue
Block a user