Package com.dotmarketing.beans

Examples of com.dotmarketing.beans.Host


  //pass linkFolders folders
  public String createMenu(String path, String pagePath, String divName, boolean linkFolders, int numberOfLevels)
  {
    try {
      Host host = hostWebAPI.getCurrentHost(request);
      return createMenu(path, pagePath, host.getIdentifier(),divName,"",linkFolders,"","",numberOfLevels);
    } catch (SystemException e) {
      Logger.error(HorizontalMenuBuilder.class, e.getMessage(), e);
      throw new DotRuntimeException(e.getMessage(), e);
    } catch (PortalException e) {
      Logger.error(HorizontalMenuBuilder.class, e.getMessage(), e);
View Full Code Here


       String menuId = "";
      
       if (path.equals("/")) {
      fileName = hostId + "_horz.vtl";
      menuId = String.valueOf(hostId);
      Host host = new Host();
      try {
        file  = new java.io.File(MENU_VTL_PATH + java.io.File.separator + fileName);
        if (!file.exists()) {
          FileOutputStream fo = new FileOutputStream(file);
          fo.close();
View Full Code Here

      } catch (Exception e) {
        stringbuffer.append("<li>" + "" + "</li>");
        Logger.error(WebAssetFactory.class,"Unable to get Contentlet", e);
      }
        } else {
          Host h = APILocator.getHostAPI().find(hostId, APILocator.getUserAPI().getSystemUser(), false);
        Folder folder = fapi.findFolderByPath(openPath, h,user,true);
   
        Identifier identifier = APILocator.getIdentifierAPI().find(h, APILocator.getIdentifierAPI().find(folder).getPath() + pagePath);
        HTMLPage htmlpage = (HTMLPage) APILocator.getVersionableAPI().findWorkingVersion(identifier,APILocator.getUserAPI().getSystemUser(),false);
       
View Full Code Here

  public List<IFileAsset> getVideoImages (String videoURI, String hostId) {
    //String videoURI = videoFile.getURI();
    String imageURI = videoURI.substring(0,videoURI.length()-4) + ".jpg";
    IFileAsset img = null;
    try {
      Host host = APILocator.getHostAPI().find(hostId,userAPI.getSystemUser(),false);
      Identifier id = APILocator.getIdentifierAPI().find(host, imageURI);
      if(id!=null && InodeUtils.isSet(id.getId()) && id.getAssetType().equals("contentlet")){
        Contentlet cont = APILocator.getContentletAPI().findContentletByIdentifier(id.getId(), true, APILocator.getLanguageAPI().getDefaultLanguage().getId(), userAPI.getSystemUser(),false);
        if(cont!=null && InodeUtils.isSet(cont.getInode())){
          img = APILocator.getFileAssetAPI().fromContentlet(cont);
View Full Code Here

      parent = APILocator.getFolderAPI().find(folderId, user, false);
    } catch (Exception ignored) {
      // Probably what we have here is a host
    }

    Host host = null;
    if (parent == null) {// If we didn't find a parent folder lets verify if
                // this is a host
      host = APILocator.getHostAPI().find(folderId, user, false);
    }
View Full Code Here

        try {

            int level = 0;

            Host host = WebAPILocator.getHostWebAPI().getCurrentHost(request);

            java.util.List itemsChildrenList = APILocator.getFolderAPI().findMenuItems(host,APILocator.getUserAPI().getSystemUser(),false);
            double divTotal = ((double) itemsChildrenList.size() / (double) columns);
            numberToBreak = Math.ceil(divTotal);
            percent = Math.round(100 / columns);
View Full Code Here

    String value="";
    if(UtilMethods.isSet(field) && APILocator.getFieldAPI().valueSettable(field)){
      try{
        if(field.getFieldType().equals(Field.FieldType.HOST_OR_FOLDER.toString())){
          value = VelocityUtil.cleanVelocity(values[0]);
          Host host = APILocator.getHostAPI().find(value, APILocator.getUserAPI().getSystemUser(), false);
          if(host!=null && InodeUtils.isSet(host.getIdentifier())){
            contentlet.setHost(host.getIdentifier());
            contentlet.setFolder(FolderAPI.SYSTEM_FOLDER);
          }else{
            Folder folder = APILocator.getFolderAPI().find(value, APILocator.getUserAPI().getSystemUser(), false);
            if(folder!=null && InodeUtils.isSet(folder.getInode())){
              contentlet.setHost(folder.getHostId());
View Full Code Here

         }
    }

    if (st.getStructureType() == Structure.STRUCTURE_TYPE_FORM) {
      contentlet.setHost(formHost.getIdentifier());
      Host host = APILocator.getHostAPI().find(formHost.getIdentifier(), APILocator.getUserAPI().getSystemUser(), false);
      if (!perAPI.doesUserHavePermissions(host,"PARENT:"+PermissionAPI.PERMISSION_READ+", CONTENTLETS:"+PermissionAPI.PERMISSION_WRITE+"", user)) {
        throw new DotSecurityException("User doesn't have write permissions to Contentlet");
      }
    }

    /**
     * If the moderator field is set, a work flow task is created
     */
    if(UtilMethods.isSet(moderatorRole)){

      if(!UtilMethods.isSet(contentlet.getStringProperty(Contentlet.WORKFLOW_ACTION_KEY)))
        contentlet.setStringProperty(Contentlet.WORKFLOW_ACTION_KEY, APILocator.getWorkflowAPI().findEntryAction(contentlet, user).getId());

      String contentletTitle = "";

          List<Field> fields = FieldsCache.getFieldsByStructureInode(contentlet.getStructureInode());

          for (Field fld : fields) {
                  if(fld.isListed()){
                      contentletTitle = contentlet.getMap().get(fld.getVelocityVarName()).toString();
                      contentletTitle = contentletTitle.length() > 250 ? contentletTitle.substring(0,250) : contentletTitle;
                  }
          }
      contentlet.setStringProperty(Contentlet.WORKFLOW_COMMENTS_KEY, "A new content titled \"" + UtilHTML.escapeHTMLSpecialChars(contentletTitle.trim()) +
          "\" has been posted by " + UtilHTML.escapeHTMLSpecialChars(user.getFullName()) + " ("+user.getEmailAddress()+")");

      contentlet.setStringProperty(Contentlet.WORKFLOW_ASSIGN_KEY, roleAPI.loadRoleByKey(moderatorRole).getId());
    }
   
    /*
    * Saving file and images
    */
    if(fileParameters.size() > 0) {
        for(Map<String,Object> value : fileParameters) {
             Field field = (Field)value.get("field");
             //http://jira.dotmarketing.net/browse/DOTCMS-3463
             if(field.getFieldType().equals(Field.FieldType.IMAGE.toString())||
                     field.getFieldType().equals(Field.FieldType.FILE.toString())){
               java.io.File uploadedFile = (java.io.File)value.get("file");
               try {
                 if(!UtilMethods.isSet(FileUtil.getBytes(uploadedFile)))
                   continue;
               } catch (IOException e) {
                   Logger.error(SubmitContentUtil.class, e.getMessage());
               }
               String title = (String)value.get("title");
               Host host = (Host)value.get("host");
               addFileToContentlet(contentlet, field,host, uploadedFile, user, title);
             }
            }
    }

View Full Code Here

    ActionErrors errors = new ActionErrors();
    ActionMessages message = new ActionMessages();
    HttpSession session = request.getSession();
    UploadServletRequest uploadReq = (UploadServletRequest) request;
    Host host = hostWebAPI.getCurrentHost(request);

    boolean useCaptcha = false;
    boolean useAudioCaptcha =false;
    boolean autoPublish = false;
    String moderatorRole="";
View Full Code Here

    else
        context.put("language", request.getAttribute(WebKeys.HTMLPAGE_LANGUAGE));

   
    try {
      Host host;
      host = WebAPILocator.getHostWebAPI().getCurrentHost(request);
      context.put("host", host);
    } catch (Exception e) {
      Logger.error(VelocityUtil.class,e.getMessage(),e);
    }
View Full Code Here

TOP

Related Classes of com.dotmarketing.beans.Host

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.