Package com.dotmarketing.beans

Examples of com.dotmarketing.beans.WebAsset


  public static WebAsset getBackAssetVersion(WebAsset versionWebAsset) throws Exception {
    Identifier id = (Identifier) APILocator.getIdentifierAPI().find(versionWebAsset);
    if (!InodeUtils.isSet(id.getInode())) {
      throw new Exception("Web asset Identifier not found!");
    }
    WebAsset working = (WebAsset) APILocator.getVersionableAPI().findWorkingVersion(id, APILocator.getUserAPI().getSystemUser(), false);
    if (!InodeUtils.isSet(working.getInode())) {
      throw new Exception("Working copy not found!");
    }
    APILocator.getVersionableAPI().setWorking(versionWebAsset);
    return versionWebAsset;
   
View Full Code Here


    Logger.debug(WebAssetFactory.class, "Publishing asset!!!!");
    // gets the identifier for this asset
    Identifier identifier = APILocator.getIdentifierAPI().find(currWebAsset);
    // gets the current working asset

    WebAsset workingwebasset = null;

    // gets the current working asset
    workingwebasset = (WebAsset) APILocator.getVersionableAPI().findWorkingVersion(identifier, APILocator.getUserAPI().getSystemUser(), false);
   
    if (!InodeUtils.isSet(workingwebasset.getInode())) {
      workingwebasset = currWebAsset;
    }

    Logger.debug(WebAssetFactory.class, "workingwebasset=" + workingwebasset.getInode());

    WebAsset livewebasset = null;


      // gets the current working asset
    livewebasset = (WebAsset) APILocator.getVersionableAPI().findLiveVersion(identifier, APILocator.getUserAPI().getSystemUser(), false);
View Full Code Here

    Logger.debug(WebAssetFactory.class, "Publishing asset!!!!");
    // gets the identifier for this asset
    Identifier identifier = APILocator.getIdentifierAPI().find(currWebAsset);
    // gets the current working asset

    WebAsset workingwebasset = null;

    // gets the current working asset
    workingwebasset = (WebAsset) APILocator.getVersionableAPI().findWorkingVersion(identifier, APILocator.getUserAPI().getSystemUser(), false);
   
    if (!InodeUtils.isSet(workingwebasset.getInode())) {
      workingwebasset = currWebAsset;
    }

    Logger.debug(WebAssetFactory.class, "workingwebasset=" + workingwebasset.getInode());

    WebAsset livewebasset = null;

    try {
      // gets the current working asset
      livewebasset = (WebAsset) APILocator.getVersionableAPI().findLiveVersion(identifier, APILocator.getUserAPI().getSystemUser(), false);
   
View Full Code Here

    Logger.debug(WebAssetFactory.class, "Publishing asset!!!!");
    // gets the identifier for this asset
    Identifier identifier = APILocator.getIdentifierAPI().find(currWebAsset);

    WebAsset livewebasset = null;

    // gets the current working asset
    livewebasset = (WebAsset) APILocator.getVersionableAPI().findLiveVersion(identifier, APILocator.getUserAPI().getSystemUser(), false);
   
    return livewebasset;
View Full Code Here

  public static boolean archiveAsset(WebAsset currWebAsset, String userId) throws DotDataException, DotStateException, DotSecurityException {

    // gets the identifier for this asset
    Identifier identifier = APILocator.getIdentifierAPI().find(currWebAsset);

    WebAsset workingwebasset = null;

      // gets the current working asset
      workingwebasset = (WebAsset) APILocator.getVersionableAPI().findWorkingVersion(identifier, APILocator.getUserAPI().getSystemUser(), false);
   

    WebAsset live = (WebAsset) APILocator.getVersionableAPI().findLiveVersion(identifier, APILocator.getUserAPI().getSystemUser(), false);
   
    //Delete the HTML Page from the Structure Detail
    if(currWebAsset instanceof HTMLPage)
    {
      List<Structure> structures = (List<Structure>) StructureFactory.getStructures();
      for(Structure structure : structures)
      {
        if(structure.getDetailPage() == identifier.getInode())
        {
          structure.setDetailPage("");
          StructureFactory.saveStructure(structure);
        }
      }
    }   
       
    else if (currWebAsset instanceof File)
    {
         RefreshMenus.deleteMenu(currWebAsset);
         Identifier ident=APILocator.getIdentifierAPI().find(currWebAsset);
         CacheLocator.getNavToolCache().removeNavByPath(ident.getHostId(), ident.getParentPath());
    }
   
    User userMod = null;
    try{
      userMod = APILocator.getUserAPI().loadUserById(workingwebasset.getModUser(),APILocator.getUserAPI().getSystemUser(),false);
    }catch(Exception ex){
      if(ex instanceof NoSuchUserException){
        try {
          userMod = APILocator.getUserAPI().getSystemUser();
        } catch (DotDataException e) {
          Logger.error(WebAssetFactory.class,e.getMessage(),e);
        }
      }
    }
    if(userMod!=null){
       workingwebasset.setModUser(userMod.getUserId());
    }
   
   
    if (userId == null || !workingwebasset.isLocked() || workingwebasset.getModUser().equals(userId)) {

      if (live!=null && InodeUtils.isSet(live.getInode())) {
            APILocator.getVersionableAPI().removeLive(live.getIdentifier());
      }
     
      //Reset the mod date
      workingwebasset.setModDate(new Date ());
      // sets deleted to true
View Full Code Here

    HostAPI hostAPI = APILocator.getHostAPI();
   
    // gets the identifier for this asset
    Identifier identifier = APILocator.getIdentifierAPI().find(currWebAsset);

    WebAsset workingwebasset = null;

    // gets the current working asset
    workingwebasset = (WebAsset) APILocator.getVersionableAPI().findWorkingVersion(identifier, APILocator.getUserAPI().getSystemUser(), false);

    WebAsset livewebasset = null;
   
    User modUser = null;
    try{
      modUser = APILocator.getUserAPI().loadUserById(workingwebasset.getModUser(),APILocator.getUserAPI().getSystemUser(),false);
    }catch(Exception ex){
      if(ex instanceof NoSuchUserException){
        try {
          modUser = APILocator.getUserAPI().getSystemUser();
        } catch (DotDataException e) {
          Logger.error(WebAssetFactory.class,e.getMessage(),e);
        }
      }
    }
    if(modUser!=null){
       workingwebasset.setModUser(modUser.getUserId());
    }

    if (!workingwebasset.isLocked() || workingwebasset.getModUser().equals(userId)) {
      try {
        // gets the current working asset
        livewebasset = (WebAsset) APILocator.getVersionableAPI().findLiveVersion(identifier, APILocator.getUserAPI().getSystemUser(), false);
       
            APILocator.getVersionableAPI().removeLive(identifier.getId());
        livewebasset.setModDate(new java.util.Date());
        livewebasset.setModUser(userId);
        HibernateUtil.saveOrUpdate(livewebasset);

        if ((livewebasset.getInode() != workingwebasset.getInode())) {
              APILocator.getVersionableAPI().setLocked(workingwebasset, false, null);       
          // removes from folder or parent inode
          if(parent != null)
            parent.deleteChild(workingwebasset);
        }
View Full Code Here

   */
  public static WebAsset saveAsset(WebAsset newWebAsset, Identifier id) throws Exception {
    if (!InodeUtils.isSet(id.getInode())) {
      throw new Exception("Web asset Identifier not found!");
    }
    WebAsset currWebAsset = null;
   
    // gets the current working asset
    currWebAsset = (WebAsset) APILocator.getVersionableAPI().findWorkingVersion(id, APILocator.getUserAPI().getSystemUser(), false);
   
    //http://jira.dotmarketing.net/browse/DOTCMS-5927
    if (!InodeUtils.isSet(currWebAsset.getInode())) {
      currWebAsset = (WebAsset) APILocator.getVersionableAPI().findLiveVersion(id, APILocator.getUserAPI().getSystemUser(), false);
      if(InodeUtils.isSet(currWebAsset.getInode()) && !currWebAsset.isWorking() && currWebAsset.isLive()){
            APILocator.getVersionableAPI().setWorking(newWebAsset);
      }else if(!InodeUtils.isSet(currWebAsset.getInode()) || !currWebAsset.isLive()){
        throw new Exception("Working copy not found!");
      }
    }

     APILocator.getVersionableAPI().setWorking(newWebAsset);
View Full Code Here

        offsetFound = true;
      }
     
      List<WebAsset> result = new ArrayList<WebAsset>(limit);
     
      WebAsset webAsset;
      while (offsetFound && (result.size() < limit) && (list != null) && (0 < list.size())) {
        if (direction.equals(Direction.NEXT)) {
          ++pos;
          while ((result.size() < limit) && (pos < list.size())) {
            webAsset = (WebAsset) list.get(pos);
View Full Code Here

        offsetFound = true;
      }
     
      List<WebAsset> result = new ArrayList<WebAsset>(limit);
     
      WebAsset webAsset;
      while (offsetFound && (result.size() < limit) && (list != null) && (0 < list.size())) {
        if (direction.equals(Direction.NEXT)) {
          ++pos;
          while ((result.size() < limit) && (pos < list.size())) {
            webAsset = (WebAsset) list.get(pos);
View Full Code Here

    java.util.List<WebAsset> elements = WebAssetFactory.getAssetsPerConditionWithPermissionWithParent(hostId, condition, assetsClass, limit, fromAssetId, direction, orderby, parentId, showDeleted, user);
    java.util.Iterator<WebAsset> elementsIter = elements.iterator();

    while (elementsIter.hasNext()) {

      WebAsset asset = elementsIter.next();
      Folder folderParent = null;
      if (!WebAssetFactory.isAbstractAsset(asset))
        folderParent = (Folder) APILocator.getFolderAPI().findParentFolder(asset,user,false);
     
      Host host=null;
View Full Code Here

TOP

Related Classes of com.dotmarketing.beans.WebAsset

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.