ToDoItemXMLHelper.java

1
/* $Id: ToDoItemXMLHelper.java 19614 2011-07-20 12:10:13Z linus $
2
 *****************************************************************************
3
 * Copyright (c) 2009 Contributors - see below
4
 * All rights reserved. This program and the accompanying materials
5
 * are made available under the terms of the Eclipse Public License v1.0
6
 * which accompanies this distribution, and is available at
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 *
9
 * Contributors:
10
 *    tfmorris
11
 *****************************************************************************
12
 *
13
 * Some portions of this file was previously release using the BSD License:
14
 */
15
16
// Copyright (c) 1996-2006 The Regents of the University of California. All
17
// Rights Reserved. Permission to use, copy, modify, and distribute this
18
// software and its documentation without fee, and without a written
19
// agreement is hereby granted, provided that the above copyright notice
20
// and this paragraph appear in all copies.  This software program and
21
// documentation are copyrighted by The Regents of the University of
22
// California. The software program and documentation are supplied "AS
23
// IS", without any accompanying services from The Regents. The Regents
24
// does not warrant that the operation of the program will be
25
// uninterrupted or error-free. The end-user understands that the program
26
// was developed for research purposes and is advised not to rely
27
// exclusively on the program for any reason.  IN NO EVENT SHALL THE
28
// UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
29
// SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
30
// ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
31
// THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
32
// SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY
33
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
34
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
35
// PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
36
// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
37
// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
38
39
package org.argouml.persistence;
40
41
import org.argouml.cognitive.ToDoItem;
42
43
/**
44
 * Helper class to help save todo items properly in the .todo XML file.
45
 * It provides a view of A ToDoItem particularly suited for saving in an
46
 * XML file by encoding strings to preserve graphic characters and allow
47
 * lines to be broken and still be able to regain the original contents.
48
 * Used by todo.tee
49
 * This is not to be considered as part of the peristence interface.
50
 *
51
 * @see	ToDoItem
52
 * @author Michael Stockman
53
 */
54
public class ToDoItemXMLHelper
55
{
56
    private final ToDoItem item;
57
58
    /**
59
     * Creates a new ToDoItemXMLHelper for item.
60
     *
61
     * @param	todoItem	A ToDoItem.
62
     */
63
    public ToDoItemXMLHelper(ToDoItem todoItem)
64
    {
65 1 1. : negated conditional → NO_COVERAGE
	if (todoItem == null) {
66
	    throw new NullPointerException();
67
	}
68
	item = todoItem;
69
    }
70
71
    /**
72
     * Encodes the headline of this ToDoItem in an XML safe way and
73
     * returns the new String. The String can be regained by running the
74
     * returned String through
75
     * {@link TodoParser#decode(String)}.
76
     *
77
     * @return	The encoded headline.
78
     */
79
    public String getHeadline()
80
    {
81 1 1. getHeadline : mutated return of Object value for org/argouml/persistence/ToDoItemXMLHelper::getHeadline to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
	return TodoParser.encode(item.getHeadline());
82
    }
83
84
    /**
85
     * Encodes the priority of this ToDoItem in an XML safe way and
86
     * returns the new String. The String can be regained by running the
87
     * returned String through
88
     * {@link TodoParser#decode(String)} and comparing to the
89
     * STRING_prio_* values in TodoTokenTable.
90
     *
91
     * @return	The encoded priority.
92
     */
93
    public String getPriority()
94
    {
95
	String s = TodoTokenTable.STRING_PRIO_HIGH;
96
	switch (item.getPriority())
97
	{
98
	case ToDoItem.HIGH_PRIORITY:
99
	    s = TodoTokenTable.STRING_PRIO_HIGH;
100
	    break;
101
102
	case ToDoItem.MED_PRIORITY:
103
	    s = TodoTokenTable.STRING_PRIO_MED;
104
	    break;
105
106
	case ToDoItem.LOW_PRIORITY:
107
	    s = TodoTokenTable.STRING_PRIO_LOW;
108
	    break;
109
	}
110
111 1 1. getPriority : mutated return of Object value for org/argouml/persistence/ToDoItemXMLHelper::getPriority to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
	return TodoParser.encode(s);
112
    }
113
114
    /**
115
     * Encodes the moreInfoURL of this ToDoItem in an XML safe way and
116
     * returns the new String. The String can be regained by running the
117
     * returned String through
118
     * {@link TodoParser#decode(String)}.
119
     *
120
     * @return	The encoded moreInfoURL.
121
     */
122
    public String getMoreInfoURL()
123
    {
124 1 1. getMoreInfoURL : mutated return of Object value for org/argouml/persistence/ToDoItemXMLHelper::getMoreInfoURL to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
	return TodoParser.encode(item.getMoreInfoURL());
125
    }
126
127
    /**
128
     * Encodes the description of this ToDoItem in an XML safe way and
129
     * returns the new String. The String can be regained by running the
130
     * returned String through
131
     * {@link TodoParser#decode(String)}.
132
     *
133
     * @return	The encoded description.
134
     */
135
    public String getDescription()
136
    {
137 1 1. getDescription : mutated return of Object value for org/argouml/persistence/ToDoItemXMLHelper::getDescription to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
	return TodoParser.encode(item.getDescription());
138
    }
139
}
140

Mutations

65

1.1
Location :
Killed by : none
negated conditional → NO_COVERAGE

81

1.1
Location : getHeadline
Killed by : none
mutated return of Object value for org/argouml/persistence/ToDoItemXMLHelper::getHeadline to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

111

1.1
Location : getPriority
Killed by : none
mutated return of Object value for org/argouml/persistence/ToDoItemXMLHelper::getPriority to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

124

1.1
Location : getMoreInfoURL
Killed by : none
mutated return of Object value for org/argouml/persistence/ToDoItemXMLHelper::getMoreInfoURL to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

137

1.1
Location : getDescription
Killed by : none
mutated return of Object value for org/argouml/persistence/ToDoItemXMLHelper::getDescription to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 0.32