Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some Checkstyle warnings #282

Merged
merged 1 commit into from
Nov 14, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/main/java/mil/dds/anet/beans/Report.java
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ public void setEngagementDate(DateTime engagementDate) {

/**
* Returns an Integer value from the set (1,2,3,4,5,6,7) in accordance with
* week days [Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday]
* week days [Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday].
*
* @return Integer engagement day of week
*/
public Integer getEngagementDayOfWeek() {
Expand Down
18 changes: 9 additions & 9 deletions src/main/java/mil/dds/anet/database/OrganizationDao.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,15 @@ public List<Organization> getTopLevelOrgs(OrganizationType type) {
@UseStringTemplate3StatementLocator
public interface OrgListQueries {
@Mapper(OrganizationMapper.class)
@SqlQuery("SELECT id AS organizations_id" +
", shortName AS organizations_shortName" +
", longName AS organizations_longName" +
", identificationCode AS organizations_identificationCode" +
", type AS organizations_type" +
", parentOrgId AS organizations_parentOrgId" +
", createdAt AS organizations_createdAt" +
", updatedAt AS organizations_updatedAt" +
" FROM organizations WHERE shortName IN ( <shortNames> )")
@SqlQuery("SELECT id AS organizations_id"
+ ", shortName AS organizations_shortName"
+ ", longName AS organizations_longName"
+ ", identificationCode AS organizations_identificationCode"
+ ", type AS organizations_type"
+ ", parentOrgId AS organizations_parentOrgId"
+ ", createdAt AS organizations_createdAt"
+ ", updatedAt AS organizations_updatedAt"
+ " FROM organizations WHERE shortName IN ( <shortNames> )")
public List<Organization> getOrgsByShortNames(@BindIn("shortNames") List<String> shortNames);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,7 @@ public ReportSensitiveInformation getForReport(Report report, Person user) {
ReportSensitiveInformation rsi = (results.size() == 0) ? null : results.get(0);
if (rsi != null) {
AnetAuditLogger.log("ReportSensitiveInformation {} retrieved by {} ", rsi, user);
}
else {
} else {
rsi = new ReportSensitiveInformation();
rsi.setReportId(report.getId());
}
Expand All @@ -120,8 +119,8 @@ public ReportSensitiveInformation getForReport(Report report, Person user) {

/**
* A user is allowed to access a report's sensitive information if either of the following holds true:
* • the user is the author of the report
* • the user holds an authorized position in the advisorOrg of the report
* • the user is the author of the report;
* • the user holds an authorized position in the advisorOrg of the report.
*
* @param user the user executing the request
* @param report the report
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/mil/dds/anet/resources/GraphQLResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -338,11 +338,10 @@ private void locateData(final XSSFWorkbook workbook, final String name, final Ma
}

/**
* TODO: This should end up in a converter type class, perhaps lookup by annotations.
*
* Create the sheet with the supplied name in the supplied workbook using the
* supplied data.
*
* TODO: This should end up in a converter type class, perhaps lookup by annotations.
*
* @param workbook
* the workbook
* @param name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,7 @@ public Organization createNewOrganization(Organization org, @Auth Person user) {
final Organization created;
try {
created = dao.insert(org);
}
catch (UnableToExecuteStatementException e) {
} catch (UnableToExecuteStatementException e) {
throw handleSqlException(e);
}

Expand Down Expand Up @@ -145,8 +144,7 @@ public Response updateOrganization(Organization org, @Auth Person user) {
final int numRows;
try {
numRows = dao.update(org);
}
catch (UnableToExecuteStatementException e) {
} catch (UnableToExecuteStatementException e) {
throw handleSqlException(e);
}

Expand Down
3 changes: 1 addition & 2 deletions src/main/java/mil/dds/anet/resources/PositionResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,7 @@ public Response updatePosition(@Auth Person user, Position pos) {

if (origPos.getAuthorized() != pos.getAuthorized()) {
AnetAuditLogger.log("Position {} edited by {}; authorized changed from {} to {}", pos, user, origPos.getAuthorized(), pos.getAuthorized());
}
else {
} else {
AnetAuditLogger.log("Position {} edited by {}", pos, user);
}
return (numRows == 1) ? Response.ok().build() : Response.status(Status.NOT_FOUND).build();
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/mil/dds/anet/resources/ReportResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -769,16 +769,16 @@ public List<Map<String, Object>> getAdvisorReportInsights(
}

private Map<Integer, Organization> getOrgsByShortNames(List<String> orgShortNames) {
final Map<Integer, Organization> result = new HashMap<>();
for (final Organization organization : engine.getOrganizationDao().getOrgsByShortNames(orgShortNames)) {
result.put(organization.getId(), organization);
}
return result;
final Map<Integer, Organization> result = new HashMap<>();
for (final Organization organization : engine.getOrganizationDao().getOrgsByShortNames(orgShortNames)) {
result.put(organization.getId(), organization);
}
return result;
}

/**
* The comparator to be used when ordering the roll up graph results to ensure
* that any pinned organisation names are returned at the start of the list.
*
*/
public static class RollupGraphComparator implements Comparator<RollupGraph> {

Expand Down