Package com.dotmarketing.beans

Examples of com.dotmarketing.beans.VersionInfo


        return contV;
    }

    @Override
    protected VersionInfo getVersionInfo(String identifier) {
        VersionInfo vi = null;
        try {
            vi = (VersionInfo)cache.get(getVersionInfoGroup()+identifier, getVersionInfoGroup());
        }
        catch(Exception ex) {
            Logger.debug(this, identifier +" versionInfo not found in cache");
View Full Code Here



      //Get the identifier of the webAsset
      Identifier identifier = APILocator.getIdentifierAPI().find(currWebAsset);

      VersionInfo auxVersionInfo = null;

      //### Get and delete the webAsset ###
      List<Versionable> webAssetList = new ArrayList<Versionable>();
      webAssetList.addAll(APILocator.getVersionableAPI().findAllVersions(identifier, APILocator.getUserAPI().getSystemUser(), false));
      if(currWebAsset instanceof Container)
      {
        ContainerServices.unpublishContainerFile((Container)currWebAsset);
        CacheLocator.getContainerCache().remove(currWebAsset.getInode());
      }
      else if(currWebAsset instanceof HTMLPage)
      {
        PageServices.unpublishPageFile((HTMLPage)currWebAsset);
        if(RefreshMenus.shouldRefreshMenus((HTMLPage)currWebAsset)){
          RefreshMenus.deleteMenu(currWebAsset);
          Identifier ident=APILocator.getIdentifierAPI().find(currWebAsset);
          CacheLocator.getNavToolCache().removeNavByPath(ident.getHostId(), ident.getParentPath());
        }

        CacheLocator.getHTMLPageCache().remove((HTMLPage)currWebAsset);
      }
      else if(currWebAsset instanceof Template)
      {
        TemplateServices.unpublishTemplateFile((Template)currWebAsset);
        APILocator.getTemplateAPI().associateContainers(new ArrayList<Container>(), (Template)currWebAsset);
        CacheLocator.getTemplateCache().remove(currWebAsset.getInode());
      }
      else if(currWebAsset instanceof Link)
      {
        VersionInfo vi = APILocator.getVersionableAPI().getVersionInfo(currWebAsset.getIdentifier());

        if(!UtilMethods.isSet(vi)) {
          auxVersionInfo = getVersionInfo(currWebAsset, identifier,
              webAssetList, "links");
        }

        VirtualLinksCache.removePathFromCache(((Link)currWebAsset).getUrl());
      }
      else if(currWebAsset instanceof File)
      {

        VersionInfo vi = APILocator.getVersionableAPI().getVersionInfo(currWebAsset.getIdentifier());

        if(!UtilMethods.isSet(vi)) {
          auxVersionInfo = getVersionInfo(currWebAsset, identifier,
              webAssetList, "file_asset");
        }
View Full Code Here

  }

  private static VersionInfo getVersionInfo(WebAsset currWebAsset,
      Identifier identifier, List<Versionable> webAssetList, String type)
      throws DotHibernateException {
    VersionInfo auxVersionInfo;
    Class clazz = UtilMethods.getVersionInfoType(type);
    HibernateUtil dh = new HibernateUtil(clazz);
    dh.setQuery("from "+clazz.getName()+" where identifier=?");
    dh.setParam(identifier);
    Logger.debug(BaseWebAssetAPI.class, "getVersionInfo query: "+dh.getQuery());
    auxVersionInfo=(VersionInfo)dh.load();

    if(UtilMethods.isSet(auxVersionInfo) && UtilMethods.isSet(auxVersionInfo.getIdentifier())) {
        clazz = InodeUtils.getClassByDBType(type);
        dh = new HibernateUtil(clazz);
      dh.setQuery("from inode in class " + clazz.getName() + " where inode.identifier = ? and inode.type='"+type+"' order by mod_date desc");
      dh.setParam(currWebAsset.getIdentifier());
      Logger.debug(BaseWebAssetAPI.class, "findAllVersions query: " + dh.getQuery());
View Full Code Here

      throw new DotSecurityException(WebKeys.USER_PERMISSIONS_EXCEPTION);
    }
  }

  public Template findWorkingTemplate(String id, User user, boolean respectFrontendRoles) throws DotDataException, DotSecurityException {
    VersionInfo info = APILocator.getVersionableAPI().getVersionInfo(id);
    return find(info.getWorkingInode(), user, respectFrontendRoles);

  }
View Full Code Here

    templateFactory.associateContainers(containerIdentifiers, template);
  }


  public Template findLiveTemplate(String id, User user, boolean respectFrontendRoles) throws DotDataException, DotSecurityException {
    VersionInfo info = APILocator.getVersionableAPI().getVersionInfo(id);
    return find(info.getLiveInode(), user, respectFrontendRoles);
  }
View Full Code Here

            Contentlet cont=(Contentlet)ver;
            ContentletVersionInfo cinfo=vfac.getContentletVersionInfo(cont.getIdentifier(), cont.getLanguageId());
            return cinfo.isDeleted();
        }
        else {
            VersionInfo info = vfac.getVersionInfo(ver.getVersionId());
            if(!UtilMethods.isSet(info.getIdentifier()))
                throw new DotStateException("No version info. Call setWorking first");
            return info.isDeleted();
        }
    }
View Full Code Here

            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()))
                throw new DotStateException("No version info. Call setWorking first");
            liveInode=info.getLiveInode();
        }
        return liveInode!=null && liveInode.equals(versionable.getInode());
    }
View Full Code Here

            if(!UtilMethods.isSet(info.getIdentifier()))
                throw new DotStateException("No version info. Call setWorking first");
            return info.isLocked();
        }
        else {
            VersionInfo info = vfac.getVersionInfo(ver.getVersionId());
            if(!UtilMethods.isSet(info.getIdentifier()))
                throw new DotStateException("No version info. Call setWorking first");
            return info.isLocked();
        }
    }
View Full Code Here

            if(info ==null || !UtilMethods.isSet(info.getIdentifier()))
                throw new DotStateException("No version info. Call setWorking first");
            workingInode=info.getWorkingInode();
        }
        else {
            VersionInfo info=vfac.getVersionInfo(versionable.getVersionId());
            if(!UtilMethods.isSet(info.getIdentifier()))
                throw new DotStateException("No version info. Call setWorking first");
            workingInode=info.getWorkingInode();
        }
        return workingInode.equals(versionable.getInode());
    }
View Full Code Here

    }

    public void removeLive(String identifier) throws DotDataException, DotStateException, DotSecurityException {
        if(!UtilMethods.isSet(identifier))
            throw new DotStateException("invalid identifier");
        VersionInfo ver = vfac.getVersionInfo(identifier);
        if(!UtilMethods.isSet(ver.getIdentifier()))
            throw new DotStateException("No version info. Call setWorking first");
        ver.setLiveInode(null);
        vfac.saveVersionInfo(ver, true);
    }
View Full Code Here

TOP

Related Classes of com.dotmarketing.beans.VersionInfo

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.