Package com.dotmarketing.portlets.contentlet.model

Examples of com.dotmarketing.portlets.contentlet.model.ContentletVersionInfo


        return null;
  }
 
  public boolean contentHasLiveVersion(String identifier) throws Exception {
      long lang=Long.parseLong((String)request.getSession().getAttribute(WebKeys.HTMLPAGE_LANGUAGE));
      ContentletVersionInfo cvi=APILocator.getVersionableAPI().getContentletVersionInfo(identifier, lang);
      return UtilMethods.isSet(cvi.getLiveInode());
  }
View Full Code Here


        cache.put(getVersionInfoGroup()+key, versionInfo, getVersionInfoGroup());
    }

    @Override
    protected ContentletVersionInfo getContentVersionInfo(String identifier, long lang) {
        ContentletVersionInfo contV = null;
        try {
            String key=identifier+"-lang:"+lang;
            contV = (ContentletVersionInfo)cache.get(getVersionInfoGroup()+key, getVersionInfoGroup());
        }
        catch(Exception ex) {
View Full Code Here

        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 {
            VersionInfo info = vfac.getVersionInfo(ver.getVersionId());
            if(!UtilMethods.isSet(info.getIdentifier()))
                throw new DotStateException("No version info. Call setWorking first");
View Full Code Here

        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()))
                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(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();
        }
        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(ident==null || !UtilMethods.isSet(ident.getId()) || !UtilMethods.isSet(ident.getAssetType()))
            return false;
        String workingInode;
        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");
            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

      if ( !UtilMethods.isSet( identifier ) ) {
            throw new DotStateException( "invalid identifier" );
        }
        Identifier ident = APILocator.getIdentifierAPI().find( identifier );

        ContentletVersionInfo ver = vfac.getContentletVersionInfo( identifier, lang );
        if ( ver == null || !UtilMethods.isSet( ver.getIdentifier() ) ) {
            throw new DotStateException( "No version info. Call setLive first" );
        }

        if ( !UtilMethods.isSet( ver.getLiveInode() ) ) {
            throw new DotStateException( "No live version Contentlet. Call setLive first" );
        }

        Contentlet liveContentlet = APILocator.getContentletAPI().find( ver.getLiveInode(), APILocator.getUserAPI().getSystemUser(), false );
        if ( liveContentlet == null || !UtilMethods.isSet( liveContentlet.getIdentifier() ) ) {
            throw new DotStateException( "No live version Contentlet. Call setLive first" );
        }

        //Get the structure for this contentlet
        Structure structure = StructureCache.getStructureByInode( liveContentlet.getStructureInode() );

        if(contentlet.getMap().get(Contentlet.DONT_VALIDATE_ME) == null){
          if ( UtilMethods.isSet( structure.getExpireDateVar() ) ) {//Verify if the structure have a Expire Date Field set
                if ( UtilMethods.isSet( ident.getSysExpireDate() ) && ident.getSysExpireDate().after( new Date() ) ) {
                    throw new PublishStateException( "message.contentlet.unpublish.expired" );
                }
            }
        }

        ver.setLiveInode( null );
        vfac.saveContentletVersionInfo( ver, true );
    }
View Full Code Here

        if(!UtilMethods.isSet(ver.getVersionId()))
            throw new DotStateException("invalid identifier");
        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");
            info.setDeleted(deleted);
            vfac.saveContentletVersionInfo(info, true);
        }
        else {
            VersionInfo info = vfac.getVersionInfo(ver.getVersionId());
            if(!UtilMethods.isSet(info.getIdentifier()))
                throw new DotStateException("No version info. Call setWorking first");
            info.setDeleted(deleted);
            vfac.saveVersionInfo(info, true);
        }
    }
View Full Code Here

        Identifier ident = APILocator.getIdentifierAPI().find( versionable );
        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" );
            }

            //Get the structure for this contentlet
            Structure structure = StructureCache.getStructureByInode( cont.getStructureInode() );

            if ( UtilMethods.isSet( structure.getPublishDateVar() ) ) {//Verify if the structure have a Publish Date Field set
                if ( UtilMethods.isSet( ident.getSysPublishDate() ) && ident.getSysPublishDate().after( new Date() ) ) {
                    throw new PublishStateException( "message.contentlet.publish.future.date" );
                }
            }
            if ( UtilMethods.isSet( structure.getExpireDateVar() ) ) {//Verify if the structure have a Expire Date Field set
                if ( UtilMethods.isSet( ident.getSysExpireDate() ) && ident.getSysExpireDate().before( new Date() ) ) {
                    throw new PublishStateException( "message.contentlet.expired" );
                }
            }

            info.setLiveInode( versionable.getInode() );
            vfac.saveContentletVersionInfo( info, true );
        } else {
            VersionInfo info = vfac.getVersionInfo( versionable.getVersionId() );
            if ( !UtilMethods.isSet( info.getIdentifier() ) ) {
                throw new DotStateException( "No version info. Call setWorking first" );
            }
            info.setLiveInode( versionable.getInode() );
            vfac.saveVersionInfo( info, true );
        }
    }
View Full Code Here

        if(!UtilMethods.isSet(ver.getVersionId()))
            throw new DotStateException("invalid identifier");
        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");
            if(locked)
                info.setLocked(user.getUserId());
            else
                info.unLock();
            vfac.saveContentletVersionInfo(info, false);
        }
        else {
            VersionInfo info = vfac.getVersionInfo(ver.getVersionId());
            if(!UtilMethods.isSet(info.getIdentifier()))
                throw new DotStateException("No version info. Call setWorking first");
            if(locked)
                info.setLocked(user.getUserId());
            else
                info.unLock();
            vfac.saveVersionInfo(info, false);
        }
    }
View Full Code Here

TOP

Related Classes of com.dotmarketing.portlets.contentlet.model.ContentletVersionInfo

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.