Cleanup unnecessary boxing

This commit is contained in:
Lars Grefer
2019-08-01 23:27:18 +02:00
committed by Josh Cummings
parent 2055466ad7
commit 2306d987e9
40 changed files with 158 additions and 159 deletions

View File

@@ -70,7 +70,7 @@ public class AddDeleteContactController {
@RequestMapping(value = "/secure/del.htm", method = RequestMethod.GET)
public ModelAndView delContact(@RequestParam("contactId") int contactId) {
Contact contact = contactManager.getById(Long.valueOf(contactId));
Contact contact = contactManager.getById((long) contactId);
contactManager.delete(contact);
return new ModelAndView("deleted", "contact", contact);

View File

@@ -68,7 +68,7 @@ public final class AdminPermissionController implements MessageSourceAware {
*/
@RequestMapping(value = "/secure/adminPermission.htm", method = RequestMethod.GET)
public ModelAndView displayAdminPage(@RequestParam("contactId") int contactId) {
Contact contact = contactManager.getById(Long.valueOf(contactId));
Contact contact = contactManager.getById((long) contactId);
Acl acl = aclService.readAclById(new ObjectIdentityImpl(contact));
Map<String, Object> model = new HashMap<>();
@@ -161,11 +161,11 @@ public final class AdminPermissionController implements MessageSourceAware {
private Map<Integer, String> listPermissions() {
Map<Integer, String> map = new LinkedHashMap<>();
map.put(Integer.valueOf(BasePermission.ADMINISTRATION.getMask()),
map.put(BasePermission.ADMINISTRATION.getMask(),
messages.getMessage("select.administer", "Administer"));
map.put(Integer.valueOf(BasePermission.READ.getMask()),
map.put(BasePermission.READ.getMask(),
messages.getMessage("select.read", "Read"));
map.put(Integer.valueOf(BasePermission.DELETE.getMask()),
map.put(BasePermission.DELETE.getMask(),
messages.getMessage("select.delete", "Delete"));
return map;

View File

@@ -84,7 +84,7 @@ public class ContactManagerBackend extends ApplicationObjectSupport implements
public void create(Contact contact) {
// Create the Contact itself
contact.setId(Long.valueOf(counter++));
contact.setId((long) counter++);
contactDao.create(contact);
// Grant the current principal administrative permission to the contact

View File

@@ -165,7 +165,7 @@ public class DataSourcePopulator implements InitializingBean {
// Create acl_object_identity rows (and also acl_class rows as needed
for (int i = 1; i < createEntities; i++) {
final ObjectIdentity objectIdentity = new ObjectIdentityImpl(Contact.class,
Long.valueOf(i));
(long) i);
tt.execute(new TransactionCallback<Object>() {
public Object doInTransaction(TransactionStatus arg0) {
mutableAclService.createAcl(objectIdentity);
@@ -230,7 +230,7 @@ public class DataSourcePopulator implements InitializingBean {
private void changeOwner(int contactNumber, String newOwnerUsername) {
AclImpl acl = (AclImpl) mutableAclService.readAclById(new ObjectIdentityImpl(
Contact.class, new Long(contactNumber)));
Contact.class, (long) contactNumber));
acl.setOwner(new PrincipalSid(newOwnerUsername));
updateAclInTransaction(acl);
}
@@ -242,7 +242,7 @@ public class DataSourcePopulator implements InitializingBean {
private void grantPermissions(int contactNumber, String recipientUsername,
Permission permission) {
AclImpl acl = (AclImpl) mutableAclService.readAclById(new ObjectIdentityImpl(
Contact.class, Long.valueOf(contactNumber)));
Contact.class, (long) contactNumber));
acl.insertAce(acl.getEntries().size(), permission, new PrincipalSid(
recipientUsername), true);
updateAclInTransaction(acl);

View File

@@ -92,10 +92,10 @@ public class IndexController {
Authentication user = SecurityContextHolder.getContext().getAuthentication();
for (Contact contact : myContactsList) {
hasDelete.put(contact, Boolean.valueOf(permissionEvaluator.hasPermission(
user, contact, HAS_DELETE)));
hasAdmin.put(contact, Boolean.valueOf(permissionEvaluator.hasPermission(user,
contact, HAS_ADMIN)));
hasDelete.put(contact, permissionEvaluator.hasPermission(
user, contact, HAS_DELETE));
hasAdmin.put(contact, permissionEvaluator.hasPermission(user,
contact, HAS_ADMIN));
}
Map<String, Object> model = new HashMap<>();