1 /* 2 * Copyright 2007-2013 smartics, Kronseder & Reiner GmbH 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 */ 16 package de.smartics.maven.exceptions.report; 17 18 import java.util.List; 19 20 import de.smartics.exceptions.report.data.ExceptionCodeReportItem; 21 import de.smartics.exceptions.report.data.StoredExceptionCodesReport; 22 import de.smartics.maven.exceptions.AbstractSinkReportGenerator; 23 24 /** 25 * Simple generator that generates with a Maven sink. 26 */ 27 public class PackageSortedSinkReportGenerator extends 28 AbstractSinkReportGenerator 29 { 30 // ********************************* Fields ********************************* 31 32 // --- constants ------------------------------------------------------------ 33 34 // --- members -------------------------------------------------------------- 35 36 // ****************************** Initializer ******************************* 37 38 // ****************************** Constructors ****************************** 39 40 /** 41 * Default constructor. 42 */ 43 public PackageSortedSinkReportGenerator() 44 { 45 } 46 47 // ****************************** Inner Classes ***************************** 48 49 // ********************************* Methods ******************************** 50 51 // --- init ----------------------------------------------------------------- 52 53 // --- get&set -------------------------------------------------------------- 54 55 // --- business ------------------------------------------------------------- 56 57 @Override 58 protected List<ExceptionCodeReportItem> getItems( 59 final StoredExceptionCodesReport report) 60 { 61 return report.getItems(); 62 } 63 64 @Override 65 protected boolean hasSectionChanged(final String currentSection, 66 final ExceptionCodeReportItem item) 67 { 68 return !item.getDeclaringTypeName().equals(currentSection); 69 } 70 71 @Override 72 protected String getCurrentSelection(final ExceptionCodeReportItem item) 73 { 74 return item.getDeclaringTypeName(); 75 } 76 77 @Override 78 protected String getCodeTitle(final String headLine, 79 final ExceptionCodeReportItem item) 80 { 81 final String title; 82 if (headLine != null) 83 { 84 title = headLine; 85 } 86 else 87 { 88 final String className = item.getDeclaringTypeName(); 89 title = className; 90 } 91 92 return title; 93 } 94 95 // --- object basics -------------------------------------------------------- 96 97 }