Salome HOME
PMD plugin is refreshed. Some code is modified to respect PMD rules. Ant build proced...
[tools/siman.git] / Workspace / Siman-Common / src / org / splat / dal / bo / kernel / Entity.java
index 77388d24086ea24c08fb35168ee7fd0615d67d8d..c66a7ce204cc00469fcfc4fded326d01a9b33790 100644 (file)
@@ -24,7 +24,7 @@ import org.splat.kernel.ObjectProperties;
 
 public abstract class Entity extends Any {
 
-    private Set<Relation> relations = new HashSet<Relation>();
+    private final Set<Relation> relations = new HashSet<Relation>();
 
 //  ==============================================================================================================================
 //  Constructors
@@ -34,7 +34,7 @@ public abstract class Entity extends Any {
     protected Entity () {
     }
 //  Initialization constructor
-    protected Entity (ObjectProperties prop) throws MissedPropertyException, InvalidPropertyException, MultiplyDefinedException {
+    protected Entity (final ObjectProperties prop) throws MissedPropertyException, InvalidPropertyException, MultiplyDefinedException {
       super(prop);
     }
 
@@ -42,21 +42,25 @@ public abstract class Entity extends Any {
 //  Public member functions
 //  ==============================================================================================================================
 
-    public Relation getFirstRelation (Class<? extends Relation> type) {
+    public Relation getFirstRelation (final Class<? extends Relation> type) {
 //  -----------------------------------------------------------------
       for (Iterator<Relation> i=relations.iterator(); i.hasNext();) {
        Relation link = i.next();
-       if (link.getClass().equals(type)) return link;
+       if (link.getClass().equals(type)) {
+                       return link;
+               }
       }
       return null;
     }
 
-    public List<Relation> getRelations (Class<? extends Relation> type) {
+    public List<Relation> getRelations (final Class<? extends Relation> type) {
       List<Relation> result = new Vector<Relation>();
 
       for (Iterator<Relation> i=relations.iterator(); i.hasNext();) {
        Relation link = i.next();
-       if (link.getClass().equals(type)) result.add(link);
+       if (link.getClass().equals(type)) {
+                       result.add(link);
+               }
       }
       return result;
     }
@@ -65,11 +69,11 @@ public abstract class Entity extends Any {
 //  Protected services
 //  ==============================================================================================================================
 
-    protected Set<Relation> getAllRelations () {
+    public Set<Relation> getAllRelations () {
       return relations;
     }
 
-    protected Relation addRelation (Relation link) {
+    public Relation addRelation (Relation link) {
 
       relations.add(link);
 
@@ -82,11 +86,15 @@ public abstract class Entity extends Any {
       return link;
     }
 
-    protected void removeRelation (Class<? extends Relation> type, Persistent to) {
+    public void removeRelation (final Class<? extends Relation> type, final Persistent to) {
       for (Iterator<Relation> i=relations.iterator(); i.hasNext();) {
        Relation link = i.next();
-       if (!link.getClass().equals(type)) continue;
-       if (!link.getTo().equals(to))      continue;
+       if (!link.getClass().equals(type)) {
+                       continue;
+               }
+       if (!link.getTo().equals(to)) {
+                       continue;
+               }
        i.remove();
        return;
       }