public void _jspService(HttpServletRequest request, HttpServletResponse response)
      throws java.io.IOException, ServletException {

    JspFactory _jspxFactory = null;
    javax.servlet.jsp.PageContext pageContext = null;
    HttpSession session = null;
    ServletContext application = null;
    ServletConfig config = null;
    JspWriter out = null;
    Object page = this;
    JspWriter _jspx_out = null;

    try {
      _jspxFactory = JspFactory.getDefaultFactory();
      response.setContentType("text/html;charset=ISO-8859-1");
      pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true);
      application = pageContext.getServletContext();
      config = pageContext.getServletConfig();
      session = pageContext.getSession();
      out = pageContext.getOut();
      _jspx_out = out;

      out.write("\n\n");
      out.write("\n\n");

      // Get required parameter(s)
      String nodeIdStr = request.getParameter("node");
      if (nodeIdStr == null) throw new org.opennms.web.MissingParameterException("node");
      int nodeId = Integer.parseInt(nodeIdStr);
      String nodeLabel = org.opennms.web.element.NetworkElementFactory.getNodeLabel(nodeId);
      Node node_db = NetworkElementFactory.getNode(nodeId);
      String orgName = node_db.getOrganizationName();
      Asset asset = this.model.getAsset(nodeId);
      boolean isNew = false;

      if (asset == null) {
        asset = new Asset();
        isNew = true;
      }

      Vector vCategories = WTProperties.getList("AssetCategories.list");

      out.write("\n\n");
      out.write("<html>\n");
      out.write("<head>\n\t");
      out.write("<title>WebTelemetry - Node Assets | System Info for ");
      out.print(node_db.getLabel());
      out.write("</title>\n\t");
      out.write("<base HREF=\"");
      out.print(org.opennms.web.Util.calculateUrlBase(request));
      out.write("\" />\n\t");
      out.write(
          "<link rel=\"stylesheet\" type=\"text/css\" href=\"/wt-portal/css/default.css\" />\n\t");
      out.write("<script type=\"text/javascript\" src=\"/wt-portal/javascript/WTtools.js\">");
      out.write("</script>\n");
      out.write("</head>\n\n");
      out.write("<body>\n\t");
      out.write("<!-- Header -->\n\t");
      String title = "Asset - Vendor Info for Node: " + node_db.getLabel() + " (" + orgName + ")";
      out.write("\n\t");
      JspRuntimeLibrary.include(
          request,
          response,
          "/includes/tabheader.jsp"
              + "?"
              + "title="
              + java.net.URLEncoder.encode("" + title)
              + "&"
              + "refresh="
              + "1"
              + "&"
              + "helpURL="
              + "assetmanager%2FWTHelp_AssetManager.html"
              + "&"
              + "tabgroup="
              + "asset"
              + "&"
              + "tabselected="
              + "vendor"
              + "&"
              + "node="
              + java.net.URLEncoder.encode("" + nodeIdStr),
          out,
          false);
      out.write("\n\n");
      out.write("<!-- BEGIN FRAMING TABLE:open tags, keep at 100%-->\n");
      out.write("<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n\t");
      out.write("<tr>\n\t\t");
      out.write("<td width=\"10\">");
      out.write(
          "<img src=\"/wt-portal/images/spacers/spacer.gif\" height=\"1\" width=\"10\" border=\"0\" alt=\"WebTelemetry\">");
      out.write("</td>\n\t\t");
      out.write("<td>\n\n");
      out.write("<!-- USER-DEFINED ATTRIBUTES TABLE: was Identification -->\n      ");
      out.write("<form action=\"asset/modifyAsset\" method=\"POST\" name=\"sysInfo\">\n        ");
      out.write("<input type=\"hidden\" name=\"node\" value=\"");
      out.print(nodeId);
      out.write("\" />\n        ");
      out.write("<input type=\"hidden\" name=\"isnew\" value=\"");
      out.print(isNew);
      out.write("\" />\n        ");
      out.write("<input type=\"hidden\" name=\"view\" value=\"asset-tab-vendor\" />\n\n        ");
      if (!isNew) {
        out.write("\n        ");
        out.write("<!-- asset-tab-system -->\n        ");
        out.write("<input type=\"hidden\" name=\"category\" value=\"");
        out.print(asset.getCategory());
        out.write("\" />\n        ");
        out.write("<input type=\"hidden\" name=\"serialnumber\" value=\"");
        out.print(asset.getSerialNumber());
        out.write("\" />\n        ");
        out.write("<input type=\"hidden\" name=\"manufacturer\" value=\"");
        out.print(asset.getManufacturer());
        out.write("\" />\n        ");
        out.write("<input type=\"hidden\" name=\"operatingsystem\" value=\"");
        out.print(asset.getOperatingSystem());
        out.write("\" />\n        ");
        out.write("<input type=\"hidden\" name=\"modelnumber\" value=\"");
        out.print(asset.getModelNumber());
        out.write("\" />\n        ");
        out.write("<input type=\"hidden\" name=\"assetnumber\" value=\"");
        out.print(asset.getAssetNumber());
        out.write("\" />\n        ");
        out.write("<input type=\"hidden\" name=\"dateinstalled\" value=\"");
        out.print(asset.getDateInstalled());
        out.write("\" />\n        ");
        out.write("<input type=\"hidden\" name=\"description\" value=\"");
        out.print(asset.getDescription());
        out.write("\" />\n        ");
        out.write("<input type=\"hidden\" name=\"comments\" value=\"");
        out.print(asset.getComments());
        out.write("\" />\n\n        ");
        out.write("<!-- asset-tab-location -->\n        ");
        out.write("<input type=\"hidden\" name=\"region\" value=\"");
        out.print(asset.getRegion());
        out.write("\" />\n        ");
        out.write("<input type=\"hidden\" name=\"division\" value=\"");
        out.print(asset.getDivision());
        out.write("\" />\n        ");
        out.write("<input type=\"hidden\" name=\"department\" value=\"");
        out.print(asset.getDepartment());
        out.write("\" />\n        ");
        out.write("<input type=\"hidden\" name=\"address1\" value=\"");
        out.print(asset.getAddress1());
        out.write("\" />\n        ");
        out.write("<input type=\"hidden\" name=\"address2\" value=\"");
        out.print(asset.getAddress2());
        out.write("\" />\n        ");
        out.write("<input type=\"hidden\" name=\"city\" value=\"");
        out.print(asset.getCity());
        out.write("\" />\n        ");
        out.write("<input type=\"hidden\" name=\"state\" value=\"");
        out.print(asset.getState());
        out.write("\" />\n        ");
        out.write("<input type=\"hidden\" name=\"zip\" value=\"");
        out.print(asset.getZip());
        out.write("\" />\n        ");
        out.write("<input type=\"hidden\" name=\"building\" value=\"");
        out.print(asset.getBuilding());
        out.write("\" />\n        ");
        out.write("<input type=\"hidden\" name=\"floor\" value=\"");
        out.print(asset.getFloor());
        out.write("\" />\n        ");
        out.write("<input type=\"hidden\" name=\"room\" value=\"");
        out.print(asset.getRoom());
        out.write("\" />\n        ");
        out.write("<input type=\"hidden\" name=\"rack\" value=\"");
        out.print(asset.getRack());
        out.write("\" />\n        ");
        out.write("<input type=\"hidden\" name=\"slot\" value=\"");
        out.print(asset.getSlot());
        out.write("\" />\n        ");
        out.write("<input type=\"hidden\" name=\"port\" value=\"");
        out.print(asset.getPort());
        out.write("\" />\n        ");
        out.write("<input type=\"hidden\" name=\"circuitid\" value=\"");
        out.print(asset.getCircuitId());
        out.write("\" />\n        ");
      }
      out.write("\n\n");
      out.write("<!-- END FRAMING TABLE:open tags, keep at 100%-->\n\t");
      out.write("<table width=\"98%\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">\n\t  ");
      out.write("<tr class=\"tableHeader\">\n\t    ");
      out.write("<td colspan=\"6\" class=\"tableHeader\">Vendor");
      out.write("</td>\n\t  ");
      out.write("</tr>\n\t  ");
      out.write("<tr class=\"tableRowLight\">\n\t    ");
      out.write("<td class=\"tableText\">");
      out.write("<span class=\"formText\">Name:");
      out.write("</span>");
      out.write("</td>\n\t    ");
      out.write("<td class=\"tableText\">");
      out.write("<input type=\"text\" name=\"vendor\" value=\"");
      out.print(asset.getVendor());
      out.write("\" size=\"20\" maxlength=\"64\"/>");
      out.write("</td>\n\t    ");
      out.write("<td class=\"tableText\">");
      out.write("<span class=\"formText\">Phone:");
      out.write("</span>");
      out.write("</td>\n\t    ");
      out.write("<td class=\"tableText\">");
      out.write("<input type=\"text\" name=\"vendorphone\" value=\"");
      out.print(asset.getVendorPhone());
      out.write("\" size=\"20\" maxlength=\"64\"/>");
      out.write("</td>\n\t    ");
      out.write("<td class=\"tableText\">");
      out.write("<span class=\"formText\">Fax:");
      out.write("</span>");
      out.write("</td>\n\t    ");
      out.write("<td class=\"tableText\">");
      out.write("<input type=\"text\" name=\"vendorfax\"  value=\"");
      out.print(asset.getVendorFax());
      out.write("\" size=\"20\" maxlength=\"64\"/>");
      out.write("</td>\n\t  ");
      out.write("</tr>\n\t  ");
      out.write("<tr class=\"tableRowLight\">\n\t    ");
      out.write("<td class=\"tableText\">");
      out.write("<span class=\"formText\">Lease:");
      out.write("</span>");
      out.write("</td>\n\t    ");
      out.write("<td class=\"tableText\">");
      out.write("<input type=\"text\" name=\"lease\" value=\"");
      out.print(asset.getLease());
      out.write("\" size=\"20\" maxlength=\"64\"/>");
      out.write("</td>\n\t    ");
      out.write("<td class=\"tableText\">");
      out.write("<span class=\"formText\">Lease Expires:");
      out.write("</span>");
      out.write("</td>\n\t    ");
      out.write("<td class=\"tableText\">");
      out.write("<input type=\"text\" name=\"leaseexpires\" value=\"");
      out.print(asset.getLeaseExpires());
      out.write("\" size=\"20\" maxlength=\"64\"/>");
      out.write("</td>\n\t    ");
      out.write("<td class=\"tableText\">");
      out.write("<span class=\"formText\">Vendor Asset:");
      out.write("</span>");
      out.write("</td>\n\t    ");
      out.write("<td class=\"tableText\">");
      out.write("<input type=\"text\" name=\"vendorassetnumber\" value=\"");
      out.print(asset.getVendorAssetNumber());
      out.write("\" size=\"20\" maxlength=\"64\"/>");
      out.write("</td>\n\t  ");
      out.write("</tr>\n\t  ");
      out.write("<tr class=\"tableRowLight\">\n\t    ");
      out.write("<td class=\"tableText\">");
      out.write("<span class=\"formText\">Maint Contract:");
      out.write("</span>");
      out.write("</td>\n\t    ");
      out.write("<td class=\"tableText\">");
      out.write("<input type=\"text\" name=\"maintcontract\" value=\"");
      out.print(asset.getMaintContract());
      out.write("\" size=\"20\" maxlength=\"64\"/>");
      out.write("</td>\n\t    ");
      out.write("<td class=\"tableText\">");
      out.write("<span class=\"formText\">Contract Expires:");
      out.write("</span>");
      out.write("</td>\n\t    ");
      out.write("<td class=\"tableText\">");
      out.write("<input type=\"text\" name=\"maintcontractexpires\" value=\"");
      out.print(asset.getMaintContractExpires());
      out.write("\" size=\"20\" maxlength=\"64\"/>");
      out.write("</td>\n\t    ");
      out.write("<td class=\"tableText\">");
      out.write("<span class=\"formText\">Maint Phone:");
      out.write("</span>");
      out.write("</td>\n\t    ");
      out.write("<td class=\"tableText\">");
      out.write("<input type=\"text\" name=\"supportphone\" value=\"");
      out.print(asset.getSupportPhone());
      out.write("\" size=\"20\" maxlength=\"64\"/>");
      out.write("</td>\n\t  ");
      out.write("</tr>\n\t  ");
      out.write("<tr class=\"tableRowLight\">\n\t    ");
      out.write("<td class=\"tableText\" colspan=\"6\">");
      out.write(
          "<img src=\"/wt-portal/images/spacers/spacer.gif\" height=\"4\" width=\"10\" border=\"0\" alt=\"WebTelemetry\">");
      out.write("</td>\n\t  ");
      out.write("</tr>\n\t");
      out.write("</table>");
      out.write("<br />\n\n\t");
      out.write("<table width=\"98%\" cellspacing=\"0\" cellpadding=\"2\" border=\"0\">\n\t  ");
      out.write("<tr>\n\t\t");
      out.write("<td colspan=\"3\">");
      out.write("<br />\n\t\t\t");
      out.write("<INPUT type=\"hidden\" name=\"button\" value=\"\">\n\t\t\t");
      out.write(
          "<INPUT type=\"image\" src=\"/wt-portal/images/buttons/btn_save_changes.gif\" onClick=\"document.sysInfo.button.value='Save Changes';\">\n\t\t\t&nbsp;&nbsp;&nbsp;\n\t\t\t");
      out.write(
          "<a href=\"javascript:document.sysInfo.reset()\" onClick=\"javascript:document.sysInfo.reset();\">");
      out.write("<img src=\"/wt-portal/images/buttons/btn_reset.gif\" border=\"0\" alt=\"Reset\">");
      out.write("</a>");
      out.write("<br />&nbsp;\n\t\t\t");
      out.write("<!-- ");
      out.write("<input type=\"submit\" value=\"Save Changes\"/>\n\t\t\t");
      out.write("<input type=\"reset\" /> -->\n\t\t");
      out.write("</td>\n\t\t");
      out.write("<td colspan=\"3\" align=\"right\" class=\"message\">");
      out.write("<br />\n\t\t\t");
      if (isNew) {
        out.write("\n\t\t\t\tNew Record\n\t\t\t");
      } else {
        out.write("\n\t\t\t\tLast Modified: ");
        out.print(WTTools.formatLocalDateToString(asset.getLastModifiedDate()));
        out.write(" by ");
        out.print(asset.getUserLastModified());
        out.write("\n\t\t\t");
      }
      out.write("\n\t\t");
      out.write("</td>\n\t  ");
      out.write("</tr>\n\t");
      out.write("</table>\n\t");
      out.write("</form>\n\n");
      out.write("<!-- BEGIN FRAMING TABLE:close tags-->\n\t\t");
      out.write("</td>\n\t");
      out.write("</tr>\n");
      out.write("</table>\n");
      out.write("<!-- END FRAMING TABLE:close tags-->\n\n");
      out.write("<br>\n");
      JspRuntimeLibrary.include(request, response, "/includes/footer.jsp", out, false);
      out.write("\n\n");
      out.write("</body>\n");
      out.write("</html>\n");
    } catch (Throwable t) {
      out = _jspx_out;
      if (out != null && out.getBufferSize() != 0) out.clearBuffer();
      if (pageContext != null) pageContext.handlePageException(t);
    } finally {
      if (_jspxFactory != null) _jspxFactory.releasePageContext(pageContext);
    }
  }
Esempio n. 2
0
 /**
  * Method executeTask.
  *
  * @param object
  *     <p>incomingRequest
  * @author EDSAC returns a copy of asset with tagNumber changed, trackingNumber "N/A" and status
  *     Pending in a list
  */
 public Object executeTask(Object object) throws Exception {
   Map incomingRequest = (Map) object;
   List assetList = new ArrayList();
   try {
     Asset asset = (Asset) incomingRequest.get("asset");
     Asset assetClon =
         new Asset(
             asset.getAssetClass(),
             asset.getSecurityCode(),
             asset.getCommodity(),
             asset.getManufacturer(),
             asset.getModel(),
             asset.getSerialNumber(),
             asset.getAssetCost(),
             asset.getDateInService(),
             asset.getDeprecMethod(),
             asset.getWarrantyStart(),
             asset.getWarrantyEnd(),
             asset.getUpgradeReqs(),
             asset.getContractService(),
             asset.getPurchaseOrder(),
             asset.getDateEntered(),
             asset.getAssetStatus(),
             asset.getAssetUdf1(),
             asset.getAssetUdf2(),
             asset.getAssetUdf3(),
             asset.getAssetUdf4(),
             asset.getAssetUdf5(),
             asset.getTotalCost(),
             asset.getIcText(),
             asset.getImageFile(),
             asset.getPoVendor(),
             asset.getContractorName(),
             asset.getOwner(),
             asset.getDeprecTerm(),
             asset.getDateReceived(),
             asset.getIcReceipt(),
             asset.getAssetUdf6(),
             asset.getAssetUdf7(),
             asset.getAssetUdf8(),
             asset.getAssetUdf9(),
             asset.getAssetUdf10(),
             asset.getIcLineKey(),
             asset.getItemNumber(),
             asset.getItemLocation(),
             asset.getIcAccount(),
             asset.getIcDsbHeader(),
             asset.getIcDsbLine(),
             asset.getLocalCurrencyPrice(),
             asset.getOriginalCost(),
             asset.getExitValue(),
             asset.getDateInactive(),
             asset.getLastChgBy(),
             asset.getDateChanged(),
             asset.getDescription(),
             asset.getLease(),
             asset.getLeaseType(),
             asset.getLeaseTerm(),
             asset.getMonthlyPayment(),
             asset.getLeasingCompany(),
             asset.getRenewalDate(),
             asset.getFinancing(),
             asset.getPrinted(),
             asset.getTrackingNumber(),
             asset.getFiscalYear());
     assetClon.setTagNumber(UniqueKeyGenerator.getInstance().getUniqueKey().toString());
     assetClon.setAssetStatus("Pending");
     assetClon.setTrackingNumber("N/A");
     assetList.add(assetClon);
   } catch (Exception e) {
     Log.error(this, e.toString());
     this.setStatus(Status.FAILED);
   }
   return assetList;
 }