private GeneralPolicyProcessor InitialiseGPP(ICompiledPolicySetCache compiledPolicy) { if (compiledPolicy == null) return null; string lang = GetCurrentCulturesLanguageFile(compiledPolicy); string content = compiledPolicy.Content; PolicySetLanguageMerger pslm = new PolicySetLanguageMerger(); content = pslm.Merge(content, lang); GeneralPolicyProcessor gpp = new GeneralPolicyProcessor(); gpp.ExceptionHandler += new ExceptionEventHandler(OnException); gpp.Initialise(m_runAt, content, compiledPolicy.ObjectReferences); return gpp; }
/// <summary> /// </summary> public void ProcessFileInfo(RunAt runat, IContentItem fileinfo) { if (fileinfo == null) { Utilities.ErrorMessage errorMessage = new Utilities.ErrorMessage( "INVALID_FILE", "Workshare.Policy.Engine.Properties.Resources", Assembly.GetExecutingAssembly()); Logger.LogError(errorMessage.LogString); throw new PolicyEngineException(errorMessage.DisplayString); } if (m_CompiledPolicySetCache == null) { Utilities.ErrorMessage errorMessage = new Utilities.ErrorMessage( "POLICYSET_UNINITIALISED", "Workshare.Policy.Engine.Properties.Resources", Assembly.GetExecutingAssembly()); Logger.LogError(errorMessage.LogString); throw new PolicyEngineException(errorMessage.DisplayString); } string objectsxml = m_CompiledPolicySetCache.ObjectReferences; string rulesxml = m_CompiledPolicySetCache.Content; string languagexml = GetCurrentCulturesLanguageFile(); if (languagexml != "") // This is to maintain backward compatibility with old rules files. { PolicySetLanguageMerger lm = new PolicySetLanguageMerger(); rulesxml = lm.Merge(rulesxml, languagexml); } m_GeneralPolicyProcessor.Initialise(runat, rulesxml, objectsxml); m_GeneralPolicyProcessor.ProcessFileInfo(fileinfo); }