2 * ============LICENSE_START====================================================
4 * ===========================================================================
5 * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
6 * ===========================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END====================================================
22 package org.onap.aaf.auth.gui;
24 import static org.onap.aaf.misc.xgen.html.HTMLGen.A;
25 import static org.onap.aaf.misc.xgen.html.HTMLGen.LI;
26 import static org.onap.aaf.misc.xgen.html.HTMLGen.UL;
28 import java.io.IOException;
30 import javax.servlet.http.HttpServletRequest;
32 import org.onap.aaf.misc.env.APIException;
33 import org.onap.aaf.misc.env.TransStore;
34 import org.onap.aaf.misc.xgen.Cache;
35 import org.onap.aaf.misc.xgen.DynamicCode;
36 import org.onap.aaf.misc.xgen.Mark;
37 import org.onap.aaf.misc.xgen.html.HTMLGen;
39 public class BreadCrumbs extends NamedCode {
42 public BreadCrumbs(Page ... pages) {
43 super(false,"breadcrumbs");
48 public void code(final Cache<HTMLGen> cache, final HTMLGen hgen) throws APIException, IOException {
50 Mark mark = new Mark();
52 cache.dynamic(hgen, new DynamicCode<HTMLGen, AAF_GUI, TransStore>() {
54 public void code(AAF_GUI gui, TransStore trans, final Cache<HTMLGen> cache, final HTMLGen hgen) throws APIException, IOException {
55 HttpServletRequest req = trans.get(gui.slot_httpServletRequest, null);
56 StringBuilder key = new StringBuilder();
58 for (Page p : breadcrumbs) {
60 // Add keys for page from commandline, where possible.
61 if (p.fields().length>0) {
64 for (String field : p.fields()) {
65 if ((value=req.getParameter(field))==null) {
66 hidden="style=display:none;";
79 hgen.incr(LI,true,hidden);
80 hgen.leaf(A,"href="+p.url()+key.toString(),hidden).text(p.name()).end(2);
83 hgen.leaf(A,"href="+p.url(),hidden).text(p.name()).end(2);