@Override
 @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
 public void updateDocument(Documents documents) {
   //        if(documentsDao.findDuplicateDocumentByDocumentName(documents.getDocumentName(),
   // documents.getDocumentId()).size() > 0){
   //            throw new DocumentAlreadyExistsException(documents.getDocumentName());
   //        }else{
   documentsDao.updateDocument(documents);
   //        }
 }
 @Override
 public String findNextControlNo(Integer clientId, String documentCode) {
   Integer nextControlNo = documentsDao.findNextControlNo(clientId, documentCode);
   String nextControlNoAsStr = nextControlNo.toString();
   int zerosToAdd = 5 - nextControlNoAsStr.length();
   if (zerosToAdd == 4) return documentCode + "-0000" + nextControlNoAsStr;
   else if (zerosToAdd == 3) return documentCode + "-000" + nextControlNoAsStr;
   else if (zerosToAdd == 2) return documentCode + "-00" + nextControlNoAsStr;
   else return documentCode + "-0" + nextControlNoAsStr;
 }
 @Override
 public List<Documents> findOrderDocumentation() {
   return documentsDao.findOrderDocumentations();
 }
 @Override
 public List<Documents> findDocumentsByOrderNumber(String orderNumber) {
   return documentsDao.findDocumentsByOrderNumber(orderNumber);
 }
 @Override
 public List<Orders> findAllOrdersDocumentationArchived() {
   return documentsDao.findAllOrdersDocumentsArchived();
 }
 @Override
 @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
 public void addDocuments(Documents documents) {
   documentsDao.addDocuments(documents);
 }
 @Override
 public Documents findDocumentByNameAndVendorCode(String documentName, String vendorCode) {
   return documentsDao.findDocumentByNameAndVendorCode(documentName, vendorCode);
 }
 @Override
 public List<Documents> findDocumentationByCriteria(String column, String value) {
   return documentsDao.findDocumentationByCriteria(column, value);
 }
 @Override
 public Documents findDocumentNameAndOrderId(String documentName, Integer referenceId) {
   return documentsDao.findDocumentNameAndOrderId(documentName, referenceId);
 }
 @Override
 public List<Documents> findDocumentsByAging(Integer aging) {
   return documentsDao.findDocumentsByAging(aging);
 }
 @Override
 public List<Documents> findAllContainerDocuments(Integer referenceId) {
   return documentsDao.findAllContainerDocuments(referenceId);
 }
 @Override
 public List<Documents> findAllFreightDocuments(Integer referenceId) {
   return documentsDao.findAllFreightDocuments(referenceId);
 }
 @Override
 public List<Documents> findDocumentNameAndId(String documentName, Integer referenceId) {
   return documentsDao.findDocumentNameAndId(documentName, referenceId);
 }
 @Override
 public Documents findManifestAndTableAndRefId(
     String documentName, String referenceTable, Integer referenceId) {
   return documentsDao.findManifestAndTableAndRefId(documentName, referenceTable, referenceId);
 }
 @Override
 public List<Documents> findDocumentNameVendorCodeOrderId(
     String documentName, String vendorCode, Integer referenceId) {
   return documentsDao.findDocumentNameVendorCodeOrderId(documentName, vendorCode, referenceId);
 }
 @Override
 public List<Documents> findOperationDocumentsByOrderId(Integer orderId) {
   return documentsDao.findOperationDocumentsByOrderId(orderId);
 }
 @Override
 public List<Documents> findDocumentByInboundStageAndID(
     Integer inboundStage, Integer referenceId) {
   return documentsDao.findDocumentByInboundStageAndID(inboundStage, referenceId);
 }
 @Override
 public Documents findDocumentById(Integer documentId) {
   return documentsDao.findDocumentById(documentId);
 }
 @Override
 public List<Documents> findDocumentByArchiveStageAndID(
     Integer archiveStage, Integer referenceId) {
   return documentsDao.findDocumentByArchiveStageAndID(archiveStage, referenceId);
 }
 @Override
 public Documents findEIRAndRefId(
     String documentName, Integer referenceId, String referenceTable) {
   return documentsDao.findEIRAndRefId(documentName, referenceId, referenceTable);
 }
 @Override
 public List<Documents> findDocumentByBillingStageAndID(
     Integer billingStage, Integer referenceId) {
   return documentsDao.findDocumentByBillingStageAndID(billingStage, referenceId);
 }
 @Override
 public List<Documents> findDocumentByFinalOutboundStageAndID(
     Integer finalOutboundStage, Integer referenceId) {
   return documentsDao.findDocumentByFinalOutboundStageAndID(finalOutboundStage, referenceId);
 }
 @Override
 public List<Documents> findDocumentByCompleteStageAndID(
     Integer completeStage, Integer referenceId) {
   return documentsDao.findDocumentByCompleteStageAndID(completeStage, referenceId);
 }