From 452681228ef122ef0f867bfbf1aa505bee74d61d Mon Sep 17 00:00:00 2001 From: burdziak Date: Thu, 23 Aug 2018 15:47:04 +0200 Subject: Fixes sonar issues in Examples Issue-ID: AAF-445 Change-Id: I798f400a54b16b93b4464b1c4879131132afc388 Signed-off-by: burdziak --- .../org/onap/aaf/cadi/aaf/client/Examples.java | 47 +++++++++++++--------- 1 file changed, 29 insertions(+), 18 deletions(-) (limited to 'cadi') diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/client/Examples.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/client/Examples.java index da81d75c..c55d3b37 100644 --- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/client/Examples.java +++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/client/Examples.java @@ -76,7 +76,8 @@ public class Examples { version = elem.substring(8); } } - if(className!=null && version!=null)break; + if(className!=null && version!=null) + break; } if(className==null) { throw new APIException(nameOrContentType + " does not contain Class Information"); @@ -87,7 +88,8 @@ public class Examples { // No Void.class in aaf.v2_0 package causing errors when trying to use a newVoidv2_0 // method similar to others in this class. This makes it work, but is it right? - if ("Void".equals(className)) return ""; + if ("Void".equals(className)) + return ""; if("1.1".equals(version)) { version = "v1_0"; @@ -158,26 +160,32 @@ public class Examples { Role r; Pkey p; Roles rs = new Roles(); - rs.getRole().add(r = new Role()); + r = new Role(); + rs.getRole().add(r); r.setName("org.osaaf.myns.myRole"); - r.getPerms().add(p = new Pkey()); + p = new Pkey(); + r.getPerms().add(p); p.setType("org.osaaf.myns.myType"); p.setInstance("myInstance"); p.setAction("myAction"); - - r.getPerms().add(p = new Pkey()); + + p = new Pkey(); + r.getPerms().add(p); p.setType("org.osaaf.myns.myType"); p.setInstance("myInstance"); p.setAction("myOtherAction"); - - rs.getRole().add(r = new Role()); + + r = new Role(); + rs.getRole().add(r); r.setName("org.osaaf.myns.myOtherRole"); - r.getPerms().add(p = new Pkey()); + p = new Pkey(); + r.getPerms().add(p); p.setType("org.osaaf.myns.myOtherType"); p.setInstance("myInstance"); p.setAction("myAction"); - - r.getPerms().add(p = new Pkey()); + + p = new Pkey(); + r.getPerms().add(p); p.setType("org.osaaf.myns.myOthertype"); p.setInstance("myInstance"); p.setAction("myOtherAction"); @@ -228,16 +236,17 @@ public class Examples { @SuppressWarnings("unused") private static Perms newPermsv2_0(boolean optional) { Perms perms = new Perms(); - Perm p; - perms.getPerm().add(p=new Perm()); + Perm p=new Perm(); + perms.getPerm().add(p); p.setType("org.osaaf.myns.myType"); p.setInstance("myInstance"); p.setAction("myAction"); p.getRoles().add("org.osaaf.myns.myRole"); p.getRoles().add("org.osaaf.myns.myRole2"); - - perms.getPerm().add(p=new Perm()); + + p=new Perm(); + perms.getPerm().add(p); p.setType("org.osaaf.myns.myOtherType"); p.setInstance("myInstance"); p.setAction("myOtherAction"); @@ -326,12 +335,14 @@ public class Examples { User user; Users users = new Users(); - users.getUser().add(user = new Users.User()); + user = new Users.User(); + users.getUser().add(user); user.setId("ab1234@people.osaaf.org"); GregorianCalendar gc = new GregorianCalendar(); user.setExpires(Chrono.timeStamp(gc)); - - users.getUser().add(user = new Users.User()); + + user = new Users.User(); + users.getUser().add(user); user.setId("zy9876@people.osaaf.org"); user.setExpires(Chrono.timeStamp(gc)); -- cgit 1.2.3-korg