From 8b0f111e940a10e543e2fea28f417a9daac7daee Mon Sep 17 00:00:00 2001 From: Dev-ALPM Date: Fri, 29 Sep 2023 11:53:45 +0200 Subject: [PATCH] Make Logger final Optimize string concatenation with template Fix error logging class name --- .../org/imixs/workflow/ItemCollection.java | 30 +- .../java/org/imixs/workflow/RuleEngine.java | 12 +- .../workflow/RuleEngineNashornConverter.java | 24 +- .../org/imixs/workflow/WorkflowKernel.java | 71 ++-- .../org/imixs/workflow/bpmn/BPMNModel.java | 10 +- .../imixs/workflow/bpmn/BPMNModelHandler.java | 59 +-- .../org/imixs/workflow/bpmn/BPMNParser.java | 7 +- .../services/rest/FormAuthenticator.java | 5 +- .../workflow/services/rest/RestClient.java | 35 +- .../org/imixs/workflow/util/JSONParser.java | 8 +- .../org/imixs/workflow/util/XMLParser.java | 4 +- .../xml/XMLDataCollectionAdapter.java | 4 +- .../workflow/xml/XMLDocumentAdapter.java | 4 +- .../java/org/imixs/workflow/xml/XMLItem.java | 9 +- .../org/imixs/workflow/xml/XSLHandler.java | 4 +- .../imixs/workflow/TestRuleEngineBPMN.java | 9 +- .../imixs/workflow/TestRuleEngineGraalJS.java | 7 +- ...estRuleEngineGraalJSDeprecatedScripts.java | 2 +- .../imixs/workflow/TestWorkflowKernel.java | 11 +- .../workflow/TestWorkflowKernelEval.java | 9 +- .../workflow/TestWorkflowKernelModels.java | 2 +- .../bpmn/MigrateImixsModelToBPMN.java | 20 +- .../imixs/workflow/util/TestJSONBuilder.java | 2 +- .../workflow/engine/AsyncEventScheduler.java | 7 +- .../workflow/engine/AsyncEventService.java | 25 +- .../workflow/engine/DocumentService.java | 65 ++- .../workflow/engine/EventLogService.java | 24 +- .../workflow/engine/HealthCheckService.java | 2 +- .../workflow/engine/ImixsConfigSource.java | 6 +- .../imixs/workflow/engine/MetricService.java | 6 +- .../imixs/workflow/engine/ModelService.java | 31 +- .../imixs/workflow/engine/ReportService.java | 32 +- .../imixs/workflow/engine/SetupService.java | 18 +- .../workflow/engine/SimulationService.java | 18 +- .../workflow/engine/TextForEachAdapter.java | 5 +- .../workflow/engine/TextItemValueAdapter.java | 12 +- .../engine/TextPropertyValueAdapter.java | 11 +- .../workflow/engine/WorkflowScheduler.java | 64 +-- .../workflow/engine/WorkflowService.java | 32 +- .../engine/adapters/AccessAdapter.java | 6 +- .../workflow/engine/adminp/AdminPService.java | 30 +- .../engine/adminp/JobHandlerRebuildIndex.java | 35 +- .../engine/adminp/JobHandlerRenameUser.java | 11 +- .../adminp/JobHandlerUpgradeWorkitems.java | 15 +- .../workflow/engine/index/SchemaService.java | 14 +- .../workflow/engine/plugins/AccessPlugin.java | 2 +- .../engine/plugins/AnalysisPlugin.java | 19 +- .../engine/plugins/ApplicationPlugin.java | 2 +- .../engine/plugins/ApproverPlugin.java | 16 +- .../plugins/DocumentComposerPlugin.java | 5 +- .../engine/plugins/EventLogPlugin.java | 2 +- .../engine/plugins/HistoryPlugin.java | 2 +- .../engine/plugins/IntervalPlugin.java | 11 +- .../workflow/engine/plugins/MailPlugin.java | 34 +- .../workflow/engine/plugins/OwnerPlugin.java | 4 +- .../workflow/engine/plugins/ReportPlugin.java | 2 +- .../workflow/engine/plugins/ResultPlugin.java | 7 +- .../workflow/engine/plugins/RulePlugin.java | 5 +- .../engine/plugins/SplitAndJoinPlugin.java | 4 +- .../engine/plugins/TaxonomyPlugin.java | 19 +- .../engine/plugins/VersionPlugin.java | 2 +- .../SchedulerConfigurationService.java | 2 +- .../engine/scheduler/SchedulerController.java | 370 +++++++++--------- .../engine/scheduler/SchedulerService.java | 44 +-- .../imixs/workflow/engine/TestAdaptText.java | 16 +- .../workflow/engine/TestDocumentService.java | 9 +- .../engine/TestEvaluateWorkflowResult.java | 5 +- .../engine/WorkflowMockEnvironment.java | 5 +- .../engine/WorkflowSimulationEnvironment.java | 3 +- .../TestAccessAdapterProcessEntity.java | 2 +- .../engine/index/TestNormalizePhrase.java | 11 +- .../workflow/plugins/TestAnalysisPlugin.java | 19 +- .../plugins/TestApplicationPlugin.java | 2 +- .../workflow/plugins/TestIntervalPlugin.java | 37 +- .../plugins/TestOwnerPluginProcessEntity.java | 2 +- .../workflow/plugins/TestResultPlugin.java | 29 +- .../workflow/plugins/TestRulePlugin.java | 47 +-- .../plugins/TestSplitAndJoinPlugin.java | 15 +- ...stSplitAndJoinPluginDeprecatedItemTag.java | 15 +- .../imixs/workflow/engine/TestAdaptText.java | 16 +- .../engine/TestEvaluateWorkflowResult.java | 5 +- .../engine/WorkflowMockEnvironment.java | 5 +- .../engine/adapters/TestAccessAdapter.java | 2 +- .../TestAccessAdapterProcessEntity.java | 2 +- .../engine/index/TestNormalizePhrase.java | 11 +- .../workflow/plugins/TestAnalysisPlugin.java | 19 +- .../plugins/TestApplicationPlugin.java | 2 +- .../workflow/plugins/TestIntervalPlugin.java | 27 +- .../plugins/TestOwnerPluginProcessEntity.java | 2 +- .../workflow/plugins/TestResultPlugin.java | 29 +- .../plugins/TestSplitAndJoinPlugin.java | 13 +- .../faces/data/AbstractDataController.java | 9 +- .../faces/data/DocumentController.java | 7 +- .../workflow/faces/data/ViewController.java | 5 +- .../workflow/faces/data/ViewHandler.java | 5 +- .../faces/data/WorkflowController.java | 20 +- .../fileupload/AjaxFileUploadServlet.java | 6 +- .../fileupload/FileUploadController.java | 7 +- .../workflow/faces/util/ErrorHandler.java | 17 +- .../engine/lucene/LuceneIndexService.java | 52 +-- .../engine/lucene/LuceneItemAdapter.java | 9 +- .../engine/lucene/LuceneSearchService.java | 39 +- .../engine/lucene/LuceneUpdateService.java | 7 +- .../engine/solr/SolrAutoFlushScheduler.java | 6 +- .../engine/solr/SolrIndexService.java | 55 +-- .../engine/solr/SolrSearchService.java | 18 +- .../engine/solr/SolrUpdateService.java | 11 +- .../workflow/jaxrs/AdminPRestService.java | 2 +- .../workflow/jaxrs/BPMNUnmarshaller.java | 16 +- .../workflow/jaxrs/DocumentRestService.java | 8 +- .../workflow/jaxrs/EventLogRestService.java | 11 +- .../workflow/jaxrs/ModelRestService.java | 7 +- .../workflow/jaxrs/ReportRestService.java | 13 +- .../imixs/workflow/jaxrs/RootRestService.java | 5 +- .../workflow/jaxrs/WorkflowRestService.java | 42 +- 115 files changed, 1080 insertions(+), 1016 deletions(-) diff --git a/imixs-workflow-core/src/main/java/org/imixs/workflow/ItemCollection.java b/imixs-workflow-core/src/main/java/org/imixs/workflow/ItemCollection.java index 7b5c2a55b..fb234ca72 100644 --- a/imixs-workflow-core/src/main/java/org/imixs/workflow/ItemCollection.java +++ b/imixs-workflow-core/src/main/java/org/imixs/workflow/ItemCollection.java @@ -53,6 +53,7 @@ import java.util.Map.Entry; import java.util.Set; import java.util.Vector; +import java.util.logging.Level; import java.util.logging.Logger; import java.util.regex.Pattern; import java.util.stream.Collectors; @@ -87,7 +88,7 @@ public class ItemCollection implements Cloneable { // NOTE: ItemCollection is not serializable - private static Logger logger = Logger.getLogger(ItemCollection.class.getName()); + private static final Logger logger = Logger.getLogger(ItemCollection.class.getName()); private Map> hash = new Hashtable>(); @@ -229,7 +230,7 @@ public void cloneItem(String itemName, ItemCollection source) { List copy = (List) ois.readObject(); hash.put(itemName, copy); } catch (IOException | ClassNotFoundException e) { - logger.warning("Unable to clone values of Item '" + itemName + "' - " + e); + logger.log(Level.WARNING, "Unable to clone values of Item ''{0}'' - {1}", new Object[]{itemName, e}); } } @@ -1626,8 +1627,9 @@ private void setItemValue(String itemName, Object itemValue, boolean append, boo // test if value is ItemCollection if (itemValue instanceof ItemCollection) { // just warn - do not remove - logger.warning("replaceItemValue '" + itemName - + "': ItemCollection can not be stored into an existing ItemCollection - use XMLItemCollection instead."); + logger.log(Level.WARNING, "replaceItemValue ''{0}'':" + + " ItemCollection can not be stored into an existing" + + " ItemCollection - use XMLItemCollection instead.", itemName); } // test if value is a Set @@ -1638,7 +1640,8 @@ private void setItemValue(String itemName, Object itemValue, boolean append, boo // test if value is serializable if (!(itemValue instanceof java.io.Serializable)) { - logger.warning("replaceItemValue '" + itemName + "': object is not serializable!"); + logger.log(Level.WARNING, "replaceItemValue ''{0}'':" + + " object is not serializable!", itemName); this.removeItem(itemName); return; } @@ -1652,8 +1655,9 @@ private void setItemValue(String itemName, Object itemValue, boolean append, boo for (int i = 0; i < itemValueList.size(); i++) { if (itemValueList.get(i) instanceof ItemCollection) { // just warn - do not remove - logger.warning("replaceItemValue '" + itemName - + "': ItemCollection can not be stored into an existing ItemCollection - use XMLItemCollection instead."); + logger.log(Level.WARNING, "replaceItemValue ''{0}'':" + + " ItemCollection can not be stored into an existing" + + " ItemCollection - use XMLItemCollection instead.", itemName); } } } else { @@ -1665,9 +1669,9 @@ private void setItemValue(String itemName, Object itemValue, boolean append, boo // now we can be sure the itemValue is an instance of List convertItemValue(itemValueList); if (!validateItemValue(itemValueList)) { - String message = "setItemValue failed for item '" + itemName - + "', the value is a non supported object type: " + itemValue.getClass().getName() + " value=" - + itemValueList; + String message = new StringBuilder("setItemValue failed for item '").append(itemName) + .append("', the value is a non supported object type: ").append(itemValue.getClass().getName()) + .append(" value=").append(itemValueList).toString(); logger.warning(message); throw new InvalidAccessException(message); } @@ -1855,10 +1859,10 @@ private Object deepCopyOfMap(Map> map) { ObjectInputStream ois = new ObjectInputStream(bais); return ois.readObject(); } catch (IOException e) { - logger.warning("Unable to clone values of ItemCollection - " + e); + logger.log(Level.WARNING, "Unable to clone values of ItemCollection - {0}", e); return null; } catch (ClassNotFoundException e) { - logger.warning("Unable to clone values of ItemCollection - " + e); + logger.log(Level.WARNING, "Unable to clone values of ItemCollection - {0}", e); return null; } } @@ -1909,7 +1913,7 @@ private static String getStringValueFromMap(Map> hash, Stri } } else { // Value is not a list! - logger.warning("getStringValueFromMap - wrong value object found '" + aName + "'"); + logger.log(Level.WARNING, "getStringValueFromMap - wrong value object found ''{0}''", aName); return obj.toString(); } } diff --git a/imixs-workflow-core/src/main/java/org/imixs/workflow/RuleEngine.java b/imixs-workflow-core/src/main/java/org/imixs/workflow/RuleEngine.java index 9b731b4ff..45e3e5227 100644 --- a/imixs-workflow-core/src/main/java/org/imixs/workflow/RuleEngine.java +++ b/imixs-workflow-core/src/main/java/org/imixs/workflow/RuleEngine.java @@ -85,7 +85,7 @@ public class RuleEngine { public static final String INVALID_SCRIPT = "INVALID_SCRIPT"; private static final HashSet> BASIC_OBJECT_TYPES = getBasicObjectTypes(); - private static Logger logger = Logger.getLogger(RuleEngine.class.getName()); + private static final Logger logger = Logger.getLogger(RuleEngine.class.getName()); private Context _context = null; private String languageId; @@ -143,7 +143,7 @@ public Context getContext() { .option("engine.WarnInterpreterOnly", "false") // .allowAllAccess(true) // .build(); - logger.info("...init RuleEngine took " + (System.currentTimeMillis()-l) + "ms"); + logger.log(Level.INFO, "...init RuleEngine took {0}ms", System.currentTimeMillis()-l); } return _context; } @@ -184,7 +184,7 @@ public boolean evaluateBooleanExpression(String script, ItemCollection workitem) } if (debug) { - logger.finest("......SCRIPT:" + script); + logger.log(Level.FINEST, "......SCRIPT:{0}", script); } // Test if we have a deprecated Script... @@ -197,7 +197,7 @@ public boolean evaluateBooleanExpression(String script, ItemCollection workitem) try { result = eval(script); } catch (PolyglotException e) { - logger.warning("Script Error in: " + script); + logger.log(Level.WARNING, "Script Error in: {0}", script); // script not valid throw new PluginException(RuleEngine.class.getSimpleName(), INVALID_SCRIPT, "BusinessRule contains invalid script:" + e.getMessage(), e); @@ -239,7 +239,7 @@ public ItemCollection evaluateBusinessRule(String script, ItemCollection workite } if (debug) { - logger.finest("......SCRIPT: " + script); + logger.log(Level.FINEST, "......SCRIPT: {0}", script); } // Test if we have a deprecated Script... @@ -255,7 +255,7 @@ public ItemCollection evaluateBusinessRule(String script, ItemCollection workite ItemCollection result = convertResult(); return result; } catch (PolyglotException e) { - logger.warning("Script Error: " + e.getMessage() + " in: " + script); + logger.log(Level.WARNING, "Script Error: {0} in: {1}", new Object[]{e.getMessage(), script}); // script not valid throw new PluginException(RuleEngine.class.getSimpleName(), INVALID_SCRIPT, "BusinessRule contains invalid script:" + e.getMessage(), e); diff --git a/imixs-workflow-core/src/main/java/org/imixs/workflow/RuleEngineNashornConverter.java b/imixs-workflow-core/src/main/java/org/imixs/workflow/RuleEngineNashornConverter.java index 5cb2d72cf..6447e5855 100644 --- a/imixs-workflow-core/src/main/java/org/imixs/workflow/RuleEngineNashornConverter.java +++ b/imixs-workflow-core/src/main/java/org/imixs/workflow/RuleEngineNashornConverter.java @@ -44,7 +44,7 @@ */ public class RuleEngineNashornConverter { - private static Logger logger = Logger.getLogger(RuleEngineNashornConverter.class.getName()); + private static final Logger logger = Logger.getLogger(RuleEngineNashornConverter.class.getName()); /** * This method returns true if the script is detected as deprecated. A @@ -114,12 +114,12 @@ public static boolean isDeprecatedScript(String script) { */ public static String rewrite(String script, ItemCollection workitem, ItemCollection event) { - String converterLog=""; - converterLog=converterLog+"\n***************************************************"; - converterLog=converterLog+"\n*** DEPRECATED NASHORN SCRIPT FOUND: ***"; - converterLog=converterLog+"\n***************************************************\n"; + StringBuilder converterLog = new StringBuilder() + .append("\n***************************************************") + .append("\n*** DEPRECATED NASHORN SCRIPT FOUND: ***") + .append("\n***************************************************\n") - converterLog=converterLog+"\n" + script + "\n\n"; + .append("\n").append(script).append("\n\n"); script = convertByItemCollection(script, workitem, "workitem"); script = convertByItemCollection(script, event, "event"); @@ -128,12 +128,12 @@ public static String rewrite(String script, ItemCollection workitem, ItemCollect // is the result. We need to remove the [0] here! script = script.replace(")[0]", ")"); - converterLog=converterLog+"\n***************************************************"; - converterLog=converterLog+"\n*** PLEASE REPLACE YOUR SCRIPT WITH: ***"; - converterLog=converterLog+"\n***************************************************\n"; - converterLog=converterLog+"\n" + script + "\n"; - converterLog=converterLog+"\n***************************************************\n"; - logger.warning(converterLog); + converterLog.append("\n***************************************************") + .append("\n*** PLEASE REPLACE YOUR SCRIPT WITH: ***") + .append("\n***************************************************\n") + .append("\n").append(script).append("\n") + .append("\n***************************************************\n"); + logger.warning(converterLog.toString()); return script; } diff --git a/imixs-workflow-core/src/main/java/org/imixs/workflow/WorkflowKernel.java b/imixs-workflow-core/src/main/java/org/imixs/workflow/WorkflowKernel.java index abb3065c6..ec5b2fcf1 100644 --- a/imixs-workflow-core/src/main/java/org/imixs/workflow/WorkflowKernel.java +++ b/imixs-workflow-core/src/main/java/org/imixs/workflow/WorkflowKernel.java @@ -114,7 +114,7 @@ public class WorkflowKernel { private List splitWorkitems = null; private RuleEngine ruleEngine = null; - private static Logger logger = Logger.getLogger(WorkflowKernel.class.getName()); + private static final Logger logger = Logger.getLogger(WorkflowKernel.class.getName()); /** * Constructor initialize the contextObject and plugin vectors @@ -182,8 +182,8 @@ public void registerPlugin(final Plugin plugin) throws PluginException { } } if (!found) { - logger.warning("Plugin '" + plugin.getClass().getName() + "' depends on unregistered Plugin class '" - + dependency + "'"); + logger.log(Level.WARNING, "Plugin ''{0}'' depends on unregistered Plugin class ''{1}''", + new Object[]{plugin.getClass().getName(), dependency}); } } } @@ -212,7 +212,7 @@ public void registerPlugin(final String pluginClass) throws PluginException { if ((pluginClass != null) && (!"".equals(pluginClass))) { if (logger.isLoggable(Level.FINEST)) - logger.finest("......register plugin class: " + pluginClass + "..."); + logger.log(Level.FINEST, "......register plugin class: {0}...", pluginClass); Class clazz = null; try { @@ -244,7 +244,7 @@ public void registerPlugin(final String pluginClass) throws PluginException { public void unregisterPlugin(final String pluginClass) throws PluginException { boolean debug = logger.isLoggable(Level.FINE); if (debug) { - logger.finest("......unregisterPlugin " + pluginClass); + logger.log(Level.FINEST, "......unregisterPlugin {0}", pluginClass); } for (Plugin plugin : pluginRegistry) { if (plugin.getClass().getName().equals(pluginClass)) { @@ -424,7 +424,7 @@ private ItemCollection findNextTask(ItemCollection documentContext, ItemCollecti int iNewProcessID = event.getItemValueInteger("numnextprocessid"); if (debug) { - logger.finest("......next $taskID=" + iNewProcessID + ""); + logger.log(Level.FINEST, "......next $taskID={0}", iNewProcessID); } // test if we have an conditional exclusive Task exits... itemColNextTask = findConditionalExclusiveTask(event, documentContext); @@ -503,8 +503,8 @@ private ItemCollection updateEventList(final ItemCollection documentContext, fin if (iNextID > 0) { // load activity if (debug) { - logger.finest("......processing=" + documentContext.getItemValueString(UNIQUEID) - + " -> loading next activityID = " + iNextID); + logger.log(Level.FINEST, "......processing={0} -> loading next activityID = {1}", + new Object[]{documentContext.getItemValueString(UNIQUEID), iNextID}); } vActivityList.remove(0); // update document context @@ -571,8 +571,9 @@ private ItemCollection updateModelVersionByEvent(final ItemCollection documentCo } } - logger.info("⚙ set model : " + documentResult.getItemValueString(UNIQUEID) + " (" - + documentResult.getItemValueString(MODELVERSION) + ")"); + logger.log(Level.INFO, "\u2699 set model : {0} ({1})", + new Object[]{documentResult.getItemValueString(UNIQUEID), + documentResult.getItemValueString(MODELVERSION)}); } return documentResult; } @@ -673,12 +674,12 @@ private void updateWorkflowStatus(ItemCollection documentResult, ItemCollection // Update the attributes $taskID and $WorkflowStatus documentResult.setTaskID(Integer.valueOf(itemColNextTask.getItemValueInteger("numprocessid"))); if (debug) { - logger.finest("......new $taskID=" + documentResult.getTaskID()); + logger.log(Level.FINEST, "......new $taskID={0}", documentResult.getTaskID()); } documentResult.replaceItemValue(WORKFLOWSTATUS, itemColNextTask.getItemValueString("txtname")); documentResult.replaceItemValue(WORKFLOWGROUP, itemColNextTask.getItemValueString("txtworkflowgroup")); if (debug) { - logger.finest("......new $workflowStatus=" + documentResult.getItemValueString(WORKFLOWSTATUS)); + logger.log(Level.FINEST, "......new $workflowStatus={0}", documentResult.getItemValueString(WORKFLOWSTATUS)); } // update deprecated attributes txtworkflowStatus and txtworkflowGroup documentResult.replaceItemValue("txtworkflowStatus", documentResult.getItemValueString(WORKFLOWSTATUS)); @@ -716,8 +717,8 @@ private void executeSignalAdapters(ItemCollection documentResult, ItemCollection if (adapter != null) { if (adapter instanceof GenericAdapter) { - logger.warning("...GenericAdapter '" + adapterClass - + "' should not be associated with a Signal Event. Adapter will not be executed."); + logger.log(Level.WARNING, "...GenericAdapter ''{0}'' should not be associated with a Signal Event." + + " Adapter will not be executed.", adapterClass); // ...stop execution as the GenericAdapter was already executed by the method // executeGenericAdapters... } else { @@ -784,7 +785,7 @@ private void executeAdaper(Adapter adapter, ItemCollection workitem, ItemCollect workitem.removeItem("adapter.error_message"); workitem = adapter.execute(workitem, event); } catch (AdapterException e) { - logger.warning("...execution of adapter failed: " + e.getMessage()); + logger.log(Level.WARNING, "...execution of adapter failed: {0}", e.getMessage()); // update workitem with adapter exception.... workitem.setItemValue("adapter.error_context", e.getErrorContext()); workitem.setItemValue("adapter.error_code", e.getErrorCode()); @@ -840,7 +841,7 @@ private ItemCollection findConditionalExclusiveTask(ItemCollection event, ItemCo boolean bmatch = ruleEngine.evaluateBooleanExpression(expression, documentContext); if (bmatch) { if (debug) { - logger.finest("......matching conditional event: " + expression); + logger.log(Level.FINEST, "......matching conditional event: {0}", expression); } ItemCollection conditionslTask = this.ctx.getModelManager() .getModel(documentContext.getModelVersion()).getTask(taskID); @@ -855,7 +856,7 @@ private ItemCollection findConditionalExclusiveTask(ItemCollection event, ItemCo boolean bmatch = ruleEngine.evaluateBooleanExpression(expression, documentContext); if (bmatch) { if (debug) { - logger.finest("......matching conditional event: " + expression); + logger.log(Level.FINEST, "......matching conditional event: {0}", expression); } // we update the documentContext.... ItemCollection itemColEvent = this.ctx.getModelManager() @@ -920,7 +921,7 @@ private ItemCollection findConditionalSplitTask(ItemCollection event, ItemCollec boolean bmatch = ruleEngine.evaluateBooleanExpression(expression, documentContext); if (bmatch) { if (debug) { - logger.finest("......matching split Task found: " + expression); + logger.log(Level.FINEST, "......matching split Task found: {0}", expression); } ItemCollection itemColNextTask = this.ctx.getModelManager() .getModel(documentContext.getModelVersion()).getTask(taskID); @@ -936,7 +937,7 @@ private ItemCollection findConditionalSplitTask(ItemCollection event, ItemCollec boolean bmatch = ruleEngine.evaluateBooleanExpression(expression, documentContext); if (bmatch) { if (debug) { - logger.finest("......matching split Event found: " + expression); + logger.log(Level.FINEST, "......matching split Event found: {0}", expression); } // we update the documentContext.... ItemCollection itemColEvent = this.ctx.getModelManager() @@ -1006,7 +1007,7 @@ private void evaluateSplitEvent(ItemCollection event, ItemCollection documentCon + "." + +event.getItemValueInteger("numActivityid") + " (" + event.getModelVersion() + ") evaluate to false must not be connected to a task. "; - logger.warning(sErrorMessage + " Condition = " + expression); + logger.log(Level.WARNING, "{0} Condition = {1}", new Object[]{sErrorMessage, expression}); throw new ModelException(ModelException.INVALID_MODEL, sErrorMessage); } } @@ -1016,7 +1017,7 @@ private void evaluateSplitEvent(ItemCollection event, ItemCollection documentCon boolean bmatch = ruleEngine.evaluateBooleanExpression(expression, documentContext); if (!bmatch) { if (debug) { - logger.finest("......matching conditional event: " + expression); + logger.log(Level.FINEST, "......matching conditional event: {0}", expression); } // we update the documentContext.... ItemCollection itemColEvent = this.ctx.getModelManager() @@ -1031,7 +1032,7 @@ private void evaluateSplitEvent(ItemCollection event, ItemCollection documentCon // clone current instance to a new version... ItemCollection cloned = createVersion(documentContext); if (debug) { - logger.finest("......created new version=" + cloned.getUniqueID()); + logger.log(Level.FINEST, "......created new version={0}", cloned.getUniqueID()); } // set new $taskID cloned.setTaskID(Integer.valueOf(itemColNextTask.getItemValueInteger("numprocessid"))); @@ -1118,7 +1119,7 @@ private ItemCollection appendActivityID(final ItemCollection documentContext, fi documentResult.replaceItemValue(ACTIVITYIDLIST, vActivityList); if (debug) { - logger.finest("......append new Activity ID=" + aID); + logger.log(Level.FINEST, "......append new Activity ID={0}", aID); } return documentResult; @@ -1178,8 +1179,8 @@ private ItemCollection logEvent(final ItemCollection documentContext, final Item // test if the log has exceeded the maximum count of entries while (logEntries.size() > MAXIMUM_ACTIVITYLOGENTRIES) { if (debug) { - logger.finest("......maximum activity log entries=" + MAXIMUM_ACTIVITYLOGENTRIES - + " exceeded, remove first entry..."); + logger.log(Level.FINEST, "......maximum activity log entries={0} exceeded, remove first entry...", + MAXIMUM_ACTIVITYLOGENTRIES); } logEntries.remove(0); } @@ -1222,7 +1223,7 @@ private ItemCollection loadEvent(final ItemCollection documentContext) { "[loadEvent] model entry " + taskID + "." + eventID + " not found for model version '" + version + "'"); if (debug) { - logger.finest(".......event: " + taskID + "." + eventID + " loaded"); + logger.log(Level.FINEST, ".......event: {0}.{1} loaded", new Object[]{taskID, eventID}); } // Check for loop in edge history if (vectorEdgeHistory != null && vectorEdgeHistory.indexOf((taskID + "." + eventID)) != -1) { @@ -1252,18 +1253,18 @@ private ItemCollection runPlugins(final ItemCollection documentContext, final It sPluginName = plugin.getClass().getName(); if (debug) { - logger.finest("......running Plugin: " + sPluginName + "..."); + logger.log(Level.FINEST, "......running Plugin: {0}...", sPluginName); } long lPluginTime = System.currentTimeMillis(); documentResult = plugin.run(documentResult, event); if (debug) { - logger.fine("...Plugin '" + sPluginName + "' processing time=" - + (System.currentTimeMillis() - lPluginTime) + "ms"); + logger.log(Level.FINE, "...Plugin ''{0}'' processing time={1}ms", + new Object[]{sPluginName, System.currentTimeMillis() - lPluginTime}); } if (documentResult == null) { - logger.severe("[runPlugins] PLUGIN_ERROR: " + sPluginName); + logger.log(Level.SEVERE, "[runPlugins] PLUGIN_ERROR: {0}", sPluginName); for (String sLogEntry : localPluginLog) - logger.severe("[runPlugins] " + sLogEntry); + logger.log(Level.SEVERE, "[runPlugins] {0}", sLogEntry); throw new PluginException(WorkflowKernel.class.getSimpleName(), PLUGIN_ERROR, "plugin: " + sPluginName + " returned null"); @@ -1279,12 +1280,12 @@ private ItemCollection runPlugins(final ItemCollection documentContext, final It } catch (PluginException e) { // log plugin stack!.... - logger.severe( - "Plugin-Error at " + e.getErrorContext() + ": " + e.getErrorCode() + " (" + e.getMessage() + ")"); + logger.log(Level.SEVERE, "Plugin-Error at {0}: {1} ({2})", + new Object[]{e.getErrorContext(), e.getErrorCode(), e.getMessage()}); if (debug) { logger.severe("Last Plugins run successfull:"); for (String sLogEntry : localPluginLog) - logger.severe(" ..." + sLogEntry); + logger.log(Level.SEVERE, " ...{0}", sLogEntry); } throw e; } @@ -1295,7 +1296,7 @@ private void closePlugins(boolean rollbackTransaction) throws PluginException { for (int i = 0; i < pluginRegistry.size(); i++) { Plugin plugin = (Plugin) pluginRegistry.get(i); if (logger.isLoggable(Level.FINEST)) - logger.finest("closing Plugin: " + plugin.getClass().getName() + "..."); + logger.log(Level.FINEST, "closing Plugin: {0}...", plugin.getClass().getName()); plugin.close(rollbackTransaction); } } diff --git a/imixs-workflow-core/src/main/java/org/imixs/workflow/bpmn/BPMNModel.java b/imixs-workflow-core/src/main/java/org/imixs/workflow/bpmn/BPMNModel.java index c93336b40..893624b10 100644 --- a/imixs-workflow-core/src/main/java/org/imixs/workflow/bpmn/BPMNModel.java +++ b/imixs-workflow-core/src/main/java/org/imixs/workflow/bpmn/BPMNModel.java @@ -34,6 +34,7 @@ import java.util.List; import java.util.Map; import java.util.TreeMap; +import java.util.logging.Level; import java.util.logging.Logger; import java.util.stream.Collectors; import org.imixs.workflow.ItemCollection; @@ -112,7 +113,7 @@ public class BPMNModel implements Model { private List workflowGroups = null; private ItemCollection definition = null; private byte[] rawData = null; - private static Logger logger = Logger.getLogger(BPMNModel.class.getName()); + private static final Logger logger = Logger.getLogger(BPMNModel.class.getName()); public BPMNModel() { taskList = new TreeMap(); @@ -383,7 +384,7 @@ protected void addTask(ItemCollection entity) throws ModelException { return; if (!"ProcessEntity".equals(entity.getItemValueString("type"))) { - logger.warning("Invalid Process Entity - wrong type '" + entity.getItemValueString("type") + "'"); + logger.log(Level.WARNING, "Invalid Process Entity - wrong type ''{0}''", entity.getItemValueString("type")); throw new ModelException(ModelException.INVALID_MODEL_ENTRY, "Invalid Process Entity - wrong type '" + entity.getItemValueString("type") + "'"); } @@ -409,7 +410,7 @@ protected void addEvent(ItemCollection aentity) throws ModelException { ItemCollection clonedEntity = new ItemCollection(aentity); if (!"ActivityEntity".equals(clonedEntity.getItemValueString("type"))) { - logger.warning("Invalid Activity Entity - wrong type '" + clonedEntity.getItemValueString("type") + "'"); + logger.log(Level.WARNING, "Invalid Activity Entity - wrong type ''{0}''", clonedEntity.getItemValueString("type")); } int pID = clonedEntity.getItemValueInteger("numprocessid"); @@ -423,8 +424,7 @@ protected void addEvent(ItemCollection aentity) throws ModelException { String activitymodelversion = clonedEntity.getItemValueString(WorkflowKernel.MODELVERSION); ItemCollection process = this.getTask(pID); if (process == null) { - logger.warning("Invalid Activiyt Entity - no numprocessid defined in model version '" + activitymodelversion - + "' "); + logger.log(Level.WARNING, "Invalid Activiyt Entity - no numprocessid defined in model version ''{0}'' ", activitymodelversion); throw new ModelException(ModelException.INVALID_MODEL_ENTRY, "Invalid Activiyt Entity - no numprocessid defined!"); } diff --git a/imixs-workflow-core/src/main/java/org/imixs/workflow/bpmn/BPMNModelHandler.java b/imixs-workflow-core/src/main/java/org/imixs/workflow/bpmn/BPMNModelHandler.java index e035e5339..c95497381 100644 --- a/imixs-workflow-core/src/main/java/org/imixs/workflow/bpmn/BPMNModelHandler.java +++ b/imixs-workflow-core/src/main/java/org/imixs/workflow/bpmn/BPMNModelHandler.java @@ -34,6 +34,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.logging.Level; import java.util.logging.Logger; import org.imixs.workflow.ItemCollection; import org.imixs.workflow.WorkflowKernel; @@ -61,7 +62,7 @@ */ public class BPMNModelHandler extends DefaultHandler { - private static Logger logger = Logger.getLogger(BPMNModelHandler.class.getName()); + private static final Logger logger = Logger.getLogger(BPMNModelHandler.class.getName()); private boolean bDefinitions = false; private boolean bMessage = false; @@ -165,7 +166,7 @@ public BPMNModelHandler() { @Override public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { - logger.finest("......Start Element :" + qName); + logger.log(Level.FINEST, "......Start Element :{0}", qName); // bpmn2:definitions if (qName.equalsIgnoreCase("bpmn2:definitions")) { @@ -504,7 +505,7 @@ public void endElement(String uri, String localName, String qName) throws SAXExc // test conditional sequence flow... if (bSequenceFlow && bconditionExpression && qName.equalsIgnoreCase("bpmn2:conditionExpression")) { String svalue = characterStream.toString(); - logger.finest("......conditional SequenceFlow:" + bpmnID + "=" + svalue); + logger.log(Level.FINEST, "......conditional SequenceFlow:{0}={1}", new Object[]{bpmnID, svalue}); bconditionExpression = false; conditionCache.put(bpmnID, svalue); } @@ -607,9 +608,10 @@ public BPMNModel buildModel() throws ModelException { // we need a new pid! pId = processIDList.get(processIDList.size() - 1); pId = pId + 100; - logger.warning("Task " + task.getItemValueInteger("numProcessID") + " (" - + task.getItemValueString("txtname") + ") is not unique, assigning new ProcessID " + pId - + ". Please verify the XML content."); + logger.log(Level.WARNING, "Task {0} ({1}) is not unique," + + " assigning new ProcessID {2}. Please verify the XML content.", + new Object[]{task.getItemValueInteger("numProcessID"), + task.getItemValueString("txtname"), pId}); task.replaceItemValue("numProcessID", pId); // update task in cache taskCache.put(key, task); @@ -667,7 +669,7 @@ public BPMNModel buildModel() throws ModelException { task.setItemValue("boundaryEvent.targetEvent", targetEvent.getItemValueInteger("numactivityid")); } else { - logger.warning("Invalid Target for BoundaryEvent " + key); + logger.log(Level.WARNING, "Invalid Target for BoundaryEvent {0}", key); } } } @@ -912,8 +914,8 @@ private List findSourceTasks(String eventID) throws ModelExcepti } } - logger.finest( - "......Imixs BPMN Event '" + eventID + "' is directly assigend to " + result.size() + " task elements"); + logger.log(Level.FINEST, "......Imixs BPMN Event ''{0}'' is directly assigend to {1} task elements", + new Object[]{eventID, result.size()}); return result; } @@ -957,14 +959,14 @@ private void addImixsEvent(String eventID, ItemCollection sourceTask) throws Mod try { if (model.getEvent(sourceTask.getItemValueInteger("numProcessID"), event.getItemValueInteger("numactivityid")) != null) { - logger.finest("......Imixs BPMN Event '" + eventName + "' is already assigned to a source task!"); + logger.log(Level.FINEST, "......Imixs BPMN Event ''{0}'' is already assigned to a source task!", eventName); return; } } catch (ModelException me1) { // ok we need to add the event.... } - logger.finest("......adding event '" + eventName + "'"); + logger.log(Level.FINEST, "......adding event ''{0}''", eventName); List outFlows = findOutgoingFlows(eventID); if (outFlows == null || outFlows.size() == 0) { @@ -1004,8 +1006,8 @@ private void addImixsEvent(String eventID, ItemCollection sourceTask) throws Mod if (targetTask != null) { String sExpression = findConditionBySquenceFlow(condFlow); if (sExpression != null && !sExpression.trim().isEmpty()) { - logger.finest("......add condition: " - + targetTask.getItemValueInteger("numProcessid") + "=" + sExpression); + logger.log(Level.FINEST, "......add condition: {0}={1}", + new Object[]{targetTask.getItemValueInteger("numProcessid"), sExpression}); conditions.put("task=" + targetTask.getItemValueInteger("numProcessid"), sExpression); } else { @@ -1013,8 +1015,8 @@ private void addImixsEvent(String eventID, ItemCollection sourceTask) throws Mod // check if it is a default flow? String defaultSequenceFlow = conditionDefaultFlows.get(conditionalGatewayID); if (defaultSequenceFlow != null && !defaultSequenceFlow.isEmpty()) { - logger.finest("......add default condition: " - + targetTask.getItemValueInteger("numProcessid")); + logger.log(Level.FINEST, "......add default condition: {0}", + targetTask.getItemValueInteger("numProcessid")); defaultCondition = "task=" + targetTask.getItemValueInteger("numProcessid"); } @@ -1026,8 +1028,8 @@ private void addImixsEvent(String eventID, ItemCollection sourceTask) throws Mod if (targetEvent != null) { String sExpression = findConditionBySquenceFlow(condFlow); if (sExpression != null && !sExpression.trim().isEmpty()) { - logger.finest("......add condition: " - + targetEvent.getItemValueInteger("numActivityid") + "=" + sExpression); + logger.log(Level.FINEST, "......add condition: {0}={1}", + new Object[]{targetEvent.getItemValueInteger("numActivityid"), sExpression}); conditions.put("event=" + targetEvent.getItemValueInteger("numActivityid"), sExpression); } else { @@ -1035,8 +1037,8 @@ private void addImixsEvent(String eventID, ItemCollection sourceTask) throws Mod // check if it is a default flow? String defaultSequenceFlow = conditionDefaultFlows.get(conditionalGatewayID); if (defaultSequenceFlow != null && !defaultSequenceFlow.isEmpty()) { - logger.finest("......add devault condition: " - + targetEvent.getItemValueInteger("numActivityid")); + logger.log(Level.FINEST, "......add devault condition: {0}", + targetEvent.getItemValueInteger("numActivityid")); defaultCondition = "event=" + targetEvent.getItemValueInteger("numActivityid"); } @@ -1079,8 +1081,8 @@ private void addImixsEvent(String eventID, ItemCollection sourceTask) throws Mod if (targetTask != null) { String sExpression = findConditionBySquenceFlow(parallelFlow); if (sExpression != null && !sExpression.trim().isEmpty()) { - logger.finest("......add condition: " - + targetTask.getItemValueInteger("numProcessid") + "=" + sExpression); + logger.log(Level.FINEST, "......add condition: {0}={1}", + new Object[]{targetTask.getItemValueInteger("numProcessid"), sExpression}); conditions.put("task=" + targetTask.getItemValueInteger("numProcessid"), sExpression); } @@ -1091,8 +1093,8 @@ private void addImixsEvent(String eventID, ItemCollection sourceTask) throws Mod if (targetEvent != null) { String sExpression = findConditionBySquenceFlow(parallelFlow); if (sExpression != null && !sExpression.trim().isEmpty()) { - logger.finest("......add condition: " - + targetEvent.getItemValueInteger("numActivityid") + "=" + sExpression); + logger.log(Level.FINEST, "......add condition: {0}={1}", + new Object[]{targetEvent.getItemValueInteger("numActivityid"), sExpression}); conditions.put("event=" + targetEvent.getItemValueInteger("numActivityid"), sExpression); } @@ -1161,7 +1163,7 @@ private void addImixsEvent(String eventID, ItemCollection sourceTask) throws Mod for (SequenceFlow _outLink : outLinkFlows) { if (linkThrowEventCache.containsKey(_outLink.target)) { outgoingLink = _outLink.target; - logger.fine("...event is associated with link event: " + outgoingLink); + logger.log(Level.FINE, "...event is associated with link event: {0}", outgoingLink); } } if (outgoingLink != null) { @@ -1207,8 +1209,8 @@ private void addImixsEvent(String eventID, ItemCollection sourceTask) throws Mod if (signalName != null && !signalName.isEmpty()) { event.setItemValue("adapter.id", signalName); } else { - logger.warning("Event " + event.getItemValueInteger("id") + " Signal Ref " + signalRefID - + " is not defined!"); + logger.log(Level.WARNING, "Event {0} Signal Ref {1} is not defined!", + new Object[]{event.getItemValueInteger("id"), signalRefID}); } } @@ -1238,7 +1240,8 @@ private ItemCollection verifyActiviytIdForEvent(ItemCollection event) { if (aid == activityid) { // problem! String name = event.getItemValueString("txtname"); - logger.warning("ActivityID " + name + " ID=" + activityid + " is not unique for task " + processid); + logger.log(Level.WARNING, "ActivityID {0} ID={1} is not unique for task {2}", + new Object[]{name, activityid, processid}); activityid = -1; } } @@ -1246,7 +1249,7 @@ private ItemCollection verifyActiviytIdForEvent(ItemCollection event) { // suggest new activityid? if (activityid <= 0) { // replace id - logger.warning("new ActivityID suggested for task " + processid + "=" + bestID); + logger.log(Level.WARNING, "new ActivityID suggested for task {0}={1}", new Object[]{processid, bestID}); event.replaceItemValue("numactivityid", bestID); // processCache.put(eventID, event); diff --git a/imixs-workflow-core/src/main/java/org/imixs/workflow/bpmn/BPMNParser.java b/imixs-workflow-core/src/main/java/org/imixs/workflow/bpmn/BPMNParser.java index b9807c392..8de885e0c 100644 --- a/imixs-workflow-core/src/main/java/org/imixs/workflow/bpmn/BPMNParser.java +++ b/imixs-workflow-core/src/main/java/org/imixs/workflow/bpmn/BPMNParser.java @@ -33,6 +33,7 @@ import java.io.IOException; import java.io.InputStream; import java.text.ParseException; +import java.util.logging.Level; import java.util.logging.Logger; import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.SAXParser; @@ -56,7 +57,7 @@ */ public class BPMNParser { - private static Logger logger = Logger.getLogger(BPMNParser.class.getName()); + private static final Logger logger = Logger.getLogger(BPMNParser.class.getName()); /** * This method parses a BPMN model from a input stream and returns a instance of @@ -96,8 +97,8 @@ public final static BPMNModel parseModel(InputStream bpmnInputStream, String enc // store file content from input stream into the BPMNmodel model.setRawData(rawData); - logger.fine( - "...BPMN Model '" + model.getVersion() + "' parsed in " + (System.currentTimeMillis() - lTime) + "ms"); + logger.log(Level.FINE, "...BPMN Model ''{0}'' parsed in {1}ms", + new Object[]{model.getVersion(), System.currentTimeMillis() - lTime}); return model; } diff --git a/imixs-workflow-core/src/main/java/org/imixs/workflow/services/rest/FormAuthenticator.java b/imixs-workflow-core/src/main/java/org/imixs/workflow/services/rest/FormAuthenticator.java index 2935090fe..245fc7587 100644 --- a/imixs-workflow-core/src/main/java/org/imixs/workflow/services/rest/FormAuthenticator.java +++ b/imixs-workflow-core/src/main/java/org/imixs/workflow/services/rest/FormAuthenticator.java @@ -40,6 +40,7 @@ import java.net.HttpURLConnection; import java.net.URL; import java.util.List; +import java.util.logging.Level; import java.util.logging.Logger; /** @@ -58,7 +59,7 @@ public class FormAuthenticator implements RequestFilter { public FormAuthenticator(String baseUri, String username, String password) { // extend the base uri with /j_security_check.... baseUri += "/j_security_check"; - logger.finest("......baseUIR= " + baseUri); + logger.log(Level.FINEST, "......baseUIR= {0}", baseUri); // Access secure page on server. In response to this request we will receive // the JSESSIONID to be used for further requests. try { @@ -85,7 +86,7 @@ public FormAuthenticator(String baseUri, String username, String password) { wr.flush(); wr.close(); int responseCode = con.getResponseCode(); - logger.finest(".....Response Code : " + responseCode); + logger.log(Level.FINEST, ".....Response Code : {0}", responseCode); con.connect(); // get cookies from underlying CookieStore CookieStore cookieJar = manager.getCookieStore(); diff --git a/imixs-workflow-core/src/main/java/org/imixs/workflow/services/rest/RestClient.java b/imixs-workflow-core/src/main/java/org/imixs/workflow/services/rest/RestClient.java index 88b120b6d..c7ef8f68e 100644 --- a/imixs-workflow-core/src/main/java/org/imixs/workflow/services/rest/RestClient.java +++ b/imixs-workflow-core/src/main/java/org/imixs/workflow/services/rest/RestClient.java @@ -43,6 +43,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.logging.Level; import java.util.logging.Logger; /** @@ -89,7 +90,7 @@ public RestClient(String rootURL) { * @param filter - request filter instance. */ public void registerRequestFilter(RequestFilter filter) { - logger.finest("......register new request filter: " + filter.getClass().getSimpleName()); + logger.log(Level.FINEST, "......register new request filter: {0}", filter.getClass().getSimpleName()); // client.register(filter); requestFilterList.add(filter); @@ -227,20 +228,22 @@ public String post(String uri, String dataString, final String _contentType, Str printWriter.close(); iLastHTTPResult = urlConnection.getResponseCode(); - logger.finest("......Sending 'POST' request to URL : " + serviceEndpoint); - logger.finest("......Response Code : " + iLastHTTPResult); + logger.log(Level.FINEST, "......Sending ''POST'' request to URL : {0}", serviceEndpoint); + logger.log(Level.FINEST, "......Response Code : {0}", iLastHTTPResult); // read response if response was successful if (iLastHTTPResult >= 200 && iLastHTTPResult <= 299) { return readResponse(urlConnection); } else { - String error = "Error " + iLastHTTPResult + " - failed POST request: '" + uri + "'"; + String error = new StringBuilder("Error ").append(iLastHTTPResult) + .append(" - failed POST request: '").append(uri).append("'").toString(); logger.warning(error); throw new RestAPIException(iLastHTTPResult, error); } } catch (IOException ioe) { - String error = "Error POST request '" + uri + " - " + ioe.getMessage(); + String error = new StringBuilder("Error POST request '").append(uri).append(" - ") + .append(ioe.getMessage()).toString(); logger.warning(error); throw new RestAPIException(500, error, ioe); } finally { @@ -331,20 +334,22 @@ public String post(String uri, byte[] data, final String _contentType, String ac httpRequestBodyWriter.close(); iLastHTTPResult = urlConnection.getResponseCode(); - logger.finest("......Sending 'POST' request to URL : " + serviceEndpoint); - logger.finest("......Response Code : " + iLastHTTPResult); + logger.log(Level.FINEST, "......Sending ''POST'' request to URL : {0}", serviceEndpoint); + logger.log(Level.FINEST, "......Response Code : {0}", iLastHTTPResult); // read response if response was successful if (iLastHTTPResult >= 200 && iLastHTTPResult <= 299) { return readResponse(urlConnection); } else { - String error = "Error " + iLastHTTPResult + " - failed POST request: '" + uri + "'"; + String error = new StringBuilder("Error ").append(iLastHTTPResult) + .append(" - failed POST request: '").append(uri).append("'").toString(); logger.warning(error); throw new RestAPIException(iLastHTTPResult, error); } } catch (IOException ioe) { - String error = "Error POST request '" + uri + " - " + ioe.getMessage(); + String error = new StringBuilder("Error POST request '") + .append(uri).append(" - ").append(ioe.getMessage()).toString(); logger.warning(error); throw new RestAPIException(500, error, ioe); } finally { @@ -393,18 +398,20 @@ public String get(String uri) throws RestAPIException { } iLastHTTPResult = urlConnection.getResponseCode(); - logger.finest("......Sending 'GET' request to URL : " + serviceEndpoint); - logger.finest("......Response Code : " + iLastHTTPResult); + logger.log(Level.FINEST, "......Sending ''GET'' request to URL : {0}", serviceEndpoint); + logger.log(Level.FINEST, "......Response Code : {0}", iLastHTTPResult); // read response if response was successful if (iLastHTTPResult >= 200 && iLastHTTPResult <= 299) { return readResponse(urlConnection); } else { - String error = "Error " + iLastHTTPResult + " - failed GET request from '" + uri + "'"; + String error = new StringBuilder("Error ").append(iLastHTTPResult) + .append(" - failed GET request from '").append(uri).append("'").toString(); logger.warning(error); throw new RestAPIException(iLastHTTPResult, error); } } catch (IOException e) { - String error = "Error GET request from '" + uri + " - " + e.getMessage(); + String error = new StringBuilder("Error GET request from '") + .append(uri).append(" - ").append(e.getMessage()).toString(); logger.warning(error); throw new RestAPIException(0, error, e); @@ -438,7 +445,7 @@ private String readResponse(URLConnection urlConnection) throws IOException { in = new BufferedReader(new InputStreamReader(urlConnection.getInputStream())); String inputLine; while ((inputLine = in.readLine()) != null) { - logger.finest("......" + inputLine); + logger.log(Level.FINEST, "......{0}", inputLine); writer.write(inputLine); } } catch (IOException e) { diff --git a/imixs-workflow-core/src/main/java/org/imixs/workflow/util/JSONParser.java b/imixs-workflow-core/src/main/java/org/imixs/workflow/util/JSONParser.java index be6e50a90..fc78faecf 100644 --- a/imixs-workflow-core/src/main/java/org/imixs/workflow/util/JSONParser.java +++ b/imixs-workflow-core/src/main/java/org/imixs/workflow/util/JSONParser.java @@ -59,7 +59,7 @@ */ public class JSONParser { - private static Logger logger = Logger.getLogger(JSONParser.class.getName()); + private static final Logger logger = Logger.getLogger(JSONParser.class.getName()); /** * This method extracts a single key from a JSON structure. It does not matter @@ -196,7 +196,7 @@ public final static ItemCollection parseWorkitem(final InputStream requestBodySt while ((inputLine = in.readLine()) != null) { stringBuffer.append(inputLine); if (debug) { - logger.finest("......parseWorkitem - read line:" + inputLine + ""); + logger.log(Level.FINEST, "......parseWorkitem - read line:{0}", inputLine); } } content = stringBuffer.toString(); @@ -376,7 +376,7 @@ private static void storeValue(String name, String token, ItemCollection workite // frist value workitem.replaceItemValue(name, value); if (debug) { - logger.finest("......storeValue: '" + name + "' = '" + value + "'"); + logger.log(Level.FINEST, "......storeValue: ''{0}'' = ''{1}''", new Object[]{name, value}); } } else { // add value @@ -384,7 +384,7 @@ private static void storeValue(String name, String token, ItemCollection workite valueList.add(value); workitem.replaceItemValue(name, valueList); if (debug) { - logger.finest("......store multivalue: '" + name + "' = '" + value + "'"); + logger.log(Level.FINEST, "......store multivalue: ''{0}'' = ''{1}''", new Object[]{name, value}); } } diff --git a/imixs-workflow-core/src/main/java/org/imixs/workflow/util/XMLParser.java b/imixs-workflow-core/src/main/java/org/imixs/workflow/util/XMLParser.java index e114be4a8..b2117cce8 100644 --- a/imixs-workflow-core/src/main/java/org/imixs/workflow/util/XMLParser.java +++ b/imixs-workflow-core/src/main/java/org/imixs/workflow/util/XMLParser.java @@ -69,7 +69,7 @@ */ public class XMLParser { - private static Logger logger = Logger.getLogger(XMLParser.class.getName()); + private static final Logger logger = Logger.getLogger(XMLParser.class.getName()); /** * This method parses a xml tag for attributes. The method returns a Map with @@ -375,7 +375,7 @@ public static ItemCollection parseTag(String xmlContent, String tag) throws Plug result.appendItemValue(name, value); //result.replaceItemValue(name, value); if (debug) { - logger.finest("......parsing item '" + name + "' value=" + value); + logger.log(Level.FINEST, "......parsing item ''{0}'' value={1}", new Object[]{name, value}); } } } diff --git a/imixs-workflow-core/src/main/java/org/imixs/workflow/xml/XMLDataCollectionAdapter.java b/imixs-workflow-core/src/main/java/org/imixs/workflow/xml/XMLDataCollectionAdapter.java index 0f0907c43..877fc84cc 100644 --- a/imixs-workflow-core/src/main/java/org/imixs/workflow/xml/XMLDataCollectionAdapter.java +++ b/imixs-workflow-core/src/main/java/org/imixs/workflow/xml/XMLDataCollectionAdapter.java @@ -58,7 +58,7 @@ */ public class XMLDataCollectionAdapter { - private static Logger logger = Logger.getLogger(XMLDataCollectionAdapter.class.getName()); + private static final Logger logger = Logger.getLogger(XMLDataCollectionAdapter.class.getName()); /** * This Method converts a org.imixs.workflow.xml.DocumentCollection @@ -204,7 +204,7 @@ public static List readCollection(byte[] byteInput) throws JAXBE resultList.add(XMLDocumentAdapter.putDocument(aentity)); } if (debug) { - logger.fine("readCollection" + ecol.getDocument().length + " entries sucessfull imported"); + logger.log(Level.FINE, "readCollection{0} entries sucessfull imported", ecol.getDocument().length); } } return resultList; diff --git a/imixs-workflow-core/src/main/java/org/imixs/workflow/xml/XMLDocumentAdapter.java b/imixs-workflow-core/src/main/java/org/imixs/workflow/xml/XMLDocumentAdapter.java index 2124ff3de..d544b8d3e 100644 --- a/imixs-workflow-core/src/main/java/org/imixs/workflow/xml/XMLDocumentAdapter.java +++ b/imixs-workflow-core/src/main/java/org/imixs/workflow/xml/XMLDocumentAdapter.java @@ -59,7 +59,7 @@ */ public class XMLDocumentAdapter { - private static Logger logger = Logger.getLogger(XMLDocumentAdapter.class.getName()); + private static final Logger logger = Logger.getLogger(XMLDocumentAdapter.class.getName()); /** * This Method converts a org.imixs.workflow.xml.XMLItemCollection @@ -169,7 +169,7 @@ public static XMLDocument getDocument(final ItemCollection document, final List< i++; } } else { - logger.warning("putItemCollection - itemName=" + itemName + " has null value"); + logger.log(Level.WARNING, "putItemCollection - itemName={0} has null value", itemName); } } } diff --git a/imixs-workflow-core/src/main/java/org/imixs/workflow/xml/XMLItem.java b/imixs-workflow-core/src/main/java/org/imixs/workflow/xml/XMLItem.java index db70f11e1..ef2491e52 100644 --- a/imixs-workflow-core/src/main/java/org/imixs/workflow/xml/XMLItem.java +++ b/imixs-workflow-core/src/main/java/org/imixs/workflow/xml/XMLItem.java @@ -44,6 +44,7 @@ import jakarta.xml.bind.annotation.XmlAttribute; import jakarta.xml.bind.annotation.XmlRootElement; import jakarta.xml.bind.annotation.XmlSeeAlso; +import java.util.logging.Level; /** * Represents a single item inside a XMLItemCollection. An XMLItem has a name @@ -57,7 +58,7 @@ public class XMLItem implements Serializable { private static final long serialVersionUID = 1L; - private static Logger logger = Logger.getLogger(XMLItem.class.getName()); + private static final Logger logger = Logger.getLogger(XMLItem.class.getName()); private String name; @@ -136,8 +137,8 @@ public void setValue(Object[] _values) { listOfObjects.add(xmlVal); } else { conversionSuccessfull = false; - logger.warning("WARNING : XMLItem - property '" + this.name - + "' contains unsupported java types: " + aSingleObject.getClass().getName()); + logger.log(Level.WARNING, "WARNING : XMLItem - property ''{0}'' contains unsupported java types: {1}", + new Object[]{this.name, aSingleObject.getClass().getName()}); break; } } @@ -174,7 +175,7 @@ private String stripNonValidXMLCharacters(String itemValue) { || ((current >= 0x10000) && (current <= 0x10FFFF))) { out.append(current); } else { - logger.warning("invalid xml character at position " + i + " in item '" + name + "'"); + logger.log(Level.WARNING, "invalid xml character at position {0} in item ''{1}''", new Object[]{i, name}); } } return out.toString(); diff --git a/imixs-workflow-core/src/main/java/org/imixs/workflow/xml/XSLHandler.java b/imixs-workflow-core/src/main/java/org/imixs/workflow/xml/XSLHandler.java index fbf7c1fe6..b91ccef28 100644 --- a/imixs-workflow-core/src/main/java/org/imixs/workflow/xml/XSLHandler.java +++ b/imixs-workflow-core/src/main/java/org/imixs/workflow/xml/XSLHandler.java @@ -62,7 +62,7 @@ */ public class XSLHandler { - private static Logger logger = Logger.getLogger(XSLHandler.class.getName()); + private static final Logger logger = Logger.getLogger(XSLHandler.class.getName()); /** * This method transforms an XML source with a provided XSL template. The result @@ -85,7 +85,7 @@ public static void transform(String xmlSource, String xslSource, String encoding } TransformerFactory transFact = TransformerFactory.newInstance(); if (debug) { - logger.finest("......xslTransformation: encoding=" + encoding); + logger.log(Level.FINEST, "......xslTransformation: encoding={0}", encoding); } // generate XML InputStream Reader with encoding ByteArrayInputStream baisXML = new ByteArrayInputStream(xmlSource.getBytes()); diff --git a/imixs-workflow-core/src/test/java/org/imixs/workflow/TestRuleEngineBPMN.java b/imixs-workflow-core/src/test/java/org/imixs/workflow/TestRuleEngineBPMN.java index e92a46d0a..e09088210 100644 --- a/imixs-workflow-core/src/test/java/org/imixs/workflow/TestRuleEngineBPMN.java +++ b/imixs-workflow-core/src/test/java/org/imixs/workflow/TestRuleEngineBPMN.java @@ -3,6 +3,7 @@ import java.io.IOException; import java.io.InputStream; import java.text.ParseException; +import java.util.logging.Level; import java.util.logging.Logger; import javax.xml.parsers.ParserConfigurationException; @@ -49,7 +50,7 @@ public void setup() throws PluginException, ModelException { bpmnRuleEngine=new BPMNRuleEngine(model); - logger.fine("...loadModel processing time=" + (System.currentTimeMillis() - lLoadTime) + "ms"); + logger.log(Level.FINE, "...loadModel processing time={0}ms", System.currentTimeMillis() - lLoadTime); } catch (ModelException | ParseException | ParserConfigurationException | SAXException | IOException e) { e.printStackTrace(); } @@ -67,7 +68,7 @@ public void testRuleMatch() { try { Assert.assertEquals(200, bpmnRuleEngine.eval(workitem)); - logger.info("evaluate BPMN-Rule in " + (System.currentTimeMillis() - l) + "ms"); + logger.log(Level.INFO, "evaluate BPMN-Rule in {0}ms", System.currentTimeMillis() - l); // task and event must still be set to 100.10 Assert.assertEquals(10, workitem.getEventID()); @@ -88,7 +89,7 @@ public void testRuleNoMatch() { try { Assert.assertEquals(900, bpmnRuleEngine.eval(workitem)); - logger.info("evaluate BPMN-Rule in " + (System.currentTimeMillis() - l) + "ms"); + logger.log(Level.INFO, "evaluate BPMN-Rule in {0}ms", System.currentTimeMillis() - l); // task and event must still be set to 100.10 Assert.assertEquals(10, workitem.getEventID()); @@ -100,4 +101,4 @@ public void testRuleNoMatch() { } -} \ No newline at end of file +} diff --git a/imixs-workflow-core/src/test/java/org/imixs/workflow/TestRuleEngineGraalJS.java b/imixs-workflow-core/src/test/java/org/imixs/workflow/TestRuleEngineGraalJS.java index 74db726a9..b033b5a64 100644 --- a/imixs-workflow-core/src/test/java/org/imixs/workflow/TestRuleEngineGraalJS.java +++ b/imixs-workflow-core/src/test/java/org/imixs/workflow/TestRuleEngineGraalJS.java @@ -1,5 +1,6 @@ package org.imixs.workflow; +import java.util.logging.Level; import java.util.logging.Logger; import javax.script.ScriptException; @@ -18,7 +19,7 @@ */ public class TestRuleEngineGraalJS { protected RuleEngine ruleEngine = null; - private static Logger logger = Logger.getLogger(TestRuleEngineGraalJS.class.getName()); + private static final Logger logger = Logger.getLogger(TestRuleEngineGraalJS.class.getName()); @Before public void setup() throws PluginException { @@ -53,7 +54,7 @@ public void testSetItemCollectionNativ() { Context context = Context.newBuilder("js").allowAllAccess(true).build(); context.getBindings("js").putMember("workitem", workitem); context.eval("js", "var x = workitem.getItemValueInteger('age');"); - logger.info("result="+context.getBindings("js").getMember("x").asInt()); + logger.log(Level.INFO, "result={0}", context.getBindings("js").getMember("x").asInt()); } /** @@ -70,7 +71,7 @@ public void testSetItemCollection() { context.eval("js", "var x = workitem.getItemValueInteger('age');"); - logger.info("result="+context.getBindings("js").getMember("x").asInt()); + logger.log(Level.INFO, "result={0}", context.getBindings("js").getMember("x").asInt()); } diff --git a/imixs-workflow-core/src/test/java/org/imixs/workflow/TestRuleEngineGraalJSDeprecatedScripts.java b/imixs-workflow-core/src/test/java/org/imixs/workflow/TestRuleEngineGraalJSDeprecatedScripts.java index 22d5c8849..c050d19b6 100644 --- a/imixs-workflow-core/src/test/java/org/imixs/workflow/TestRuleEngineGraalJSDeprecatedScripts.java +++ b/imixs-workflow-core/src/test/java/org/imixs/workflow/TestRuleEngineGraalJSDeprecatedScripts.java @@ -19,7 +19,7 @@ public class TestRuleEngineGraalJSDeprecatedScripts { protected RuleEngine ruleEngine = null; @SuppressWarnings("unused") - private static Logger logger = Logger.getLogger(TestRuleEngineGraalJSDeprecatedScripts.class.getName()); + private static final Logger logger = Logger.getLogger(TestRuleEngineGraalJSDeprecatedScripts.class.getName()); @Before public void setup() throws PluginException { diff --git a/imixs-workflow-core/src/test/java/org/imixs/workflow/TestWorkflowKernel.java b/imixs-workflow-core/src/test/java/org/imixs/workflow/TestWorkflowKernel.java index e74867eaf..f6266b76d 100644 --- a/imixs-workflow-core/src/test/java/org/imixs/workflow/TestWorkflowKernel.java +++ b/imixs-workflow-core/src/test/java/org/imixs/workflow/TestWorkflowKernel.java @@ -24,6 +24,7 @@ import org.mockito.Mockito; import jakarta.ejb.SessionContext; +import java.util.logging.Level; /** * Test class for Imixs WorkflowKernel using a static default model. The test @@ -37,7 +38,7 @@ public class TestWorkflowKernel { protected WorkflowKernel kernel = null; protected SessionContext ctx; protected WorkflowContext workflowContext; - private static Logger logger = Logger.getLogger(TestWorkflowKernel.class.getName()); + private static final Logger logger = Logger.getLogger(TestWorkflowKernel.class.getName()); @Before public void setup() throws PluginException { @@ -295,7 +296,7 @@ public void testActivityLog() { Assert.assertNotNull(log); Assert.assertEquals(2, log.size()); - logger.info("'$eventlog'=" + log); + logger.log(Level.INFO, "''$eventlog''={0}", log); // test log entries // Format: timestamp|model-version|1000.10|1000|userid| @@ -397,7 +398,7 @@ public void testActivityLogMaxLength() { Assert.assertNotNull(log); Assert.assertEquals(30, log.size()); - logger.info("'$eventlog'=" + log); + logger.log(Level.INFO, "''$eventlog''={0}", log); // test log entries // Format: timestamp|model-version|1000.10|1000|userid| @@ -453,7 +454,7 @@ public void testActivityLogMaxLength() { @Category(org.imixs.workflow.WorkflowKernel.class) public void testUUID() { String uid = WorkflowKernel.generateUniqueID(); - logger.info("UUID=" + uid); + logger.log(Level.INFO, "UUID={0}", uid); // expected length is 36 Assert.assertEquals(36, uid.length()); } @@ -467,7 +468,7 @@ public void testUUID() { public void testTransactionID() { String tid = null; tid = WorkflowKernel.generateTransactionID(); - logger.info("TransactionID=" + tid); + logger.log(Level.INFO, "TransactionID={0}", tid); // expected length is > 8 Assert.assertTrue(tid.length() > 8); } diff --git a/imixs-workflow-core/src/test/java/org/imixs/workflow/TestWorkflowKernelEval.java b/imixs-workflow-core/src/test/java/org/imixs/workflow/TestWorkflowKernelEval.java index 0a0038c44..7171f46b1 100644 --- a/imixs-workflow-core/src/test/java/org/imixs/workflow/TestWorkflowKernelEval.java +++ b/imixs-workflow-core/src/test/java/org/imixs/workflow/TestWorkflowKernelEval.java @@ -3,6 +3,7 @@ import java.io.IOException; import java.io.InputStream; import java.text.ParseException; +import java.util.logging.Level; import java.util.logging.Logger; import javax.xml.parsers.ParserConfigurationException; @@ -51,7 +52,7 @@ public void setup() throws PluginException, ModelException { ruleContext.getModelManager().addModel(model); - logger.fine("...loadModel processing time=" + (System.currentTimeMillis() - lLoadTime) + "ms"); + logger.log(Level.FINE, "...loadModel processing time={0}ms", System.currentTimeMillis() - lLoadTime); } catch (ModelException | ParseException | ParserConfigurationException | SAXException | IOException e) { e.printStackTrace(); } @@ -70,7 +71,7 @@ public void testRuleMatch() { try { Assert.assertEquals(200, workflowKernel.eval(workitem)); - logger.info("evaluate BPMN-Rule in " + (System.currentTimeMillis()-l) + "ms"); + logger.log(Level.INFO, "evaluate BPMN-Rule in {0}ms", System.currentTimeMillis()-l); // task and event must still be set to 100.10 Assert.assertEquals(10, workitem.getEventID()); @@ -92,7 +93,7 @@ public void testRuleNoMatch() { try { Assert.assertEquals(900, workflowKernel.eval(workitem)); - logger.info("evaluate BPMN-Rule in " + (System.currentTimeMillis()-l) + "ms"); + logger.log(Level.INFO, "evaluate BPMN-Rule in {0}ms", System.currentTimeMillis()-l); // task and event must still be set to 100.10 Assert.assertEquals(10, workitem.getEventID()); @@ -145,4 +146,4 @@ public Model getModelByWorkitem(ItemCollection workitem) throws ModelException { } } -} \ No newline at end of file +} diff --git a/imixs-workflow-core/src/test/java/org/imixs/workflow/TestWorkflowKernelModels.java b/imixs-workflow-core/src/test/java/org/imixs/workflow/TestWorkflowKernelModels.java index 4dda41fdb..7a62725d6 100644 --- a/imixs-workflow-core/src/test/java/org/imixs/workflow/TestWorkflowKernelModels.java +++ b/imixs-workflow-core/src/test/java/org/imixs/workflow/TestWorkflowKernelModels.java @@ -33,7 +33,7 @@ public class TestWorkflowKernelModels { protected WorkflowKernel kernel = null; protected SessionContext ctx; protected WorkflowContext workflowContext; - private static Logger logger = Logger.getLogger(TestWorkflowKernelModels.class.getName()); + private static final Logger logger = Logger.getLogger(TestWorkflowKernelModels.class.getName()); @Before public void setup() throws PluginException, ModelException, ParseException, ParserConfigurationException, diff --git a/imixs-workflow-core/src/test/java/org/imixs/workflow/bpmn/MigrateImixsModelToBPMN.java b/imixs-workflow-core/src/test/java/org/imixs/workflow/bpmn/MigrateImixsModelToBPMN.java index 440c9e039..206416304 100644 --- a/imixs-workflow-core/src/test/java/org/imixs/workflow/bpmn/MigrateImixsModelToBPMN.java +++ b/imixs-workflow-core/src/test/java/org/imixs/workflow/bpmn/MigrateImixsModelToBPMN.java @@ -10,6 +10,7 @@ import java.util.logging.Logger; import jakarta.xml.bind.JAXBException; +import java.util.logging.Level; import org.imixs.workflow.ItemCollection; import org.imixs.workflow.xml.XMLDataCollectionAdapter; @@ -48,19 +49,18 @@ public static void main(String[] args) { } private static void readModel() { - logger.info("read Model file " + sourceModelFile + "..."); + logger.log(Level.INFO, "read Model file {0}...", sourceModelFile); try { modelItemCollection = XMLDataCollectionAdapter .readCollectionFromInputStream(MigrateImixsModelToBPMN.class .getClass().getResourceAsStream(sourceModelFile)); - logger.info("Model contains " + modelItemCollection.size() - + " elements"); + logger.log(Level.INFO, "Model contains {0} elements", modelItemCollection.size()); } catch (JAXBException e) { - logger.severe("Error reding model file " + e.getMessage()); + logger.log(Level.SEVERE, "Error reding model file {0}", e.getMessage()); } catch (IOException e) { - logger.severe("Error reding model file " + e.getMessage()); + logger.log(Level.SEVERE, "Error reding model file {0}", e.getMessage()); } } @@ -74,7 +74,7 @@ private static void buildBPMN() { List groups = findGroups(); for (String group : groups) { - logger.info("Profile migrate workflow group: " + group); + logger.log(Level.INFO, "Profile migrate workflow group: {0}", group); // find model version List tasks = findProcessEntitiesByGroup(group); @@ -83,7 +83,7 @@ private static void buildBPMN() { .getItemValueString("$modelversion"); sModelVersion = group.toLowerCase() + "-" + sModelVersion; - logger.info(" - $modelversion=" + sModelVersion); + logger.log(Level.INFO, " - $modelversion={0}", sModelVersion); // now create a new bpmn file... PrintWriter writer; @@ -140,8 +140,7 @@ private static void buildBPMN() { // test if follow up..... - logger.fine("TEST Followup " + processID + "_" - + activityID); + logger.log(Level.FINE, "TEST Followup {0}_{1}", new Object[]{processID, activityID}); if (!followUpIds.contains(processID + "_" + activityID)) { // outgoing... String from = "Task_" + processID; @@ -178,8 +177,7 @@ private static void buildBPMN() { + "\" targetRef=\"" + to + "\"/>"); followUpIds.add(processID + "_" + nextID); - logger.fine("ADD follow up " + processID + "_" - + nextID); + logger.log(Level.FINE, "ADD follow up {0}_{1}", new Object[]{processID, nextID}); flowCount++; } else { diff --git a/imixs-workflow-core/src/test/java/org/imixs/workflow/util/TestJSONBuilder.java b/imixs-workflow-core/src/test/java/org/imixs/workflow/util/TestJSONBuilder.java index 3e6934d50..3480659d9 100644 --- a/imixs-workflow-core/src/test/java/org/imixs/workflow/util/TestJSONBuilder.java +++ b/imixs-workflow-core/src/test/java/org/imixs/workflow/util/TestJSONBuilder.java @@ -20,7 +20,7 @@ * @author rsoika */ public class TestJSONBuilder { - private static Logger logger = Logger.getLogger(TestJSONBuilder.class.getName()); + private static final Logger logger = Logger.getLogger(TestJSONBuilder.class.getName()); /** * Expected Output: diff --git a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/AsyncEventScheduler.java b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/AsyncEventScheduler.java index 770f073af..9f931e006 100644 --- a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/AsyncEventScheduler.java +++ b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/AsyncEventScheduler.java @@ -44,6 +44,7 @@ import jakarta.ejb.Timer; import jakarta.ejb.TimerConfig; import jakarta.ejb.TimerService; +import java.util.logging.Level; /** * The AsyncEventScheduler starts a scheduler service to process async events in @@ -97,7 +98,7 @@ public class AsyncEventScheduler { @ConfigProperty(name = AsyncEventScheduler.ASYNCEVENT_PROCESSOR_DEADLOCK, defaultValue = "60000") long deadLockInterval; - private static Logger logger = Logger.getLogger(AsyncEventScheduler.class.getName()); + private static final Logger logger = Logger.getLogger(AsyncEventScheduler.class.getName()); @Resource TimerService timerService; @@ -111,8 +112,8 @@ public class AsyncEventScheduler { @PostConstruct public void init() { if (enabled) { - logger.info( - "Starting AsyncEventScheduler - initalDelay=" + initialDelay + " inverval=" + interval + " ...."); + logger.log(Level.INFO, "Starting AsyncEventScheduler - initalDelay={0} inverval={1} ....", + new Object[]{initialDelay, interval}); // Registering a non-persistent Timer Service. final TimerConfig timerConfig = new TimerConfig(); diff --git a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/AsyncEventService.java b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/AsyncEventService.java index 5e3e8eca4..728c592c4 100644 --- a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/AsyncEventService.java +++ b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/AsyncEventService.java @@ -92,7 +92,7 @@ public class AsyncEventService { @ConfigProperty(name = AsyncEventScheduler.ASYNCEVENT_PROCESSOR_ENABLED, defaultValue = "false") boolean enabled; - private static Logger logger = Logger.getLogger(AsyncEventService.class.getName()); + private static final Logger logger = Logger.getLogger(AsyncEventService.class.getName()); @Inject EventLogService eventLogService; @@ -129,7 +129,7 @@ public void onProcess(@Observes ProcessingEvent processingEvent) throws ModelExc // create new eventLog ? if (boundaryTarget > 0) { if (debug) { - logger.finest("......create new async event - eventId=" + boundaryTarget); + logger.log(Level.FINEST, "......create new async event - eventId={0}", boundaryTarget); } // compute timeout Calendar cal = Calendar.getInstance(); @@ -169,7 +169,7 @@ public void processEventLog() { AsyncEventScheduler.EVENTLOG_TOPIC_ASYNC_EVENT); if (debug) { - logger.finest("......found " + events.size() + " eventLog entries"); + logger.log(Level.FINEST, "......found {0} eventLog entries", events.size()); } for (EventLog eventLogEntry : events) { try { @@ -193,20 +193,20 @@ public void processEventLog() { workitem = workflowService.processWorkItemByNewTransaction(workitem); } else { // just a normal log message - logger.info("...AsyncEvent " + syncEventData.getEventID() + " for " - + workitem.getUniqueID() + " is deprecated and will be removed. (" - + workitem.getItemValueString(WorkflowKernel.TRANSACTIONID) + " ≠ " - + syncEventData.getItemValueString(WorkflowKernel.TRANSACTIONID)); + logger.log(Level.INFO, "...AsyncEvent {0} for {1} is deprecated and will be removed. ({2} \u2260 {3}", + new Object[]{syncEventData.getEventID(), workitem.getUniqueID(), + workitem.getItemValueString(WorkflowKernel.TRANSACTIONID), + syncEventData.getItemValueString(WorkflowKernel.TRANSACTIONID)}); } // finally remove the event log entry... eventLogService.removeEvent(eventLogEntry.getId()); } catch (WorkflowException | InvalidAccessException | EJBException e) { // we also catch EJBExceptions here because we do not want to cancel the // ManagedScheduledExecutorService - logger.severe( - "AsyncEvent " + workitem.getUniqueID() + " processing failed: " + e.getMessage()); + logger.log(Level.SEVERE, "AsyncEvent {0} processing failed: {1}", + new Object[]{workitem.getUniqueID(), e.getMessage()}); // now we need to remove the batch event - logger.warning("AsyncEvent " + workitem.getUniqueID() + " will be removed!"); + logger.log(Level.WARNING, "AsyncEvent {0} will be removed!", workitem.getUniqueID()); eventLogService.removeEvent(eventLogEntry.getId()); } } @@ -214,13 +214,14 @@ public void processEventLog() { } catch (OptimisticLockException e) { // lock was not possible - continue.... - logger.info("...unable to lock AsyncEvent: " + e.getMessage()); + logger.log(Level.INFO, "...unable to lock AsyncEvent: {0}", e.getMessage()); } } if (debug) { - logger.fine("..." + events.size() + " AsyncEvents processed in " + (System.currentTimeMillis() - l) + "ms"); + logger.log(Level.FINE, "...{0} AsyncEvents processed in {1}ms", + new Object[]{events.size(), System.currentTimeMillis() - l}); } } diff --git a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/DocumentService.java b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/DocumentService.java index 25f8d8e63..6deffbe27 100644 --- a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/DocumentService.java +++ b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/DocumentService.java @@ -358,8 +358,8 @@ public ItemCollection save(ItemCollection document) throws AccessDeniedException boolean debug = logger.isLoggable(Level.FINE); long lSaveTime = System.currentTimeMillis(); if (debug) { - logger.finest("......save - ID=" + document.getUniqueID() + ", provided version=" - + document.getItemValueInteger(VERSION)); + logger.log(Level.FINEST, "......save - ID={0}, provided version={1}", + new Object[]{document.getUniqueID(), document.getItemValueInteger(VERSION)}); } Document persistedDocument = null; // Now set flush Mode to COMMIT @@ -376,7 +376,7 @@ public ItemCollection save(ItemCollection document) throws AccessDeniedException // yes so we can try to find the Entity by its primary key persistedDocument = manager.find(Document.class, sID); if (debug && persistedDocument == null) { - logger.finest("......Document '" + sID + "' not found!"); + logger.log(Level.FINEST, "......Document ''{0}'' not found!", sID); } } @@ -421,8 +421,8 @@ public ItemCollection save(ItemCollection document) throws AccessDeniedException // after all the persistedDocument is now managed through JPA! if (debug) { - logger.finest( - "......save - ID=" + document.getUniqueID() + " managed version=" + persistedDocument.getVersion()); + logger.log(Level.FINEST, "......save - ID={0} managed version={1}", + new Object[]{document.getUniqueID(), persistedDocument.getVersion()}); } // remove the property $isauthor document.removeItem(ISAUTHOR); @@ -513,8 +513,8 @@ public ItemCollection save(ItemCollection document) throws AccessDeniedException persistedDocument.setPending(true); if (debug) { - logger.fine( - "...'" + document.getUniqueID() + "' saved in " + (System.currentTimeMillis() - lSaveTime) + "ms"); + logger.log(Level.FINE, "...''{0}'' saved in {1}ms", + new Object[]{document.getUniqueID(), System.currentTimeMillis() - lSaveTime}); } // return the updated document return document; @@ -555,8 +555,8 @@ public void removeDocumentFromIndex(String uniqueID) { long ltime = System.currentTimeMillis(); eventLogService.createEvent(EVENTLOG_TOPIC_INDEX_REMOVE, uniqueID); if (debug) { - logger.fine("... update eventLog cache in " + (System.currentTimeMillis() - ltime) - + " ms (1 document to be removed)"); + logger.log(Level.FINE, "... update eventLog cache in {0} ms (1 document to be removed)", + System.currentTimeMillis() - ltime); } } @@ -625,8 +625,8 @@ public ItemCollection load(String id) { if (persistedDocument.isPending()) { // we clone but do not detach if (debug) { - logger.finest( - "......clone manged entity '" + id + "' pending status=" + persistedDocument.isPending()); + logger.log(Level.FINEST, "......clone manged entity ''{0}'' pending status={1}", + new Object[]{id, persistedDocument.isPending()}); } result = new ItemCollection(persistedDocument.getData()); } else { @@ -645,8 +645,8 @@ public ItemCollection load(String id) { logger.warning("Missing CDI support for Event !"); } if (debug) { - logger.fine("...'" + result.getUniqueID() + "' loaded in " + (System.currentTimeMillis() - lLoadTime) - + "ms"); + logger.log(Level.FINE, "...''{0}'' loaded in {1}ms", + new Object[]{result.getUniqueID(), System.currentTimeMillis() - lLoadTime}); } return result; } else @@ -810,8 +810,8 @@ public List find(String searchTerm, int pageSize, int pageIndex, throws QueryException { boolean debug = logger.isLoggable(Level.FINE); if (debug) { - logger.finest("......find - SearchTerm=" + searchTerm + " , pageSize=" + pageSize + " pageNumber=" - + pageIndex + " , sortBy=" + sortBy + " reverse=" + sortReverse); + logger.log(Level.FINEST, "......find - SearchTerm={0} , pageSize={1} pageNumber={2} , sortBy={3} reverse={4}", + new Object[]{searchTerm, pageSize, pageIndex, sortBy, sortReverse}); } // create sort object SortOrder sortOrder = null; @@ -866,8 +866,8 @@ public List findStubs(String searchTerm, int pageSize, int pageI boolean sortReverse) throws QueryException { boolean debug = logger.isLoggable(Level.FINE); if (debug) { - logger.finest("......find - SearchTerm=" + searchTerm + " , pageSize=" + pageSize + " pageNumber=" - + pageIndex + " , sortBy=" + sortBy + " reverse=" + sortReverse); + logger.log(Level.FINEST, "......find - SearchTerm={0} , pageSize={1} pageNumber={2} , sortBy={3} reverse={4}", + new Object[]{searchTerm, pageSize, pageIndex, sortBy, sortReverse}); } // create sort object SortOrder sortOrder = null; @@ -917,7 +917,7 @@ public List findDocumentsByRef(String uniqueIdRef, int pageSize, try { return find(searchTerm, pageSize, pageIndex); } catch (QueryException e) { - logger.severe("findDocumentsByRef - invalid query: " + e.getMessage()); + logger.log(Level.SEVERE, "findDocumentsByRef - invalid query: {0}", e.getMessage()); return null; } } @@ -1028,8 +1028,8 @@ public List getDocumentsByQuery(String query, int firstResult, i if (doc.isPending()) { // we clone but do not detach if (debug) { - logger.finest( - "......clone manged entity '" + doc.getId() + "' pending status=" + doc.isPending()); + logger.log(Level.FINEST, "......clone manged entity ''{0}'' pending status={1}", + new Object[]{doc.getId(), doc.isPending()}); } _tmp = new ItemCollection(doc.getData()); } else { @@ -1049,8 +1049,8 @@ public List getDocumentsByQuery(String query, int firstResult, i } } if (debug) { - logger.fine("...getDocumentsByQuery - found " + documentList.size() + " documents in " - + (System.currentTimeMillis() - l) + " ms"); + logger.log(Level.FINE, "...getDocumentsByQuery - found {0} documents in {1} ms", + new Object[]{documentList.size(), System.currentTimeMillis() - l}); } return result; } @@ -1079,8 +1079,8 @@ public void backup(String query, String filePath, boolean snapshots) throws IOEx int icount = 0; logger.info("backup - starting..."); - logger.info("backup - query=" + query); - logger.info("backup - target=" + filePath); + logger.log(Level.INFO, "backup - query={0}", query); + logger.log(Level.INFO, "backup - target={0}", filePath); if (filePath == null || filePath.isEmpty()) { logger.severe("Invalid FilePath!"); @@ -1094,7 +1094,7 @@ public void backup(String query, String filePath, boolean snapshots) throws IOEx Collection col = find(query, JUNK_SIZE, pageIndex); totalcount = totalcount + col.size(); - logger.info("backup - processing...... " + col.size() + " documents read...."); + logger.log(Level.INFO, "backup - processing...... {0} documents read....", col.size()); if (col.size() < JUNK_SIZE) { hasMoreData = false; @@ -1127,7 +1127,7 @@ public void backup(String query, String filePath, boolean snapshots) throws IOEx } } out.close(); - logger.info("backup - finished: " + icount + " documents read totaly."); + logger.log(Level.INFO, "backup - finished: {0} documents read totaly.", icount); } // default method @@ -1150,7 +1150,7 @@ public void restore(String filePath) throws IOException { FileInputStream fis = new FileInputStream(filePath); ObjectInputStream in = new ObjectInputStream(fis); - logger.info("...starting restor form file " + filePath + "..."); + logger.log(Level.INFO, "...starting restor form file {0}...", filePath); long l = System.currentTimeMillis(); while (true) { try { @@ -1167,8 +1167,7 @@ public void restore(String filePath) throws IOException { icount++; if (icount >= JUNK_SIZE) { icount = 0; - logger.info("...restored " + totalcount + " document in " + (System.currentTimeMillis() - l) - + "ms...."); + logger.log(Level.INFO, "...restored {0} document in {1}ms....", new Object[]{totalcount, System.currentTimeMillis() - l}); l = System.currentTimeMillis(); } @@ -1176,12 +1175,12 @@ public void restore(String filePath) throws IOException { break; } catch (ClassNotFoundException e) { errorCount++; - logger.warning("...error importing workitem at position " + (totalcount + errorCount) + " Error: " - + e.getMessage()); + logger.log(Level.WARNING, "...error importing workitem at position {0}{1} Error: {2}", + new Object[]{totalcount, errorCount, e.getMessage()}); } catch (AccessDeniedException e) { errorCount++; - logger.warning("...error importing workitem at position " + (totalcount + errorCount) + " Error: " - + e.getMessage()); + logger.log(Level.WARNING, "...error importing workitem at position {0}{1} Error: {2}", + new Object[]{totalcount, errorCount, e.getMessage()}); } } in.close(); diff --git a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/EventLogService.java b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/EventLogService.java index 2844819ef..b19072455 100644 --- a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/EventLogService.java +++ b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/EventLogService.java @@ -93,7 +93,7 @@ public class EventLogService { @PersistenceContext(unitName = "org.imixs.workflow.jpa") private EntityManager manager; - private static Logger logger = Logger.getLogger(EventLogService.class.getName()); + private static final Logger logger = Logger.getLogger(EventLogService.class.getName()); /** * Creates/updates a new event log entry. @@ -166,7 +166,7 @@ public EventLog createEvent(String topic, String refID, Map } manager.persist(eventLog); if (debug) { - logger.finest("......created new eventLog '" + refID + "' => " + topic); + logger.log(Level.FINEST, "......created new eventLog ''{0}'' => {1}", new Object[]{refID, topic}); } return eventLog; } @@ -198,7 +198,7 @@ public List findEventsByTopic(int maxCount, String... topic) { q.setMaxResults(maxCount); result = q.getResultList(); if (debug) { - logger.fine("found " + result.size() + " event for topic " + topic); + logger.log(Level.FINE, "found {0} event for topic {1}", new Object[]{result.size(), topic}); } return result; @@ -238,7 +238,7 @@ public List findEventsByTimeout(int maxCount, String... topic) { q.setMaxResults(maxCount); result = q.getResultList(); if (debug) { - logger.fine("found " + result.size() + " event for topic " + topic); + logger.log(Level.FINE, "found {0} event for topic {1}", new Object[]{result.size(), topic}); } return result; @@ -274,7 +274,7 @@ public List findEventsByRef(int maxCount, String ref, String... topic) q.setMaxResults(maxCount); result = q.getResultList(); if (debug) { - logger.fine("found " + result.size() + " event for topic " + topic); + logger.log(Level.FINE, "found {0} event for topic {1}", new Object[]{result.size(), topic}); } return result; @@ -308,7 +308,7 @@ public List findAllEvents(int firstResult, int maxResult) { result = q.getResultList(); if (debug) { - logger.fine("found " + result.size() + " event log entries"); + logger.log(Level.FINE, "found {0} event log entries", result.size()); } return result; @@ -400,7 +400,7 @@ public boolean lock(EventLog _eventLogEntry) { return true; } else { // unable to lock! - logger.warning("unable to lock eventLogEntry '" + _eventLogEntry.getId() + "' - already locked!"); + logger.log(Level.WARNING, "unable to lock eventLogEntry ''{0}'' - already locked!", _eventLogEntry.getId()); } } @@ -431,7 +431,7 @@ public boolean unlock(EventLog _eventLogEntry) { return true; } else { // unable to lock! - logger.warning("unable to lock eventLogEntry '" + _eventLogEntry.getId() + "' - already locked!"); + logger.log(Level.WARNING, "unable to lock eventLogEntry ''{0}'' - already locked!", _eventLogEntry.getId()); } } return false; @@ -459,13 +459,13 @@ public void releaseDeadLocks(long deadLockInterval, String... topic) { if (lockDate != null) { age = now.getTime() - lockDate.getTime(); if (age > deadLockInterval) { - logger.warning("Deadlock detected! - eventlog.id=" + eventLogEntry.getId() - + " will be unlocked! (deadlock since " + age + "ms)"); + logger.log(Level.WARNING, "Deadlock detected! - eventlog.id={0} will be unlocked!" + + " (deadlock since {1}ms)", new Object[]{eventLogEntry.getId(), age}); unlock(eventLogEntry); } } else { - logger.warning("Invalid Deadlock state detected, missing lock date! - eventlog.id=" - + eventLogEntry.getId() + " will be deleted"); + logger.log(Level.WARNING, "Invalid Deadlock state detected, missing lock date!" + + " - eventlog.id={0} will be deleted", eventLogEntry.getId()); removeEvent(eventLogEntry.getId()); } } diff --git a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/HealthCheckService.java b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/HealthCheckService.java index 1532c9c2f..cb9ac06fd 100644 --- a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/HealthCheckService.java +++ b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/HealthCheckService.java @@ -62,7 +62,7 @@ public class HealthCheckService implements HealthCheck { private String workflowVersion = null; - private static Logger logger = Logger.getLogger(HealthCheckService.class.getName()); + private static final Logger logger = Logger.getLogger(HealthCheckService.class.getName()); @Inject private SetupService setupService; diff --git a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/ImixsConfigSource.java b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/ImixsConfigSource.java index d37adf609..4c0333b6b 100644 --- a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/ImixsConfigSource.java +++ b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/ImixsConfigSource.java @@ -62,7 +62,7 @@ public class ImixsConfigSource implements ConfigSource { public static final String NAME = "ImixsConfigSource"; private Map properties = null; - private static Logger logger = Logger.getLogger(ImixsConfigSource.class.getName()); + private static final Logger logger = Logger.getLogger(ImixsConfigSource.class.getName()); @Override public Set getPropertyNames() { @@ -87,8 +87,8 @@ public String getValue(String key) { if (keyAlternative != null && !keyAlternative.isEmpty()) { value = properties.get(keyAlternative); if (value != null && !value.isEmpty()) { - logger.warning( - "Deprecated imixs.property '" + keyAlternative + "' should be replaced by '" + key + "'"); + logger.log(Level.WARNING, "Deprecated imixs.property ''{0}'' should be replaced by ''{1}''", + new Object[]{keyAlternative, key}); } } diff --git a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/MetricService.java b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/MetricService.java index af4986438..7a3f8330e 100644 --- a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/MetricService.java +++ b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/MetricService.java @@ -92,7 +92,7 @@ public class MetricService { boolean mpMetricNoSupport = false; - private static Logger logger = Logger.getLogger(MetricService.class.getName()); + private static final Logger logger = Logger.getLogger(MetricService.class.getName()); /** * ProcessingEvent listener to generate a metric. @@ -119,7 +119,7 @@ public void onProcessingEvent(@Observes ProcessingEvent processingEvent) throws counter.inc(); } catch (IncompatibleClassChangeError | ObserverException oe) { mpMetricNoSupport = true; - logger.warning("...Microprofile Metrics v2.2 not supported!"); + logger.warning("...Microprofile Metrics not supported!"); } } @@ -149,7 +149,7 @@ public void onDocumentEvent(@Observes DocumentEvent documentEvent) throws Access } catch (IncompatibleClassChangeError | ObserverException oe) { mpMetricNoSupport = true; - logger.warning("...Microprofile Metrics v2.0 not supported!"); + logger.warning("...Microprofile Metrics not supported!"); oe.printStackTrace(); } } diff --git a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/ModelService.java b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/ModelService.java index ea9500488..244693698 100644 --- a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/ModelService.java +++ b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/ModelService.java @@ -94,7 +94,7 @@ public class ModelService implements ModelManager { private ConcurrentHashMap modelStore = null; - private static Logger logger = Logger.getLogger(ModelService.class.getName()); + private static final Logger logger = Logger.getLogger(ModelService.class.getName()); @Inject private DocumentService documentService; @Resource @@ -125,7 +125,7 @@ void init() throws AccessDeniedException { for (FileData file : files) { if (debug) { - logger.finest("......loading file:" + file.getName()); + logger.log(Level.FINEST, "......loading file:{0}", file.getName()); } byte[] rawData = file.getContent(); InputStream bpmnInputStream = new ByteArrayInputStream(rawData); @@ -137,8 +137,7 @@ void init() throws AccessDeniedException { try { if (getModel(modelVersion) != null) { // no op - logger.warning("Model '" + modelVersion - + "' is dupplicated! Please update the model version!"); + logger.log(Level.WARNING, "Model ''{0}'' is dupplicated! Please update the model version!", modelVersion); } } catch (ModelException e) { // exception is expected @@ -146,7 +145,7 @@ void init() throws AccessDeniedException { } } } catch (Exception e) { - logger.warning("Failed to load model '" + file.getName() + "' : " + e.getMessage()); + logger.log(Level.WARNING, "Failed to load model ''{0}'' : {1}", new Object[]{file.getName(), e.getMessage()}); } } } @@ -166,7 +165,7 @@ public void addModel(Model model) throws ModelException { if (modelVersion.isEmpty()) { throw new ModelException(ModelException.INVALID_MODEL, "Invalid Model: Model Version not provided! "); } - logger.info("⟳ updated model version: '" + model.getVersion() + "'"); + logger.log(Level.INFO, "\u27f3 updated model version: ''{0}''", model.getVersion()); getModelStore().put(modelVersion, model); } @@ -182,7 +181,7 @@ public void removeModel(String modelversion) { boolean debug = logger.isLoggable(Level.FINE); getModelStore().remove(modelversion); if (debug) { - logger.finest("......removed BPMNModel '" + modelversion + "'..."); + logger.log(Level.FINEST, "......removed BPMNModel ''{0}''...", modelversion); } } @@ -232,7 +231,8 @@ public Model getModelByWorkitem(ItemCollection workitem) throws ModelException { if (!versions.isEmpty()) { // we found a match by regex! String newVersion = versions.get(0); - logger.info("...... match version '" + newVersion + "' -> by regex '" + modelVersion + "'"); + logger.log(Level.INFO, "...... match version ''{0}'' -> by regex ''{1}''", + new Object[]{newVersion, modelVersion}); workitem.replaceItemValue(WorkflowKernel.MODELVERSION, newVersion); model = getModel(newVersion); } @@ -244,8 +244,9 @@ public Model getModelByWorkitem(ItemCollection workitem) throws ModelException { if (!versions.isEmpty()) { String newVersion = versions.get(0); if (!modelVersion.isEmpty()) { - logger.warning("Deprecated model version: '" + modelVersion + "' -> migrating to '" + newVersion - + "', $workflowgroup: '" + workflowGroup + "', $uniqueid: " + workitem.getUniqueID()); + logger.log(Level.WARNING, "Deprecated model version: ''{0}'' -> migrating to ''{1}''," + + " $workflowgroup: ''{2}'', $uniqueid: {3}", + new Object[]{modelVersion, newVersion, workflowGroup, workitem.getUniqueID()}); } workitem.replaceItemValue(WorkflowKernel.MODELVERSION, newVersion); model = getModel(newVersion); @@ -330,7 +331,7 @@ public List findVersionsByGroup(String group) { boolean debug = logger.isLoggable(Level.FINE); List result = new ArrayList(); if (debug) { - logger.finest("......searching model versions for workflowgroup '" + group + "'..."); + logger.log(Level.FINEST, "......searching model versions for workflowgroup ''{0}''...", group); } // try to find matching model version by group Collection models = getModelStore().values(); @@ -356,7 +357,7 @@ public List findVersionsByRegEx(String modelRegex) { boolean debug = logger.isLoggable(Level.FINE); List result = new ArrayList(); if (debug) { - logger.finest("......searching model versions for regex '" + modelRegex + "'..."); + logger.log(Level.FINEST, "......searching model versions for regex ''{0}''...", modelRegex); } // try to find matching model version by regex Collection models = getModelStore().values(); @@ -405,7 +406,7 @@ public void saveModel(BPMNModel model, String _filename) throws ModelException { deleteModel(model.getVersion()); // store model into internal cache if (debug) { - logger.finest("......save BPMNModel '" + model.getVersion() + "'..."); + logger.log(Level.FINEST, "......save BPMNModel ''{0}''...", model.getVersion()); } BPMNModel bpmnModel = (BPMNModel) model; addModel(model); @@ -447,7 +448,7 @@ public void deleteModel(String version) { if (version != null && !version.isEmpty()) { boolean debug = logger.isLoggable(Level.FINE); if (debug) { - logger.finest("......delete BPMNModel '" + version + "'..."); + logger.log(Level.FINEST, "......delete BPMNModel ''{0}''...", version); } Collection col = documentService.getDocumentsByType("model"); for (ItemCollection modelEntity : col) { @@ -476,7 +477,7 @@ public ItemCollection loadModelEntity(String version) { if (version != null && !version.isEmpty()) { boolean debug = logger.isLoggable(Level.FINE); if (debug) { - logger.finest("......load BPMNModel Entity '" + version + "'..."); + logger.log(Level.FINEST, "......load BPMNModel Entity ''{0}''...", version); } Collection col = documentService.getDocumentsByType("model"); diff --git a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/ReportService.java b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/ReportService.java index 19b327916..bedc8eb48 100644 --- a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/ReportService.java +++ b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/ReportService.java @@ -64,6 +64,7 @@ import org.imixs.workflow.xml.XSLHandler; import javax.xml.transform.TransformerException; import jakarta.ejb.Stateless; +import java.util.logging.Level; /** * The ReportService supports methods to create, process and find report @@ -91,7 +92,7 @@ @Stateless public class ReportService { - private static Logger logger = Logger.getLogger(ReportService.class.getName()); + private static final Logger logger = Logger.getLogger(ReportService.class.getName()); @Inject DocumentService documentService; @@ -119,7 +120,7 @@ public ItemCollection findReport(String reportID) { try { col = documentService.find(searchTerm, 1, 0); } catch (QueryException e) { - logger.severe("findReport - invalid id: " + e.getMessage()); + logger.log(Level.SEVERE, "findReport - invalid id: {0}", e.getMessage()); return null; } if (col.size() > 0) { @@ -223,7 +224,7 @@ public List getDataSource(ItemCollection reportEntity, int pageS List clonedResult = new ArrayList(); long l = System.currentTimeMillis(); - logger.finest("......executeReport: " + reportEntity.getItemValueString("txtname")); + logger.log(Level.FINEST, "......executeReport: {0}", reportEntity.getItemValueString("txtname")); String query = reportEntity.getItemValueString("txtquery"); @@ -238,14 +239,14 @@ public List getDataSource(ItemCollection reportEntity, int pageS // test if key is contained in query if (query.indexOf("{" + sKeyName + "}") > -1) { query = query.replace("{" + sKeyName + "}", sParamValue); - logger.finest("......executeReport set param " + sKeyName + "=" + sParamValue); + logger.log(Level.FINEST, "......executeReport set param {0}={1}", new Object[]{sKeyName, sParamValue}); } else { // support old param format if (query.indexOf("?" + sKeyName) > -1) { query = query.replace("?" + sKeyName, sParamValue); - logger.warning("......query definition in Report '" + reportEntity.getItemValueString("txtname") - + "' is deprecated! Please replace the param '?" + sKeyName + "' with '{" + sKeyName - + "}'"); + logger.log(Level.WARNING, "......query definition in Report ''{0}'' is deprecated!" + + " Please replace the param ''?{1}'' with '''{'{2}'}'''", + new Object[]{reportEntity.getItemValueString("txtname"), sKeyName, sKeyName}); } } @@ -256,7 +257,7 @@ public List getDataSource(ItemCollection reportEntity, int pageS query = replaceDateString(query); // execute query - logger.finest("......executeReport query=" + query); + logger.log(Level.FINEST, "......executeReport query={0}", query); List result = documentService.find(query, pageSize, pageIndex, sortBy, sortReverse); // test if a itemList is provided or defined in the reportEntity... @@ -285,8 +286,8 @@ public List getDataSource(ItemCollection reportEntity, int pageS clonedResult.add(clone); } } - logger.fine("...executed report '" + reportEntity.getItemValueString("txtname") + "' in " - + (System.currentTimeMillis() - l) + "ms"); + logger.log(Level.FINE, "...executed report ''{0}'' in {1}ms", + new Object[]{reportEntity.getItemValueString("txtname"), System.currentTimeMillis() - l}); return clonedResult; } @@ -632,9 +633,8 @@ private String formatObjectValue(Object o, String format, String locale) { } singleValue = formatter.format(dateValue); } catch (Exception ef) { - Logger logger = Logger.getLogger(AbstractPlugin.class.getName()); - logger.warning("ReportService: Invalid format String '" + format + "'"); - logger.warning("ReportService: Can not format value - error: " + ef.getMessage()); + logger.log(Level.WARNING, "ReportService: Invalid format String ''{0}''", format); + logger.log(Level.WARNING, "ReportService: Can not format value - error: {0}", ef.getMessage()); return "" + dateValue; } } else { @@ -649,7 +649,7 @@ private String formatObjectValue(Object o, String format, String locale) { double d = Double.parseDouble(o.toString()); singleValue = customNumberFormat(format, locale, d); } catch (IllegalArgumentException e) { - logger.warning("Format Error (" + format + ") = " + e.getMessage()); + logger.log(Level.WARNING, "Format Error ({0}) = {1}", new Object[]{format, e.getMessage()}); singleValue = "0"; } @@ -688,11 +688,11 @@ private List convertItemValue(ItemCollection itemcol, String itemName, S List adaptedValueList = null; if (converter.startsWith("<") && converter.endsWith(">")) { try { - logger.finest("......converter = " + converter); + logger.log(Level.FINEST, "......converter = {0}", converter); // adapt the value list... adaptedValueList = workflowService.adaptTextList(converter, itemcol); } catch (PluginException e) { - logger.warning("Unable to adapt text converter: " + converter); + logger.log(Level.WARNING, "Unable to adapt text converter: {0}", converter); } } diff --git a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/SetupService.java b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/SetupService.java index 338f1e045..c19bdf587 100644 --- a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/SetupService.java +++ b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/SetupService.java @@ -74,6 +74,7 @@ import jakarta.xml.bind.JAXBContext; import jakarta.xml.bind.JAXBException; import jakarta.xml.bind.Unmarshaller; +import java.util.logging.Level; /** * The SetupService EJB initializes the Imxis-Workflow engine and returns the @@ -110,7 +111,7 @@ public class SetupService { public static String SETUP_OK = "OK"; public static String MODEL_INITIALIZED = "MODEL_INITIALIZED"; - private static Logger logger = Logger.getLogger(SetupService.class.getName()); + private static final Logger logger = Logger.getLogger(SetupService.class.getName()); @Inject @ConfigProperty(name = "model.default.data") @@ -164,7 +165,7 @@ public void startup() { scanDefaultModels(); } else { for (String model : models) { - logger.info("...model: " + model + " ...OK"); + logger.log(Level.INFO, "...model: {0} ...OK", model); } } @@ -277,7 +278,7 @@ public void scanDefaultModels() { for (String modelResource : modelResources) { // try to load the resource file.... if (modelResource.endsWith(".bpmn") || modelResource.endsWith(".xml")) { - logger.info("...uploading default model file: '" + modelResource + "'...."); + logger.log(Level.INFO, "...uploading default model file: ''{0}''....", modelResource); // if resource starts with '/' then we pickup the file form the filesystem. // otherwise we load it as a resource bundle. InputStream inputStream = null; @@ -328,7 +329,7 @@ public void scanDefaultModels() { } } else { - logger.severe("Wrong model format: '" + modelResource + "' - expected *.bpmn or *.xml"); + logger.log(Level.SEVERE, "Wrong model format: ''{0}'' - expected *.bpmn or *.xml", modelResource); } } @@ -393,8 +394,7 @@ public void importXmlEntityData(byte[] filestream) { } // now remove old model entries.... for (String aModelVersion : vModelVersions) { - logger.fine("importXmlEntityData - removing existing configuration for model version '" - + aModelVersion + "'"); + logger.log(Level.FINE, "importXmlEntityData - removing existing configuration for model version ''{0}''", aModelVersion); modelService.removeModel(aModelVersion); } // save new entities into database and update modelversion..... @@ -405,7 +405,7 @@ public void importXmlEntityData(byte[] filestream) { documentService.save(itemCollection); } - logger.fine("importXmlEntityData - " + ecol.getDocument().length + " entries sucessfull imported"); + logger.log(Level.FINE, "importXmlEntityData - {0} entries sucessfull imported", ecol.getDocument().length); } } catch (Exception e) { @@ -427,7 +427,7 @@ public void migrateWorkflowScheduler() { try { col = documentService.find(searchTerm, 1, 0); } catch (QueryException e) { - logger.severe("loadConfiguration - invalid param: " + e.getMessage()); + logger.log(Level.SEVERE, "loadConfiguration - invalid param: {0}", e.getMessage()); throw new InvalidAccessException(InvalidAccessException.INVALID_ID, e.getMessage(), e); } @@ -477,7 +477,7 @@ Timer findTimer(String id) { String timerID = atimer.getInfo().toString(); if (id.equals(timerID)) { if (timer != null) { - logger.severe("more then one timer with id " + id + " was found!"); + logger.log(Level.SEVERE, "more then one timer with id {0} was found!", id); } timer = atimer; } diff --git a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/SimulationService.java b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/SimulationService.java index b00ea4de7..47f2ef4fb 100644 --- a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/SimulationService.java +++ b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/SimulationService.java @@ -51,6 +51,7 @@ import jakarta.ejb.SessionContext; import jakarta.ejb.Stateless; +import java.util.logging.Level; /** * The SimulationService can be used to simulate a process life cycle without @@ -69,7 +70,7 @@ @Stateless public class SimulationService implements WorkflowContext { - private static Logger logger = Logger.getLogger(SimulationService.class.getName()); + private static final Logger logger = Logger.getLogger(SimulationService.class.getName()); @Resource private SessionContext ctx; @@ -140,7 +141,7 @@ public ItemCollection processWorkItem(final ItemCollection _workitem, final List // aPlugin=null; if (aPlugin != null) { // register injected CDI Plugin - logger.fine("register CDI plugin class: " + aPluginClassName + "..."); + logger.log(Level.FINE, "register CDI plugin class: {0}...", aPluginClassName); workflowkernel.registerPlugin(aPlugin); } else { // register plugin by class name @@ -155,12 +156,13 @@ public ItemCollection processWorkItem(final ItemCollection _workitem, final List workitem = workflowkernel.process(workitem); } catch (PluginException pe) { // if a plugin exception occurs we roll back the transaction. - logger.severe("processing workitem '" + workitem.getItemValueString(WorkflowKernel.UNIQUEID) - + " failed, rollback transaction..."); + logger.log(Level.SEVERE, "processing workitem ''{0} failed, rollback transaction...", + workitem.getItemValueString(WorkflowKernel.UNIQUEID)); throw pe; } - logger.fine("workitem '" + workitem.getItemValueString(WorkflowKernel.UNIQUEID) + "' simulated in " - + (System.currentTimeMillis() - l) + "ms"); + logger.log(Level.FINE, "workitem ''{0}'' simulated in {1}ms", + new Object[]{workitem.getItemValueString(WorkflowKernel.UNIQUEID), + System.currentTimeMillis() - l}); // fire event if (events != null) { @@ -210,13 +212,13 @@ private Plugin findPluginByName(String pluginClassName) { return null; if (plugins == null || !plugins.iterator().hasNext()) { - logger.fine("[WorkflowService] no CDI plugins injected"); + logger.fine("[SimulationService] no CDI plugins injected"); return null; } // iterate over all injected plugins.... for (Plugin plugin : this.plugins) { if (plugin.getClass().getName().equals(pluginClassName)) { - logger.fine("[WorkflowService] CDI plugin '" + pluginClassName + "' successful injected"); + logger.log(Level.FINE, "[SimulationService] CDI plugin ''{0}'' successful injected", pluginClassName); return plugin; } } diff --git a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/TextForEachAdapter.java b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/TextForEachAdapter.java index d0060de8d..c00369f77 100644 --- a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/TextForEachAdapter.java +++ b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/TextForEachAdapter.java @@ -34,7 +34,6 @@ import java.util.logging.Logger; import org.imixs.workflow.ItemCollection; -import org.imixs.workflow.engine.plugins.AbstractPlugin; import org.imixs.workflow.util.XMLParser; import jakarta.annotation.Priority; @@ -100,7 +99,7 @@ @Stateless public class TextForEachAdapter { - private static Logger logger = Logger.getLogger(AbstractPlugin.class.getName()); + private static final Logger logger = Logger.getLogger(TextForEachAdapter.class.getName()); @Inject protected Event textEvents; @@ -123,7 +122,7 @@ public void onEvent(@Observes @Priority(Interceptor.Priority.APPLICATION - 10) T List tagList = XMLParser.findNoEmptyTags(text, "for-each"); if (debug) { - logger.finest("......" + tagList.size() + " tags found"); + logger.log(Level.FINEST, "......{0} tags found", tagList.size()); } // test if a tag exists... for (String tag : tagList) { diff --git a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/TextItemValueAdapter.java b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/TextItemValueAdapter.java index 6f3b2f0ee..c4eeb2f21 100644 --- a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/TextItemValueAdapter.java +++ b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/TextItemValueAdapter.java @@ -41,7 +41,6 @@ import jakarta.ejb.Stateless; import jakarta.enterprise.event.Observes; import org.imixs.workflow.ItemCollection; -import org.imixs.workflow.engine.plugins.AbstractPlugin; import org.imixs.workflow.util.XMLParser; /** @@ -54,7 +53,7 @@ @Stateless public class TextItemValueAdapter { - private static Logger logger = Logger.getLogger(AbstractPlugin.class.getName()); + private static final Logger logger = Logger.getLogger(TextItemValueAdapter.class.getName()); /** * This method reacts on CDI events of the type TextEvent and parses a string @@ -94,7 +93,7 @@ public void onEvent(@Observes TextEvent event) { List tagList = XMLParser.findTags(text, "itemvalue"); if (debug) { - logger.finest("......" + tagList.size() + " tags found"); + logger.log(Level.FINEST, "......{0} tags found", tagList.size()); } // test if a tag exists... for (String tag : tagList) { @@ -288,9 +287,8 @@ private String formatObjectValue(Object o, String format, Locale locale) { } singleValue = formatter.format(dateValue); } catch (Exception ef) { - Logger logger = Logger.getLogger(AbstractPlugin.class.getName()); - logger.warning("ReportService: Invalid format String '" + format + "'"); - logger.warning("ReportService: Can not format value - error: " + ef.getMessage()); + logger.log(Level.WARNING, "TextItemValueAdapter: Invalid format String ''{0}''", format); + logger.log(Level.WARNING, "TextItemValueAdapter: Can not format value - error: {0}", ef.getMessage()); return "" + dateValue; } } else { @@ -305,7 +303,7 @@ private String formatObjectValue(Object o, String format, Locale locale) { double d = Double.parseDouble(o.toString()); singleValue = customNumberFormat(format, locale, d); } catch (IllegalArgumentException e) { - logger.warning("Format Error (" + format + ") = " + e.getMessage()); + logger.log(Level.WARNING, "Format Error ({0}) = {1}", new Object[]{format, e.getMessage()}); singleValue = "0"; } diff --git a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/TextPropertyValueAdapter.java b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/TextPropertyValueAdapter.java index 400a2fcef..2db8deb03 100644 --- a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/TextPropertyValueAdapter.java +++ b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/TextPropertyValueAdapter.java @@ -56,7 +56,7 @@ public class TextPropertyValueAdapter { @Inject private Config config; - private static Logger logger = Logger.getLogger(AbstractPlugin.class.getName()); + private static final Logger logger = Logger.getLogger(TextPropertyValueAdapter.class.getName()); /** * This method reacts on CDI events of the type TextEvent and parses a string @@ -77,7 +77,7 @@ public void onEvent(@Observes TextEvent event) { List tagList = XMLParser.findTags(text, "propertyvalue"); if (debug) { - logger.finest("......" + tagList.size() + " tags found"); + logger.log(Level.FINEST, "......{0} tags found", tagList.size()); } // test if a tag exists... for (String tag : tagList) { @@ -92,7 +92,7 @@ public void onEvent(@Observes TextEvent event) { try { vValue = config.getValue(sPropertyKey, String.class); } catch (java.util.NoSuchElementException e) { - logger.warning("propertyvalue '" + sPropertyKey + "' is not defined in imixs.properties!"); + logger.log(Level.WARNING, "propertyvalue ''{0}'' is not defined in imixs.properties!", sPropertyKey); vValue = ""; } @@ -203,9 +203,8 @@ private static String formatObjectValue(Object o, String format, Locale locale) } singleValue = formatter.format(dateValue); } catch (Exception ef) { - Logger logger = Logger.getLogger(AbstractPlugin.class.getName()); - logger.warning("AbstractPlugin: Invalid format String '" + format + "'"); - logger.warning("AbstractPlugin: Can not format value - error: " + ef.getMessage()); + logger.log(Level.WARNING, "TextPropertyValueAdapter: Invalid format String ''{0}''", format); + logger.log(Level.WARNING, "TextPropertyValueAdapter: Can not format value - error: {0}", ef.getMessage()); return "" + dateValue; } } else diff --git a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/WorkflowScheduler.java b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/WorkflowScheduler.java index 982c25151..b6cf406a2 100644 --- a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/WorkflowScheduler.java +++ b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/WorkflowScheduler.java @@ -126,17 +126,17 @@ public boolean workItemInDue(ItemCollection doc, ItemCollection docActivity) { // 3=day, 4=workdays if (iOffsetUnit < 1 || iOffsetUnit > 4) { - logger.warning( - "error parsing delay in ActivityEntity " + docActivity.getItemValueInteger("numProcessID") - + "." + docActivity.getItemValueInteger("numActivityID") - + " : unsuported keyActivityDelayUnit=" + sDelayUnit); + logger.log(Level.WARNING, "error parsing delay in ActivityEntity {0}.{1} :" + + " unsuported keyActivityDelayUnit={2}", + new Object[]{docActivity.getItemValueInteger("numProcessID"), + docActivity.getItemValueInteger("numActivityID"), sDelayUnit}); return false; } } catch (NumberFormatException nfe) { - logger.warning( - "error parsing delay in ActivityEntity " + docActivity.getItemValueInteger("numProcessID") + "." - + docActivity.getItemValueInteger("numActivityID") + " :" + nfe.getMessage()); + logger.log(Level.WARNING, "error parsing delay in ActivityEntity {0}.{1} :{2}", + new Object[]{docActivity.getItemValueInteger("numProcessID"), + docActivity.getItemValueInteger("numActivityID"), nfe.getMessage()}); return false; } // get activityDelay from Event @@ -151,7 +151,7 @@ public boolean workItemInDue(ItemCollection doc, ItemCollection docActivity) { if ("4".equals(sDelayUnit)) sDelayUnit = "workdays"; - logger.finest("......" + suniqueid + " offset =" + iOffset + " " + sDelayUnit); + logger.log(Level.FINEST, "......{0} offset ={1} {2}", new Object[]{suniqueid, iOffset, sDelayUnit}); iCompareType = docActivity.getItemValueInteger("keyScheduledBaseObject"); @@ -161,7 +161,7 @@ public boolean workItemInDue(ItemCollection doc, ItemCollection docActivity) { switch (iCompareType) { // last process - case 1: { - logger.finest("......" + suniqueid + ": CompareType = last event"); + logger.log(Level.FINEST, "......{0}: CompareType = last event", suniqueid); // support deprecated fields $lastProcessingDate and timWorkflowLastAccess if (!doc.hasItem("$lastEventDate")) { @@ -174,12 +174,12 @@ public boolean workItemInDue(ItemCollection doc, ItemCollection docActivity) { } dateTimeCompare = doc.getItemValueDate("$lastEventDate"); if (dateTimeCompare == null) { - logger.warning(suniqueid + ": item '$lastEventDate' is missing!"); + logger.log(Level.WARNING, "{0}: item ''$lastEventDate'' is missing!", suniqueid); return false; } // compute scheduled time - logger.finest("......" + suniqueid + ": $lastEventDate=" + dateTimeCompare); + logger.log(Level.FINEST, "......{0}: $lastEventDate={1}", new Object[]{suniqueid, dateTimeCompare}); dateTimeCompare = adjustBaseDate(dateTimeCompare, iOffsetUnit, iOffset); if (dateTimeCompare != null) return dateTimeCompare.before(dateTimeNow); @@ -189,11 +189,11 @@ public boolean workItemInDue(ItemCollection doc, ItemCollection docActivity) { // last modification case 2: { - logger.finest("......" + suniqueid + ": CompareType = last modify"); + logger.log(Level.FINEST, "......{0}: CompareType = last modify", suniqueid); dateTimeCompare = doc.getItemValueDate("$modified"); - logger.finest("......" + suniqueid + ": modified=" + dateTimeCompare); + logger.log(Level.FINEST, "......{0}: modified={1}", new Object[]{suniqueid, dateTimeCompare}); dateTimeCompare = adjustBaseDate(dateTimeCompare, iOffsetUnit, iOffset); @@ -205,10 +205,10 @@ public boolean workItemInDue(ItemCollection doc, ItemCollection docActivity) { // creation case 3: { - logger.finest("......" + suniqueid + ": CompareType = creation"); + logger.log(Level.FINEST, "......{0}: CompareType = creation", suniqueid); dateTimeCompare = doc.getItemValueDate("$created"); - logger.finest("......" + suniqueid + ": doc.getCreated() =" + dateTimeCompare); + logger.log(Level.FINEST, "......{0}: doc.getCreated() ={1}", new Object[]{suniqueid, dateTimeCompare}); // Nein -> Creation date ist masstab dateTimeCompare = adjustBaseDate(dateTimeCompare, iOffsetUnit, iOffset); @@ -222,23 +222,23 @@ public boolean workItemInDue(ItemCollection doc, ItemCollection docActivity) { // field case 4: { String sNameOfField = docActivity.getItemValueString("keyTimeCompareField"); - logger.finest("......" + suniqueid + ": CompareType = field: '" + sNameOfField + "'"); + logger.log(Level.FINEST, "......{0}: CompareType = field: ''{1}''", new Object[]{suniqueid, sNameOfField}); if (!doc.hasItem(sNameOfField)) { - logger.finest("......" + suniqueid + ": CompareType =" + sNameOfField + " no value found!"); + logger.log(Level.FINEST, "......{0}: CompareType ={1} no value found!", new Object[]{suniqueid, sNameOfField}); return false; } dateTimeCompare = doc.getItemValueDate(sNameOfField); - logger.finest("......" + suniqueid + ": " + sNameOfField + "=" + dateTimeCompare); + logger.log(Level.FINEST, "......{0}: {1}={2}", new Object[]{suniqueid, sNameOfField, dateTimeCompare}); dateTimeCompare = adjustBaseDate(dateTimeCompare, iOffsetUnit, iOffset); if (dateTimeCompare != null) { - logger.finest("......" + suniqueid + ": Compare " + dateTimeCompare + " <-> " + dateTimeNow); + logger.log(Level.FINEST, "......{0}: Compare {1} <-> {2}", new Object[]{suniqueid, dateTimeCompare, dateTimeNow}); if (dateTimeCompare.before(dateTimeNow)) { - logger.finest("......" + suniqueid + " isInDue!"); + logger.log(Level.FINEST, "......{0} isInDue!", suniqueid); } return dateTimeCompare.before(dateTimeNow); } else @@ -323,8 +323,8 @@ public Calendar addWorkDays(final Calendar baseDate, final int days) { } } if (resultDate != null) { - logger.finest( - "......addWorkDays (" + baseDate.getTime() + ") + " + days + " = (" + resultDate.getTime() + ")"); + logger.log(Level.FINEST, "......addWorkDays ({0}) + {1} = ({2})", + new Object[]{baseDate.getTime(), days, resultDate.getTime()}); } return resultDate; } @@ -366,7 +366,7 @@ public ItemCollection run(ItemCollection configItemCollection) throws SchedulerE } } catch (Exception e) { - logger.severe("Error processing worklist: " + e.getMessage()); + logger.log(Level.SEVERE, "Error processing worklist: {0}", e.getMessage()); if (logger.isLoggable(Level.FINE)) { e.printStackTrace(); } @@ -408,12 +408,12 @@ protected Collection findScheduledEvents(String aModelVersion) t for (ItemCollection aprocessentity : colProcessList) { // select all activities for this process entity... int processid = aprocessentity.getItemValueInteger("numprocessid"); - logger.finest("......analyse processentity '" + processid + "'"); + logger.log(Level.FINEST, "......analyse processentity ''{0}''", processid); Collection aActivityList = modelService.getModel(aModelVersion) .findAllEventsByTask(processid); for (ItemCollection aactivityEntity : aActivityList) { - logger.finest("......analyse acitity '" + aactivityEntity.getItemValueString("txtname") + "'"); + logger.log(Level.FINEST, "......analyse acitity ''{0}''", aactivityEntity.getItemValueString("txtname")); // check if activity is scheduled if ("1".equals(aactivityEntity.getItemValueString("keyScheduledActivity"))) @@ -482,7 +482,7 @@ protected void processWorkListByEvent(ItemCollection event, ItemCollection confi if (worklist.size() == 0) { break; } else { - logger.finest("......" + worklist.size() + " workitems found in total, collect due date..."); + logger.log(Level.FINEST, "......{0} workitems found in total, collect due date...", worklist.size()); // update collector..... collectWorkitemsInDue(event, modelVersionEvent, worklist, worklistCollector); if (worklist.size() < MAX_WORKITEM_COUNT) { @@ -518,7 +518,8 @@ protected void processWorkListByEvent(ItemCollection event, ItemCollection confi workitem = workflowService.processWorkItemByNewTransaction(workitem); iProcessWorkItems++; } catch (Exception e) { - logger.warning("error processing workitem: " + workitem.getUniqueID() + " Error=" + e.getMessage()); + logger.log(Level.WARNING, "error processing workitem: {0} Error={1}", + new Object[]{workitem.getUniqueID(), e.getMessage()}); if (logger.isLoggable(Level.FINEST)) { e.printStackTrace(); } @@ -572,15 +573,16 @@ private void collectWorkitemsInDue(ItemCollection event, String modelVersionEven continue; } catch (ModelException me) { // ModelException - we migrate the model ... - logger.fine("...deprecated model version '" + workitem.getModelVersion() - + "' no longer exists -> migrating to new model version '" + modelVersionEvent + "'"); + logger.log(Level.FINE, "...deprecated model version ''{0}'' no longer exists ->" + + " migrating to new model version ''{1}''", + new Object[]{workitem.getModelVersion(), modelVersionEvent}); workitem.model(modelVersionEvent); } } // verify due date if (workItemInDue(workitem, event)) { - logger.finest("......document " + workitem.getUniqueID() + "is in due"); + logger.log(Level.FINEST, "......document {0}is in due", workitem.getUniqueID()); collector.add(workitem); } @@ -651,7 +653,7 @@ private QuerySelector findSelectorByName(String selectorClassName) { for (QuerySelector selector : this.selectors) { if (selector.getClass().getName().equals(selectorClassName)) { if (debug) { - logger.finest("......CDI selector '" + selectorClassName + "' successful injected"); + logger.log(Level.FINEST, "......CDI selector ''{0}'' successful injected", selectorClassName); } return selector; } diff --git a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/WorkflowService.java b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/WorkflowService.java index e22aa4a08..a2173de1b 100644 --- a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/WorkflowService.java +++ b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/WorkflowService.java @@ -134,7 +134,7 @@ public class WorkflowService implements WorkflowManager, WorkflowContext { @Inject protected Event textEvents; - private static Logger logger = Logger.getLogger(WorkflowService.class.getName()); + private static final Logger logger = Logger.getLogger(WorkflowService.class.getName()); @@ -184,7 +184,7 @@ public List getWorkListByOwner(String name, String type, int pag try { return documentService.find(searchTerm, pageSize, pageIndex, sortBy, sortReverse); } catch (QueryException e) { - logger.severe("getWorkListByOwner - invalid param: " + e.getMessage()); + logger.log(Level.SEVERE, "getWorkListByOwner - invalid param: {0}", e.getMessage()); return null; } } @@ -222,7 +222,7 @@ public List getWorkListByAuthor(String name, String type, int pa try { return documentService.find(searchTerm, pageSize, pageIndex, sortBy, sortReverse); } catch (QueryException e) { - logger.severe("getWorkListByAuthor - invalid param: " + e.getMessage()); + logger.log(Level.SEVERE, "getWorkListByAuthor - invalid param: {0}", e.getMessage()); return null; } } @@ -258,7 +258,7 @@ public List getWorkListByCreator(String name, String type, int p try { return documentService.find(searchTerm, pageSize, pageIndex, sortBy, sortReverse); } catch (QueryException e) { - logger.severe("getWorkListByCreator - invalid param: " + e.getMessage()); + logger.log(Level.SEVERE, "getWorkListByCreator - invalid param: {0}", e.getMessage()); return null; } } @@ -304,7 +304,7 @@ public List getWorkListByWriteAccess(String type, int pageSize, try { return documentService.find(searchTerm, pageSize, pageIndex, sortBy, sortReverse); } catch (QueryException e) { - logger.severe("getWorkListByWriteAccess - invalid param: " + e.getMessage()); + logger.log(Level.SEVERE, "getWorkListByWriteAccess - invalid param: {0}", e.getMessage()); return null; } } @@ -336,7 +336,7 @@ public List getWorkListByGroup(String name, String type, int pag try { return documentService.find(searchTerm, pageSize, pageIndex, sortBy, sortReverse); } catch (QueryException e) { - logger.severe("getWorkListByGroup - invalid param: " + e.getMessage()); + logger.log(Level.SEVERE, "getWorkListByGroup - invalid param: {0}", e.getMessage()); return null; } } @@ -368,7 +368,7 @@ public List getWorkListByProcessID(int aid, String type, int pag try { return documentService.find(searchTerm, pageSize, pageIndex, sortBy, sortReverse); } catch (QueryException e) { - logger.severe("getWorkListByProcessID - invalid param: " + e.getMessage()); + logger.log(Level.SEVERE, "getWorkListByProcessID - invalid param: {0}", e.getMessage()); return null; } } @@ -400,7 +400,7 @@ public List getWorkListByRef(String aref, String type, int pageS try { return documentService.find(searchTerm, pageSize, pageIndex, sortBy, sortReverse); } catch (QueryException e) { - logger.severe("getWorkListByRef - invalid param: " + e.getMessage()); + logger.log(Level.SEVERE, "getWorkListByRef - invalid param: {0}", e.getMessage()); return null; } } @@ -589,12 +589,12 @@ public ItemCollection processWorkItem(ItemCollection workitem) long lKernelTime = System.currentTimeMillis(); workitem = workflowkernel.process(workitem); if (debug) { - logger.fine("...WorkflowKernel processing time=" + (System.currentTimeMillis() - lKernelTime) + "ms"); + logger.log(Level.FINE, "...WorkflowKernel processing time={0}ms", System.currentTimeMillis() - lKernelTime); } } catch (PluginException pe) { // if a plugin exception occurs we roll back the transaction. - logger.severe("processing workitem '" + workitem.getItemValueString(WorkflowKernel.UNIQUEID) - + " failed, rollback transaction..."); + logger.log(Level.SEVERE, "processing workitem ''{0} failed, rollback transaction...", + workitem.getItemValueString(WorkflowKernel.UNIQUEID)); ctx.setRollbackOnly(); throw pe; } @@ -615,7 +615,7 @@ public ItemCollection processWorkItem(ItemCollection workitem) workitem = documentService.save(workitem); if (debug) { - logger.fine("...total processing time=" + (System.currentTimeMillis() - lStartTime) + "ms"); + logger.log(Level.FINE, "...total processing time={0}ms", System.currentTimeMillis() - lStartTime); } return workitem; } @@ -978,7 +978,7 @@ public ItemCollection evalWorkflowResult(ItemCollection event, String tag, ItemC result.appendItemValue(tagName, dateResult); } catch (ParseException e) { if (debug) { - logger.finer("failed to convert string into date object: " + e.getMessage()); + logger.log(Level.FINER, "failed to convert string into date object: {0}", e.getMessage()); } } } @@ -1100,7 +1100,7 @@ protected void registerPlugins(WorkflowKernel workflowkernel, Model model) throw if (aPlugin != null) { // register injected CDI Plugin if (debug) { - logger.finest("......register CDI plugin class: " + aPluginClassName + "..."); + logger.log(Level.FINEST, "......register CDI plugin class: {0}...", aPluginClassName); } workflowkernel.registerPlugin(aPlugin); } else { @@ -1118,7 +1118,7 @@ protected void registerAdapters(WorkflowKernel workflowkernel) { // iterate over all injected adapters.... for (Adapter adapter : this.adapters) { if (debug) { - logger.finest("......register CDI Adapter class '" + adapter.getClass().getName() + "'"); + logger.log(Level.FINEST, "......register CDI Adapter class ''{0}''", adapter.getClass().getName()); } workflowkernel.registerAdapter(adapter); } @@ -1194,7 +1194,7 @@ private Plugin findPluginByName(String pluginClassName) { for (Plugin plugin : this.plugins) { if (plugin.getClass().getName().equals(pluginClassName)) { if (debug) { - logger.finest("......CDI plugin '" + pluginClassName + "' successful injected"); + logger.log(Level.FINEST, "......CDI plugin ''{0}'' successful injected", pluginClassName); } return plugin; } diff --git a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/adapters/AccessAdapter.java b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/adapters/AccessAdapter.java index e35181593..c3a34e78f 100644 --- a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/adapters/AccessAdapter.java +++ b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/adapters/AccessAdapter.java @@ -67,7 +67,7 @@ public class AccessAdapter implements GenericAdapter, Serializable { private static final long serialVersionUID = 1L; - private static Logger logger = Logger.getLogger(AccessAdapter.class.getName()); + private static final Logger logger = Logger.getLogger(AccessAdapter.class.getName()); // See CDI Constructor protected WorkflowService workflowService; @@ -214,7 +214,7 @@ private void updateACLByItemCollection(ItemCollection documentContext, ItemColle if ((debug) && (vectorAccess.size() > 0)) { logger.finest("......[AccessPlugin] ReadAccess:"); for (int j = 0; j < vectorAccess.size(); j++) - logger.finest(" '" + (String) vectorAccess.get(j) + "'"); + logger.log(Level.FINEST, " ''{0}''", (String) vectorAccess.get(j)); } // update WriteAccess @@ -231,7 +231,7 @@ private void updateACLByItemCollection(ItemCollection documentContext, ItemColle if ((debug) && (vectorAccess.size() > 0)) { logger.finest("......[AccessPlugin] WriteAccess:"); for (int j = 0; j < vectorAccess.size(); j++) - logger.finest(" '" + (String) vectorAccess.get(j) + "'"); + logger.log(Level.FINEST, " ''{0}''", (String) vectorAccess.get(j)); } } diff --git a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/adminp/AdminPService.java b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/adminp/AdminPService.java index 17933b962..2c44ba659 100644 --- a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/adminp/AdminPService.java +++ b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/adminp/AdminPService.java @@ -118,7 +118,7 @@ public class AdminPService { @Any private Instance plugins; - private static Logger logger = Logger.getLogger(AdminPService.class.getName()); + private static final Logger logger = Logger.getLogger(AdminPService.class.getName()); /** * This Method starts a new TimerService for a given job. @@ -175,7 +175,7 @@ public ItemCollection createJob(ItemCollection adminp) throws AccessDeniedExcept Timer timer = timerService.createTimer(terminationDate, (interval * 1000), adminp.getItemValueString(WorkflowKernel.UNIQUEID)); - logger.info("Job " + jobtype + " (" + timer.getInfo().toString() + ") started... "); + logger.log(Level.INFO, "Job {0} ({1}) started... ", new Object[]{jobtype, timer.getInfo().toString()}); return adminp; } @@ -215,7 +215,7 @@ public void scheduleTimer(jakarta.ejb.Timer timer) { // verify if admin entity still exists if (adminp == null) { // configuration was removed - so stop the timer! - logger.info("Process " + sTimerID + " was removed - timer will be canceled"); + logger.log(Level.INFO, "Process {0} was removed - timer will be canceled", sTimerID); // stop timer timer.cancel(); // go out! @@ -223,7 +223,7 @@ public void scheduleTimer(jakarta.ejb.Timer timer) { } String job = adminp.getItemValueString("job"); - logger.info("Job " + job + " (" + adminp.getUniqueID() + ") processing..."); + logger.log(Level.INFO, "Job {0} ({1}) processing...", new Object[]{job, adminp.getUniqueID()}); // boolean jobfound = false; @@ -256,16 +256,16 @@ public void scheduleTimer(jakarta.ejb.Timer timer) { if (adminp.getItemValueBoolean("iscompleted")) { timer.cancel(); adminp.replaceItemValue("$workflowStatus", "COMPLETED"); - logger.info("Job " + job + " (" + adminp.getUniqueID() + ") completed - timer stopped"); + logger.log(Level.INFO, "Job {0} ({1}) completed - timer stopped", new Object[]{job, adminp.getUniqueID()}); } else { adminp.replaceItemValue("$workflowStatus", "WAITING"); } } else { - logger.warning("Unable to start AdminP Job. JobHandler class '" + job + "' not defined!"); + logger.log(Level.WARNING, "Unable to start AdminP Job. JobHandler class ''{0}'' not defined!", job); timer.cancel(); adminp.replaceItemValue("$workflowStatus", "FAILED"); - logger.info("Job " + adminp.getUniqueID() + " - timer stopped"); + logger.log(Level.INFO, "Job {0} - timer stopped", adminp.getUniqueID()); } } catch (AdminPException e) { @@ -286,14 +286,14 @@ public void scheduleTimer(jakarta.ejb.Timer timer) { logger.warning("Unable to update adminp job status - adminp document is null!"); } } catch (AccessDeniedException | EJBException e2) { - logger.warning("Unable to update adminp job status - reason: " + e2.getMessage()); + logger.log(Level.WARNING, "Unable to update adminp job status - reason: {0}", e2.getMessage()); if (debug) { e2.printStackTrace(); } } } - logger.fine("...timer call finished successfull after " + ((System.currentTimeMillis()) - lProfiler) + " ms"); + logger.log(Level.FINE, "...timer call finished successfull after {0} ms", (System.currentTimeMillis()) - lProfiler); } @@ -315,7 +315,7 @@ private JobHandler findJobHandlerByName(String jobHandlerClassName) { // iterate over all injected JobHandlers.... for (JobHandler jobHandler : this.jobHandlers) { if (jobHandler.getClass().getName().equals(jobHandlerClassName)) { - logger.finest("......CDI JobHandler '" + jobHandlerClassName + "' successful injected"); + logger.log(Level.FINEST, "......CDI JobHandler ''{0}'' successful injected", jobHandlerClassName); return jobHandler; } } @@ -332,18 +332,18 @@ private JobHandler findJobHandlerByName(String jobHandlerClassName) { */ private ItemCollection cancelTimer(String id) { - logger.finest("......cancelTimer - id:" + id + " ...."); + logger.log(Level.FINEST, "......cancelTimer - id:{0} ....", id); ItemCollection adminp = documentService.load(id); if (adminp == null) { - logger.warning("failed to load timer data ID:" + id + " "); + logger.log(Level.WARNING, "failed to load timer data ID:{0} ", id); } // try to cancel an existing timer Timer timer = this.findTimer(id); if (timer != null) { timer.cancel(); - logger.info("cancelTimer - id:" + id + " successful."); + logger.log(Level.INFO, "cancelTimer - id:{0} successful.", id); } else { - logger.info("cancelTimer - id:" + id + " failed - timer does no longer exist."); + logger.log(Level.INFO, "cancelTimer - id:{0} failed - timer does no longer exist.", id); } if (adminp != null) { adminp.replaceItemValue("txtTimerStatus", "Stopped"); @@ -372,7 +372,7 @@ private Timer findTimer(String id) { } } } - logger.warning("findTimer - id:" + id + " does no longer exist."); + logger.log(Level.WARNING, "findTimer - id:{0} does no longer exist.", id); return null; } } diff --git a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/adminp/JobHandlerRebuildIndex.java b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/adminp/JobHandlerRebuildIndex.java index 364fc94ee..18468be9c 100644 --- a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/adminp/JobHandlerRebuildIndex.java +++ b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/adminp/JobHandlerRebuildIndex.java @@ -54,6 +54,7 @@ import jakarta.persistence.EntityManager; import jakarta.persistence.PersistenceContext; import jakarta.persistence.Query; +import java.util.logging.Level; /** * JobHandler to rebuild the lucene fulltext index. @@ -86,7 +87,7 @@ public class JobHandlerRebuildIndex implements JobHandler { @Inject UpdateService updateService; - private static Logger logger = Logger.getLogger(JobHandlerRebuildIndex.class.getName()); + private static final Logger logger = Logger.getLogger(JobHandlerRebuildIndex.class.getName()); /** * This method runs the RebuildLuceneIndexJob. The job starts at creation date @@ -118,8 +119,8 @@ public ItemCollection run(ItemCollection adminp) throws AdminPException { if (jobTimeOut > 0) { // fix deprecated invtervall unit if (jobTimeOut <= 5) { // <5 seconds - logger.warning( - "fix deprecated interval of " + jobTimeOut + " - set new job interval to " + time_out + "sec"); + logger.log(Level.WARNING, "fix deprecated interval of {0} - set new job interval to {1}sec", + new Object[]{jobTimeOut, time_out}); jobTimeOut = time_out; } // overwrite default time_out @@ -127,8 +128,8 @@ public ItemCollection run(ItemCollection adminp) throws AdminPException { } // update interval adminp.setItemValue("numinterval", time_out); - logger.info("...Job " + AdminPService.JOB_REBUILD_INDEX + " (" + adminp.getUniqueID() - + ") - lucene.rebuild.time_out=" + time_out); + logger.log(Level.INFO, "...Job " + AdminPService.JOB_REBUILD_INDEX + " ({0}) - lucene.rebuild.time_out={1}", + new Object[]{adminp.getUniqueID(), time_out}); try { while (true) { List resultList = new ArrayList(); @@ -140,7 +141,8 @@ public ItemCollection run(ItemCollection adminp) throws AdminPException { try { resultList.add(new ItemCollection(doc.getData())); } catch (InvalidAccessException e) { - logger.warning("...unable to index document '" + doc.getId() + "' " + e.getMessage()); + logger.log(Level.WARNING, "...unable to index document ''{0}'' {1}", + new Object[]{doc.getId(), e.getMessage()}); } // detach object! manager.detach(doc); @@ -159,8 +161,9 @@ public ItemCollection run(ItemCollection adminp) throws AdminPException { if (time == 0) { time = 1; } - logger.info("...Job " + AdminPService.JOB_REBUILD_INDEX + " (" + adminp.getUniqueID() - + ") - ..." + totalCount + " documents indexed in " + time + " sec. ... "); + logger.log(Level.INFO,"...Job " + AdminPService.JOB_REBUILD_INDEX + + " ({0}) - ...{1} documents indexed in {2} sec. ... ", + new Object[]{adminp.getUniqueID(), totalCount, time}); blockCount = 0; } } else { @@ -175,8 +178,9 @@ public ItemCollection run(ItemCollection adminp) throws AdminPException { time = 1; } if (time > time_out) { // suspend after 2 mintues (default 120).... - logger.info("...Job " + AdminPService.JOB_REBUILD_INDEX + " (" + adminp.getUniqueID() - + ") - suspended: " + totalCount + " documents indexed in " + time + " sec. "); + logger.log(Level.INFO,"...Job " + AdminPService.JOB_REBUILD_INDEX + + " ({0}) - suspended: {1} documents indexed in {2} sec. ", + new Object[]{adminp.getUniqueID(), totalCount, time}); adminp.replaceItemValue("_syncpoint", syncPoint); adminp.replaceItemValue(JobHandler.ISCOMPLETED, false); @@ -188,9 +192,9 @@ public ItemCollection run(ItemCollection adminp) throws AdminPException { } } catch (Exception e) { // print exception and stop job - logger.severe("...Job " + AdminPService.JOB_REBUILD_INDEX + " (" + adminp.getUniqueID() + ") - failed - " - + e.getMessage() + " last syncpoint " + syncPoint + " - " + totalCount - + " documents reindexed...."); + logger.log(Level.SEVERE,"...Job " + AdminPService.JOB_REBUILD_INDEX + + " ({0}) - failed - {1} last syncpoint {2} - {3} documents reindexed....", + new Object[]{adminp.getUniqueID(), e.getMessage(), syncPoint, totalCount}); e.printStackTrace(); adminp.replaceItemValue(JobHandler.ISCOMPLETED, false); // update syncpoint @@ -209,8 +213,9 @@ public ItemCollection run(ItemCollection adminp) throws AdminPException { if (time == 0) { time = 1; } - logger.info("...Job " + AdminPService.JOB_REBUILD_INDEX + " (" + adminp.getUniqueID() + ") - Finished: " - + totalCount + " documents indexed in " + time + " sec. "); + logger.log(Level.INFO,"...Job " + AdminPService.JOB_REBUILD_INDEX + + " ({0}) - Finished: {1} documents indexed in {2} sec. ", + new Object[]{adminp.getUniqueID(), totalCount, time}); adminp.replaceItemValue(JobHandler.ISCOMPLETED, true); adminp.replaceItemValue("numUpdates", totalCount); diff --git a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/adminp/JobHandlerRenameUser.java b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/adminp/JobHandlerRenameUser.java index d2ca5f6d5..a8c8d2516 100644 --- a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/adminp/JobHandlerRenameUser.java +++ b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/adminp/JobHandlerRenameUser.java @@ -54,6 +54,7 @@ import jakarta.ejb.Stateless; import jakarta.ejb.TransactionAttribute; import jakarta.ejb.TransactionAttributeType; +import java.util.logging.Level; /** * The JobHandlerRenameUser updates the name fields of workitems. A name can be @@ -102,7 +103,7 @@ public class JobHandlerRenameUser implements JobHandler { DocumentService documentService; private static final int DEFAULT_COUNT = 100; - private static Logger logger = Logger.getLogger(JobHandlerRenameUser.class.getName()); + private static final Logger logger = Logger.getLogger(JobHandlerRenameUser.class.getName()); /** * This method creates a new AdminP Job to rename userId in workitems. @@ -201,9 +202,9 @@ public ItemCollection run(ItemCollection adminp) throws AdminPException { time = 1; } - logger.info("Job " + AdminPService.JOB_RENAME_USER + " (" + adminp.getUniqueID() + ") - " + colSize - + " documents processed, " + iUpdates + " updates in " + time + " sec. (in total: " + iProcessed - + " processed, " + iUpdates + " updates)"); + logger.log(Level.INFO, "Job " + AdminPService.JOB_RENAME_USER + " ({0}) - {1} documents processed," + + " {2} updates in {3} sec. (in total: {4} processed, {5} updates)", + new Object[]{adminp.getUniqueID(), colSize, iUpdates, time, iProcessed, iUpdates}); // if colSize " + to + " (replace=" + replace + ")"; entity.appendItemValue("txtAdminpLog", new Date(System.currentTimeMillis()) + " " + summary); documentService.save(entity); - logger.finest("......updated: " + entity.getItemValueString(WorkflowKernel.UNIQUEID)); + logger.log(Level.FINEST, "......updated: {0}", entity.getItemValueString(WorkflowKernel.UNIQUEID)); } return bUpdate; } diff --git a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/adminp/JobHandlerUpgradeWorkitems.java b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/adminp/JobHandlerUpgradeWorkitems.java index 0306b88ab..a138b957c 100644 --- a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/adminp/JobHandlerUpgradeWorkitems.java +++ b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/adminp/JobHandlerUpgradeWorkitems.java @@ -51,6 +51,7 @@ import jakarta.ejb.Stateless; import jakarta.ejb.TransactionAttribute; import jakarta.ejb.TransactionAttributeType; +import java.util.logging.Level; /** * JobHandler to upgrate existing workItems to the latest workflow version. @@ -123,22 +124,22 @@ public ItemCollection run(ItemCollection adminp) throws AdminPException { int iProcessed = adminp.getItemValueInteger("numProcessed"); String query = buildQuery(adminp); - logger.finest("......JQPL query: " + query); + logger.log(Level.FINEST, "......JQPL query: {0}", query); adminp.replaceItemValue("txtQuery", query); logger.info("... selecting workitems..."); List workitemList = documentService.getDocumentsByQuery(query, iIndex, iBlockSize); int colSize = workitemList.size(); // Update index - logger.info("Job " + AdminPService.JOB_UPGRADE + " (" + adminp.getUniqueID() + ") - verifeing " + colSize - + " workitems..."); + logger.log(Level.INFO,"Job " + AdminPService.JOB_UPGRADE + + " ({0}) - verifeing {1} workitems...", new Object[]{adminp.getUniqueID(), colSize}); int iCount = 0; for (ItemCollection workitem : workitemList) { // only look into documents with a model version... if (workitem.hasItem(WorkflowKernel.MODELVERSION)) { if (upgradeWorkitem(workitem)) { // update workitem... - logger.info("...upgrade '" + workitem.getUniqueID() + "' ..."); + logger.log(Level.INFO, "...upgrade ''{0}'' ...", workitem.getUniqueID()); documentService.saveByNewTransaction(workitem); iCount++; } @@ -158,9 +159,9 @@ public ItemCollection run(ItemCollection adminp) throws AdminPException { time = 1; } - logger.info("Job " + AdminPService.JOB_UPGRADE + " (" + adminp.getUniqueID() + ") - " + colSize - + " documents processed, " + iCount + " updates in " + time + " sec. (in total: " + iProcessed - + " processed, " + iUpdates + " updates)"); + logger.log(Level.INFO,"Job " + AdminPService.JOB_UPGRADE + " ({0}) - {1} documents processed," + + " {2} updates in {3} sec. (in total: {4} processed, {5} updates)", + new Object[]{adminp.getUniqueID(), colSize, iCount, time, iProcessed, iUpdates}); // if colSize(); @@ -339,7 +339,7 @@ public String getExtendedSearchTerm(String sSearchTerm) throws QueryException { sAccessTerm += ") AND "; sSearchTerm = sAccessTerm + sSearchTerm; } - logger.finest("......lucene final searchTerm=" + sSearchTerm); + logger.log(Level.FINEST, "......lucene final searchTerm={0}", sSearchTerm); return sSearchTerm; } diff --git a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/plugins/AccessPlugin.java b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/plugins/AccessPlugin.java index b78a370f9..4f32e7bd2 100644 --- a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/plugins/AccessPlugin.java +++ b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/plugins/AccessPlugin.java @@ -41,7 +41,7 @@ */ @Deprecated public class AccessPlugin extends AbstractPlugin { - private static Logger logger = Logger.getLogger(AccessPlugin.class.getName()); + private static final Logger logger = Logger.getLogger(AccessPlugin.class.getName()); @Deprecated public ItemCollection run(ItemCollection adocumentContext, ItemCollection documentActivity) throws PluginException { diff --git a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/plugins/AnalysisPlugin.java b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/plugins/AnalysisPlugin.java index a236b7c3f..b441bbfe4 100644 --- a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/plugins/AnalysisPlugin.java +++ b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/plugins/AnalysisPlugin.java @@ -31,6 +31,7 @@ import java.util.ArrayList; import java.util.Date; import java.util.List; +import java.util.logging.Level; import java.util.logging.Logger; import org.imixs.workflow.ItemCollection; import org.imixs.workflow.exceptions.PluginException; @@ -71,7 +72,7 @@ public class AnalysisPlugin extends AbstractPlugin { public static final String INVALID_FORMAT = "INVALID_FORMAT"; - private static Logger logger = Logger.getLogger(AnalysisPlugin.class.getName()); + private static final Logger logger = Logger.getLogger(AnalysisPlugin.class.getName()); @SuppressWarnings({ "unchecked", "rawtypes" }) @Override @@ -92,10 +93,10 @@ public ItemCollection run(ItemCollection documentContext, ItemCollection documen // the length of stop list must be the same as the start list if (valuesStart.size() != valuesStop.size()) { - logger.warning("[AnalysisPlugin] Wrong measure point '" + point.name - + "' starttime without stoptime! - please check model entry " - + documentActivity.getItemValueInteger("numProcessID") + "." - + documentActivity.getItemValueInteger("numActivityID") + " measurepoint will be ignored!"); + logger.log(Level.WARNING, "[AnalysisPlugin] Wrong measure point ''{0}'' starttime without stoptime!" + + " - please check model entry {1}.{2} measurepoint will be ignored!", + new Object[]{point.name, documentActivity.getItemValueInteger("numProcessID"), + documentActivity.getItemValueInteger("numActivityID")}); continue; } @@ -109,10 +110,10 @@ public ItemCollection run(ItemCollection documentContext, ItemCollection documen List valuesStop = documentContext.getItemValue("datMeasurePointStop_" + point.name); if (valuesStop.size() != (valuesStart.size() - 1)) { - logger.warning("[AnalysisPlugin] Wrong measure point '" + point.name - + "' stoptime without starttime! - please check model entry " - + documentActivity.getItemValueInteger("numProcessID") + "." - + documentActivity.getItemValueInteger("numActivityID") + " measurepoint will be ignored!"); + logger.log(Level.WARNING, "[AnalysisPlugin] Wrong measure point ''{0}'' stoptime without starttime!" + + " - please check model entry {1}.{2} measurepoint will be ignored!", + new Object[]{point.name, documentActivity.getItemValueInteger("numProcessID"), + documentActivity.getItemValueInteger("numActivityID")}); continue; } diff --git a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/plugins/ApplicationPlugin.java b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/plugins/ApplicationPlugin.java index 504c26828..070188181 100644 --- a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/plugins/ApplicationPlugin.java +++ b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/plugins/ApplicationPlugin.java @@ -82,7 +82,7 @@ public class ApplicationPlugin extends AbstractPlugin { private String sAbstract; private String sSummary; @SuppressWarnings("unused") - private static Logger logger = Logger.getLogger(ApplicationPlugin.class.getName()); + private static final Logger logger = Logger.getLogger(ApplicationPlugin.class.getName()); public ItemCollection run(ItemCollection adocumentContext, ItemCollection adocumentActivity) throws PluginException { diff --git a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/plugins/ApproverPlugin.java b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/plugins/ApproverPlugin.java index dd5398ad2..f389c4b8f 100644 --- a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/plugins/ApproverPlugin.java +++ b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/plugins/ApproverPlugin.java @@ -74,7 +74,7 @@ */ public class ApproverPlugin extends AbstractPlugin { - private static Logger logger = Logger.getLogger(ApproverPlugin.class.getName()); + private static final Logger logger = Logger.getLogger(ApproverPlugin.class.getName()); public static String APPROVEDBY = "$approvedby"; public static String APPROVERS = "$approvers"; @@ -106,7 +106,7 @@ public ItemCollection run(ItemCollection workitem, ItemCollection event) throws refresh = false; } if (debug) { - logger.fine("refresh=" + refresh); + logger.log(Level.FINE, "refresh={0}", refresh); } // test reset reset = false; @@ -114,7 +114,7 @@ public ItemCollection run(ItemCollection workitem, ItemCollection event) throws reset = true; } if (debug) { - logger.fine("reset=" + reset); + logger.log(Level.FINE, "reset={0}", reset); } // 1.) extract the groups definitions List groups = evalItemCollection.getItemValue(EVAL_APPROVEDBY); @@ -132,7 +132,7 @@ public ItemCollection run(ItemCollection workitem, ItemCollection event) throws if (!workitem.hasItem(aGroup + APPROVERS) || reset) { if (debug) { - logger.fine("creating new approver list: " + aGroup + "=" + newAppoverList); + logger.log(Level.FINE, "creating new approver list: {0}={1}", new Object[]{aGroup, newAppoverList}); } workitem.replaceItemValue(aGroup + APPROVERS, newAppoverList); workitem.removeItem(aGroup + APPROVEDBY); @@ -148,7 +148,7 @@ public ItemCollection run(ItemCollection workitem, ItemCollection event) throws List listApprovedBy = workitem.getItemValue(aGroup + APPROVEDBY); List listApprovers = workitem.getItemValue(aGroup + APPROVERS); if (debug) { - logger.fine("approved by: " + currentAppover); + logger.log(Level.FINE, "approved by: {0}", currentAppover); } if (listApprovers.contains(currentAppover) && !listApprovedBy.contains(currentAppover)) { listApprovers.remove(currentAppover); @@ -159,7 +159,7 @@ public ItemCollection run(ItemCollection workitem, ItemCollection event) throws workitem.replaceItemValue(aGroup + APPROVERS, listApprovers); workitem.replaceItemValue(aGroup + APPROVEDBY, listApprovedBy); if (debug) { - logger.fine("new list of approvedby: " + aGroup + "=" + listApprovedBy); + logger.log(Level.FINE, "new list of approvedby: {0}={1}", new Object[]{aGroup, listApprovedBy}); } } } @@ -197,7 +197,7 @@ void refreshApprovers(ItemCollection workitem, String sourceItem) { if (!listApprovedBy.contains(approver) && !listApprovers.contains(approver)) { // add the new member to the existing approver list if (debug) { - logger.fine("adding new approver to list '" + sourceItem + APPROVERS + "'"); + logger.log(Level.FINE, "adding new approver to list ''{0}{1}''", new Object[]{sourceItem, APPROVERS}); } listApprovers.add(approver); // remove empty entries... @@ -208,7 +208,7 @@ void refreshApprovers(ItemCollection workitem, String sourceItem) { } if (update) { if (debug) { - logger.fine("updating approver list '" + sourceItem + APPROVERS + "'"); + logger.log(Level.FINE, "updating approver list ''{0}{1}''", new Object[]{sourceItem, APPROVERS}); } workitem.replaceItemValue(sourceItem + APPROVERS, listApprovers); } diff --git a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/plugins/DocumentComposerPlugin.java b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/plugins/DocumentComposerPlugin.java index 66293ce70..6fde39ea2 100644 --- a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/plugins/DocumentComposerPlugin.java +++ b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/plugins/DocumentComposerPlugin.java @@ -35,6 +35,7 @@ import java.util.logging.Logger; import jakarta.xml.bind.JAXBContext; import jakarta.xml.bind.Marshaller; +import java.util.logging.Level; import org.imixs.workflow.ItemCollection; import org.imixs.workflow.WorkflowContext; import org.imixs.workflow.exceptions.ModelException; @@ -65,7 +66,7 @@ public class DocumentComposerPlugin extends AbstractPlugin { public static String INVALID_DATA_OBJECT = "INVALID_DATA_OBJECT"; public static String INVALID_XSL_FORMAT = "INVALID_XSL_FORMAT"; - private static Logger logger = Logger.getLogger(DocumentComposerPlugin.class.getName()); + private static final Logger logger = Logger.getLogger(DocumentComposerPlugin.class.getName()); @Override public void init(WorkflowContext actx) throws PluginException { @@ -106,7 +107,7 @@ public ItemCollection run(ItemCollection documentContext, ItemCollection event) String output = transformXSLTemplate(documentContext, template); documentContext.replaceItemValue(outputItem, output); - logger.fine("...composed document in " + (System.currentTimeMillis() - l) + "ms"); + logger.log(Level.FINE, "...composed document in {0}ms", System.currentTimeMillis() - l); } } diff --git a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/plugins/EventLogPlugin.java b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/plugins/EventLogPlugin.java index 4f7a5112a..fdd785fea 100644 --- a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/plugins/EventLogPlugin.java +++ b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/plugins/EventLogPlugin.java @@ -69,7 +69,7 @@ public class EventLogPlugin extends AbstractPlugin { public static final String INVALID_FORMAT = "INVALID_FORMAT"; - private static Logger logger = Logger.getLogger(EventLogPlugin.class.getName()); + private static final Logger logger = Logger.getLogger(EventLogPlugin.class.getName()); @Inject EventLogService eventLogService; diff --git a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/plugins/HistoryPlugin.java b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/plugins/HistoryPlugin.java index 2615b0f1d..7e5a24d1a 100644 --- a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/plugins/HistoryPlugin.java +++ b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/plugins/HistoryPlugin.java @@ -67,7 +67,7 @@ public class HistoryPlugin extends AbstractPlugin { private ItemCollection documentContext; private List> historyList = null; - private static Logger logger = Logger.getLogger(HistoryPlugin.class.getName()); + private static final Logger logger = Logger.getLogger(HistoryPlugin.class.getName()); /** * Update the Log entry. diff --git a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/plugins/IntervalPlugin.java b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/plugins/IntervalPlugin.java index 9ac717a6b..e29abffe0 100644 --- a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/plugins/IntervalPlugin.java +++ b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/plugins/IntervalPlugin.java @@ -35,6 +35,7 @@ import java.time.temporal.TemporalUnit; import java.util.Optional; import java.util.Set; +import java.util.logging.Level; import java.util.logging.Logger; import java.util.regex.Pattern; @@ -71,7 +72,7 @@ public class IntervalPlugin extends AbstractPlugin { public boolean increase = false; private ItemCollection documentContext; - private static Logger logger = Logger.getLogger(IntervalPlugin.class.getName()); + private static final Logger logger = Logger.getLogger(IntervalPlugin.class.getName()); /** * The method paresed for a fields with the prafix 'keyitnerval' @@ -129,9 +130,9 @@ public ItemCollection run(ItemCollection adocumentContext, ItemCollection event) "invalid interval configuration: ref item is missing for " + "macro!"); } - logger.info("......cron=" + cron); - logger.info("......macro=" + macro); - logger.info("......ref=" + ref); + logger.log(Level.INFO, "......cron={0}", cron); + logger.log(Level.INFO, "......macro={0}", macro); + logger.log(Level.INFO, "......ref={0}", ref); // compute cron or macro interval if (!cron.isEmpty()) { @@ -296,7 +297,7 @@ private LocalDateTime adjustDateTimeByCronUnit(String cronUnit, LocalDateTime ba if (cronUnit.contains(",")) { String[] units = cronUnit.split(","); // 9,15 - logger.info(" unit now = " + nowUnit); + logger.log(Level.INFO, " unit now = {0}", nowUnit); boolean found = false; for (String singleUnit : units) { if (Integer.parseInt(singleUnit) >= nowUnit) { diff --git a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/plugins/MailPlugin.java b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/plugins/MailPlugin.java index 0bc759e93..59423567e 100644 --- a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/plugins/MailPlugin.java +++ b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/plugins/MailPlugin.java @@ -113,7 +113,7 @@ public class MailPlugin extends AbstractPlugin { private String charSet = "ISO-8859-1"; private boolean bHTMLMail = false; - private static Logger logger = Logger.getLogger(MailPlugin.class.getName()); + private static final Logger logger = Logger.getLogger(MailPlugin.class.getName()); /** * The run method creates a mailMessage object if recipients are defined by the @@ -195,7 +195,7 @@ public ItemCollection run(ItemCollection documentContext, ItemCollection documen // set mailbody MimeBodyPart messagePart = new MimeBodyPart(); if (debug) { - logger.finest("......ContentType: '" + getContentType() + "'"); + logger.log(Level.FINEST, "......ContentType: ''{0}''", getContentType()); } messagePart.setContent(aBodyText, getContentType()); // append message part @@ -234,7 +234,7 @@ public void close(boolean rollbackTransaction) throws PluginException { logger.info("Running in TestMode, forwarding mails to:"); for (String adr : vRecipients) { - logger.info(" " + adr); + logger.log(Level.INFO, " {0}", adr); } try { getMailMessage().setRecipients(Message.RecipientType.CC, null); @@ -276,13 +276,13 @@ public void close(boolean rollbackTransaction) throws PluginException { trans.sendMessage(mailMessage, mailMessage.getAllRecipients()); trans.close(); if (debug) { - logger.finest("...mail transfer in " + (System.currentTimeMillis() - l) + "ms"); + logger.log(Level.FINEST, "...mail transfer in {0}ms", System.currentTimeMillis() - l); } } - logger.info("...send mail: MessageID=" + mailMessage.getMessageID()); + logger.log(Level.INFO, "...send mail: MessageID={0}", mailMessage.getMessageID()); } catch (Exception esend) { - logger.warning("close failed with exception: " + esend.toString()); + logger.log(Level.WARNING, "close failed with exception: {0}", esend.toString()); } } } @@ -311,7 +311,7 @@ public String getFrom(ItemCollection documentContext, ItemCollection documentAct if (sFrom == null || sFrom.isEmpty()) sFrom = this.getWorkflowService().getUserName(); if (debug) { - logger.finest("......From: " + sFrom); + logger.log(Level.FINEST, "......From: {0}", sFrom); } return sFrom; } @@ -334,7 +334,7 @@ public String getReplyTo(ItemCollection documentContext, ItemCollection document else sReplyTo = documentActivity.getItemValueString("namMailReplyToUser"); if (debug) { - logger.finest("......ReplyTo=" + sReplyTo); + logger.log(Level.FINEST, "......ReplyTo={0}", sReplyTo); } return sReplyTo; } @@ -353,7 +353,7 @@ public String getSubject(ItemCollection documentContext, ItemCollection document String subject = getWorkflowService().adaptText(documentActivity.getItemValueString("txtMailSubject"), documentContext); if (debug) { - logger.finest("......Subject: " + subject); + logger.log(Level.FINEST, "......Subject: {0}", subject); } return subject; } @@ -380,9 +380,9 @@ public List getRecipients(ItemCollection documentContext, ItemCollection // write debug Log if (logger.isLoggable(Level.FINE)) { - logger.finest("......" + vectorRecipients.size() + " Receipients: "); + logger.log(Level.FINEST, "......{0} Receipients: ", vectorRecipients.size()); for (String rez : vectorRecipients) - logger.finest(" " + rez); + logger.log(Level.FINEST, " {0}", rez); } return vectorRecipients; @@ -409,9 +409,9 @@ public List getRecipientsCC(ItemCollection documentContext, ItemCollecti // write debug Log if (logger.isLoggable(Level.FINE)) { - logger.finest("......" + vectorRecipients.size() + " ReceipientsCC: "); + logger.log(Level.FINEST, "......{0} ReceipientsCC: ", vectorRecipients.size()); for (String rez : vectorRecipients) - logger.finest(" " + rez); + logger.log(Level.FINEST, " {0}", rez); } return vectorRecipients; } @@ -437,9 +437,9 @@ public List getRecipientsBCC(ItemCollection documentContext, ItemCollect // write debug Log if (logger.isLoggable(Level.FINE)) { - logger.finest("......" + vectorRecipients.size() + " ReceipientsBCC: "); + logger.log(Level.FINEST, "......{0} ReceipientsBCC: ", vectorRecipients.size()); for (String rez : vectorRecipients) - logger.finest(" " + rez); + logger.log(Level.FINEST, " {0}", rez); } return vectorRecipients; } @@ -556,12 +556,12 @@ public void initMailMessage() throws AddressException, MessagingException { Enumeration enumer = props.keys(); while (enumer.hasMoreElements()) { String aKey = enumer.nextElement().toString(); - logger.finest("...... ProperyName= " + aKey); + logger.log(Level.FINEST, "...... ProperyName= {0}", aKey); Object value = props.getProperty(aKey); if (value == null) logger.finest("...... PropertyValue=null"); else - logger.finest("...... PropertyValue= " + props.getProperty(aKey).toString()); + logger.log(Level.FINEST, "...... PropertyValue= {0}", props.getProperty(aKey)); } } mailMessage = new MimeMessage(mailSession); diff --git a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/plugins/OwnerPlugin.java b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/plugins/OwnerPlugin.java index 283164021..76c78aa6f 100644 --- a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/plugins/OwnerPlugin.java +++ b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/plugins/OwnerPlugin.java @@ -84,7 +84,7 @@ public class OwnerPlugin extends AbstractPlugin { private ItemCollection documentActivity; private ItemCollection documentNextProcessEntity; - private static Logger logger = Logger.getLogger(OwnerPlugin.class.getName()); + private static final Logger logger = Logger.getLogger(OwnerPlugin.class.getName()); /** * changes the '$owner' item depending to the activityentity or processEntity @@ -162,7 +162,7 @@ private void updateOwnerByItemCollection(ItemCollection modelEntity) throws Plug if ((logger.isLoggable(Level.FINE)) && (newOwnerList.size() > 0)) { logger.finest("......Owners:"); for (int j = 0; j < newOwnerList.size(); j++) - logger.finest(" '" + (String) newOwnerList.get(j) + "'"); + logger.log(Level.FINEST, " ''{0}''", (String) newOwnerList.get(j)); } // we also need to support the deprecated iten name "namOwner" which was diff --git a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/plugins/ReportPlugin.java b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/plugins/ReportPlugin.java index f3d69b852..1d5158b31 100644 --- a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/plugins/ReportPlugin.java +++ b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/plugins/ReportPlugin.java @@ -71,7 +71,7 @@ public class ReportPlugin extends AbstractPlugin { public static final String REPORT_UNDEFINED = "REPORT_UNDEFINED"; public static final String INVALID_REPORT_DEFINITION = "INVALID_REPORT_DEFINITION"; - private static Logger logger = Logger.getLogger(ReportPlugin.class.getName()); + private static final Logger logger = Logger.getLogger(ReportPlugin.class.getName()); /** * Executes a report defined defined by the event in the attribute diff --git a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/plugins/ResultPlugin.java b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/plugins/ResultPlugin.java index 969d70344..7ed641cb1 100644 --- a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/plugins/ResultPlugin.java +++ b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/plugins/ResultPlugin.java @@ -30,6 +30,7 @@ import java.util.Arrays; import java.util.List; +import java.util.logging.Level; import java.util.logging.Logger; import org.imixs.workflow.ItemCollection; @@ -61,7 +62,7 @@ public class ResultPlugin extends AbstractPlugin { public static List SPPORTED_KERNEL_ITEMS = Arrays.asList("$file", "$snapshot.history"); - private static Logger logger = Logger.getLogger(ResultPlugin.class.getName()); + private static final Logger logger = Logger.getLogger(ResultPlugin.class.getName()); public ItemCollection run(ItemCollection documentContext, ItemCollection event) throws PluginException { // evaluate new items.... @@ -74,8 +75,8 @@ public ItemCollection run(ItemCollection documentContext, ItemCollection event) // do not accept items starting with $ // allow $file - Issue #644 if (!isValidItemName(itemName)) { - logger.warning(" tag contains unsupported item name '" + itemName - + "' - verify event result definition!"); + logger.log(Level.WARNING, " tag contains unsupported item name ''{0}''" + + " - verify event result definition!", itemName); evalItemCollection.removeItem(itemName); } diff --git a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/plugins/RulePlugin.java b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/plugins/RulePlugin.java index 35ffaf8f0..d6c5789b5 100644 --- a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/plugins/RulePlugin.java +++ b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/plugins/RulePlugin.java @@ -30,6 +30,7 @@ import java.util.List; import java.util.Map; +import java.util.logging.Level; import java.util.logging.Logger; import org.imixs.workflow.ItemCollection; @@ -100,7 +101,7 @@ public class RulePlugin extends AbstractPlugin { public static final String INVALID_SCRIPT = "INVALID_SCRIPT"; public static final String VALIDATION_ERROR = "VALIDATION_ERROR"; - private static Logger logger = Logger.getLogger(RulePlugin.class.getName()); + private static final Logger logger = Logger.getLogger(RulePlugin.class.getName()); /** * The run method evaluates a script provided by an activityEntity with the @@ -195,7 +196,7 @@ public ItemCollection run(ItemCollection workitem, ItemCollection event) String itemName = entry.getKey(); // skip fieldnames starting with '$' if (!itemName.startsWith("$")) { - logger.finest("......Update item '" + itemName + "'"); + logger.log(Level.FINEST, "......Update item ''{0}''", itemName); workitem.replaceItemValue(itemName, entry.getValue()); } } diff --git a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/plugins/SplitAndJoinPlugin.java b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/plugins/SplitAndJoinPlugin.java index ef66daa11..a83ba15e3 100644 --- a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/plugins/SplitAndJoinPlugin.java +++ b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/plugins/SplitAndJoinPlugin.java @@ -80,7 +80,7 @@ public class SplitAndJoinPlugin extends AbstractPlugin { public static final String ORIGIN_UPDATE = "origin_update"; public static final String SUBPROCESS_SYNC = "subprocess_sync"; // synchronize items from parent - private static Logger logger = Logger.getLogger(SplitAndJoinPlugin.class.getName()); + private static final Logger logger = Logger.getLogger(SplitAndJoinPlugin.class.getName()); /** * The method evaluates the workflow activity result for items with name: @@ -632,7 +632,7 @@ protected void copyItemList(String items, ItemCollection source, ItemCollection protected void addWorkitemRef(String aUniqueID, ItemCollection workitem) { boolean debug = logger.isLoggable(Level.FINE); if (debug) { - logger.fine("LinkController add workitem reference: " + aUniqueID); + logger.log(Level.FINE, "LinkController add workitem reference: {0}", aUniqueID); } List refList = workitem.getItemValue(LINK_PROPERTY); diff --git a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/plugins/TaxonomyPlugin.java b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/plugins/TaxonomyPlugin.java index 024267281..8e285f80e 100644 --- a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/plugins/TaxonomyPlugin.java +++ b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/plugins/TaxonomyPlugin.java @@ -30,6 +30,7 @@ import java.util.Date; import java.util.List; +import java.util.logging.Level; import java.util.logging.Logger; import org.imixs.workflow.ItemCollection; @@ -76,7 +77,7 @@ public class TaxonomyPlugin extends AbstractPlugin { public static final String INVALID_FORMAT = "INVALID_FORMAT"; - private static Logger logger = Logger.getLogger(TaxonomyPlugin.class.getName()); + private static final Logger logger = Logger.getLogger(TaxonomyPlugin.class.getName()); @Override @@ -92,7 +93,7 @@ public ItemCollection run(ItemCollection documentContext, ItemCollection event) // now iterate over all taxonomy definitions.... for (String name : taxonomyConfig.getItemNames()) { - logger.finest("found taxonomy name=" + name); + logger.log(Level.FINEST, "found taxonomy name={0}", name); // for each taxonomy definition evaluate the taxonomy data.... String xmlDef = taxonomyConfig.getItemValueString(name); ItemCollection taxonomyData = XMLParser.parseItemStructure(xmlDef); @@ -103,7 +104,7 @@ public ItemCollection run(ItemCollection documentContext, ItemCollection event) if (taxonomyData.hasItem("anonymised")) { anonymised=taxonomyData.getItemValueBoolean("anonymised"); } - logger.finest("... type=" + type + " anonymised=" + anonymised); + logger.log(Level.FINEST, "... type={0} anonymised={1}", new Object[]{type, anonymised}); evalTaxonomyDefinition(documentContext, name, type,anonymised); } @@ -133,9 +134,9 @@ void evalTaxonomyDefinition(ItemCollection documentContext, String name, String // the length of stop list must be the same as the start list if (valuesStart.size() != valuesStop.size()) { - logger.warning("Invalid taxonomy definition '" + name - + "' starttime without stoptime! - please check model event " + documentContext.getTaskID() - + "." + documentContext.getEventID() + " taxonomy will be ignored!"); + logger.log(Level.WARNING, "Invalid taxonomy definition ''{0}'' starttime without stoptime!" + + " - please check model event {1}.{2} taxonomy will be ignored!", + new Object[]{name, documentContext.getTaskID(), documentContext.getEventID()}); return; } @@ -154,9 +155,9 @@ void evalTaxonomyDefinition(ItemCollection documentContext, String name, String if ("stop".equals(type)) { if (valuesStop.size() != (valuesStart.size() - 1)) { - logger.warning("Invalid taxonomy definition '" + name - + "' stoptime without starttime! - please check model entry " + documentContext.getTaskID() - + "." + documentContext.getEventID() + " taxonomy will be ignored!"); + logger.log(Level.WARNING, "Invalid taxonomy definition ''{0}'' stoptime without starttime!" + + " - please check model entry {1}.{2} taxonomy will be ignored!", + new Object[]{name, documentContext.getTaskID(), documentContext.getEventID()}); return; } diff --git a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/plugins/VersionPlugin.java b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/plugins/VersionPlugin.java index 971005fc3..04990718e 100644 --- a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/plugins/VersionPlugin.java +++ b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/plugins/VersionPlugin.java @@ -88,7 +88,7 @@ public class VersionPlugin extends AbstractPlugin { private ItemCollection documentContext = null; private static final String PROCESSING_VERSION_ATTRIBUTE = "$processingversion"; - private static Logger logger = Logger.getLogger(VersionPlugin.class.getName()); + private static final Logger logger = Logger.getLogger(VersionPlugin.class.getName()); public ItemCollection getVersion() { return version; diff --git a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/scheduler/SchedulerConfigurationService.java b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/scheduler/SchedulerConfigurationService.java index 3c9fb8a9f..b2b659877 100644 --- a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/scheduler/SchedulerConfigurationService.java +++ b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/scheduler/SchedulerConfigurationService.java @@ -63,7 +63,7 @@ public class SchedulerConfigurationService { @Inject DocumentService documentService; - private static Logger logger = Logger.getLogger(SchedulerConfigurationService.class.getName()); + private static final Logger logger = Logger.getLogger(SchedulerConfigurationService.class.getName()); /** * This method saves a configuration in a new transaction. This is needed case diff --git a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/scheduler/SchedulerController.java b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/scheduler/SchedulerController.java index 97e9f2e7e..9a168fec1 100644 --- a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/scheduler/SchedulerController.java +++ b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/scheduler/SchedulerController.java @@ -1,185 +1,185 @@ -/* - * Imixs-Workflow - * - * Copyright (C) 2001-2020 Imixs Software Solutions GmbH, - * http://www.imixs.com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You can receive a copy of the GNU General Public - * License at http://www.gnu.org/licenses/gpl.html - * - * Project: - * https://www.imixs.org - * https://github.com/imixs/imixs-workflow - * - * Contributors: - * Imixs Software Solutions GmbH - Project Management - * Ralph Soika - Software Developer - */ - -package org.imixs.workflow.engine.scheduler; - -import java.io.Serializable; -import java.text.ParseException; -import java.util.concurrent.TimeUnit; -import java.util.logging.Level; -import java.util.logging.Logger; - -import jakarta.annotation.PostConstruct; -import jakarta.enterprise.context.RequestScoped; -import jakarta.faces.event.ActionEvent; -import jakarta.inject.Inject; -import jakarta.inject.Named; - -import org.imixs.workflow.ItemCollection; -import org.imixs.workflow.exceptions.AccessDeniedException; - -/** - * The SchedulerController is a front-end controller to start and stop - * schedulers. A scheduler configuration is defined by the item type="scheduler" - * and the item name. - *

- * The class can be subclassed to add specific data to the scheduler - * configuration. - * - * @author rsoika - * @version 1.0 - */ - -@Named -@RequestScoped -public class SchedulerController implements Serializable { - - private ItemCollection configuration = null; - private String name; - private String schedulerClass; - - @Inject - private SchedulerService schedulerService; - - private static final long serialVersionUID = 1L; - - private static Logger logger = Logger.getLogger(SchedulerController.class.getName()); - - /** - * This method load the config entity after postContstruct. If no Entity exists - * than the ConfigService EJB creates a new config entity. - * - */ - @PostConstruct - public void init() { - configuration = schedulerService.loadConfiguration(getName()); - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getSchedulerClass() { - return schedulerClass; - } - - public void setSchedulerClass(String schedulerClass) { - this.schedulerClass = schedulerClass; - } - - public ItemCollection getConfiguration() { - if (configuration == null) { - configuration = new ItemCollection(); - configuration.setItemValue("$workflowsummary", getName()); - configuration.setItemValue(Scheduler.ITEM_SCHEDULER_NAME, getName()); - configuration.setItemValue(Scheduler.ITEM_SCHEDULER_CLASS, getSchedulerClass()); - } - return configuration; - } - - public void setConfiguration(ItemCollection configuration) { - this.configuration = configuration; - } - - /** - * Saves the current scheduler configuration. - */ - public void saveConfiguration() { - configuration.setItemValue(Scheduler.ITEM_SCHEDULER_CLASS, getSchedulerClass()); - schedulerService.saveConfiguration(getConfiguration()); - } - - /** - * This method updates the scheduler configuration with the current timer - * information - * - */ - public void refresh() { - configuration = schedulerService.loadConfiguration(getName()); - } - - public SchedulerService getSchedulerService() { - return schedulerService; - } - - /** - * starts the timer service - * - * @return - * @throws ParseException - * @throws AccessDeniedException - * @throws Exception - */ - public void startScheduler() throws AccessDeniedException, ParseException { - configuration = schedulerService.start(getConfiguration()); - schedulerService.saveConfiguration(configuration); - } - - public void stopScheduler() { - configuration = schedulerService.stop(getConfiguration()); - schedulerService.saveConfiguration(configuration); - } - - public void restartScheduler(ActionEvent event) throws Exception { - stopScheduler(); - startScheduler(); - } - - /** - * - * converts time (in milliseconds) to human-readable format "hh:mm:ss" - * - * @return - */ - public String millisToShortDHMS(int duration) { - boolean debug = logger.isLoggable(Level.FINE); - if (debug) { - logger.finest("......confert ms " + duration); - } - String res = ""; - long days = TimeUnit.MILLISECONDS.toDays(duration); - long hours = TimeUnit.MILLISECONDS.toHours(duration) - - TimeUnit.DAYS.toHours(TimeUnit.MILLISECONDS.toDays(duration)); - long minutes = TimeUnit.MILLISECONDS.toMinutes(duration) - - TimeUnit.HOURS.toMinutes(TimeUnit.MILLISECONDS.toHours(duration)); - long seconds = TimeUnit.MILLISECONDS.toSeconds(duration) - - TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(duration)); - if (days == 0) { - res = String.format("%d hours, %d minutes, %d seconds", hours, minutes, seconds); - } else { - res = String.format("%d days, %d hours, %d minutes, %d seconds", days, hours, minutes, seconds); - } - return res; - - } - -} +/* + * Imixs-Workflow + * + * Copyright (C) 2001-2020 Imixs Software Solutions GmbH, + * http://www.imixs.com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You can receive a copy of the GNU General Public + * License at http://www.gnu.org/licenses/gpl.html + * + * Project: + * https://www.imixs.org + * https://github.com/imixs/imixs-workflow + * + * Contributors: + * Imixs Software Solutions GmbH - Project Management + * Ralph Soika - Software Developer + */ + +package org.imixs.workflow.engine.scheduler; + +import java.io.Serializable; +import java.text.ParseException; +import java.util.concurrent.TimeUnit; +import java.util.logging.Level; +import java.util.logging.Logger; + +import jakarta.annotation.PostConstruct; +import jakarta.enterprise.context.RequestScoped; +import jakarta.faces.event.ActionEvent; +import jakarta.inject.Inject; +import jakarta.inject.Named; + +import org.imixs.workflow.ItemCollection; +import org.imixs.workflow.exceptions.AccessDeniedException; + +/** + * The SchedulerController is a front-end controller to start and stop + * schedulers. A scheduler configuration is defined by the item type="scheduler" + * and the item name. + *

+ * The class can be subclassed to add specific data to the scheduler + * configuration. + * + * @author rsoika + * @version 1.0 + */ + +@Named +@RequestScoped +public class SchedulerController implements Serializable { + + private ItemCollection configuration = null; + private String name; + private String schedulerClass; + + @Inject + private SchedulerService schedulerService; + + private static final long serialVersionUID = 1L; + + private static final Logger logger = Logger.getLogger(SchedulerController.class.getName()); + + /** + * This method load the config entity after postContstruct. If no Entity exists + * than the ConfigService EJB creates a new config entity. + * + */ + @PostConstruct + public void init() { + configuration = schedulerService.loadConfiguration(getName()); + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getSchedulerClass() { + return schedulerClass; + } + + public void setSchedulerClass(String schedulerClass) { + this.schedulerClass = schedulerClass; + } + + public ItemCollection getConfiguration() { + if (configuration == null) { + configuration = new ItemCollection(); + configuration.setItemValue("$workflowsummary", getName()); + configuration.setItemValue(Scheduler.ITEM_SCHEDULER_NAME, getName()); + configuration.setItemValue(Scheduler.ITEM_SCHEDULER_CLASS, getSchedulerClass()); + } + return configuration; + } + + public void setConfiguration(ItemCollection configuration) { + this.configuration = configuration; + } + + /** + * Saves the current scheduler configuration. + */ + public void saveConfiguration() { + configuration.setItemValue(Scheduler.ITEM_SCHEDULER_CLASS, getSchedulerClass()); + schedulerService.saveConfiguration(getConfiguration()); + } + + /** + * This method updates the scheduler configuration with the current timer + * information + * + */ + public void refresh() { + configuration = schedulerService.loadConfiguration(getName()); + } + + public SchedulerService getSchedulerService() { + return schedulerService; + } + + /** + * starts the timer service + * + * @return + * @throws ParseException + * @throws AccessDeniedException + * @throws Exception + */ + public void startScheduler() throws AccessDeniedException, ParseException { + configuration = schedulerService.start(getConfiguration()); + schedulerService.saveConfiguration(configuration); + } + + public void stopScheduler() { + configuration = schedulerService.stop(getConfiguration()); + schedulerService.saveConfiguration(configuration); + } + + public void restartScheduler(ActionEvent event) throws Exception { + stopScheduler(); + startScheduler(); + } + + /** + * + * converts time (in milliseconds) to human-readable format "hh:mm:ss" + * + * @return + */ + public String millisToShortDHMS(int duration) { + boolean debug = logger.isLoggable(Level.FINE); + if (debug) { + logger.log(Level.FINEST, "......confert ms {0}", duration); + } + String res = ""; + long days = TimeUnit.MILLISECONDS.toDays(duration); + long hours = TimeUnit.MILLISECONDS.toHours(duration) + - TimeUnit.DAYS.toHours(TimeUnit.MILLISECONDS.toDays(duration)); + long minutes = TimeUnit.MILLISECONDS.toMinutes(duration) + - TimeUnit.HOURS.toMinutes(TimeUnit.MILLISECONDS.toHours(duration)); + long seconds = TimeUnit.MILLISECONDS.toSeconds(duration) + - TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(duration)); + if (days == 0) { + res = String.format("%d hours, %d minutes, %d seconds", hours, minutes, seconds); + } else { + res = String.format("%d days, %d hours, %d minutes, %d seconds", days, hours, minutes, seconds); + } + return res; + + } + +} diff --git a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/scheduler/SchedulerService.java b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/scheduler/SchedulerService.java index 65001a6f5..64e6996d3 100644 --- a/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/scheduler/SchedulerService.java +++ b/imixs-workflow-engine/src/main/java/org/imixs/workflow/engine/scheduler/SchedulerService.java @@ -118,7 +118,7 @@ public class SchedulerService { @Any private Instance schedulerHandlers; - private static Logger logger = Logger.getLogger(SchedulerService.class.getName()); + private static final Logger logger = Logger.getLogger(SchedulerService.class.getName()); /** * Loads the scheduler configuration entity by name. The method returns null if @@ -222,13 +222,13 @@ public ItemCollection start(ItemCollection configuration) throws AccessDeniedExc timer.cancel(); timer = null; } catch (Exception e) { - logger.warning("...failed to stop existing timer for '" + configuration.getUniqueID() + "'!"); + logger.log(Level.WARNING, "...failed to stop existing timer for ''{0}''!", configuration.getUniqueID()); throw new InvalidAccessException(SchedulerService.class.getName(), SchedulerException.INVALID_WORKITEM, " failed to cancle existing timer!"); } } - logger.info("...Scheduler Service " + configuration.getUniqueID() + " will be started..."); + logger.log(Level.INFO, "...Scheduler Service {0} will be started...", configuration.getUniqueID()); String schedulerDescription = configuration.getItemValueString(Scheduler.ITEM_SCHEDULER_DEFINITION); if (!schedulerDescription.isEmpty()) { @@ -243,8 +243,8 @@ public ItemCollection start(ItemCollection configuration) throws AccessDeniedExc String msg = "started at " + dateFormatDE.format(calNow.getTime()) + " by " + ctx.getCallerPrincipal().getName(); configuration.replaceItemValue(Scheduler.ITEM_SCHEDULER_STATUS, msg); - logger.info("...Scheduler Service " + id + " (" + configuration.getItemValueString("Name") - + ") successfull started."); + logger.log(Level.INFO, "...Scheduler Service {0} ({1}) successfull started.", + new Object[]{id, configuration.getItemValueString("Name")}); } configuration.replaceItemValue(Scheduler.ITEM_SCHEDULER_ENABLED, true); // clear logs... @@ -274,7 +274,7 @@ public ItemCollection stop(ItemCollection configuration, Timer timer) { try { timer.cancel(); } catch (Exception e) { - logger.info("...failed to stop timer for '" + configuration.getUniqueID() + "'!"); + logger.log(Level.INFO, "...failed to stop timer for ''{0}''!", configuration.getUniqueID()); } // update status message @@ -288,8 +288,8 @@ public ItemCollection stop(ItemCollection configuration, Timer timer) { } configuration.replaceItemValue(Scheduler.ITEM_SCHEDULER_STATUS, message); - logger.info("... scheduler " + configuration.getItemValueString("Name") + " stopped: " - + configuration.getUniqueID()); + logger.log(Level.INFO, "... scheduler {0} stopped: {1}", + new Object[]{configuration.getItemValueString("Name"), configuration.getUniqueID()}); } else { String msg = "stopped"; configuration.replaceItemValue(Scheduler.ITEM_SCHEDULER_STATUS, msg); @@ -329,15 +329,14 @@ public void startAllSchedulers() { if (findTimer(schedulerConfig.getUniqueID()) == null) { start(schedulerConfig); } else { - logger.info("...Scheduler Service " + schedulerConfig.getUniqueID() + " already running. "); + logger.log(Level.INFO, "...Scheduler Service {0} already running. ", schedulerConfig.getUniqueID()); } } catch (Exception e) { - logger.severe("...start of Scheduler Service " + schedulerConfig.getUniqueID() + " failed! - " - + e.getMessage()); + logger.log(Level.SEVERE, "...start of Scheduler Service {0} failed! - {1}", new Object[]{schedulerConfig.getUniqueID(), e.getMessage()}); e.printStackTrace(); } } else { - logger.info("...Scheduler Service " + schedulerConfig.getUniqueID() + " is not enabled. "); + logger.log(Level.INFO, "...Scheduler Service {0} is not enabled. ", schedulerConfig.getUniqueID()); } } //} catch (QueryException e1) { @@ -386,7 +385,7 @@ public void updateTimerDetails(ItemCollection configuration) { configuration.removeItem("timeRemaining"); } } catch (Exception e) { - logger.warning("unable to updateTimerDetails: " + e.getMessage()); + logger.log(Level.WARNING, "unable to updateTimerDetails: {0}", e.getMessage()); configuration.removeItem("nextTimeout"); configuration.removeItem("timeRemaining"); } @@ -450,12 +449,12 @@ protected Scheduler findSchedulerByName(String schedulerClassName) { return null; } - logger.finest("......injecting CDI Scheduler '" + schedulerClassName + "'..."); + logger.log(Level.FINEST, "......injecting CDI Scheduler ''{0}''...", schedulerClassName); // iterate over all injected JobHandlers.... for (Scheduler scheduler : this.schedulerHandlers) { if (scheduler.getClass().getName().equals(schedulerClassName)) { if (debug) { - logger.finest("......CDI Scheduler class '" + schedulerClassName + "' successful injected"); + logger.log(Level.FINEST, "......CDI Scheduler class ''{0}'' successful injected", schedulerClassName); } return scheduler; } @@ -493,23 +492,22 @@ protected void onTimeout(jakarta.ejb.Timer timer) { Scheduler scheduler = findSchedulerByName(schedulerClassName); if (scheduler != null) { - logger.info("...run scheduler '" + id + "' scheduler class='" + schedulerClassName + "'...."); + logger.log(Level.INFO, "...run scheduler ''{0}'' scheduler class=''{1}''....", new Object[]{id, schedulerClassName}); Calendar cal = Calendar.getInstance(); configuration.replaceItemValue(Scheduler.ITEM_LOGMESSAGE, "Started: " + cal.getTime()); configuration = scheduler.run(configuration); - logger.info("...run scheduler '" + id + "' finished in: " + ((System.currentTimeMillis()) - lProfiler) - + " ms"); + logger.log(Level.INFO, "...run scheduler ''{0}'' finished in: {1} ms", new Object[]{id, (System.currentTimeMillis()) - lProfiler}); cal = Calendar.getInstance(); configuration.appendItemValue(Scheduler.ITEM_LOGMESSAGE, "Finished: " + cal.getTime()); if (configuration.getItemValueBoolean(Scheduler.ITEM_SCHEDULER_ENABLED) == false) { - logger.info("...scheduler '" + id + "' disabled -> timer will be stopped..."); + logger.log(Level.INFO, "...scheduler ''{0}'' disabled -> timer will be stopped...", id); stop(configuration); } } else { errorMes = "Scheduler class='" + schedulerClassName + "' not found!"; - logger.warning("...scheduler '" + id + "' scheduler class='" + schedulerClassName - + "' not found, timer will be stopped..."); + logger.log(Level.WARNING, "...scheduler ''{0}'' scheduler class=''{1}'' not found, timer will be stopped...", + new Object[]{id, schedulerClassName}); configuration.setItemValue(Scheduler.ITEM_SCHEDULER_ENABLED, false); stop(configuration); @@ -520,7 +518,7 @@ protected void onTimeout(jakarta.ejb.Timer timer) { e.printStackTrace(); } errorMes = e.getMessage(); - logger.severe("Scheduler '" + id + "' failed: " + errorMes); + logger.log(Level.SEVERE, "Scheduler ''{0}'' failed: {1}", new Object[]{id, errorMes}); configuration.appendItemValue(Scheduler.ITEM_LOGMESSAGE, "Error: " + errorMes); configuration = stop(configuration, timer); @@ -528,7 +526,7 @@ protected void onTimeout(jakarta.ejb.Timer timer) { // in case of an RuntimeException we did not cancel the Timer service e.printStackTrace(); errorMes = e.getMessage(); - logger.severe("Scheduler '" + id + "' failed: " + errorMes); + logger.log(Level.SEVERE, "Scheduler ''{0}'' failed: {1}", new Object[]{id, errorMes}); configuration.appendItemValue(Scheduler.ITEM_LOGMESSAGE, "Error: " + errorMes); //configuration = stop(configuration, timer); } finally { diff --git a/imixs-workflow-engine/src/test/java/org/imixs/workflow/engine/TestAdaptText.java b/imixs-workflow-engine/src/test/java/org/imixs/workflow/engine/TestAdaptText.java index 75dc6edef..44c745693 100644 --- a/imixs-workflow-engine/src/test/java/org/imixs/workflow/engine/TestAdaptText.java +++ b/imixs-workflow-engine/src/test/java/org/imixs/workflow/engine/TestAdaptText.java @@ -53,7 +53,7 @@ public void testReplaceDynamicValues() throws PluginException { // prepare data - logger.info("[TestAbstractPlugin] setup test data..."); + logger.info("[TestAdaptText] setup test data..."); documentContext = new ItemCollection(); documentContext.replaceItemValue("txtName", "Anna"); @@ -77,7 +77,7 @@ public void testReplaceDynamicValuesFormatError() { // prepare data - logger.info("[TestAbstractPlugin] setup test data..."); + logger.info("[TestAdaptText] setup test data..."); documentContext = new ItemCollection(); documentContext.replaceItemValue("txtName", "Anna"); @@ -114,7 +114,7 @@ public void testDateFormat() throws PluginException { // prepare data documentContext = new ItemCollection(); - logger.info("[TestHisotryPlugin] setup test data..."); + logger.info("[TestAdaptText] setup test data..."); Calendar cal = Calendar.getInstance(); cal.set(Calendar.DATE, 27); @@ -137,7 +137,7 @@ public void testDateFormatEN() throws PluginException { // prepare data documentContext = new ItemCollection(); - logger.info("[TestHisotryPlugin] setup test data..."); + logger.info("[TestAdaptText] setup test data..."); Calendar cal = Calendar.getInstance(); cal.set(Calendar.DATE, 27); @@ -173,7 +173,7 @@ public void testMultiValueFormat() throws PluginException { // prepare data documentContext = new ItemCollection(); - logger.info("[TestHisotryPlugin] setup test data..."); + logger.info("[TestAdaptText] setup test data..."); Vector value = new Vector(); value.add(1); @@ -246,7 +246,7 @@ public void testMultiValueWithNoSeparator() throws PluginException { // prepare data documentContext = new ItemCollection(); - logger.info("[TestHisotryPlugin] setup test data..."); + logger.info("[TestAdaptText] setup test data..."); Vector value = new Vector(); value.add(1); @@ -283,7 +283,7 @@ public void testMultiValuePosition() throws PluginException { // prepare data documentContext = new ItemCollection(); - logger.info("[TestHisotryPlugin] setup test data..."); + logger.info("[TestAdaptText] setup test data..."); Vector values = new Vector(); values.add(1); @@ -301,7 +301,7 @@ public void testMultiValuePosition() throws PluginException { // prepare data documentContext = new ItemCollection(); - logger.info("[TestHisotryPlugin] setup test data..."); + logger.info("[TestAdaptText] setup test data..."); documentContext.replaceItemValue("_numbers", values); diff --git a/imixs-workflow-engine/src/test/java/org/imixs/workflow/engine/TestDocumentService.java b/imixs-workflow-engine/src/test/java/org/imixs/workflow/engine/TestDocumentService.java index 588409535..eb5abe6fe 100644 --- a/imixs-workflow-engine/src/test/java/org/imixs/workflow/engine/TestDocumentService.java +++ b/imixs-workflow-engine/src/test/java/org/imixs/workflow/engine/TestDocumentService.java @@ -1,5 +1,6 @@ package org.imixs.workflow.engine; +import java.util.logging.Level; import java.util.logging.Logger; import org.imixs.workflow.WorkflowKernel; @@ -34,22 +35,22 @@ public void testRegexUID() { // test standard uid String uid = WorkflowKernel.generateUniqueID(); - logger.info("verify uid pattern: " + uid); + logger.log(Level.INFO, "verify uid pattern: {0}", uid); Assert.assertTrue(documentService.isValidUIDPattern(uid)); // test UUID + snapshot uid = WorkflowKernel.generateUniqueID() + "-" + System.currentTimeMillis(); - logger.info("verify uid snapshot pattern: " + uid); + logger.log(Level.INFO, "verify uid snapshot pattern: {0}", uid); Assert.assertTrue(documentService.isValidUIDPattern(uid)); // test old pattern uid = "14c1463c9ef-13f6ef4e"; - logger.info("verify old uid pattern: " + uid); + logger.log(Level.INFO, "verify old uid pattern: {0}", uid); Assert.assertTrue(documentService.isValidUIDPattern(uid)); // test old snapshot pattern uid = "14c1463c9ef-13f6ef4e" + "-" + System.currentTimeMillis(); - logger.info("verify old uid snapshot pattern: " + uid); + logger.log(Level.INFO, "verify old uid snapshot pattern: {0}", uid); Assert.assertTrue(documentService.isValidUIDPattern(uid)); } diff --git a/imixs-workflow-engine/src/test/java/org/imixs/workflow/engine/TestEvaluateWorkflowResult.java b/imixs-workflow-engine/src/test/java/org/imixs/workflow/engine/TestEvaluateWorkflowResult.java index e5209bf69..c814dfe95 100644 --- a/imixs-workflow-engine/src/test/java/org/imixs/workflow/engine/TestEvaluateWorkflowResult.java +++ b/imixs-workflow-engine/src/test/java/org/imixs/workflow/engine/TestEvaluateWorkflowResult.java @@ -1,6 +1,7 @@ package org.imixs.workflow.engine; import java.util.List; +import java.util.logging.Level; import java.util.logging.Logger; import org.imixs.workflow.ItemCollection; @@ -216,7 +217,7 @@ public void testEvaluateWorkflowResultMultiValueWithEmptyTag() throws PluginExce evalItemCollection = workflowMockEnvironment.getWorkflowService().evalWorkflowResult(activityEntity, "item", new ItemCollection()); - logger.info("...evaluated result in " + (System.currentTimeMillis() - l) + "ms..."); + logger.log(Level.INFO, "...evaluated result in {0}ms...", System.currentTimeMillis() - l); // expected: comment_ignore=true Assert.assertTrue(evalItemCollection.hasItem("comment.ignore")); @@ -237,7 +238,7 @@ public void testEvaluateWorkflowResultMultiValueWithEmptyTag() throws PluginExce evalItemCollection = new ItemCollection(); evalItemCollection = workflowMockEnvironment.getWorkflowService().evalWorkflowResult(activityEntity, "item", new ItemCollection()); - logger.info("...evaluated result in " + (System.currentTimeMillis() - l) + "ms..."); + logger.log(Level.INFO, "...evaluated result in {0}ms...", System.currentTimeMillis() - l); // expected: comment_ignore=true Assert.assertTrue(evalItemCollection.hasItem("comment.ignore")); diff --git a/imixs-workflow-engine/src/test/java/org/imixs/workflow/engine/WorkflowMockEnvironment.java b/imixs-workflow-engine/src/test/java/org/imixs/workflow/engine/WorkflowMockEnvironment.java index d29feb4f7..de81a3296 100644 --- a/imixs-workflow-engine/src/test/java/org/imixs/workflow/engine/WorkflowMockEnvironment.java +++ b/imixs-workflow-engine/src/test/java/org/imixs/workflow/engine/WorkflowMockEnvironment.java @@ -15,6 +15,7 @@ import java.util.logging.Logger; import jakarta.ejb.SessionContext; +import java.util.logging.Level; import javax.xml.parsers.ParserConfigurationException; import org.imixs.workflow.ItemCollection; @@ -331,11 +332,11 @@ public void loadModel() { long lLoadTime = System.currentTimeMillis(); InputStream inputStream = WorkflowMockEnvironment.class.getResourceAsStream(this.modelPath); try { - logger.info("loading model: " + this.modelPath + "...."); + logger.log(Level.INFO, "loading model: {0}....", this.modelPath); model = BPMNParser.parseModel(inputStream, "UTF-8"); this.modelService.addModel(model); - logger.fine("...loadModel processing time=" + (System.currentTimeMillis() - lLoadTime) + "ms"); + logger.log(Level.FINE, "...loadModel processing time={0}ms", System.currentTimeMillis() - lLoadTime); } catch (ModelException | ParseException | ParserConfigurationException | SAXException | IOException e) { e.printStackTrace(); } diff --git a/imixs-workflow-engine/src/test/java/org/imixs/workflow/engine/WorkflowSimulationEnvironment.java b/imixs-workflow-engine/src/test/java/org/imixs/workflow/engine/WorkflowSimulationEnvironment.java index 98d02f5d6..758d62810 100644 --- a/imixs-workflow-engine/src/test/java/org/imixs/workflow/engine/WorkflowSimulationEnvironment.java +++ b/imixs-workflow-engine/src/test/java/org/imixs/workflow/engine/WorkflowSimulationEnvironment.java @@ -10,6 +10,7 @@ import java.util.logging.Logger; import jakarta.ejb.SessionContext; +import java.util.logging.Level; import javax.xml.parsers.ParserConfigurationException; import org.imixs.workflow.ItemCollection; @@ -133,7 +134,7 @@ public void loadModel() { if (this.modelPath != null) { InputStream inputStream = getClass().getResourceAsStream(this.modelPath); try { - logger.info("loading model: " + this.modelPath + "...."); + logger.log(Level.INFO, "loading model: {0}....", this.modelPath); model = BPMNParser.parseModel(inputStream, "UTF-8"); this.modelService.addModel(model); diff --git a/imixs-workflow-engine/src/test/java/org/imixs/workflow/engine/adapters/TestAccessAdapterProcessEntity.java b/imixs-workflow-engine/src/test/java/org/imixs/workflow/engine/adapters/TestAccessAdapterProcessEntity.java index 100871efb..ada5ffa87 100644 --- a/imixs-workflow-engine/src/test/java/org/imixs/workflow/engine/adapters/TestAccessAdapterProcessEntity.java +++ b/imixs-workflow-engine/src/test/java/org/imixs/workflow/engine/adapters/TestAccessAdapterProcessEntity.java @@ -64,7 +64,7 @@ public void setUp() throws PluginException, ModelException { // prepare data documentContext = new ItemCollection().model(WorkflowMockEnvironment.DEFAULT_MODEL_VERSION).task(100); - logger.info("[TestAccessPlugin] setup test data..."); + logger.info("[TestAccessAdapterProcessEntity] setup test data..."); Vector list = new Vector(); list.add("manfred"); list.add("anna"); diff --git a/imixs-workflow-engine/src/test/java/org/imixs/workflow/engine/index/TestNormalizePhrase.java b/imixs-workflow-engine/src/test/java/org/imixs/workflow/engine/index/TestNormalizePhrase.java index 2cd0e9d27..6d889bd56 100644 --- a/imixs-workflow-engine/src/test/java/org/imixs/workflow/engine/index/TestNormalizePhrase.java +++ b/imixs-workflow-engine/src/test/java/org/imixs/workflow/engine/index/TestNormalizePhrase.java @@ -1,5 +1,6 @@ package org.imixs.workflow.engine.index; +import java.util.logging.Level; import java.util.logging.Logger; import org.imixs.workflow.exceptions.ModelException; @@ -18,7 +19,7 @@ public class TestNormalizePhrase { SchemaService schemaService = null; - private static Logger logger = Logger.getLogger(TestNormalizePhrase.class.getName()); + private static final Logger logger = Logger.getLogger(TestNormalizePhrase.class.getName()); @Before public void setUp() throws PluginException, ModelException { @@ -36,7 +37,7 @@ public void test1() throws PluginException { String result = null; result = schemaService.normalizeSearchTerm(searchTerm); - logger.info(searchTerm + " --> " + result); + logger.log(Level.INFO, "{0} --> {1}", new Object[]{searchTerm, result}); Assert.assertEquals("lukas podolski", result); @@ -55,7 +56,7 @@ public void test2() throws PluginException { String result = null; result = schemaService.normalizeSearchTerm(searchTerm); - logger.info(searchTerm + " --> " + result); + logger.log(Level.INFO, "{0} --> {1}", new Object[]{searchTerm, result}); Assert.assertEquals("europe berlin", result); @@ -72,7 +73,7 @@ public void test3() throws PluginException { String result = null; result = schemaService.normalizeSearchTerm(searchTerm); - logger.info(searchTerm + " --> " + result); + logger.log(Level.INFO, "{0} --> {1}", new Object[]{searchTerm, result}); Assert.assertEquals("rs\\/82550\\/201618", result); @@ -89,7 +90,7 @@ public void test4() throws PluginException { String result = null; result = schemaService.normalizeSearchTerm(searchTerm); - logger.info(searchTerm + " --> " + result); + logger.log(Level.INFO, "{0} --> {1}", new Object[]{searchTerm, result}); Assert.assertEquals("rs\\-82550\\/201618", result); diff --git a/imixs-workflow-engine/src/test/java/org/imixs/workflow/plugins/TestAnalysisPlugin.java b/imixs-workflow-engine/src/test/java/org/imixs/workflow/plugins/TestAnalysisPlugin.java index 09673db78..d3d394480 100644 --- a/imixs-workflow-engine/src/test/java/org/imixs/workflow/plugins/TestAnalysisPlugin.java +++ b/imixs-workflow-engine/src/test/java/org/imixs/workflow/plugins/TestAnalysisPlugin.java @@ -1,5 +1,6 @@ package org.imixs.workflow.plugins; +import java.util.logging.Level; import java.util.logging.Logger; import org.imixs.workflow.ItemCollection; @@ -17,7 +18,7 @@ */ public class TestAnalysisPlugin { protected AnalysisPlugin analysisPlugin = null; - private static Logger logger = Logger.getLogger(TestAnalysisPlugin.class.getName()); + private static final Logger logger = Logger.getLogger(TestAnalysisPlugin.class.getName()); @Before public void setUp() throws PluginException { @@ -44,7 +45,7 @@ public void testBasicTest() throws PluginException { ItemCollection adocumentActivity = new ItemCollection(); String sResult = "M1"; - logger.info("txtActivityResult=" + sResult); + logger.log(Level.INFO, "txtActivityResult={0}", sResult); adocumentActivity.replaceItemValue("txtActivityResult", sResult); adocumentContext = analysisPlugin.run(adocumentContext, adocumentActivity); @@ -52,7 +53,7 @@ public void testBasicTest() throws PluginException { Assert.assertTrue(adocumentContext.hasItem("datMeasurePointStart_M1")); - logger.info("datMeasurePointStart_M1= " + adocumentContext.getItemValueDate("datMeasurePointStart_M1")); + logger.log(Level.INFO, "datMeasurePointStart_M1= {0}", adocumentContext.getItemValueDate("datMeasurePointStart_M1")); } @@ -74,7 +75,7 @@ public void testWrongStartTest() throws PluginException { ItemCollection adocumentActivity = new ItemCollection(); String sResult = "M1"; - logger.info("txtActivityResult=" + sResult); + logger.log(Level.INFO, "txtActivityResult={0}", sResult); adocumentActivity.replaceItemValue("txtActivityResult", sResult); adocumentContext = analysisPlugin.run(adocumentContext, adocumentActivity); @@ -82,13 +83,13 @@ public void testWrongStartTest() throws PluginException { Assert.assertTrue(adocumentContext.hasItem("datMeasurePointStart_M1")); - logger.info("datMeasurePointStart_M1= " + adocumentContext.getItemValueDate("datMeasurePointStart_M1")); + logger.log(Level.INFO, "datMeasurePointStart_M1= {0}", adocumentContext.getItemValueDate("datMeasurePointStart_M1")); sResult = "M1"; - logger.info("txtActivityResult=" + sResult); + logger.log(Level.INFO, "txtActivityResult={0}", sResult); adocumentActivity.replaceItemValue("txtActivityResult", sResult); adocumentContext = analysisPlugin.run(adocumentContext, adocumentActivity); @@ -119,7 +120,7 @@ public void testTotalTime() throws PluginException { ItemCollection adocumentActivity = new ItemCollection(); String sResult = "M1"; - logger.info("txtActivityResult=" + sResult); + logger.log(Level.INFO, "txtActivityResult={0}", sResult); adocumentActivity.replaceItemValue("txtActivityResult", sResult); adocumentContext = analysisPlugin.run(adocumentContext, adocumentActivity); @@ -127,7 +128,7 @@ public void testTotalTime() throws PluginException { Assert.assertTrue(adocumentContext.hasItem("datMeasurePointStart_M1")); - logger.info("datMeasurePointStart_M1= " + adocumentContext.getItemValueDate("datMeasurePointStart_M1")); + logger.log(Level.INFO, "datMeasurePointStart_M1= {0}", adocumentContext.getItemValueDate("datMeasurePointStart_M1")); @@ -140,7 +141,7 @@ public void testTotalTime() throws PluginException { sResult = "M1"; - logger.info("txtActivityResult=" + sResult); + logger.log(Level.INFO, "txtActivityResult={0}", sResult); adocumentActivity.replaceItemValue("txtActivityResult", sResult); adocumentContext = analysisPlugin.run(adocumentContext, adocumentActivity); diff --git a/imixs-workflow-engine/src/test/java/org/imixs/workflow/plugins/TestApplicationPlugin.java b/imixs-workflow-engine/src/test/java/org/imixs/workflow/plugins/TestApplicationPlugin.java index 0b274ceb4..f6099e716 100644 --- a/imixs-workflow-engine/src/test/java/org/imixs/workflow/plugins/TestApplicationPlugin.java +++ b/imixs-workflow-engine/src/test/java/org/imixs/workflow/plugins/TestApplicationPlugin.java @@ -51,7 +51,7 @@ public void setUp() throws PluginException, ModelException { // prepare data documentContext = new ItemCollection().model("1.0.0").task(100); - logger.info("[TestAccessPlugin] setup test data..."); + logger.info("[TestApplicationPlugin] setup test data..."); Vector list = new Vector(); list.add("manfred"); list.add("anna"); diff --git a/imixs-workflow-engine/src/test/java/org/imixs/workflow/plugins/TestIntervalPlugin.java b/imixs-workflow-engine/src/test/java/org/imixs/workflow/plugins/TestIntervalPlugin.java index e7ecdef2b..0d31d1188 100644 --- a/imixs-workflow-engine/src/test/java/org/imixs/workflow/plugins/TestIntervalPlugin.java +++ b/imixs-workflow-engine/src/test/java/org/imixs/workflow/plugins/TestIntervalPlugin.java @@ -4,6 +4,7 @@ import java.time.LocalDateTime; import java.time.temporal.ChronoField; import java.util.Date; +import java.util.logging.Level; import java.util.logging.Logger; import org.imixs.workflow.ItemCollection; @@ -24,7 +25,7 @@ public class TestIntervalPlugin { protected IntervalPlugin intervalPlugin = null; - private static Logger logger = Logger.getLogger(TestIntervalPlugin.class.getName()); + private static final Logger logger = Logger.getLogger(TestIntervalPlugin.class.getName()); WorkflowMockEnvironment workflowMockEnvironment; ItemCollection documentContext; ItemCollection documentActivity; @@ -47,7 +48,7 @@ public void setup() throws PluginException, ModelException, AdapterException { // prepare test workitem documentContext = new ItemCollection(); - logger.info("[TestAccessPlugin] setup test data..."); + logger.info("[TestIntervalPlugin] setup test data..."); documentContext.replaceItemValue("reminder", new Date()); @@ -62,7 +63,7 @@ public void setup() throws PluginException, ModelException, AdapterException { */ @Test public void testBPMNModel() throws PluginException { - logger.info("------------------ Ref Date =" + documentContext.getItemValueDate("reminder")); + logger.log(Level.INFO, "------------------ Ref Date ={0}", documentContext.getItemValueDate("reminder")); try { documentActivity = workflowMockEnvironment.getModel().getEvent(100, 99); intervalPlugin.run(documentContext, documentActivity); @@ -71,7 +72,7 @@ public void testBPMNModel() throws PluginException { Assert.fail(); } Date result = documentContext.getItemValueDate("reminder"); - logger.info("------------------ Result Date=" + result); + logger.log(Level.INFO, "------------------ Result Date={0}", result); } /** @@ -84,7 +85,7 @@ public void test1stDayInMonth() throws PluginException { // @monthly String cron = "0 0 1 * *"; LocalDateTime date = intervalPlugin.evalCron(cron); - logger.info("Result monthyl=" + date); + logger.log(Level.INFO, "Result monthyl={0}", date); LocalDateTime now = LocalDateTime.now(); int exptectedMonth = now.getMonthValue() + 1; if (exptectedMonth == 13) { @@ -104,7 +105,7 @@ public void test1stDayInYear() throws PluginException { // @monthly String cron = "0 0 1 1 *"; LocalDateTime date = intervalPlugin.evalCron(cron); - logger.info("Result monthly=" + date); + logger.log(Level.INFO, "Result monthly={0}", date); LocalDateTime now = LocalDateTime.now(); Assert.assertEquals(date.getYear(), now.getYear() + 1); Assert.assertEquals(1, date.getMonthValue()); @@ -120,7 +121,7 @@ public void test1stDayOfWeek() throws PluginException { // @weekly String cron = "0 0 * * 1 "; LocalDateTime date = intervalPlugin.evalCron(cron); - logger.info("Result monthyl=" + date); + logger.log(Level.INFO, "Result monthyl={0}", date); // move to past one day... Assert.assertEquals(DayOfWeek.MONDAY, date.getDayOfWeek()); } @@ -137,8 +138,8 @@ public void testMonthly() throws PluginException { LocalDateTime ldt = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now(); LocalDateTime date = intervalPlugin.evalMacro("@monthly", ldt); - logger.info("Now =" + now); - logger.info("Result @monthly=" + date); + logger.log(Level.INFO, "Now ={0}", now); + logger.log(Level.INFO, "Result @monthly={0}", date); int exptectedMonth = now.getMonthValue() + 1; if (exptectedMonth == 13) { // year switch @@ -159,8 +160,8 @@ public void testYearly() throws PluginException { LocalDateTime ldt = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now(); LocalDateTime date = intervalPlugin.evalMacro("@yearly", ldt); - logger.info("Now =" + now); - logger.info("Result @yearly=" + date); + logger.log(Level.INFO, "Now ={0}", now); + logger.log(Level.INFO, "Result @yearly={0}", date); Assert.assertEquals(now.getDayOfMonth(), date.getDayOfMonth()); Assert.assertEquals(now.getMonthValue(), date.getMonthValue()); Assert.assertEquals(now.getYear() + 1, date.getYear()); @@ -178,8 +179,8 @@ public void testWeekly() throws PluginException { LocalDateTime ldt = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now(); LocalDateTime date = intervalPlugin.evalMacro("@weekly", ldt); - logger.info("Now =" + now); - logger.info("Result @weekly=" + date); + logger.log(Level.INFO, "Now ={0}", now); + logger.log(Level.INFO, "Result @weekly={0}", date); Assert.assertTrue(now.getDayOfMonth() != date.getDayOfMonth()); Assert.assertEquals(now.getDayOfWeek(), date.getDayOfWeek()); } @@ -206,7 +207,7 @@ public void testCronUnitValueList() { now = now.with(ChronoField.HOUR_OF_DAY,8); String cron = "0 9,18 * * *"; date = intervalPlugin.evalCron(cron,now); - logger.info(" => now=" + now + " result=" + date); + logger.log(Level.INFO, " => now={0} result={1}", new Object[]{now, date}); // expected 9:00 Assert.assertTrue(date.getHour()==9); @@ -215,7 +216,7 @@ public void testCronUnitValueList() { now = now.with(ChronoField.MINUTE_OF_HOUR,0); now = now.with(ChronoField.HOUR_OF_DAY,10); date = intervalPlugin.evalCron(cron,now); - logger.info(" => now=" + now + " result=" + date); + logger.log(Level.INFO, " => now={0} result={1}", new Object[]{now, date}); // expected 18:00 Assert.assertTrue(date.getHour()==18); @@ -224,7 +225,7 @@ public void testCronUnitValueList() { now = now.with(ChronoField.MINUTE_OF_HOUR,0); now = now.with(ChronoField.HOUR_OF_DAY,22); date = intervalPlugin.evalCron(cron,now); - logger.info(" => now=" + now + " result=" + date); + logger.log(Level.INFO, " => now={0} result={1}", new Object[]{now, date}); // expected 9:00 next day Assert.assertTrue(date.getHour()==9); Assert.assertTrue(date.getDayOfYear()==now.getDayOfYear()+1); @@ -235,7 +236,7 @@ public void testCronUnitValueList() { cron = "15,30 * * * *"; now = now.with(ChronoField.HOUR_OF_DAY,10); date = intervalPlugin.evalCron(cron,now); - logger.info(" => now=" + now + " result=" + date); + logger.log(Level.INFO, " => now={0} result={1}", new Object[]{now, date}); // expected 10:15 Assert.assertTrue(date.getHour()==10); Assert.assertTrue(date.getMinute()==15); @@ -244,7 +245,7 @@ public void testCronUnitValueList() { now = now.with(ChronoField.HOUR_OF_DAY,10); now = now.with(ChronoField.MINUTE_OF_HOUR,25); date = intervalPlugin.evalCron(cron,now); - logger.info(" => now=" + now + " result=" + date); + logger.log(Level.INFO, " => now={0} result={1}", new Object[]{now, date}); // expected 10:30 Assert.assertTrue(date.getHour()==10); Assert.assertTrue(date.getMinute()==30); diff --git a/imixs-workflow-engine/src/test/java/org/imixs/workflow/plugins/TestOwnerPluginProcessEntity.java b/imixs-workflow-engine/src/test/java/org/imixs/workflow/plugins/TestOwnerPluginProcessEntity.java index f03b17ba9..3446bbabe 100644 --- a/imixs-workflow-engine/src/test/java/org/imixs/workflow/plugins/TestOwnerPluginProcessEntity.java +++ b/imixs-workflow-engine/src/test/java/org/imixs/workflow/plugins/TestOwnerPluginProcessEntity.java @@ -68,7 +68,7 @@ public void setUp() throws PluginException, ModelException { // prepare data documentContext = new ItemCollection().model(WorkflowMockEnvironment.DEFAULT_MODEL_VERSION).task(100).event(10); - logger.info("[TestOwnerPlugin] setup test data..."); + logger.info("[TestOwnerPluginProcessEntity] setup test data..."); Vector list = new Vector(); list.add("manfred"); list.add("anna"); diff --git a/imixs-workflow-engine/src/test/java/org/imixs/workflow/plugins/TestResultPlugin.java b/imixs-workflow-engine/src/test/java/org/imixs/workflow/plugins/TestResultPlugin.java index c04f1335d..22d10b560 100644 --- a/imixs-workflow-engine/src/test/java/org/imixs/workflow/plugins/TestResultPlugin.java +++ b/imixs-workflow-engine/src/test/java/org/imixs/workflow/plugins/TestResultPlugin.java @@ -2,6 +2,7 @@ import java.util.Calendar; import java.util.Date; +import java.util.logging.Level; import java.util.logging.Logger; import javax.script.ScriptException; @@ -32,7 +33,7 @@ public class TestResultPlugin { protected ResultPlugin resultPlugin = null; public static final String DEFAULT_MODEL_VERSION = "1.0.0"; - private static Logger logger = Logger.getLogger(TestResultPlugin.class.getName()); + private static final Logger logger = Logger.getLogger(TestResultPlugin.class.getName()); protected WorkflowMockEnvironment workflowMockEnvironment; @@ -68,7 +69,7 @@ public void testBasic() throws PluginException { ItemCollection adocumentActivity = new ItemCollection(); String sResult = "Manfred"; - logger.info("txtActivityResult=" + sResult); + logger.log(Level.INFO, "txtActivityResult={0}", sResult); adocumentActivity.replaceItemValue("txtActivityResult", sResult); // run plugin adocumentContext = resultPlugin.run(adocumentContext, adocumentActivity); @@ -78,7 +79,7 @@ public void testBasic() throws PluginException { // test with ' instead of " sResult = "Manfred"; - logger.info("txtActivityResult=" + sResult); + logger.log(Level.INFO, "txtActivityResult={0}", sResult); adocumentActivity.replaceItemValue("txtActivityResult", sResult); // run plugin adocumentContext = resultPlugin.run(adocumentContext, adocumentActivity); @@ -96,7 +97,7 @@ public void testBasicWithTypeBoolean() throws PluginException { String sResult = "true"; - logger.info("txtActivityResult=" + sResult); + logger.log(Level.INFO, "txtActivityResult={0}", sResult); adocumentActivity.replaceItemValue("txtActivityResult", sResult); // run plugin @@ -115,7 +116,7 @@ public void testBasicWithTypeInteger() throws PluginException { String sResult = "47"; - logger.info("txtActivityResult=" + sResult); + logger.log(Level.INFO, "txtActivityResult={0}", sResult); adocumentActivity.replaceItemValue("txtActivityResult", sResult); // run plugin @@ -134,7 +135,7 @@ public void testBasicWithTypeDate() throws PluginException { String sResult = "2017-12-31"; - logger.info("txtActivityResult=" + sResult); + logger.log(Level.INFO, "txtActivityResult={0}", sResult); adocumentActivity.replaceItemValue("txtActivityResult", sResult); // run plugin @@ -162,7 +163,7 @@ public void testBasicWithTypeDateWithEmptyValue() throws PluginException { String sResult = ""; - logger.info("txtActivityResult=" + sResult); + logger.log(Level.INFO, "txtActivityResult={0}", sResult); adocumentActivity.replaceItemValue("txtActivityResult", sResult); // run plugin @@ -185,7 +186,7 @@ public void testBasicWithTypeDateWithExistingDateValue() throws PluginException String sResult = "$lastEventDate"; - logger.info("txtActivityResult=" + sResult); + logger.log(Level.INFO, "txtActivityResult={0}", sResult); adocumentActivity.replaceItemValue("txtActivityResult", sResult); // run plugin adocumentContext = resultPlugin.run(adocumentContext, adocumentActivity); @@ -220,7 +221,7 @@ public void testTypeProperty() throws PluginException { String sResult = "workitemdeleted"; - logger.info("txtActivityResult=" + sResult); + logger.log(Level.INFO, "txtActivityResult={0}", sResult); adocumentActivity.replaceItemValue("txtActivityResult", sResult); // run plugin @@ -249,7 +250,7 @@ public void testInvalidFormatException() { // wrong format String sResult = "Anna"; - logger.info("txtActivityResult=" + sResult); + logger.log(Level.INFO, "txtActivityResult={0}", sResult); adocumentActivity.replaceItemValue("txtActivityResult", sResult); int result; @@ -266,7 +267,7 @@ public void testInvalidFormatException() { // wrong format missing " sResult = "Anna"; - logger.info("txtActivityResult=" + sResult); + logger.log(Level.INFO, "txtActivityResult={0}", sResult); adocumentActivity.replaceItemValue("txtActivityResult", sResult); try { @@ -336,7 +337,7 @@ public void testWhiteSpace() throws PluginException { // test new line... String sResult = " \r\n some data \r\n workitemdeleted \r\n "; - logger.info("txtActivityResult=" + sResult); + logger.log(Level.INFO, "txtActivityResult={0}", sResult); adocumentActivity.replaceItemValue("txtActivityResult", sResult); // run plugin @@ -365,7 +366,7 @@ public void testEmptyTag() throws PluginException { // clear value... String sResult = ""; - logger.info("txtActivityResult=" + sResult); + logger.log(Level.INFO, "txtActivityResult={0}", sResult); adocumentActivity.replaceItemValue("txtActivityResult", sResult); // run plugin @@ -397,7 +398,7 @@ public void testImediateTag() throws PluginException { String sResult = "some data"; sResult = sResult + "true"; sResult = sResult + "some other data"; - logger.info("txtActivityResult=" + sResult); + logger.log(Level.INFO, "txtActivityResult={0}", sResult); adocumentActivity.replaceItemValue("txtActivityResult", sResult); // run plugin diff --git a/imixs-workflow-engine/src/test/java/org/imixs/workflow/plugins/TestRulePlugin.java b/imixs-workflow-engine/src/test/java/org/imixs/workflow/plugins/TestRulePlugin.java index 7ff910214..841bbfc8e 100644 --- a/imixs-workflow-engine/src/test/java/org/imixs/workflow/plugins/TestRulePlugin.java +++ b/imixs-workflow-engine/src/test/java/org/imixs/workflow/plugins/TestRulePlugin.java @@ -4,6 +4,7 @@ import java.util.Calendar; import java.util.Date; import java.util.List; +import java.util.logging.Level; import java.util.logging.Logger; import javax.script.ScriptException; @@ -48,7 +49,7 @@ public void testBasicScript() throws PluginException { // set a business rule String script = "var result={}; var a=1;var b=2;result.isValid = ((a5000)" + " result.followUp=90;"; - logger.info("Script=" + script); + logger.log(Level.INFO, "Script={0}", script); ItemCollection workitem = new ItemCollection(); workitem.replaceItemValue("_amount_brutto", Double.valueOf(6000)); @@ -342,7 +343,7 @@ public void bigDecimalTest() throws PluginException { // set a business rule String script = " var result={};" + " if (workitem._amount_brutto[0]>5000.50)" + " result.followUp=90;"; - logger.info("Script=" + script); + logger.log(Level.INFO, "Script={0}", script); ItemCollection adocumentContext = new ItemCollection(); adocumentContext.replaceItemValue("_amount_brutto", BigDecimal.valueOf(5000.51d)); @@ -385,7 +386,7 @@ public void testEventObjectByScript() throws PluginException { // set a business rule String script = "var result={}; result.isValid = '1'==event.keymailenabled[0];"; - logger.info("Script=" + script); + logger.log(Level.INFO, "Script={0}", script); adocumentActivity.replaceItemValue("txtBusinessRUle", script); // run plugin @@ -413,7 +414,7 @@ public void testInjectItemIntoEventObjectByScript() throws PluginException { // set a business rule String script = "var result={}; event.setItemValue('nammailreplytouser','test@me.com');"; - logger.info("Script=" + script); + logger.log(Level.INFO, "Script={0}", script); event.replaceItemValue("txtBusinessRUle", script); // run plugin @@ -445,7 +446,7 @@ public void testChangeEventObejctByScript() throws PluginException { //String script = "var result={}; result.isValid =event.keymailenabled[0]=='1'; event.keymailenabled='0';"; String script = "var result={}; result.isValid =event.keymailenabled[0]=='1'; event.setItemValue('keymailenabled','0');"; - logger.info("Script=" + script); + logger.log(Level.INFO, "Script={0}", script); adocumentActivity.replaceItemValue("txtBusinessRUle", script); // run plugin @@ -476,7 +477,7 @@ public void testSimpleWorkitemScript() throws PluginException { // set a business rule String script = "var result={}; result.isValid = 1000==workitem.get('$taskid')[0];"; - logger.info("Script=" + script); + logger.log(Level.INFO, "Script={0}", script); adocumentActivity.replaceItemValue("txtBusinessRUle", script); // run plugin @@ -502,7 +503,7 @@ public void testSimpleWorkitemScriptWithDeprecatedField() throws PluginExceptio // String script = "var isValid = 1000==workitem.get('$processid')[0];"; String script = "var result={}; result.isValid = 1000==workitem.get('$processid')[0];"; - logger.info("Script=" + script); + logger.log(Level.INFO, "Script={0}", script); adocumentActivity.replaceItemValue("txtBusinessRUle", script); // run plugin @@ -528,7 +529,7 @@ public void testIsValidDate() throws PluginException { String script = "var result={}; var refField1=\"_contact\";" + " var refField2=\"datdate\";" + " result.isValid=true;" + " if ( ( workitem.get(refField2) == null) ) {" + " result.isValid=false;" + " result.errorMessage='1) Bitte geben Sie ein Datum fuer das Zahlungsziel an!';" + " } "; - logger.info("Script=" + script); + logger.log(Level.INFO, "Script={0}", script); adocumentActivity.replaceItemValue("txtBusinessRUle", script); // run plugin @@ -544,7 +545,7 @@ public void testIsValidDate() throws PluginException { script = "var result={}; var refField1=\"_contact\";" + " var refField2=\"datdate\";" + " result.isValid=true;" + " if ( ( workitem.get(refField2) == null) ) {" + " result.isValid=false;" + " result.errorMessage='2) Bitte geben Sie ein Datum fuer das Zahlungsziel an!';" + " } "; - logger.info("Script=" + script); + logger.log(Level.INFO, "Script={0}", script); adocumentActivity.replaceItemValue("txtBusinessRUle", script); try { @@ -570,7 +571,7 @@ public void testIsValidDate() throws PluginException { script = "var result={}; var refField1=\"_contact\";" + " var refField2=\"datdate\";" + " result.isValid=true;" + " if ( ( workitem.get(refField2) == null) ) {" + " result.isValid=false;" + " result.errorMessage='3) Bitte geben Sie ein Datum fuer das Zahlungsziel an!';" + " } "; - logger.info("Script=" + script); + logger.log(Level.INFO, "Script={0}", script); adocumentActivity.replaceItemValue("txtBusinessRUle", script); // run plugin @@ -751,7 +752,7 @@ public void testResultObjectJSON() throws PluginException { // set a business rule String script = "var result={ someitem:'Hello World', somenumber:1};"; - logger.info("Script=" + script); + logger.log(Level.INFO, "Script={0}", script); adocumentActivity.replaceItemValue("txtBusinessRUle", script); // run plugin @@ -781,7 +782,7 @@ public void testResultObjectFollowUpActivity() throws PluginException { // set a business rule String script = "var a=1.0;var b=2;var result={}; result.followUp =a+b;"; - logger.info("Script=" + script); + logger.log(Level.INFO, "Script={0}", script); adocumentActivity.replaceItemValue("txtBusinessRUle", script); // run plugin @@ -814,7 +815,7 @@ public void testResultObjectNewValue() throws PluginException { // set a business rule String script = "var a=1.0;var b=2;var result={}; result.someitem='Hello World'; result.somenumber=1"; - logger.info("Script=" + script); + logger.log(Level.INFO, "Script={0}", script); adocumentActivity.replaceItemValue("txtBusinessRUle", script); // run plugin @@ -843,7 +844,7 @@ public void testResultObjectNewValueList() throws PluginException { // set a business rule String script = "var a=1.0;var b=2;var result={}; result.some_item=[]; result.some_item[0]='Hello World'; result.some_item[1]='Hello Imixs';"; - logger.info("Script=" + script); + logger.log(Level.INFO, "Script={0}", script); adocumentActivity.replaceItemValue("txtBusinessRUle", script); // run plugin @@ -875,7 +876,7 @@ public void testResultObjectNewValueListAsJSON() throws PluginException { // set a business rule String script = "var a=1.0;var b=2;var result={'single_item':'Hello World', 'multi_item':['Hello World','Hello Imixs']};"; - logger.info("Script=" + script); + logger.log(Level.INFO, "Script={0}", script); adocumentActivity.replaceItemValue("txtBusinessRUle", script); // run plugin @@ -918,7 +919,7 @@ public void testUpdateActivityByScript() throws PluginException { // now add a manipulation! script += " event.setItemValue('keymailenabled','0');"; - logger.info("Script=" + script); + logger.log(Level.INFO, "Script={0}", script); event.replaceItemValue("txtBusinessRUle", script); event.replaceItemValue("txtBusinessRuleEngine", "js"); diff --git a/imixs-workflow-engine/src/test/java/org/imixs/workflow/plugins/TestSplitAndJoinPlugin.java b/imixs-workflow-engine/src/test/java/org/imixs/workflow/plugins/TestSplitAndJoinPlugin.java index 7d945b6bd..ae11f26b8 100644 --- a/imixs-workflow-engine/src/test/java/org/imixs/workflow/plugins/TestSplitAndJoinPlugin.java +++ b/imixs-workflow-engine/src/test/java/org/imixs/workflow/plugins/TestSplitAndJoinPlugin.java @@ -5,6 +5,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Vector; +import java.util.logging.Level; import java.util.logging.Logger; import java.util.regex.Pattern; @@ -62,7 +63,7 @@ public void setUp() throws PluginException, ModelException { // prepare test workitem documentContext = new ItemCollection(); - logger.info("[TestAccessPlugin] setup test data..."); + logger.info("[TestSplitAndJoinPlugin] setup test data..."); Vector list = new Vector(); list.add("manfred"); list.add("anna"); @@ -114,7 +115,7 @@ public void testCreateSubProcess() throws ModelException { Assert.assertEquals(100, subprocess.getTaskID()); - logger.info("Created Subprocess UniqueID=" + subprocess.getUniqueID()); + logger.log(Level.INFO, "Created Subprocess UniqueID={0}", subprocess.getUniqueID()); // test if the field namTeam is available List team = subprocess.getItemValue("namTeam"); @@ -158,7 +159,7 @@ public void testCreateSubProcessTargetFieldName() throws ModelException { Assert.assertEquals(100, subprocess.getTaskID()); - logger.info("Created Subprocess UniqueID=" + subprocess.getUniqueID()); + logger.log(Level.INFO, "Created Subprocess UniqueID={0}", subprocess.getUniqueID()); // test if the field namTeam is available List team = subprocess.getItemValue("_sub_Team"); @@ -215,7 +216,7 @@ public void testCreateSubProcessWithFile() throws ModelException { Assert.assertEquals(100, subprocess.getTaskID()); - logger.info("Created Subprocess UniqueID=" + subprocess.getUniqueID()); + logger.log(Level.INFO, "Created Subprocess UniqueID={0}", subprocess.getUniqueID()); // test if the field namTeam is available List team = subprocess.getItemValue("_sub_Team"); @@ -266,14 +267,14 @@ public void testCreateMultiSubProcess() throws ModelException { ItemCollection subprocess = workflowMockEnvironment.getDocumentService().load(subprocessUniqueid); Assert.assertNotNull(subprocess); Assert.assertEquals(100, subprocess.getTaskID()); - logger.info("Created Subprocess UniqueID=" + subprocess.getUniqueID()); + logger.log(Level.INFO, "Created Subprocess UniqueID={0}", subprocess.getUniqueID()); // test second subprocess instance... 100.20 -> $processId=200 subprocessUniqueid = workitemRefList.get(1); subprocess = workflowMockEnvironment.getDocumentService().load(subprocessUniqueid); Assert.assertNotNull(subprocess); Assert.assertEquals(100, subprocess.getTaskID()); - logger.info("Created Subprocess UniqueID=" + subprocess.getUniqueID()); + logger.log(Level.INFO, "Created Subprocess UniqueID={0}", subprocess.getUniqueID()); } @@ -292,7 +293,7 @@ public void testCreateSubProcessParsingError() throws ModelException { Assert.fail(); } catch (PluginException e) { // Plugin exception is expected - logger.info("Exprected exception message: " + e.getMessage()); + logger.log(Level.INFO, "Exprected exception message: {0}", e.getMessage()); Assert.assertTrue(e.getMessage().startsWith("Parsing item content failed:")); } diff --git a/imixs-workflow-engine/src/test/java/org/imixs/workflow/plugins/TestSplitAndJoinPluginDeprecatedItemTag.java b/imixs-workflow-engine/src/test/java/org/imixs/workflow/plugins/TestSplitAndJoinPluginDeprecatedItemTag.java index e13c6bd7d..db1fe9232 100644 --- a/imixs-workflow-engine/src/test/java/org/imixs/workflow/plugins/TestSplitAndJoinPluginDeprecatedItemTag.java +++ b/imixs-workflow-engine/src/test/java/org/imixs/workflow/plugins/TestSplitAndJoinPluginDeprecatedItemTag.java @@ -5,6 +5,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Vector; +import java.util.logging.Level; import java.util.logging.Logger; import java.util.regex.Pattern; @@ -61,7 +62,7 @@ public void setUp() throws PluginException, ModelException { // prepare test workitem documentContext = new ItemCollection(); - logger.info("[TestAccessPlugin] setup test data..."); + logger.info("[TestSplitAndJoinPluginDeprecatedItemTag] setup test data..."); Vector list = new Vector(); list.add("manfred"); list.add("anna"); @@ -113,7 +114,7 @@ public void testCreateSubProcess() throws ModelException { Assert.assertEquals(100, subprocess.getTaskID()); - logger.info("Created Subprocess UniqueID=" + subprocess.getUniqueID()); + logger.log(Level.INFO, "Created Subprocess UniqueID={0}", subprocess.getUniqueID()); // test if the field namTeam is available List team = subprocess.getItemValue("namTeam"); @@ -157,7 +158,7 @@ public void testCreateSubProcessTargetFieldName() throws ModelException { Assert.assertEquals(100, subprocess.getTaskID()); - logger.info("Created Subprocess UniqueID=" + subprocess.getUniqueID()); + logger.log(Level.INFO, "Created Subprocess UniqueID={0}", subprocess.getUniqueID()); // test if the field namTeam is available List team = subprocess.getItemValue("_sub_Team"); @@ -210,7 +211,7 @@ public void testCreateSubProcessWithFile() throws ModelException { Assert.assertEquals(100, subprocess.getTaskID()); - logger.info("Created Subprocess UniqueID=" + subprocess.getUniqueID()); + logger.log(Level.INFO, "Created Subprocess UniqueID={0}", subprocess.getUniqueID()); // test if the field namTeam is available List team = subprocess.getItemValue("_sub_Team"); @@ -259,14 +260,14 @@ public void testCreateMultiSubProcess() throws ModelException { ItemCollection subprocess = workflowMockEnvironment.getDocumentService().load(subprocessUniqueid); Assert.assertNotNull(subprocess); Assert.assertEquals(100, subprocess.getTaskID()); - logger.info("Created Subprocess UniqueID=" + subprocess.getUniqueID()); + logger.log(Level.INFO, "Created Subprocess UniqueID={0}", subprocess.getUniqueID()); // test second subprocess instance... 100.20 -> $processId=200 subprocessUniqueid = workitemRefList.get(1); subprocess = workflowMockEnvironment.getDocumentService().load(subprocessUniqueid); Assert.assertNotNull(subprocess); Assert.assertEquals(100, subprocess.getTaskID()); - logger.info("Created Subprocess UniqueID=" + subprocess.getUniqueID()); + logger.log(Level.INFO, "Created Subprocess UniqueID={0}", subprocess.getUniqueID()); } @@ -285,7 +286,7 @@ public void testCreateSubProcessParsingError() throws ModelException { Assert.fail(); } catch (PluginException e) { // Plugin exception is expected - logger.info("Exprected exception message: " + e.getMessage()); + logger.log(Level.INFO, "Exprected exception message: {0}", e.getMessage()); Assert.assertTrue(e.getMessage().startsWith("Parsing item content failed:")); } diff --git a/imixs-workflow-faces/java/org/imixs/workflow/engine/TestAdaptText.java b/imixs-workflow-faces/java/org/imixs/workflow/engine/TestAdaptText.java index 75dc6edef..44c745693 100644 --- a/imixs-workflow-faces/java/org/imixs/workflow/engine/TestAdaptText.java +++ b/imixs-workflow-faces/java/org/imixs/workflow/engine/TestAdaptText.java @@ -53,7 +53,7 @@ public void testReplaceDynamicValues() throws PluginException { // prepare data - logger.info("[TestAbstractPlugin] setup test data..."); + logger.info("[TestAdaptText] setup test data..."); documentContext = new ItemCollection(); documentContext.replaceItemValue("txtName", "Anna"); @@ -77,7 +77,7 @@ public void testReplaceDynamicValuesFormatError() { // prepare data - logger.info("[TestAbstractPlugin] setup test data..."); + logger.info("[TestAdaptText] setup test data..."); documentContext = new ItemCollection(); documentContext.replaceItemValue("txtName", "Anna"); @@ -114,7 +114,7 @@ public void testDateFormat() throws PluginException { // prepare data documentContext = new ItemCollection(); - logger.info("[TestHisotryPlugin] setup test data..."); + logger.info("[TestAdaptText] setup test data..."); Calendar cal = Calendar.getInstance(); cal.set(Calendar.DATE, 27); @@ -137,7 +137,7 @@ public void testDateFormatEN() throws PluginException { // prepare data documentContext = new ItemCollection(); - logger.info("[TestHisotryPlugin] setup test data..."); + logger.info("[TestAdaptText] setup test data..."); Calendar cal = Calendar.getInstance(); cal.set(Calendar.DATE, 27); @@ -173,7 +173,7 @@ public void testMultiValueFormat() throws PluginException { // prepare data documentContext = new ItemCollection(); - logger.info("[TestHisotryPlugin] setup test data..."); + logger.info("[TestAdaptText] setup test data..."); Vector value = new Vector(); value.add(1); @@ -246,7 +246,7 @@ public void testMultiValueWithNoSeparator() throws PluginException { // prepare data documentContext = new ItemCollection(); - logger.info("[TestHisotryPlugin] setup test data..."); + logger.info("[TestAdaptText] setup test data..."); Vector value = new Vector(); value.add(1); @@ -283,7 +283,7 @@ public void testMultiValuePosition() throws PluginException { // prepare data documentContext = new ItemCollection(); - logger.info("[TestHisotryPlugin] setup test data..."); + logger.info("[TestAdaptText] setup test data..."); Vector values = new Vector(); values.add(1); @@ -301,7 +301,7 @@ public void testMultiValuePosition() throws PluginException { // prepare data documentContext = new ItemCollection(); - logger.info("[TestHisotryPlugin] setup test data..."); + logger.info("[TestAdaptText] setup test data..."); documentContext.replaceItemValue("_numbers", values); diff --git a/imixs-workflow-faces/java/org/imixs/workflow/engine/TestEvaluateWorkflowResult.java b/imixs-workflow-faces/java/org/imixs/workflow/engine/TestEvaluateWorkflowResult.java index e5209bf69..c814dfe95 100644 --- a/imixs-workflow-faces/java/org/imixs/workflow/engine/TestEvaluateWorkflowResult.java +++ b/imixs-workflow-faces/java/org/imixs/workflow/engine/TestEvaluateWorkflowResult.java @@ -1,6 +1,7 @@ package org.imixs.workflow.engine; import java.util.List; +import java.util.logging.Level; import java.util.logging.Logger; import org.imixs.workflow.ItemCollection; @@ -216,7 +217,7 @@ public void testEvaluateWorkflowResultMultiValueWithEmptyTag() throws PluginExce evalItemCollection = workflowMockEnvironment.getWorkflowService().evalWorkflowResult(activityEntity, "item", new ItemCollection()); - logger.info("...evaluated result in " + (System.currentTimeMillis() - l) + "ms..."); + logger.log(Level.INFO, "...evaluated result in {0}ms...", System.currentTimeMillis() - l); // expected: comment_ignore=true Assert.assertTrue(evalItemCollection.hasItem("comment.ignore")); @@ -237,7 +238,7 @@ public void testEvaluateWorkflowResultMultiValueWithEmptyTag() throws PluginExce evalItemCollection = new ItemCollection(); evalItemCollection = workflowMockEnvironment.getWorkflowService().evalWorkflowResult(activityEntity, "item", new ItemCollection()); - logger.info("...evaluated result in " + (System.currentTimeMillis() - l) + "ms..."); + logger.log(Level.INFO, "...evaluated result in {0}ms...", System.currentTimeMillis() - l); // expected: comment_ignore=true Assert.assertTrue(evalItemCollection.hasItem("comment.ignore")); diff --git a/imixs-workflow-faces/java/org/imixs/workflow/engine/WorkflowMockEnvironment.java b/imixs-workflow-faces/java/org/imixs/workflow/engine/WorkflowMockEnvironment.java index 463f89716..7626176d7 100644 --- a/imixs-workflow-faces/java/org/imixs/workflow/engine/WorkflowMockEnvironment.java +++ b/imixs-workflow-faces/java/org/imixs/workflow/engine/WorkflowMockEnvironment.java @@ -17,6 +17,7 @@ import javax.xml.parsers.ParserConfigurationException; import jakarta.ejb.SessionContext; +import java.util.logging.Level; import org.imixs.workflow.ItemCollection; @@ -334,11 +335,11 @@ public void loadModel() { long lLoadTime = System.currentTimeMillis(); InputStream inputStream = WorkflowMockEnvironment.class.getResourceAsStream(this.modelPath); try { - logger.info("loading model: " + this.modelPath + "...."); + logger.log(Level.INFO, "loading model: {0}....", this.modelPath); model = BPMNParser.parseModel(inputStream, "UTF-8"); this.modelService.addModel(model); - logger.fine("...loadModel processing time=" + (System.currentTimeMillis() - lLoadTime) + "ms"); + logger.log(Level.FINE, "...loadModel processing time={0}ms", System.currentTimeMillis() - lLoadTime); } catch (ModelException | ParseException | ParserConfigurationException | IOException | SAXException e) { e.printStackTrace(); } diff --git a/imixs-workflow-faces/java/org/imixs/workflow/engine/adapters/TestAccessAdapter.java b/imixs-workflow-faces/java/org/imixs/workflow/engine/adapters/TestAccessAdapter.java index 8fd9914d1..808812160 100644 --- a/imixs-workflow-faces/java/org/imixs/workflow/engine/adapters/TestAccessAdapter.java +++ b/imixs-workflow-faces/java/org/imixs/workflow/engine/adapters/TestAccessAdapter.java @@ -95,7 +95,7 @@ public void fieldMappingTest() throws ModelException { documentActivity = workflowMockEnvironment.getModel().getEvent(100, 10); documentContext.setEventID(10); - logger.info("[TestAccessPlugin] setup test data..."); + logger.info("[TestAccessAdapter] setup test data..."); Vector list = new Vector(); list.add("manfred"); list.add("anna"); diff --git a/imixs-workflow-faces/java/org/imixs/workflow/engine/adapters/TestAccessAdapterProcessEntity.java b/imixs-workflow-faces/java/org/imixs/workflow/engine/adapters/TestAccessAdapterProcessEntity.java index 100871efb..ada5ffa87 100644 --- a/imixs-workflow-faces/java/org/imixs/workflow/engine/adapters/TestAccessAdapterProcessEntity.java +++ b/imixs-workflow-faces/java/org/imixs/workflow/engine/adapters/TestAccessAdapterProcessEntity.java @@ -64,7 +64,7 @@ public void setUp() throws PluginException, ModelException { // prepare data documentContext = new ItemCollection().model(WorkflowMockEnvironment.DEFAULT_MODEL_VERSION).task(100); - logger.info("[TestAccessPlugin] setup test data..."); + logger.info("[TestAccessAdapterProcessEntity] setup test data..."); Vector list = new Vector(); list.add("manfred"); list.add("anna"); diff --git a/imixs-workflow-faces/java/org/imixs/workflow/engine/index/TestNormalizePhrase.java b/imixs-workflow-faces/java/org/imixs/workflow/engine/index/TestNormalizePhrase.java index 2cd0e9d27..6d889bd56 100644 --- a/imixs-workflow-faces/java/org/imixs/workflow/engine/index/TestNormalizePhrase.java +++ b/imixs-workflow-faces/java/org/imixs/workflow/engine/index/TestNormalizePhrase.java @@ -1,5 +1,6 @@ package org.imixs.workflow.engine.index; +import java.util.logging.Level; import java.util.logging.Logger; import org.imixs.workflow.exceptions.ModelException; @@ -18,7 +19,7 @@ public class TestNormalizePhrase { SchemaService schemaService = null; - private static Logger logger = Logger.getLogger(TestNormalizePhrase.class.getName()); + private static final Logger logger = Logger.getLogger(TestNormalizePhrase.class.getName()); @Before public void setUp() throws PluginException, ModelException { @@ -36,7 +37,7 @@ public void test1() throws PluginException { String result = null; result = schemaService.normalizeSearchTerm(searchTerm); - logger.info(searchTerm + " --> " + result); + logger.log(Level.INFO, "{0} --> {1}", new Object[]{searchTerm, result}); Assert.assertEquals("lukas podolski", result); @@ -55,7 +56,7 @@ public void test2() throws PluginException { String result = null; result = schemaService.normalizeSearchTerm(searchTerm); - logger.info(searchTerm + " --> " + result); + logger.log(Level.INFO, "{0} --> {1}", new Object[]{searchTerm, result}); Assert.assertEquals("europe berlin", result); @@ -72,7 +73,7 @@ public void test3() throws PluginException { String result = null; result = schemaService.normalizeSearchTerm(searchTerm); - logger.info(searchTerm + " --> " + result); + logger.log(Level.INFO, "{0} --> {1}", new Object[]{searchTerm, result}); Assert.assertEquals("rs\\/82550\\/201618", result); @@ -89,7 +90,7 @@ public void test4() throws PluginException { String result = null; result = schemaService.normalizeSearchTerm(searchTerm); - logger.info(searchTerm + " --> " + result); + logger.log(Level.INFO, "{0} --> {1}", new Object[]{searchTerm, result}); Assert.assertEquals("rs\\-82550\\/201618", result); diff --git a/imixs-workflow-faces/java/org/imixs/workflow/plugins/TestAnalysisPlugin.java b/imixs-workflow-faces/java/org/imixs/workflow/plugins/TestAnalysisPlugin.java index 09673db78..d3d394480 100644 --- a/imixs-workflow-faces/java/org/imixs/workflow/plugins/TestAnalysisPlugin.java +++ b/imixs-workflow-faces/java/org/imixs/workflow/plugins/TestAnalysisPlugin.java @@ -1,5 +1,6 @@ package org.imixs.workflow.plugins; +import java.util.logging.Level; import java.util.logging.Logger; import org.imixs.workflow.ItemCollection; @@ -17,7 +18,7 @@ */ public class TestAnalysisPlugin { protected AnalysisPlugin analysisPlugin = null; - private static Logger logger = Logger.getLogger(TestAnalysisPlugin.class.getName()); + private static final Logger logger = Logger.getLogger(TestAnalysisPlugin.class.getName()); @Before public void setUp() throws PluginException { @@ -44,7 +45,7 @@ public void testBasicTest() throws PluginException { ItemCollection adocumentActivity = new ItemCollection(); String sResult = "M1"; - logger.info("txtActivityResult=" + sResult); + logger.log(Level.INFO, "txtActivityResult={0}", sResult); adocumentActivity.replaceItemValue("txtActivityResult", sResult); adocumentContext = analysisPlugin.run(adocumentContext, adocumentActivity); @@ -52,7 +53,7 @@ public void testBasicTest() throws PluginException { Assert.assertTrue(adocumentContext.hasItem("datMeasurePointStart_M1")); - logger.info("datMeasurePointStart_M1= " + adocumentContext.getItemValueDate("datMeasurePointStart_M1")); + logger.log(Level.INFO, "datMeasurePointStart_M1= {0}", adocumentContext.getItemValueDate("datMeasurePointStart_M1")); } @@ -74,7 +75,7 @@ public void testWrongStartTest() throws PluginException { ItemCollection adocumentActivity = new ItemCollection(); String sResult = "M1"; - logger.info("txtActivityResult=" + sResult); + logger.log(Level.INFO, "txtActivityResult={0}", sResult); adocumentActivity.replaceItemValue("txtActivityResult", sResult); adocumentContext = analysisPlugin.run(adocumentContext, adocumentActivity); @@ -82,13 +83,13 @@ public void testWrongStartTest() throws PluginException { Assert.assertTrue(adocumentContext.hasItem("datMeasurePointStart_M1")); - logger.info("datMeasurePointStart_M1= " + adocumentContext.getItemValueDate("datMeasurePointStart_M1")); + logger.log(Level.INFO, "datMeasurePointStart_M1= {0}", adocumentContext.getItemValueDate("datMeasurePointStart_M1")); sResult = "M1"; - logger.info("txtActivityResult=" + sResult); + logger.log(Level.INFO, "txtActivityResult={0}", sResult); adocumentActivity.replaceItemValue("txtActivityResult", sResult); adocumentContext = analysisPlugin.run(adocumentContext, adocumentActivity); @@ -119,7 +120,7 @@ public void testTotalTime() throws PluginException { ItemCollection adocumentActivity = new ItemCollection(); String sResult = "M1"; - logger.info("txtActivityResult=" + sResult); + logger.log(Level.INFO, "txtActivityResult={0}", sResult); adocumentActivity.replaceItemValue("txtActivityResult", sResult); adocumentContext = analysisPlugin.run(adocumentContext, adocumentActivity); @@ -127,7 +128,7 @@ public void testTotalTime() throws PluginException { Assert.assertTrue(adocumentContext.hasItem("datMeasurePointStart_M1")); - logger.info("datMeasurePointStart_M1= " + adocumentContext.getItemValueDate("datMeasurePointStart_M1")); + logger.log(Level.INFO, "datMeasurePointStart_M1= {0}", adocumentContext.getItemValueDate("datMeasurePointStart_M1")); @@ -140,7 +141,7 @@ public void testTotalTime() throws PluginException { sResult = "M1"; - logger.info("txtActivityResult=" + sResult); + logger.log(Level.INFO, "txtActivityResult={0}", sResult); adocumentActivity.replaceItemValue("txtActivityResult", sResult); adocumentContext = analysisPlugin.run(adocumentContext, adocumentActivity); diff --git a/imixs-workflow-faces/java/org/imixs/workflow/plugins/TestApplicationPlugin.java b/imixs-workflow-faces/java/org/imixs/workflow/plugins/TestApplicationPlugin.java index 0b274ceb4..f6099e716 100644 --- a/imixs-workflow-faces/java/org/imixs/workflow/plugins/TestApplicationPlugin.java +++ b/imixs-workflow-faces/java/org/imixs/workflow/plugins/TestApplicationPlugin.java @@ -51,7 +51,7 @@ public void setUp() throws PluginException, ModelException { // prepare data documentContext = new ItemCollection().model("1.0.0").task(100); - logger.info("[TestAccessPlugin] setup test data..."); + logger.info("[TestApplicationPlugin] setup test data..."); Vector list = new Vector(); list.add("manfred"); list.add("anna"); diff --git a/imixs-workflow-faces/java/org/imixs/workflow/plugins/TestIntervalPlugin.java b/imixs-workflow-faces/java/org/imixs/workflow/plugins/TestIntervalPlugin.java index 977408e04..f9888842a 100644 --- a/imixs-workflow-faces/java/org/imixs/workflow/plugins/TestIntervalPlugin.java +++ b/imixs-workflow-faces/java/org/imixs/workflow/plugins/TestIntervalPlugin.java @@ -3,6 +3,7 @@ import java.time.DayOfWeek; import java.time.LocalDateTime; import java.util.Date; +import java.util.logging.Level; import java.util.logging.Logger; import org.imixs.workflow.ItemCollection; @@ -24,7 +25,7 @@ public class TestIntervalPlugin { protected IntervalPlugin intervalPlugin = null; - private static Logger logger = Logger.getLogger(TestIntervalPlugin.class.getName()); + private static final Logger logger = Logger.getLogger(TestIntervalPlugin.class.getName()); WorkflowMockEnvironment workflowMockEnvironment; ItemCollection documentContext; ItemCollection documentActivity; @@ -47,7 +48,7 @@ public void setup() throws PluginException, ModelException, AdapterException { // prepare test workitem documentContext = new ItemCollection(); - logger.info("[TestAccessPlugin] setup test data..."); + logger.info("[TestIntervalPlugin] setup test data..."); documentContext.replaceItemValue("reminder", new Date()); @@ -62,7 +63,7 @@ public void setup() throws PluginException, ModelException, AdapterException { */ @Test public void testBPMNModel() throws PluginException { - logger.info("------------------ Ref Date =" + documentContext.getItemValueDate("reminder")); + logger.log(Level.INFO, "------------------ Ref Date ={0}", documentContext.getItemValueDate("reminder")); try { documentActivity = workflowMockEnvironment.getModel().getEvent(100, 99); intervalPlugin.run(documentContext, documentActivity); @@ -71,7 +72,7 @@ public void testBPMNModel() throws PluginException { Assert.fail(); } Date result = documentContext.getItemValueDate("reminder"); - logger.info("------------------ Result Date=" + result); + logger.log(Level.INFO, "------------------ Result Date={0}", result); } /** @@ -84,7 +85,7 @@ public void test1stDayInMonth() throws PluginException { // @monthly String cron = "0 0 1 * *"; LocalDateTime date = intervalPlugin.evalCron(cron); - logger.info("Result monthyl=" + date); + logger.log(Level.INFO, "Result monthyl={0}", date); LocalDateTime now = LocalDateTime.now(); int exptectedMonth= now.getMonthValue() +1; if (exptectedMonth==13) { @@ -104,7 +105,7 @@ public void test1stDayInYear() throws PluginException { // @monthly String cron = "0 0 1 1 *"; LocalDateTime date = intervalPlugin.evalCron(cron); - logger.info("Result monthly=" + date); + logger.log(Level.INFO, "Result monthly={0}", date); LocalDateTime now = LocalDateTime.now(); Assert.assertEquals(date.getYear(), now.getYear() + 1); Assert.assertEquals(1, date.getMonthValue()); @@ -120,7 +121,7 @@ public void test1stDayOfWeek() throws PluginException { // @weekly String cron = "0 0 * * 1 "; LocalDateTime date = intervalPlugin.evalCron(cron); - logger.info("Result monthyl=" + date); + logger.log(Level.INFO, "Result monthyl={0}", date); // move to past one day... Assert.assertEquals(DayOfWeek.MONDAY, date.getDayOfWeek()); } @@ -137,8 +138,8 @@ public void testMonthly() throws PluginException { LocalDateTime ldt = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now(); LocalDateTime date = intervalPlugin.evalMacro("@monthly", ldt); - logger.info("Now =" + now); - logger.info("Result @monthly=" + date); + logger.log(Level.INFO, "Now ={0}", now); + logger.log(Level.INFO, "Result @monthly={0}", date); Assert.assertEquals(now.getDayOfMonth(), date.getDayOfMonth()); int exptectedMonth= now.getMonthValue() +1; if (exptectedMonth==13) { @@ -160,8 +161,8 @@ public void testYearly() throws PluginException { LocalDateTime ldt = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now(); LocalDateTime date = intervalPlugin.evalMacro("@yearly", ldt); - logger.info("Now =" + now); - logger.info("Result @yearly=" + date); + logger.log(Level.INFO, "Now ={0}", now); + logger.log(Level.INFO, "Result @yearly={0}", date); Assert.assertEquals(now.getDayOfMonth(), date.getDayOfMonth()); Assert.assertEquals(now.getMonthValue(), date.getMonthValue()); Assert.assertEquals(now.getYear() + 1, date.getYear()); @@ -179,8 +180,8 @@ public void testWeekly() throws PluginException { LocalDateTime ldt = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now(); LocalDateTime date = intervalPlugin.evalMacro("@weekly", ldt); - logger.info("Now =" + now); - logger.info("Result @weekly=" + date); + logger.log(Level.INFO, "Now ={0}", now); + logger.log(Level.INFO, "Result @weekly={0}", date); Assert.assertTrue(now.getDayOfMonth() != date.getDayOfMonth()); Assert.assertEquals(now.getDayOfWeek(), date.getDayOfWeek()); } diff --git a/imixs-workflow-faces/java/org/imixs/workflow/plugins/TestOwnerPluginProcessEntity.java b/imixs-workflow-faces/java/org/imixs/workflow/plugins/TestOwnerPluginProcessEntity.java index f03b17ba9..3446bbabe 100644 --- a/imixs-workflow-faces/java/org/imixs/workflow/plugins/TestOwnerPluginProcessEntity.java +++ b/imixs-workflow-faces/java/org/imixs/workflow/plugins/TestOwnerPluginProcessEntity.java @@ -68,7 +68,7 @@ public void setUp() throws PluginException, ModelException { // prepare data documentContext = new ItemCollection().model(WorkflowMockEnvironment.DEFAULT_MODEL_VERSION).task(100).event(10); - logger.info("[TestOwnerPlugin] setup test data..."); + logger.info("[TestOwnerPluginProcessEntity] setup test data..."); Vector list = new Vector(); list.add("manfred"); list.add("anna"); diff --git a/imixs-workflow-faces/java/org/imixs/workflow/plugins/TestResultPlugin.java b/imixs-workflow-faces/java/org/imixs/workflow/plugins/TestResultPlugin.java index c04f1335d..22d10b560 100644 --- a/imixs-workflow-faces/java/org/imixs/workflow/plugins/TestResultPlugin.java +++ b/imixs-workflow-faces/java/org/imixs/workflow/plugins/TestResultPlugin.java @@ -2,6 +2,7 @@ import java.util.Calendar; import java.util.Date; +import java.util.logging.Level; import java.util.logging.Logger; import javax.script.ScriptException; @@ -32,7 +33,7 @@ public class TestResultPlugin { protected ResultPlugin resultPlugin = null; public static final String DEFAULT_MODEL_VERSION = "1.0.0"; - private static Logger logger = Logger.getLogger(TestResultPlugin.class.getName()); + private static final Logger logger = Logger.getLogger(TestResultPlugin.class.getName()); protected WorkflowMockEnvironment workflowMockEnvironment; @@ -68,7 +69,7 @@ public void testBasic() throws PluginException { ItemCollection adocumentActivity = new ItemCollection(); String sResult = "Manfred"; - logger.info("txtActivityResult=" + sResult); + logger.log(Level.INFO, "txtActivityResult={0}", sResult); adocumentActivity.replaceItemValue("txtActivityResult", sResult); // run plugin adocumentContext = resultPlugin.run(adocumentContext, adocumentActivity); @@ -78,7 +79,7 @@ public void testBasic() throws PluginException { // test with ' instead of " sResult = "Manfred"; - logger.info("txtActivityResult=" + sResult); + logger.log(Level.INFO, "txtActivityResult={0}", sResult); adocumentActivity.replaceItemValue("txtActivityResult", sResult); // run plugin adocumentContext = resultPlugin.run(adocumentContext, adocumentActivity); @@ -96,7 +97,7 @@ public void testBasicWithTypeBoolean() throws PluginException { String sResult = "true"; - logger.info("txtActivityResult=" + sResult); + logger.log(Level.INFO, "txtActivityResult={0}", sResult); adocumentActivity.replaceItemValue("txtActivityResult", sResult); // run plugin @@ -115,7 +116,7 @@ public void testBasicWithTypeInteger() throws PluginException { String sResult = "47"; - logger.info("txtActivityResult=" + sResult); + logger.log(Level.INFO, "txtActivityResult={0}", sResult); adocumentActivity.replaceItemValue("txtActivityResult", sResult); // run plugin @@ -134,7 +135,7 @@ public void testBasicWithTypeDate() throws PluginException { String sResult = "2017-12-31"; - logger.info("txtActivityResult=" + sResult); + logger.log(Level.INFO, "txtActivityResult={0}", sResult); adocumentActivity.replaceItemValue("txtActivityResult", sResult); // run plugin @@ -162,7 +163,7 @@ public void testBasicWithTypeDateWithEmptyValue() throws PluginException { String sResult = ""; - logger.info("txtActivityResult=" + sResult); + logger.log(Level.INFO, "txtActivityResult={0}", sResult); adocumentActivity.replaceItemValue("txtActivityResult", sResult); // run plugin @@ -185,7 +186,7 @@ public void testBasicWithTypeDateWithExistingDateValue() throws PluginException String sResult = "$lastEventDate"; - logger.info("txtActivityResult=" + sResult); + logger.log(Level.INFO, "txtActivityResult={0}", sResult); adocumentActivity.replaceItemValue("txtActivityResult", sResult); // run plugin adocumentContext = resultPlugin.run(adocumentContext, adocumentActivity); @@ -220,7 +221,7 @@ public void testTypeProperty() throws PluginException { String sResult = "workitemdeleted"; - logger.info("txtActivityResult=" + sResult); + logger.log(Level.INFO, "txtActivityResult={0}", sResult); adocumentActivity.replaceItemValue("txtActivityResult", sResult); // run plugin @@ -249,7 +250,7 @@ public void testInvalidFormatException() { // wrong format String sResult = "Anna"; - logger.info("txtActivityResult=" + sResult); + logger.log(Level.INFO, "txtActivityResult={0}", sResult); adocumentActivity.replaceItemValue("txtActivityResult", sResult); int result; @@ -266,7 +267,7 @@ public void testInvalidFormatException() { // wrong format missing " sResult = "Anna"; - logger.info("txtActivityResult=" + sResult); + logger.log(Level.INFO, "txtActivityResult={0}", sResult); adocumentActivity.replaceItemValue("txtActivityResult", sResult); try { @@ -336,7 +337,7 @@ public void testWhiteSpace() throws PluginException { // test new line... String sResult = " \r\n some data \r\n workitemdeleted \r\n "; - logger.info("txtActivityResult=" + sResult); + logger.log(Level.INFO, "txtActivityResult={0}", sResult); adocumentActivity.replaceItemValue("txtActivityResult", sResult); // run plugin @@ -365,7 +366,7 @@ public void testEmptyTag() throws PluginException { // clear value... String sResult = ""; - logger.info("txtActivityResult=" + sResult); + logger.log(Level.INFO, "txtActivityResult={0}", sResult); adocumentActivity.replaceItemValue("txtActivityResult", sResult); // run plugin @@ -397,7 +398,7 @@ public void testImediateTag() throws PluginException { String sResult = "some data"; sResult = sResult + "true"; sResult = sResult + "some other data"; - logger.info("txtActivityResult=" + sResult); + logger.log(Level.INFO, "txtActivityResult={0}", sResult); adocumentActivity.replaceItemValue("txtActivityResult", sResult); // run plugin diff --git a/imixs-workflow-faces/java/org/imixs/workflow/plugins/TestSplitAndJoinPlugin.java b/imixs-workflow-faces/java/org/imixs/workflow/plugins/TestSplitAndJoinPlugin.java index 1ea9321b0..9983130ac 100644 --- a/imixs-workflow-faces/java/org/imixs/workflow/plugins/TestSplitAndJoinPlugin.java +++ b/imixs-workflow-faces/java/org/imixs/workflow/plugins/TestSplitAndJoinPlugin.java @@ -4,6 +4,7 @@ import java.util.List; import java.util.Vector; +import java.util.logging.Level; import java.util.logging.Logger; import java.util.regex.Pattern; @@ -60,7 +61,7 @@ public void setUp() throws PluginException, ModelException { // prepare test workitem documentContext = new ItemCollection(); - logger.info("[TestAccessPlugin] setup test data..."); + logger.info("[TestSplitAndJoinPlugin] setup test data..."); Vector list = new Vector(); list.add("manfred"); list.add("anna"); @@ -112,7 +113,7 @@ public void testCreateSubProcess() throws ModelException { Assert.assertEquals(100, subprocess.getTaskID()); - logger.info("Created Subprocess UniqueID=" + subprocess.getUniqueID()); + logger.log(Level.INFO, "Created Subprocess UniqueID={0}", subprocess.getUniqueID()); // test if the field namTeam is available List team = subprocess.getItemValue("namTeam"); @@ -156,7 +157,7 @@ public void testCreateSubProcessTargetFieldName() throws ModelException { Assert.assertEquals(100, subprocess.getTaskID()); - logger.info("Created Subprocess UniqueID=" + subprocess.getUniqueID()); + logger.log(Level.INFO, "Created Subprocess UniqueID={0}", subprocess.getUniqueID()); // test if the field namTeam is available List team = subprocess.getItemValue("_sub_Team"); @@ -197,14 +198,14 @@ public void testCreateMultiSubProcess() throws ModelException { ItemCollection subprocess = workflowMockEnvironment.getDocumentService().load(subprocessUniqueid); Assert.assertNotNull(subprocess); Assert.assertEquals(100, subprocess.getTaskID()); - logger.info("Created Subprocess UniqueID=" + subprocess.getUniqueID()); + logger.log(Level.INFO, "Created Subprocess UniqueID={0}", subprocess.getUniqueID()); // test second subprocess instance... 100.20 -> $processId=200 subprocessUniqueid = workitemRefList.get(1); subprocess = workflowMockEnvironment.getDocumentService().load(subprocessUniqueid); Assert.assertNotNull(subprocess); Assert.assertEquals(100, subprocess.getTaskID()); - logger.info("Created Subprocess UniqueID=" + subprocess.getUniqueID()); + logger.log(Level.INFO, "Created Subprocess UniqueID={0}", subprocess.getUniqueID()); } @@ -223,7 +224,7 @@ public void testCreateSubProcessParsingError() throws ModelException { Assert.fail(); } catch (PluginException e) { // Plugin exception is expected - logger.info("Exprected exception message: " + e.getMessage()); + logger.log(Level.INFO, "Exprected exception message: {0}", e.getMessage()); Assert.assertTrue(e.getMessage().startsWith("Parsing item content failed:")); } diff --git a/imixs-workflow-faces/src/main/java/org/imixs/workflow/faces/data/AbstractDataController.java b/imixs-workflow-faces/src/main/java/org/imixs/workflow/faces/data/AbstractDataController.java index 8a801e7d0..d725d05c9 100644 --- a/imixs-workflow-faces/src/main/java/org/imixs/workflow/faces/data/AbstractDataController.java +++ b/imixs-workflow-faces/src/main/java/org/imixs/workflow/faces/data/AbstractDataController.java @@ -45,6 +45,7 @@ import jakarta.faces.application.FacesMessage; import jakarta.faces.context.FacesContext; import jakarta.servlet.http.HttpServletRequest; +import java.util.logging.Level; /** * This is the abstract base class for the CDI beans DocumentController and @@ -79,7 +80,7 @@ public abstract class AbstractDataController implements Serializable { private static final long serialVersionUID = 1L; - private static Logger logger = Logger.getLogger(AbstractDataController.class.getName()); + private static final Logger logger = Logger.getLogger(AbstractDataController.class.getName()); private String defaultType; @@ -196,7 +197,7 @@ public void onLoad() { */ public void load(String uniqueid) { if (uniqueid != null && !uniqueid.isEmpty()) { - logger.finest("......load uniqueid=" + uniqueid); + logger.log(Level.FINEST, "......load uniqueid={0}", uniqueid); data = documentService.load(uniqueid); if (data == null) { data = new ItemCollection(); @@ -213,7 +214,7 @@ public void load(String uniqueid) { */ public void close() { if (!conversation.isTransient()) { - logger.finest("......stopping conversation, id=" + conversation.getId()); + logger.log(Level.FINEST, "......stopping conversation, id={0}", conversation.getId()); conversation.end(); } } @@ -227,7 +228,7 @@ protected void startConversation() { ((HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest()) .getSession().getMaxInactiveInterval() * 1000); conversation.begin(); - logger.finest("......start new conversation, id=" + conversation.getId()); + logger.log(Level.FINEST, "......start new conversation, id={0}", conversation.getId()); } } diff --git a/imixs-workflow-faces/src/main/java/org/imixs/workflow/faces/data/DocumentController.java b/imixs-workflow-faces/src/main/java/org/imixs/workflow/faces/data/DocumentController.java index 431bbadfa..dd7fc794a 100644 --- a/imixs-workflow-faces/src/main/java/org/imixs/workflow/faces/data/DocumentController.java +++ b/imixs-workflow-faces/src/main/java/org/imixs/workflow/faces/data/DocumentController.java @@ -42,6 +42,7 @@ import jakarta.faces.context.ExternalContext; import jakarta.faces.context.FacesContext; +import java.util.logging.Level; /** * The DocumentController is a @ConversationScoped CDI bean to control the life @@ -105,7 +106,7 @@ public class DocumentController extends AbstractDataController implements Serializable { private static final long serialVersionUID = 1L; - private static Logger logger = Logger.getLogger(DocumentController.class.getName()); + private static final Logger logger = Logger.getLogger(DocumentController.class.getName()); @Inject protected Event events; @@ -225,9 +226,9 @@ public void delete(String uniqueID) throws AccessDeniedException { events.fire(new WorkflowEvent(getDocument(), WorkflowEvent.DOCUMENT_AFTER_DELETE)); } setDocument(null); - logger.fine("......document " + uniqueID + " deleted"); + logger.log(Level.FINE, "......document {0} deleted", uniqueID); } else { - logger.fine("......document '" + uniqueID + "' not found (null)"); + logger.log(Level.FINE, "......document ''{0}'' not found (null)", uniqueID); } } diff --git a/imixs-workflow-faces/src/main/java/org/imixs/workflow/faces/data/ViewController.java b/imixs-workflow-faces/src/main/java/org/imixs/workflow/faces/data/ViewController.java index 8ae5966af..6c9bad1d4 100644 --- a/imixs-workflow-faces/src/main/java/org/imixs/workflow/faces/data/ViewController.java +++ b/imixs-workflow-faces/src/main/java/org/imixs/workflow/faces/data/ViewController.java @@ -36,6 +36,7 @@ import jakarta.faces.view.ViewScoped; import jakarta.inject.Inject; import jakarta.inject.Named; +import java.util.logging.Level; import org.imixs.workflow.ItemCollection; import org.imixs.workflow.engine.DocumentService; import org.imixs.workflow.exceptions.QueryException; @@ -70,7 +71,7 @@ public class ViewController implements Serializable { private boolean endOfList = false; private boolean loadStubs = true; - private static Logger logger = Logger.getLogger(ViewController.class.getName()); + private static final Logger logger = Logger.getLogger(ViewController.class.getName()); @Inject private DocumentService documentService; @@ -200,7 +201,7 @@ public List loadData() throws QueryException { } // load data - logger.finest("...... load data - query=" + _query + " pageIndex=" + getPageIndex()); + logger.log(Level.FINEST, "...... load data - query={0} pageIndex={1}", new Object[]{_query, getPageIndex()}); List result = null; if (this.isLoadStubs()) { diff --git a/imixs-workflow-faces/src/main/java/org/imixs/workflow/faces/data/ViewHandler.java b/imixs-workflow-faces/src/main/java/org/imixs/workflow/faces/data/ViewHandler.java index a6955089b..66a2fc778 100644 --- a/imixs-workflow-faces/src/main/java/org/imixs/workflow/faces/data/ViewHandler.java +++ b/imixs-workflow-faces/src/main/java/org/imixs/workflow/faces/data/ViewHandler.java @@ -37,6 +37,7 @@ import jakarta.annotation.PostConstruct; import jakarta.enterprise.context.RequestScoped; import jakarta.inject.Named; +import java.util.logging.Level; import org.imixs.workflow.ItemCollection; import org.imixs.workflow.exceptions.QueryException; @@ -55,7 +56,7 @@ public class ViewHandler implements Serializable { private Map> data = null; - private static Logger logger = Logger.getLogger(ViewHandler.class.getName()); + private static final Logger logger = Logger.getLogger(ViewHandler.class.getName()); public ViewHandler() { super(); @@ -124,7 +125,7 @@ public List getData(ViewController viewController) throws QueryE // load data result = viewController.loadData(); - logger.finest("......cache with hash=" + getHashKey(viewController)); + logger.log(Level.FINEST, "......cache with hash={0}", getHashKey(viewController)); // cache result data.put(getHashKey(viewController), result); diff --git a/imixs-workflow-faces/src/main/java/org/imixs/workflow/faces/data/WorkflowController.java b/imixs-workflow-faces/src/main/java/org/imixs/workflow/faces/data/WorkflowController.java index 5557cc4a6..8ba78a8fa 100644 --- a/imixs-workflow-faces/src/main/java/org/imixs/workflow/faces/data/WorkflowController.java +++ b/imixs-workflow-faces/src/main/java/org/imixs/workflow/faces/data/WorkflowController.java @@ -114,7 +114,7 @@ public class WorkflowController extends AbstractDataController implements Serializable { private static final long serialVersionUID = 1L; - private static Logger logger = Logger.getLogger(WorkflowController.class.getName()); + private static final Logger logger = Logger.getLogger(WorkflowController.class.getName()); @Inject ModelService modelService; @@ -309,7 +309,7 @@ public String process() throws PluginException, ModelException { try { long l1 = System.currentTimeMillis(); events.fire(new WorkflowEvent(getWorkitem(), WorkflowEvent.WORKITEM_BEFORE_PROCESS)); - logger.finest("......fire WORKITEM_BEFORE_PROCESS event: ' in " + (System.currentTimeMillis() - l1) + "ms"); + logger.log(Level.FINEST, "......fire WORKITEM_BEFORE_PROCESS event: '' in {0}ms", System.currentTimeMillis() - l1); // process workItem now... data = workflowService.processWorkItem(data); @@ -334,17 +334,17 @@ public String process() throws PluginException, ModelException { actionResult = actionResult + "&faces-redirect=true"; } } - logger.fine("... new actionResult=" + actionResult); + logger.log(Level.FINE, "... new actionResult={0}", actionResult); // fire event long l2 = System.currentTimeMillis(); events.fire(new WorkflowEvent(getWorkitem(), WorkflowEvent.WORKITEM_AFTER_PROCESS)); - logger.finest("......[process] fire WORKITEM_AFTER_PROCESS event: ' in " + (System.currentTimeMillis() - l2) - + "ms"); + logger.log(Level.FINEST, "......[process] fire WORKITEM_AFTER_PROCESS event: '' in {0}ms", System.currentTimeMillis() - l2); if (logger.isLoggable(Level.FINEST)) { - logger.finest("......[process] '" + getWorkitem().getItemValueString(WorkflowKernel.UNIQUEID) - + "' completed in " + (System.currentTimeMillis() - lTotal) + "ms"); + logger.log(Level.FINEST, "......[process] ''{0}'' completed in {1}ms", + new Object[]{getWorkitem().getItemValueString(WorkflowKernel.UNIQUEID), + System.currentTimeMillis() - lTotal}); } // Finally we close the conversation. In case of an exception, the conversation // will stay open @@ -385,7 +385,7 @@ public String process() throws PluginException, ModelException { ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext(); externalContext.redirect(externalURL); } catch (IOException e) { - logger.warning("Failed to redirect action result: " + externalURL + " - Error: " + e.getMessage()); + logger.log(Level.WARNING, "Failed to redirect action result: {0} - Error: {1}", new Object[]{externalURL, e.getMessage()}); e.printStackTrace(); } } @@ -409,7 +409,7 @@ public String process(int id) throws ModelException, PluginException { if (data == null) { logger.finest("......process workitem is null"); } else { - logger.finest("......process workitem id: " + data.getUniqueID()); + logger.log(Level.FINEST, "......process workitem id: {0}", data.getUniqueID()); } this.getWorkitem().setEventID(id); return process(); @@ -433,7 +433,7 @@ && getWorkitem().getItemValueString(WorkflowKernel.WORKFLOWGROUP).isEmpty())) { try { activityList = workflowService.getEvents(getWorkitem()); } catch (ModelException e) { - logger.warning("Unable to get workflow event list: " + e.getMessage()); + logger.log(Level.WARNING, "Unable to get workflow event list: {0}", e.getMessage()); } return activityList; diff --git a/imixs-workflow-faces/src/main/java/org/imixs/workflow/faces/fileupload/AjaxFileUploadServlet.java b/imixs-workflow-faces/src/main/java/org/imixs/workflow/faces/fileupload/AjaxFileUploadServlet.java index 8d283dd33..6a965749e 100644 --- a/imixs-workflow-faces/src/main/java/org/imixs/workflow/faces/fileupload/AjaxFileUploadServlet.java +++ b/imixs-workflow-faces/src/main/java/org/imixs/workflow/faces/fileupload/AjaxFileUploadServlet.java @@ -71,7 +71,7 @@ public class AjaxFileUploadServlet extends HttpServlet { private static final String CONTENT_DISPOSITION_FILENAME = "filename"; public static final String IMIXS_FILEDATA_LIST = "IMIXS_FILEDATA_LIST"; - private static Logger logger = Logger.getLogger(AjaxFileUploadServlet.class.getName()); + private static final Logger logger = Logger.getLogger(AjaxFileUploadServlet.class.getName()); @Inject FileUploadController fileUploadController; @@ -170,7 +170,7 @@ protected void doGet(HttpServletRequest httpRequest, HttpServletResponse httpRes */ private boolean isPostFileUploadRequest(HttpServletRequest httpRequest) { String sContentType = httpRequest.getContentType(); - logger.finest("......contentType=" + sContentType); + logger.log(Level.FINEST, "......contentType={0}", sContentType); return (REQUEST_METHOD_POST.equalsIgnoreCase(httpRequest.getMethod()) && httpRequest.getContentType() != null && sContentType.toLowerCase().startsWith(CONTENT_TYPE_MULTIPART)); @@ -279,7 +279,7 @@ private List getFilesFromRequest(HttpServletRequest httpRequest) { // extract the file content... FileData fileData = null; - logger.finest("......filename : " + fileName + ", contentType " + p.getContentType()); + logger.log(Level.FINEST, "......filename : {0}, contentType {1}", new Object[]{fileName, p.getContentType()}); fileData = new FileData(fileName, b, p.getContentType(), null); fileDataList.add(fileData); diff --git a/imixs-workflow-faces/src/main/java/org/imixs/workflow/faces/fileupload/FileUploadController.java b/imixs-workflow-faces/src/main/java/org/imixs/workflow/faces/fileupload/FileUploadController.java index 551605b1e..7eee33709 100644 --- a/imixs-workflow-faces/src/main/java/org/imixs/workflow/faces/fileupload/FileUploadController.java +++ b/imixs-workflow-faces/src/main/java/org/imixs/workflow/faces/fileupload/FileUploadController.java @@ -48,6 +48,7 @@ import jakarta.faces.context.FacesContext; import jakarta.servlet.http.HttpServletRequest; +import java.util.logging.Level; /** * The FileUploadController is a conversation scoped bean and used to hold the @@ -69,7 +70,7 @@ public class FileUploadController implements Serializable { private List _tmpFiles = null; // temporarly file list. private List _persistedFiles = null; // persisted file list. - private static Logger logger = Logger.getLogger(FileUploadController.class.getName()); + private static final Logger logger = Logger.getLogger(FileUploadController.class.getName()); @Inject private Conversation conversation; @@ -101,7 +102,7 @@ public void setWorkitem(ItemCollection workitem) { ((HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest()) .getSession().getMaxInactiveInterval() * 1000); conversation.begin(); - logger.finest("......starting new conversation, id=" + conversation.getId()); + logger.log(Level.FINEST, "......starting new conversation, id={0}", conversation.getId()); } reset(); for (FileData fileData : workitem.getFileData()) { @@ -256,7 +257,7 @@ public String getFileSize(String aFilename) { try { bytes = Double.parseDouble(sizeAttribute.get(0).toString()); } catch (NumberFormatException n) { - logger.warning("unable to parse size attribute in FileData for file '" + aFilename + "'"); + logger.log(Level.WARNING, "unable to parse size attribute in FileData for file ''{0}''", aFilename); } } } diff --git a/imixs-workflow-faces/src/main/java/org/imixs/workflow/faces/util/ErrorHandler.java b/imixs-workflow-faces/src/main/java/org/imixs/workflow/faces/util/ErrorHandler.java index 896947d57..3b71f1eca 100644 --- a/imixs-workflow-faces/src/main/java/org/imixs/workflow/faces/util/ErrorHandler.java +++ b/imixs-workflow-faces/src/main/java/org/imixs/workflow/faces/util/ErrorHandler.java @@ -44,7 +44,7 @@ public class ErrorHandler { - private static Logger logger = Logger.getLogger(ErrorHandler.class.getName()); + private static final Logger logger = Logger.getLogger(ErrorHandler.class.getName()); /** * The Method expects a PluginException and adds the corresponding Faces Error @@ -68,7 +68,7 @@ public static void handlePluginException(PluginException pe) { ResourceBundle rb = ResourceBundle.getBundle("bundle.app", browserLocale); errorCode = rb.getString(pe.getErrorCode()); } catch (MissingResourceException mre) { - logger.warning("ErrorHandler: " + mre.getMessage()); + logger.log(Level.WARNING, "ErrorHandler: {0}", mre.getMessage()); } // create a faces message for each parameter Object[] messages = pe.getErrorParameters(); @@ -82,8 +82,8 @@ public static void handlePluginException(PluginException pe) { addErrorMessage(pe); } - logger.warning( - "ErrorHandler cauth PluginException - error code=" + pe.getErrorCode() + " - " + pe.getMessage()); + logger.log(Level.WARNING, "ErrorHandler cauth PluginException - error code={0} - {1}", + new Object[]{pe.getErrorCode(), pe.getMessage()}); if (logger.isLoggable(Level.FINE)) { pe.printStackTrace(); // Or use a logger. @@ -107,13 +107,14 @@ public static void handleModelException(ModelException me) { ResourceBundle rb = ResourceBundle.getBundle("bundle.app", browserLocale); message = rb.getString(me.getErrorCode()); } catch (MissingResourceException mre) { - logger.warning("ErrorHandler: " + mre.getMessage()); + logger.log(Level.WARNING, "ErrorHandler: {0}", mre.getMessage()); } FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, message, me.getMessage())); - logger.warning("ErrorHandler cauth ModelException - error code=" + me.getErrorCode() + " - " + me.getMessage()); + logger.log(Level.WARNING, "ErrorHandler cauth ModelException - error code={0} - {1}", + new Object[]{me.getErrorCode(), me.getMessage()}); if (logger.isLoggable(Level.FINE)) { me.printStackTrace(); // Or use a logger. } @@ -150,7 +151,7 @@ public static void addErrorMessage(WorkflowException pe) { message = messageFromBundle; } } catch (MissingResourceException mre) { - logger.warning("ErrorHandler: " + mre.getMessage()); + logger.log(Level.WARNING, "ErrorHandler: {0}", mre.getMessage()); } // parse message for params @@ -205,7 +206,7 @@ private static String getMessageFromBundle(String messageFromBundle) { } } catch (MissingResourceException mre) { - logger.warning("ErrorHandler: " + mre.getMessage()); + logger.log(Level.WARNING, "ErrorHandler: {0}", mre.getMessage()); } } diff --git a/imixs-workflow-index-lucene/src/main/java/org/imixs/workflow/engine/lucene/LuceneIndexService.java b/imixs-workflow-index-lucene/src/main/java/org/imixs/workflow/engine/lucene/LuceneIndexService.java index 9778e8701..48ff8b9f2 100644 --- a/imixs-workflow-index-lucene/src/main/java/org/imixs/workflow/engine/lucene/LuceneIndexService.java +++ b/imixs-workflow-index-lucene/src/main/java/org/imixs/workflow/engine/lucene/LuceneIndexService.java @@ -109,7 +109,7 @@ public class LuceneIndexService { @Inject private LuceneItemAdapter luceneItemAdapter; - private static Logger logger = Logger.getLogger(LuceneIndexService.class.getName()); + private static final Logger logger = Logger.getLogger(LuceneIndexService.class.getName()); @Inject private AdminPService adminPService; @@ -175,8 +175,8 @@ public boolean flushEventLog(int junkSize) { total = total + EVENTLOG_ENTRY_FLUSH_COUNT; count = count + EVENTLOG_ENTRY_FLUSH_COUNT; if (count >= 100) { - logger.finest("...flush event log: " + total + " entries in " + (System.currentTimeMillis() - l) - + "ms..."); + logger.log(Level.FINEST, "...flush event log: {0} entries in {1}ms...", + new Object[]{total, System.currentTimeMillis() - l}); count = 0; } @@ -185,14 +185,14 @@ public boolean flushEventLog(int junkSize) { // experimental code: we break the flush method after 1024 flushs // maybe we can remove this hard break if (total >= junkSize) { - logger.finest("...flush event: Issue #439 -> total count >=" + total - + " flushEventLog will be continued..."); + logger.log(Level.FINEST, "...flush event: Issue #439 ->" + + " total count >={0} flushEventLog will be continued...", total); return false; } } } catch (IndexException e) { - logger.warning("...unable to flush lucene event log: " + e.getMessage()); + logger.log(Level.WARNING, "...unable to flush lucene event log: {0}", e.getMessage()); return true; } } @@ -249,8 +249,8 @@ public void indexDocuments(Collection documents) { if (!workitem.getItemValueBoolean(DocumentService.NOINDEX)) { // create term Term term = new Term("$uniqueid", workitem.getItemValueString("$uniqueid")); - logger.finest("......lucene add/update uncommitted workitem '" - + workitem.getItemValueString(WorkflowKernel.UNIQUEID) + "' to index..."); + logger.log(Level.FINEST, "......lucene add/update uncommitted workitem ''{0}'' to index...", + workitem.getItemValueString(WorkflowKernel.UNIQUEID)); // awriter.updateDocument(term, createDocument(workitem)); Document lucenedoc = createDocument(workitem); @@ -258,7 +258,7 @@ public void indexDocuments(Collection documents) { } } } catch (IOException luceneEx) { - logger.warning("lucene error: " + luceneEx.getMessage()); + logger.log(Level.WARNING, "lucene error: {0}", luceneEx.getMessage()); throw new IndexException(IndexException.INVALID_INDEX, "Unable to update lucene search index", luceneEx); } finally { // close writer! @@ -289,11 +289,11 @@ public void indexDocuments(Collection documents) { long updateTime = (System.currentTimeMillis() - ltime); if (updateTime > 5000) { - logger.warning("... update index block in took " + (updateTime) + " ms ! (" + documents.size() - + " documents in total)"); + logger.log(Level.WARNING, "... update index block in took {0} ms ! ({1} documents in total)", + new Object[]{updateTime, documents.size()}); } else if (logger.isLoggable(Level.FINE)) { - logger.fine( - "... update index block in " + (updateTime) + " ms (" + documents.size() + " documents in total)"); + logger.log(Level.FINE, "... update index block in {0} ms ({1} documents in total)", + new Object[]{updateTime, documents.size()}); } } @@ -338,14 +338,14 @@ protected boolean flushEventLogByCount(int count) { // indexWriter.updateDocument(term,lucenedoc ); updateLuceneIndex(term, lucenedoc, indexWriter, taxonomyWriter); - logger.finest("......lucene add/update workitem '" + doc.getId() + "' to index in " - + (System.currentTimeMillis() - l2) + "ms"); + logger.log(Level.FINEST, "......lucene add/update workitem ''{0}'' to index in {1}ms", + new Object[]{doc.getId(), System.currentTimeMillis() - l2}); } } else { long l2 = System.currentTimeMillis(); indexWriter.deleteDocuments(term); - logger.finest("......lucene remove workitem '" + term + "' from index in " - + (System.currentTimeMillis() - l2) + "ms"); + logger.log(Level.FINEST, "......lucene remove workitem ''{0}'' from index in {1}ms", + new Object[]{term, System.currentTimeMillis() - l2}); } // remove the eventLogEntry. @@ -361,7 +361,7 @@ protected boolean flushEventLogByCount(int count) { } } } catch (IOException luceneEx) { - logger.warning("...unable to flush lucene event log: " + luceneEx.getMessage()); + logger.log(Level.WARNING, "...unable to flush lucene event log: {0}", luceneEx.getMessage()); // We just log a warning here and close the flush mode to no longer block the // writer. // NOTE: maybe throwing a IndexException would be an alternative: @@ -401,8 +401,8 @@ protected boolean flushEventLogByCount(int count) { } - logger.fine("...flushEventLog - " + events.size() + " events in " + (System.currentTimeMillis() - l) - + " ms - last log entry: " + lastEventDate); + logger.log(Level.FINE, "...flushEventLog - {0} events in {1} ms - last log entry: {2}", + new Object[]{events.size(), System.currentTimeMillis() - l, lastEventDate}); return cacheIsEmpty; @@ -504,7 +504,7 @@ protected Document createDocument(ItemCollection document) { logger.warning("Missing CDI support for Event !"); } - logger.finest("......add lucene field content=" + textContent); + logger.log(Level.FINEST, "......add lucene field content={0}", textContent); doc.add(new TextField("content", textContent, Store.NO)); // add each field from the indexFieldList into the lucene document @@ -568,7 +568,7 @@ protected Document createDocument(ItemCollection document) { doc.add(new FacetField(aFieldname + TAXONOMY_INDEXFIELD_PRAFIX, stringValue)); } } catch (IllegalArgumentException iae) { - logger.warning("Failed to build facete: " + iae.getMessage()); + logger.log(Level.WARNING, "Failed to build facete: {0}", iae.getMessage()); } } } @@ -680,13 +680,13 @@ protected DirectoryTaxonomyWriter createTaxonomyWriter() throws IOException { * @throws IOException */ public Directory createIndexDirectory() throws IOException { - logger.finest("......create lucene Index Directory - path=" + getLuceneIndexDir()); + logger.log(Level.FINEST, "......create lucene Index Directory - path={0}", getLuceneIndexDir()); // create Lucene Directory Instance Path luceneIndexDir = Paths.get(getLuceneIndexDir()); Directory indexDir = FSDirectory.open(luceneIndexDir); if (!DirectoryReader.indexExists(indexDir)) { - logger.info("...lucene index directory '" + getLuceneIndexDir() - + "' is empty or does not yet exist, rebuild index now...."); + logger.log(Level.INFO, "...lucene index directory ''{0}'' is empty or does not yet exist," + + " rebuild index now....", getLuceneIndexDir()); rebuildIndex(indexDir); } return indexDir; @@ -708,7 +708,7 @@ public Directory createTaxonomyDirectory() throws IOException { sPath = sPath.substring(0, sPath.lastIndexOf("/")); } sPath = sPath + "_tax"; - logger.finest("......create lucene taxonomy Directory - path=" + sPath); + logger.log(Level.FINEST, "......create lucene taxonomy Directory - path={0}", sPath); // create Lucene Directory Instance Path luceneIndexDir = Paths.get(sPath); Directory indexDir = FSDirectory.open(luceneIndexDir); diff --git a/imixs-workflow-index-lucene/src/main/java/org/imixs/workflow/engine/lucene/LuceneItemAdapter.java b/imixs-workflow-index-lucene/src/main/java/org/imixs/workflow/engine/lucene/LuceneItemAdapter.java index 6397bb042..da98bae12 100644 --- a/imixs-workflow-index-lucene/src/main/java/org/imixs/workflow/engine/lucene/LuceneItemAdapter.java +++ b/imixs-workflow-index-lucene/src/main/java/org/imixs/workflow/engine/lucene/LuceneItemAdapter.java @@ -33,6 +33,7 @@ import java.util.Date; import java.util.logging.Logger; import jakarta.inject.Named; +import java.util.logging.Level; import org.apache.lucene.document.Field.Store; import org.apache.lucene.document.SortedDocValuesField; import org.apache.lucene.document.StringField; @@ -56,7 +57,7 @@ @Named public class LuceneItemAdapter { - private static Logger logger = Logger.getLogger(UpdateService.class.getName()); + private static final Logger logger = Logger.getLogger(UpdateService.class.getName()); /** * Creates a Indexable Lucene Field to be added into a Lucene document. The @@ -97,7 +98,8 @@ public IndexableField adaptItemValue(String itemName, Object itemValue, boolean */ public IndexableField adaptItemValue(String itemName, Object itemValue, boolean doAnalyze, Store stored) { String stringValue = convertItemValue(itemValue); - logger.finest("......lucene add IndexField (analyzed=" + doAnalyze + "): " + itemName + "=" + stringValue); + logger.log(Level.FINEST, "......lucene add IndexField (analyzed={0}): {1}={2}", + new Object[]{doAnalyze, itemName, stringValue}); if (doAnalyze) { // just create a text field to be indexed return new TextField(itemName, stringValue, stored); @@ -118,7 +120,8 @@ public IndexableField adaptItemValue(String itemName, Object itemValue, boolean */ public SortedDocValuesField adaptSortableItemValue(String itemName, Object itemValue) { String stringValue = convertItemValue(itemValue); - logger.finest("......lucene add sortable IndexValue: " + itemName + "=" + stringValue); + logger.log(Level.FINEST, "......lucene add sortable IndexValue: {0}={1}", + new Object[]{itemName, stringValue}); return new SortedDocValuesField(itemName, new BytesRef(stringValue)); } diff --git a/imixs-workflow-index-lucene/src/main/java/org/imixs/workflow/engine/lucene/LuceneSearchService.java b/imixs-workflow-index-lucene/src/main/java/org/imixs/workflow/engine/lucene/LuceneSearchService.java index 4a0541ea9..2d7f20e76 100644 --- a/imixs-workflow-index-lucene/src/main/java/org/imixs/workflow/engine/lucene/LuceneSearchService.java +++ b/imixs-workflow-index-lucene/src/main/java/org/imixs/workflow/engine/lucene/LuceneSearchService.java @@ -117,7 +117,7 @@ public class LuceneSearchService implements SearchService { @Inject private SchemaService schemaService; - private static Logger logger = Logger.getLogger(LuceneSearchService.class.getName()); + private static final Logger logger = Logger.getLogger(LuceneSearchService.class.getName()); /** * Returns a collection of documents matching the provided search term. The term @@ -171,7 +171,7 @@ public List search(String searchTerm, int pageSize, int pageInde } if (debug) { - logger.finest("......lucene search: pageNumber=" + pageIndex + " pageSize=" + pageSize); + logger.log(Level.FINEST, "......lucene search: pageNumber={0} pageSize={1}", new Object[]{pageIndex, pageSize}); } ArrayList workitems = new ArrayList(); @@ -208,15 +208,16 @@ public List search(String searchTerm, int pageSize, int pageInde if ((startIndex + pageSize) > DEFAULT_MAX_SEARCH_RESULT) { // adjust maxSearchResult maxSearchResult = startIndex + (3 * pageSize); - logger.warning("PageIndex (" + pageSize + "x" + pageIndex + ") exeeded DEFAULT_MAX_SEARCH_RESULT(" - + DEFAULT_MAX_SEARCH_RESULT + ") -> new MAX_SEARCH_RESULT is set to " + maxSearchResult); + logger.log(Level.WARNING, "PageIndex ({0}x{1}) exeeded DEFAULT_MAX_SEARCH_RESULT({2}) ->" + + " new MAX_SEARCH_RESULT is set to {3}", + new Object[]{pageSize, pageIndex, DEFAULT_MAX_SEARCH_RESULT, maxSearchResult}); } Query query = parser.parse(searchTerm); if (sortOrder != null) { // sorted by sortoder if (debug) { - logger.finest("......lucene result sorted by sortOrder= '" + sortOrder + "' "); + logger.log(Level.FINEST, "......lucene result sorted by sortOrder= ''{0}'' ", sortOrder); } // MAX_SEARCH_RESULT is limiting the total number of hits collector = TopFieldCollector.create(buildLuceneSort(sortOrder), maxSearchResult, false, false, false, @@ -245,8 +246,8 @@ public List search(String searchTerm, int pageSize, int pageInde ScoreDoc[] scoreDosArray = topDocs.scoreDocs; if (debug) { - logger.finest("...returned " + scoreDosArray.length + " documents in " - + (System.currentTimeMillis() - lsearchtime) + " ms - total hits=" + topDocs.totalHits); + logger.log(Level.FINEST, "...returned {0} documents in {1} ms - total hits={2}", + new Object[]{scoreDosArray.length, System.currentTimeMillis() - lsearchtime, topDocs.totalHits}); } SimpleDateFormat luceneDateformat = new SimpleDateFormat("yyyyMMddHHmmss"); for (ScoreDoc scoredoc : scoreDosArray) { @@ -261,14 +262,14 @@ public List search(String searchTerm, int pageSize, int pageInde imixsDoc.replaceItemValue(WorkflowKernel.UNIQUEID, sID); } else { // load the full imixs document from the database - logger.finest("......lucene lookup $uniqueid=" + sID); + logger.log(Level.FINEST, "......lucene lookup $uniqueid={0}", sID); imixsDoc = documentService.load(sID); } if (imixsDoc != null) { workitems.add(imixsDoc); } else { - logger.warning("lucene index returned unreadable workitem : " + sID); + logger.log(Level.WARNING, "lucene index returned unreadable workitem : {0}", sID); documentService.removeDocumentFromIndex(sID); // this situation happens if the search index returned // documents the current user has no read access. @@ -281,16 +282,16 @@ public List search(String searchTerm, int pageSize, int pageInde searcher.getIndexReader().close(); if (debug) { - logger.fine("...search result computed in " + (System.currentTimeMillis() - ltime) + " ms - loadStubs=" - + loadStubs); + logger.log(Level.FINE, "...search result computed in {0} ms - loadStubs={1}", + new Object[]{System.currentTimeMillis() - ltime, loadStubs}); } } catch (IOException e) { // in case of an IOException we just print an error message and // return an empty result - logger.severe("Lucene index error: " + e.getMessage()); + logger.log(Level.SEVERE, "Lucene index error: {0}", e.getMessage()); throw new InvalidAccessException(InvalidAccessException.INVALID_INDEX, e.getMessage(), e); } catch (ParseException e) { - logger.severe("Lucene search error: " + e.getMessage()); + logger.log(Level.SEVERE, "Lucene search error: {0}", e.getMessage()); throw new QueryException(QueryException.QUERY_NOT_UNDERSTANDABLE, e.getMessage(), e); } @@ -344,7 +345,7 @@ public List getTaxonomyByQuery(String searchTerm, String... categories } catch (IOException | QueryException | ParseException e) { // in case of an IOException we just print an error message and // return an empty result - logger.severe("Lucene index error: " + e.getMessage()); + logger.log(Level.SEVERE, "Lucene index error: {0}", e.getMessage()); throw new InvalidAccessException(InvalidAccessException.INVALID_INDEX, e.getMessage(), e); } return results; @@ -410,14 +411,14 @@ public int getTotalHits(final String _searchTerm, final int _maxResult, final De searcher.search(query, collector); result = collector.getTotalHits(); - logger.finest("......lucene count result = " + result); + logger.log(Level.FINEST, "......lucene count result = {0}", result); } catch (IOException e) { // in case of an IOException we just print an error message and // return an empty result - logger.severe("Lucene index error: " + e.getMessage()); + logger.log(Level.SEVERE, "Lucene index error: {0}", e.getMessage()); throw new InvalidAccessException(InvalidAccessException.INVALID_INDEX, e.getMessage(), e); } catch (ParseException e) { - logger.severe("Lucene search error: " + e.getMessage()); + logger.log(Level.SEVERE, "Lucene search error: {0}", e.getMessage()); throw new QueryException(QueryException.QUERY_NOT_UNDERSTANDABLE, e.getMessage(), e); } @@ -443,7 +444,7 @@ IndexSearcher createIndexSearcher() throws IOException { // if the index dose not yet exits we got a IO Exception (issue #329) reader = DirectoryReader.open(indexDir); } catch (IOException ioe) { - logger.warning("lucene index can not be opened: " + ioe.getMessage()); + logger.log(Level.WARNING, "lucene index can not be opened: {0}", ioe.getMessage()); // throw the origin exception.... throw ioe; } @@ -538,7 +539,7 @@ ItemCollection convertLuceneDocument(Document luceneDoc, SimpleDateFormat lucene if (objectValue == null) { objectValue = stringValue; } - logger.finest(".........append " + indexableField.name() + " = " + objectValue); + logger.log(Level.FINEST, ".........append {0} = {1}", new Object[]{indexableField.name(), objectValue}); imixsDoc.appendItemValue(indexableField.name(), objectValue); } diff --git a/imixs-workflow-index-lucene/src/main/java/org/imixs/workflow/engine/lucene/LuceneUpdateService.java b/imixs-workflow-index-lucene/src/main/java/org/imixs/workflow/engine/lucene/LuceneUpdateService.java index 70001b50d..228fa2fcc 100644 --- a/imixs-workflow-index-lucene/src/main/java/org/imixs/workflow/engine/lucene/LuceneUpdateService.java +++ b/imixs-workflow-index-lucene/src/main/java/org/imixs/workflow/engine/lucene/LuceneUpdateService.java @@ -38,6 +38,7 @@ import org.imixs.workflow.exceptions.IndexException; import jakarta.ejb.Singleton; +import java.util.logging.Level; /** * The LuceneUpdateService provides methods to write Imixs Workitems into a @@ -71,7 +72,7 @@ public class LuceneUpdateService implements UpdateService { @Inject private LuceneIndexService luceneIndexService; - private static Logger logger = Logger.getLogger(LuceneUpdateService.class.getName()); + private static final Logger logger = Logger.getLogger(LuceneUpdateService.class.getName()); /** * This method adds a collection of documents to the Lucene index. The documents @@ -102,8 +103,8 @@ public void updateIndex() { while (luceneIndexService.flushEventLog(2048) == false) { // repeat flush.... flushCount = +2048; - logger.info("...flush event log: " + flushCount + " entries updated in " - + (System.currentTimeMillis() - ltime) + "ms ..."); + logger.log(Level.INFO, "...flush event log: {0} entries updated in {1}ms ...", + new Object[]{flushCount, System.currentTimeMillis() - ltime}); } } diff --git a/imixs-workflow-index-solr/src/main/java/org/imixs/workflow/engine/solr/SolrAutoFlushScheduler.java b/imixs-workflow-index-solr/src/main/java/org/imixs/workflow/engine/solr/SolrAutoFlushScheduler.java index 4133a3254..e1ebf448a 100644 --- a/imixs-workflow-index-solr/src/main/java/org/imixs/workflow/engine/solr/SolrAutoFlushScheduler.java +++ b/imixs-workflow-index-solr/src/main/java/org/imixs/workflow/engine/solr/SolrAutoFlushScheduler.java @@ -42,6 +42,7 @@ import jakarta.ejb.Singleton; import jakarta.ejb.Startup; import jakarta.enterprise.concurrent.ManagedScheduledExecutorService; +import java.util.logging.Level; /** * The SolrAutoFlushScheduler starts a ManagedScheduledExecutorService to flush @@ -89,7 +90,7 @@ public class SolrAutoFlushScheduler { @ConfigProperty(name = SOLR_AUTOFLUSH_INITIALDELAY, defaultValue = "0") long initialDelay; - private static Logger logger = Logger.getLogger(SolrAutoFlushScheduler.class.getName()); + private static final Logger logger = Logger.getLogger(SolrAutoFlushScheduler.class.getName()); @Resource ManagedScheduledExecutorService scheduler; @@ -104,7 +105,8 @@ public class SolrAutoFlushScheduler { @PostConstruct public void init() { if (!flushDisabled) { - logger.info("Starting Solr auto flush - initalDelay=" + initialDelay + " inverval=" + interval + " ...."); + logger.log(Level.INFO, "Starting Solr auto flush - initalDelay={0} inverval={1} ....", + new Object[]{initialDelay, interval}); this.scheduler.scheduleAtFixedRate(this::run, initialDelay, interval, TimeUnit.MILLISECONDS); } } diff --git a/imixs-workflow-index-solr/src/main/java/org/imixs/workflow/engine/solr/SolrIndexService.java b/imixs-workflow-index-solr/src/main/java/org/imixs/workflow/engine/solr/SolrIndexService.java index c36848d80..f0156a314 100644 --- a/imixs-workflow-index-solr/src/main/java/org/imixs/workflow/engine/solr/SolrIndexService.java +++ b/imixs-workflow-index-solr/src/main/java/org/imixs/workflow/engine/solr/SolrIndexService.java @@ -151,7 +151,7 @@ public class SolrIndexService { private RestClient restClient; - private static Logger logger = Logger.getLogger(SolrIndexService.class.getName()); + private static final Logger logger = Logger.getLogger(SolrIndexService.class.getName()); /** * Create a rest client instance @@ -177,7 +177,7 @@ public void init() { */ public void setup(@Observes SetupEvent setupEvent) throws RestAPIException { - logger.info("...verify solr core '" + core + "'..."); + logger.log(Level.INFO, "...verify solr core ''{0}''...", core); // try to get the schma of the core... try { @@ -188,7 +188,8 @@ public void setup(@Observes SetupEvent setupEvent) throws RestAPIException { updateSchema(existingSchema); } catch (RestAPIException e) { // no schema found - logger.severe("...no solr core '" + core + "' found - " + e.getMessage() + ": verify the solr instance!"); + logger.log(Level.SEVERE, "...no solr core ''{0}'' found - {1}: verify the solr instance!", + new Object[]{core, e.getMessage()}); throw e; } @@ -216,9 +217,9 @@ public void updateSchema(String schema) throws RestAPIException { // test if the schemaUdpate contains instructions.... if (!"{}".equals(schemaUpdate)) { String uri = api + "/api/cores/" + core + "/schema"; - logger.info("...updating schema '" + core + "':"); + logger.log(Level.INFO, "...updating schema ''{0}'':", core); if (debug) { - logger.finest("..." + schemaUpdate); + logger.log(Level.FINEST, "...{0}", schemaUpdate); } restClient.post(uri, schemaUpdate, "application/json"); logger.info("...schema update - successfull "); @@ -259,8 +260,8 @@ public void indexDocuments(List documents) throws RestAPIExcepti } if (debug) { - logger.fine("... update index block in " + (System.currentTimeMillis() - ltime) + " ms (" + documents.size() - + " workitems total)"); + logger.log(Level.FINE, "... update index block in {0} ms ({1} workitems total)", + new Object[]{System.currentTimeMillis() - ltime, documents.size()}); } } @@ -303,14 +304,14 @@ public void removeDocuments(List documentIDs) throws RestAPIException { String xmlRequest = xmlDelete.toString(); String uri = api + "/solr/" + core + "/update?commit=true"; if (debug) { - logger.finest("......delete documents '" + core + "':"); + logger.log(Level.FINEST, "......delete documents ''{0}'':", core); } restClient.post(uri, xmlRequest, "text/xml"); } if (debug) { - logger.fine("... update index block in " + (System.currentTimeMillis() - ltime) + " ms (" - + documentIDs.size() + " workitems total)"); + logger.log(Level.FINE, "... update index block in {0} ms ({1} workitems total)", + new Object[]{System.currentTimeMillis() - ltime, documentIDs.size()}); } } @@ -360,7 +361,7 @@ public String query(String searchTerm, int pageSize, int pageIndex, SortOrder so DefaultOperator defaultOperator, boolean loadStubs) throws QueryException { boolean debug = logger.isLoggable(Level.FINE); if (debug) { - logger.fine("...search solr index: " + searchTerm + "..."); + logger.log(Level.FINE, "...search solr index: {0}...", searchTerm); } StringBuffer uri = new StringBuffer(); @@ -414,13 +415,13 @@ public String query(String searchTerm, int pageSize, int pageIndex, SortOrder so // append query uri.append("&q=" + URLEncoder.encode(searchTerm, "UTF-8")); if (debug) { - logger.finest("...... uri=" + uri.toString()); + logger.log(Level.FINEST, "...... uri={0}", uri.toString()); } String result = restClient.get(uri.toString()); return result; } catch (RestAPIException | UnsupportedEncodingException e) { - logger.severe("Solr search error: " + e.getMessage()); + logger.log(Level.SEVERE, "Solr search error: {0}", e.getMessage()); throw new QueryException(QueryException.QUERY_NOT_UNDERSTANDABLE, e.getMessage(), e); } @@ -517,7 +518,7 @@ protected String buildUpdateSchema(String oldSchema) { oldSchema = oldSchema.replace(" ", ""); if (debug) { - logger.finest("......old schema=" + oldSchema); + logger.log(Level.FINEST, "......old schema={0}", oldSchema); } updateSchema.append("{"); @@ -624,7 +625,7 @@ protected String buildAddDoc(List documents) { if (debug) { - logger.finest("......add index field " + DEFAULT_SEARCH_FIELD + "=" + textContent); + logger.log(Level.FINEST,"......add index field " + DEFAULT_SEARCH_FIELD + "={0}", textContent); } // remove existing CDATA... textContent = stripCDATA(textContent); @@ -749,16 +750,16 @@ public boolean flushEventLogByCount(int count) { if (!workitem.getItemValueBoolean(DocumentService.NOINDEX)) { indexDocument(workitem); if (debug) { - logger.finest("......solr added workitem '" + eventLogEntry.getRef() + "' to index in " - + (System.currentTimeMillis() - l2) + "ms"); + logger.log(Level.FINEST, "......solr added workitem ''{0}'' to index in {1}ms", + new Object[]{eventLogEntry.getRef(), System.currentTimeMillis() - l2}); } } } else { long l2 = System.currentTimeMillis(); removeDocument(eventLogEntry.getRef()); if (debug) { - logger.finest("......solr removed workitem '" + eventLogEntry.getRef() + "' from index in " - + (System.currentTimeMillis() - l2) + "ms"); + logger.log(Level.FINEST, "......solr removed workitem ''{0}'' from index in {1}ms", + new Object[]{eventLogEntry.getRef(), System.currentTimeMillis() - l2}); } } @@ -776,7 +777,7 @@ public boolean flushEventLogByCount(int count) { } } catch (RestAPIException e) { - logger.warning("...unable to flush lucene event log: " + e.getMessage()); + logger.log(Level.WARNING, "...unable to flush lucene event log: {0}", e.getMessage()); // We just log a warning here and close the flush mode to no longer block the // writer. // NOTE: maybe throwing a IndexException would be an alternative: @@ -789,8 +790,8 @@ public boolean flushEventLogByCount(int count) { } if (debug) { - logger.fine("...flushEventLog - " + events.size() + " events in " + (System.currentTimeMillis() - l) - + " ms - last log entry: " + lastEventDate); + logger.log(Level.FINE, "...flushEventLog - {0} events in {1} ms - last log entry: {2}", + new Object[]{events.size(), System.currentTimeMillis() - l, lastEventDate}); } return cacheIsEmpty; @@ -828,8 +829,8 @@ public boolean flushEventLog(int junkSize) { total = total + EVENTLOG_ENTRY_FLUSH_COUNT; count = count + EVENTLOG_ENTRY_FLUSH_COUNT; if (count >= 100 && debug) { - logger.finest("...flush event log: " + total + " entries in " + (System.currentTimeMillis() - l) - + "ms..."); + logger.log(Level.FINEST, "...flush event log: {0} entries in {1}ms...", + new Object[]{total, System.currentTimeMillis() - l}); count = 0; } @@ -839,15 +840,15 @@ public boolean flushEventLog(int junkSize) { // maybe we can remove this hard break if (total >= junkSize) { if (debug) { - logger.finest("...flush event: Issue #439 -> total count >=" + total - + " flushEventLog will be continued..."); + logger.log(Level.FINEST, "...flush event: Issue #439 ->" + + " total count >={0} flushEventLog will be continued...", total); } return false; } } } catch (IndexException e) { - logger.warning("...unable to flush lucene event log: " + e.getMessage()); + logger.log(Level.WARNING, "...unable to flush lucene event log: {0}", e.getMessage()); return true; } } diff --git a/imixs-workflow-index-solr/src/main/java/org/imixs/workflow/engine/solr/SolrSearchService.java b/imixs-workflow-index-solr/src/main/java/org/imixs/workflow/engine/solr/SolrSearchService.java index 41bf02be6..1bf2f94b4 100644 --- a/imixs-workflow-index-solr/src/main/java/org/imixs/workflow/engine/solr/SolrSearchService.java +++ b/imixs-workflow-index-solr/src/main/java/org/imixs/workflow/engine/solr/SolrSearchService.java @@ -91,7 +91,7 @@ public class SolrSearchService implements SearchService { @Inject private DocumentService documentService; - private static Logger logger = Logger.getLogger(SolrSearchService.class.getName()); + private static final Logger logger = Logger.getLogger(SolrSearchService.class.getName()); private SimpleDateFormat luceneDateFormat = new SimpleDateFormat("yyyyMMddHHmmss"); @@ -134,7 +134,7 @@ public List search(String _searchTerm, int pageSize, int pageInd pageIndex = 0; } if (debug) { - logger.finest("......solr search: pageNumber=" + pageIndex + " pageSize=" + pageSize); + logger.log(Level.FINEST, "......solr search: pageNumber={0} pageSize={1}", new Object[]{pageIndex, pageSize}); } ArrayList workitems = new ArrayList(); @@ -147,7 +147,7 @@ public List search(String _searchTerm, int pageSize, int pageInd // post query.... String result = solarIndexService.query(searchTerm, pageSize, pageIndex, sortOrder, defaultOperator, loadStubs); if (debug) { - logger.finest("......Result = " + result); + logger.log(Level.FINEST, "......Result = {0}", result); } if (result != null && !result.isEmpty()) { List documentStubs = parseQueryResult(result); @@ -165,8 +165,8 @@ public List search(String _searchTerm, int pageSize, int pageInd } if (debug) { - logger.fine("...search result computed in " + (System.currentTimeMillis() - ltime) + " ms - loadStubs=" - + loadStubs); + logger.log(Level.FINE, "...search result computed in {0} ms - loadStubs={1}", + new Object[]{System.currentTimeMillis() - ltime, loadStubs}); } return workitems; } @@ -204,11 +204,11 @@ public int getTotalHits(final String _searchTerm, final int _maxResult, final De String response = JSONParser.getKey("response", result); hits = Integer.parseInt(JSONParser.getKey("numFound", response)); } catch (NumberFormatException e) { - logger.severe("getTotalHits - failed to parse solr result object! - " + e.getMessage()); + logger.log(Level.SEVERE, "getTotalHits - failed to parse solr result object! - {0}", e.getMessage()); hits = 0; } - logger.info("......computed totalHits in " + (System.currentTimeMillis() - l) + "ms"); + logger.log(Level.INFO, "......computed totalHits in {0}ms", System.currentTimeMillis() - l); return hits; } @@ -276,7 +276,7 @@ protected List parseQueryResult(String json) { } } if (debug) { - logger.finest("......total parsing time " + (System.currentTimeMillis() - l) + "ms"); + logger.log(Level.FINEST, "......total parsing time {0}ms", System.currentTimeMillis() - l); } return result; } @@ -295,7 +295,7 @@ private ItemCollection parseDoc(JsonParser parser) { while (event.name().equals(Event.KEY_NAME.toString())) { String itemName = parser.getString(); if (debug) { - logger.finest("......found item " + itemName); + logger.log(Level.FINEST, "......found item {0}", itemName); } List itemValue = parseItem(parser); // convert itemName and value.... diff --git a/imixs-workflow-index-solr/src/main/java/org/imixs/workflow/engine/solr/SolrUpdateService.java b/imixs-workflow-index-solr/src/main/java/org/imixs/workflow/engine/solr/SolrUpdateService.java index f7d82a56b..22d989d73 100644 --- a/imixs-workflow-index-solr/src/main/java/org/imixs/workflow/engine/solr/SolrUpdateService.java +++ b/imixs-workflow-index-solr/src/main/java/org/imixs/workflow/engine/solr/SolrUpdateService.java @@ -68,7 +68,7 @@ public class SolrUpdateService implements UpdateService { @Inject SolrIndexService solrIndexService; - private static Logger logger = Logger.getLogger(SolrUpdateService.class.getName()); + private static final Logger logger = Logger.getLogger(SolrUpdateService.class.getName()); /** * This method adds a collection of documents to the Lucene index. The documents @@ -88,7 +88,7 @@ public void updateIndex(List documents) { try { solrIndexService.indexDocuments(documents); } catch (RestAPIException e) { - logger.severe("Failed to update document collection: " + e.getMessage()); + logger.log(Level.SEVERE, "Failed to update document collection: {0}", e.getMessage()); throw new IndexException(IndexException.INVALID_INDEX, "Unable to update solr search index", e); } } @@ -103,12 +103,13 @@ public void updateIndex() { // repeat flush.... flushCount = +1048; if (debug) { - logger.fine("...flush event log: " + flushCount + " entries updated in " - + (System.currentTimeMillis() - ltime) + "ms ..."); + logger.log(Level.FINE, "...flush event log: {0} entries updated in {1}ms ...", + new Object[]{flushCount, System.currentTimeMillis() - ltime}); } } if (debug) { - logger.fine("...flush solr index completed in " + (System.currentTimeMillis() - ltime) + "ms ..."); + logger.log(Level.FINE, "...flush solr index completed in {0}ms ...", + System.currentTimeMillis() - ltime); } } diff --git a/imixs-workflow-jax-rs/src/main/java/org/imixs/workflow/jaxrs/AdminPRestService.java b/imixs-workflow-jax-rs/src/main/java/org/imixs/workflow/jaxrs/AdminPRestService.java index 81f301eac..f311e3136 100644 --- a/imixs-workflow-jax-rs/src/main/java/org/imixs/workflow/jaxrs/AdminPRestService.java +++ b/imixs-workflow-jax-rs/src/main/java/org/imixs/workflow/jaxrs/AdminPRestService.java @@ -81,7 +81,7 @@ public class AdminPRestService { @Resource private SessionContext ctx; - private static Logger logger = Logger.getLogger(AdminPRestService.class.getName()); + private static final Logger logger = Logger.getLogger(AdminPRestService.class.getName()); @GET @Produces("text/html") diff --git a/imixs-workflow-jax-rs/src/main/java/org/imixs/workflow/jaxrs/BPMNUnmarshaller.java b/imixs-workflow-jax-rs/src/main/java/org/imixs/workflow/jaxrs/BPMNUnmarshaller.java index 43a058fab..79f9d0bfd 100644 --- a/imixs-workflow-jax-rs/src/main/java/org/imixs/workflow/jaxrs/BPMNUnmarshaller.java +++ b/imixs-workflow-jax-rs/src/main/java/org/imixs/workflow/jaxrs/BPMNUnmarshaller.java @@ -40,6 +40,7 @@ import jakarta.ws.rs.core.MultivaluedMap; import jakarta.ws.rs.ext.MessageBodyReader; import jakarta.ws.rs.ext.Provider; +import java.util.logging.Level; import javax.xml.parsers.ParserConfigurationException; import org.imixs.workflow.bpmn.BPMNModel; import org.imixs.workflow.bpmn.BPMNParser; @@ -56,7 +57,7 @@ @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_OCTET_STREAM, MediaType.TEXT_PLAIN }) public class BPMNUnmarshaller implements MessageBodyReader { - private static Logger logger = Logger.getLogger(BPMNUnmarshaller.class.getName()); + private static final Logger logger = Logger.getLogger(BPMNUnmarshaller.class.getName()); @SuppressWarnings("rawtypes") @Override @@ -74,17 +75,8 @@ public BPMNModel readFrom(Class aClass, Type type, Annotation[] annotations, Med try { return BPMNParser.parseModel(bpmnInputStream, "UTF-8"); - } catch (ModelException e) { - logger.warning("Invalid Model: " + e.getMessage()); - e.printStackTrace(); - } catch (ParseException e) { - logger.warning("Invalid Model: " + e.getMessage()); - e.printStackTrace(); - } catch (ParserConfigurationException e) { - logger.warning("Invalid Model: " + e.getMessage()); - e.printStackTrace(); - } catch (SAXException e) { - logger.warning("Invalid Model: " + e.getMessage()); + } catch (ModelException | ParseException | ParserConfigurationException | SAXException e) { + logger.log(Level.WARNING, "Invalid Model: {0}", e.getMessage()); e.printStackTrace(); } diff --git a/imixs-workflow-jax-rs/src/main/java/org/imixs/workflow/jaxrs/DocumentRestService.java b/imixs-workflow-jax-rs/src/main/java/org/imixs/workflow/jaxrs/DocumentRestService.java index 1bfa76d16..284bec50d 100644 --- a/imixs-workflow-jax-rs/src/main/java/org/imixs/workflow/jaxrs/DocumentRestService.java +++ b/imixs-workflow-jax-rs/src/main/java/org/imixs/workflow/jaxrs/DocumentRestService.java @@ -72,6 +72,7 @@ import jakarta.ejb.Stateless; import jakarta.servlet.http.HttpServletRequest; +import java.util.logging.Level; /** * The DocumentService provides methods to access the DocumentService EJB @@ -93,7 +94,7 @@ public class DocumentRestService { @Resource private SessionContext ctx; - private static Logger logger = Logger.getLogger(DocumentRestService.class.getName()); + private static final Logger logger = Logger.getLogger(DocumentRestService.class.getName()); @GET @Produces(MediaType.APPLICATION_XHTML_XML) @@ -206,7 +207,7 @@ public Response findDocumentsByQuery(@PathParam("query") String query, result = documentService.find(decodedQuery, pageSize, pageIndex, sortBy, sortReverse); } catch (Exception e) { - logger.warning("Invalid Search Query: " + e.getMessage()); + logger.log(Level.WARNING, "Invalid Search Query: {0}", e.getMessage()); ItemCollection error = new ItemCollection(); error.setItemValue("$error_message", e.getMessage()); @@ -396,8 +397,7 @@ public Response postDocument(XMLDocument xmlworkitem, @QueryParam("items") Strin // return workitem try { if (workitem.hasItem("$error_code")) { - logger.severe(workitem.getItemValueString("$error_code") + ": " - + workitem.getItemValueString("$error_message")); + logger.log(Level.SEVERE, "{0}: {1}", new Object[]{workitem.getItemValueString("$error_code"), workitem.getItemValueString("$error_message")}); return Response.ok(XMLDataCollectionAdapter.getDataCollection(workitem), MediaType.APPLICATION_XML) .status(Response.Status.NOT_ACCEPTABLE).build(); } else { diff --git a/imixs-workflow-jax-rs/src/main/java/org/imixs/workflow/jaxrs/EventLogRestService.java b/imixs-workflow-jax-rs/src/main/java/org/imixs/workflow/jaxrs/EventLogRestService.java index acba483d5..afa2c0ad1 100644 --- a/imixs-workflow-jax-rs/src/main/java/org/imixs/workflow/jaxrs/EventLogRestService.java +++ b/imixs-workflow-jax-rs/src/main/java/org/imixs/workflow/jaxrs/EventLogRestService.java @@ -57,6 +57,7 @@ import jakarta.ws.rs.core.Context; import jakarta.ws.rs.core.MediaType; import jakarta.ws.rs.core.Response; +import java.util.logging.Level; /** * The EventLogRestService supports methods to access the event log entries by @@ -76,7 +77,7 @@ public class EventLogRestService { @Context private HttpServletRequest servletRequest; - private static Logger logger = Logger.getLogger(EventLogRestService.class.getName()); + private static final Logger logger = Logger.getLogger(EventLogRestService.class.getName()); /** * Returns all eventLog entries. @@ -121,7 +122,7 @@ public XMLDataCollection getAllEventLogEntries( public XMLDataCollection getEventLogEntriesByTopic(@PathParam("topic") String topic, @DefaultValue("99") @QueryParam("maxCount") int maxCount) { - logger.finest("......get eventLogEntry by topic: " + topic); + logger.log(Level.FINEST, "......get eventLogEntry by topic: {0}", topic); // we split the topic by swung dash if multiple topics are provided String[] topicList = topic.split("~"); List eventLogEntries = eventLogService.findEventsByTopic(maxCount, topicList); @@ -157,7 +158,7 @@ public Response lockEventLogEntry(@PathParam("id") String id) { } catch (OptimisticLockException e) { // lock was not possible - continue.... - logger.info("...unable to lock EventLock: " + e.getMessage()); + logger.log(Level.INFO, "...unable to lock EventLock: {0}", e.getMessage()); } } @@ -184,7 +185,7 @@ public Response unlockEventLogEntry(@PathParam("id") String id) { } } catch (OptimisticLockException e) { // lock was not possible - continue.... - logger.info("...unable to lock EventLock: " + e.getMessage()); + logger.log(Level.INFO, "...unable to lock EventLock: {0}", e.getMessage()); } } return Response.status(Response.Status.CONFLICT).build(); @@ -200,7 +201,7 @@ public Response unlockEventLogEntry(@PathParam("id") String id) { @POST @Path("/release/{interval}/{topic}") public void releaseDeadLocks(@PathParam("interval") long deadLockInterval, @PathParam("topic") String topic) { - logger.finest("......releaseDeadLocks: " + topic); + logger.log(Level.FINEST, "......releaseDeadLocks: {0}", topic); // we split the topic by swung dash if multiple topics are provided String[] topicList = topic.split("~"); eventLogService.releaseDeadLocks(deadLockInterval, topicList); diff --git a/imixs-workflow-jax-rs/src/main/java/org/imixs/workflow/jaxrs/ModelRestService.java b/imixs-workflow-jax-rs/src/main/java/org/imixs/workflow/jaxrs/ModelRestService.java index 5938b935a..ee46802d5 100644 --- a/imixs-workflow-jax-rs/src/main/java/org/imixs/workflow/jaxrs/ModelRestService.java +++ b/imixs-workflow-jax-rs/src/main/java/org/imixs/workflow/jaxrs/ModelRestService.java @@ -65,6 +65,7 @@ import jakarta.ejb.Stateless; import jakarta.servlet.http.HttpServletRequest; +import java.util.logging.Level; /** * The WorkflowService Handler supports methods to process different kind of @@ -78,7 +79,7 @@ MediaType.TEXT_XML }) @Stateless public class ModelRestService { - private static Logger logger = Logger.getLogger(ModelRestService.class.getName()); + private static final Logger logger = Logger.getLogger(ModelRestService.class.getName()); static List modelEntityTypes = Arrays.asList("WorkflowEnvironmentEntity", "processentity", "activityentity"); @@ -356,7 +357,7 @@ public Response putBPMNModel(BPMNModel bpmnmodel) { logger.fine("BPMN Model posted... "); modelService.saveModel(bpmnmodel); } catch (ModelException e) { - logger.warning("Unable to update model: " + e.getMessage()); + logger.log(Level.WARNING, "Unable to update model: {0}", e.getMessage()); return Response.status(Response.Status.NOT_ACCEPTABLE).build(); } logger.fine("putBPMNModel finished! "); @@ -381,7 +382,7 @@ public Response putBPMNModel(@PathParam("filename") String filename, BPMNModel b logger.fine("BPMN Model posted... "); modelService.saveModel(bpmnmodel, filename); } catch (ModelException e) { - logger.warning("Unable to update model: " + e.getMessage()); + logger.log(Level.WARNING, "Unable to update model: {0}", e.getMessage()); return Response.status(Response.Status.NOT_ACCEPTABLE).build(); } logger.fine("putBPMNModel finished! "); diff --git a/imixs-workflow-jax-rs/src/main/java/org/imixs/workflow/jaxrs/ReportRestService.java b/imixs-workflow-jax-rs/src/main/java/org/imixs/workflow/jaxrs/ReportRestService.java index 1309d732e..3df91155d 100644 --- a/imixs-workflow-jax-rs/src/main/java/org/imixs/workflow/jaxrs/ReportRestService.java +++ b/imixs-workflow-jax-rs/src/main/java/org/imixs/workflow/jaxrs/ReportRestService.java @@ -88,6 +88,7 @@ import jakarta.servlet.http.HttpServletResponse; import jakarta.xml.bind.JAXBContext; import jakarta.xml.bind.Marshaller; +import java.util.logging.Level; /** * The WorkflowService Handler supports methods to process different kind of @@ -110,7 +111,7 @@ public class ReportRestService { @Context private HttpServletRequest servletRequest; - private static Logger logger = Logger.getLogger(ReportRestService.class.getName()); + private static final Logger logger = Logger.getLogger(ReportRestService.class.getName()); @GET @Produces("text/html") @@ -211,7 +212,7 @@ public Response getExcecuteReport(@PathParam("name") String reportName, ItemCollection report = reportService.findReport(reportName); if (report == null) { - logger.severe("Report '" + reportName + "' not defined!"); + logger.log(Level.SEVERE, "Report ''{0}'' not defined!", reportName); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); } @@ -353,7 +354,7 @@ public DocumentTable getHTMLResult(@PathParam("name") String reportName, } } - logger.fine("set encoding :" + encoding); + logger.log(Level.FINE, "set encoding :{0}", encoding); servlerResponse.setContentType(MediaType.TEXT_HTML + "; charset=" + encoding); return documentTable; @@ -384,7 +385,7 @@ public Response getCustomResult(@PathParam("name") String reportName, ItemCollection report = reportService.findReport(reportName); if (report == null) { - logger.severe("Report '" + reportName + "' not defined!"); + logger.log(Level.SEVERE, "Report ''{0}'' not defined!", reportName); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); } if (encoding == null || "".equals(encoding)) { @@ -404,7 +405,7 @@ public Response getCustomResult(@PathParam("name") String reportName, } // set content type and character encoding - logger.fine("set encoding :" + encoding); + logger.log(Level.FINE, "set encoding :{0}", encoding); servlerResponse.setContentType(sContentType + "; charset=" + encoding); return Response.ok(documentTable, sContentType).build(); @@ -452,7 +453,7 @@ public XMLDataCollection getXMLResult(@PathParam("name") String reportName, } } - logger.fine("set encoding :" + encoding); + logger.log(Level.FINE, "set encoding :{0}", encoding); servlerResponse.setContentType(MediaType.APPLICATION_XML + "; charset=" + encoding); return XMLDataCollectionAdapter.getDataCollection(col); diff --git a/imixs-workflow-jax-rs/src/main/java/org/imixs/workflow/jaxrs/RootRestService.java b/imixs-workflow-jax-rs/src/main/java/org/imixs/workflow/jaxrs/RootRestService.java index 472919a42..bf9b2931a 100644 --- a/imixs-workflow-jax-rs/src/main/java/org/imixs/workflow/jaxrs/RootRestService.java +++ b/imixs-workflow-jax-rs/src/main/java/org/imixs/workflow/jaxrs/RootRestService.java @@ -44,6 +44,7 @@ import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpSession; +import java.util.logging.Level; /** * The RootService provides the api description @@ -63,7 +64,7 @@ public class RootRestService { private HttpServletResponse servletResponse; - private static Logger logger = Logger.getLogger(RootRestService.class.getName()); + private static final Logger logger = Logger.getLogger(RootRestService.class.getName()); @GET @@ -104,7 +105,7 @@ public void logout() { } } catch (ServletException e) { - logger.warning("Failed to logout from API endpoint /logout : " + e.getMessage()); + logger.log(Level.WARNING, "Failed to logout from API endpoint /logout : {0}", e.getMessage()); return; } logger.finest("Logout successfull"); diff --git a/imixs-workflow-jax-rs/src/main/java/org/imixs/workflow/jaxrs/WorkflowRestService.java b/imixs-workflow-jax-rs/src/main/java/org/imixs/workflow/jaxrs/WorkflowRestService.java index 3ac4124d3..a311cada7 100644 --- a/imixs-workflow-jax-rs/src/main/java/org/imixs/workflow/jaxrs/WorkflowRestService.java +++ b/imixs-workflow-jax-rs/src/main/java/org/imixs/workflow/jaxrs/WorkflowRestService.java @@ -75,6 +75,7 @@ import jakarta.ejb.Stateless; import jakarta.servlet.http.HttpServletRequest; +import java.util.logging.Level; /** * The WorkflowService Handler supports methods to process different kind of @@ -97,7 +98,7 @@ public class WorkflowRestService { @jakarta.ws.rs.core.Context private HttpServletRequest servletRequest; - private static Logger logger = Logger.getLogger(WorkflowRestService.class.getName()); + private static final Logger logger = Logger.getLogger(WorkflowRestService.class.getName()); @GET @Produces("text/html") @@ -203,26 +204,27 @@ public Response getWorkItemFile(@PathParam("uniqueid") String uniqueid, @PathPar Response.ResponseBuilder builder = Response.ok(fileData.getContent(), fileData.getContentType()); return builder.build(); } else { - logger.warning("WorkflowRestService unable to open file: '" + file + "' in workitem '" + uniqueid - + "' - error: Filename not found!"); + logger.log(Level.WARNING, "WorkflowRestService unable to open file: ''{0}''" + + " in workitem ''{1}'' - error: Filename not found!", new Object[]{file, uniqueid}); // workitem not found return Response.status(Response.Status.NOT_FOUND).build(); } } else { - logger.warning("WorkflowRestService unable to open file: '" + file + "' in workitem '" + uniqueid - + "' - error: Workitem not found!"); + logger.log(Level.WARNING, "WorkflowRestService unable to open file: ''{0}''" + + " in workitem ''{1}'' - error: Workitem not found!", new Object[]{file, uniqueid}); // workitem not found return Response.status(Response.Status.NOT_FOUND).build(); } } catch (Exception e) { - logger.severe("WorkflowRestService unable to open file: '" + file + "' in workitem '" + uniqueid - + "' - error: " + e.getMessage()); + logger.log(Level.SEVERE, "WorkflowRestService unable to open file: ''{0}''" + + " in workitem ''{1}'' - error: {2}", new Object[]{file, uniqueid, e.getMessage()}); e.printStackTrace(); } - logger.severe("WorkflowRestService unable to open file: '" + file + "' in workitem '" + uniqueid + "'"); + logger.log(Level.SEVERE, "WorkflowRestService unable to open file: ''{0}''" + + " in workitem ''{1}''", new Object[]{file, uniqueid}); return Response.status(Response.Status.NOT_FOUND).build(); } @@ -531,7 +533,7 @@ public Response putWorkitem(XMLDocument workitem, @QueryParam("items") String it @Consumes({ MediaType.APPLICATION_XML, MediaType.TEXT_XML, MediaType.APPLICATION_JSON }) public Response postWorkitemByUniqueID(@PathParam("uniqueid") String uniqueid, XMLDocument xmlworkitem, @QueryParam("items") String items) { - logger.fine("postWorkitemByUniqueID @POST /workitem/" + uniqueid + " method:postWorkitemXML...."); + logger.log(Level.FINE, "postWorkitemByUniqueID @POST /workitem/{0} method:postWorkitemXML....", uniqueid); ItemCollection workitem; workitem = XMLDocumentAdapter.putDocument(xmlworkitem); return processWorkitem(workitem, uniqueid, items); @@ -663,7 +665,7 @@ public Response putTypedWorkitemJSON(InputStream requestBodyStream, @QueryParam( @Consumes({ MediaType.APPLICATION_JSON }) public Response postTypedWorkitemJSONByUniqueID(@PathParam("uniqueid") String uniqueid, InputStream requestBodyStream, @QueryParam("error") String error, @QueryParam("items") String items) { - logger.fine("postJSONWorkitemByUniqueID @POST /workitem/" + uniqueid + "...."); + logger.log(Level.FINE, "postJSONWorkitemByUniqueID @POST /workitem/{0}....", uniqueid); ItemCollection workitem = null; try { @@ -742,7 +744,7 @@ public ItemCollection parseWorkitem(InputStream requestBodyStream) { StringTokenizer st = new StringTokenizer(inputLine, "&", false); while (st.hasMoreTokens()) { String fieldValue = st.nextToken(); - logger.finest("[WorkflowRestService] parse line:" + fieldValue + ""); + logger.log(Level.FINEST, "[WorkflowRestService] parse line:{0}", fieldValue); try { fieldValue = URLDecoder.decode(fieldValue, "UTF-8"); @@ -765,7 +767,7 @@ public ItemCollection parseWorkitem(InputStream requestBodyStream) { if (fieldValue.indexOf('=') == fieldValue.length()) { // no value workitem.replaceItemValue(fieldName, ""); - logger.fine("[WorkflowRestService] no value for '" + fieldName + "'"); + logger.log(Level.FINE, "[WorkflowRestService] no value for ''{0}''", fieldName); } else { fieldValue = fieldValue.substring(fieldValue.indexOf('=') + 1); // test for a multiValue field - did we know @@ -776,13 +778,13 @@ public ItemCollection parseWorkitem(InputStream requestBodyStream) { List v = workitem.getItemValue(fieldName); v.add(fieldValue); - logger.fine("[WorkflowRestService] multivalue for '" + fieldName + "' = '" + fieldValue - + "'"); + logger.log(Level.FINE, "[WorkflowRestService] multivalue for ''{0}'' = ''{1}''", + new Object[]{fieldName, fieldValue}); workitem.replaceItemValue(fieldName, v); } else { // first single value.... - logger.fine( - "[WorkflowRestService] value for '" + fieldName + "' = '" + fieldValue + "'"); + logger.log(Level.FINE, "[WorkflowRestService] value for ''{0}'' = ''{1}''", + new Object[]{fieldName, fieldValue}); workitem.replaceItemValue(fieldName, fieldValue); vMultiValueFieldNames.add(fieldName); } @@ -836,8 +838,8 @@ private Response processWorkitem(ItemCollection workitem, String uid, String ite // validate optional uniqueId if (uid != null && !uid.isEmpty() && !workitem.getUniqueID().isEmpty() && !uid.equals(workitem.getUniqueID())) { - logger.severe("@POST/@PUT workitem/" + uid - + " : $UNIQUEID did not match, remove $uniqueid to create a new instnace!"); + logger.log(Level.SEVERE, "@POST/@PUT workitem/{0} : $UNIQUEID did not match," + + " remove $uniqueid to create a new instnace!", uid); return Response.status(Response.Status.NOT_ACCEPTABLE).build(); } @@ -866,8 +868,8 @@ private Response processWorkitem(ItemCollection workitem, String uid, String ite // return workitem try { if (workitem.hasItem("$error_code")) { - logger.severe(workitem.getItemValueString("$error_code") + ": " - + workitem.getItemValueString("$error_message")); + logger.log(Level.SEVERE, "{0}: {1}", + new Object[]{workitem.getItemValueString("$error_code"), workitem.getItemValueString("$error_message")}); return Response.ok(XMLDataCollectionAdapter.getDataCollection(workitem)) .status(Response.Status.NOT_ACCEPTABLE).build(); } else {