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

com.liferay.portal.kernel.security.membershippolicy.MembershipPolicyException Maven / Gradle / Ivy

There is a newer version: 7.4.3.112-ga112
Show newest version
/**
 * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library 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 Lesser General Public License for more
 * details.
 */

package com.liferay.portal.kernel.security.membershippolicy;

import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.model.Group;
import com.liferay.portal.kernel.model.Organization;
import com.liferay.portal.kernel.model.Role;
import com.liferay.portal.kernel.model.User;
import com.liferay.portal.kernel.model.UserGroup;

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

/**
 * @author Brian Wing Shun Chan
 */
public class MembershipPolicyException extends PortalException {

	public static final int ORGANIZATION_MEMBERSHIP_NOT_ALLOWED = 1;

	public static final int ORGANIZATION_MEMBERSHIP_REQUIRED = 2;

	public static final int ROLE_MEMBERSHIP_NOT_ALLOWED = 3;

	public static final int ROLE_MEMBERSHIP_REQUIRED = 4;

	public static final int SITE_MEMBERSHIP_NOT_ALLOWED = 5;

	public static final int SITE_MEMBERSHIP_REQUIRED = 6;

	public static final int USER_GROUP_MEMBERSHIP_NOT_ALLOWED = 7;

	public static final int USER_GROUP_MEMBERSHIP_REQUIRED = 8;

	public MembershipPolicyException(int type) {
		_type = type;
	}

	public void addGroup(Group group) {
		_groups.add(group);
	}

	public void addOrganization(Organization organization) {
		_organizations.add(organization);
	}

	public void addRole(Role role) {
		_roles.add(role);
	}

	public void addUser(User user) {
		_users.add(user);
	}

	public void addUserGroup(UserGroup userGroup) {
		_userGroups.add(userGroup);
	}

	public List getGroups() {
		return _groups;
	}

	public List getOrganizations() {
		return _organizations;
	}

	public List getRoles() {
		return _roles;
	}

	public int getType() {
		return _type;
	}

	public List getUserGroups() {
		return _userGroups;
	}

	public List getUsers() {
		return _users;
	}

	private final List _groups = new ArrayList<>();
	private final List _organizations = new ArrayList<>();
	private final List _roles = new ArrayList<>();
	private final int _type;
	private final List _userGroups = new ArrayList<>();
	private final List _users = new ArrayList<>();

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy