Clover Coverage Report
Coverage timestamp: Fri May 24 2013 13:47:27 UTC
../../../../../../img/srcFileCovDistChart9.png 45% of files have more coverage
12   81   9   2.4
8   36   0.75   5
5     1.8  
1    
 
  LiteratureItemListHandler       Line # 29 12 9 84% 0.84
 
  (101)
 
1    /* This file is part of the project "Hilbert II" - http://www.qedeq.org
2    *
3    * Copyright 2000-2013, Michael Meyling <mime@qedeq.org>.
4    *
5    * "Hilbert II" is free software; you can redistribute
6    * it and/or modify it under the terms of the GNU General Public
7    * License as published by the Free Software Foundation; either
8    * version 2 of the License, or (at your option) any later version.
9    *
10    * This program is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13    * GNU General Public License for more details.
14    */
15   
16    package org.qedeq.kernel.xml.handler.module;
17   
18    import org.qedeq.kernel.se.dto.module.LiteratureItemListVo;
19    import org.qedeq.kernel.xml.common.XmlSyntaxException;
20    import org.qedeq.kernel.xml.handler.common.AbstractSimpleHandler;
21    import org.qedeq.kernel.xml.handler.common.SimpleAttributes;
22   
23    /**
24    * Parse literature list.
25    *
26    * @version $Revision: 1.1 $
27    * @author Michael Meyling
28    */
 
29    public class LiteratureItemListHandler extends AbstractSimpleHandler {
30   
31    /** List of literatureItems. */
32    private LiteratureItemListVo list;
33   
34    /** Parses an literatureItem. */
35    private final LiteratureItemHandler literatureItemHandler;
36   
37   
38    /**
39    * Handles list of literatureItems.
40    *
41    * @param handler Parent handler.
42    */
 
43  614 toggle public LiteratureItemListHandler(final AbstractSimpleHandler handler) {
44  614 super(handler, "BIBLIOGRAPHY");
45  614 literatureItemHandler = new LiteratureItemHandler(this);
46    }
47   
 
48  253 toggle public final void init() {
49  253 list = new LiteratureItemListVo();
50    }
51   
52    /**
53    * Get list of literatureItems.
54    *
55    * @return LiteratureItem list.
56    */
 
57  253 toggle public final LiteratureItemListVo getLiteratureItemList() {
58  253 return list;
59    }
60   
 
61  1311 toggle public final void startElement(final String name, final SimpleAttributes attributes)
62    throws XmlSyntaxException {
63  1311 if (getStartTag().equals(name)) {
64    // nothing to do
65  1058 } else if (literatureItemHandler.getStartTag().equals(name)) {
66  1058 changeHandler(literatureItemHandler, name, attributes);
67    } else {
68  0 throw XmlSyntaxException.createUnexpectedTagException(name);
69    }
70    }
71   
 
72  1311 toggle public final void endElement(final String name) throws XmlSyntaxException {
73  1311 if (getStartTag().equals(name)) {
74    // nothing to do
75  1058 } else if (literatureItemHandler.getStartTag().equals(name)) {
76  1058 list.add(literatureItemHandler.getLiteratureItem());
77    } else {
78  0 throw XmlSyntaxException.createUnexpectedTagException(name);
79    }
80    }
81    }