Package com.dotcms.repackage.org.directwebremoting

Examples of com.dotcms.repackage.org.directwebremoting.WebContext


    result.put("size",containersList.size());   
    return result;
  }
 
  public void setSelectedStructure(String StructureVelocityVarName){
    WebContext ctx = WebContextFactory.get();
    HttpServletRequest request = ctx.getHttpServletRequest();
   
    if(StructureCache.getStructureByVelocityVarName(StructureVelocityVarName) != null){
      request.getSession().setAttribute("selectedStructure", StructureCache.getStructureByVelocityVarName(StructureVelocityVarName).getInode())
    }
  }
View Full Code Here


  }

  public Map<String, Object> getWorkingTextFile(String fileInode) throws DotDataException, DotSecurityException,
      PortalException, SystemException, IOException {

    WebContext ctx = WebContextFactory.get();
    HttpServletRequest req = ctx.getHttpServletRequest();
    User user = userAPI.getLoggedInUser(req);
    boolean respectFrontendRoles = userAPI.isLoggedToFrontend(req);

    File file = fileAPI.get(fileInode, user, respectFrontendRoles);
    Map<String, Object> map = file.getMap();
View Full Code Here

  }

  public void saveFileText(String fileIdentifier, String newText) throws PortalException, SystemException,
      DotDataException, DotSecurityException, IOException {
    WebContext ctx = WebContextFactory.get();
    HttpServletRequest req = ctx.getHttpServletRequest();
    User user = userAPI.getLoggedInUser(req);
    Host host = WebAPILocator.getHostWebAPI().getCurrentHost(req);
    boolean respectFrontendRoles = userAPI.isLoggedToFrontend(req);
    File file = fileAPI.getWorkingFileById(fileIdentifier, user, respectFrontendRoles);
    java.io.File fileData = new java.io.File(APILocator.getFileAPI().getAssetIOFile(file).getPath()+"_text");
View Full Code Here

        fos.close();
    }
  }

  public Map<String, Object> getFileUploadStatus(String fieldName) {
    WebContext ctx = WebContextFactory.get();
    AjaxFileUploadListener.FileUploadStats fileUploadStats =
      (AjaxFileUploadListener.FileUploadStats) ctx.getSession().getAttribute("FILE_UPLOAD_STATS_" + fieldName);
    Map<String, Object> result = new HashMap<String, Object>();
    if (fileUploadStats != null) {
      if(fileUploadStats.getCurrentStatus().equalsIgnoreCase("error")){
        result.put("error", "Sorry! We Could not process this uploaded file.");
        return result;
      }
      long bytesProcessed = fileUploadStats.getBytesRead();
      long sizeTotal = fileUploadStats.getTotalSize();
      long percentComplete = (long) Math
          .floor(((double) bytesProcessed / (double) sizeTotal) * 100.0);
      long timeInSeconds = fileUploadStats.getElapsedTimeInSeconds();
      double uploadRate = bytesProcessed / (timeInSeconds + 0.00001);
      double estimatedRuntime = sizeTotal / (uploadRate + 0.00001);
     
      result.put("bytesProcessed", bytesProcessed);
      result.put("sizeTotal", sizeTotal);
      result.put("percentComplete", percentComplete);
      result.put("timeInSeconds", timeInSeconds);
      result.put("uploadRate", uploadRate);
      result.put("estimatedRuntime", estimatedRuntime);
      result.put("error", null);   
     
      // dotcms 3022
      ctx.getSession().setAttribute("SIZE_FILE_UPLOAD_STATS_" + fieldName, sizeTotal);
      return result;
    }
    return null;
  }
View Full Code Here

    }
    return null;
  }
 
  public long clearFileUploadStatus(String fieldName) {
    WebContext ctx = WebContextFactory.get();
    long size = ((AjaxFileUploadListener.FileUploadStats)ctx.getSession().getAttribute("FILE_UPLOAD_STATS_" + fieldName)).getTotalSize();   
    ctx.getSession().removeAttribute("FILE_UPLOAD_STATS_" + fieldName);
    return size;
 
View Full Code Here

  public List<Map<String, String>> getLanguages() throws LanguageException, DotRuntimeException, PortalException, SystemException {
    List<Language> languages =  APILocator.getLanguageAPI().getLanguages();
    ArrayList<Map<String, String>> langList = new ArrayList<Map<String, String>> ();
    UserWebAPI uWebAPI = WebAPILocator.getUserWebAPI();
    WebContext ctx = WebContextFactory.get();
    HttpServletRequest request = ctx.getHttpServletRequest();

    for (Language language : languages) {
      Map<String, String> map = new HashMap<String, String>();
      map.put("title", LanguageUtil.get(uWebAPI.getLoggedInUser(request), "Language") );
      map.put("languageCode", language.getLanguageCode());
View Full Code Here

  @Override
  public void executeAction(WorkflowProcessor processor, Map<String, WorkflowActionClassParameter> params) throws WorkflowActionFailureException {
      if(LicenseUtil.getLevel()<200)
            return; // the apis will do nothing anyway
     
        WebContext ctx = WebContextFactory.get();
        HttpServletRequest request = ctx.getHttpServletRequest();
      User user=null;
        try {
            user = uWebAPI.getLoggedInUser(request);
        } catch (Exception exx) {
            throw new WorkflowActionFailureException(exx.getMessage());
View Full Code Here

  protected HostAPI hostAPI = APILocator.getHostAPI();

  public String saveHostVariable(String id, String hostId, String name, String key, String value) throws DotRuntimeException, PortalException,
    SystemException, DotDataException, DotSecurityException {

    WebContext ctx = WebContextFactory.get();
    HttpServletRequest req = ctx.getHttpServletRequest();
    UserWebAPI userWebAPI = WebAPILocator.getUserWebAPI();
    User user = userWebAPI.getLoggedInUser(req);
    boolean respectFrontendRoles = userWebAPI.isLoggedToFrontend(req);
   
    key = key.trim();
View Full Code Here

  }

  public void deleteHostVariable(String hvarId) throws DotDataException, DotSecurityException, DotRuntimeException, PortalException, SystemException {

    WebContext ctx = WebContextFactory.get();
    HttpServletRequest req = ctx.getHttpServletRequest();
    UserWebAPI userWebAPI = WebAPILocator.getUserWebAPI();
    User user = userWebAPI.getLoggedInUser(req);
    boolean respectFrontendRoles = userWebAPI.isLoggedToFrontend(req);

    HostVariableAPI hostVariableAPI = APILocator.getHostVariableAPI();
View Full Code Here

  }

  public List<Map<String, Object>> getHostVariables(String hostId) throws Exception {
   
    WebContext ctx = WebContextFactory.get();
    HttpServletRequest req = ctx.getHttpServletRequest();
    UserWebAPI userWebAPI = WebAPILocator.getUserWebAPI();
    User user = userWebAPI.getLoggedInUser(req);
    boolean respectFrontendRoles = userWebAPI.isLoggedToFrontend(req);
    HostVariableAPI hostVariableAPI = APILocator.getHostVariableAPI();
   
View Full Code Here

TOP

Related Classes of com.dotcms.repackage.org.directwebremoting.WebContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.