You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by il...@apache.org on 2012/10/24 15:07:58 UTC

svn commit: r1401665 - in /incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans: AbstractAttributable.java membership/Membership.java role/SyncopeRole.java user/SyncopeUser.java

Author: ilgrosso
Date: Wed Oct 24 13:07:57 2012
New Revision: 1401665

URL: http://svn.apache.org/viewvc?rev=1401665&view=rev
Log:
White noise: formatting and cleaning up

Modified:
    incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/AbstractAttributable.java
    incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/membership/Membership.java
    incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/role/SyncopeRole.java
    incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/user/SyncopeUser.java

Modified: incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/AbstractAttributable.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/AbstractAttributable.java?rev=1401665&r1=1401664&r2=1401665&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/AbstractAttributable.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/AbstractAttributable.java Wed Oct 24 13:07:57 2012
@@ -128,18 +128,18 @@ public abstract class AbstractAttributab
 
     public abstract void setVirtualAttributes(List<? extends AbstractVirAttr> virtualAttributes);
 
-    protected abstract Set<ExternalResource> resources();
+    protected abstract Set<ExternalResource> internalGetResources();
 
     public boolean addResource(final ExternalResource resource) {
-        return resources().add(resource);
+        return internalGetResources().add(resource);
     }
 
     public boolean removeResource(final ExternalResource resource) {
-        return resources().remove(resource);
+        return internalGetResources().remove(resource);
     }
 
     public Set<ExternalResource> getResources() {
-        return resources();
+        return internalGetResources();
     }
 
     public Set<String> getResourceNames() {
@@ -154,9 +154,9 @@ public abstract class AbstractAttributab
     }
 
     public void setResources(final Set<ExternalResource> resources) {
-        resources().clear();
+        internalGetResources().clear();
         if (resources != null) {
-            resources().addAll(resources);
+            internalGetResources().addAll(resources);
         }
     }
 }

Modified: incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/membership/Membership.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/membership/Membership.java?rev=1401665&r1=1401664&r2=1401665&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/membership/Membership.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/membership/Membership.java Wed Oct 24 13:07:57 2012
@@ -44,18 +44,24 @@ import org.apache.syncope.core.persisten
 public class Membership extends AbstractAttributable {
 
     private static final long serialVersionUID = 5030106264797289469L;
+
     @Id
     private Long id;
+
     @ManyToOne
     private SyncopeUser syncopeUser;
+
     @ManyToOne
     private SyncopeRole syncopeRole;
+
     @OneToMany(cascade = CascadeType.ALL, mappedBy = "owner")
     @Valid
     private List<MAttr> attributes;
+
     @OneToMany(cascade = CascadeType.ALL, mappedBy = "owner")
     @Valid
     private List<MDerAttr> derivedAttributes;
+
     @OneToMany(cascade = CascadeType.ALL, mappedBy = "owner")
     @Valid
     private List<MVirAttr> virtualAttributes;
@@ -74,7 +80,7 @@ public class Membership extends Abstract
     }
 
     @Override
-    protected Set<ExternalResource> resources() {
+    protected Set<ExternalResource> internalGetResources() {
         return Collections.emptySet();
     }
 
@@ -82,7 +88,7 @@ public class Membership extends Abstract
         return syncopeRole;
     }
 
-    public void setSyncopeRole(SyncopeRole syncopeRole) {
+    public void setSyncopeRole(final SyncopeRole syncopeRole) {
         this.syncopeRole = syncopeRole;
     }
 
@@ -90,12 +96,12 @@ public class Membership extends Abstract
         return syncopeUser;
     }
 
-    public void setSyncopeUser(SyncopeUser syncopeUser) {
+    public void setSyncopeUser(final SyncopeUser syncopeUser) {
         this.syncopeUser = syncopeUser;
     }
 
     @Override
-    public <T extends AbstractAttr> boolean addAttribute(T attribute) {
+    public <T extends AbstractAttr> boolean addAttribute(final T attribute) {
         if (!(attribute instanceof MAttr)) {
             throw new ClassCastException("attribute is expected to be typed MAttr: " + attribute.getClass().getName());
         }
@@ -103,7 +109,7 @@ public class Membership extends Abstract
     }
 
     @Override
-    public <T extends AbstractAttr> boolean removeAttribute(T attribute) {
+    public <T extends AbstractAttr> boolean removeAttribute(final T attribute) {
         if (!(attribute instanceof MAttr)) {
             throw new ClassCastException("attribute is expected to be typed MAttr: " + attribute.getClass().getName());
         }
@@ -116,25 +122,28 @@ public class Membership extends Abstract
     }
 
     @Override
-    public void setAttributes(List<? extends AbstractAttr> attributes) {
-        this.attributes = (List<MAttr>) attributes;
+    public void setAttributes(final List<? extends AbstractAttr> attributes) {
+        this.attributes.clear();
+        if (attributes != null && !attributes.isEmpty()) {
+            this.attributes.addAll((List<MAttr>) attributes);
+        }
     }
 
     @Override
-    public <T extends AbstractDerAttr> boolean addDerivedAttribute(T derivedAttribute) {
-        if (!(derivedAttribute instanceof MDerAttr)) {
-            throw new ClassCastException("attribute is expected to be typed MDerAttr: " + derivedAttribute.getClass().getName());
+    public <T extends AbstractDerAttr> boolean addDerivedAttribute(final T derAttr) {
+        if (!(derAttr instanceof MDerAttr)) {
+            throw new ClassCastException("attribute is expected to be typed MDerAttr: " + derAttr.getClass().getName());
         }
-        return derivedAttributes.add((MDerAttr) derivedAttribute);
+        return derivedAttributes.add((MDerAttr) derAttr);
     }
 
     @Override
-    public <T extends AbstractDerAttr> boolean removeDerivedAttribute(T derivedAttribute) {
-        if (!(derivedAttribute instanceof MDerAttr)) {
-            throw new ClassCastException("attribute is expected to be typed MDerAttr: " + derivedAttribute.getClass().getName());
+    public <T extends AbstractDerAttr> boolean removeDerivedAttribute(final T derAttr) {
+        if (!(derAttr instanceof MDerAttr)) {
+            throw new ClassCastException("attribute is expected to be typed MDerAttr: " + derAttr.getClass().getName());
         }
 
-        return derivedAttributes.remove((MDerAttr) derivedAttribute);
+        return derivedAttributes.remove((MDerAttr) derAttr);
     }
 
     @Override
@@ -143,27 +152,29 @@ public class Membership extends Abstract
     }
 
     @Override
-    public void setDerivedAttributes(List<? extends AbstractDerAttr> derivedAttributes) {
-
-        this.derivedAttributes = (List<MDerAttr>) derivedAttributes;
+    public void setDerivedAttributes(final List<? extends AbstractDerAttr> derivedAttributes) {
+        this.derivedAttributes.clear();
+        if (derivedAttributes != null && !derivedAttributes.isEmpty()) {
+            this.derivedAttributes.addAll((List<MDerAttr>) derivedAttributes);
+        }
     }
 
     @Override
-    public <T extends AbstractVirAttr> boolean addVirtualAttribute(T virtualAttribute) {
-        if (!(virtualAttribute instanceof MVirAttr)) {
-            throw new ClassCastException("attribute is expected to be typed MVirAttr: " + virtualAttribute.getClass().getName());
+    public <T extends AbstractVirAttr> boolean addVirtualAttribute(final T virAttr) {
+        if (!(virAttr instanceof MVirAttr)) {
+            throw new ClassCastException("attribute is expected to be typed MVirAttr: " + virAttr.getClass().getName());
         }
 
-        return virtualAttributes.add((MVirAttr) virtualAttribute);
+        return virtualAttributes.add((MVirAttr) virAttr);
     }
 
     @Override
-    public <T extends AbstractVirAttr> boolean removeVirtualAttribute(T virtualAttribute) {
-        if (!(virtualAttribute instanceof MVirAttr)) {
-            throw new ClassCastException("attribute is expected to be typed MVirAttr: " + virtualAttribute.getClass().getName());
+    public <T extends AbstractVirAttr> boolean removeVirtualAttribute(final T virAttr) {
+        if (!(virAttr instanceof MVirAttr)) {
+            throw new ClassCastException("attribute is expected to be typed MVirAttr: " + virAttr.getClass().getName());
         }
 
-        return virtualAttributes.remove((MVirAttr) virtualAttribute);
+        return virtualAttributes.remove((MVirAttr) virAttr);
     }
 
     @Override
@@ -172,9 +183,11 @@ public class Membership extends Abstract
     }
 
     @Override
-    public void setVirtualAttributes(List<? extends AbstractVirAttr> virtualAttributes) {
-
-        this.virtualAttributes = (List<MVirAttr>) virtualAttributes;
+    public void setVirtualAttributes(final List<? extends AbstractVirAttr> virtualAttributes) {
+        this.virtualAttributes.clear();
+        if (virtualAttributes != null && !virtualAttributes.isEmpty()) {
+            this.virtualAttributes.addAll((List<MVirAttr>) virtualAttributes);
+        }
     }
 
     @Override

Modified: incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/role/SyncopeRole.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/role/SyncopeRole.java?rev=1401665&r1=1401664&r2=1401665&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/role/SyncopeRole.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/role/SyncopeRole.java Wed Oct 24 13:07:57 2012
@@ -61,56 +61,73 @@ import org.apache.syncope.core.persisten
 public class SyncopeRole extends AbstractAttributable {
 
     private static final long serialVersionUID = -5281258853142421875L;
+
     @Id
     private Long id;
+
     @NotNull
     private String name;
+
     @ManyToOne(optional = true)
     private SyncopeRole parent;
+
     @ManyToMany(fetch = FetchType.EAGER)
     @JoinTable(joinColumns =
-    @JoinColumn(name = "role_id"), inverseJoinColumns =
+    @JoinColumn(name = "role_id"),
+    inverseJoinColumns =
     @JoinColumn(name = "entitlement_name"))
     private Set<Entitlement> entitlements;
+
     @OneToMany(cascade = CascadeType.ALL, mappedBy = "owner")
     @Valid
     private List<RAttr> attributes;
+
     @OneToMany(cascade = CascadeType.ALL, mappedBy = "owner")
     @Valid
     private List<RDerAttr> derivedAttributes;
+
     @OneToMany(cascade = CascadeType.ALL, mappedBy = "owner")
     @Valid
     private List<RVirAttr> virtualAttributes;
+
     @Basic(optional = true)
     @Min(0)
     @Max(1)
     private Integer inheritAttributes;
+
     @Basic(optional = true)
     @Min(0)
     @Max(1)
     private Integer inheritDerivedAttributes;
+
     @Basic(optional = true)
     @Min(0)
     @Max(1)
     private Integer inheritVirtualAttributes;
+
     @Basic(optional = true)
     @Min(0)
     @Max(1)
     private Integer inheritPasswordPolicy;
+
     @Basic(optional = true)
     @Min(0)
     @Max(1)
     private Integer inheritAccountPolicy;
+
     @ManyToOne(fetch = FetchType.EAGER, optional = true)
     private PasswordPolicy passwordPolicy;
+
     @ManyToOne(fetch = FetchType.EAGER, optional = true)
     private AccountPolicy accountPolicy;
+
     /**
      * Provisioning external resources.
      */
     @ManyToMany(fetch = FetchType.EAGER)
     @JoinTable(joinColumns =
-    @JoinColumn(name = "role_id"), inverseJoinColumns =
+    @JoinColumn(name = "role_id"),
+    inverseJoinColumns =
     @JoinColumn(name = "resource_name"))
     @Valid
     private Set<ExternalResource> resources;
@@ -136,7 +153,7 @@ public class SyncopeRole extends Abstrac
     }
 
     @Override
-    protected Set<ExternalResource> resources() {
+    protected Set<ExternalResource> internalGetResources() {
         return resources;
     }
 
@@ -144,7 +161,7 @@ public class SyncopeRole extends Abstrac
         return name;
     }
 
-    public void setName(String name) {
+    public void setName(final String name) {
         this.name = name;
     }
 
@@ -152,7 +169,7 @@ public class SyncopeRole extends Abstrac
         return parent;
     }
 
-    public void setParent(SyncopeRole parent) {
+    public void setParent(final SyncopeRole parent) {
         this.parent = parent;
     }
 
@@ -176,7 +193,7 @@ public class SyncopeRole extends Abstrac
     }
 
     @Override
-    public <T extends AbstractAttr> boolean addAttribute(T attribute) {
+    public <T extends AbstractAttr> boolean addAttribute(final T attribute) {
         if (!(attribute instanceof RAttr)) {
             throw new ClassCastException("attribute is expected to be typed RAttr: " + attribute.getClass().getName());
         }
@@ -184,7 +201,7 @@ public class SyncopeRole extends Abstrac
     }
 
     @Override
-    public <T extends AbstractAttr> boolean removeAttribute(T attribute) {
+    public <T extends AbstractAttr> boolean removeAttribute(final T attribute) {
         if (!(attribute instanceof RAttr)) {
             throw new ClassCastException("attribute is expected to be typed RAttr: " + attribute.getClass().getName());
         }
@@ -197,24 +214,27 @@ public class SyncopeRole extends Abstrac
     }
 
     @Override
-    public void setAttributes(List<? extends AbstractAttr> attributes) {
-        this.attributes = (List<RAttr>) attributes;
+    public void setAttributes(final List<? extends AbstractAttr> attributes) {
+        this.attributes.clear();
+        if (attributes != null && !attributes.isEmpty()) {
+            this.attributes.addAll((List<RAttr>) attributes);
+        }
     }
 
     @Override
-    public <T extends AbstractDerAttr> boolean addDerivedAttribute(T derivedAttribute) {
-        if (!(derivedAttribute instanceof RDerAttr)) {
-            throw new ClassCastException("attribute is expected to be typed RDerAttr: " + derivedAttribute.getClass().getName());
+    public <T extends AbstractDerAttr> boolean addDerivedAttribute(final T derAttr) {
+        if (!(derAttr instanceof RDerAttr)) {
+            throw new ClassCastException("attribute is expected to be typed RDerAttr: " + derAttr.getClass().getName());
         }
-        return derivedAttributes.add((RDerAttr) derivedAttribute);
+        return derivedAttributes.add((RDerAttr) derAttr);
     }
 
     @Override
-    public <T extends AbstractDerAttr> boolean removeDerivedAttribute(T derivedAttribute) {
-        if (!(derivedAttribute instanceof RDerAttr)) {
-            throw new ClassCastException("attribute is expected to be typed RDerAttr: " + derivedAttribute.getClass().getName());
+    public <T extends AbstractDerAttr> boolean removeDerivedAttribute(final T derAttr) {
+        if (!(derAttr instanceof RDerAttr)) {
+            throw new ClassCastException("attribute is expected to be typed RDerAttr: " + derAttr.getClass().getName());
         }
-        return derivedAttributes.remove((RDerAttr) derivedAttribute);
+        return derivedAttributes.remove((RDerAttr) derAttr);
     }
 
     @Override
@@ -223,25 +243,27 @@ public class SyncopeRole extends Abstrac
     }
 
     @Override
-    public void setDerivedAttributes(List<? extends AbstractDerAttr> derivedAttributes) {
-
-        this.derivedAttributes = (List<RDerAttr>) derivedAttributes;
+    public void setDerivedAttributes(final List<? extends AbstractDerAttr> derivedAttributes) {
+        this.attributes.clear();
+        if (attributes != null && !attributes.isEmpty()) {
+            this.attributes.addAll((List<RAttr>) attributes);
+        }
     }
 
     @Override
-    public <T extends AbstractVirAttr> boolean addVirtualAttribute(T virtualAttribute) {
-        if (!(virtualAttribute instanceof RVirAttr)) {
-            throw new ClassCastException("attribute is expected to be typed RVirAttr: " + virtualAttribute.getClass().getName());
+    public <T extends AbstractVirAttr> boolean addVirtualAttribute(final T virAttr) {
+        if (!(virAttr instanceof RVirAttr)) {
+            throw new ClassCastException("attribute is expected to be typed RVirAttr: " + virAttr.getClass().getName());
         }
-        return virtualAttributes.add((RVirAttr) virtualAttribute);
+        return virtualAttributes.add((RVirAttr) virAttr);
     }
 
     @Override
-    public <T extends AbstractVirAttr> boolean removeVirtualAttribute(T virtualAttribute) {
-        if (!(virtualAttribute instanceof RVirAttr)) {
-            throw new ClassCastException("attribute is expected to be typed RVirAttr: " + virtualAttribute.getClass().getName());
+    public <T extends AbstractVirAttr> boolean removeVirtualAttribute(final T virAttr) {
+        if (!(virAttr instanceof RVirAttr)) {
+            throw new ClassCastException("attribute is expected to be typed RVirAttr: " + virAttr.getClass().getName());
         }
-        return virtualAttributes.remove((RVirAttr) virtualAttribute);
+        return virtualAttributes.remove((RVirAttr) virAttr);
     }
 
     @Override
@@ -250,16 +272,18 @@ public class SyncopeRole extends Abstrac
     }
 
     @Override
-    public void setVirtualAttributes(List<? extends AbstractVirAttr> virtualAttributes) {
-
-        this.virtualAttributes = (List<RVirAttr>) virtualAttributes;
+    public void setVirtualAttributes(final List<? extends AbstractVirAttr> virtualAttributes) {
+        this.virtualAttributes.clear();
+        if (virtualAttributes != null && !virtualAttributes.isEmpty()) {
+            this.virtualAttributes.addAll((List<RVirAttr>) virtualAttributes);
+        }
     }
 
     public boolean isInheritAttributes() {
         return isBooleanAsInteger(inheritAttributes);
     }
 
-    public void setInheritAttributes(boolean inheritAttributes) {
+    public void setInheritAttributes(final boolean inheritAttributes) {
         this.inheritAttributes = getBooleanAsInteger(inheritAttributes);
     }
 
@@ -296,7 +320,7 @@ public class SyncopeRole extends Abstrac
         return isBooleanAsInteger(inheritDerivedAttributes);
     }
 
-    public void setInheritDerivedAttributes(boolean inheritDerivedAttributes) {
+    public void setInheritDerivedAttributes(final boolean inheritDerivedAttributes) {
         this.inheritDerivedAttributes = getBooleanAsInteger(inheritDerivedAttributes);
 
     }
@@ -335,7 +359,7 @@ public class SyncopeRole extends Abstrac
         return isBooleanAsInteger(inheritVirtualAttributes);
     }
 
-    public void setInheritVirtualAttributes(boolean inheritVirtualAttributes) {
+    public void setInheritVirtualAttributes(final boolean inheritVirtualAttributes) {
         this.inheritVirtualAttributes = getBooleanAsInteger(inheritVirtualAttributes);
 
     }
@@ -373,8 +397,8 @@ public class SyncopeRole extends Abstrac
     /**
      * Get first valid password policy.
      *
-     * @return parent password policy if isInheritPasswordPolicy is 'true' and
-     * parent is not null. Return local passowrd policy otherwise.
+     * @return parent password policy if isInheritPasswordPolicy is 'true' and parent is not null, local password policy
+     * otherwise
      */
     public PasswordPolicy getPasswordPolicy() {
         return isInheritPasswordPolicy() && getParent() != null
@@ -382,7 +406,7 @@ public class SyncopeRole extends Abstrac
                 : passwordPolicy;
     }
 
-    public void setPasswordPolicy(PasswordPolicy passwordPolicy) {
+    public void setPasswordPolicy(final PasswordPolicy passwordPolicy) {
         this.passwordPolicy = passwordPolicy;
     }
 
@@ -390,15 +414,15 @@ public class SyncopeRole extends Abstrac
         return isBooleanAsInteger(inheritPasswordPolicy);
     }
 
-    public void setInheritPasswordPolicy(boolean inheritPasswordPolicy) {
+    public void setInheritPasswordPolicy(final boolean inheritPasswordPolicy) {
         this.inheritPasswordPolicy = getBooleanAsInteger(inheritPasswordPolicy);
     }
 
     /**
      * Get first valid account policy.
      *
-     * @return parent account policy if isInheritAccountPolicy is 'true' and
-     * parent is not null. Return local account policy otherwise.
+     * @return parent account policy if isInheritAccountPolicy is 'true' and parent is not null, local account policy
+     * otherwise.
      */
     public AccountPolicy getAccountPolicy() {
         return isInheritAccountPolicy() && getParent() != null
@@ -406,7 +430,7 @@ public class SyncopeRole extends Abstrac
                 : accountPolicy;
     }
 
-    public void setAccountPolicy(AccountPolicy accountPolicy) {
+    public void setAccountPolicy(final AccountPolicy accountPolicy) {
         this.accountPolicy = accountPolicy;
     }
 

Modified: incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/user/SyncopeUser.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/user/SyncopeUser.java?rev=1401665&r1=1401664&r2=1401665&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/user/SyncopeUser.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/user/SyncopeUser.java Wed Oct 24 13:07:57 2012
@@ -159,8 +159,10 @@ public class SyncopeUser extends Abstrac
      */
     @ManyToMany(fetch = FetchType.EAGER)
     @JoinTable(joinColumns =
-    @JoinColumn(name = "user_id"), inverseJoinColumns =
+    @JoinColumn(name = "user_id"),
+    inverseJoinColumns =
     @JoinColumn(name = "resource_name"))
+    @Valid
     private Set<ExternalResource> resources;
 
     public SyncopeUser() {
@@ -182,7 +184,7 @@ public class SyncopeUser extends Abstrac
     }
 
     @Override
-    protected Set<ExternalResource> resources() {
+    protected Set<ExternalResource> internalGetResources() {
         return resources;
     }
 
@@ -267,9 +269,8 @@ public class SyncopeUser extends Abstrac
     }
 
     public void setPassword(final String password, final CipherAlgorithm cipherAlgoritm, final int historySize) {
-
         // clear password
-        clearPassword = password;
+        this.clearPassword = password;
 
         try {
             this.password = encodePassword(password, cipherAlgoritm);
@@ -312,22 +313,20 @@ public class SyncopeUser extends Abstrac
     }
 
     @Override
-    public <T extends AbstractDerAttr> boolean addDerivedAttribute(final T derivedAttribute) {
-        if (!(derivedAttribute instanceof UDerAttr)) {
-            throw new ClassCastException("attribute is expected to be typed UDerAttr: " + derivedAttribute.getClass().
-                    getName());
+    public <T extends AbstractDerAttr> boolean addDerivedAttribute(final T derAttr) {
+        if (!(derAttr instanceof UDerAttr)) {
+            throw new ClassCastException("attribute is expected to be typed UDerAttr: " + derAttr.getClass().getName());
         }
 
-        return derivedAttributes.add((UDerAttr) derivedAttribute);
+        return derivedAttributes.add((UDerAttr) derAttr);
     }
 
     @Override
-    public <T extends AbstractDerAttr> boolean removeDerivedAttribute(T derivedAttribute) {
-        if (!(derivedAttribute instanceof UDerAttr)) {
-            throw new ClassCastException("attribute is expected to be typed UDerAttr: " + derivedAttribute.getClass().
-                    getName());
+    public <T extends AbstractDerAttr> boolean removeDerivedAttribute(final T derAttr) {
+        if (!(derAttr instanceof UDerAttr)) {
+            throw new ClassCastException("attribute is expected to be typed UDerAttr: " + derAttr.getClass().getName());
         }
-        return derivedAttributes.remove((UDerAttr) derivedAttribute);
+        return derivedAttributes.remove((UDerAttr) derAttr);
     }
 
     @Override
@@ -344,21 +343,19 @@ public class SyncopeUser extends Abstrac
     }
 
     @Override
-    public <T extends AbstractVirAttr> boolean addVirtualAttribute(final T virtualAttribute) {
-        if (!(virtualAttribute instanceof UVirAttr)) {
-            throw new ClassCastException("attribute is expected to be typed UVirAttr: " + virtualAttribute.getClass().
-                    getName());
+    public <T extends AbstractVirAttr> boolean addVirtualAttribute(final T virAttr) {
+        if (!(virAttr instanceof UVirAttr)) {
+            throw new ClassCastException("attribute is expected to be typed UVirAttr: " + virAttr.getClass().getName());
         }
-        return virtualAttributes.add((UVirAttr) virtualAttribute);
+        return virtualAttributes.add((UVirAttr) virAttr);
     }
 
     @Override
-    public <T extends AbstractVirAttr> boolean removeVirtualAttribute(final T virtualAttribute) {
-        if (!(virtualAttribute instanceof UVirAttr)) {
-            throw new ClassCastException("attribute is expected to be typed UVirAttr: " + virtualAttribute.getClass().
-                    getName());
+    public <T extends AbstractVirAttr> boolean removeVirtualAttribute(final T virAttr) {
+        if (!(virAttr instanceof UVirAttr)) {
+            throw new ClassCastException("attribute is expected to be typed UVirAttr: " + virAttr.getClass().getName());
         }
-        return virtualAttributes.remove((UVirAttr) virtualAttribute);
+        return virtualAttributes.remove((UVirAttr) virAttr);
     }
 
     @Override
@@ -369,7 +366,6 @@ public class SyncopeUser extends Abstrac
     @Override
     public void setVirtualAttributes(final List<? extends AbstractVirAttr> virtualAttributes) {
         this.virtualAttributes.clear();
-
         if (virtualAttributes != null && !virtualAttributes.isEmpty()) {
             this.virtualAttributes.addAll((List<UVirAttr>) virtualAttributes);
         }
@@ -379,7 +375,7 @@ public class SyncopeUser extends Abstrac
         return workflowId;
     }
 
-    public void setWorkflowId(String workflowId) {
+    public void setWorkflowId(final String workflowId) {
         this.workflowId = workflowId;
     }
 
@@ -387,11 +383,11 @@ public class SyncopeUser extends Abstrac
         return status;
     }
 
-    public void setStatus(String status) {
+    public void setStatus(final String status) {
         this.status = status;
     }
 
-    public void generateToken(int tokenLength, int tokenExpireTime) {
+    public void generateToken(final int tokenLength, final int tokenExpireTime) {
         this.token = RandomStringUtils.randomAlphanumeric(tokenLength);
 
         Calendar calendar = Calendar.getInstance();