Package org.jallinone.items.spareparts.java

Examples of org.jallinone.items.spareparts.java.ItemSheetVO


   * Callback method invoked when the user has double clicked on the selected row of the grid.
   * @param rowNumber selected row index
   * @param persistentObject v.o. related to the selected row
   */
  public void doubleClick(int rowNumber,ValueObject persistentObject) {
    ItemSheetVO vo = (ItemSheetVO)persistentObject;
    gridPanel.addLink(vo);
  }
View Full Code Here


    rootSheetController.addLookupListener(new LookupListener() {

      public void codeValidated(boolean validated) {}

      public void codeChanged(ValueObject parentVO,Collection parentChangedAttributes) {
        ItemSheetVO vo = (ItemSheetVO)rootSheetController.getLookupVO();
        sheets.clearData();
        if (vo.getSheetCodeITM25()==null) {
          controlRootSheet.setValue(null);
          controlDescr.setValue(null);
          gridItemSpareParts.clearData();
        }
        else {
          controlRootSheet.setValue(vo.getSheetCodeITM25());
          controlDescr.setValue(vo.getDescriptionSYS10());
          gridItemSpareParts.getOtherGridParams().put(ApplicationConsts.ITEM_PK,new ItemPK(itemVO.getCompanyCodeSys01(),itemVO.getItemCodeITM01()));
          gridItemSpareParts.reloadData();

           sheets.addLink(vo);
        }
View Full Code Here

            else {
              tabpanel.setEnabledAt(1,true);
              java.util.List rows = ((VOListResponse)res).getRows();
              if (rows.size()==1) {
                // specified item has a model associated...
                ItemSheetVO sheetVO = (ItemSheetVO)rows.get(0);
                sheets.addLink(sheetVO);
              }
            }
          }
        }
View Full Code Here

  /**
   * Callback method invoked when the user has clicked on the insert button
   * @param valueObject empty value object just created: the user can manage it to fill some attribute values
   */
  public void createValueObject(ValueObject valueObject) throws Exception {
    ItemSheetVO vo = (ItemSheetVO)valueObject;
    String companyCode = frame.getLevelVO().getCompanyCodeSys01ITM29();
    vo.setCompanyCodeSys01ITM25(companyCode);
    vo.setLevITM25(frame.getLevelVO().getLevITM29());
    frame.getImagePanel().setImage(new byte[0]);
  }
View Full Code Here

   * @param oldValue old cell value (before cell editing)
   * @param newValue new cell value (just edited)
   * @return <code>true</code> if cell value is valid, <code>false</code> otherwise
   */
  public boolean validateCell(int rowNumber,String attributeName,Object oldValue,Object newValue) {
    ItemSheetVO vo = (ItemSheetVO)frame.getGrid().getVOListTableModel().getObjectForRow(rowNumber);
    if (attributeName.equals("sheetCodeITM25") && newValue!=null && (vo.getDescriptionSYS10()==null || vo.getDescriptionSYS10().equals("")))
      vo.setDescriptionSYS10(newValue.toString());
    if (attributeName.equals("imageITM25"))
      frame.getImagePanel().setImage((byte[])newValue);
    return true;
  }
View Full Code Here

   * Callback method invoked when the user has double clicked on the selected row of the grid.
   * @param rowNumber selected row index
   * @param persistentObject v.o. related to the selected row
   */
  public void doubleClick(int rowNumber,ValueObject persistentObject) {
    ItemSheetVO vo = (ItemSheetVO)persistentObject;
    Response res = ClientUtils.getData("loadItemSheetImage",vo);
    if (!res.isError()) {
      vo = (ItemSheetVO)((VOResponse)res).getVo();
      frame.getImagePanel().setImage(vo.getImageITM25());
    }
  }
View Full Code Here

      HashSet pkAttributes = new HashSet();
      pkAttributes.add("companyCodeSys01ITM25");
      pkAttributes.add("sheetCodeITM25");

      ItemSheetVO oldVO = null;
      ItemSheetVO newVO = null;
      for(int i=0;i<oldVOs.size();i++) {
        oldVO = (ItemSheetVO)oldVOs.get(i);
        newVO = (ItemSheetVO)newVOs.get(i);

        // update sheet description...
        CompanyTranslationUtils.updateTranslation(
           newVO.getCompanyCodeSys01ITM25(),
            oldVO.getDescriptionSYS10(),
            newVO.getDescriptionSYS10(),
            newVO.getProgressiveSys10ITM25(),
            serverLanguageId,
            username,
            conn
        );

        if (oldVO.getImageITM25()!=null && newVO.getImageITM25()==null) {
           // remove image from file system...
           String appPath = imagePath;
           appPath = appPath.replace('\\','/');
           if (!appPath.endsWith("/"))
             appPath += "/";
           if (!new File(appPath).isAbsolute()) {
             // relative path (to "WEB-INF/classes/" folder)
             appPath = this.getClass().getResource("/").getPath().replaceAll("%20"," ")+appPath;
           }
           new File(appPath+oldVO.getImageITM25()).delete();
        }
        else if (newVO.getImageITM25()!=null) {
           // save image on file system...
           String appPath = imagePath;
           appPath = appPath.replace('\\','/');
           if (!appPath.endsWith("/"))
             appPath += "/";
           if (!new File(appPath).isAbsolute()) {
             // relative path (to "WEB-INF/classes/" folder)
             appPath = this.getClass().getResource("/").getPath().replaceAll("%20"," ")+appPath;
           }
           new File(appPath).mkdirs();

           if (oldVO.getImageITM25()==null) {
             String relativePath = FileUtils.getFilePath(appPath,"ITM25");
             BigDecimal imageProgressive = CompanyProgressiveUtils.getInternalProgressive(newVO.getCompanyCodeSys01ITM25(),"ITM25_ITEM_SHEETS","IMG",conn);
             newVO.setImageNameITM25(relativePath+"IMG"+imageProgressive);
             new File(appPath+relativePath).mkdirs();
           }
           else
             newVO.setImageNameITM25(oldVO.getImageNameITM25());

           File f = new File(appPath+newVO.getImageNameITM25());
           f.delete();
           FileOutputStream out = new FileOutputStream(f);
           out.write(newVO.getImageITM25());
           out.close();
        }


        // update ITM01 table...
View Full Code Here

    PreparedStatement pstmt = null;
    ResultSet rset = null;
    Connection conn = null;
    try {
      if (this.conn==null) conn = getConn(); else conn = this.conn;
      ItemSheetVO vo = null;
      stmt = conn.createStatement();

      for(int i=0;i<list.size();i++) {
        vo = (ItemSheetVO)list.get(i);

        // check if there exists a relation among this sheet and another one: if exists then interrupt delete operation...
        rset = stmt.executeQuery(
            "select * from ITM30_SUB_SHEETS where "+
            "COMPANY_CODE_SYS01='"+vo.getCompanyCodeSys01ITM25()+"' and "+
            "(SHEET_CODE_ITM25='"+vo.getSheetCodeITM25()+"' or PARENT_SHEET_CODE_ITM25='"+vo.getSheetCodeITM25()+"')"
        );
        if (rset.next())
          throw new Exception("cannot delete sheet: it is currently referenced by another sheet");
        rset.close();

        // check if there exists a relation among this sheet and an item: if exists then interrupt delete operation...
        rset = stmt.executeQuery(
            "select * from ITM01_ITEMS where "+
            "COMPANY_CODE_SYS01='"+vo.getCompanyCodeSys01ITM25()+"' and "+
            "SHEET_CODE_ITM25='"+vo.getSheetCodeITM25()+"'"
        );
        if (rset.next())
          throw new Exception("cannot delete sheet: it is currently referenced in an item");
        rset.close();

        // delete spare parts linked to current sheet...
        stmt.executeUpdate(
            "delete from ITM27_SHEETS_SPARE_PARTS where "+
            "COMPANY_CODE_SYS01='"+vo.getCompanyCodeSys01ITM25()+"' and "+
            "SHEET_CODE_ITM25='"+vo.getSheetCodeITM25()+"'"
        );

       // retrieve root sheets to update...
        ArrayList rootSheetsToUpdate = new ArrayList();
        rset = stmt.executeQuery(
            "select ROOT_SHEET_CODE_ITM25 from ITM24_LEAFSHEETS where "+
            "COMPANY_CODE_SYS01='"+vo.getCompanyCodeSys01ITM25()+"' and "+
            "SHEET_CODE_ITM25='"+vo.getSheetCodeITM25()+"'"
        );
        while(rset.next()) {
          rootSheetsToUpdate.add(rset.getString(1));
        }
        rset.close();

        // delete link with root sheets...
        stmt.executeUpdate(
              "DELETE from ITM24_LEAFSHEETS where "+
              "COMPANY_CODE_SYS01='"+vo.getCompanyCodeSys01ITM25()+"' and "+
              "SHEET_CODE_ITM25='"+vo.getSheetCodeITM25()+"'"
        );

        // logically delete the record in ITM25...
        pstmt = conn.prepareStatement(
            "update ITM25_ITEM_SHEETS set ENABLED='N',LAST_UPDATE_USER=?,LAST_UPDATE_DATE=?  where "+
            "COMPANY_CODE_SYS01='"+vo.getCompanyCodeSys01ITM25()+"' and "+
            "SHEET_CODE='"+vo.getSheetCodeITM25()+"'"
        );
        pstmt.setString(1,username);
        pstmt.setTimestamp(2,new java.sql.Timestamp(System.currentTimeMillis()));
        pstmt.execute();
        pstmt.close();

        for(int k=0;k<rootSheetsToUpdate.size();k++)
          recalculateRootSheetSpareParts(conn,vo.getCompanyCodeSys01ITM25(),rootSheetsToUpdate.get(k).toString(),username);
      }

      return new VOResponse(new Boolean(true));
    }
    catch (Throwable ex) {
View Full Code Here

    PreparedStatement pstmt2 = null;
    ResultSet rset = null;
    Connection conn = null;
    try {
      if (this.conn==null) conn = getConn(); else conn = this.conn;
      ItemSheetVO vo = null;
       HashSet leafSheetCodes = new HashSet();
      pstmt = conn.prepareStatement("insert into ITM30_SUB_SHEETS(COMPANY_CODE_SYS01,PARENT_SHEET_CODE_ITM25,SHEET_CODE_ITM25,CREATE_USER,CREATE_DATE) VALUES(?,?,?,?,?)");
      for(int i=0;i<list.size();i++) {
        vo = (ItemSheetVO)list.get(i);

        pstmt.setString(1,vo.getCompanyCodeSys01ITM25());
        pstmt.setString(2,parentVO.getSheetCodeITM25());
        pstmt.setString(3,vo.getSheetCodeITM25());
        pstmt.setString(4,username);
        pstmt.setTimestamp(5,new java.sql.Timestamp(System.currentTimeMillis()));
        pstmt.execute();

        retrieveLeafSheets(conn,leafSheetCodes,vo.getCompanyCodeSys01ITM25(),vo.getSheetCodeITM25());
      }
      pstmt.close();

      // retrieve all root nodes of the current (parent) sheet...
      HashSet rootSheetCodes = new HashSet();
      retrieveRootSheets(conn,rootSheetCodes,parentVO.getCompanyCodeSys01ITM25(),parentVO.getSheetCodeITM25());

      if (rootSheetCodes.size()>0 && leafSheetCodes.size()>0) {

        // for each root sheet:
        // for each leaf: insert it in ITM24_LEAFSHEETS...
        if (rootSheetCodes.size()>0) {
          pstmt = conn.prepareStatement(
            "insert into ITM24_LEAFSHEETS(COMPANY_CODE_SYS01,ROOT_SHEET_CODE_ITM25,SHEET_CODE_ITM25,CREATE_USER,CREATE_DATE) values(?,?,?,?,?)"
          );
          pstmt2 = conn.prepareStatement(
            "select SHEET_CODE_ITM25 from ITM24_LEAFSHEETS where "+
            "COMPANY_CODE_SYS01=? and ROOT_SHEET_CODE_ITM25=? and SHEET_CODE_ITM25=?"
          );

          String rootSheetCode = null;
          String sheetCode = null;
          Iterator it = rootSheetCodes.iterator();
          while(it.hasNext()) {
            rootSheetCode = it.next().toString();
            it = leafSheetCodes.iterator();
            while(it.hasNext()) {
              sheetCode = it.next().toString();
              pstmt2.setString(1,vo.getCompanyCodeSys01ITM25());
              pstmt2.setString(2,rootSheetCode);
              pstmt2.setString(3,sheetCode);
              rset = pstmt2.executeQuery();
              if (!rset.next()) {
                pstmt.setString(1,vo.getCompanyCodeSys01ITM25());
                pstmt.setString(2,rootSheetCode);
                pstmt.setString(3,sheetCode);
                pstmt.setString(4,username);
                pstmt.setTimestamp(5,new java.sql.Timestamp(System.currentTimeMillis()));
                pstmt.execute();
              }
              rset.close();
            }

            // regenerate root sheet's spare parts...
            recalculateRootSheetSpareParts(conn,vo.getCompanyCodeSys01ITM25(),rootSheetCode,username);

          } // end while on root sheets...
        }
      }
View Full Code Here

    PreparedStatement pstmt = null;
    ResultSet rset = null;
    Connection conn = null;
    try {
      if (this.conn==null) conn = getConn(); else conn = this.conn;
      ItemSheetVO vo = null;
       HashSet leafSheetCodes = new HashSet();
      pstmt = conn.prepareStatement("delete from ITM30_SUB_SHEETS where COMPANY_CODE_SYS01=? and PARENT_SHEET_CODE_ITM25=? and SHEET_CODE_ITM25=?");
      for(int i=0;i<list.size();i++) {
        vo = (ItemSheetVO)list.get(i);

        pstmt.setString(1,vo.getCompanyCodeSys01ITM25());
        pstmt.setString(2,parentVO.getSheetCodeITM25());
        pstmt.setString(3,vo.getSheetCodeITM25());
        pstmt.execute();

        retrieveLeafSheets(conn,leafSheetCodes,vo.getCompanyCodeSys01ITM25(),vo.getSheetCodeITM25());
      }
      pstmt.close();

      // retrieve all root nodes of the current sheet...
      HashSet rootSheetCodes = new HashSet();
      retrieveRootSheets(conn,rootSheetCodes,parentVO.getCompanyCodeSys01ITM25(),parentVO.getSheetCodeITM25());

      if (rootSheetCodes.size()>0 && leafSheetCodes.size()>0) {
        // for each root sheet:
        // for each leaf: delete it in ITM24_LEAFSHEETS...
        pstmt = conn.prepareStatement(
          "delete from ITM24_LEAFSHEETS where COMPANY_CODE_SYS01=? and ROOT_SHEET_CODE_ITM25=? and SHEET_CODE_ITM25=?"
        );

        String rootSheetCode = null;
        String sheetCode = null;
        Iterator it = rootSheetCodes.iterator();
        while(it.hasNext()) {
          rootSheetCode = it.next().toString();
          it = leafSheetCodes.iterator();
          while(it.hasNext()) {
            sheetCode = it.next().toString();
            pstmt.setString(1,vo.getCompanyCodeSys01ITM25());
            pstmt.setString(2,rootSheetCode);
            pstmt.setString(3,sheetCode);
            pstmt.execute();
          }

          // regenerate root sheet's spare parts...
          recalculateRootSheetSpareParts(conn,vo.getCompanyCodeSys01ITM25(),rootSheetCode,username);

        } // end while on root sheets...
      }

      return new VOResponse(new Boolean(true));
View Full Code Here

TOP

Related Classes of org.jallinone.items.spareparts.java.ItemSheetVO

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.