Update of 
/var/cvs/contributions/CMSContainer_Modules/openofficeintegration/src/java/com/finalist/cmsc/openoffice/service
In directory 
james.mmbase.org:/tmp/cvs-serv13927/openofficeintegration/src/java/com/finalist/cmsc/openoffice/service

Modified Files:
        OutFinishHtml.java ChangeContentXml.java Parserfactory.java 
Added Files:
        OdtFileTransfer.java 
Removed Files:
        OdtFileTranster.java 
Log Message:
CMSC-907 - Added Generics and removed unread/unused code. Renamed bad method 
and classes names


See also: 
http://cvs.mmbase.org/viewcvs/contributions/CMSContainer_Modules/openofficeintegration/src/java/com/finalist/cmsc/openoffice/service
See also: http://www.mmbase.org/jira/browse/CMSC-907


OdtFileTransfer.java is new



Index: OutFinishHtml.java
===================================================================
RCS file: 
/var/cvs/contributions/CMSContainer_Modules/openofficeintegration/src/java/com/finalist/cmsc/openoffice/service/OutFinishHtml.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- OutFinishHtml.java  3 Jul 2008 20:29:29 -0000       1.3
+++ OutFinishHtml.java  7 Jul 2008 20:52:35 -0000       1.4
@@ -23,7 +23,7 @@
 
     ChangeContentXml ccx;
 
-    public OutFinishHtml(String odtLocation, String middleFileLocation) {
+    public OutFinishHtml(String odtLocation, String middleFileLocation) throws 
IOException {
         this.odtLocation = odtLocation;
         this.middleFileLocation = middleFileLocation;
         ccx = new ChangeContentXml();


Index: ChangeContentXml.java
===================================================================
RCS file: 
/var/cvs/contributions/CMSContainer_Modules/openofficeintegration/src/java/com/finalist/cmsc/openoffice/service/ChangeContentXml.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- ChangeContentXml.java       28 Jan 2008 09:11:25 -0000      1.2
+++ ChangeContentXml.java       7 Jul 2008 20:52:35 -0000       1.3
@@ -17,14 +17,14 @@
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 
 
 public class ChangeContentXml {
@@ -32,9 +32,9 @@
        Log log = LogFactory.getLog(ChangeContentXml.class);
     Properties styles = new Properties();
     InputSource inputSource;
-    HashMap hs = new HashMap();
+    HashMap<String, String> hs = new HashMap<String, String>();
 
-    public ChangeContentXml() {
+    public ChangeContentXml() throws IOException {
 
        InputStream in = new 
BufferedInputStream(this.getClass().getResourceAsStream("style.properties"));
 
@@ -43,55 +43,60 @@
         } catch (IOException e) {
             log.error("Error when load style properties", e);
         }
+        finally {
+           if (in != null) {
+              in.close();
+           }
+        }
     }
 
-    public HashMap getStyleMap(HashMap contentStyle) {
-        HashMap hs = new HashMap();
+    public HashMap<String, String> getStyleMap(HashMap contentStyle) {
+        HashMap<String, String> hs = new HashMap<String, String>();
         String newKey = null;
-        String vaule = null;
+        String value = null;
         String newValue = null;
         Set contentKey = contentStyle.keySet();
         Iterator it = contentKey.iterator();
         while (it.hasNext()) {
                newKey = it.next().toString();
-            vaule = contentStyle.get(newKey).toString();
+            value = contentStyle.get(newKey).toString();
             //bold
-            if (vaule.contains("font-weight=\"bold\"")) {
+            if (value.contains("font-weight=\"bold\"")) {
                 newValue = "1";
             } else {
                 newValue = "0";
             }
             //italic
-            if (vaule.contains("font-style=\"italic\"")) {
+            if (value.contains("font-style=\"italic\"")) {
                 newValue = newValue + "1";
             } else {
                 newValue = newValue + "0";
             }
             //underline
-            if (vaule.contains("text-underline-style=\"solid\"")) {
+            if (value.contains("text-underline-style=\"solid\"")) {
                 newValue = newValue + "1";
             } else {
                 newValue = newValue + "0";
             }
             //throughline
-            if (vaule.contains("text-line-through-style=\"solid\"")) {
+            if (value.contains("text-line-through-style=\"solid\"")) {
                 newValue = newValue + "1";
             } else {
                 newValue = newValue + "0";
             }
             //superscript
-            if (vaule.contains("text-position=\"super")) {
+            if (value.contains("text-position=\"super")) {
                 newValue = newValue + "1";
-            } else if (vaule.contains("text-position=\"sub")) {
+            } else if (value.contains("text-position=\"sub")) {
                 newValue = newValue + "2";
             } else {
                 newValue = newValue + "0";
             }
             //list
-            if (vaule.contains("bullet-char")) {
+            if (value.contains("bullet-char")) {
                 newValue = "ul";
             }
-            if (vaule.contains("num-format")) {
+            if (value.contains("num-format")) {
                 newValue = "ol";
             }
             hs.put(newKey, newValue);
@@ -99,14 +104,14 @@
         return hs;
     }
 
-    public HashMap getContentStyle(String ContentUrl) {
+    public HashMap<String, String> getContentStyle(String ContentUrl) {
         InputSource inputSource;
         inputSource = getXml(ContentUrl);
         hs = getStyleAttributes(inputSource);
         return hs;
     }
 
-    public String getPsoperties(String key, String filePath) throws 
IOException {
+    public String getProperties(String key, String filePath) throws 
IOException {
         Properties props = new Properties();
         String Property = null;
         InputStream in = new BufferedInputStream(new 
FileInputStream(filePath));
@@ -117,8 +122,8 @@
         return Property;
     }
 
-    public HashMap getStyleAttributes(InputSource styleSource) {
-        HashMap contentFirstHashMap = new HashMap();
+    public HashMap<String, String> getStyleAttributes(InputSource styleSource) 
{
+        HashMap<String, String> contentFirstHashMap = new HashMap<String, 
String>();
         DocumentBuilderFactory domfac = DocumentBuilderFactory.newInstance();
         try {
             DocumentBuilder dombuilder = domfac.newDocumentBuilder();


Index: Parserfactory.java
===================================================================
RCS file: 
/var/cvs/contributions/CMSContainer_Modules/openofficeintegration/src/java/com/finalist/cmsc/openoffice/service/Parserfactory.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- Parserfactory.java  28 Jan 2008 09:11:25 -0000      1.2
+++ Parserfactory.java  7 Jul 2008 20:52:35 -0000       1.3
@@ -14,11 +14,11 @@
 
 public class Parserfactory {
 
-    public Node creatNode(Document doc, HashMap hs, Node node) {
+    public Node creatNode(Document doc, HashMap<String, String> hs, Node node) 
{
         Node NewNode = null;
         String style = null;
-        Set tag = hs.keySet();
-        Iterator it = tag.iterator();
+        Set<String> tag = hs.keySet();
+        Iterator<String> it = tag.iterator();
         while (it.hasNext()) {
             style = it.next().toString();
             Element theNewNode = doc.createElement(style);
@@ -29,7 +29,7 @@
     }
 
     public void process(Document doc, Node node, HashMap hs,Map mapping) {
-        HashMap styleMap = new HashMap();
+        HashMap<String, String> styleMap = new HashMap<String, String>();
         String nodeName = node.getNodeName();
         if (nodeName.equals("p")) {
             styleMap = changePnode(node, hs);
@@ -90,9 +90,9 @@
                }
     }
 
-    public HashMap changePnode(Node node, HashMap hs) {
+    public HashMap<String, String> changePnode(Node node, HashMap hs) {
         String classStyle = null;
-        HashMap styleHs = new HashMap();
+        HashMap<String, String> styleHs = new HashMap<String, String>();
         if (node.getAttributes().getNamedItem("class") != null) {
             classStyle = 
node.getAttributes().getNamedItem("class").getNodeValue();
         }
@@ -104,8 +104,8 @@
         return styleHs;
     }
 
-    public HashMap changeSpannode(Node node, HashMap hs) {
-        HashMap styleHs = new HashMap();
+    public HashMap<String, String> changeSpannode(Node node, HashMap hs) {
+        HashMap<String, String> styleHs = new HashMap<String, String>();
         String classStyle = "";
         Node styleNode = node.getAttributes().getNamedItem("class");
         if (null != styleNode) {
@@ -118,8 +118,8 @@
         }
         return styleHs;
     }
-    public HashMap getTagFormStyle(String style) {
-        HashMap tag = new HashMap();
+    public HashMap<String, String> getTagFormStyle(String style) {
+        HashMap<String, String> tag = new HashMap<String, String>();
         if (style != null) {
             String bold = String.valueOf(style.charAt(0));
             String italics = String.valueOf(style.charAt(1));


_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to