package gov.nih.nci.caadapter.ui.common.preferences;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.HashMap;

/**
 * This class implements preferences in caAdapter
 *
 * @author OWNER: Harsha Jayanna
 * @author LAST UPDATE $Author: jayannah $
 * @version Since caAdapter v4.0 revision
 *          $Revision: 1.3 $
 *          $Date: 2007-08-17 15:15:25 $
 */
public class CaAdapterPref {
    private static CaAdapterPref caAdapterPref=null;
    private HashMap caAdapterPropHashMap = null;

    private HashMap getcaAdapterPref() {
        return caAdapterPropHashMap;
    }

    public static synchronized HashMap getCaAdapterPreferences() {
        if (caAdapterPref == null) {
            caAdapterPref = new CaAdapterPref();
            return caAdapterPref.getcaAdapterPref();
        } else {
            return caAdapterPref.getcaAdapterPref();
        }
    }

    private CaAdapterPref() {
        try {
            FileInputStream f_out = new FileInputStream(System.getProperty("user.home") + "\\.caadapter");
            ObjectInputStream obj_out = new ObjectInputStream(f_out);
            caAdapterPropHashMap = (HashMap) obj_out.readObject();
        } catch (Exception e) {
            caAdapterPropHashMap = null;
            e.printStackTrace();
        }
    }

    public static synchronized void setCaAdapterPreferences(HashMap mapFromApplication) {
        try {
            FileOutputStream f_out = new FileOutputStream(System.getProperty("user.home") + "\\.caadapter");
            ObjectOutputStream obj_out = new ObjectOutputStream(f_out);
            obj_out.writeObject(mapFromApplication);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
/**
 * Change History
 * $Log: not supported by cvs2svn $
 */

@@ -334,16 +334,15 @@
 or: 
-jayannah
+wangeug
  $%0A 
@@ -411,9 +411,9 @@
 : 1.
-3
+4
  $%0A 
@@ -442,19 +442,19 @@
 -08-
-17 15
+24 21
 :15:
-25
+14
  $%0A 
@@ -588,16 +588,221 @@
  null;%0A%0A
+    public static String VALIDATION_PERFORMANCE_LEVLE_0=%22level 0%22;%0A    public static String VALIDATION_PERFORMANCE_LEVLE_1=%22leve 1%22;%0A    public static String VALIDATION_PERFORMANCE_LEVLE_2=%22level 2%22;%0A    %0A
     priv
@@ -2061,12 +2061,135 @@
 s2svn $%0A
+ * Revision 1.3  2007/08/17 15:15:25  jayannah%0A * Reformatted and added the Comments and the log tags for all the files%0A *%0A
  */%0A

add validation level constants