remove warnings about unused imports and make CodeValueData immutable.

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