예제 #1
0
 @Override
 public void printReferencesById(List<Long> referenceIds) {
   for (Long referenceId : referenceIds) {
     Reference reference = referenceDAO.findById(referenceId);
     reference.setState(Reference.ReferenceState.PROCESSED);
     referenceDAO.update(reference);
   }
 }
예제 #2
0
 @Override
 public void readyReferencesById(List<Long> referenceIds) {
   for (Long referenceId : referenceIds) {
     Reference reference = referenceDAO.findById(referenceId);
     reference.setState(Reference.ReferenceState.READY);
     referenceDAO.update(reference);
   }
 }
예제 #3
0
 @Override
 public Reference makeReference(Reference.ReferenceType type, Long ownerId) {
   Reference reference = new Reference();
   reference.setType(type);
   reference.setOwnerId(ownerId);
   reference.setPurpose("по месту требования");
   return reference;
 }
예제 #4
0
 @Override
 public void issueReferencesById(List<Long> referenceIds) {
   for (Long referenceId : referenceIds) {
     Reference reference = referenceDAO.findById(referenceId);
     reference.setIssuedDate(new Date());
     reference.setState(Reference.ReferenceState.ISSUED);
     referenceDAO.update(reference);
   }
 }
예제 #5
0
 @Override
 public void generatePrintForm(Reference reference, OutputStream outputStream) {
   ReportXml reportXml = new ReportXml();
   if (reference.getPrintTemplate() == null
       || reference.getPrintTemplate().getFileName() == null) {
     setDefaultPrintTemplate(reference);
   }
   reportXml.setTemplateFileName(reference.getPrintTemplate().getFileName());
   build(reportXml, studentDAO.findById(reference.getOwnerId()), reference.getPurpose());
   ReportPdfProcessor.getInstance().generate(reportXml, outputStream);
 }
예제 #6
0
  @Override
  public void setDefaultPrintTemplate(Reference reference) {
    String documentName;

    switch (reference.getType()) {
      case REFERENCE_1:
        documentName = "reference-1.xml";
        break;
      case REFERENCE_2:
        documentName = "reference-2.xml";
        break;
      case REFERENCE_3:
        documentName = "reference-3.xml";
        break;
      default:
        throw new RuntimeException(
            "Unknown template file name for reference type " + reference.getType() + ".");
    }
    String templName =
        ReferenceServiceImpl.class.getResource("/templates/" + documentName).getFile();
    templName = templName.replace("%20", " ");
    reference.setPrintTemplate(new Template(templName));
  }
예제 #7
0
  @Override
  public void generatePrintForm(List<Reference> references, OutputStream outputStream) {
    List<Report> reports = new ArrayList<Report>();

    for (Reference reference : references) {
      ReportXml reportXml = new ReportXml();
      if (reference.getPrintTemplate() == null
          || reference.getPrintTemplate().getFileName() == null) {
        setDefaultPrintTemplate(reference);
      }
      reportXml.setTemplateFileName(reference.getPrintTemplate().getFileName());
      build(reportXml, studentDAO.findById(reference.getOwnerId()), reference.getPurpose());
      reports.add(reportXml);
    }
    ReportPdfProcessor.getInstance().generate(reports, outputStream);
  }
예제 #8
0
 @Override
 public void registrationReference(Reference reference) {
   reference.setRegisteredDate(new Date());
   reference.setState(Reference.ReferenceState.REGISTERED);
   referenceDAO.saveOrUpdate(reference);
 }