Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static XSLTranformationDoc getXSLTranformationDocByXMLPath(String XMLPath,String XSLPath) {
- DotCacheAdministrator cache = CacheLocator.getCacheAdministrator();
- XSLTranformationDoc doc = null;
- try{
- doc = (XSLTranformationDoc) cache.get(getPrimaryGroup() + XMLPath+"_"+XSLPath, getPrimaryGroup());
- }catch (DotCacheException e) {
- Logger.debug(XSLTransformationCache.class,"Cache Entry not found", e);
- }
- if (doc != null) {
- try{
- /*validate if xsl file change*/
- Identifier xslIdentifier = APILocator.getIdentifierAPI().find(doc.getIdentifier());
- Contentlet xslFile = APILocator.getContentletAPI().findContentletByIdentifier(doc.getIdentifier(),
- false, APILocator.getLanguageAPI().getDefaultLanguage().getId(), userAPI.getSystemUser(), false);
- // File xslFile = (File) versionableAPI.findWorkingVersion(xslIdentifier, userAPI.getSystemUser(), false);
- /*validate time to live*/
- long ttl = doc.getTtl() - new Date().getTime();
- if(ttl <= 0 || doc.getInode() != xslFile.getInode()){
- removeXSLTranformationDoc(doc);
- doc =null;
- }
- }catch (Exception e) {
- Logger.debug(XSLTransformationCache.class,"Cache xsl identifier not found", e);
- }
- }
- return doc;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement