/* * Created on 2004/04/15 * */ package net.sourceforge.fenixedu.dataTransferObject.finalDegreeWork; import java.util.ArrayList; import java.util.List; import net.sourceforge.fenixedu.dataTransferObject.InfoExecutionDegree; import net.sourceforge.fenixedu.dataTransferObject.InfoObject; import net.sourceforge.fenixedu.domain.DomainReference; import net.sourceforge.fenixedu.domain.finalDegreeWork.FinalDegreeWorkGroup; import net.sourceforge.fenixedu.domain.finalDegreeWork.GroupProposal; import net.sourceforge.fenixedu.domain.finalDegreeWork.GroupStudent; /** * @author Luis Cruz * */ public class InfoGroup extends InfoObject { private DomainReference groupDomainReference; public InfoGroup(final FinalDegreeWorkGroup group) { groupDomainReference = new DomainReference(group); } public static InfoGroup newInfoFromDomain(final FinalDegreeWorkGroup group) { return group == null ? null : new InfoGroup(group); } public FinalDegreeWorkGroup getGroup() { return groupDomainReference == null ? null : groupDomainReference.getObject(); } public boolean equals(Object obj) { return obj instanceof InfoGroup && getGroup() == ((InfoGroup) obj).getGroup(); } public int hashCode() { return getGroup().hashCode(); } @Override public Integer getIdInternal() { return getGroup().getIdInternal(); } @Override public void setIdInternal(Integer integer) { throw new Error("Method should not be called!"); } public String toString() { return getGroup().toString(); } /** * @return Returns the executionDegree. */ public InfoExecutionDegree getExecutionDegree() { return InfoExecutionDegree.newInfoFromDomain(getGroup().getExecutionDegree()); } /** * @return Returns the groupProposals. */ public List getGroupProposals() { List result = new ArrayList(); for (final GroupProposal groupProposal : getGroup().getGroupProposals()) { result.add(InfoGroupProposal.newInfoFromDomain(groupProposal)); } return result; } /** * @return Returns the groupStudents. */ public List getGroupStudents() { List result = new ArrayList(); for (final GroupStudent groupStudent : getGroup().getGroupStudents()) { result.add(InfoGroupStudent.newInfoFromDomain(groupStudent)); } return result; } }