deleted obsolete links_imcs
authorrk <rk>
Tue, 22 Apr 2003 14:02:11 +0000 (14:02 +0000)
committerrk <rk>
Tue, 22 Apr 2003 14:02:11 +0000 (14:02 +0000)
source/mir/servlet/ServletModule.java
source/mircoders/entity/EntityLinksImcs.java [deleted file]
source/mircoders/module/ModuleLinksImcs.java [deleted file]
source/mircoders/servlet/ServletModuleLinksImcs.java [deleted file]
source/mircoders/storage/DatabaseLinksImcs.java [deleted file]

index 8569764..12df8a9 100755 (executable)
@@ -477,4 +477,4 @@ public abstract class ServletModule {
       throw new ServletModuleFailure( "ServletModule.getIntersectingValues: " + e.getMessage(), e);
     }
   }
-}
+}
\ No newline at end of file
diff --git a/source/mircoders/entity/EntityLinksImcs.java b/source/mircoders/entity/EntityLinksImcs.java
deleted file mode 100755 (executable)
index 2637140..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright (C) 2001, 2002 The Mir-coders group
- *
- * This file is part of Mir.
- *
- * Mir is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * Mir is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Mir; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with  any library licensed under the Apache Software License, 
- * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library 
- * (or with modified versions of the above that use the same license as the above), 
- * and distribute linked combinations including the two.  You must obey the 
- * GNU General Public License in all respects for all of the code used other than 
- * the above mentioned libraries.  If you modify this file, you may extend this 
- * exception to your version of the file, but you are not obligated to do so.  
- * If you do not wish to do so, delete this exception statement from your version.
- */
-package mircoders.entity;
-
-import java.util.Set;
-
-import mir.entity.Entity;
-import mir.storage.StorageObject;
-import mir.storage.store.StorableObject;
-import mir.storage.store.StoreIdentifier;
-
-/**
- * Diese Klasse enth?lt die Daten eines MetaObjekts
- *
- * @author RK
- * @version 29.6.1999
- */
-
-
-public class EntityLinksImcs extends Entity implements StorableObject
-{
-
-  public EntityLinksImcs(){
-         super();
-  }
-
-  public EntityLinksImcs(StorageObject theStorage)
-  {
-    this();
-    setStorage(theStorage);
-  }
-
-    /**
-   *  Method:       getStoreIdentifier
-   *  Description:  returns unique StoreIdentifer under which the Entity
-   *                is Stored. Based upon primary key and tablename.
-   *
-   *  @return       StoreIdentifier
-   */
-  public StoreIdentifier getStoreIdentifier() {
-    String id = getId();
-    if ( id!=null && theStorageObject!= null )
-     return new StoreIdentifier(this, id+"@"+theStorageObject.getTableName());
-    return null;
-  }
-
-  /**
-   *  Method:       getNotifyOnReleaseSet()
-   *  Description:  returns empty Set, GenericContainer does not implement
-   *                dependencies.
-   *
-   *  @return       null
-   */
-  public Set getNotifyOnReleaseSet() { return null; }
-
-}
-
diff --git a/source/mircoders/module/ModuleLinksImcs.java b/source/mircoders/module/ModuleLinksImcs.java
deleted file mode 100755 (executable)
index 8ddd3c7..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (C) 2001, 2002 The Mir-coders group
- *
- * This file is part of Mir.
- *
- * Mir is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * Mir is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Mir; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with  any library licensed under the Apache Software License, 
- * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library 
- * (or with modified versions of the above that use the same license as the above), 
- * and distribute linked combinations including the two.  You must obey the 
- * GNU General Public License in all respects for all of the code used other than 
- * the above mentioned libraries.  If you modify this file, you may extend this 
- * exception to your version of the file, but you are not obligated to do so.  
- * If you do not wish to do so, delete this exception statement from your version.
- */
-package mircoders.module;
-
-import mir.log.LoggerWrapper;
-import mir.module.AbstractModule;
-import mir.storage.StorageObject;
-import mircoders.storage.DatabaseLinksImcs;
-import freemarker.template.SimpleHash;
-
-/*
- *  ModuleLinksImcs -
- *
- *
- * @author RK
- */
-
-public class ModuleLinksImcs extends AbstractModule
-{
-  static LoggerWrapper logger = new LoggerWrapper("Module.LinksImcs");
-
-  public ModuleLinksImcs(StorageObject theStorage) {
-    this.theStorage = theStorage;
-  }
-
-  public SimpleHash getLinksImcsAsSimpleHash() {
-    return ((DatabaseLinksImcs)theStorage).getHashData();
-  }
-}
\ No newline at end of file
diff --git a/source/mircoders/servlet/ServletModuleLinksImcs.java b/source/mircoders/servlet/ServletModuleLinksImcs.java
deleted file mode 100755 (executable)
index 5b19071..0000000
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- * Copyright (C) 2001, 2002 The Mir-coders group
- *
- * This file is part of Mir.
- *
- * Mir is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * Mir is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Mir; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with  any library licensed under the Apache Software License, 
- * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library 
- * (or with modified versions of the above that use the same license as the above), 
- * and distribute linked combinations including the two.  You must obey the 
- * GNU General Public License in all respects for all of the code used other than 
- * the above mentioned libraries.  If you modify this file, you may extend this 
- * exception to your version of the file, but you are not obligated to do so.  
- * If you do not wish to do so, delete this exception statement from your version.
- */
-package mircoders.servlet;
-
-import java.io.PrintWriter;
-import java.net.URLEncoder;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import mir.entity.EntityList;
-import mir.log.LoggerWrapper;
-import mir.misc.HTMLTemplateProcessor;
-import mir.servlet.ServletModule;
-import mir.servlet.ServletModuleExc;
-import mir.servlet.ServletModuleFailure;
-import mir.storage.StorageObjectFailure;
-import mircoders.module.ModuleLanguage;
-import mircoders.module.ModuleLinksImcs;
-import mircoders.storage.DatabaseLanguage;
-import mircoders.storage.DatabaseLinksImcs;
-import freemarker.template.SimpleHash;
-
-/*
- *  ServletModuleLinksImcs -
- *  liefert HTML fuer LinksImcs
- *
- *
- * @author RK
- */
-
-public class ServletModuleLinksImcs extends ServletModule {
-  private ModuleLanguage languageModule;
-
-  // Singelton / Kontruktor
-  private static ServletModuleLinksImcs instance = new ServletModuleLinksImcs();
-
-  public static ServletModule getInstance() {
-    return instance;
-  }
-
-
-  private ServletModuleLinksImcs() {
-    super();
-    logger = new LoggerWrapper("ServletModule.LinksImcs");
-    templateListString = configuration.getString("ServletModule.LinksImcs.ListTemplate");
-    templateObjektString = configuration.getString("ServletModule.LinksImcs.ObjektTemplate");
-    templateConfirmString = configuration.getString("ServletModule.LinksImcs.ConfirmTemplate");
-
-    try {
-      mainModule = new ModuleLinksImcs(DatabaseLinksImcs.getInstance());
-      languageModule = new ModuleLanguage(DatabaseLanguage.getInstance());
-    }
-    catch (StorageObjectFailure e) {
-      logger.error("Initialization of ServletModuleLinksImcs failed!: " + e.getMessage());
-    }
-  }
-
-  public void add(HttpServletRequest req, HttpServletResponse res) throws ServletModuleExc {
-    try {
-      SimpleHash modelRoot = new SimpleHash();
-      EntityList theParentList;
-      EntityList theLanguageList;
-      int offset = 0;
-
-      theParentList = mainModule.getByWhereClause("to_parent_id=NULL", "title", offset, 1000);
-      theLanguageList = languageModule.getByWhereClause(null, "name", 0);
-
-      modelRoot.put("new", "1");
-      modelRoot.put("parentlist", theParentList);
-      modelRoot.put("languagelist", theLanguageList);
-
-      if (theParentList == null || theParentList.getCount() == 0 || theParentList.getCount() > 1) {
-        HTMLTemplateProcessor.process(res, templateObjektString, modelRoot, res.getWriter(), getLocale(req), getFallbackLocale(req));
-      }
-      else {
-        deliver(req, res, modelRoot, templateObjektString);
-      }
-
-    }
-    catch (Throwable e) {
-      throw new ServletModuleFailure(e);
-    }
-  }
-
-  public void list(HttpServletRequest req, HttpServletResponse res) throws ServletModuleExc {
-    try {
-
-      SimpleHash modelRoot = new SimpleHash();
-      EntityList theParentList;
-      EntityList theImcsList;
-      EntityList theLanguageList;
-      String offsetParam = req.getParameter("offset");
-      String where = "";
-      String offset = "";
-      PrintWriter out = res.getWriter();
-
-      // Parameter auswerten
-      String query_text = req.getParameter("query_text");
-      modelRoot.put("query_text", query_text);
-      if (query_text != null) modelRoot.put("query_text_encoded", URLEncoder.encode(query_text));
-      String query_field = req.getParameter("query_field");
-      modelRoot.put("query_field", query_field);
-      String parent = req.getParameter("to_parent_id");
-      modelRoot.put("to_parent_id", parent);
-      String language = req.getParameter("to_language");
-      modelRoot.put("to_language", language);
-
-      String whereClause = "";
-      boolean isFirst = true;
-      if (query_text != null && !query_text.equalsIgnoreCase("")) {
-        whereClause += "lower(" + query_field + ") like lower('%" + query_text + "%')";
-        isFirst = false;
-      }
-      if (parent != null && !parent.equals("")) {
-        if (isFirst == false) whereClause += " and ";
-        whereClause += "to_parent_id='" + parent + "'";
-        isFirst = false;
-      }
-      if (language != null && !language.equals("")) {
-        if (isFirst == false) whereClause += " and ";
-        whereClause += "to_language='" + language + "'";
-        isFirst = false;
-      }
-
-      // hier offsetcode bearbeiten
-      if (offsetParam != null && !offsetParam.equals("")) {
-        offset = offsetParam;
-      }
-      if (req.getParameter("next") != null) {
-        offset = req.getParameter("nextoffset");
-      }
-      else {
-        if (req.getParameter("prev") != null) {
-          offset = req.getParameter("prevoffset");
-        }
-      }
-
-      if (offset == null || offset.equals("")) offset = "0";
-      modelRoot.put("offset", (new Integer(offset)).toString());
-
-      theParentList = mainModule.getByWhereClause("to_parent_id=NULL", "title", 0, 1000);
-      theImcsList = mainModule.getByWhereClause(whereClause, "title", (new Integer(offset)).intValue());
-      theLanguageList = languageModule.getByWhereClause(null, "name", 0);
-
-      modelRoot.put("parentlist", theParentList);
-      modelRoot.put("imcslist", theImcsList);
-      modelRoot.put("languagelist", theLanguageList);
-      modelRoot.put("count", (new Integer(theImcsList.getCount())).toString());
-      modelRoot.put("from", (new Integer(theImcsList.getFrom())).toString());
-      modelRoot.put("to", (new Integer(theImcsList.getTo())).toString());
-      if (theImcsList.hasNextBatch())
-        modelRoot.put("next", (new Integer(theImcsList.getNextBatch())).toString());
-      if (theImcsList.hasPrevBatch())
-        modelRoot.put("prev", (new Integer(theImcsList.getPrevBatch())).toString());
-
-      HTMLTemplateProcessor.process(res, templateListString, modelRoot, res.getWriter(), getLocale(req), getFallbackLocale(req));
-
-    }
-    catch (Throwable e) {
-      throw new ServletModuleFailure(e);
-    }
-  }
-
-  public void edit(HttpServletRequest req, HttpServletResponse res)
-          throws ServletModuleExc {
-    try {
-
-      SimpleHash modelRoot = new SimpleHash();
-      EntityList parentList;
-      EntityList theLanguageList;
-      int offset = 0;
-      String idParam = req.getParameter("id");
-      String where = "";
-
-      parentList = mainModule.getByWhereClause("to_parent_id=NULL", "title", offset, 1000);
-      theLanguageList = languageModule.getByWhereClause(null, "name", 0);
-
-      modelRoot.put("parentlist", parentList);
-      modelRoot.put("languagelist", theLanguageList);
-      modelRoot.put("entity", mainModule.getById(idParam));
-      modelRoot.put("new", "0");
-      deliver(req, res, modelRoot, templateObjektString);
-
-    }
-    catch (Throwable e) {
-      throw new ServletModuleFailure(e);
-    }
-  }
-
-}
-
diff --git a/source/mircoders/storage/DatabaseLinksImcs.java b/source/mircoders/storage/DatabaseLinksImcs.java
deleted file mode 100755 (executable)
index 85c8144..0000000
+++ /dev/null
@@ -1,249 +0,0 @@
-/*
- * Copyright (C) 2001, 2002 The Mir-coders group
- *
- * This file is part of Mir.
- *
- * Mir is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * Mir is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Mir; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with  any library licensed under the Apache Software License, 
- * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library 
- * (or with modified versions of the above that use the same license as the above), 
- * and distribute linked combinations including the two.  You must obey the 
- * GNU General Public License in all respects for all of the code used other than 
- * the above mentioned libraries.  If you modify this file, you may extend this 
- * exception to your version of the file, but you are not obligated to do so.  
- * If you do not wish to do so, delete this exception statement from your version.
- */
-
-package  mircoders.storage;
-
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.List;
-import java.util.Map;
-
-import mir.entity.Entity;
-import mir.log.LoggerWrapper;
-import mir.storage.Database;
-import mir.storage.StorageObject;
-import mir.storage.StorageObjectFailure;
-import mir.util.JDBCStringRoutines;
-
-
-/**
- * <b>Diese Klasse implementiert die Datenbankverbindung zur MetaObjekt-Tabelle
- *
- *
- */
-public class DatabaseLinksImcs extends Database implements StorageObject {
-
-  private static DatabaseLinksImcs instance;
-
-  public static DatabaseLinksImcs getInstance() {
-    if (instance == null) {
-      synchronized (DatabaseLinksImcs.class) {
-        if (instance == null) {
-          DatabaseLinksImcs newInstance;
-
-          newInstance = new DatabaseLinksImcs();
-          newInstance.myselfDatabase = newInstance;
-          instance = newInstance;
-        }
-      }
-    }
-
-    return instance;
-  }
-
-  private DatabaseLinksImcs() {
-    super();
-
-    logger = new LoggerWrapper("ServletModule.Database.LinksImcs");
-    hasTimestamp = false;
-    theTable = "links_imcs";
-
-    theEntityClass = mircoders.entity.EntityLinksImcs.class;
-  }
-
-  /** @todo toooo much copy/paste in this class //rk  */
-
-  public String insert(Entity theEntity) throws StorageObjectFailure {
-    String returnId = "0";
-    Connection con = null;
-    PreparedStatement pstmt = null;
-    //cache
-    invalidatePopupCache();
-    try {
-      Map theEntityValues = theEntity.getValues();
-      List streamedInput = theEntity.streamedInput();
-      StringBuffer f = new StringBuffer();
-      StringBuffer v = new StringBuffer();
-      String aField, aValue;
-      boolean firstField = true;
-      // make sql-string
-      for (int i = 0; i < getFields().size(); i++) {
-        aField = (String) getFields().get(i);
-        if (!aField.equals(thePKeyName)) {
-          aValue = null;
-          // sonderfaelle
-          if (aField.equals("webdb_create")) {
-            aValue = "NOW()";
-          }
-          else {
-            if (streamedInput != null && streamedInput.contains(aField)) {
-              aValue = "?";
-            }
-            else {
-              if (theEntityValues.containsKey(aField)) {
-                if (aField.equals("to_parent_id")) {
-                  aValue = JDBCStringRoutines.escapeStringLiteral((String) theEntityValues.get(aField));
-                }
-                else {
-                  aValue = "'" + JDBCStringRoutines.escapeStringLiteral((String) theEntityValues.get(aField)) +  "'";
-                }
-              }
-            }
-          }
-          // wenn Wert gegeben, dann einbauen
-          if (aValue != null) {
-            if (firstField == false) {
-              f.append(",");
-              v.append(",");
-            }
-            else {
-              firstField = false;
-            }
-            f.append(aField);
-            v.append(aValue);
-          }
-        }
-      } // end for
-      // insert into db
-      StringBuffer sqlBuf =
-          new StringBuffer("insert into ").append(theTable).append("(").append(f).append(") values (").append(v).append(")");
-      String sql = sqlBuf.toString();
-
-      logger.info("INSERT: " + sql);
-
-      con = getPooledCon();
-      con.setAutoCommit(false);
-      pstmt = con.prepareStatement(sql);
-      if (streamedInput != null) {
-        for (int i = 0; i < streamedInput.size(); i++) {
-          String inputString = (String) theEntityValues.get(streamedInput.get(i));
-          pstmt.setBytes(i + 1, inputString.getBytes());
-        }
-      }
-      pstmt.execute();
-      pstmt = con.prepareStatement(theAdaptor.getLastInsertSQL( (Database)
-          myselfDatabase));
-      ResultSet rs = pstmt.executeQuery();
-      rs.next();
-      returnId = rs.getString(1);
-      theEntity.setId(returnId);
-    }
-    catch (SQLException sqe) {
-      throwSQLException(sqe, "insert");
-    }
-    finally {
-      try {
-        con.setAutoCommit(true);
-      }
-      catch (Exception e) {
-        ;
-      }
-      freeConnection(con, pstmt);
-    }
-    return returnId;
-  }
-
-  public void update(Entity theEntity) throws StorageObjectFailure {
-    Connection con = null;
-    PreparedStatement pstmt = null;
-    List streamedInput = theEntity.streamedInput();
-    Map theEntityValues = theEntity.getValues();
-    String id = theEntity.getId();
-    String aField;
-    StringBuffer fv = new StringBuffer();
-    boolean firstField = true;
-    //cache
-    invalidatePopupCache();
-    // build sql statement
-    for (int i = 0; i < getFields().size(); i++) {
-      aField = (String) metadataFields.get(i);
-      // only normal cases
-      if (! (aField.equals(thePKeyName) || aField.equals("webdb_create") ||
-             aField.equals("webdb_lastchange") ||
-             (streamedInput != null && streamedInput.contains(aField)))) {
-        if (theEntityValues.containsKey(aField)) {
-          if (firstField == false) {
-            fv.append(", ");
-          }
-          else {
-            firstField = false;
-          }
-          if (aField.equals("to_parent_id")) {
-            fv.append(aField).append("=").append(JDBCStringRoutines.escapeStringLiteral((String)theEntityValues.get(aField)));
-          }
-          else {
-            fv.append(aField).append("='").append(JDBCStringRoutines.escapeStringLiteral((String)theEntityValues.get(aField))).append("'");
-          }
-        }
-      }
-    }
-    StringBuffer sql = new StringBuffer("update ").append(theTable).append(
-        " set ").append(fv);
-    // exceptions
-    if (metadataFields.contains("webdb_lastchange")) {
-      sql.append(",webdb_lastchange=NOW()");
-    }
-    if (streamedInput != null) {
-      for (int i = 0; i < streamedInput.size(); i++) {
-        sql.append(",").append(streamedInput.get(i)).append("=?");
-      }
-    }
-    sql.append(" where id=").append(id);
-    logger.info("UPDATE: " + sql);
-    // execute sql
-    try {
-      con = getPooledCon();
-      con.setAutoCommit(false);
-      pstmt = con.prepareStatement(sql.toString());
-      if (streamedInput != null) {
-        for (int i = 0; i < streamedInput.size(); i++) {
-          String inputString = (String) theEntityValues.get(streamedInput.get(i));
-          pstmt.setBytes(i + 1, inputString.getBytes());
-        }
-      }
-      pstmt.executeUpdate();
-    }
-    catch (SQLException sqe) {
-      throwSQLException(sqe, "update");
-    }
-    finally {
-      try {
-        con.setAutoCommit(true);
-      }
-      catch (Exception e) {
-        ;
-      }
-      freeConnection(con, pstmt);
-    }
-  }
-
-}
\ No newline at end of file