Package com.dotmarketing.business

Examples of com.dotmarketing.business.IdentifierAPI


   * </ul>
   */
  private void setHTMLPagesDependencies() {
    try {

      IdentifierAPI idenAPI = APILocator.getIdentifierAPI();
      FolderAPI folderAPI = APILocator.getFolderAPI();
      List<Container> containerList = new ArrayList<Container>();

      for (String pageId : htmlPagesSet) {
        Identifier iden = idenAPI.find(pageId);

        // Host dependency
        Host h = APILocator.getHostAPI().find(iden.getHostId(), user, false);
        hosts.addOrClean( iden.getHostId(), h.getModDate());
        hostsSet.add(iden.getHostId());
View Full Code Here


        con.setReviewInterval(fatty.getReviewInterval());



       if(UtilMethods.isSet(fatty.getIdentifier())){
          IdentifierAPI identifierAPI = APILocator.getIdentifierAPI();
          Identifier identifier = identifierAPI.find(fatty.getIdentifier());
          Folder folder = null;
          if(identifier.getParentPath().length()>1){
              folder = APILocator.getFolderAPI().findFolderByPath(identifier.getParentPath(), identifier.getHostId(), APILocator.getUserAPI().getSystemUser(),false);
          }else{
              folder = APILocator.getFolderAPI().findSystemFolder();
View Full Code Here

          dc.addParam(structureInode);

          List<Map<String, String>> contentIdentifiers = dc.loadResults();

          PermissionAPI perAPI = APILocator.getPermissionAPI();
          IdentifierAPI identAPI = APILocator.getIdentifierAPI();

          for(Map<String, String> ident:contentIdentifiers){
            Identifier identifier = identAPI.find(ident.get("content_ident"));
            if(perAPI.doesUserHavePermission(identifier, PermissionAPI.PERMISSION_READ, user)){
              Map<String, String> h = new HashMap<String, String>();
              h.put("identifier", ident.get("content_ident"));
              h.put("numberOfViews", ident.get("numberOfViews"));
              result.add(h);
View Full Code Here

  @SuppressWarnings("unchecked")
  public void _saveWebAsset(ActionRequest req, ActionResponse res,
      PortletConfig config, ActionForm form, User user) throws Exception {

    HostAPI hostAPI = APILocator.getHostAPI();
    IdentifierAPI identifierAPI = APILocator.getIdentifierAPI();
   
    //wraps request to get session object
    ActionRequestImpl reqImpl = (ActionRequestImpl) req;
    HttpServletRequest httpReq = reqImpl.getHttpServletRequest();

    LinkForm linkForm = (LinkForm) form;
   
    //gets the new information for the link from the request object
    Link link = new Link();
    link.setTitle(((LinkForm) form).getTitle());   
    BeanUtils.copyProperties(link,form);
    req.setAttribute(WebKeys.LINK_FORM_EDIT,link);
   
    boolean previousShowMenu = link.isShowOnMenu();

    //gets the current link being edited from the request object
    Link currentLink = (Link) req.getAttribute(WebKeys.LINK_EDIT);
   
    //parent folder or inode for this file
    Folder parent = APILocator.getFolderAPI().find(req.getParameter("parent"), user, false);
    //http://jira.dotmarketing.net/browse/DOTCMS-5899
    if(UtilMethods.isSet(currentLink.getInode())){
      Identifier id = APILocator.getIdentifierAPI().find(currentLink);
      String URI = id.getURI();
      String uriPath = URI.substring(0,URI.lastIndexOf("/")+1);
      if(!uriPath.equals(APILocator.getIdentifierAPI().find(parent).getPath())){
        id.setURI(APILocator.getIdentifierAPI().find(parent).getPath()+currentLink.getProtocal() + currentLink.getUrl());
        APILocator.getIdentifierAPI().save(id);
      }
    }
   
    //Checking permissions
    _checkPermissions(currentLink, parent, user, httpReq);

    //gets user id from request for mod user
    String userId = user.getUserId();

    // take care of internal links
    if (InodeUtils.isSet(linkForm.getInternalLinkIdentifier())) {

      Identifier internalLinkIdentifier = identifierAPI.findFromInode(linkForm.getInternalLinkIdentifier());
      //link.setLinkType(LinkType.INTERNAL.toString());
      link.setInternalLinkIdentifier(internalLinkIdentifier.getInode());
      link.setProtocal("http://");

      StringBuffer myURL = new StringBuffer();
View Full Code Here

  @SuppressWarnings("unchecked")
  private boolean move(Folder folder, Object destination) throws DotDataException, DotStateException, DotSecurityException {

    folder = (Folder) HibernateUtil.load(Folder.class, folder.getInode());
    IdentifierAPI identAPI = APILocator.getIdentifierAPI();
    Identifier folderId = identAPI.find(folder.getIdentifier());

        //Clean up the cache
        if ( folder.isShowOnMenu() ) {
            CacheLocator.getNavToolCache().removeNav( folder.getHostId(), folder.getInode() );
        }
        CacheLocator.getNavToolCache().removeNavByPath( folderId.getHostId(), folderId.getParentPath() );
        fc.removeFolder( folder, folderId );

    User systemUser = APILocator.getUserAPI().getSystemUser();
    boolean contains = false;
    String newParentPath;
    String newParentHostId;
    if (destination instanceof Folder) {
      contains = folderContains(folder.getName(), (Folder) destination);
      Identifier destinationId = identAPI.find(((Folder) destination).getIdentifier());
      newParentPath = destinationId.getPath();
      newParentHostId = destinationId.getHostId();
      if(!contains)
          CacheLocator.getNavToolCache().removeNavByPath(destinationId.getHostId(), destinationId.getPath());
    } else {
      contains = APILocator.getHostAPI().doesHostContainsFolder((Host) destination, folder.getName());
      newParentPath = "/";
      newParentHostId = ((Host)destination).getIdentifier();
      if(!contains)
          CacheLocator.getNavToolCache().removeNav(newParentHostId, FolderAPI.SYSTEM_FOLDER);
    }
    if (contains)
      return false;

    List<Folder> subFolders = getSubFolders(folder);
    List htmlPages = getChildrenClass(folder, HTMLPage.class);
    List files = getChildrenClass(folder, File.class);
    List links = getChildrenClass(folder, Link.class);
    List<Contentlet> contentlets = APILocator.getContentletAPI().findContentletsByFolder(folder, systemUser, false);


    folderId.setParentPath(newParentPath);
    folderId.setHostId(newParentHostId);
    identAPI.save(folderId);

    for (Object page : htmlPages) {
      APILocator.getHTMLPageAPI().movePage((HTMLPage) page, folder, systemUser, false);
    }
View Full Code Here

      DotConnect dc = new DotConnect();
      dc.setSQL("select * from inode where inode = ?");
      dc.addParam(inode);
      Identifier id = null;
      IdentifierAPI iapi = APILocator.getIdentifierAPI();
      id=   iapi.findFromInode(dc.getString("identifier"));
      return id.getURI();
    } catch (Exception e) {
      Logger.warn(this, "Unable to find identifier : " + inode);

    }
View Full Code Here

             && UtilMethods.isSet(contentletFormData.get("contentcontainer_inode")))) {

      String htmlpage_inode = (String) contentletFormData.get("htmlpage_inode");
      String contentcontainer_inode = (String) contentletFormData.get("contentcontainer_inode");

      final IdentifierAPI identifierAPI = APILocator.getIdentifierAPI();
      final VersionableAPI versionableAPI = APILocator.getVersionableAPI();

      Identifier htmlParentId = identifierAPI.findFromInode(htmlpage_inode);
      HTMLPage htmlParent = (HTMLPage) versionableAPI.findWorkingVersion(htmlParentId, user, false);
      Logger.debug(this, "Added Contentlet to parent=" + htmlParent.getInode());

      Identifier containerParentId = null;
      Container containerParent = null;
      try{
        containerParentId =  identifierAPI.findFromInode(contentcontainer_inode);
        containerParent = (Container) versionableAPI.findWorkingVersion(containerParentId, user, false);
      }
      catch(Exception e){
        if(e instanceof DotSecurityException){
          SessionMessages.add(req, "message", "User needs 'View' Permissions on container");
          throw new DotSecurityException("User have no View Permissions on container");
        }else{
          throw e;
        }
      }

      if(containerParent != null){
        Logger.debug(this, "Added Contentlet to parent=" + containerParent.getInode());


        if (InodeUtils.isSet(htmlParent.getInode()) && InodeUtils.isSet(containerParent.getInode()) && InodeUtils.isSet(contentlet.getInode())) {
          Identifier htmlPageIdentifier = identifierAPI.find(htmlParent);
          Identifier containerIdentifier = identifierAPI.find(containerParent);
          Identifier contenletIdentifier = identifierAPI.find(contentlet);
          MultiTree multiTree = MultiTreeFactory.getMultiTree(htmlPageIdentifier, containerIdentifier,
              contenletIdentifier);
          Logger.debug(this, "Getting multitree for=" + htmlParent.getInode() + " ," + containerParent.getInode()
              + " ," + contentlet.getIdentifier());
          Logger.debug(this, "Coming from multitree parent1=" + multiTree.getParent1() + " parent2="
View Full Code Here

TOP

Related Classes of com.dotmarketing.business.IdentifierAPI

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.