Skip to content
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
9 changes: 3 additions & 6 deletions snprc_ehr/src/org/labkey/snprc_ehr/SNPRCBeanFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
public class SNPRCBeanFactory<K> extends BeanObjectFactory<K>
{

private static Logger _log = LogManager.getLogger(BeanObjectFactory.class);
private Class<K> _class;
private static final Logger _log = LogManager.getLogger(BeanObjectFactory.class);
private final Class<K> _class;


public SNPRCBeanFactory(Class<K> clss)
Expand All @@ -55,9 +55,6 @@ public SNPRCBeanFactory(Class<K> clss)
/**
* Maps property fooBar to key foo_bar, in preparation for CRUD operations
*
* @param bean
* @param m
* @return
*/
@Override
public
Expand Down Expand Up @@ -128,7 +125,7 @@ public K fromMap(K bean, Map<String, ?> m)
}
catch (IllegalAccessException | InvocationTargetException x)
{
throw new UnexpectedException(x);
throw UnexpectedException.wrap(x);
}
catch (IllegalArgumentException x)
{
Expand Down
30 changes: 15 additions & 15 deletions snprc_ehr/src/org/labkey/snprc_ehr/SNPRC_EHRController.java
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public void setBaseURL(String baseURL)
}

@RequiresPermission(AdminPermission.class)
public class SSRSConfigAction extends FormViewAction<SSRSConfigForm>
public static class SSRSConfigAction extends FormViewAction<SSRSConfigForm>
{
@Override
public void validateCommand(SSRSConfigForm target, Errors errors)
Expand Down Expand Up @@ -174,7 +174,7 @@ public void addNavTrail(NavTree root)
}

@RequiresPermission(ManageLookupTablesPermission.class)
public class EditLookupTablesAction extends SimpleViewAction
public static class EditLookupTablesAction extends SimpleViewAction<Object>
{

@Override
Expand All @@ -192,7 +192,7 @@ public ModelAndView getView(Object o, BindException errors)


@RequiresPermission(UpdatePermission.class)
public class UpdateQueryAction extends SimpleViewAction<QueryForm>
public static class UpdateQueryAction extends SimpleViewAction<QueryForm>
{
private QueryForm _form;

Expand Down Expand Up @@ -265,7 +265,7 @@ public void addNavTrail(NavTree root)

// http://localhost:8080/labkey/snprc_ehr/snprc/getNextAnimalId
@RequiresPermission(EHRDataEntryPermission.class)
public class getNextAnimalIdAction extends MutatingApiAction<SimpleApiJsonForm>
public static class getNextAnimalIdAction extends MutatingApiAction<SimpleApiJsonForm>
{
@Override
public ApiResponse execute(SimpleApiJsonForm simpleApiJsonForm, BindException errors)
Expand Down Expand Up @@ -302,7 +302,7 @@ public ApiResponse execute(SimpleApiJsonForm simpleApiJsonForm, BindException er
}

@RequiresPermission(SNPRCColonyAdminPermission.class)
public class BirthReportAction extends SimpleRedirectAction
public static class BirthReportAction extends SimpleRedirectAction<Object>
{
@Override
public URLHelper getRedirectURL(Object o)
Expand All @@ -312,7 +312,7 @@ public URLHelper getRedirectURL(Object o)
}

@RequiresPermission(SNPRCColonyAdminPermission.class)
public class SsrsReportsAction extends SimpleRedirectAction
public static class SsrsReportsAction extends SimpleRedirectAction<Object>
{
@Override
public URLHelper getRedirectURL(Object o)
Expand All @@ -322,7 +322,7 @@ public URLHelper getRedirectURL(Object o)
}

@RequiresPermission(ReadPermission.class)
public class IdChipReaderAction extends SimpleRedirectAction
public static class IdChipReaderAction extends SimpleRedirectAction
{
@Override
public URLHelper getRedirectURL(Object o)
Expand All @@ -332,7 +332,7 @@ public URLHelper getRedirectURL(Object o)
}

@RequiresPermission(EHRDataEntryPermission.class)
public class SndEventViewAction extends SimpleRedirectAction
public static class SndEventViewAction extends SimpleRedirectAction<Object>
{
@Override
public URLHelper getRedirectURL(Object o)
Expand All @@ -342,7 +342,7 @@ public URLHelper getRedirectURL(Object o)
}

@RequiresPermission(SNPRCColonyAdminPermission.class)
public class NewAnimalWizardAction extends SimpleRedirectAction
public static class NewAnimalWizardAction extends SimpleRedirectAction<Object>
{
@Override
public URLHelper getRedirectURL(Object o)
Expand All @@ -355,13 +355,13 @@ public URLHelper getRedirectURL(Object o)
* Get all New Animals
*/
@RequiresPermission(SNPRCColonyAdminPermission.class)
public class GetNewAnimalDataAction extends ReadOnlyApiAction<NewAnimalData>
public static class GetNewAnimalDataAction extends ReadOnlyApiAction<NewAnimalData>
{
@Override
public ApiResponse execute(NewAnimalData o, BindException errors)
{

Map<String, Object> props = new HashMap<String, Object>();
Map<String, Object> props = new HashMap<>();


SimpleFilter filter = new SimpleFilter();
Expand All @@ -387,7 +387,7 @@ public ApiResponse execute(NewAnimalData o, BindException errors)
* Update/Add new animal
*/
@RequiresPermission(SNPRCColonyAdminPermission.class)
public class UpdateAnimalDataAction extends MutatingApiAction<NewAnimalData>
public static class UpdateAnimalDataAction extends MutatingApiAction<NewAnimalData>
{
@Override
public void validateForm(NewAnimalData newAnimalData, Errors errors)
Expand Down Expand Up @@ -480,12 +480,12 @@ public ApiResponse execute(NewAnimalData newAnimalData, BindException errors)
}

@RequiresPermission(EHRDataEntryPermission.class)
public class RemoveCategoryAction extends MutatingApiAction<AnimalGroupCategory>
public static class RemoveCategoryAction extends MutatingApiAction<AnimalGroupCategory>
{
@Override
public ApiResponse execute(AnimalGroupCategory animalGroupCategory, BindException errors)
{
Map<String, Object> props = new HashMap<String, Object>();
Map<String, Object> props = new HashMap<>();
try
{
UserSchema us = new SNPRC_EHRUserSchema(getUser(), getContainer());
Expand All @@ -504,7 +504,7 @@ public ApiResponse execute(AnimalGroupCategory animalGroupCategory, BindExceptio
categoriesFilter.addCondition(FieldKey.fromString("category_code"), animalGroupCategory.getCategoryCode(), CompareType.EQUAL);
Map<String, Object> animalGroupsCategory = new TableSelector(categoriesTable, categoriesFilter, null).getObject(Map.class);

List<Map<String, Object>> keys = new ArrayList<Map<String, Object>>();
List<Map<String, Object>> keys = new ArrayList<>();

Map<String, Object> idMap = new HashMap<>();
idMap.put("category_code", animalGroupsCategory.get("category_code"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public AnimalGroupsController()
}

@RequiresPermission(EHRDataEntryPermission.class)
public class GroupCategoriesAction extends SimpleViewAction<AnimalGroupCategory>
public static class GroupCategoriesAction extends SimpleViewAction<AnimalGroupCategory>
{
@Override
public void addNavTrail(NavTree root)
Expand All @@ -114,13 +114,13 @@ public ModelAndView getView(AnimalGroupCategory animalGroupCategory, BindExcepti
* Get all defined categories
*/
@RequiresPermission(EHRDataEntryPermission.class)
public class GetCategoriesAction extends ReadOnlyApiAction<AnimalGroupCategory>
public static class GetCategoriesAction extends ReadOnlyApiAction<AnimalGroupCategory>
{
@Override
public ApiResponse execute(AnimalGroupCategory o, BindException errors)
{

Map<String, Object> props = new HashMap<String, Object>();
Map<String, Object> props = new HashMap<>();

Sort sort = SortFilterHelper.getSort(o.getSort(), true);

Expand Down Expand Up @@ -149,7 +149,7 @@ public ApiResponse execute(AnimalGroupCategory o, BindException errors)
* Update/Add category
*/
@RequiresPermission(EHRDataEntryPermission.class)
public class UpdateCategoriesAction extends MutatingApiAction<AnimalGroupCategory>
public static class UpdateCategoriesAction extends MutatingApiAction<AnimalGroupCategory>
{
@Override
public ApiResponse execute(AnimalGroupCategory o, BindException errors)
Expand Down Expand Up @@ -225,12 +225,12 @@ private Integer getNextCategoryId()
}

@RequiresPermission(EHRDataEntryPermission.class)
public class RemoveCategoryAction extends MutatingApiAction<AnimalGroupCategory>
public static class RemoveCategoryAction extends MutatingApiAction<AnimalGroupCategory>
{
@Override
public ApiResponse execute(AnimalGroupCategory animalGroupCategory, BindException errors)
{
Map<String, Object> props = new HashMap<String, Object>();
Map<String, Object> props = new HashMap<>();
try
{
UserSchema us = new SNPRC_EHRUserSchema(getUser(), getContainer());
Expand All @@ -249,7 +249,7 @@ public ApiResponse execute(AnimalGroupCategory animalGroupCategory, BindExceptio
categoriesFilter.addCondition(FieldKey.fromString("category_code"), animalGroupCategory.getCategoryCode(), CompareType.EQUAL);
Map<String, Object> animalGroupsCategory = new TableSelector(categoriesTable, categoriesFilter, null).getObject(Map.class);

List<Map<String, Object>> keys = new ArrayList<Map<String, Object>>();
List<Map<String, Object>> keys = new ArrayList<>();

Map<String, Object> idMap = new HashMap<>();
idMap.put("category_code", animalGroupsCategory.get("category_code"));
Expand Down Expand Up @@ -289,13 +289,13 @@ public ApiResponse execute(AnimalGroupCategory animalGroupCategory, BindExceptio
* Get all defined species, needed when editing categories
*/
@RequiresPermission(EHRDataEntryPermission.class)
public class GetSpeciesAction extends ReadOnlyApiAction<AnimalSpecies>
public static class GetSpeciesAction extends ReadOnlyApiAction<AnimalSpecies>
{
@Override
public ApiResponse execute(AnimalSpecies o, BindException errors)
{
List<JSONObject> jsonRows = new ArrayList<>();
Map<String, Object> props = new HashMap<String, Object>();
Map<String, Object> props = new HashMap<>();

try
{
Expand Down Expand Up @@ -334,12 +334,12 @@ public ApiResponse execute(AnimalSpecies o, BindException errors)
* Given a category, get all its groups
*/
@RequiresPermission(EHRDataEntryPermission.class)
public class GetGroupsByCategoryAction extends ReadOnlyApiAction<AnimalGroup>
public static class GetGroupsByCategoryAction extends ReadOnlyApiAction<AnimalGroup>
{
@Override
public ApiResponse execute(AnimalGroup animalGroup, BindException errors)
{
Map<String, Object> props = new HashMap<String, Object>();
Map<String, Object> props = new HashMap<>();
UserSchema us = new SNPRC_EHRUserSchema(getUser(), getContainer());

ArrayList<AnimalGroup> rows = new TableSelector(us.getTable("animal_groups", null, true, false),
Expand All @@ -359,7 +359,7 @@ public ApiResponse execute(AnimalGroup animalGroup, BindException errors)
* Given a group, load all animals that are assigned to it
*/
@RequiresPermission(EHRDataEntryPermission.class)
public class GetAnimalsByGroupAction extends ReadOnlyApiAction<GroupMember>
public static class GetAnimalsByGroupAction extends ReadOnlyApiAction<GroupMember>
{
@Override
public ApiResponse execute(GroupMember groupMember, BindException errors)
Expand All @@ -385,7 +385,7 @@ public ApiResponse execute(GroupMember groupMember, BindException errors)
animals.add(member.toJSON());
}

Map<String, Object> props = new HashMap<String, Object>();
Map<String, Object> props = new HashMap<>();
props.put("animals", animals);
props.put("success", true);
return new ApiSimpleResponse(props);
Expand All @@ -396,7 +396,7 @@ public ApiResponse execute(GroupMember groupMember, BindException errors)
* Get Animals by name (animal id) - defined to present a list of valid animals to the user
*/
@RequiresPermission(EHRDataEntryPermission.class)
public class GetAnimalsByNameAction extends ReadOnlyApiAction<GroupMember>
public static class GetAnimalsByNameAction extends ReadOnlyApiAction<GroupMember>
{
@Override
public ApiResponse execute(GroupMember groupMember, BindException errors)
Expand Down Expand Up @@ -425,7 +425,7 @@ public ApiResponse execute(GroupMember groupMember, BindException errors)
* validation of the data takes place in the animal_groups.js trigger script
*/
@RequiresPermission(EHRDataEntryPermission.class)
public class UpdateGroupsAction extends MutatingApiAction<SimpleApiJsonForm>
public static class UpdateGroupsAction extends MutatingApiAction<SimpleApiJsonForm>
{
@Override
public ApiResponse execute(SimpleApiJsonForm simpleApiJsonForm, BindException errors)
Expand Down Expand Up @@ -506,9 +506,6 @@ public ApiResponse execute(SimpleApiJsonForm simpleApiJsonForm, BindException er
/**
* Get a group code to be assigned to a new group
*
* @param categoryCode
* @param ignoreCategory - if true, this will return the next code regardless of the category the group belongs to
* @return
*/
private Integer getNextGroupCode(int categoryCode, boolean ignoreCategory)
{
Expand All @@ -524,7 +521,6 @@ private Integer getNextGroupCode(int categoryCode, boolean ignoreCategory)
/**
* Get a group code to be assigned to a new group
*
* @param categoryCode
* @return next code to be used for insert
*/
private Integer getNextGroupCode(int categoryCode)
Expand Down Expand Up @@ -567,7 +563,7 @@ private Integer getNextGroupCode()
}

@RequiresPermission(EHRDataEntryPermission.class)
public class DeleteGroupsAction extends MutatingApiAction<SimpleApiJsonForm>
public static class DeleteGroupsAction extends MutatingApiAction<SimpleApiJsonForm>
{
@Override
public ApiResponse execute(SimpleApiJsonForm simpleApiJsonForm, BindException errors)
Expand Down Expand Up @@ -637,7 +633,7 @@ public ApiResponse execute(SimpleApiJsonForm simpleApiJsonForm, BindException er
* Assigns animals to a group using an instance of {@link AnimalsGroupAssignor}
*/
@RequiresPermission(ManageGroupMembersPermission.class)
public class UpdateGroupMembersAction extends MutatingApiAction<GroupMember>
public static class UpdateGroupMembersAction extends MutatingApiAction<GroupMember>
{
@Override
public ApiResponse execute(GroupMember groupMember, BindException errors)
Expand All @@ -655,7 +651,7 @@ public ApiResponse execute(GroupMember groupMember, BindException errors)

AnimalsGroupAssignor animalsGroupAssignor = new AnimalsGroupAssignor(this.getViewContext(), groupMember.getGroupid());

List<GroupMember> groupMembers = new ArrayList<GroupMember>();
List<GroupMember> groupMembers = new ArrayList<>();
for (String animal : groupMember.getId().split("\n"))
{
GroupMember animalForm = new GroupMember();
Expand Down Expand Up @@ -687,7 +683,7 @@ public ApiResponse execute(GroupMember groupMember, BindException errors)
}

@RequiresPermission(ManageGroupMembersPermission.class)
public class DeleteGroupMembersAction extends MutatingApiAction<GroupMember>
public static class DeleteGroupMembersAction extends MutatingApiAction<GroupMember>
{
@Override
public ApiResponse execute(GroupMember groupMember, BindException errors)
Expand All @@ -707,7 +703,7 @@ public ApiResponse execute(GroupMember groupMember, BindException errors)
filter.addCondition(FieldKey.fromString("date"), groupMember.getDate(), CompareType.EQUAL);
TableSelector tableSelector = new TableSelector(table, filter, null);

List<Map<String, Object>> keys = new ArrayList<Map<String, Object>>();
List<Map<String, Object>> keys = new ArrayList<>();
List<GroupMember> members = tableSelector.getArrayList(GroupMember.class);
for (GroupMember member : members)
{
Expand Down
Loading