IProposal proposalAttributedToGroup = persistentFinalWork.readFinalDegreeWorkAttributedToGroupByTeacher(group.getIdInternal()); if (proposalAttributedToGroup != null && !proposalAttributedToGroup.getIdInternal().equals(proposal.getIdInternal())) { throw new GroupAlreadyAttributed(proposalAttributedToGroup.getProposalNumber().toString()); }
	public Boolean run(Integer selectedGroupProposalOID) throws FenixServiceException	{		try		{			ISuportePersistente persistentSupport = SuportePersistenteOJB.getInstance();			IPersistentFinalDegreeWork persistentFinalWork = persistentSupport					.getIPersistentFinalDegreeWork();			IGroupProposal groupProposal = (IGroupProposal) persistentFinalWork.readByOID(GroupProposal.class, selectedGroupProposalOID);			if (groupProposal != null)			{			    IProposal proposal = groupProposal.getFinalDegreeWorkProposal();			    IGroup group = groupProposal.getFinalDegreeDegreeWorkGroup();			    if (proposal != null && group != null)			    {			        persistentFinalWork.simpleLockWrite(proposal);			        if (proposal.getGroupAttributedByTeacher() == null || !proposal.getGroupAttributedByTeacher().equals(group))			        {			            proposal.setGroupAttributedByTeacher(group);			            for (int i = 0; i < group.getGroupProposals().size(); i++)			            {			                IGroupProposal otherGroupProposal = (IGroupProposal) group.getGroupProposals().get(i);			                IProposal otherProposal = otherGroupProposal.getFinalDegreeWorkProposal();			                if (!otherProposal.getIdInternal().equals(proposal.getIdInternal())			                        && group.equals(otherProposal.getGroupAttributedByTeacher()))			                {			                    persistentFinalWork.simpleLockWrite(otherProposal);			                    otherProposal.setGroupAttributedByTeacher(null);			                }			            }			        }			        else			        {			            proposal.setGroupAttributedByTeacher(null);			        }			    }			}			return new Boolean(true);		}		catch (ExcepcaoPersistencia e)		{			throw new FenixServiceException(e);		}	}