コード例 #1
0
ファイル: JsonType.java プロジェクト: NeroBurner/JECommons
  public JsonType(JEVisType jtype) {
    try {
      name = jtype.getName();
      primitiveType = jtype.getPrimitiveType();
      GUIDisplayType = jtype.getGUIDisplayType();
      description = jtype.getDescription();
      GUIPosition = jtype.getGUIPosition();

    } catch (JEVisException ex) {
      Logger.getLogger(JsonType.class.getName()).log(Level.SEVERE, null, ex);
    }
  }
コード例 #2
0
ファイル: ClassTable.java プロジェクト: EnvidatecJM/JEAPI-SQL
  public boolean delete(JEVisClass jclass) throws JEVisException {
    String sql = "delete from " + TABLE + " where " + COLUMN_NAME + "=?";
    PreparedStatement ps = null;
    ResultSet rs = null;
    _ds.addQuery("ClassTable.delete");

    try {
      for (JEVisType type : jclass.getTypes()) {
        if (jclass.getInheritance() != null) {
          if (jclass.getInheritance().getType(type.getName()) == null) {
            _ds.getTypeTable().detele(type);
          }
        } else {
          _ds.getTypeTable().detele(type);
        }
      }

      for (JEVisClassRelationship rel : jclass.getRelationships()) {
        _ds.getClassRelationshipTable().delete(rel);
      }

      ps = _connection.prepareStatement(sql);
      ps.setString(1, jclass.getName());

      System.out.println("delete.class: " + ps.toString());
      int count = ps.executeUpdate();

      if (count == 1) {
        SimpleClassCache.getInstance().remove(jclass.getName());

        return true;
      } else {
        return false;
      }

    } catch (Exception ex) {
      throw new JEVisException("Error while deleting Class: " + ex, 2342763);
    } finally {
      if (ps != null) {
        try {
          ps.close();
        } catch (SQLException ex) {
          logger.warn("cound not close Prepared statement: {}", ex);
        }
      }
    }
  }