Advertisement
Guest User

Untitled

a guest
Feb 21st, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. public static XSLTranformationDoc getXSLTranformationDocByXMLPath(String XMLPath,String XSLPath) {
  2. DotCacheAdministrator cache = CacheLocator.getCacheAdministrator();
  3. XSLTranformationDoc doc = null;
  4. try{
  5. doc = (XSLTranformationDoc) cache.get(getPrimaryGroup() + XMLPath+"_"+XSLPath, getPrimaryGroup());
  6. }catch (DotCacheException e) {
  7. Logger.debug(XSLTransformationCache.class,"Cache Entry not found", e);
  8. }
  9.  
  10. if (doc != null) {
  11. try{
  12.  
  13. /*validate if xsl file change*/
  14. Identifier xslIdentifier = APILocator.getIdentifierAPI().find(doc.getIdentifier());
  15.  
  16. Contentlet xslFile = APILocator.getContentletAPI().findContentletByIdentifier(doc.getIdentifier(),
  17. false, APILocator.getLanguageAPI().getDefaultLanguage().getId(), userAPI.getSystemUser(), false);
  18.  
  19. // File xslFile = (File) versionableAPI.findWorkingVersion(xslIdentifier, userAPI.getSystemUser(), false);
  20.  
  21. /*validate time to live*/
  22. long ttl = doc.getTtl() - new Date().getTime();
  23.  
  24. if(ttl <= 0 || doc.getInode() != xslFile.getInode()){
  25. removeXSLTranformationDoc(doc);
  26. doc =null;
  27. }
  28.  
  29.  
  30. }catch (Exception e) {
  31. Logger.debug(XSLTransformationCache.class,"Cache xsl identifier not found", e);
  32. }
  33. }
  34. return doc;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement