package net.sourceforge.fenixedu.domain.serviceRequests.documentRequests; import net.sourceforge.fenixedu.dataTransferObject.serviceRequests.AcademicServiceRequestBean; import net.sourceforge.fenixedu.domain.ExecutionYear; import net.sourceforge.fenixedu.domain.accounting.EventType; import net.sourceforge.fenixedu.domain.accounting.events.serviceRequests.PhotocopyRequestEvent; import net.sourceforge.fenixedu.domain.exceptions.DomainException; import net.sourceforge.fenixedu.domain.student.Registration; public class PhotocopyRequest extends PhotocopyRequest_Base { protected PhotocopyRequest() { super(); setNumberOfPages(0); } public PhotocopyRequest(final Registration registration, final ExecutionYear executionYear) { this(registration, executionYear, false, false); } public PhotocopyRequest(final Registration registration, final ExecutionYear executionYear, final Boolean urgentRequest, final Boolean freeProcessed) { this(); super.init(registration, executionYear, urgentRequest, freeProcessed); } @Override public EventType getEventType() { return EventType.PHOTOCOPY_REQUEST; } @Override public DocumentRequestType getDocumentRequestType() { return DocumentRequestType.PHOTOCOPY; } @Override public String getDocumentTemplateKey() { // this request does not need a document template key, because no document will be printed return null; } @Override protected void internalChangeState(AcademicServiceRequestBean academicServiceRequestBean) { if (academicServiceRequestBean.isToCancelOrReject() && hasEvent()) { getEvent().cancel(academicServiceRequestBean.getEmployee()); } else if (academicServiceRequestBean.isToConclude()) { if (!hasNumberOfPages()) { throw new DomainException("error.serviceRequests.documentRequests.numberOfPages.must.be.set"); } if (!isFree()) { new PhotocopyRequestEvent(getAdministrativeOffice(), getPerson(), this); } } else if (academicServiceRequestBean.isToDeliver()) { if (isPayable() && !isPayed()) { // ISCTE(ajsco, 2008-08-01) - Ignorar propinas até o // sistema estar devidamente integrado com a tesouraria. // throw new DomainException("AcademicServiceRequest.hasnt.been.payed"); ; // EMPTY instruction } } } @Override public boolean isPagedDocument() { return true; } @Override public boolean isToPrint() { return false; } }