private Person checkUser() {
   Person person = AccessControl.getPerson();
   Unit ciistUnit =
       Unit.readByCostCenterCode(
           FenixConfigurationManager.getConfiguration().getCIISTCostCenterCode());
   Unit currentWorkingPlace = person.getEmployee().getCurrentWorkingPlace();
   if ((currentWorkingPlace != null && ciistUnit != null && !currentWorkingPlace.equals(ciistUnit))
       || person.getPersonRole(RoleType.MANAGER) == null) {
     throw new DomainException("What you want do do hein?!?!");
   }
   return person;
 }
  private void patchLinks(Document doc, HttpServletRequest request) {
    // build basePath
    String appContext = FenixConfigurationManager.getConfiguration().appContext();

    // patch css link nodes
    NodeList linkNodes = doc.getElementsByTagName("link");
    for (int i = 0; i < linkNodes.getLength(); i++) {
      Element link = (Element) linkNodes.item(i);
      String href = link.getAttribute("href");

      if (appContext != null && appContext.length() > 0 && href.contains(appContext)) {
        href = href.substring(appContext.length() + 1);
      }

      try {
        String realPath = servletContext.getResource(href).toString();
        link.setAttribute("href", realPath);
      } catch (MalformedURLException e) {
        logger.error(e.getMessage(), e);
      }
    }

    // patch image nodes
    NodeList imageNodes = doc.getElementsByTagName("img");
    for (int i = 0; i < imageNodes.getLength(); i++) {
      Element img = (Element) imageNodes.item(i);
      String src = img.getAttribute("src");

      if (appContext != null && appContext.length() > 0 && src.contains(appContext)) {
        src = src.substring(appContext.length() + 1);
      }

      try {
        String realPath = servletContext.getResource(src).toString();
        img.setAttribute("src", realPath);
      } catch (MalformedURLException e) {
        logger.error(e.getMessage(), e);
      }
    }
  }
Пример #3
0
 static {
   storedUsername =
       FenixConfigurationManager.getConfiguration().getWebServicesLibraryManagementUsername();
   storedPassword =
       FenixConfigurationManager.getConfiguration().getWebServicesLibraryManagementPassword();
 }