/*
 * Copyright 2016 EPAM Systems
 * 
 * 
 * This file is part of EPAM Report Portal.
 * https://github.com/reportportal/commons-dao
 * 
 * Report Portal is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * Report Portal is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with Report Portal.  If not, see <http://www.gnu.org/licenses/>.
 */ 

package com.epam.ta.reportportal.database.entity;

import java.util.Arrays;
import java.util.Optional;

/**
 * Project Role Representation
 * 
 * @author Andrei Varabyeu
 * 
 */
public enum ProjectRole implements Comparable<ProjectRole> {

	CUSTOMER(0), MEMBER(1), PROJECT_MANAGER(2);

	private int roleLevel;

	ProjectRole(int level) {
		this.roleLevel = level;
	}

	boolean higherThan(ProjectRole other) {
		return this.roleLevel > other.roleLevel;
	}

	boolean sameOrHigherThan(ProjectRole other) {
		return this.roleLevel >= other.roleLevel;
	}

	public static Optional<ProjectRole> forName(final String name) {
		return Arrays.stream(ProjectRole.values()).filter(role -> role.name()
				.equalsIgnoreCase(name)).findAny();
	}

}
@@ -1028,16 +1028,29 @@
 le%3E %7B%0A%0A%09
+OPERATOR(0), 
 CUSTOMER
@@ -1050,17 +1050,17 @@
 USTOMER(
-0
+1
 ), MEMBE
@@ -1061,17 +1061,17 @@
  MEMBER(
-1
+2
 ), PROJE
@@ -1081,17 +1081,17 @@
 MANAGER(
-2
+3
 );%0A%0A%09pri

introduce new role