EMMA Coverage Report (generated Fri Sep 15 10:32:43 EDT 2006)
[all classes][org.apache.pluto.driver.services.portal]

COVERAGE SUMMARY FOR SOURCE FILE [RenderConfig.java]

nameclass, %method, %block, %line, %
RenderConfig.java0%   (0/2)0%   (0/10)0%   (0/117)0%   (0/29)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class RenderConfig0%   (0/1)0%   (0/7)0%   (0/87)0%   (0/20)
<static initializer> 0%   (0/1)0%   (0/4)0%   (0/1)
RenderConfig (): void 0%   (0/1)0%   (0/17)0%   (0/5)
addPage (PageConfig): void 0%   (0/1)0%   (0/17)0%   (0/3)
getDefaultPageId (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getPageConfig (String): PageConfig 0%   (0/1)0%   (0/29)0%   (0/5)
getPages (): List 0%   (0/1)0%   (0/13)0%   (0/3)
setDefaultPageId (String): void 0%   (0/1)0%   (0/4)0%   (0/2)
     
class RenderConfig$10%   (0/1)0%   (0/3)0%   (0/30)0%   (0/9)
RenderConfig$1 (RenderConfig): void 0%   (0/1)0%   (0/6)0%   (0/1)
compare (Object, Object): int 0%   (0/1)0%   (0/22)0%   (0/7)
equals (Object): boolean 0%   (0/1)0%   (0/2)0%   (0/1)

1/*
2 * Copyright 2004 The Apache Software Foundation.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.apache.pluto.driver.services.portal;
17 
18import org.apache.commons.logging.Log;
19import org.apache.commons.logging.LogFactory;
20import org.apache.pluto.driver.services.portal.PageConfig;
21 
22import java.util.*;
23 
24/**
25 * @author <a href="ddewolf@apache.org">David H. DeWolf</a>
26 */
27public class RenderConfig {
28    private static final Log LOG =
29        LogFactory.getLog(RenderConfig.class);
30 
31    private Map pages;
32    private String defaultPageId;
33 
34    // internally used.
35    private int orderNumberCounter = 0;
36    private Comparator pageComparator;
37 
38    public RenderConfig() {
39        this.pages = new java.util.HashMap();
40        this.pageComparator = new Comparator() {
41            public int compare(Object a, Object b) {
42                PageConfig pa = (PageConfig)a;
43                PageConfig pb = (PageConfig)b;
44                if(pa.getOrderNumber() > pb.getOrderNumber()) {
45                    return 1;
46                }
47                else if(pa.getOrderNumber() == pb.getOrderNumber()) {
48                    return 0;
49                }
50                else {
51                    return -1;
52                }
53            }
54 
55            public boolean equals(Object a) {
56                return false;
57            }
58        };
59    }
60 
61 
62    public String getDefaultPageId() {
63        return defaultPageId;
64    }
65 
66    public void setDefaultPageId(String defaultPageId) {
67        this.defaultPageId = defaultPageId;
68    }
69 
70    public List getPages() {
71        List col =  new ArrayList(pages.values());
72        Collections.sort(col, pageComparator);
73        return col;
74    }
75 
76    public PageConfig getPageConfig(String pageId) {
77        if (pageId == null || "".equals(pageId)) {
78            if (LOG.isDebugEnabled()) {
79                LOG.debug(
80                    "Requested page is null.  Returning default: " +
81                    defaultPageId);
82            }
83            pageId = defaultPageId;
84        }
85        return (PageConfig) pages.get(pageId);
86    }
87 
88    public void addPage(PageConfig config) {
89        config.setOrderNumber(orderNumberCounter++);
90        pages.put(config.getName(), config);
91    }
92 
93}

[all classes][org.apache.pluto.driver.services.portal]
EMMA 2.0.5312 (C) Vladimir Roubtsov