Package com.dotmarketing.beans

Examples of com.dotmarketing.beans.Identifier


    _inode = urlString.nextToken();
    if(urlString.hasMoreTokens()){
      _page = urlString.nextToken();
    }

    Identifier iden = null;
    try {
      iden = APILocator.getIdentifierAPI().find(_inode);
    } catch (Exception e) {
      Logger.info(PermalinkServlet.class, e.getMessage());
    }

    /**
     * Check if is a trackback ping calling from the permalink url
     * The blog_name, title, excerpt, url params could be only use for
     * call to trackback process
     */
    if(UtilMethods.isSet(request.getParameter("blog_name")) || UtilMethods.isSet(request.getParameter("excerpt")) ||
        UtilMethods.isSet(request.getParameter("title")) ||  UtilMethods.isSet(request.getParameter("url"))){
       
        processTrackBackPing(request,response);
        return;
    } else{
      /**
       * Call to the usual permalink functionality redirecting to the page or file location
       */
      /*Check if is a contentlet and redirect to the specified page*/
      ContentletAPI contentletApi = APILocator.getContentletAPI();
      String luceneQuery = "+type:content +live:true +deleted:false +identifier:" + iden.getInode();
     
      List<Contentlet> contentlets = new ArrayList<Contentlet>();
      try
      {
        User user = APILocator.getUserAPI().getSystemUser();
        contentlets = contentletApi.search(luceneQuery,0,0,"",user,false);
      }
      catch(Exception ex)
      {
        Logger.info(PermalinkServlet.class,ex.getMessage());
      }
     
      if(contentlets.size() > 0)
      {
        try {
          //_page should be an identifier
          Identifier pageIden = APILocator.getIdentifierAPI().find(_page);
          //in case it is the inode of the page
          if(!InodeUtils.isSet(pageIden.getInode())){
            pageIden = APILocator.getIdentifierAPI().find((HTMLPage)InodeFactory.getInode(_page, HTMLPage.class));
          }
          redirect = redirect+UtilMethods.encodeURIComponent(pageIden.getURI())+"?id="+_inode;

        } catch (Exception e) {
          Logger.info(PermalinkServlet.class, e.getMessage());
        }

View Full Code Here


       
        for (Rating rating : list) {
           
            try {
                row = new ArrayList<String>();
                Identifier id = APILocator.getIdentifierAPI().find(rating.getIdentifier());
                Contentlet content = conAPI.findContentletByIdentifier(id.getInode(), false, langAPI.getDefaultLanguage().getId(), APILocator.getUserAPI().getSystemUser(), true);
                String conTitle = conAPI.getName(content, APILocator.getUserAPI().getSystemUser(), true);
                row.add("" + structure.getInode());
                row.add(UtilMethods.isSet(structure.getName()) ? structure.getName() : "");
                row.add("" + content.getInode());
                row.add(UtilMethods.isSet(conTitle) ? conTitle : "");
View Full Code Here

          HTMLPage page = htmlAPI.loadLivePageById(
              st.getPagedetail(), systemUser, true);

          Logger.debug(this, " Creating Site Map for Structure "
              + stVelocityVarName);
          Identifier pageIdentifier = identAPI.find(page
              .getIdentifier());

          Logger.debug(this,
              " Performing Host Parameter validation Page Identifider Host ["
                  + pageIdentifier.getHostId()
                  + "], Host Identifider ["
                  + host.getIdentifier() + "], Deleted ["
                  + page.isDeleted() + "], Live ["
                  + page.isLive() + "]");

          if (!(host.getIdentifier().equals(
              pageIdentifier.getHostId()) && (!page.isDeleted() && page
              .isLive()))) {
            Logger.debug(this,
                "Host Parameter validation failed for structure ["
                    + stVelocityVarName + "]");
            continue;
          }

          String query = "+structureName:" + st.getVelocityVarName()
              + " +deleted:false +live:true";

          List<Contentlet> hits = conAPI.search(query, -1, 0, "",
              systemUser, true);

          String structureURLMap = st.getUrlMapPattern();

          List<RegExMatch> matches = null;

          if (useStructureURLMap
              && UtilMethods.isSet(structureURLMap)) {
            matches = RegEX.find(st.getUrlMapPattern(),
                "({[^{}]+})");
          }
          for (Contentlet contenlet : hits) {
            try {
              if (usePermalinks) {
                stringbuf = "<url><loc>"
                    + XMLUtils.xmlEscape("http://"
                        + host.getHostname()
                        + "/permalink/"
                        + contenlet.getIdentifier()
                        + "/" + st.getPagedetail()
                        + "/")
                    + "</loc><lastmod>"
                    + modifiedDateStringValue
                    + "</lastmod><changefreq>daily</changefreq></url>\n";
              } else if (useStructureURLMap
                  && UtilMethods.isSet(structureURLMap)
                  && (matches != null)) {
                String uri = structureURLMap;
                Logger.debug(this,
                    " Found the URL String for validation ["
                        + uri + "]");
                for (RegExMatch match : matches) {
                  String urlMapField = match.getMatch();
                  String urlMapFieldValue = contenlet
                      .getStringProperty(urlMapField
                          .substring(1, (urlMapField
                              .length() - 1)));
                  urlMapField = urlMapField.replaceFirst(
                      "\\{", "\\\\{");
                  urlMapField = urlMapField.replaceFirst(
                      "\\}", "\\\\}");

                  if (urlMapFieldValue != null) {
                    uri = uri.replaceAll(urlMapField,
                        urlMapFieldValue);
                  }
                  Logger.debug(this,
                      "Performing Variable replacement - urlMapField ["
                          + match.getMatch()
                          + "], urlMapField [ "
                          + urlMapField
                          + "], urlMapFieldValue ["
                          + urlMapFieldValue
                          + "], uri [" + uri + "]");
                }

                if (uri == null
                    && UtilMethods
                        .isSet(st.getDetailPage())) {
                  if (page != null
                      && UtilMethods.isSet(page
                          .getIdentifier())) {
                    uri = page.getURI() + "?id="
                        + contenlet.getInode();
                  }
                }
                String urlRelacementText = getUrlPatternReplacementText(
                    host, stVelocityVarName);

                uri = uri.replaceAll(urlRelacementText, "");

                Logger.debug(this,
                    "Performing URL replacement - urlRelacementText ["
                        + urlRelacementText
                        + "], uri [" + uri + "]");

                stringbuf = "<url><loc>"
                    + XMLUtils.xmlEscape("http://"
                        + host.getHostname() + uri)
                    + "</loc><lastmod>"
                    + modifiedDateStringValue
                    + "</lastmod><changefreq>daily</changefreq></url>\n";
              } else {
                stringbuf = "<url><loc>"
                    + XMLUtils.xmlEscape("http://"
                        + host.getHostname()
                        + pageIdentifier.getURI()
                        + "?id="
                        + contenlet.getIdentifier())
                    + "</loc><lastmod>"
                    + modifiedDateStringValue
                    + "</lastmod><changefreq>daily</changefreq></url>\n";
              }
              writeFile(stringbuf);
              addRegistryProcessed();

            } catch (Exception e) {
              Logger.error(this, e.getMessage(), e);
            }
          }
        }
        /**
         * This part add the show on menu pages. similar as we do in
         * navigationwebapi to generate sitemap
         * */
        java.util.List<Folder> itemsList = new ArrayList<Folder>();

        itemsList = folderAPI.findSubFolders(host, true);

        //Logger.warn(this, "Finding Subfolders for referebce [" + itemsList.size() + "]");

        Comparator<Folder> comparator = new AssetsComparator(
            orderDirection);
        Collections.sort(itemsList, comparator);

        List<Inode> itemsList2 = new ArrayList<Inode>();

        for (Folder f : itemsList) {
          if (f instanceof Folder) {
            //Logger.warn(this, "Folder Iteration in progress Name [" + f.getName() + "], show on Menu Indicator [" + f.isShowOnMenu() + "]");
            itemsList2.addAll(folderAPI.findMenuItems(f,
                systemUser, true));
          }
        }

        //Logger.warn(this, "List Size [" + itemsList2 + "]");

        if (itemsList2.size() > 0) {

          // /FIRST LEVEL MENU ITEMS!!!!
          for (Permissionable itemChild : itemsList) {

            if (itemChild instanceof Folder) {

              Folder folderChild = (Folder) itemChild;

              Logger.debug(this, "Folder Iteration in progress Name [" + folderChild.getName() + "], show on Menu Indicator [" + folderChild.isShowOnMenu() + "]");

              // recursive method here
              buildSubFolderSiteMapMenu(folderChild, 100, 1, 1);

            } else if (itemChild instanceof Link) {
              Link link = (Link) itemChild;
              if (link.isLive() && !link.isDeleted()) {
                if (link.getUrl()
                    .startsWith(host.getHostname())) {
                  stringbuf = "<url><loc>"
                      + XMLUtils.xmlEscape(link
                          .getProtocal()
                          + link.getUrl())
                      + "</loc><lastmod>"
                      + modifiedDateStringValue
                      + "</lastmod><changefreq>daily</changefreq></url>\n";
                  writeFile(stringbuf);
                  addRegistryProcessed();
                }
              }
            } else if (itemChild instanceof HTMLPage) {
              HTMLPage page = (HTMLPage) itemChild;
              Logger.debug(this, "Folder Page Configuration " + page.getURI());
              if (page.isLive() && !page.isDeleted()) {
                String indexPageConfiguration = "/index."+ Config.getStringProperty("VELOCITY_PAGE_EXTENSION");
                String pathToPageUrl = XMLUtils.xmlEscape("http://"+ host.getHostname() + page.getURI());

                if (pathToPageUrl.endsWith(indexPageConfiguration)) {
                  pathToPageUrl = pathToPageUrl.replace(indexPageConfiguration, "");
                }

                stringbuf = "<url><loc>"
                    + pathToPageUrl
                    + "</loc><lastmod>"
                    + modifiedDateStringValue
                    + "</lastmod><changefreq>daily</changefreq></url>\n";
                writeFile(stringbuf);
                addRegistryProcessed();
              }
            } else if (itemChild instanceof com.dotmarketing.portlets.files.model.File) {
              com.dotmarketing.portlets.files.model.File file = (com.dotmarketing.portlets.files.model.File) itemChild;
              if (file.isLive() && !file.isDeleted()) {
                stringbuf = "<url><loc>"
                    + XMLUtils.xmlEscape("http://"
                        + host.getHostname()
                        + file.getURI())
                    + "</loc><lastmod>"
                    + modifiedDateStringValue
                    + "</lastmod><changefreq>daily</changefreq></url>\n";
                writeFile(stringbuf);
                addRegistryProcessed();
              }
            } else if (itemChild instanceof Contentlet) {
              Contentlet fileContent = (Contentlet)itemChild;
              if (fileContent.isLive() && !fileContent.isArchived()) {
                Identifier identifier = APILocator.getIdentifierAPI().find(fileContent);
                stringbuf = "<url><loc>"
                    + XMLUtils.xmlEscape("http://"
                        + host.getHostname()
                        + UtilMethods.encodeURIComponent(identifier.getParentPath()+fileContent.getStringProperty(FileAssetAPI.FILE_NAME_FIELD)))
                    + "</loc><lastmod>"
                    + modifiedDateStringValue
                    + "</lastmod><changefreq>daily</changefreq></url>\n";
                writeFile(stringbuf);
                addRegistryProcessed();
View Full Code Here

    String stringbuf = null;
    // gets menu items for this folder
    java.util.List<Inode> itemsChildrenList2 = folderAPI.findMenuItems(
        thisFolder, orderDirection);

    Identifier folderIdent = identAPI.find(thisFolder.getIdentifier());

    String folderChildPath = folderIdent.getURI().substring(0,
        folderIdent.getURI().length() - 1);

    folderChildPath = folderChildPath.substring(0, folderChildPath
        .lastIndexOf("/"));

    Host host = hostAPI.findParentHost(thisFolder, systemUser, false);

    Identifier id = identAPI.loadFromCache(host, folderIdent.getURI()
        + "/index."
        + Config.getStringProperty("VELOCITY_PAGE_EXTENSION"));

    Logger.debug(this, "Performing check for folders [" + (folderIdent.getURI() + "/index." + Config.getStringProperty("VELOCITY_PAGE_EXTENSION")) + "], Identifier Check ["
     + (id != null) + "], Children Count [" + itemsChildrenList2.size() + "], Host Identifier [" + host.getIdentifier() + "], Identifier " +
     ((id != null) ? id.getInode() : "") + "]");

    boolean isIndexPageAlreadyConfigured = false;

    if ((id != null) && InodeUtils.isSet(id.getInode())) {
      stringbuf = "<url><loc>"
          + XMLUtils
              .xmlEscape("http://"
                  + host.getHostname()
                  + folderIdent.getURI())
          + "</loc><lastmod>" + modifiedDateStringValue
          + "</lastmod><changefreq>daily</changefreq></url>\n";

      Logger.debug(this, "Writing the XMLConfiguration for Folder[" + XMLUtils
              .xmlEscape("http://"
                  + host.getHostname()
                  + folderIdent.getURI()) + "]"
      );

      isIndexPageAlreadyConfigured = true;

      writeFile(stringbuf);
      addRegistryProcessed();
    }

    if (currentLevel < numberOfLevels) {

      for (Permissionable childChild2 : itemsChildrenList2) {
        if (childChild2 instanceof Folder) {
          Folder folderChildChild2 = (Folder) childChild2;
          Identifier childChild2Ident = identAPI
              .find(folderChildChild2.getIdentifier());

          if (currentLevel <= numberOfLevels) {
            buildSubFolderSiteMapMenu(folderChildChild2,
                numberOfLevels, currentLevel + 1,
                orderDirection);
          } else {
            stringbuf = "<url><loc>"
                + XMLUtils
                    .xmlEscape("http://"
                        + host.getHostname()
                        + childChild2Ident.getURI())
                + "</loc><lastmod>"
                + modifiedDateStringValue
                + "</lastmod><changefreq>daily</changefreq></url>\n";

            Logger.debug(this, "Writing the XMLConfiguration Second Level Check for [" + XMLUtils
                    .xmlEscape("http://"
                        + host.getHostname()
                        + childChild2Ident.getURI()) + "]");

            writeFile(stringbuf);
            addRegistryProcessed();
          }
        } else if (childChild2 instanceof Link) {
          Link link2 = (Link) childChild2;
          if (link2.isLive() && !link2.isDeleted()) {
            if (link2.getUrl().startsWith(host.getHostname())) {
              stringbuf = "<url><loc>"
                  + XMLUtils.xmlEscape(link2.getProtocal()
                      + link2.getUrl())
                  + "</loc><lastmod>"
                  + modifiedDateStringValue
                  + "</lastmod><changefreq>daily</changefreq></url>\n";
              writeFile(stringbuf);
              addRegistryProcessed();
            }
          }
        } else if (childChild2 instanceof HTMLPage) {
          HTMLPage page2 = (HTMLPage) childChild2;
          Identifier childChild2Ident = identAPI.find(page2
              .getIdentifier());
          if (page2.isLive() && !page2.isDeleted()) {
            String indexPageConfiguration = "/index."+ Config.getStringProperty("VELOCITY_PAGE_EXTENSION");

            String pathToPageUrl = XMLUtils.xmlEscape("http://" + host.getHostname() + childChild2Ident.getURI());

            if (pathToPageUrl.endsWith(indexPageConfiguration) && isIndexPageAlreadyConfigured) {
              Logger.debug(this, "Index Page is already configured, skipping the process [" + pathToPageUrl + "]");
              continue;
            }

            pathToPageUrl = pathToPageUrl.replace(indexPageConfiguration, "");

            stringbuf = "<url><loc>" + pathToPageUrl + "</loc><lastmod>" + modifiedDateStringValue + "</lastmod><changefreq>daily</changefreq></url>\n";

            Logger.debug(this, "Writing the XMLConfiguration for an HTML Page with out index." + Config.getStringProperty("VELOCITY_PAGE_EXTENSION","html") + " extension [" + pathToPageUrl + "]");

            writeFile(stringbuf);

            addRegistryProcessed();
          }
        } else if (childChild2 instanceof com.dotmarketing.portlets.files.model.File) {
          com.dotmarketing.portlets.files.model.File file2 = (com.dotmarketing.portlets.files.model.File) childChild2;
          Identifier childChild2Ident = identAPI.find(file2
              .getIdentifier());
          if (file2.isLive() && !file2.isDeleted()) {
            stringbuf = "<url><loc>"
                + XMLUtils.xmlEscape("http://"
                    + host.getHostname()
                    + childChild2Ident.getURI() + "/"
                    + file2.getFileName())
                + "</loc><lastmod>"
                + modifiedDateStringValue
                + "</lastmod><changefreq>daily</changefreq></url>\n";
            writeFile(stringbuf);
            addRegistryProcessed();
          }
        } else if (childChild2 instanceof Contentlet) {
          Contentlet fileContent = (Contentlet)childChild2;
          if (fileContent.isLive() && !fileContent.isArchived()) {
            Identifier identifier = APILocator.getIdentifierAPI().find(fileContent);
            stringbuf = "<url><loc>"
                + XMLUtils.xmlEscape("http://"
                    + host.getHostname()
                    + UtilMethods.encodeURIComponent(identifier.getParentPath()+fileContent.getStringProperty(FileAssetAPI.FILE_NAME_FIELD)))
                + "</loc><lastmod>"
                + modifiedDateStringValue
                + "</lastmod><changefreq>daily</changefreq></url>\n";
            writeFile(stringbuf);
            addRegistryProcessed();
View Full Code Here

                                    ids.add(_assetId);
                                }
                            }

                        } else { // if the asset is not a folder and has identifier, put it, if not, put the inode
                            Identifier iden = APILocator.getIdentifierAPI().findFromInode( _assetId );
                            if ( !ids.contains( iden.getId() ) ) {//Multiples languages have the same identifier
                              if(!UtilMethods.isSet(bundleId) || !isAssetInBundle(iden.getId(), bundleId)){
                                ids.add( iden.getId() );
                              }
                            }
                        }

                    } catch ( DotStateException e ) {
View Full Code Here

        Assert.assertNull(APILocator.getIdentifierAPI().loadFromCache(ftest1.getIdentifier()));
        Assert.assertNull(APILocator.getIdentifierAPI().loadFromCache(ftest2.getIdentifier()));
        Assert.assertNull(APILocator.getIdentifierAPI().loadFromCache(ftest3.getIdentifier()));
       
        // make sure the rename is properly propagated on children (that's done in a db trigger)
        Identifier ident=APILocator.getIdentifierAPI().find(ftest),ident1=APILocator.getIdentifierAPI().find(ftest1),
                ident2=APILocator.getIdentifierAPI().find(ftest2),ident3=APILocator.getIdentifierAPI().find(ftest3);
        Assert.assertTrue(ident.getAssetName().startsWith("folderTestXX"));
        Assert.assertEquals(ident.getPath(),ident1.getParentPath());
        Assert.assertEquals(ident1.getPath(),ident2.getParentPath());
        Assert.assertEquals(ident2.getPath(),ident3.getParentPath());
       
    }
View Full Code Here

                          type = "user";
                      } else if ( identifier.contains( ".jar" ) ) {//Trying to publish an OSGI jar bundle
                          type = "osgi";
                      } else {

                          Identifier iden = APILocator.getIdentifierAPI().find( identifier );

                          if ( !UtilMethods.isSet( iden.getId() ) ) { // we have an inode, not an identifier
                              try {
                                  // check if it is a structure
                                  Structure st = null;
                                  List<Structure> sts = StructureFactory.getStructures();
                                  for ( Structure s : sts ) {
                                      if ( s.getInode().equals( identifier ) ) {
                                          st = s;
                                      }
                                  }
                                  Folder folder;

                                  /**
                                   * ISSUE 2244: https://github.com/dotCMS/dotCMS/issues/2244
                                   *
                                   */
                                  // check if it is a category
                                  if ( CATEGORY.equals( identifier ) ) {
                                      type = "category";
                                  } else if ( UtilMethods.isSet( st ) ) {
                                      if ( !strPerAPI.doesUserHavePermission( st, PermissionAPI.PERMISSION_PUBLISH, user ) ) {
                                          //Generate and append the error message
                                          appendPermissionError( errorsList, user, "Structure", st.getName(), st.getIdentifier() );
                                          continue;
                                      }

                                      type = "structure";
                                  }

                                  // check if it is a folder
                                  else if ( UtilMethods.isSet( folder = APILocator.getFolderAPI().find( identifier, user, false ) ) ) {
                                      if ( !strPerAPI.doesUserHavePermission( folder, PermissionAPI.PERMISSION_PUBLISH, user ) ) {
                                          //Generate and append the error message
                                          appendPermissionError( errorsList, user, "Folder", folder.getName(), folder.getIdentifier() );
                                          continue;
                                      }

                                      type = "folder";
                                  }
                              } catch ( Exception ex ) {
                                if ( UtilMethods.isSet( APILocator.getWorkflowAPI().findScheme(identifier) )) {
                                    type = "workflow";
                                  }
                              }

                          } else {
                              if ( !strPerAPI.doesUserHavePermission( iden, PermissionAPI.PERMISSION_PUBLISH, user ) ) {
                                  //Generate and append the error message
                                  appendPermissionError( errorsList, user, iden.getAssetType(), null, iden.getId() );
                                  continue;
                              }
                              type = UtilMethods.isSet( APILocator.getHostAPI().find( identifier, user, false ) ) ? "host" : iden.getAssetType();
                          }
                      }

                      String action = operationType==ADD_OR_UPDATE_ELEMENT?"Publish":operationType==DELETE_ELEMENT?"Delete":"Added by Browsing";
                      dc.addParam( operationType );
View Full Code Here

        testFolder.setSortOrder( 0 );
        testFolder.setTitle( "dotcms_junit_test_folder_" + String.valueOf( new Date().getTime() ) );
        testFolder.setType( "folder" );
        testFolder.setHostId( defaultHost.getIdentifier() );
        //Creates and set an identifier
        Identifier identifier = APILocator.getIdentifierAPI().createNew( testFolder, defaultHost );
        identifiers.add( identifier );
        testFolder.setIdentifier( identifier.getId() );

        //Saving the folder
        folderAPI.save( testFolder, user, false );

        //*******************************************************************************
 
View Full Code Here

                                           (reqURI.startsWith("/DOTLESS/") ? LessCompiler.class : null);
            CSSCompiler compiler = compilerClass.getConstructor(Host.class,String.class,boolean.class).newInstance(host,uri,live);
           
            // check if the asset exists
            String actualUri =  uri.substring(0, uri.lastIndexOf('.')) + "." + compiler.getDefaultExtension();
            Identifier ident = APILocator.getIdentifierAPI().find(host, actualUri);
            if(ident==null || !InodeUtils.isSet(ident.getId())) {
                resp.sendError(404);
                return;
            }
           
            // get the asset in order to build etag and check permissions
            long defLang=APILocator.getLanguageAPI().getDefaultLanguage().getId();
            FileAsset fileasset;
            try {
                fileasset = APILocator.getFileAssetAPI().fromContentlet(
                    APILocator.getContentletAPI().findContentletByIdentifier(ident.getId(), live, defLang, user, true));
            }
            catch(DotSecurityException ex) {
                resp.sendError(403);
                return;
            }
           
            boolean userHasEditPerms = false;
            if(!live) {
                userHasEditPerms = APILocator.getPermissionAPI().doesUserHavePermission(fileasset,PermissionAPI.PERMISSION_EDIT,user);
                if(req.getParameter("recompile")!=null && userHasEditPerms) {
                    CacheLocator.getCSSCache().remove(host.getIdentifier(), actualUri, false);
                    CacheLocator.getCSSCache().remove(host.getIdentifier(), actualUri, true);
                }
            }
           
            CachedCSS cache = CacheLocator.getCSSCache().get(host.getIdentifier(), actualUri, live, user);
           
            byte[] responseData=null;
            Date cacheMaxDate=null;
            CachedCSS cacheObject=null;
           
            if(cache==null || cache.data==null) {
                // do compile!
                synchronized(ident.getId().intern()) {
                    cache = CacheLocator.getCSSCache().get(host.getIdentifier(), actualUri, live, user);
                    if(cache==null || cache.data==null) {
                        Logger.debug(this, "compiling css data for "+host.getHostname()+":"+uri);
                       
                        try {
                            compiler.compile();
                        }
                        catch(Throwable ex) {
                            Logger.error(this, "Error compiling "+host.getHostname()+":"+uri, ex);
                            throw new Exception(ex);
                        }
                       
                        // build cache object
                        ContentletVersionInfo vinfo = APILocator.getVersionableAPI().getContentletVersionInfo(ident.getId(), defLang);
                        CachedCSS newcache = new CachedCSS();
                        newcache.data = compiler.getOutput();
                        newcache.hostId = host.getIdentifier();
                        newcache.uri = actualUri;
                        newcache.live = live;
                        newcache.modDate = vinfo.getVersionTs();
                        newcache.imported = new ArrayList<ImportedAsset>();
                        for(String importUri : compiler.getAllImportedURI()) {
                            // newcache entry for the imported asset
                            ImportedAsset asset = new ImportedAsset();
                            asset.uri = importUri;
                            Identifier ii;
                            if(importUri.startsWith("//")) {
                                importUri=importUri.substring(2);
                                String hn=importUri.substring(0, importUri.indexOf('/'));
                                String uu=importUri.substring(importUri.indexOf('/'));
                                ii = APILocator.getIdentifierAPI().find(APILocator.getHostAPI().findByName(hn, user, live),uu);
                            }
                            else {
                                ii = APILocator.getIdentifierAPI().find(host, importUri);
                            }
                            ContentletVersionInfo impInfo = APILocator.getVersionableAPI().getContentletVersionInfo(ii.getId(), defLang);
                            asset.modDate = impInfo.getVersionTs();
                            newcache.imported.add(asset);
                            Logger.debug(this, host.getHostname()+":"+actualUri+" imports-> "+importUri);
                           
                            // actual cache entry for the imported asset. If needed
                            synchronized(ii.getId().intern()) {
                                if(CacheLocator.getCSSCache().get(ii.getHostId(), importUri, live, user)==null) {
                                    CachedCSS entry = new CachedCSS();
                                    entry.data = null;
                                    entry.hostId = ii.getHostId();
                                    entry.imported = new ArrayList<ImportedAsset>();
                                    entry.live = live;
                                    entry.modDate = impInfo.getVersionTs();
                                    entry.uri = importUri;
                                    CacheLocator.getCSSCache().add(entry);
View Full Code Here

                for (Contentlet contentlet : contents) {
                  APILocator.getContentletIndexAPI().removeContentFromIndex(contentlet);
                  CacheLocator.getContentletCache().remove(contentlet.getInode());
                }

                Identifier folderIdentifier = APILocator.getIdentifierAPI().find(folder.getIdentifier());
                CacheLocator.getFolderCache().removeFolder(folder, folderIdentifier);

                CacheLocator.getIdentifierCache().removeFromCacheByIdentifier(folderIdentifier.getId());


                // THIS IS THE NEW CODE

                    // 1.1) Insert dummy temp row on INODE table
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.