definition_jsp.java 20.3 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479
/*
 * Decompiled with CFR 0_118.
 * 
 * Could not load the following classes:
 *  com.day.crx.i18n.Dictionary
 *  javax.jcr.Item
 *  javax.jcr.Node
 *  javax.jcr.NodeIterator
 *  javax.jcr.Property
 *  javax.jcr.PropertyIterator
 *  javax.jcr.RepositoryException
 *  javax.jcr.Session
 *  javax.jcr.Workspace
 *  javax.jcr.lock.Lock
 *  javax.jcr.nodetype.NodeDefinition
 *  javax.jcr.nodetype.NodeType
 *  javax.jcr.nodetype.PropertyDefinition
 *  javax.servlet.Servlet
 *  javax.servlet.ServletConfig
 *  javax.servlet.ServletContext
 *  javax.servlet.ServletException
 *  javax.servlet.ServletRequest
 *  javax.servlet.ServletResponse
 *  javax.servlet.http.HttpServletRequest
 *  javax.servlet.http.HttpServletResponse
 *  javax.servlet.jsp.JspFactory
 *  javax.servlet.jsp.JspWriter
 *  javax.servlet.jsp.PageContext
 *  javax.servlet.jsp.SkipPageException
 *  org.apache.commons.lang3.StringEscapeUtils
 *  org.apache.jackrabbit.util.Text
 *  org.apache.jasper.runtime.HttpJspBase
 *  org.apache.jasper.runtime.JspSourceDependent
 */
package com.day.crx.explorer.impl.jsp.browser;

import com.day.crx.explorer.impl.j2ee.CRXContext;
import com.day.crx.explorer.impl.j2ee.JCRExplorerServlet;
import com.day.crx.explorer.impl.ui.NodeDefView;
import com.day.crx.explorer.impl.ui.NodeTypeView;
import com.day.crx.explorer.impl.ui.PropertyDefView;
import com.day.crx.i18n.Dictionary;
import java.io.IOException;
import java.util.HashSet;
import java.util.List;
import javax.jcr.Item;
import javax.jcr.Node;
import javax.jcr.NodeIterator;
import javax.jcr.Property;
import javax.jcr.PropertyIterator;
import javax.jcr.RepositoryException;
import javax.jcr.Session;
import javax.jcr.Workspace;
import javax.jcr.lock.Lock;
import javax.jcr.nodetype.NodeDefinition;
import javax.jcr.nodetype.NodeType;
import javax.jcr.nodetype.PropertyDefinition;
import javax.servlet.Servlet;
import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.jsp.JspFactory;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.PageContext;
import javax.servlet.jsp.SkipPageException;
import org.apache.commons.lang3.StringEscapeUtils;
import org.apache.jackrabbit.util.Text;
import org.apache.jasper.runtime.HttpJspBase;
import org.apache.jasper.runtime.JspSourceDependent;

public final class definition_jsp
extends HttpJspBase
implements JspSourceDependent {
    private static List _jspx_dependants;

    private void printNodeTypes(JspWriter out, NodeType[] nts, NodeType[] declared, String docroot) throws IOException {
        int n;
        NodeType[] arrnodeType;
        int n2;
        HashSet<String> decl = new HashSet<String>();
        if (declared != null) {
            arrnodeType = declared;
            n2 = 0;
            n = arrnodeType.length;
            while (n2 < n) {
                NodeType aDeclared = arrnodeType[n2];
                decl.add(aDeclared.getName());
                ++n2;
            }
        }
        arrnodeType = nts;
        n2 = 0;
        n = arrnodeType.length;
        while (n2 < n) {
            NodeType nt = arrnodeType[n2];
            if (declared == null || decl.contains(nt.getName())) {
                this.printNodeType(out, nt, docroot);
                out.print("<br>");
            } else {
                out.print("<font color=\"#888888\">");
                this.printNodeType(out, nt, docroot);
                out.print("</font><br>");
            }
            ++n2;
        }
    }

    private void printNodeType(JspWriter out, NodeType nt, String docroot) throws IOException {
        if (nt != null) {
            out.print("<img align=\"middle\" src=\"" + docroot + JCRExplorerServlet.getNTIcon(nt) + "\">&nbsp;" + StringEscapeUtils.escapeHtml4((String)nt.getName()));
        }
    }

    private void printIsCheckedOut(JspWriter out, Node node) throws IOException {
        try {
            out.print(Boolean.toString(node.isCheckedOut()));
        }
        catch (RepositoryException e) {
            String msg = e.getMessage() == null ? e.toString() : e.getMessage();
            out.print("N/A (" + msg + ")");
        }
    }

    private void printIsLocked(JspWriter out, Node node, Dictionary dict) throws IOException {
        try {
            if (node.isLocked()) {
                out.print(dict.msg("crex.true_by.tit"));
                out.print(node.getLock().getNode().getPath());
            } else {
                out.print(dict.msg("crex.false.lab"));
            }
        }
        catch (RepositoryException e) {
            String msg = e.getMessage() == null ? e.toString() : e.getMessage();
            out.print("N/A (" + msg + ")");
        }
    }

    private void printLockToken(JspWriter out, Node node, Dictionary dict) throws IOException {
        try {
            out.print(node.getLock().getLockToken());
        }
        catch (RepositoryException e) {
            String msg = e.getMessage() == null ? e.toString() : e.getMessage();
            out.print(dict.fmt("crex.na_0.lab", (Object)msg));
        }
    }

    private void printLockOwner(JspWriter out, Node node, Dictionary dict) throws IOException {
        try {
            out.print(node.getLock().getLockOwner());
        }
        catch (RepositoryException e) {
            String msg = e.getMessage() == null ? e.toString() : e.getMessage();
            out.print(dict.fmt("crex.na_0.lab", (Object)msg));
        }
    }

    private void printLockTokens(JspWriter out, Session session) throws IOException {
        String[] lt = session.getLockTokens();
        int i = 0;
        while (i < lt.length) {
            out.print(lt[i]);
            out.print("<br>");
            ++i;
        }
    }

    private void printHoldsLock(JspWriter out, Node node, Dictionary dict) throws IOException {
        try {
            out.print(Boolean.toString(node.holdsLock()));
        }
        catch (RepositoryException e) {
            String msg = e.getMessage() == null ? e.toString() : e.getMessage();
            out.print(dict.fmt("crex.na_0.lab", (Object)msg));
        }
    }

    private void printUUID(JspWriter out, Node node, Dictionary dict) throws IOException {
        try {
            if (node.isNodeType("mix:referenceable")) {
                out.print(node.getUUID());
            } else {
                out.print(dict.msg("crex.not_ref.txt"));
            }
        }
        catch (RepositoryException e) {
            String msg = e.getMessage() == null ? e.toString() : e.getMessage();
            out.print(dict.fmt("crex.na_0.lab", (Object)msg));
        }
    }

    private void printPath(JspWriter out, Item item, String docroot, Dictionary dict) throws IOException {
        try {
            String path = item.getPath();
            StringBuffer uri = new StringBuffer();
            uri.append(docroot).append("/crx/repository/");
            uri.append(item.getSession().getWorkspace().getName());
            uri.append(path);
            out.print("<a target=\"_new\" href=\"");
            out.print(StringEscapeUtils.escapeHtml4((String)uri.toString()));
            out.print("\">");
            out.print(StringEscapeUtils.escapeHtml4((String)path));
            out.print("</a>");
        }
        catch (RepositoryException e) {
            String msg = e.getMessage() == null ? e.toString() : e.getMessage();
            out.print(StringEscapeUtils.escapeHtml4((String)dict.fmt("crex.na_0.lab", (Object)msg)));
        }
    }

    public Object getDependants() {
        return _jspx_dependants;
    }

    /*
     * Unable to fully structure code
     * Enabled aggressive block sorting
     * Enabled unnecessary exception pruning
     * Enabled aggressive exception aggregation
     * Lifted jumps to return sites
     */
    public void _jspService(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
        block21 : {
            block20 : {
                block19 : {
                    _jspxFactory = null;
                    pageContext = null;
                    out = null;
                    _jspx_out = null;
                    _jspx_page_context = null;
                    _jspxFactory = JspFactory.getDefaultFactory();
                    response.setContentType("text/html");
                    _jspx_page_context = pageContext = _jspxFactory.getPageContext((Servlet)this, (ServletRequest)request, (ServletResponse)response, null, false, 8192, true);
                    pageContext.getServletContext();
                    pageContext.getServletConfig();
                    _jspx_out = out = pageContext.getOut();
                    response.setContentType("text/html; charset=utf-8");
                    ctx = CRXContext.getInstance(pageContext, request);
                    repSession = ctx.getSession();
                    if (repSession != null) break block19;
                    if (_jspxFactory == null) return;
                    _jspxFactory.releasePageContext(_jspx_page_context);
                    return;
                }
                docroot = ctx.getDocroot();
                contextPath = request.getContextPath();
                dict = ctx.getCurrentDictionary();
                out.write("<html><head>\n<link rel=\"stylesheet\" href=\"");
                out.print(docroot);
                out.write("/ui/default.css\" type=\"text/css\" title=\"style\" />\n<script type=\"text/javascript\">\nfunction selectItem(id) {\n    var src = \"");
                out.print(docroot);
                out.write("/browser/definition.jsp\";\n    src+=\"?Path=\"+encodeURIComponent(id);\n    src+=\"&_charset_=utf-8\";\n    src+=\"&ck=\" + new Date().valueOf();\n    window.location.href=src;\n    }\nfunction jump(nodePath, property) {\n    window.parent.content.gotoNode(nodePath);\n}\n</script>\n</head><body class=\"frame\">");
                item = ctx.getItem();
                if (item != null) break block20;
                out.write("</body></html>");
                if (_jspxFactory == null) return;
                _jspxFactory.releasePageContext(_jspx_page_context);
                return;
            }
            try {
                if (item.isNode()) ** GOTO lbl49
                property = (Property)item;
                pd = property.getDefinition();
                lengthStr = "";
                if (!property.getDefinition().isMultiple()) ** GOTO lbl47
                lengths = property.getLengths();
                i = 0;
                ** GOTO lbl186
lbl47: // 1 sources:
                lengthStr = String.valueOf(property.getLength());
                break block21;
lbl49: // 1 sources:
                node = (Node)item;
                nodeType = node.getPrimaryNodeType();
                nd = node.getDefinition();
                out.write("<table>\n    <tr><td colspan=\"2\"><b>");
                out.print(dict.msg("crex.node.lab"));
                out.write("</b></td></tr>\n    <tr><td>");
                out.print(dict.msg("crex.name.lab"));
                out.write("</td><td>");
                out.print(StringEscapeUtils.escapeHtml4((String)node.getName()));
                out.write("</td></tr>\n    <tr><td>");
                out.print(dict.msg("crex.path.lab"));
                out.write("</td><td>");
                this.printPath(out, (Item)node, contextPath, dict);
                out.write("</td></tr>\n    <tr><td>");
                out.print(dict.msg("crex.uuid.lab"));
                out.write("</td><td>");
                this.printUUID(out, node, dict);
                out.write("</td></tr>\n    ");
                if (node.isNodeType("mix:referenceable")) {
                    out.write("<tr><td>");
                    out.print(dict.msg("crex.referenced_by.tit"));
                    out.write("</td><td>");
                    nobody = "<i>(none)</i>";
                    iter = node.getReferences();
                    do {
                        if (!iter.hasNext()) {
                            out.print(nobody);
                            out.write("</td></tr>");
                            break;
                        }
                        p = iter.nextProperty();
                        nobody = "";
                        out.write("<a href=\"javascript:jump(decodeURIComponent('");
                        out.print(Text.escape((String)p.getParent().getPath()));
                        out.write("'), decodeURIComponent('");
                        out.print(Text.escape((String)p.getName()));
                        out.write("'))\">");
                        out.print(StringEscapeUtils.escapeHtml4((String)p.getPath()));
                        out.write("</a><br>");
                    } while (true);
                }
                out.write("<tr><td>");
                out.print(dict.msg("crex.depth.lab"));
                out.write("</td><td>");
                out.print(node.getDepth());
                out.write("</td></tr>\n    <tr><td>");
                out.print(dict.msg("crex.numchild.lab"));
                out.write("</td><td>");
                out.print(node.getNodes().getSize());
                out.write("</td></tr>\n    <tr><td>");
                out.print(dict.msg("crex.is_new.tit"));
                out.write("</td><td>");
                out.print(node.isNew());
                out.write("</td></tr>\n    <tr><td>");
                out.print(dict.msg("crex.is_modified.tit"));
                out.write("</td><td>");
                out.print(node.isModified());
                out.write("</td></tr>\n    <tr><td>");
                out.print(dict.msg("crex.is_locked.tit"));
                out.write("</td><td>");
                this.printIsLocked(out, node, dict);
                out.write("</td></tr>\n    <tr><td>");
                out.print(dict.msg("crex.is_checkedout.tit"));
                out.write("</td><td>");
                this.printIsCheckedOut(out, node);
                out.write("</td></tr>\n    ");
                try {
                    if (node.isNodeType("mix:lockable")) {
                        out.write("<tr><td>");
                        out.print(dict.msg("crex.holds_lock.tit"));
                        out.write("</td><td>");
                        this.printHoldsLock(out, node, dict);
                        out.write("</td></tr>\n    <tr><td>");
                        out.print(dict.msg("crex.lock_token.tit"));
                        out.write("</td><td>");
                        this.printLockToken(out, node, dict);
                        out.write("</td></tr>\n    <tr><td>");
                        out.print(dict.msg("crex.lock_owner.tit"));
                        out.write("</td><td>");
                        this.printLockOwner(out, node, dict);
                        out.write("</td></tr>\n    ");
                    }
                }
                catch (Exception v0) {}
                out.write("<tr><td colspan=\"2\"><hr size=\"1\"></td></tr>\n    <tr><td>");
                out.print(dict.msg("crex.primary_nodetype.tit"));
                out.write("</td><td>");
                this.printNodeType(out, node.getPrimaryNodeType(), docroot);
                out.write("</td></tr>\n    ");
                out.write("<tr><td>");
                out.print(dict.msg("crex.mixin_nodetypes.tit"));
                out.write("</td><td>");
                this.printNodeTypes(out, node.getMixinNodeTypes(), null, docroot);
                out.write("</td></tr>\n    <tr><td>");
                out.print(dict.msg("crex.orderable_child_nodes.txt"));
                out.write("</td><td>");
                out.print(node.getPrimaryNodeType().hasOrderableChildNodes());
                out.write("</td></tr>\n    <tr><td>");
                out.print(dict.msg("crex.primary_item_name.txt"));
                out.write("</td><td>");
                out.print(node.getPrimaryNodeType().getPrimaryItemName() == null ? "<i>(none)</i>" : Text.encodeIllegalXMLCharacters((String)node.getPrimaryNodeType().getPrimaryItemName()));
                out.write("</td></tr>\n</table>\n<br><br>\n");
                cnDefs = NodeTypeView.getAgregatedNodeDefs(node);
                prDefs = NodeTypeView.getAgregatedPropertyDefs(node);
                ntView = new NodeTypeView(repSession, JCRExplorerServlet.getDocrootPrefix(request), pageContext);
                ntView.drawBegin();
                ndView = new NodeDefView(ntView);
                ndView.drawTableHeader(dict.msg("crex.applicable_node_definition.txt"), dict.msg("crex.child_node_definition_of_this_node_parent_node_type.txt"));
                ndView.drawNodeDef(nodeType, nd, 1);
                ndView.drawTableFooter();
                ndView.drawTableHeader(dict.msg("crex.child_node_definitions.txt"), dict.msg("crex.combined_child_node_definitions_from_primary_and_mixin_node_types.txt"));
                i = 0;
                do {
                    if (i < cnDefs.length) ** GOTO lbl166
                    ndView.drawTableFooter();
                    pdView = new PropertyDefView(ntView);
                    pdView.drawTableHeader(dict.msg("crex.property_definitions.tit"), dict.msg("crex.combined_property_definitions_from_primary_and_mixin_node_types.txt"));
                    i2 = 0;
                    ** GOTO lbl225
lbl166: // 1 sources:
                    ndView.drawNodeDef(nodeType, cnDefs[i], i + 1);
                    ++i;
                } while (true);
            }
            catch (Throwable t) {
                try {
                    if (t instanceof SkipPageException != false) return;
                    out = _jspx_out;
                    if (out != null && out.getBufferSize() != 0) {
                        out.clearBuffer();
                    }
                    if (_jspx_page_context == null) return;
                    _jspx_page_context.handlePageException(t);
                    return;
                }
                catch (Throwable throwable) {
                    throw throwable;
                }
                finally {
                    if (_jspxFactory != null) {
                        _jspxFactory.releasePageContext(_jspx_page_context);
                    }
                }
            }
lbl-1000: // 1 sources:
            {
                lengthStr = String.valueOf(lengthStr) + (i == 0 ? "" : ", ") + String.valueOf(lengths[i]);
                ++i;
lbl186: // 2 sources:
                ** while (i < lengths.length)
            }
        }
        out.write("<table>\n    <tr><td colspan=\"2\"><b>");
        out.print(dict.msg("crex.property.lab"));
        out.write("</b></td></tr>\n    <tr><td>");
        out.print(dict.msg("crex.name.lab"));
        out.write("</td><td>");
        out.print(StringEscapeUtils.escapeHtml4((String)property.getName()));
        out.write("</td></tr>\n    <tr><td>");
        out.print(dict.msg("crex.path.lab"));
        out.write("</td><td>");
        this.printPath(out, (Item)property, contextPath, dict);
        out.write("</td></tr>\n    <tr><td>");
        out.print(dict.msg("crex.depth.lab"));
        out.write("</td><td>");
        out.print(property.getDepth());
        out.write("</td></tr>\n    <tr><td>");
        out.print(dict.msg("crex.is_new.tit"));
        out.write("</td><td>");
        out.print(property.isNew());
        out.write("</td></tr>\n    <tr><td>");
        out.print(dict.msg("crex.is_modified.tit"));
        out.write("</td><td>");
        out.print(property.isModified());
        out.write("</td></tr>\n    <tr><td>");
        out.print(dict.msg("crex.length.lab"));
        out.write("</td><td>");
        out.print(lengthStr);
        out.write("</td></tr>\n  </table>");
        ntView = new NodeTypeView(repSession, JCRExplorerServlet.getDocrootPrefix(request), pageContext);
        ntView.drawBegin();
        pdView = new PropertyDefView(ntView);
        pdView.drawTableHeader(dict.msg("crex.applicable_property_definition.txt"), dict.msg("crex.property_definition_of_this_property_parent_node_type.txt"));
        pdView.drawPropertyDef(null, pd, 1);
        pdView.drawTableFooter();
        ntView.drawEnd();
        ** GOTO lbl228
lbl-1000: // 1 sources:
        {
            pdView.drawPropertyDef(nodeType, prDefs[i2], i2 + 1);
            ++i2;
lbl225: // 2 sources:
            ** while (i2 < prDefs.length)
        }
lbl226: // 1 sources:
        pdView.drawTableFooter();
        ntView.drawEnd();
lbl228: // 2 sources:
        out.write("</body></html>");
    }
}