コード例 #1
0
  public static void createDatabasePrivilegeSet(
      DatabasePrivilegeSet dto, UserDatabasePrivilege entity) {
    if (dto == null || entity == null) {
      return;
    }

    dto.setAlterPriv(entity.getAlterPriv());
    dto.setCreatePriv(entity.getCreatePriv());
    dto.setDeletePriv(entity.getDeletePriv());
    dto.setDropPriv(entity.getDropPriv());
    dto.setIndexPriv(entity.getIndexPriv());
    dto.setInsertPriv(entity.getInsertPriv());
    dto.setSelectPriv(entity.getSelectPriv());
    dto.setUpdatePriv(entity.getUpdatePriv());

    if (dto instanceof MySQLPrivilegeSet) {
      MySQLPrivilegeSet mysqlDTO = (MySQLPrivilegeSet) dto;
      mysqlDTO.setAlterRoutinePriv(entity.getAlterRoutinePriv());
      mysqlDTO.setCreateRoutinePriv(entity.getCreateRoutinePriv());
      mysqlDTO.setCreateTmpTablePriv(entity.getCreateTmpTablePriv());
      mysqlDTO.setCreateViewPriv(entity.getCreateViewPriv());
      mysqlDTO.setEventPriv(entity.getEventPriv());
      mysqlDTO.setExecutePriv(entity.getExecutePriv());
      mysqlDTO.setGrantPriv(entity.getGrantPriv());
      mysqlDTO.setLockTablesPriv(entity.getLockTablesPriv());
      mysqlDTO.setReferencesPriv(entity.getReferencesPriv());
      mysqlDTO.setAlterRoutinePriv(entity.getAlterRoutinePriv());
      mysqlDTO.setShowViewPriv(entity.getShowViewPriv());
      mysqlDTO.setTriggerPriv(entity.getTriggerPriv());
    }
  }
コード例 #2
0
  public static void createDatabasePrivilegeSet(
      DatabasePrivilegeSetInfo info, DatabasePrivilegeSet entity) {
    if (info == null || entity == null) {
      return;
    }
    entity.setAlterPriv(info.getAlterPriv());
    entity.setCreatePriv(info.getCreatePriv());
    entity.setDeletePriv(info.getDeletePriv());
    entity.setDropPriv(info.getDropPriv());
    entity.setIndexPriv(info.getIndexPriv());
    entity.setInsertPriv(info.getInsertPriv());
    entity.setSelectPriv(info.getSelectPriv());
    entity.setUpdatePriv(info.getUpdatePriv());

    if (info instanceof MySQLPrivilegeSetInfo && entity instanceof MySQLPrivilegeSet) {
      MySQLPrivilegeSetInfo mysqlInfo = (MySQLPrivilegeSetInfo) info;
      MySQLPrivilegeSet mysqlEntity = (MySQLPrivilegeSet) entity;

      mysqlEntity.setCreateRoutinePriv(mysqlInfo.getCreateRoutinePriv());
      mysqlEntity.setCreateTmpTablePriv(mysqlInfo.getCreateTmpTablePriv());
      mysqlEntity.setCreateViewPriv(mysqlInfo.getCreateViewPriv());
      mysqlEntity.setEventPriv(mysqlInfo.getEventPriv());
      mysqlEntity.setExecutePriv(mysqlInfo.getExecutePriv());
      mysqlEntity.setGrantPriv(mysqlInfo.getGrantPriv());
      mysqlEntity.setLockTablesPriv(mysqlInfo.getLockTablesPriv());
      mysqlEntity.setReferencesPriv(mysqlInfo.getReferencesPriv());
      mysqlEntity.setAlterRoutinePriv(mysqlInfo.getAlterRoutinePriv());
      mysqlEntity.setShowViewPriv(mysqlInfo.getShowViewPriv());
      mysqlEntity.setTriggerPriv(mysqlInfo.getTriggerPriv());
    }
  }