/* * Created on 29/Nov/2003 * */ package net.sourceforge.fenixedu.applicationTier.Servico.manager; import net.sourceforge.fenixedu.applicationTier.FenixService; import net.sourceforge.fenixedu.applicationTier.Servico.exceptions.FenixServiceException; import net.sourceforge.fenixedu.applicationTier.Servico.exceptions.InvalidArgumentsServiceException; import net.sourceforge.fenixedu.domain.ExecutionCourse; import com.linkare.commons.metainfo.Linkare; /** * @author Joćo Mota 29/Nov/2003 * */ @Linkare(author = "Paulo Zenida", comments = "Delegated the implementation in the ExecutionCourse class.") public class MergeExecutionCourses extends FenixService { public class SourceAndDestinationAreTheSameException extends FenixServiceException { private static final long serialVersionUID = 3761968254943244338L; } public class DuplicateShiftNameException extends FenixServiceException { private static final long serialVersionUID = 3761968254943244338L; } public void run(Integer executionCourseDestinationId, Integer executionCourseSourceId) throws FenixServiceException { if (executionCourseDestinationId.equals(executionCourseSourceId)) { throw new SourceAndDestinationAreTheSameException(); } final ExecutionCourse executionCourseFrom = rootDomainObject.readExecutionCourseByOID(executionCourseSourceId); if (executionCourseFrom == null) { throw new InvalidArgumentsServiceException(); } final ExecutionCourse executionCourseTo = rootDomainObject.readExecutionCourseByOID(executionCourseDestinationId); if (executionCourseTo == null) { throw new InvalidArgumentsServiceException(); } executionCourseFrom.merge(executionCourseTo); } }