001: package de.webman.content.eventhandler;
002:
003: import com.teamkonzept.web.*;
004: import com.teamkonzept.webman.*;
005: import com.teamkonzept.webman.db.TKWebmanDBManager;
006: import com.teamkonzept.webman.mainint.*;
007: import com.teamkonzept.webman.mainint.db.queries.TKDBContentTreeGetParentInfo;
008: import de.webman.content.db.queries.*;
009: import com.teamkonzept.webman.mainint.events.*;
010: import com.teamkonzept.lib.*;
011: import com.teamkonzept.field.*;
012: import com.teamkonzept.field.db.*;
013: import com.teamkonzept.db.*;
014: import de.webman.content.workflow.*;
015: import java.sql.*;
016: import com.teamkonzept.international.LanguageManager;
017: import de.webman.util.legacy.Legacy;
018:
019: /**
020: * Infos über Content anzeigen
021: *
022: * @author $Author: uli $
023: * @version $Revision: 1.11 $
024: */
025: public class CEContentInfoHandler extends DefaultEventHandler implements
026: ParameterTypes, FrameConstants, DatabaseDefaults {
027: private CEContentInfoHandler() {
028: }
029:
030: /** Singleton Instance */
031: private static CEContentInfoHandler instance = new CEContentInfoHandler();
032:
033: public static CEContentInfoHandler getInstance() {
034: return instance;
035: }
036:
037: public void handleEvent(TKEvent evt) throws TKException {
038: try {
039: CEUtils.checkEvent(evt);
040: Integer contentNodeId = new Integer(evt.getParameter(
041: PARAMETER, "CONTENT_NODE_ID"));
042: String type = evt.getParameter(PARAMETER,
043: "CONTENT_NODE_TYPE");
044: String name = evt.getParameter(PARAMETER,
045: "CONTENT_NODE_NAME");
046: TKVector depends = new TKVector();
047: boolean groupDepend = false;
048: // hier noch feststellen - ob ein Mitglied einer Contentgruppe
049: TKQuery q;
050: ResultSet rs;
051: if (type.equals(SINGLE)) {
052: q = TKDBManager
053: .newQuery(TKDBContentTreeGetParentInfo.class);
054: q.setQueryParams("CONTENT_NODE_ID", contentNodeId);
055: q.execute();
056: rs = q.fetchResultSet();
057: rs.next();
058: // Vater informationen lesen
059: String parentType = rs.getString("CONTENT_NODE_TYPE");
060: if (parentType.equals(GROUP)) {
061: // wenn ja, auch noch die Abhaengigkeiten der Gruppe checken
062: Integer groupId = new Integer(rs
063: .getInt("CONTENT_NODE_ID"));
064: if (CEUtils.checkDependencies(groupId, depends,
065: false)) {
066: groupDepend = true;
067: // Dependency gefunden !
068: }
069: }
070: }
071: CEUtils.checkDependencies(contentNodeId, depends, true);
072: TKHTMLTemplate t = evt
073: .getPrepHTMLTemplate("dependency.tmpl");
074: q = TKDBManager.newQuery(SelectContentTreeAndForm.class);
075: q.setQueryParams("CONTENT_NODE_ID", contentNodeId);
076: q.execute();
077: rs = q.fetchResultSet();
078:
079: String text = null;
080:
081: if (rs.next()) {
082: Object[] arguments = new Object[2];
083: arguments[0] = name;
084: arguments[1] = rs.getString("FORM_NAME");
085:
086: text = LanguageManager.getText("content",
087: "CONTENT_DEPENDENCY", arguments);
088: } else {
089: text = LanguageManager.getText("content",
090: "CONTENT_DIRECTORY_DEPENDENCY",
091: new Object[] { name });
092: }
093:
094: t.set("TITLE", text);
095: t.setListIterator(new TKStandardPluginIterator(
096: "REFERENCES", null, depends, false, t
097: .getListIterator()));
098:
099: evt.finishTemplate(t);
100: } catch (Throwable e) {
101: // TO DO : Analyze Exception !
102: throw WebmanExceptionHandler.getException(e);
103: }
104: }
105:
106: public boolean isHandler(TKEvent evt) {
107: return evt.getName().equalsIgnoreCase("CE_INFO");
108: }
109: }
|