From: rk Date: Tue, 25 Sep 2001 20:14:07 +0000 (+0000) Subject: translate X-Git-Tag: prexmlproducerconfig~429 X-Git-Url: http://erislabs.org.uk/gitweb/?a=commitdiff_plain;h=6c49d8cb35bdbadf72aed286d54a2433fc202828;p=mir.git translate --- diff --git a/source/mir/misc/HTMLTemplateProcessor.java b/source/mir/misc/HTMLTemplateProcessor.java index c40c3674..f445a38b 100755 --- a/source/mir/misc/HTMLTemplateProcessor.java +++ b/source/mir/misc/HTMLTemplateProcessor.java @@ -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"); - 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