Package com.dotmarketing.beans

Examples of com.dotmarketing.beans.Identifier


      doc = XSLTransformationCache.getXSLTranformationDocByXMLPath(XMLPath,XSLPath);

      if(doc == null){
        /*Get the XSL source*/
        java.io.File binFile = null;
        Identifier xslId = APILocator.getIdentifierAPI().find(host, XSLPath);
        if(xslId!=null && InodeUtils.isSet(xslId.getId()) && xslId.getAssetType().equals("contentlet")){
          Contentlet cont = APILocator.getContentletAPI().findContentletByIdentifier(xslId.getId(), true, APILocator.getLanguageAPI().getDefaultLanguage().getId(), userAPI.getSystemUser(),false);
          if(cont!=null && InodeUtils.isSet(cont.getInode())){
            binFile = cont.getBinary(FileAssetAPI.BINARY_FIELD);
          }
        }else{
          File xslFile = fileAPI.getFileByURI(XSLPath, host, true, userAPI.getSystemUser(),false);
          binFile = fileAPI.getAssetIOFile (xslFile);
        }
       
       
        /*Get the XML Source from file or from URL*/
        if(!XMLPath.startsWith("http")){
          Identifier xmlId = APILocator.getIdentifierAPI().find(host, XMLPath);
          if(xmlId!=null && InodeUtils.isSet(xmlId.getId()) && xmlId.getAssetType().equals("contentlet")){
            Contentlet cont = APILocator.getContentletAPI().findContentletByIdentifier(xmlId.getId(), true, APILocator.getLanguageAPI().getDefaultLanguage().getId(), userAPI.getSystemUser(),false);
            if(cont!=null && InodeUtils.isSet(cont.getInode())){
              xmlSource = new StreamSource(new InputStreamReader(new FileInputStream(cont.getBinary(FileAssetAPI.BINARY_FIELD)), "UTF8"));
            }
          }else{
            File xmlFile = fileAPI.getFileByURI(XMLPath, host, true,userAPI.getSystemUser(),false);
View Full Code Here


          hm.put("page_title", pageTitle);

        }
        else {
          // Map with all identifier inodes for a given uri.
          Identifier idInode = APILocator.getIdentifierAPI().find(host, page_url_clean);
          HTMLPage livePage = (HTMLPage) APILocator.getVersionableAPI().findLiveVersion(idInode,APILocator.getUserAPI().getSystemUser(),false);
 
          hm.put("page_title", livePage.getTitle());
        }
View Full Code Here

@Deprecated
public class TemplateFactory {

  public static File getImageFile(Template template) throws DotStateException, DotDataException, DotSecurityException {
    String imageIdentifierInode = template.getImage();
    Identifier identifier = new Identifier();
    try {
      identifier = APILocator.getIdentifierAPI().find(imageIdentifierInode);
    } catch (DotHibernateException e) {
      Logger.error(TemplateFactory.class,e.getMessage(),e);
    }
    File imageFile = new File();
    if(InodeUtils.isSet(identifier.getInode())){
      imageFile = (File) APILocator.getVersionableAPI().findWorkingVersion(identifier, APILocator.getUserAPI().getSystemUser(),false);
    }
    return imageFile;
  }
View Full Code Here

    return imageFile;
  }

  public static Contentlet getImageContentlet(Template template) throws DotStateException, DotDataException, DotSecurityException {
    String imageIdentifierInode = template.getImage();
    Identifier identifier = new Identifier();
    try {
      identifier = APILocator.getIdentifierAPI().find(imageIdentifierInode);
    } catch (DotHibernateException e) {
      Logger.error(TemplateFactory.class,e.getMessage(),e);
    }
    Contentlet imageContentlet = new Contentlet();
    if(InodeUtils.isSet(identifier.getInode())){
      imageContentlet = APILocator.getContentletAPI().findContentletByIdentifier(identifier.getId(), false, APILocator.getLanguageAPI().getDefaultLanguage().getId(), APILocator.getUserAPI().getSystemUser(), false);
    }
    return imageContentlet;
  }
View Full Code Here

    // persists the webasset
    if(!UtilMethods.isSet(webasset.getInode()))
        HibernateUtil.save(webasset);

    // create new identifier, without URI
    Identifier id = APILocator.getIdentifierAPI().createNew(webasset, (Host)null);
    id.setOwner(userId);
    //HibernateUtil.saveOrUpdate(id);
    APILocator.getIdentifierAPI().save(id);

    webasset.setIdentifier(id.getId());
    save(webasset);
    APILocator.getVersionableAPI().setWorking(webasset);
  }
View Full Code Here

    // persists the webasset
    if(!UtilMethods.isSet(webasset.getInode()))
            HibernateUtil.save(webasset);

    Identifier id = APILocator.getIdentifierAPI().createNew(webasset, (Folder) parent);
    id.setOwner(userId);
    // set the identifier on the inode for future reference.
    // and for when we get rid of identifiers all together
    //HibernateUtil.saveOrUpdate(id);
    APILocator.getIdentifierAPI().save(id);

    webasset.setIdentifier(id.getId());
    // persists the webasset
    save(webasset);

    // adds the webasset as child of the folder or parent inode
    if(!parent.getType().equalsIgnoreCase("folder"))
View Full Code Here

      //### END Delete the entry from cache ###


      //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");
        }

        APILocator.getFileAPI().invalidateCache((File)currWebAsset);
        if(RefreshMenus.shouldRefreshMenus((File)currWebAsset)){
          RefreshMenus.deleteMenu(currWebAsset);
          Identifier ident=APILocator.getIdentifierAPI().find(currWebAsset);
          CacheLocator.getNavToolCache().removeNavByPath(ident.getHostId(), ident.getParentPath());
        }
      }

      if(auxVersionInfo==null || !UtilMethods.isSet(auxVersionInfo.getIdentifier())) { // null auxVersionInfo  indicates everything goes fine
        APILocator.getVersionableAPI().deleteVersionInfo(currWebAsset.getVersionId());
View Full Code Here

      throw new IOException(e.getMessage());
    }

    IFileAsset f =null;
    try {
        Identifier id  = APILocator.getIdentifierAPI().find(host, url);
        if(id!=null && InodeUtils.isSet(id.getId())) {
            if(id.getAssetType().equals("contentlet")){
                Contentlet cont = APILocator.getContentletAPI().findContentletByIdentifier(id.getId(), false, APILocator.getLanguageAPI().getDefaultLanguage().getId(), user, false);
                  if(cont!=null && InodeUtils.isSet(cont.getIdentifier()) && !APILocator.getVersionableAPI().isDeleted(cont)){
                      f = APILocator.getFileAssetAPI().fromContentlet(cont);
                  }
            }
            else {
View Full Code Here

        // ### Copy the permission ###
        // Source
        boolean live = false;

        Identifier identifier  = APILocator.getIdentifierAPI().find(children[i].getHost(), destinationPath + "/" + children[i].getName());
        Permissionable destinationFile = null;
         if(identifier!=null && identifier.getAssetType().equals("contentlet")){
           destinationFile = APILocator.getContentletAPI().findContentletByIdentifier(identifier.getId(), live, APILocator.getLanguageAPI().getDefaultLanguage().getId(), user, false);
        }else{
          destinationFile = fileAPI.getFileByURI(destinationPath + "/" + children[i].getName(), children[i].getHost(), live, user, false);
        }

        // Delete the new permissions
View Full Code Here

          throw new IOException("The file doesn't comply the folder's filter");
        }

        if (host != null && InodeUtils.isSet(host.getInode())&& InodeUtils.isSet(folder.getInode())) {

          Identifier identifier = APILocator.getIdentifierAPI().find(host,path);

          File file = new File();
          file.setTitle(fileName);
          file.setFileName(fileName);
          file.setShowOnMenu(false);
          file.setModDate(new Date());
          String mimeType = fileAPI.getMimeType(fileName);
          file.setMimeType(mimeType);
          String author = user.getFullName();
          file.setAuthor(author);
          file.setModUser(author);
          file.setSortOrder(0);
          file.setShowOnMenu(false);


          if (identifier !=null &&  InodeUtils.isSet(identifier.getId()) && !identifier.getAssetType().equals("contentlet")) {
            File actualFile = fileAPI.getFileByURI(path, host, false,user,false);
            if(!UtilMethods.isSet(actualFile.getInode())){
              actualFile = (File)APILocator.getVersionableAPI().findWorkingVersion(identifier, user, false);
              WebAssetFactory.unArchiveAsset(actualFile);
            }
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.