Exemplo n.º 1
0
  /**
   * Method getCodesDecodes.
   *
   * @return Vector<Decode>
   * @throws ValueTypeException
   */
  @Override
  public Vector<Decode> getCodesDecodes() throws ValueTypeException {
    final Vector<Decode> decodes = new Vector<Decode>();

    final Vector<Decode> decodesAll = super.getCodesDecodes();
    for (final Decode decode : decodesAll) {
      final Strategy strategy = (Strategy) decode.getObject();
      boolean isMgr = false;
      if (!strategy.hasStrategyManager()) {
        for (final Decode mgrdecode : decodesAll) {
          final Strategy strategyMgr = (Strategy) mgrdecode.getObject();
          if (strategyMgr.hasStrategyManager()) {
            if (strategyMgr.getStrategyManager().equals(strategy)) {
              isMgr = true;
              break;
            }
          }
        }
      }
      if (!isMgr) {
        decodes.add(decode);
      }
    }
    return decodes;
  }
 /**
  * Method getNewRow.
  *
  * @param newRow Vector<Object>
  * @param element Strategy
  */
 public void getNewRow(Vector<Object> newRow, Strategy element) {
   newRow.addElement(element.getName());
   newRow.addElement(element.getDescription());
   newRow.addElement(element.getClassName());
   if (element.hasStrategyManager()) {
     newRow.addElement(DAOStrategyManager.newInstance(element.getStrategyManager().getName()));
   } else {
     newRow.addElement(DAOStrategyManager.newInstance(Decode.NONE));
   }
   if (null == element.getMarketData()) {
     newRow.addElement(new YesNo());
   } else {
     newRow.addElement(YesNo.newInstance(element.getMarketData()));
   }
 }
  /**
   * Method populateDAO.
   *
   * @param value Object
   * @param row int
   * @param column int
   */
  public void populateDAO(Object value, int row, int column) {

    final Strategy element = (Strategy) getData().getAspect().get(row);

    switch (column) {
      case 0:
        {
          element.setName((String) value);
          break;
        }
      case 1:
        {
          element.setDescription((String) value);
          break;
        }
      case 2:
        {
          element.setClassName((String) value);
          break;
        }
      case 3:
        {
          if (value instanceof DAOStrategyManager) {
            if (!Decode.NONE.equals(((DAOStrategyManager) value).getDisplayName())) {
              element.setStrategyManager((Strategy) ((DAOStrategyManager) value).getObject());
            } else {
              element.setStrategyManager(null);
            }
          }
          break;
        }
      case 4:
        {
          element.setMarketData(new Boolean(((YesNo) value).getCode()));
          break;
        }
      default:
        {
        }
    }
    element.setDirty(true);
  }