You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2015/03/30 14:56:46 UTC
[17/22] isis git commit: ISIS-720: mothballing scimpi
http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/Debug.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/Debug.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/Debug.java
deleted file mode 100644
index c1a01b4..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/Debug.java
+++ /dev/null
@@ -1,479 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.viewer.scimpi.dispatcher.view.debug;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-
-import org.apache.isis.applib.filter.Filter;
-import org.apache.isis.applib.filter.Filters;
-import org.apache.isis.core.commons.debug.DebugBuilder;
-import org.apache.isis.core.commons.debug.DebugHtmlString;
-import org.apache.isis.core.commons.debug.DebugString;
-import org.apache.isis.core.commons.debug.DebuggableWithTitle;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.facetapi.Facet;
-import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-import org.apache.isis.core.metamodel.spec.ActionType;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.SpecificationLoaderSpi;
-import org.apache.isis.core.metamodel.spec.feature.Contributed;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
-import org.apache.isis.core.metamodel.spec.feature.ObjectActionParameter;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.core.metamodel.spec.feature.ObjectMember;
-import org.apache.isis.core.metamodel.util.Dump;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.Dispatcher;
-import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class Debug extends AbstractElementProcessor {
-
- private final Dispatcher dispatcher;
-
- public Debug(final Dispatcher dispatcher) {
- this.dispatcher = dispatcher;
- }
-
- @Override
- public void process(final Request request) {
- if (request.getContext().isDebugDisabled()) {
- return;
- }
-
- final String type = request.getOptionalProperty(TYPE);
-
- final boolean alwaysShow = request.isRequested("force", false);
- if (type != null) {
- if (type.equals("system")) {
- displaySystem(request);
- } else if (type.equals("session")) {
- displaySession(request);
- } else if (type.equals("test")) {
- final DebugBuilder debug = new DebugHtmlString();
- debug.appendTitle("Title");
- debug.appendln("boolean", true);
- debug.appendln("number", 213);
- debug.startSection("Section 1");
- debug.appendln("boolean", false);
- debug.appendln("number", 12348);
- debug.endSection();
- debug.startSection("Section 2");
- debug.appendln("boolean", false);
- debug.appendln("number", 12348);
- debug.appendTitle("Another title");
- debug.appendln("boolean", false);
- debug.appendln("number", 12348);
- debug.endSection();
-
- debug.startSection("Section 3");
- debug.appendln("boolean", false);
- debug.appendln("number", 89878);
- debug.endSection();
- debug.startSection("Subsection 2");
- debug.appendln("boolean", false);
- debug.appendln("number", 12348);
- debug.endSection();
-
- debug.startSection("Section 4");
- debug.appendln("boolean", false);
- debug.indent();
- debug.appendln("boolean", false);
- debug.appendln("number", 12348);
- debug.unindent();
- debug.appendln("number", 12348);
- debug.appendPreformatted("code", "line 1\nline 2\nline 3");
- debug.appendln("A lot of text etc.");
- debug.endSection();
-
- request.appendHtml(debug.toString());
- //request.appendHtml("<pre>" + debug.toString() + "</pre>");
-
- debug.close();
-
- } else if (type.equals("variables")) {
- displayVariables(request);
- } else if (type.equals("dispatcher")) {
- displayDispatcher(request);
- } else if (type.equals("context")) {
- displayContext(request);
- } else if (type.equals("specifications")) {
- listSpecifications(request);
- } else if (type.equals("specification-for")) {
- specificationFor(request);
- } else if (type.equals("specification")) {
- specification(request);
- } else if (type.equals("specification-graph")) {
- specificationGraph(request);
- } else if (type.equals("object-graph")) {
- objectGraph(request);
-
- } else if (type.equals("object")) {
- final String value = request.getOptionalProperty(VALUE);
- final RequestContext context = request.getContext();
- final ObjectAdapter object = context.getMappedObject(value);
- final DebugString str = new DebugString();
- Dump.adapter(object, str);
- Dump.graph(object, IsisContext.getAuthenticationSession(), str);
- request.appendHtml("<h2>" + object.getSpecification().getFullIdentifier() + "</h2>");
- request.appendHtml("<pre class=\"debug\">" + str + "</pre>");
- }
-
- }
-
- if (alwaysShow || request.getContext().getDebug() == RequestContext.Debug.ON) {
-
- final RequestContext context = request.getContext();
-
- final String id = request.getOptionalProperty("object");
- if (id != null) {
- final ObjectAdapter object = context.getMappedObject(id);
- if (object instanceof DebuggableWithTitle) {
- final DebugString debug = new DebugString();
- ((DebuggableWithTitle) object).debugData(debug);
- request.appendHtml("<pre class=\"debug\">" + debug + "</pre>");
- } else {
- request.appendHtml(object.toString());
- }
- }
-
- final String variable = request.getOptionalProperty("variable");
- if (variable != null) {
- final Object object = context.getVariable(variable);
- request.appendHtml(variable + " => " + (object == null ? "null" : object.toString()));
- }
-
- final String list = request.getOptionalProperty("list");
- if (list != null) {
- final DebugString debug = new DebugString();
- context.append(debug, list);
- request.appendHtml(debug.toString());
- }
-
- final String uri = request.getOptionalProperty("uri");
- if (uri != null) {
- request.appendHtml("<pre class=\"debug\">");
- request.appendHtml(context.getUri());
- request.appendHtml("</pre>");
- }
-
- }
- }
-
- protected void objectGraph(final Request request) {
- final String id = request.getOptionalProperty(VALUE);
- final ObjectAdapter object = request.getContext().getMappedObjectOrResult(id);
- request.appendHtml("<h1>Object Graph - " + object + "</h1>");
- request.appendHtml("<pre>");
- final DebugBuilder debug = new DebugString();
- Dump.graph(object, null, debug);
- request.appendHtml(debug.toString());
- request.appendHtml("</pre>");
- }
-
- protected void specificationFor(final Request request) {
- final String id = request.getOptionalProperty(VALUE);
- final ObjectAdapter object = request.getContext().getMappedObjectOrResult(id);
- specification(request, object.getSpecification());
- }
-
- protected void specification(final Request request) {
- final String name = request.getOptionalProperty(VALUE);
- final ObjectSpecification spec = getSpecificationLoader().loadSpecification(name);
- specification(request, spec);
- }
-
- private void specification(final Request request, final ObjectSpecification spec) {
- request.appendHtml("<h1>Specification - " + spec.getFullIdentifier() + "</h1>");
- request.appendHtml("<p><a href=\"./debug.shtml?type=specification-graph&value=" + spec.getFullIdentifier() + "\">Specification Graph</a></p>");
- final DebugBuilder debug = new DebugHtmlString();
- specification(spec, debug);
- request.appendHtml(debug.toString());
- }
-
- protected void specificationGraph(final Request request) {
- final String name = request.getOptionalProperty(VALUE);
- final ObjectSpecification spec = getSpecificationLoader().loadSpecification(name);
- request.appendHtml("<h1>Specification Graph - " + spec.getFullIdentifier() + "</h1>");
- request.appendHtml("<p><a href=\"./debug.shtml?type=specification&value=" + spec.getFullIdentifier() + "\">Full Specification</a></p>");
- request.appendHtml("<pre>");
- final DebugBuilder debug = new DebugString();
- debug.appendln(spec.getFullIdentifier());
- debug.indent();
- specificationGraph(spec, debug, new ArrayList<ObjectSpecification>());
- debug.unindent();
- request.appendHtml(debug.toString());
- request.appendHtml("</pre>");
- }
-
- private void displayContext(final Request request) {
- request.appendHtml("<h1>Context</h1>");
- final DebugHtmlString debugString = new DebugHtmlString();
- request.getContext().append(debugString);
- debugString.close();
- request.appendHtml(debugString.toString());
- }
-
- private void displayDispatcher(final Request request) {
- request.appendHtml("<h1>Dispatcher</h1>");
- final DebugHtmlString debugString = new DebugHtmlString();
- dispatcher.debug(debugString);
- debugString.close();
- request.appendHtml(debugString.toString());
- }
-
- protected void displayVariables(final Request request) {
- request.appendHtml("<h1>Variables</h1>");
- final DebugHtmlString debug = new DebugHtmlString();
- final RequestContext context = request.getContext();
- context.append(debug, "variables");
- debug.close();
- request.appendHtml(debug.toString());
- }
-
- protected void displaySystem(final Request request) {
- request.appendHtml("<h1>System</h1>");
- final DebuggableWithTitle[] debugItems = IsisContext.debugSystem();
- for (final DebuggableWithTitle debug : debugItems) {
- final DebugHtmlString debugBuffer = new DebugHtmlString();
- debugBuffer.startSection(debug.debugTitle());
- debug.debugData(debugBuffer);
- debugBuffer.endSection();
- debugBuffer.close();
- request.appendHtml(debugBuffer.toString());
- }
- }
-
- protected void displaySession(final Request request) {
- request.appendHtml("<h1>Session</h1>");
- final DebuggableWithTitle[] debugItems = IsisContext.debugSession();
- for (final DebuggableWithTitle debug : debugItems) {
- final DebugHtmlString debugBuffer = new DebugHtmlString();
- debugBuffer.startSection(debug.debugTitle());
- debug.debugData(debugBuffer);
- debugBuffer.endSection();
- debugBuffer.close();
- request.appendHtml(debugBuffer.toString());
- }
- }
-
- protected void listSpecifications(final Request request) {
- request.appendHtml("<h1>Specifications</h1>");
- final List<ObjectSpecification> fullIdentifierList = new ArrayList<ObjectSpecification>(getSpecificationLoader().allSpecifications());
- Collections.sort(fullIdentifierList, ObjectSpecification.COMPARATOR_SHORT_IDENTIFIER_IGNORE_CASE);
- final DebugHtmlString debug = new DebugHtmlString();
- for (final ObjectSpecification spec : fullIdentifierList) {
- final String name = spec.getSingularName();
- debug.appendln(name, specificationLink(spec));
- }
- debug.close();
- request.appendHtml(debug.toString());
- }
-
- private String specificationLink(final ObjectSpecification specification) {
- if (specification == null) {
- return "none";
- } else {
- final String name = specification.getFullIdentifier();
- return "<a href=\"./debug.shtml?type=specification&value=" + name + "\">" + name + "</a>";
- }
- }
-
- protected SpecificationLoaderSpi getSpecificationLoader() {
- return IsisContext.getSpecificationLoader();
- }
-
- @Override
- public String getName() {
- return "debug";
- }
-
- private void specificationGraph(final ObjectSpecification spec, final DebugBuilder view, final ArrayList<ObjectSpecification> visited) {
- final List<ObjectAssociation> fields = new ArrayList<ObjectAssociation>(spec.getAssociations(Contributed.EXCLUDED));
- Collections.sort(fields, new Comparator<ObjectAssociation>() {
- @Override
- public int compare(final ObjectAssociation o1, final ObjectAssociation o2) {
- return o1.getName().compareTo(o2.getName());
- }
- });
- for (int i = 0; i < fields.size(); i++) {
- final ObjectAssociation field = fields.get(i);
- final ObjectSpecification specification = field.getSpecification();
- if (!specification.isValue()) {
- final boolean contains = visited.contains(specification);
- final String aggregated = specification.isParented() ? "++" : "";
- view.appendln(aggregated + field.getName() + " (<a href=\"./debug.shtml?type=specification-graph&value=" + specification.getFullIdentifier() + "\">" + specification.getFullIdentifier() + "</a>" + (contains ? "..." : "") + ")");
- if (!contains) {
- visited.add(specification);
- view.indent();
- specificationGraph(specification, view, visited);
- view.unindent();
- }
- }
- }
-
- }
-
- private void specification(final ObjectSpecification spec, final DebugBuilder view) {
- view.startSection("Summary");
- view.appendln("Hash code", "#" + Integer.toHexString(spec.hashCode()));
- view.appendln("ID", spec.getIdentifier());
- view.appendln("Full name", spec.getFullIdentifier());
- view.appendln("Short name", spec.getShortIdentifier());
- view.appendln("Singular name", spec.getSingularName());
- view.appendln("Plural name", spec.getPluralName());
- view.appendln("Description", spec.getDescription());
-
- view.appendln("Type", "?");
- view.appendln("Value/aggregated", String.valueOf(!spec.isValueOrIsParented()));
-
- view.appendln("Parent specification", specificationLink(spec.superclass()));
- specificationClasses(view, "Child specifications", spec.subclasses());
- specificationClasses(view, "Implemented interfaces", spec.interfaces());
- speficationFacets(view, spec);
-
- final List<ObjectAssociation> fields = spec.getAssociations(Contributed.EXCLUDED);
- specificationMembers(view, "Fields", fields);
- final List<ObjectAction> userActions = spec.getObjectActions(ActionType.USER, Contributed.INCLUDED, Filters.<ObjectAction>any());
- specificationMembers(view, "User Actions", userActions);
- specificationMembers(view, "Exploration Actions", spec.getObjectActions(ActionType.EXPLORATION, Contributed.INCLUDED, Filters.<ObjectAction>any()));
- specificationMembers(view, "Prototype Actions", spec.getObjectActions(ActionType.PROTOTYPE, Contributed.INCLUDED, Filters.<ObjectAction>any()));
- specificationMembers(view, "Debug Actions", spec.getObjectActions(ActionType.DEBUG, Contributed.INCLUDED, Filters.<ObjectAction>any()));
- view.endSection();
-
- view.startSection("Fields");
- for (int i = 0; i < fields.size(); i++) {
- final ObjectAssociation field = fields.get(i);
- view.appendTitle("<span id=\"" + field.getId() + "\"><em>Field:</em> " + field.getId() + "</span>");
- view.appendln("ID", field.getIdentifier());
- view.appendln("Short ID", field.getId());
- view.appendln("Name", field.getName());
- view.appendln("Specification", specificationLink(field.getSpecification()));
-
- view.appendln("Type", field.isOneToManyAssociation() ? "Collection" : field.isOneToOneAssociation() ? "Object" : "Unknown");
- view.appendln("Flags", (field.isAlwaysHidden() ? "" : "Visible ") + (field.isNotPersisted() ? "Not-Persisted " : " ") + (field.isMandatory() ? "Mandatory " : ""));
-
- speficationFacets(view, field);
- }
- view.endSection();
-
- view.startSection("Actions");
- for (int i = 0; i < userActions.size(); i++) {
- final ObjectAction action = userActions.get(i);
- view.appendTitle("<span id=\"" + action.getId() + "\"><em>Action:</em> " + action.getId() + "</span>");
- view.appendln("ID", action.getIdentifier());
- view.appendln("Short ID", action.getId());
- view.appendln("Name", action.getName());
- view.appendln("Specification", specificationLink(action.getSpecification()));
-
- view.appendln("On type", specificationLink(action.getOnType()));
-
- final ObjectSpecification returnType = action.getReturnType();
- view.appendln("Returns", returnType == null ? "VOID" : specificationLink(returnType));
-
- speficationFacets(view, action);
-
- final List<ObjectActionParameter> parameters = action.getParameters();
- if (parameters.size() == 0) {
- view.appendln("Parameters", "none");
- } else {
- final StringBuffer buffer = new StringBuffer();
- final List<ObjectActionParameter> p = action.getParameters();
- for (int j = 0; j < parameters.size(); j++) {
- buffer.append(p.get(j).getName());
- buffer.append(" (");
- buffer.append(specificationLink(parameters.get(j).getSpecification()));
- buffer.append(")");
- view.appendln("Parameters", buffer.toString());
-
- view.indent();
- final Class<? extends Facet>[] parameterFacets = p.get(j).getFacetTypes();
- for (final Class<? extends Facet> parameterFacet : parameterFacets) {
- view.append(p.get(j).getFacet(parameterFacet).toString());
- }
- view.unindent();
- }
- }
- }
- }
-
- private void specificationClasses(final DebugBuilder view, final String label, final List<ObjectSpecification> subclasses) {
- final StringBuffer buffer = new StringBuffer();
- if (subclasses.size() == 0) {
- buffer.append("none");
- } else {
- for (int i = 0; i < subclasses.size(); i++) {
- buffer.append(specificationLink(subclasses.get(i)) + "<br>");
- }
- }
- view.appendln(label, buffer.toString());
- }
-
- private void specificationMembers(final DebugBuilder view, final String label, final List<? extends ObjectMember> members) {
- final StringBuffer buffer = new StringBuffer();
- if (members.size() == 0) {
- buffer.append("none");
- } else {
- for (int i = 0; i < members.size(); i++) {
- final ObjectMember member = members.get(i);
- buffer.append("<a href=\"#" + members.get(i).getId() + "\">" + member.getId() + "</a> <small>");
- buffer.append(member.isAlwaysHidden() ? "" : "Visible ");
- if (member.isPropertyOrCollection()) {
- buffer.append(((ObjectAssociation) member).isNotPersisted() ? "Not-Persisted " : " ");
- buffer.append(((ObjectAssociation) member).isMandatory() ? "Mandatory " : "");
- }
- buffer.append("</small></a><br>");
- }
- }
- view.appendln(label, buffer.toString());
- }
-
- private void speficationFacets(final DebugBuilder view, final FacetHolder facetHolder) {
- final List<Facet> facets = facetHolder.getFacets(new Filter<Facet>() {
- @Override
- public boolean accept(final Facet facet) {
- return true;
- }
- });
- final StringBuffer buffer = new StringBuffer();
- if (facets == null || facets.size() == 0) {
- buffer.append("none");
- } else {
- Collections.sort(facets, new Comparator<Facet>() {
- @Override
- public int compare(final Facet o1, final Facet o2) {
- final String facetType1 = o1.facetType().getName();
- final String facetType2 = o2.facetType().getName();
- return facetType1.substring(facetType1.lastIndexOf('.') + 1).compareTo(facetType2.substring(facetType2.lastIndexOf('.') + 1));
- }
- });
- for (final Facet facet : facets) {
- final String facetType = facet.facetType().getName();
- buffer.append("<span class=\"facet-type\">" + facetType.substring(facetType.lastIndexOf('.') + 1) + "</span>: " + facet + "<br>");
- }
- }
- view.appendln("Facets", buffer.toString());
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/DebugAccessCheck.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/DebugAccessCheck.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/DebugAccessCheck.java
deleted file mode 100644
index 796faf0..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/DebugAccessCheck.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.viewer.scimpi.dispatcher.view.debug;
-
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.ForbiddenException;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class DebugAccessCheck extends AbstractElementProcessor {
-
- @Override
- public void process(final Request request) {
- if (request.getContext().isDebugDisabled()) {
- throw new ForbiddenException("Debug is disabled");
- }
- }
-
- @Override
- public String getName() {
- return "debug-access-check";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/DebugCollectionView.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/DebugCollectionView.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/DebugCollectionView.java
deleted file mode 100644
index 9137783..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/DebugCollectionView.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.viewer.scimpi.dispatcher.view.debug;
-
-import java.util.List;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractObjectProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-import org.apache.isis.viewer.scimpi.dispatcher.view.HelpLink;
-import org.apache.isis.viewer.scimpi.dispatcher.view.field.LinkedObject;
-
-public class DebugCollectionView extends AbstractObjectProcessor {
-
- @Override
- public void process(final Request request, final ObjectAdapter object) {
- final String cls = request.getOptionalProperty(CLASS, "form");
- final String classString = " class=\"" + cls + "\"";
- String title = request.getOptionalProperty(FORM_TITLE);
- final String oddRowClass = request.getOptionalProperty(ODD_ROW_CLASS);
- final String evenRowClass = request.getOptionalProperty(EVEN_ROW_CLASS);
- final boolean showIcons = request.isRequested(SHOW_ICON, true);
-
- }
-
- private void write(final Request request, final ObjectAdapter object, final List<ObjectAssociation> fields,
- final LinkedObject[] linkFields, final String classString, final String title, final String oddRowClass,
- final String evenRowClass, final boolean showIcons) {
- request.appendHtml("<div" + classString + ">");
- if (title != null) {
- request.appendHtml("<div class=\"title\">");
- request.appendAsHtmlEncoded(title);
- request.appendHtml("</div>");
- HelpLink.append(request, object.getSpecification().getDescription(), object.getSpecification().getHelp());
- }
- /*
- final List<ObjectAssociation> fields =
- tag.includedFields(object.getSpecification().getAssociations(
- ObjectAssociationFilters.STATICALLY_VISIBLE_ASSOCIATIONS));
- final LinkedObject[] linkFields = tag.linkedFields(fields);
-
- String linkAllView = request.getOptionalProperty(LINK);
- if (linkAllView != null) {
- linkAllView = request.getContext().fullUriPath(linkAllView);
- for (int i = 0; i < linkFields.length; i++) {
- final boolean isObject = fields.get(i).isOneToOneAssociation();
- final boolean isNotParseable =
- !fields.get(i).getSpecification().containsFacet(ParseableFacet.class);
- linkFields[i] = isObject && isNotParseable ? new LinkedObject(linkAllView) : null;
- }
- }
-
-
-
- int row = 1;
- for (int i = 0; i < fields.size(); i++) {
- final ObjectAssociation field = fields.get(i);
- if (ignoreField(field)) {
- continue;
- }
- if (field.isVisible(IsisContext.getAuthenticationSession(), object).isVetoed()) {
- continue;
- }
-
- final String description =
- field.getDescription().equals("") ? "" : "title=\"" + field.getDescription() + "\"";
- String cls;
- if (row++ % 2 == 1) {
- cls = " class=\"field " + (oddRowClass == null ? ODD_ROW_CLASS : oddRowClass) + "\"";
- } else {
- cls = " class=\"field " + (evenRowClass == null ? EVEN_ROW_CLASS : evenRowClass) + "\"";
- }
- request.appendHtml("<div " + cls + description + "><span class=\"label\">");
- request.appendAsHtmlEncoded(field.getName());
- request.appendHtml(":</span>");
- final LinkedObject linkedObject = linkFields[i];
- addField(request, object, field, linkedObject, showIcons);
- HelpLink.append(request, field.getDescription(), field.getHelp());
- request.appendHtml("</div>");
- }
- */
- request.appendHtml("</div>");
-
- }
-
-
- @Override
- public String getName() {
- return "debug-collection";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/DebugObjectView.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/DebugObjectView.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/DebugObjectView.java
deleted file mode 100644
index 020377d..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/DebugObjectView.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.viewer.scimpi.dispatcher.view.debug;
-
-import java.util.Collection;
-import java.util.List;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.version.Version;
-import org.apache.isis.core.metamodel.facets.object.parseable.ParseableFacet;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.feature.Contributed;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractObjectProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext.Scope;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-import org.apache.isis.viewer.scimpi.dispatcher.view.display.FieldValue;
-import org.apache.isis.viewer.scimpi.dispatcher.view.field.LinkedObject;
-
-
-public class DebugObjectView extends AbstractObjectProcessor {
-
- @Override
- public void process(final Request request, final ObjectAdapter object) {
- final String classString = " class=\"" + request.getOptionalProperty(CLASS, "form debug") + "\"";
- final String objectLink = request.getOptionalProperty(OBJECT + "-" + LINK_VIEW, request.getViewPath());
- // final String collectionLink = request.getOptionalProperty(COLLECTION + "-" + LINK_VIEW, request.getViewPath());
- final String oddRowClass = request.getOptionalProperty(ODD_ROW_CLASS);
- final String evenRowClass = request.getOptionalProperty(EVEN_ROW_CLASS);
- final boolean showIcons = request.isRequested(SHOW_ICON, true);
-
- ObjectSpecification specification = object.getSpecification();
-
- request.appendHtml("<div" + classString + ">");
- request.appendHtml("<div class=\"title\">");
- request.appendAsHtmlEncoded(specification.getSingularName() + " - " + specification.getFullIdentifier());
- request.appendHtml("</div>");
-
- Version version = object.getVersion();
- request.appendHtml("<div class=\"version\">");
- request.appendAsHtmlEncoded("#" + version.sequence() + " - " + version.getUser() + " (" + version.getTime() + ")" );
- request.appendHtml("</div>");
-
- final List<ObjectAssociation> fields = specification.getAssociations(Contributed.EXCLUDED, ObjectAssociation.Filters.ALL);
-
- int row = 1;
- for (int i = 0; i < fields.size(); i++) {
- final ObjectAssociation field = fields.get(i);
- /*
- * if (field.isVisible(IsisContext.getAuthenticationSession(), object).isVetoed()) { continue; }
- */
- String cls;
- if (row++ % 2 == 1) {
- cls = " class=\"field " + (oddRowClass == null ? ODD_ROW_CLASS : oddRowClass) + "\"";
- } else {
- cls = " class=\"field " + (evenRowClass == null ? EVEN_ROW_CLASS : evenRowClass) + "\"";
- }
- request.appendHtml("<div " + cls + "><span class=\"label\">");
- request.appendAsHtmlEncoded(field.getName());
- request.appendHtml(":</span>");
-
- final boolean isNotParseable =
- !fields.get(i).getSpecification().containsFacet(ParseableFacet.class);
- LinkedObject linkedObject = null;
- if (isNotParseable) {
- // linkedObject = new LinkedObject(field.isOneToManyAssociation() ? collectionLink : objectLink);
- linkedObject = new LinkedObject(objectLink);
- }
- addField(request, object, field, linkedObject, showIcons);
-
- if (field.isOneToManyAssociation()) {
- Collection collection = (Collection) field.get(object).getObject();
- if (collection.size() == 0) {
- request.appendHtml("[empty]");
- } else {
- // request.appendHtml(collection.size() + " elements");
-
- request.appendHtml("<ol>");
-
- for (Object element : collection) {
- ObjectAdapter adapterFor = IsisContext.getPersistenceSession().getAdapterManager().getAdapterFor(element);
- IsisContext.getPersistenceSession().resolveImmediately(adapterFor);
-
- String id = request.getContext().mapObject(adapterFor, linkedObject.getScope(), Scope.INTERACTION);
-
- request.appendHtml("<li class=\"element\">");
- request.appendHtml("<a href=\"" + linkedObject.getForwardView() + "?" + linkedObject.getVariable() + "="
- + id + request.getContext().encodedInteractionParameters() + "\">");
- request.appendHtml(element.toString());
- request.appendHtml("</a></li>");
- }
- request.appendHtml("</ol>");
- }
- } else {
- FieldValue.write(request, object, field, linkedObject, "value", showIcons, 0);
- }
-
-
-
- request.appendHtml("</div>");
- }
- request.appendHtml("</div>");
- }
-
- protected void addField(
- final Request request,
- final ObjectAdapter object,
- final ObjectAssociation field,
- final LinkedObject linkedObject,
- final boolean showIcons) {
- }
-
- @Override
- public String getName() {
- return "debug-object";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/DebuggerLink.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/DebuggerLink.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/DebuggerLink.java
deleted file mode 100644
index 795d272..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/DebuggerLink.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.viewer.scimpi.dispatcher.view.debug;
-
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class DebuggerLink extends AbstractElementProcessor {
-
- @Override
- public void process(final Request request) {
- if (request.getContext().isDebugDisabled()) {
- request.skipUntilClose();
- return;
- }
-
- final RequestContext context = request.getContext();
- final Object result = context.getVariable(RequestContext.RESULT);
- request.appendHtml("<div class=\"debug\">");
- request.appendHtml("<a class=\"debug-link\" href=\"/debug/debug.shtml\" target=\"debug\" title=\"debug\" >...</a>");
- if (result != null) {
- request.appendHtml(" <a href=\"/debug/object.shtml?_result=" + result + "\" target=\"debug\" title=\"debug instance\">...</a>");
- }
- request.appendHtml(" <span class=\"debug-link\" onclick=\"$('#page-debug').toggle()\" alt=\"show/hide debug details\">...</span>");
- request.appendHtml("</div>");
-
- request.processUtilCloseTag();
- }
-
- @Override
- public String getName() {
- return "debugger";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/Diagnostics.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/Diagnostics.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/Diagnostics.java
deleted file mode 100644
index 037812e..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/Diagnostics.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.viewer.scimpi.dispatcher.view.debug;
-
-import org.apache.isis.core.commons.authentication.AuthenticationSession;
-import org.apache.isis.core.commons.debug.DebugHtmlString;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class Diagnostics extends AbstractElementProcessor {
-
- @Override
- public void process(final Request request) {
- if (request.getContext().isDebugDisabled()) {
- return;
- }
-
- final String type = request.getOptionalProperty(TYPE, "page");
- final boolean isForced = request.isRequested("force");
- if (isForced || request.getContext().showDebugData()) {
- request.appendHtml("<div class=\"debug\">");
- if ("page".equals(type)) {
- request.appendHtml("<pre>");
- final RequestContext context = request.getContext();
- request.appendHtml("URI: " + context.getUri());
- request.appendHtml("\n");
- request.appendHtml("File: " + context.fullFilePath(context.getResourceFile()));
- final String result = (String) request.getContext().getVariable(RequestContext.RESULT);
- if (result != null) {
- request.appendHtml("\n");
- request.appendHtml("Object: " + result);
- }
- request.appendHtml("</pre>");
- } else if ("session".equals(type)) {
- request.appendHtml("<pre>");
- final AuthenticationSession session = IsisContext.getAuthenticationSession();
- request.appendHtml("Session: " + session.getUserName() + " " + session.getRoles());
- request.appendHtml("</pre>");
- } else if ("variables".equals(type)) {
- final RequestContext context = request.getContext();
- final DebugHtmlString debug = new DebugHtmlString();
- debug.appendln("", "");
- context.append(debug, "variables");
- debug.close();
- request.appendHtml(debug.toString());
- } else if ("processing".equals(type)) {
- request.appendHtml("<pre>");
- request.appendHtml(request.getContext().getDebugTrace());
- request.appendHtml("</pre>");
- } else {
- request.appendHtml("<i>No such type " + type + "</i>");
- }
- request.appendHtml("</div>");
- }
- }
-
- @Override
- public String getName() {
- return "diagnostics";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/Log.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/Log.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/Log.java
deleted file mode 100644
index 92db889..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/Log.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.viewer.scimpi.dispatcher.view.debug;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class Log extends AbstractElementProcessor {
-
- @Override
- public void process(final Request request) {
- String name = request.getRequiredProperty(NAME);
- Logger logger = LoggerFactory.getLogger(name);
-
- request.pushNewBuffer();
- request.processUtilCloseTag();
- final String message = request.popBuffer();
- logger.info(message);
- }
-
- @Override
- public String getName() {
- return "log";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/LogLevel.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/LogLevel.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/LogLevel.java
deleted file mode 100644
index 66e2d6d..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/LogLevel.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.viewer.scimpi.dispatcher.view.debug;
-
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class LogLevel extends AbstractElementProcessor {
-
- @Override
- public void process(final Request request) {
-
- String view = request.getOptionalProperty(VIEW, request.getViewPath());
- view = request.getContext().fullFilePath(view);
- final org.apache.log4j.Level level = org.apache.log4j.LogManager.getRootLogger().getLevel();
- final boolean showSelector = request.isRequested(SHOW_SELECT, true);
- if (showSelector) {
- request.appendHtml("<form action=\"log.app\" type=\"post\" >");
- request.appendHtml("<input type=\"hidden\" name=\"view\" value=\"" + view + "\" />");
- request.appendHtml("<select name=\"level\">");
- for (final org.apache.log4j.Level l : new org.apache.log4j.Level[] { org.apache.log4j.Level.OFF, org.apache.log4j.Level.FATAL, org.apache.log4j.Level.ERROR, org.apache.log4j.Level.WARN, org.apache.log4j.Level.INFO, org.apache.log4j.Level.DEBUG, org.apache.log4j.Level.TRACE }) {
- final String settings = level + "\"" + (level == l ? " selected=\"selected\" " : "");
- request.appendHtml("<option " + settings + ">" + l + "</option>");
- }
- request.appendHtml("<input type=\"submit\" value=\"Change Level\" />");
- request.appendHtml("</select>");
- request.appendHtml("</form>");
- } else {
- request.appendHtml(level.toString());
- }
- }
-
- @Override
- public String getName() {
- return "log-level";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/Members.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/Members.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/Members.java
deleted file mode 100644
index 54ff196..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/Members.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.viewer.scimpi.dispatcher.view.debug;
-
-import java.util.List;
-
-import org.apache.isis.applib.annotation.Where;
-import org.apache.isis.applib.filter.Filters;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.spec.ActionType;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.feature.Contributed;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
-import org.apache.isis.core.metamodel.spec.feature.ObjectActionParameter;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.ForbiddenException;
-import org.apache.isis.viewer.scimpi.dispatcher.ScimpiException;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class Members extends AbstractElementProcessor {
-
- // REVIEW: should provide this rendering context, rather than hardcoding.
- // the net effect currently is that class members annotated with
- // @Hidden(where=Where.ANYWHERE) or @Disabled(where=Where.ANYWHERE) will indeed
- // be hidden/disabled, but will be visible/enabled (perhaps incorrectly)
- // for any other value for Where
- private final Where where = Where.ANYWHERE;
-
- @Override
- public String getName() {
- return "members";
- }
-
- @Override
- public void process(final Request request) {
- if (request.getContext().isDebugDisabled()) {
- return;
- }
-
- final String id = request.getOptionalProperty(OBJECT);
- final String fieldName = request.getOptionalProperty(FIELD);
- request.appendHtml("<pre class=\"debug\">");
- try {
- ObjectAdapter object = request.getContext().getMappedObjectOrResult(id);
- ObjectAssociation field = null;
- if (fieldName != null) {
- field = object.getSpecification().getAssociation(fieldName);
- if (field.isVisible(IsisContext.getAuthenticationSession(), object, where).isVetoed()) {
- throw new ForbiddenException(field, ForbiddenException.VISIBLE);
- }
- object = field.get(object);
- }
- request.processUtilCloseTag();
-
- final ObjectSpecification specification = field == null ? object.getSpecification() : field.getSpecification();
-
- request.appendHtml(specification.getSingularName() + " (" + specification.getFullIdentifier() + ") \n");
- final List<ObjectAssociation> fields = specification.getAssociations(Contributed.EXCLUDED);
- for (final ObjectAssociation fld : fields) {
- if (!fld.isAlwaysHidden()) {
- request.appendHtml(" " + fld.getId() + " - '" + fld.getName() + "' -> " + fld.getSpecification().getSingularName() + (fld.isOneToManyAssociation() ? " (collection of)" : "") + "\n");
- }
- }
- request.appendHtml(" --------------\n");
- final List<ObjectAction> actions = specification.getObjectActions(
- ActionType.USER, Contributed.INCLUDED, Filters.<ObjectAction>any());
- ;
- for (final ObjectAction action : actions) {
- request.appendHtml(" " + action.getId() + " (");
- boolean first = true;
- for (final ObjectActionParameter parameter : action.getParameters()) {
- if (!first) {
- request.appendHtml(", ");
- }
- request.appendHtml(parameter.getSpecification().getSingularName());
- first = false;
- }
- request.appendHtml(")" + " - '" + action.getName() + "'");
- if (action.getSpecification() != null) {
- request.appendHtml(" -> " + action.getSpecification().getSingularName() + ")");
- }
- request.appendHtml("\n");
- }
- } catch (final ScimpiException e) {
- request.appendHtml("Debug failed: " + e.getMessage());
- }
- request.appendHtml("</pre>");
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/ShowDebug.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/ShowDebug.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/ShowDebug.java
deleted file mode 100644
index 895f9a6..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/ShowDebug.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.viewer.scimpi.dispatcher.view.debug;
-
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class ShowDebug extends AbstractElementProcessor {
-
- @Override
- public void process(final Request request) {
- if (request.getContext().isDebugDisabled()) {
- request.skipUntilClose();
- } else {
- request.processUtilCloseTag();
- }
- }
-
- @Override
- public String getName() {
- return "show-debug";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/Specification.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/Specification.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/Specification.java
deleted file mode 100644
index 0974fe4..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/Specification.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.viewer.scimpi.dispatcher.view.debug;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.isis.core.commons.lang.StringExtensions;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.feature.Contributed;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-
-public class Specification extends AbstractElementProcessor {
-
- @Override
- public void process(final Request request) {
- final RequestContext context = request.getContext();
- if (context.isDebugDisabled()) {
- return;
- }
-
- if (request.isRequested("always") || context.getDebug() == RequestContext.Debug.ON) {
- request.appendHtml("<div class=\"debug\">");
- request.appendHtml("<pre>");
-
- final String id = request.getOptionalProperty("object");
- final ObjectAdapter object = context.getMappedObjectOrResult(id);
- final ObjectSpecification specification = object.getSpecification();
- String type = request.getOptionalProperty(TYPE, "details");
-
- if (type.equals("graph")) {
- specificationGraph(request, specification, null, new ArrayList<ObjectSpecification>(), 0);
- } else if (type.equals("details")) {
- specificationDetails(request, specification);
- } else {
- request.appendHtml("invalid type: " + type);
- }
-
- request.appendHtml("</pre>");
- request.appendHtml("</div>");
- }
- }
-
- private void specificationDetails(final Request request, final ObjectSpecification specification) {
- renderName(request, specification);
- final List<ObjectAssociation> fields = specification.getAssociations(Contributed.EXCLUDED);
- for (int i = 0; i < fields.size(); i++) {
- request.appendHtml(" " + fields.get(i).getName() + " (" + fields.get(i).getSpecification().getSingularName()
- + ") \n");
- }
- }
-
- private void specificationGraph(
- Request request,
- ObjectSpecification specification,
- String fieldName,
- List<ObjectSpecification> processed,
- int level) {
- if (processed.contains(specification)) {
- return;
- }
-
- request.appendHtml(StringExtensions.repeat(" ", level));
- if (processed.contains(specification)) {
- request.appendHtml("* ");
- }
- request.appendHtml(specification.getFullIdentifier());
- if (fieldName != null) {
- request.appendHtml(" (" + fieldName + ")");
- }
- request.appendHtml("\n");
-
- if (processed.contains(specification)) {
- return;
- }
- processed.add(specification);
-
- final List<ObjectAssociation> fields = specification.getAssociations(Contributed.EXCLUDED);
- for (int i = 0; i < fields.size(); i++) {
- ObjectSpecification fieldSpecification = fields.get(i).getSpecification();
- if (fieldSpecification.isValue()) {
- continue;
- }
- specificationGraph(request, fieldSpecification, fields.get(i).getName(), processed, level + 1);
- }
- }
-
- private void renderName(final Request request, final ObjectSpecification specification) {
- request.appendHtml(specification.getSingularName() + " (" + specification.getFullIdentifier() + ") \n");
- }
-
- @Override
- public String getName() {
- return "specification";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/ThrowException.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/ThrowException.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/ThrowException.java
deleted file mode 100644
index 65af85e..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/ThrowException.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.viewer.scimpi.dispatcher.view.debug;
-
-import org.apache.isis.core.commons.exceptions.IsisException;
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class ThrowException extends AbstractElementProcessor {
-
- @Override
- public void process(final Request request) {
- if (request.getContext().isDebugDisabled()) {
- return;
- }
-
- final String message = request.getOptionalProperty("message", "Exception throw for testing purposes");
- throw new IsisException(message);
- }
-
- @Override
- public String getName() {
- return "debug-exception";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/AbstractFormView.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/AbstractFormView.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/AbstractFormView.java
deleted file mode 100644
index e88f89a..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/AbstractFormView.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.viewer.scimpi.dispatcher.view.display;
-
-import java.util.List;
-
-import org.apache.isis.applib.annotation.Where;
-import org.apache.isis.core.commons.authentication.AuthenticationSession;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.facets.object.parseable.ParseableFacet;
-import org.apache.isis.core.metamodel.spec.feature.Contributed;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractObjectProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-import org.apache.isis.viewer.scimpi.dispatcher.view.HelpLink;
-import org.apache.isis.viewer.scimpi.dispatcher.view.field.LinkedFieldsBlock;
-import org.apache.isis.viewer.scimpi.dispatcher.view.field.LinkedObject;
-
-public abstract class AbstractFormView extends AbstractObjectProcessor {
-
- @Override
- public String checkFieldType(final ObjectAssociation objectField) {
- return objectField.isOneToOneAssociation() ? null : "is not an object";
- }
-
- @Override
- public void process(final Request request, final ObjectAdapter object) {
- final LinkedFieldsBlock tag = new LinkedFieldsBlock();
-
- if (object != null) {
- final String id = request.getOptionalProperty(ID, object.getSpecification().getShortIdentifier());
- final String cls = request.getOptionalProperty(CLASS, "form");
- final String classString = " id=\"" + id + "\" class=\"" + cls + "\"";
- String title = request.getOptionalProperty(FORM_TITLE);
- final String oddRowClass = request.getOptionalProperty(ODD_ROW_CLASS);
- final String evenRowClass = request.getOptionalProperty(EVEN_ROW_CLASS);
- final String labelDelimiter = request.getOptionalProperty(LABEL_DELIMITER, ":");
- final boolean showIcons = request.isRequested(SHOW_ICON, showIconByDefault());
- String linkAllView = request.getOptionalProperty(LINK_VIEW);
-
- request.setBlockContent(tag);
- request.processUtilCloseTag();
-
- final AuthenticationSession session = IsisContext.getAuthenticationSession();
- List<ObjectAssociation> associations = object.getSpecification().getAssociations(Contributed.EXCLUDED, ObjectAssociation.Filters.dynamicallyVisible(session, object, Where.OBJECT_FORMS));
- final List<ObjectAssociation> fields = tag.includedFields(associations);
- final LinkedObject[] linkFields = tag.linkedFields(fields);
-
- if (linkAllView != null) {
- linkAllView = request.getContext().fullUriPath(linkAllView);
- for (int i = 0; i < linkFields.length; i++) {
- final boolean isObject = fields.get(i).isOneToOneAssociation();
- final boolean isNotParseable = !fields.get(i).getSpecification().containsFacet(ParseableFacet.class);
- linkFields[i] = isObject && isNotParseable ? new LinkedObject(linkAllView) : null;
- }
- }
-
- if (title == null) {
- title = object.getSpecification().getSingularName();
- } else if (title.equals("")) {
- title = null;
- }
-
- write(request, object, fields, linkFields, classString, title, labelDelimiter, oddRowClass, evenRowClass, showIcons);
- } else {
- request.skipUntilClose();
- }
- }
-
- private void write(
- final Request request,
- final ObjectAdapter object,
- final List<ObjectAssociation> fields,
- final LinkedObject[] linkFields,
- final String classString,
- final String title,
- final String labelDelimiter,
- final String oddRowClass,
- final String evenRowClass,
- final boolean showIcons) {
- request.appendHtml("<div" + classString + ">");
- if (title != null) {
- request.appendHtml("<div class=\"title\">");
- request.appendAsHtmlEncoded(title);
- request.appendHtml("</div>");
- HelpLink.append(request, object.getSpecification().getDescription(), object.getSpecification().getHelp());
- }
- int row = 1;
- for (int i = 0; i < fields.size(); i++) {
- final ObjectAssociation field = fields.get(i);
- if (ignoreField(field)) {
- continue;
- }
- if (field.isVisible(IsisContext.getAuthenticationSession(), object, Where.OBJECT_FORMS).isVetoed()) {
- continue;
- }
-
- final String description = field.getDescription().equals("") ? "" : "title=\"" + field.getDescription() + "\"";
- String cls;
- if (row++ % 2 == 1) {
- cls = " class=\"field " + (oddRowClass == null ? ODD_ROW_CLASS : oddRowClass) + "\"";
- } else {
- cls = " class=\"field " + (evenRowClass == null ? EVEN_ROW_CLASS : evenRowClass) + "\"";
- }
- request.appendHtml("<div " + cls + description + "><span class=\"label\">");
- request.appendAsHtmlEncoded(field.getName());
- request.appendHtml(labelDelimiter + "</span>");
- final LinkedObject linkedObject = linkFields[i];
- addField(request, object, field, linkedObject, showIcons);
- HelpLink.append(request, field.getDescription(), field.getHelp());
- request.appendHtml("</div>");
- }
- request.appendHtml("</div>");
- }
-
- protected void addField(final Request request, final ObjectAdapter object, final ObjectAssociation field, final LinkedObject linkedObject, final boolean showIcons) {
- FieldValue.write(request, object, field, linkedObject, null, showIcons, 0);
- }
-
- protected boolean ignoreField(final ObjectAssociation objectField) {
- return false;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/AbstractTableView.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/AbstractTableView.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/AbstractTableView.java
deleted file mode 100644
index 286d84d..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/AbstractTableView.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.viewer.scimpi.dispatcher.view.display;
-
-import java.util.Iterator;
-import java.util.List;
-import org.apache.isis.applib.annotation.Where;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.facets.actcoll.typeof.TypeOfFacet;
-import org.apache.isis.core.metamodel.facets.collections.modify.CollectionFacet;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.feature.Contributed;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.ResolveFieldUtil;
-import org.apache.isis.viewer.scimpi.dispatcher.ScimpiException;
-import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext;
-import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext.Scope;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public abstract class AbstractTableView extends AbstractElementProcessor {
-
- // REVIEW: should provide this rendering context, rather than hardcoding.
- // the net effect currently is that class members annotated with
- // @Hidden(where=Where.ALL_TABLES) or @Disabled(where=Where.ALL_TABLES) will indeed
- // be hidden from all tables but will be visible/enabled (perhaps incorrectly)
- // if annotated with Where.PARENTED_TABLE or Where.STANDALONE_TABLE
- private final Where where = Where.ALL_TABLES;
-
- @Override
- public void process(final Request request) {
- final RequestContext context = request.getContext();
-
- ObjectAdapter collection;
- String parentObjectId = null;
- boolean isFieldEditable = false;
- final String field = request.getOptionalProperty(FIELD);
- final String tableClass = request.getOptionalProperty(CLASS);
- ObjectSpecification elementSpec;
- String tableId;
- if (field != null) {
- final String objectId = request.getOptionalProperty(OBJECT);
- final ObjectAdapter object = context.getMappedObjectOrResult(objectId);
- if (object == null) {
- throw new ScimpiException("No object for result or " + objectId);
- }
- final ObjectAssociation objectField = object.getSpecification().getAssociation(field);
- if (!objectField.isOneToManyAssociation()) {
- throw new ScimpiException("Field " + objectField.getId() + " is not a collection");
- }
- isFieldEditable = objectField.isUsable(IsisContext.getAuthenticationSession(), object, where).isAllowed();
- ResolveFieldUtil.resolveField(object, objectField);
- collection = objectField.get(object);
- final TypeOfFacet facet = objectField.getFacet(TypeOfFacet.class);
- elementSpec = facet.valueSpec();
- parentObjectId = objectId == null ? context.mapObject(object, Scope.REQUEST) : objectId;
- tableId = request.getOptionalProperty(ID, field);
- } else {
- final String id = request.getOptionalProperty(COLLECTION);
- collection = context.getMappedObjectOrResult(id);
- elementSpec = collection.getElementSpecification();
- tableId = request.getOptionalProperty(ID, collection.getElementSpecification().getShortIdentifier());
- }
-
- final String summary = request.getOptionalProperty("summary");
- final String rowClassesList = request.getOptionalProperty(ROW_CLASSES, ODD_ROW_CLASS + "|" + EVEN_ROW_CLASS);
- String[] rowClasses = null;
- if (rowClassesList.length() > 0) {
- rowClasses = rowClassesList.split("[,|/]");
- }
-
- final List<ObjectAssociation> allFields = elementSpec.getAssociations(Contributed.EXCLUDED, ObjectAssociation.Filters.VISIBLE_AT_LEAST_SOMETIMES);
- final TableContentWriter rowBuilder = createRowBuilder(request, context, isFieldEditable ? parentObjectId : null, allFields, collection);
- write(request, collection, summary, rowBuilder, tableId, tableClass, rowClasses);
-
- }
-
- protected PersistenceSession getPersistenceSession() {
- return IsisContext.getPersistenceSession();
- }
-
- protected abstract TableContentWriter createRowBuilder(final Request request, RequestContext context, final String parent, final List<ObjectAssociation> allFields, ObjectAdapter collection);
-
- public static void write(
- final Request request,
- final ObjectAdapter collection,
- final String summary,
- final TableContentWriter rowBuilder,
- final String tableId,
- final String tableClass,
- final String[] rowClasses) {
- final RequestContext context = request.getContext();
-
- final String summarySegment = summary == null ? "" : (" summary=\"" + summary + "\"");
- final String idSegment = tableId == null ? "" : (" id=\"" + tableId + "\"");
- final String classSegment = tableClass == null ? "" : (" class=\"" + tableClass + "\"");
- request.appendHtml("<table" + idSegment + classSegment + summarySegment + ">");
- rowBuilder.writeCaption(request);
- rowBuilder.writeHeaders(request);
- rowBuilder.writeFooters(request);
-
- request.appendHtml("<tbody>");
- final CollectionFacet facet = collection.getSpecification().getFacet(CollectionFacet.class);
- final Iterator<ObjectAdapter> iterator = facet.iterator(collection);
- int row = 1;
- while (iterator.hasNext()) {
- final ObjectAdapter element = iterator.next();
-
- context.addVariable("row", "" + (row), Scope.REQUEST);
- String cls = "";
- if (rowClasses != null) {
- cls = " class=\"" + rowClasses[row % rowClasses.length] + "\"";
- }
- request.appendHtml("<tr" + cls + ">");
- rowBuilder.writeElement(request, context, element);
- request.appendHtml("</tr>");
- row++;
- }
- request.appendHtml("</tbody>");
- request.appendHtml("</table>");
-
- rowBuilder.tidyUp();
- }
-
- @Override
- public String getName() {
- return "table";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/AddMessage.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/AddMessage.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/AddMessage.java
deleted file mode 100644
index 7076f70..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/AddMessage.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.viewer.scimpi.dispatcher.view.display;
-
-import org.apache.isis.core.commons.authentication.MessageBroker;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class AddMessage extends AbstractElementProcessor {
-
- @Override
- public void process(final Request request) {
- request.pushNewBuffer();
- request.processUtilCloseTag();
- final String content = request.popBuffer();
-
- final MessageBroker messageBroker = IsisContext.getMessageBroker();
- messageBroker.addMessage(content);
- }
-
- @Override
- public String getName() {
- return "add-message";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/2c7cfbfe/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/AddWarning.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/AddWarning.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/AddWarning.java
deleted file mode 100644
index ac0d240..0000000
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/AddWarning.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.viewer.scimpi.dispatcher.view.display;
-
-import org.apache.isis.core.commons.authentication.MessageBroker;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
-
-public class AddWarning extends AbstractElementProcessor {
-
- @Override
- public void process(final Request request) {
- request.pushNewBuffer();
- request.processUtilCloseTag();
- final String content = request.popBuffer();
-
- final MessageBroker messageBroker = IsisContext.getMessageBroker();
- messageBroker.addWarning(content);
- }
-
- @Override
- public String getName() {
- return "add-warning";
- }
-
-}