You are viewing a plain text version of this content. The canonical link for it is here.
Posted to lokahi-commits@incubator.apache.org by to...@apache.org on 2006/06/15 14:00:22 UTC

svn commit: r414586 - /incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/api/server/HardwareModel.java

Author: toback
Date: Thu Jun 15 07:00:21 2006
New Revision: 414586

URL: http://svn.apache.org/viewvc?rev=414586&view=rev
Log:
Added the missing ability to delete hardware.

Modified:
    incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/api/server/HardwareModel.java

Modified: incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/api/server/HardwareModel.java
URL: http://svn.apache.org/viewvc/incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/api/server/HardwareModel.java?rev=414586&r1=414585&r2=414586&view=diff
==============================================================================
--- incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/api/server/HardwareModel.java (original)
+++ incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/api/server/HardwareModel.java Thu Jun 15 07:00:21 2006
@@ -47,6 +47,22 @@
     JobPool.update(jp);
   }
 
+    public void deleteHardware(User u, Collection<Hardware> c, Function f) throws SQLException, AuthorizationException, TMCIllegalArgumentException {
+      this.jpInit(f, u);
+        StringBuilder opts = new StringBuilder();
+      if (u.isAllowed(f) && "DeleteHardware".equals(f.getCommand())) {
+          for (Hardware h : c) {
+          opts.append(h.getName());
+              opts.append(',');
+        Hardware.delete(h);
+          }
+      } else {
+        throw new AuthorizationException("User " + u.getName() + " Not allowed to " + f.getName());
+      }
+      jp.setState(State.COMPLETE);
+      JobPool.update(jp);
+    }
+
   public void deleteHardware(User u, Hardware h, Function f) throws SQLException, AuthorizationException, TMCIllegalArgumentException {
     if (h == null || h.getPk() < 1) throw new TMCIllegalArgumentException("Hardware can not be null");
     this.jpInit(f, u, h.getName());