/**
   * @param accessCode - строковой код доступа к документу
   * @param organID - номер-�?Д субьекта-органа оператора документа
   * @param docTypeID - номер-�?Д типа документа (опционально)
   * @param password - строка-пароль (опционально)
   */
  @RequestMapping(
      value = "/getDocumentAccessByHandler",
      method = RequestMethod.GET,
      headers = {"Accept=application/json"})
  public @ResponseBody Document getDocumentAccessByHandler(
      @RequestParam(value = "sCode_DocumentAccess") String accessCode,
      @RequestParam(value = "nID_DocumentOperator_SubjectOrgan") Long organID,
      @RequestParam(value = "nID_DocumentType", required = false) Long docTypeID,
      @RequestParam(value = "sPass", required = false) String password,
      HttpServletResponse resp) {

    Document document =
        handlerFactory
            .buildHandlerFor(documentDao.getOperator(organID))
            .setDocumentType(docTypeID)
            .setAccessCode(accessCode)
            .setPassword(password)
            .getDocument();
    try {
      createHistoryEvent(
          HistoryEventType.GET_DOCUMENT_ACCESS_BY_HANDLER,
          document.getSubject().getId(),
          subjectOrganDao.getSubjectOrgan(organID).getName(),
          null,
          document);
    } catch (Exception e) {
      log.warn("can`t create history event!", e);
    }
    return document;
  }
 @RequestMapping(
     value = "/setSubjectOrganJoin",
     method = RequestMethod.GET,
     headers = {"Accept=application/json"})
 public @ResponseBody void setSubjectOrganJoin(
     @RequestParam(value = "nID_SubjectOrgan") Long organID,
     @RequestParam(value = "sNameUa") String nameUA,
     @RequestParam(value = "sNameRu") String nameRU,
     @RequestParam(value = "sID_Privat") String privateID,
     @RequestParam(value = "sID_Public") String publicID,
     @RequestParam(value = "sGeoLongitude") String geoLongitude,
     @RequestParam(value = "sGeoLatitude") String geoLatitude,
     @RequestParam(value = "sID_UA") String uaID,
     @RequestParam(value = "nID_Region", required = false) Long regionID,
     @RequestParam(value = "nID_City", required = false) Long cityID) {
   SubjectOrganJoin soj = new SubjectOrganJoin();
   soj.setUaId(uaID);
   soj.setSubjectOrganId(organID);
   soj.setNameUa(nameUA);
   soj.setNameRu(nameRU);
   soj.setPrivatId(privateID);
   soj.setPublicId(publicID);
   soj.setGeoLongitude(geoLongitude);
   soj.setGeoLatitude(geoLatitude);
   soj.setRegionId(regionID);
   soj.setCityId(cityID);
   subjectOrganDao.add(soj);
 }
 private Subject syncSubject_Upload(String sID_Subject_Upload) {
   Subject subject_Upload = subjectDao.getSubject(sID_Subject_Upload);
   if (subject_Upload == null) {
     subject_Upload = subjectOrganDao.setSubjectOrgan(sID_Subject_Upload).getoSubject();
   }
   return subject_Upload;
 }
 @RequestMapping(
     value = "/removeSubjectOrganJoins",
     method = RequestMethod.GET,
     headers = {"Accept=application/json"})
 public @ResponseBody void removeSubjectOrganJoins(
     @RequestParam(value = "nID_SubjectOrgan") Long organID,
     @RequestParam(value = "asID_Public") String[] publicIDs) {
   subjectOrganDao.removeSubjectOrganJoin(organID, publicIDs);
 }
 @RequestMapping(
     value = "/getSubjectOrganJoins",
     method = RequestMethod.GET,
     headers = {"Accept=application/json"})
 public @ResponseBody List<SubjectOrganJoin> getAllSubjectOrganJoins(
     @RequestParam(value = "nID_SubjectOrgan") Long organID,
     @RequestParam(value = "nID_Region", required = false) Long regionID,
     @RequestParam(value = "nID_City", required = false) Long cityID,
     @RequestParam(value = "sID_UA", required = false) String uaID) {
   return subjectOrganDao.findSubjectOrganJoinsBy(organID, regionID, cityID, uaID);
 }