As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
log4j.logger.org.alfresco.repo.jscript=debug log4j.logger.org.alfresco.repo.jscript.ScriptLogger=debug
logger.log("whatever"); var thirdParties = document.properties["sp:thirdParties"]; var location = document.properties["sp:location"]; var responsibleEmp = document.properties["sp:responsibleEmp"]; var contractRef = document.properties["sp:contractRef"]; var effectiveDate = document.properties["sp:effectiveDate"]; var mctype = document.properties["sp:mctype"]; var sourceFile = document; //var sourceFolder = document.parent; var targetFolder = ""; var success = true; //Check to see if values are null if( thirdParties == null || location == "" || responsibleEmp == null || contractRef == null || effectiveDate == null || location.toString() != "UK" || mctype == null ){ success = false; }else{ var effectiveDate = new Date ( document.properties["sp:effectiveDate"] ); //Check if folder exist if(checkFolderExists(location, effectiveDate )){ targetFolder = space.parent.childByNamePath(location.toString()).childByNamePath("Contracts").childByNamePath(effectiveDate.getFullYear().toString()).childByNamePath("MLA and Supplement"); }else{ success = false; // do not move doc no folder exists } } if(success){ var targetFile = targetFolder.childByNamePath(document.name); if(targetFile == null){ sourceFile.move(targetFolder); }else{ var targetFileWorkingCopy = targetFile.checkout(); targetFileWorkingCopy.content = sourceFile.content; targetFileWorkingCopy.checkin("",false); sourceFile.remove(); } } /** Function checks if year folder exists if not then it creeates it * @param String location of created doc * @param Date effectiveDate entered in metadata */ function checkFolderExists(location, effectiveDate){ if( !space.parent.childByNamePath(location.toString()).childByNamePath("Contracts").childByNamePath(effectiveDate.getFullYear().toString()) ){ space.parent.childByNamePath(location.toString()).childByNamePath("Contracts").createFolder( effectiveDate.getFullYear().toString() ); //create year folder if( !space.parent.childByNamePath(location.toString()).childByNamePath("Contracts").childByNamePath(effectiveDate.getFullYear().toString()).childByNamePath("MLA and Supplement") ){ space.parent.childByNamePath(location.toString()).childByNamePath("Contracts").childByNamePath(effectiveDate.getFullYear().toString()).createFolder("MLA and Supplement"); // create supllement mla folde rin year folder } return true; }else if( !space.parent.childByNamePath(location.toString()).childByNamePath("Contracts").childByNamePath(effectiveDate.getFullYear().toString()).childByNamePath("MLA and Supplement") ) { space.parent.childByNamePath(location.toString()).childByNamePath("Contracts").childByNamePath(effectiveDate.getFullYear().toString()).createFolder("MLA and Supplement"); // create supllement mla folde rin year folder }else if ( space.parent.childByNamePath(location.toString()).childByNamePath("Contracts").childByNamePath(effectiveDate.getFullYear().toString()).childByNamePath("MLA and Supplement") ) { return true; }else{ return false; } }
tail -f /opt/alfresco-4.0.d/tomcat/logs/catalina.out /opt/alfresco-4.0.d/alfresco.log