Examples of UserWebAPI


Examples of com.dotmarketing.business.web.UserWebAPI

  }
  public static Map<String,Object> importTags(byte[] uploadFile) {

    Map<String,Object> callbackData = new HashMap<String,Object>();
    try {
      UserWebAPI uWebAPI = WebAPILocator.getUserWebAPI();
      WebContext ctx = WebContextFactory.get();
      HttpServletRequest request = ctx.getHttpServletRequest();
      User user = uWebAPI.getLoggedInUser(request);

      String content = new String(uploadFile);
      StringReader sr = new StringReader(content);
      BufferedReader br = new BufferedReader(sr);
View Full Code Here

Examples of com.dotmarketing.business.web.UserWebAPI

    // get out of session
    language = (String) session.getAttribute(com.dotmarketing.util.WebKeys.HTMLPAGE_LANGUAGE);
    // Copied directly out of VelocityServlet -- END

    UserWebAPI uAPI = WebAPILocator.getUserWebAPI();

    user = null;
    try {
      user = uAPI.getLoggedInUser(req);
    } catch (DotRuntimeException e2) {
      Logger.debug(this, "DotRuntimeException: " + e2.getMessage(), e2);
    } catch (PortalException e2) {
      Logger.debug(this, "PortalException: " + e2.getMessage(), e2);
    } catch (SystemException e2) {
      Logger.debug(this, "SystemException: " + e2.getMessage(), e2);
    }

    if(user != null){
      Logger.debug(this, "The user is " + user.getUserId());
    }else{
      Logger.debug(this, "The user is null");
    }

    boolean working = false;
    boolean live = false;

    String VELOCITY_HTMLPAGE_EXTENSION = Config.getStringProperty("VELOCITY_HTMLPAGE_EXTENSION");

    String location = "live";
    if (working) {
      location = "working";
    }

    Logger.debug(this, "The location is " + location);

    boolean PREVIEW_MODE = ((session.getAttribute(com.dotmarketing.util.WebKeys.PREVIEW_MODE_SESSION) != null));
    boolean EDIT_MODE = ((session.getAttribute(com.dotmarketing.util.WebKeys.EDIT_MODE_SESSION) != null));

    if (PREVIEW_MODE || EDIT_MODE) {
      working = true;
      Logger.debug(this, "Working is true");
    } else {
      live = true;
      Logger.debug(this, "Live is true");
    }

    if (EDIT_MODE) {
      try {
        user = uAPI.getLoggedInUser(req);
      } catch (DotRuntimeException e) {
        Logger.debug(this, "DotRuntimeException: " + e.getMessage(), e);
      } catch (PortalException e) {
        Logger.debug(this, "PortalException: " + e.getMessage(), e);
      } catch (SystemException e) {
View Full Code Here

Examples of com.dotmarketing.business.web.UserWebAPI

      Logger.warn(this, "No exporter for path " + exporterPath + " is registered. Requested url = " + uri);
      resp.sendError(HttpServletResponse.SC_NOT_FOUND);
      return;
    }

    UserWebAPI userWebAPI = WebAPILocator.getUserWebAPI();
    ContentletAPI contentAPI = APILocator.getContentletAPI();
    BinaryContentExporter.BinaryContentExporterData data = null;
    File inputFile = null;
    HttpSession session = req.getSession(false);
    List<String> tempBinaryImageInodes = null;
        if ( session != null && session.getAttribute( Contentlet.TEMP_BINARY_IMAGE_INODES_LIST ) != null ) {
            tempBinaryImageInodes = (List<String>) session.getAttribute( Contentlet.TEMP_BINARY_IMAGE_INODES_LIST );
        } else {
            tempBinaryImageInodes = new ArrayList<String>();
        }

        boolean isTempBinaryImage = tempBinaryImageInodes.contains(assetInode);
    try {
      User user = userWebAPI.getLoggedInUser(req);
      boolean respectFrontendRoles = !userWebAPI.isLoggedToBackend(req);
      String downloadName = "file_asset";
      long lang = APILocator.getLanguageAPI().getDefaultLanguage().getId();
      try {
        String x = null;
        if (session != null) {
          x = (String) session.getAttribute(WebKeys.HTMLPAGE_LANGUAGE);
        } else {
          x = (String) req.getAttribute(WebKeys.HTMLPAGE_LANGUAGE);
        }
        lang = Long.parseLong(x);
      } catch(Exception e){
        // Number parsing exception
      }

      boolean isContent = false;
      try {
        isContent = isContent(uuid, byInode, lang, respectFrontendRoles);
      }catch (DotStateException e) {
        resp.sendError(404);
        return;
      }

      if (isContent){
        Contentlet content = null;
        if(byInode) {
          if(isTempBinaryImage)
            content = contentAPI.find(assetInode, APILocator.getUserAPI().getSystemUser(), respectFrontendRoles);
          else
            content = contentAPI.find(assetInode, user, respectFrontendRoles);
          assetIdentifier = content.getIdentifier();
        } else {
            boolean live=userWebAPI.isLoggedToFrontend(req);
            if (req.getSession(false) != null && req.getSession().getAttribute("tm_date")!=null) {
                live=true;
                Identifier ident=APILocator.getIdentifierAPI().find(assetIdentifier);
                if(UtilMethods.isSet(ident.getSysPublishDate()) || UtilMethods.isSet(ident.getSysExpireDate())) {
                    Date fdate=new Date(Long.parseLong((String)req.getSession().getAttribute("tm_date")));
View Full Code Here

Examples of com.dotmarketing.business.web.UserWebAPI

  public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    UtilMethods.removeBrowserCache(response);

    UserWebAPI uWebAPI = WebAPILocator.getUserWebAPI();
    User user = null;

    try {

      user = uWebAPI.getLoggedInUser(request);
      String inode = request.getParameter("inode");
      String action = request.getParameter("action");
      String q = request.getParameter("q");
      String permission = request.getParameter("permission");
      String reorder = request.getParameter("reorder");
View Full Code Here

Examples of com.dotmarketing.business.web.UserWebAPI

  private void exportCategories(HttpServletRequest request, HttpServletResponse response, String contextInode, String filter) throws ServletException, IOException {
    ServletOutputStream out = response.getOutputStream();
    response.setContentType("application/octet-stream");
    response.setHeader("Content-Disposition", "attachment; filename=\"categories_" + UtilMethods.dateToHTMLDate(new Date(),"M_d_yyyy") +".csv\"");

    UserWebAPI uWebAPI = WebAPILocator.getUserWebAPI();
    User user = null;

    try {
      user = uWebAPI.getLoggedInUser(request);
      CategoryAPI catAPI = APILocator.getCategoryAPI();
      List<Category> categories = UtilMethods.isSet(contextInode)?catAPI.findChildren(user, contextInode, false, filter):
        catAPI.findTopLevelCategories(user, false, filter);

      if(!categories.isEmpty()) {
View Full Code Here

Examples of com.dotmarketing.business.web.UserWebAPI

    }
  }


  private void loadPermission(String inode, HttpServletRequest request, HttpServletResponse response) throws Exception {
    UserWebAPI uWebAPI = WebAPILocator.getUserWebAPI();
    User user = uWebAPI.getLoggedInUser(request);
    CategoryAPI categoryAPI = APILocator.getCategoryAPI();
    Category cat = categoryAPI.find(inode, user, false);
    request.setAttribute(com.dotmarketing.util.WebKeys.PERMISSIONABLE_EDIT, cat);
    RequestDispatcher rd = request.getRequestDispatcher("/html/portlet/ext/common/edit_permissions_tab_ajax.jsp");
    rd.include(request, response);
View Full Code Here

Examples of com.dotmarketing.business.web.UserWebAPI

    return 0;
  }

  public Integer deleteCategories(String contextInode) throws Exception {
    UserWebAPI uWebAPI = WebAPILocator.getUserWebAPI();
    WebContext ctx = WebContextFactory.get();
    HttpServletRequest request = ctx.getHttpServletRequest();
    User user = uWebAPI.getLoggedInUser(request);
    Integer catsWithDependencies = 0;

    if(UtilMethods.isSet(contextInode)) {
      Category contextCat = categoryAPI.find(contextInode, user, false);
      List<Category> catsToDelete =  categoryAPI.getChildren(contextCat, user, false);
View Full Code Here

Examples of com.dotmarketing.business.web.UserWebAPI

    return 0;
  }

  public Integer deleteCategory(String inode) throws Exception {
    UserWebAPI uWebAPI = WebAPILocator.getUserWebAPI();
    WebContext ctx = WebContextFactory.get();
    HttpServletRequest request = ctx.getHttpServletRequest();
    User user = uWebAPI.getLoggedInUser(request);
    Category cat = categoryAPI.find(inode, user, false);

    try {
      if(!categoryAPI.hasDependencies(cat)){
        categoryAPI.delete(cat, user, false);
View Full Code Here

Examples of com.dotmarketing.business.web.UserWebAPI

  }

  private Integer saveOrUpdateCategory(Boolean save, String inode, String name, String var, String key, String keywords, String sort, boolean merge)
      throws Exception {

    UserWebAPI uWebAPI = WebAPILocator.getUserWebAPI();
    WebContext ctx = WebContextFactory.get();
    HttpServletRequest request = ctx.getHttpServletRequest();
    User user = uWebAPI.getLoggedInUser(request);
    Category parent = null;
    Category cat = new Category();
    cat.setCategoryName(name);
    cat.setKey(key);
    cat.setCategoryVelocityVarName(var);
View Full Code Here

Examples of com.dotmarketing.business.web.UserWebAPI

    return validKey;
  }

  public boolean getPermission(String inode) throws Exception {
    UserWebAPI uWebAPI = WebAPILocator.getUserWebAPI();
    WebContext ctx = WebContextFactory.get();
    HttpServletRequest request = ctx.getHttpServletRequest();
    User user = uWebAPI.getLoggedInUser(request);
    Category cat = categoryAPI.find(inode, user, false);

    try {
      if(!categoryAPI.hasDependencies(cat)){
        categoryAPI.delete(cat, user, false);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.