/** {@inheritDoc} */ @Override public synchronized int insert(Field field, Plugin plugin) { field.setIdField(newPrimaryKey(plugin)); field.setPosition(newPosition(plugin)); DAOUtil daoUtil = new DAOUtil(SQL_QUERY_INSERT, plugin); daoUtil.setInt(1, field.getIdField()); daoUtil.setInt(2, field.getEntry().getIdEntry()); daoUtil.setString(3, field.getTitle()); daoUtil.setString(4, field.getValue()); daoUtil.setInt(5, field.getHeight()); daoUtil.setInt(6, field.getWidth()); daoUtil.setBoolean(7, field.isDefaultValue()); daoUtil.setInt(8, field.getMaxSizeEnter()); daoUtil.setInt(9, field.getPosition()); daoUtil.setDate( 10, (field.getValueTypeDate() == null) ? null : new Date(field.getValueTypeDate().getTime())); daoUtil.setString(11, field.getRoleKey()); daoUtil.setString(12, field.getWorkgroup()); daoUtil.setBoolean(13, field.isShownInResultList()); daoUtil.setBoolean(14, field.isShownInResultRecord()); daoUtil.executeUpdate(); daoUtil.free(); return field.getIdField(); }
/** {@inheritDoc} */ @Override public void store(Field field, Plugin plugin) { DAOUtil daoUtil = new DAOUtil(SQL_QUERY_UPDATE, plugin); daoUtil.setInt(1, field.getIdField()); daoUtil.setInt(2, field.getEntry().getIdEntry()); daoUtil.setString(3, field.getTitle()); daoUtil.setString(4, field.getValue()); daoUtil.setInt(5, field.getHeight()); daoUtil.setInt(6, field.getWidth()); daoUtil.setBoolean(7, field.isDefaultValue()); daoUtil.setInt(8, field.getMaxSizeEnter()); daoUtil.setInt(9, field.getPosition()); daoUtil.setDate( 10, (field.getValueTypeDate() == null) ? null : new Date(field.getValueTypeDate().getTime())); daoUtil.setString(11, field.getRoleKey()); daoUtil.setString(12, field.getWorkgroup()); daoUtil.setBoolean(13, field.isShownInResultList()); daoUtil.setBoolean(14, field.isShownInResultRecord()); daoUtil.setInt(15, field.getIdField()); daoUtil.executeUpdate(); daoUtil.free(); }