translate
authorrk <rk>
Tue, 25 Sep 2001 20:14:07 +0000 (20:14 +0000)
committerrk <rk>
Tue, 25 Sep 2001 20:14:07 +0000 (20:14 +0000)
source/mir/misc/HTMLTemplateProcessor.java

index c40c367..f445a38 100755 (executable)
@@ -214,15 +214,15 @@ public final class HTMLTemplateProcessor {
 
 
   /**
-   *   Wandelt eine Entity-Liste in eine SimpleList von SimpleHashes um.
+   *   Converts Entity-List to SimpleList of SimpleHashes.
    *   @param aList ist eine Liste von Entity
    *   @return eine freemarker.template.SimpleList von SimpleHashes.
    */
   public static SimpleList makeSimpleList(EntityList aList) throws StorageObjectException
   {
-    SimpleList      simpleList = new SimpleList();
+    SimpleList  simpleList = new SimpleList();
     if (aList != null) {
-      for(int i=0;i<aList.size();i++){
+      for(int i=0;i<aList.size();i++) {
         simpleList.add(makeSimpleHash(aList.elementAt(i)));
       }
     }
@@ -256,15 +256,12 @@ public final class HTMLTemplateProcessor {
    *  @return SimpleHash mit den entsprechenden freemarker Daten
    *
    */
-    public static SimpleHash makeSimpleHash(Entity entity) {
-      if (entity != null) {
-        return makeSimpleHash(entity.getValues());
-      }
-      else {
-        //theLog.printWarning("Entity ist <null>");
-        return null;
-      }
-    }
+  public static SimpleHash makeSimpleHash(Entity entity) {
+    if (entity != null)
+      return makeSimpleHash(entity.getValues());
+    else
+      return null;
+  }
 
   /**
    *  Konvertiert ein Hashtable mit den keys und values als String
@@ -290,38 +287,38 @@ public final class HTMLTemplateProcessor {
 
 
   /**
-   * Wandelt EntityListe in SimpleHash um, und versieht die Liste mit StandardInfos,
-   * die aus EntityList kommen.
+   * Converts EntityList in SimpleHash and adds additional information
+   * to the returned SimpleHash
    *
    * @param entList
    * @return SimpleHash returns SimpleHash with the converted EntityList plus
    *        additional Data about the list.
    * @exception StorageObjectException
    */
-    public static SimpleHash makeSimpleHashWithEntitylistInfos(EntityList entList) throws StorageObjectException {
-      SimpleHash modelRoot = new SimpleHash();
-      if (entList!=null) {
-                modelRoot.put("contentlist", makeSimpleList(entList));
-                modelRoot.put("count", new SimpleScalar((new Integer(entList.getCount())).toString()));
-          if (entList.getWhere()!=null) {
-            modelRoot.put("where", new SimpleScalar(entList.getWhere()));
-            modelRoot.put("where_encoded", new SimpleScalar(URLEncoder.encode(entList.getWhere())));
-          }
-
-          if(entList.getOrder()!=null) {
-            modelRoot.put("order", new SimpleScalar(entList.getOrder()));
-            modelRoot.put("order_encoded", new SimpleScalar(URLEncoder.encode(entList.getOrder())));
-          }
-          modelRoot.put("from", new SimpleScalar((new Integer(entList.getFrom())).toString()));
-          modelRoot.put("to", new SimpleScalar((new Integer(entList.getTo())).toString()));
-
-          if (entList.hasNextBatch())
-            modelRoot.put("next", new SimpleScalar((new Integer(entList.getNextBatch())).toString()));
-          if (entList.hasPrevBatch())
-            modelRoot.put("prev", new SimpleScalar((new Integer(entList.getPrevBatch())).toString()));
+
+  public static SimpleHash makeSimpleHashWithEntitylistInfos(EntityList entList) throws StorageObjectException {
+    SimpleHash modelRoot = new SimpleHash();
+    if (entList!=null) {
+      modelRoot.put("contentlist", makeSimpleList(entList));
+      modelRoot.put("count", new SimpleScalar((new Integer(entList.getCount())).toString()));
+      if (entList.getWhere()!=null) {
+        modelRoot.put("where", new SimpleScalar(entList.getWhere()));
+        modelRoot.put("where_encoded", new SimpleScalar(URLEncoder.encode(entList.getWhere())));
+      }
+      if(entList.getOrder()!=null) {
+        modelRoot.put("order", new SimpleScalar(entList.getOrder()));
+        modelRoot.put("order_encoded", new SimpleScalar(URLEncoder.encode(entList.getOrder())));
       }
-      return modelRoot;
+      modelRoot.put("from", new SimpleScalar((new Integer(entList.getFrom())).toString()));
+      modelRoot.put("to", new SimpleScalar((new Integer(entList.getTo())).toString()));
+
+      if (entList.hasNextBatch())
+        modelRoot.put("next", new SimpleScalar((new Integer(entList.getNextBatch())).toString()));
+      if (entList.hasPrevBatch())
+        modelRoot.put("prev", new SimpleScalar((new Integer(entList.getPrevBatch())).toString()));
     }
+    return modelRoot;
+  }
 
   /**
    * Private methods to get template from a templateFilename