Package com.dotmarketing.beans

Examples of com.dotmarketing.beans.Identifier


      // parent folder
      String parent = ParamUtil.getString(req, "parent");
      Folder folder = APILocator.getFolderAPI().find(parent, user, false);
      //http://jira.dotmarketing.net/browse/DOTCMS-5899
      if(InodeUtils.isSet(currentFile.getIdentifier())){
        Identifier id = APILocator.getIdentifierAPI().find(currentFile);
        if(id!=null && InodeUtils.isSet(id.getInode())){
          String URI = id.getURI();
          String uriPath = URI.substring(0,URI.lastIndexOf("/")+1);
          String folderPath = APILocator.getIdentifierAPI().find(folder).getPath();
          if(!uriPath.equals(folderPath)){
            id.setURI(folderPath+currentFile.getFileName());
            APILocator.getIdentifierAPI().save(id);
          }
        }
      }
View Full Code Here


      User user) throws Exception {
   
    File workingFile = (File) super._getVersionBackWebAsset(req, res, config, form, user, File.class,
        WebKeys.FILE_EDIT);
    File fileVersion = (File) req.getAttribute(WebKeys.FILE_EDIT);
    Identifier identifier = APILocator.getIdentifierAPI().find(fileVersion);
    String parentInode = req.getParameter("parent");
    Folder parent = null;
    if (parentInode != null && parentInode.length() != 0 && !parentInode.equalsIgnoreCase("")) {
      // the parent is being passed through the request
      parent = (Folder) InodeFactory.getInode(parentInode, Folder.class);
View Full Code Here

       template = templateAPI.findWorkingTemplate(id, APILocator.getUserAPI().getSystemUser(), false);
    }catch(DotSecurityException e){
      Logger.error(this, e.getMessage());
    }
    if(template!=null){
      Identifier imageIdentifier = APILocator.getIdentifierAPI().find(template.getImage());
      if(UtilMethods.isSet(imageIdentifier.getAssetType()) && imageIdentifier.getAssetType().equals("contentlet")) {
        Contentlet imageContentlet = TemplateFactory.getImageContentlet(template);
        if(imageContentlet!=null){
          toReturn.put("inode", imageContentlet.getInode());
          toReturn.put("name", imageContentlet.getTitle());
          toReturn.put("identifier", imageContentlet.getIdentifier());
View Full Code Here

      this.baseHostId = baseHostId;
    }

    public int compare(Template o1, Template o2) {
      try {
        Identifier id1 = APILocator.getIdentifierAPI().find(o1.getIdentifier());
        if(id1.getHostId() == null) id1 = null;
        Identifier id2 = APILocator.getIdentifierAPI().find(o2.getIdentifier());
        if(id2.getHostId() == null) id2 = null;
        if(id1 != null && id2 != null && id1.getHostId().equals(baseHostId) && id2.getHostId().equals(baseHostId)) {
          return o1.getTitle().compareTo(o2.getTitle());
        }
        if(id1 != null && id1.getHostId().equals(baseHostId)) {
          return -1;
        }
        if(id2 != null && id2.getHostId().equals(baseHostId)) {
          return 1;
        }
        return id1 == null || id2 == null || id1.getHostId().equals(id2.getHostId())?o1.getTitle().compareTo(o2.getTitle()):id1.getHostId().compareTo(id2.getHostId());

      } catch (DotDataException e) {

      }
      return 0;
View Full Code Here

   * @return
   * @throws Exception
   */
  public File getWorkingFileByFileName(String fileName, Folder folder) throws DotDataException{

    Identifier id = APILocator.getIdentifierAPI().find(folder);

      HibernateUtil hu = new HibernateUtil(File.class);
      hu.setSQLQuery(workingFileByName);
      hu.setParam(id.getPath());
      hu.setParam(id.getHostId());
      hu.setParam(fileName);

      return (File) hu.load();


View Full Code Here

  }

    public boolean isDeleted(Versionable ver) throws DotDataException, DotStateException, DotSecurityException {
        if(!UtilMethods.isSet(ver) || !InodeUtils.isSet(ver.getVersionId()))
          return false;
        Identifier ident = APILocator.getIdentifierAPI().find(ver.getVersionId());

        if(!UtilMethods.isSet(ident.getId()))
          return false;

        if(ident.getAssetType().equals("contentlet")) {
            Contentlet cont=(Contentlet)ver;
            ContentletVersionInfo cinfo=vfac.getContentletVersionInfo(cont.getIdentifier(), cont.getLanguageId());
            return cinfo.isDeleted();
        }
        else {
View Full Code Here

  }

  public File getLiveFileByFileName(String fileName, Folder folder) throws DotDataException{

    Identifier id = APILocator.getIdentifierAPI().find(folder);

      HibernateUtil hu = new HibernateUtil(File.class);
      hu.setSQLQuery(liveFileByName);
      hu.setParam(id.getPath());
      hu.setParam(fileName);

      return (File) hu.load();

View Full Code Here

    }

    public boolean isLive(Versionable versionable) throws DotDataException, DotStateException, DotSecurityException {
        if(!UtilMethods.isSet(versionable) || !InodeUtils.isSet(versionable.getVersionId()))
          return false;
        Identifier ident = APILocator.getIdentifierAPI().find(versionable);
        if(ident==null || !UtilMethods.isSet(ident.getId()) || !UtilMethods.isSet(ident.getAssetType()))
            return false;
        String liveInode;
        if(ident.getAssetType().equals("contentlet")) {
            Contentlet cont = (Contentlet)versionable;
            ContentletVersionInfo info = vfac.getContentletVersionInfo(cont.getIdentifier(), cont.getLanguageId());
            if(info ==null || !UtilMethods.isSet(info.getIdentifier()))
                throw new DotStateException("No version info. Call setWorking first "+ident.getId());
            liveInode=info.getLiveInode();
        }
        else {
            VersionInfo info = vfac.getVersionInfo(versionable.getVersionId());
            if(!UtilMethods.isSet(info.getIdentifier()))
View Full Code Here

            newFile.setFriendlyName( file.getFriendlyName() + " (COPY) " );
        } else {
            newFile.setFileName( fileName + "." + fileExtension );
        }

        Identifier identifier;
        if ( parent != null ) {
            identifier = APILocator.getIdentifierAPI().createNew( newFile, parent );
        } else {
            identifier = APILocator.getIdentifierAPI().createNew( newFile, host );
        }
        newFile.setIdentifier( identifier.getInode() );

        // persists the webasset
        HibernateUtil.saveOrUpdate( newFile );

        saveFileData( file, newFile, null );

        Logger.debug( FileFactory.class, "identifier=" + identifier.getURI() );

        WorkingCache.removeAssetFromCache( newFile );
        WorkingCache.addToWorkingAssetToCache( newFile );
        PermissionAPI permissionAPI = APILocator.getPermissionAPI();
View Full Code Here

    }

    public boolean isLocked(Versionable ver) throws DotDataException, DotStateException, DotSecurityException {
        if(!UtilMethods.isSet(ver) || !InodeUtils.isSet(ver.getVersionId()))
            return false;
        Identifier ident = APILocator.getIdentifierAPI().find(ver.getVersionId());
        if(ident.getAssetType().equals("contentlet")) {
            Contentlet cont=(Contentlet)ver;
            ContentletVersionInfo info = vfac.getContentletVersionInfo(cont.getIdentifier(),cont.getLanguageId());
            if(!UtilMethods.isSet(info.getIdentifier()))
                throw new DotStateException("No version info. Call setWorking first");
            return info.isLocked();
View Full Code Here

TOP

Related Classes of com.dotmarketing.beans.Identifier

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.