/* * NobodyGroup.java * * Copyright (c) 2013, Instituto Superior Técnico. All rights reserved. * * This file is part of bennu-core. * * bennu-core 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. * * bennu-core 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 bennu-core. If not, see * <http://www.gnu.org/licenses/>. */ package org.fenixedu.bennu.core.groups; import java.util.stream.Stream; import org.fenixedu.bennu.core.annotation.GroupOperator; import org.fenixedu.bennu.core.domain.User; import org.fenixedu.bennu.core.i18n.BundleUtil; import org.joda.time.DateTime; /** * Group that always returns false. * * @author Pedro Santos (pedro.miguel.santos@tecnico.ulisboa.pt) * @see Group */ @GroupOperator("nobody") final class NobodyGroup extends GroupStrategy { private static final long serialVersionUID = -6691063224199800203L; NobodyGroup() { super(); } @Override public String getPresentationName() { return BundleUtil.getString("resources.BennuResources", "label.bennu.group.nobody"); } @Override public Stream<User> getMembers() { return Stream.empty(); } @Override public boolean isMember(final User user) { return false; } @Override public Stream<User> getMembers(DateTime when) { return getMembers(); } @Override public boolean isMember(User user, DateTime when) { return isMember(user); } @Override public Group and(Group group) { return this; } @Override public Group or(Group group) { return group; } @Override public Group minus(Group group) { return this; } @Override public Group not() { return Group.anyone(); } }