org.openpermis.editor.policy.view
Class LoadProblemRecorder

java.lang.Object
  extended by org.openpermis.editor.policy.view.LoadProblemRecorder
All Implemented Interfaces:
org.openpermis.policy.io.ProblemReporter

public class LoadProblemRecorder
extends Object
implements org.openpermis.policy.io.ProblemReporter

Records import problems and shows warning messages.

Since:
0.3.0

Field Summary
private static int FORMAT_LIST
          Dialog format for warnings.
private static int FORMAT_TABLE
          Dialog format for warnings.
private static org.slf4j.Logger LOGGER
          The logger object of this class.
private static String PROBLEM_KEY_PREFIX
          Prefix for all problem keys.
private  org.jdesktop.application.ResourceMap resourceMap
          The translations for problem types handled by this reporter.
private  List<String> warnings
          A list of warnings recorded.
 
Constructor Summary
LoadProblemRecorder(org.jdesktop.application.ApplicationContext context)
          Creates a new problem reporter for import problems.
 
Method Summary
private  String getKey(org.openpermis.policy.io.ProblemType type)
          Returns the translation key for a problem type.
private  String getWarningDetails(File file, int format)
          Returns an HTML version of the collected warnings.
 boolean hasWarnings()
          Tests if there have been any warnings during the import.
 void reportProblem(org.openpermis.policy.io.ProblemType type, Object... parameters)
           
 void showDialog(Component owner, File file)
          Shows a warning dialog with detail messages for the specified file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROBLEM_KEY_PREFIX

private static final String PROBLEM_KEY_PREFIX
Prefix for all problem keys.

Constant Field Value:
"problem."
Since:
0.3.0

LOGGER

private static final org.slf4j.Logger LOGGER
The logger object of this class.

Since:
0.3.0

FORMAT_LIST

private static final int FORMAT_LIST
Dialog format for warnings.

Constant Field Value:
1
Since:
0.3.0

FORMAT_TABLE

private static final int FORMAT_TABLE
Dialog format for warnings.

Constant Field Value:
2
Since:
0.3.0

resourceMap

private final org.jdesktop.application.ResourceMap resourceMap
The translations for problem types handled by this reporter.

Since:
0.3.0

warnings

private final List<String> warnings
A list of warnings recorded.

Since:
0.3.0
Constructor Detail

LoadProblemRecorder

public LoadProblemRecorder(org.jdesktop.application.ApplicationContext context)
Creates a new problem reporter for import problems.

Parameters:
context - the context used to retrieve translations.
Since:
0.3.0
Method Detail

hasWarnings

public boolean hasWarnings()
Tests if there have been any warnings during the import.

Returns:
true if a warning was recorded, false otherwise.
Since:
0.3.0

getWarningDetails

private String getWarningDetails(File file,
                                 int format)
Returns an HTML version of the collected warnings.

Parameters:
file - the file for which to issue the warning message.
format - {FORMAT_LIST, FORMAT_TABLE}
Returns:
the warning details.
Since:
0.3.0

showDialog

public void showDialog(Component owner,
                       File file)
Shows a warning dialog with detail messages for the specified file.

Parameters:
owner - the owner of the dialog to display.
file - the file for which to show the warnings.
Since:
0.3.0

getKey

private String getKey(org.openpermis.policy.io.ProblemType type)
Returns the translation key for a problem type.

Parameters:
type - the problem type for which to retrieve the key.
Returns:
the translation key for the problem type.
Since:
0.3.0

reportProblem

public void reportProblem(org.openpermis.policy.io.ProblemType type,
                          Object... parameters)
Specified by:
reportProblem in interface org.openpermis.policy.io.ProblemReporter
Since:
0.3.0


PERMIS Role Based Access Control 0.3.0 (Build 14)
2009/05/08 09:06:48
Copyright (c) 2002-2007 Ergon Informatik AG