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/21 19:03:24 UTC

svn commit: r416073 - in /incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core: api/server/HardwareModel.java gui/www/HardwareAction.java

Author: toback
Date: Wed Jun 21 12:03:24 2006
New Revision: 416073

URL: http://svn.apache.org/viewvc?rev=416073&view=rev
Log:
Fixed an issue where hardware as entered in the template wasn't being submitted to the database.

Modified:
    incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/api/server/HardwareModel.java
    incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/gui/www/HardwareAction.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=416073&r1=416072&r2=416073&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 Wed Jun 21 12:03:24 2006
@@ -25,6 +25,7 @@
 import org.apache.lokahi.core.common.interfaces.LokahiModel;
 import org.apache.lokahi.tomcat.api.server.Tomcat;
 import org.apache.lokahi.tomcat.api.worker.TomcatWorker;
+import org.apache.log4j.Logger;
 
 import java.io.IOException;
 import java.sql.SQLException;
@@ -35,10 +36,16 @@
  * @version $Id: HardwareModel.java,v 1.5 2006/03/10 22:46:07 drtobes Exp $
  */
 public class HardwareModel extends LokahiModel<Hardware> {
+  static final Logger logger = Logger.getLogger(HardwareModel.class);
+
+  public void addHardware(User u, Hardware h) throws AuthorizationException, TMCIllegalArgumentException, SQLException, IOException {
+    Function f = Function.getFunction("AddHardware");
+    this.addHardware(u, h, f);
+  }
 
   public void addHardware(User u, Hardware h, Function f) throws AuthorizationException, TMCIllegalArgumentException, SQLException, IOException {
     this.jpInit(f, u, h.getName());
-    if (u.isAllowed(f) && "AddHardware".equals(f.getCommand())) {
+    if (u.isAllowed(f)) {
       Hardware.store(h);
     } else {
       throw new AuthorizationException("User " + u.getName() + " Not allowed to " + f.getName());
@@ -77,7 +84,7 @@
 
   public void updateHardware(User u, Hardware h, Function f) throws AuthorizationException, TMCIllegalArgumentException, SQLException, IOException {
     this.jpInit(f, u, h.getName());
-    if (u.isAllowed(f) && "UpdateHardware".equals(f.getCommand())) {
+    if (u.isAllowed(f)) {
       if (h.getPk() > 1 && h.getServerName() != null && !"".equals(h.getServerName())) {
         Hardware.update(h);
       } else {
@@ -119,12 +126,12 @@
     this.addHardware(u, h);
   }
 
-  public void addHardware(User u, Hardware h) throws AuthorizationException, TMCIllegalArgumentException, SQLException, IOException {
-    Function f = Function.getFunction("AddHardware");
-    this.jpInit(f, u, h.getName());
-    if (!u.isAllowed(f)) throw new AuthorizationException(""); //todo finish this
-    this.addHardware(jp, h);
-  }
+//  public void addHardware(User u, Hardware h) throws AuthorizationException, TMCIllegalArgumentException, SQLException, IOException {
+//    Function f = Function.getFunction("AddHardware");
+//    this.jpInit(f, u, h.getName());
+//    if (!u.isAllowed(f)) throw new AuthorizationException("User " + u.getName() + " Not allowed to " + f.getName());
+//    this.addHardware(jp, h);
+//  }
 
   public void addHardware(JobPool jp, Hardware h) throws AuthorizationException, TMCIllegalArgumentException, SQLException, IOException {
 
@@ -135,7 +142,8 @@
   }
 
   public void updateHardware(User u, Hardware h) throws AuthorizationException, TMCIllegalArgumentException, SQLException, IOException {
-
+  Function f = Function.getFunction("UpdateHardware");
+    this.updateHardware(u, h, f);
   }
 
   public void updateHardware(JobPool jp, Hardware h) throws AuthorizationException, TMCIllegalArgumentException, SQLException, IOException {

Modified: incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/gui/www/HardwareAction.java
URL: http://svn.apache.org/viewvc/incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/gui/www/HardwareAction.java?rev=416073&r1=416072&r2=416073&view=diff
==============================================================================
--- incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/gui/www/HardwareAction.java (original)
+++ incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/gui/www/HardwareAction.java Wed Jun 21 12:03:24 2006
@@ -124,6 +124,7 @@
     final int envId;
     if (envIdst != null && !"".equals(envIdst)) {
       envId = Integer.parseInt(envIdst);
+      h.setEnvId(envId);
     }
     if (stateId != null && !"".equals(stateId)) {
       h.setStatusId(Integer.parseInt(stateId));