/** * Validates and trims the security role key * * @param securityRoleKey securityRoleKey * * @return security role validated and trimmed */ private String validateSecurityRoleKey(SecurityRoleKey securityRoleKey) { Assert.notNull(securityRoleKey, "A security role key must be specified."); return alternateKeyHelper.validateStringParameter("security role name", securityRoleKey.getSecurityRoleName()); }
public StringBuilder appendFields(ObjectLocator locator, StringBuilder buffer, ToStringStrategy2 strategy) { { String theSecurityRoleName; theSecurityRoleName = this.getSecurityRoleName(); strategy.appendField(locator, this, "securityRoleName", buffer, theSecurityRoleName, (this.securityRoleName!= null)); } return buffer; }
public StringBuilder appendFields(ObjectLocator locator, StringBuilder buffer, ToStringStrategy2 strategy) { { String theSecurityRoleName; theSecurityRoleName = this.getSecurityRoleName(); strategy.appendField(locator, this, "securityRoleName", buffer, theSecurityRoleName, (this.securityRoleName!= null)); } return buffer; }
private SecurityRoleEntity getSecurityRoleEntityByName(SecurityRoleKey securityRoleKey) { SecurityRoleEntity securityRoleEntity = securityRoleDao.getSecurityRoleByName(securityRoleKey.getSecurityRoleName()); if (securityRoleEntity == null) { throw new ObjectNotFoundException(String.format("Security role with name \"%s\" doesn't exist.", securityRoleKey.getSecurityRoleName())); } return securityRoleEntity; } }
/** * Validates and trims the security role key * * @param securityRoleKey securityRoleKey * * @return security role validated and trimmed */ private String validateSecurityRoleKey(SecurityRoleKey securityRoleKey) { Assert.notNull(securityRoleKey, "A security role key must be specified."); return alternateKeyHelper.validateStringParameter("security role name", securityRoleKey.getSecurityRoleName()); }
public StringBuilder appendFields(ObjectLocator locator, StringBuilder buffer, ToStringStrategy2 strategy) { { String theSecurityRoleName; theSecurityRoleName = this.getSecurityRoleName(); strategy.appendField(locator, this, "securityRoleName", buffer, theSecurityRoleName, (this.securityRoleName!= null)); } return buffer; }
private SecurityRoleEntity getSecurityRoleEntityByName(SecurityRoleKey securityRoleKey) { SecurityRoleEntity securityRoleEntity = securityRoleDao.getSecurityRoleByName(securityRoleKey.getSecurityRoleName()); if (securityRoleEntity == null) { throw new ObjectNotFoundException(String.format("Security role with name \"%s\" doesn't exist.", securityRoleKey.getSecurityRoleName())); } return securityRoleEntity; } }
/** * Validates a security role key. This method also trims the key parameters. * * @param securityRoleKey the security role key */ public void validateAndTrimSecurityRoleKey(SecurityRoleKey securityRoleKey) { Assert.notNull(securityRoleKey, "A security role key must be specified."); securityRoleKey.setSecurityRoleName(alternateKeyHelper.validateStringParameter("security role name", securityRoleKey.getSecurityRoleName())); } }
/** * Validates a security role key. This method also trims the key parameters. * * @param securityRoleKey the security role key */ public void validateAndTrimSecurityRoleKey(SecurityRoleKey securityRoleKey) { Assert.notNull(securityRoleKey, "A security role key must be specified."); securityRoleKey.setSecurityRoleName(alternateKeyHelper.validateStringParameter("security role name", securityRoleKey.getSecurityRoleName())); } }
public boolean equals(ObjectLocator thisLocator, ObjectLocator thatLocator, Object object, EqualsStrategy2 strategy) { if ((object == null)||(this.getClass()!= object.getClass())) { return false; } if (this == object) { return true; } final SecurityRoleKey that = ((SecurityRoleKey) object); { String lhsSecurityRoleName; lhsSecurityRoleName = this.getSecurityRoleName(); String rhsSecurityRoleName; rhsSecurityRoleName = that.getSecurityRoleName(); if (!strategy.equals(LocatorUtils.property(thisLocator, "securityRoleName", lhsSecurityRoleName), LocatorUtils.property(thatLocator, "securityRoleName", rhsSecurityRoleName), lhsSecurityRoleName, rhsSecurityRoleName, (this.securityRoleName!= null), (that.securityRoleName!= null))) { return false; } } return true; }
public boolean equals(ObjectLocator thisLocator, ObjectLocator thatLocator, Object object, EqualsStrategy2 strategy) { if ((object == null)||(this.getClass()!= object.getClass())) { return false; } if (this == object) { return true; } final SecurityRoleKey that = ((SecurityRoleKey) object); { String lhsSecurityRoleName; lhsSecurityRoleName = this.getSecurityRoleName(); String rhsSecurityRoleName; rhsSecurityRoleName = that.getSecurityRoleName(); if (!strategy.equals(LocatorUtils.property(thisLocator, "securityRoleName", lhsSecurityRoleName), LocatorUtils.property(thatLocator, "securityRoleName", rhsSecurityRoleName), lhsSecurityRoleName, rhsSecurityRoleName, (this.securityRoleName!= null), (that.securityRoleName!= null))) { return false; } } return true; }
public boolean equals(ObjectLocator thisLocator, ObjectLocator thatLocator, Object object, EqualsStrategy2 strategy) { if ((object == null)||(this.getClass()!= object.getClass())) { return false; } if (this == object) { return true; } final SecurityRoleKey that = ((SecurityRoleKey) object); { String lhsSecurityRoleName; lhsSecurityRoleName = this.getSecurityRoleName(); String rhsSecurityRoleName; rhsSecurityRoleName = that.getSecurityRoleName(); if (!strategy.equals(LocatorUtils.property(thisLocator, "securityRoleName", lhsSecurityRoleName), LocatorUtils.property(thatLocator, "securityRoleName", rhsSecurityRoleName), lhsSecurityRoleName, rhsSecurityRoleName, (this.securityRoleName!= null), (that.securityRoleName!= null))) { return false; } } return true; }
public int hashCode(ObjectLocator locator, HashCodeStrategy2 strategy) { int currentHashCode = 1; { String theSecurityRoleName; theSecurityRoleName = this.getSecurityRoleName(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "securityRoleName", theSecurityRoleName), currentHashCode, theSecurityRoleName, (this.securityRoleName!= null)); } return currentHashCode; }
public int hashCode(ObjectLocator locator, HashCodeStrategy2 strategy) { int currentHashCode = 1; { String theSecurityRoleName; theSecurityRoleName = this.getSecurityRoleName(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "securityRoleName", theSecurityRoleName), currentHashCode, theSecurityRoleName, (this.securityRoleName!= null)); } return currentHashCode; }
public int hashCode(ObjectLocator locator, HashCodeStrategy2 strategy) { int currentHashCode = 1; { String theSecurityRoleName; theSecurityRoleName = this.getSecurityRoleName(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "securityRoleName", theSecurityRoleName), currentHashCode, theSecurityRoleName, (this.securityRoleName!= null)); } return currentHashCode; }
@Override public SecurityRoleFunctionKeys getSecurityRoleFunctionsBySecurityRole(SecurityRoleKey securityRoleKey) { // Validate and trim the security role to function key. securityRoleHelper.validateAndTrimSecurityRoleKey(securityRoleKey); // Retrieve and return a list of security role to function mapping keys for the specified security role. SecurityRoleFunctionKeys securityRoleFunctionKeys = new SecurityRoleFunctionKeys(); securityRoleFunctionKeys.getSecurityRoleFunctionKeys() .addAll(securityRoleFunctionDao.getSecurityRoleFunctionKeysBySecurityRole(securityRoleKey.getSecurityRoleName())); return securityRoleFunctionKeys; }
@Override public SecurityRoleFunctionKeys getSecurityRoleFunctionsBySecurityRole(SecurityRoleKey securityRoleKey) { // Validate and trim the security role to function key. securityRoleHelper.validateAndTrimSecurityRoleKey(securityRoleKey); // Retrieve and return a list of security role to function mapping keys for the specified security role. SecurityRoleFunctionKeys securityRoleFunctionKeys = new SecurityRoleFunctionKeys(); securityRoleFunctionKeys.getSecurityRoleFunctionKeys() .addAll(securityRoleFunctionDao.getSecurityRoleFunctionKeysBySecurityRole(securityRoleKey.getSecurityRoleName())); return securityRoleFunctionKeys; }
public Object copyTo(ObjectLocator locator, Object target, CopyStrategy2 strategy) { final Object draftCopy = ((target == null)?createNewInstance():target); if (draftCopy instanceof SecurityRoleKey) { final SecurityRoleKey copy = ((SecurityRoleKey) draftCopy); { Boolean securityRoleNameShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, (this.securityRoleName!= null)); if (securityRoleNameShouldBeCopiedAndSet == Boolean.TRUE) { String sourceSecurityRoleName; sourceSecurityRoleName = this.getSecurityRoleName(); String copySecurityRoleName = ((String) strategy.copy(LocatorUtils.property(locator, "securityRoleName", sourceSecurityRoleName), sourceSecurityRoleName, (this.securityRoleName!= null))); copy.setSecurityRoleName(copySecurityRoleName); } else { if (securityRoleNameShouldBeCopiedAndSet == Boolean.FALSE) { copy.securityRoleName = null; } } } } return draftCopy; }
public Object copyTo(ObjectLocator locator, Object target, CopyStrategy2 strategy) { final Object draftCopy = ((target == null)?createNewInstance():target); if (draftCopy instanceof SecurityRoleKey) { final SecurityRoleKey copy = ((SecurityRoleKey) draftCopy); { Boolean securityRoleNameShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, (this.securityRoleName!= null)); if (securityRoleNameShouldBeCopiedAndSet == Boolean.TRUE) { String sourceSecurityRoleName; sourceSecurityRoleName = this.getSecurityRoleName(); String copySecurityRoleName = ((String) strategy.copy(LocatorUtils.property(locator, "securityRoleName", sourceSecurityRoleName), sourceSecurityRoleName, (this.securityRoleName!= null))); copy.setSecurityRoleName(copySecurityRoleName); } else { if (securityRoleNameShouldBeCopiedAndSet == Boolean.FALSE) { copy.securityRoleName = null; } } } } return draftCopy; }
@Test public void testGetSecurityRoleKeys() { // Create a list of security role keys. final List<SecurityRoleKey> securityRoleKeys = ImmutableList.of(new SecurityRoleKey(SECURITY_ROLE), new SecurityRoleKey(SECURITY_ROLE_2)); // Create and persist security role entities in reverse order. for (SecurityRoleKey securityRoleKey : Lists.reverse(securityRoleKeys)) { securityRoleDaoTestHelper.createSecurityRoleEntity(securityRoleKey.getSecurityRoleName()); } // Get all security roles registered in the system. List<SecurityRoleKey> result = securityRoleDao.getSecurityRoleKeys(); // Validate the returned object. assertEquals(securityRoleKeys, result); } }