{
if (field.equals("webdb_create_formatted"))
{
- if (hasValueForField("webdb_create"))
- returnValue=StringUtil.dateToReadableDate(getValue("webdb_create"));
+ if (hasValueForField("webdb_create"))
+ returnValue=StringUtil.dateToReadableDate(getValue("webdb_create"));
}
else if (field.equals("webdb_lastchange_formatted"))
{
if (hasValueForField("webdblast_change"))
- returnValue=StringUtil.dateToReadableDate(getValue("webdb_lastchange"));
+ returnValue=StringUtil.dateToReadableDate(getValue("webdb_lastchange"));
}
else
returnValue = (String)theValuesHash.get(field);
public TemplateModel get(java.lang.String key) throws TemplateModelException
{
- return new SimpleScalar(getValue(key));
+ return new SimpleScalar(getValue(key));
}
-
- public void put(java.lang.String key, TemplateModel model)
+
+ public void put(java.lang.String key, TemplateModel model)
{
// putting should only take place via setValue and is limited to the
// database fields associated with the entity. no additional freemarker
* date "now" // rk */
// put standard configuration into tempalteRootmodel
SimpleHash configHash = new SimpleHash();
- configHash.put("docroot", new SimpleScalar(producerDocRoot));
- configHash.put("storageroot", new SimpleScalar(producerStorageRoot));
- configHash.put("productionhost", new SimpleScalar(productionHost));
- configHash.put("openaction", new SimpleScalar(openAction));
+ configHash.put("producerDocRoot", new SimpleScalar(producerDocRoot));
+ configHash.put("storageRoot", new SimpleScalar(producerStorageRoot));
+ configHash.put("productionHost", new SimpleScalar(productionHost));
+ configHash.put("openAction", new SimpleScalar(openAction));
configHash.put("actionRootLogin",new SimpleScalar(actionRoot));
-
-
- tmr.put("docRoot", new SimpleScalar(docRoot));
- tmr.put("now", new SimpleScalar(StringUtil.date2readableDateTime(new GregorianCalendar())));
- tmr.put("actionRoot", new SimpleScalar(actionRoot+session));
- tmr.put("openAction", new SimpleScalar(openAction));
- tmr.put("productionHost", new SimpleScalar(productionHost));
- tmr.put("videoHost", new SimpleScalar(videoHost));
- tmr.put("audioHost", new SimpleScalar(audioHost));
- tmr.put("imageHost", new SimpleScalar(imageHost));
+ configHash.put("docRoot", new SimpleScalar(docRoot));
+ configHash.put("now", new SimpleScalar(StringUtil.date2readableDateTime(new GregorianCalendar())));
+ configHash.put("actionRoot", new SimpleScalar(actionRoot+session));
+ configHash.put("productionHost", new SimpleScalar(productionHost));
+ configHash.put("videoHost", new SimpleScalar(videoHost));
+ configHash.put("audioHost", new SimpleScalar(audioHost));
+ configHash.put("imageHost", new SimpleScalar(imageHost));
// this conform to updated freemarker syntax
- tmr.put("compressWhitespace", new freemarker.template.utility.CompressWhitespace() );
-
- tmr.put("config", configHash);
- tmpl.process(tmr, out);
-
+ configHash.put("compressWhitespace", new freemarker.template.utility.CompressWhitespace() );
+
+ SimpleHash outPutHash = new SimpleHash();
+ outPutHash.put("data",tmr);
+ outPutHash.put("config", configHash);
+
+ tmpl.process(outPutHash,out);
}
*/
-public class EntityTopics extends Entity
-{
+public class EntityTopics extends Entity {
public EntityTopics(){
super();
}
- public EntityTopics(StorageObject theStorage)
- {
+ public EntityTopics(StorageObject theStorage) {
this();
setStorage(theStorage);
}
-
- // Dependencies einhalten
- public void update() throws StorageObjectException{
- super.update();
- DatabaseContent dbContent = DatabaseContent.getInstance();
- dbContent.setUnproduced("to_topic="+getId());
- }
-
}
/**
* setValues in the Entity and updates them on the StorageObject
*/
- public String set(HashMap theValues) throws ModuleException
- {
+ public String set(HashMap theValues) throws ModuleException {
try {
Entity theEntity = theStorage.selectById((String)theValues.get("id"));
if (theEntity == null)
throw new ModuleException("No Objekt with id in Database id: " + theValues.get("id"));
+ DatabaseContent.getInstance().setUnproduced("id=" + theEntity.getValue("to_media"));
theEntity.setValues(theValues);
theEntity.update();
- //set content to unproduced
- DatabaseContent.getInstance().setUnproduced("id=" + theEntity.getValue("to_media"));
return theEntity.getId();
- }
- catch (StorageObjectException e){
+ } catch (StorageObjectException e){
e.printStackTrace(System.err);
throw new ModuleException(e.toString());
}
import mir.storage.*;
import mircoders.storage.*;
+import mircoders.entity.*;
/*
* ThemenModule -
}
return returnList;
}
+
+ /**
+ * Overrides the AbstractModule.set(),
+ * All dependent ContentEntities are set unproduced.
+ * @param theValues Hash mit Spalte/Wert-Paaren
+ * @return Id des eingefügten Objekts
+ * @exception ModuleException
+ */
+ public String set (HashMap theValues) throws ModuleException {
+ try {
+ Entity theEntity = theStorage.selectById((String)theValues.get("id"));
+ if (theEntity == null){
+ throw new ModuleException("Kein Objekt mit id in Datenbank id: " + theValues.get("id"));
+ }
+ theEntity.setValues(theValues);
+ DatabaseContentToTopics db = DatabaseContentToTopics.getInstance();
+ DatabaseContent dbc = DatabaseContent.getInstance();
+ EntityList contentList = db.getContent((EntityTopics)theEntity);
+ for (int i = 0; i < contentList.size(); i++){
+ dbc.setUnproduced("id="+((EntityContent)contentList.elementAt(i)).getId());
+ }
+ theEntity.update();
+ return theEntity.getId();
+ } catch (StorageObjectException e){
+ e.printStackTrace(System.err);
+ throw new ModuleException(e.toString());
+ }
+ }
}
{
Connection con=null;Statement stmt=null;
String sql = "update content set is_produced='0' where " + where;
+ theLog.printDebugInfo("set unproduced: "+where);
try {
con = getPooledCon();
// should be a preparedStatement because is faster
stmt = con.createStatement();
executeUpdate(stmt,sql);
+ theLog.printDebugInfo("set unproduced: "+where);
}
catch (Exception e) {_throwStorageObjectException(e, "-- set unproduced failed");}
finally { freeConnection(con,stmt);}