1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package olr.presentation;
18
19 import java.util.Iterator;
20 import java.util.List;
21
22 import olr.rdf.Attribute;
23 import olr.rdf.OLR3Definitions;
24 import olr.rdf.Tools;
25
26 import org.w3c.dom.html.HTMLFrameElement;
27 import org.w3c.dom.html.HTMLFrameSetElement;
28
29 import com.lutris.appserver.server.httpPresentation.ClientPageRedirectException;
30 import com.lutris.appserver.server.httpPresentation.HttpPresentationException;
31 import com.lutris.appserver.server.httpPresentation.HttpPresentationRequest;
32
33 /***
34 * @version $Id: ContentReader.java,v 1.9 2004/08/03 08:33:53 roku Exp $
35 */
36 public class ContentReader extends SecureHttpPresentation {
37
38 public String handleDefault() throws HttpPresentationException {
39 return showPage();
40 }
41
42 public String showPage() {
43 ContentReaderHTML page = new ContentReaderHTML();
44 try {
45 HTMLFrameSetElement frameSettings = page.getElementFrameSettings();
46 HTMLFrameElement link = page.getElementLink();
47 HTMLFrameElement header = page.getElementHeader();
48 HTMLFrameElement activities = page.getElementActivities();
49 HTMLFrameElement relations = page.getElementRelations();
50 HttpPresentationRequest request = getComms().request;
51 String aboutURI = request.getParameter("aboutURI");
52 String resource = request.getParameter("resource");
53 String predicate = request.getParameter("predicate");
54 if (aboutURI != null) {
55 header.setSrc("ContentReaderHeader.po?aboutURI=".concat(String.valueOf(String
56 .valueOf(aboutURI))));
57 activities.setSrc("Activities.po?aboutURI=".concat(String.valueOf(String
58 .valueOf(aboutURI))));
59 relations.setSrc("Relations.po?aboutURI=".concat(String.valueOf(String
60 .valueOf(aboutURI))));
61 aboutURI = Tools.IDtoURI(aboutURI);
62 if (predicate != null) {
63 link.setSrc("Index.po?event=Create&resource=" + resource + "&predicate="
64 + predicate);
65 link.getParentNode().appendChild(link.cloneNode(true));
66 frameSettings.setRows("45,*");
67 link.getParentNode().removeChild(link);
68
69 } else {
70
71 final List attributes = getSessionData().getStatementPool()
72 .getSpecificAttributesAbout(aboutURI, OLR3Definitions.OLR3_SHOWLINK);
73
74 if (attributes.size() > 0) {
75 String rows = "45";
76 for (Iterator it = attributes.iterator(); it.hasNext();) {
77 Attribute attribute = (Attribute) it.next();
78
79 link.setSrc(attribute.getObject());
80 link.getParentNode().appendChild(link.cloneNode(true));
81 rows = String.valueOf(String.valueOf(rows)).concat(",*");
82 }
83
84 frameSettings.setRows(rows);
85 link.getParentNode().removeChild(link);
86 }
87 }
88 } else {
89 throw new ClientPageRedirectException("ContentUndefined.html");
90 }
91 } catch (Exception e) {
92 e.printStackTrace();
93 }
94 return page.toDocument();
95 }
96 }