package net.sourceforge.fenixedu.domain.accessControl; import java.util.Set; import net.sourceforge.fenixedu.domain.Person; import net.sourceforge.fenixedu.domain.accessControl.groups.language.Argument; import net.sourceforge.fenixedu.domain.accessControl.groups.language.GroupBuilder; import net.sourceforge.fenixedu.domain.accessControl.groups.language.exceptions.GroupDynamicExpressionException; import net.sourceforge.fenixedu.domain.accessControl.groups.language.operators.IdOperator; import net.sourceforge.fenixedu.domain.organizationalStructure.Unit; public class UnitMembersGroup extends DomainBackedGroup { public UnitMembersGroup(Unit unit) { super(unit); } /** * */ private static final long serialVersionUID = 1L; @Override public Set getElements() { return (Set) getObject().getPossibleGroupMembers(); } @Override protected Argument[] getExpressionArguments() { return new Argument[] { new IdOperator(getObject()) }; } public static class Builder implements GroupBuilder { public Group build(Object[] arguments) { try { return new UnitMembersGroup((Unit) arguments[0]); } catch (ClassCastException e) { throw new GroupDynamicExpressionException("accessControl.group.builder.unitMembers.notUnit", arguments[0] .toString()); } } public int getMinArguments() { return 1; } public int getMaxArguments() { return 1; } } }