All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.microsoft.sqlserver.jdbc.dataclassification.SensitivityClassification Maven / Gradle / Ivy

There is a newer version: 12.7.0.jre11-preview
Show newest version
/*
 * Microsoft JDBC Driver for SQL Server Copyright(c) Microsoft Corporation All rights reserved. This program is made
 * available under the terms of the MIT License. See the LICENSE file in the project root for more information.
 */

package com.microsoft.sqlserver.jdbc.dataclassification;

import java.util.ArrayList;
import java.util.List;

import com.microsoft.sqlserver.jdbc.SQLServerException;


/**
 * Provides the functionality to retrieve Sensitivity Classification data as received from SQL Server for the active
 * resultSet
 */
public class SensitivityClassification {

    /**
     * Sensitivity Rank
     * 
     * https://docs.microsoft.com/sql/relational-databases/system-catalog-views/sys-sensitivity-classifications-transact-sql
     *
     */
    public enum SensitivityRank {
        /**
         * rank not defined
         */
        NOT_DEFINED(-1),
        
        /**
         * rank NONE
         */
        NONE(0),
        
        /**
         * rank LOW
         */
        LOW(10),
        
        /**
         * rank MEDIUM
         */
        MEDIUM(20),
        
        /**
         * rank HIGH
         */
        HIGH(30),
        
        /**
         * rank CRITICAL
         */
        CRITICAL(40);

        private static final SensitivityRank[] VALUES = values();
        private int rank;

        private SensitivityRank(int rank) {
            this.rank = rank;
        }

        /**
         * Get rank value
         * 
         * @return rank
         */
        public int getValue() {
            return rank;
        }

        /**
         * Check if sensitivity rank value is valid
         * 
         * @param rank
         *        rank
         * 
         * @return if sensitivity rank value is valid
         * @throws SQLServerException
         *         if error
         */
        public static boolean isValid(int rank) throws SQLServerException {
            for (SensitivityRank r : VALUES) {
                if (r.getValue() == rank) {
                    return true;
                }
            }
            return false;
        }
    }

    private List




© 2015 - 2024 Weber Informatics LLC | Privacy Policy