Esempio n. 1
0
  /**
   * Constructor of the class
   *
   * @param sqle
   */
  @Override
  public CatchBlock getCatchBlock(Config config) {
    String strSQL = sql == null ? "" : sql.toString();
    if (StringUtil.isEmpty(strSQL)) strSQL = Caster.toString(getAdditional().get("SQL", ""), "");

    String datasourceName = datasource == null ? "" : datasource.getName();
    if (StringUtil.isEmpty(datasourceName))
      datasourceName = Caster.toString(getAdditional().get("DataSource", ""), "");

    CatchBlock sct = super.getCatchBlock(config);
    sct.setEL("NativeErrorCode", new Double(errorcode));
    sct.setEL("DataSource", datasourceName);
    sct.setEL("SQLState", sqlstate);
    sct.setEL("Sql", strSQL);
    sct.setEL("queryError", strSQL);
    sct.setEL("where", "");
    return sct;
  }
  @Override
  public int compare(ModelObject arg0, ModelObject arg1) {
    CatchBlock m = (CatchBlock) arg0;
    CatchBlock e = (CatchBlock) arg1;

    if (m.size() != e.size()) {
      return (1);
    }

    if (m.getParticipants().size() != e.getParticipants().size()) {
      return (1);
    }

    TypeReferenceComparator trefcomp =
        (TypeReferenceComparator) ComparatorUtil.getComparator(TypeReference.class);

    if (trefcomp.compare(m.getType(), e.getType()) != 0) {
      return (1);
    }

    return (0);
  }