From 0ec8481c10cd8277d84c7c1a785483a0a739e5a0 Mon Sep 17 00:00:00 2001 From: abranson Date: Thu, 4 Aug 2011 00:42:34 +0200 Subject: More code cleanup: Refactored Entity Proxy Subscription to handle generics better Rewrote RemoteMap to use TreeMap instead of the internal array for order. It now sorts its keys by number if they parse, else as strings. Removed a no-longer-in-progress outcome form class --- .../instance/predefined/entitycreation/NewAgent.java | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) mode change 100755 => 100644 source/com/c2kernel/lifecycle/instance/predefined/entitycreation/NewAgent.java (limited to 'source/com/c2kernel/lifecycle/instance/predefined/entitycreation/NewAgent.java') diff --git a/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/NewAgent.java b/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/NewAgent.java old mode 100755 new mode 100644 index fa575a3..30b80c4 --- a/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/NewAgent.java +++ b/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/NewAgent.java @@ -2,7 +2,6 @@ package com.c2kernel.lifecycle.instance.predefined.entitycreation; import java.security.NoSuchAlgorithmException; import java.util.ArrayList; -import java.util.Iterator; import com.c2kernel.common.CannotManageException; import com.c2kernel.common.ObjectAlreadyExistsException; @@ -21,19 +20,19 @@ public class NewAgent implements java.io.Serializable { public String name; public String password; - - public ArrayList roles; + + public ArrayList roles; public NewAgent() { super(); - roles = new ArrayList(); - } - + roles = new ArrayList(); + } + public NewAgent(String name, String password) { this.name = name; this.password = password; } - + protected void create(int agentId) throws ObjectNotFoundException, ObjectCannotBeUpdated, NoSuchAlgorithmException, CannotManageException, ObjectAlreadyExistsException { AgentPath newAgent = Gateway.getLDAPLookup().getNextKeyManager().generateNextAgentKey(); newAgent.setAgentName(name); @@ -50,8 +49,8 @@ public class NewAgent implements java.io.Serializable { Logger.error(ex); throw new CannotManageException("Error initialising new agent"); } - for (Iterator iter = roles.iterator(); iter.hasNext();) { - String role = (String) iter.next(); + for (Object name2 : roles) { + String role = (String) name2; RolePath thisRole; try { thisRole = Gateway.getLDAPLookup().getRoleManager().getRolePath(role); @@ -60,6 +59,6 @@ public class NewAgent implements java.io.Serializable { } thisRole.addAgent(newAgent); } - + } } -- cgit v1.2.3