Project

General

Profile

Revision cadf0eb8

IDcadf0eb859050a18a7044e6eee9314d2e86afb34
Parent f33355c3
Child e154bb27

Added by Andreas Müller 2 months ago

cleanup

View differences:

cdmlib-model/src/main/java/eu/etaxonomy/cdm/format/description/AbstractCategoricalDescriptionBuilder.java
19 19
 * @author m.venin
20 20
 * @since 2010
21 21
 */
22
public abstract class AbstractCategoricalDescriptionBuilder extends DescriptionBuilder<CategoricalData>{
22
public abstract class AbstractCategoricalDescriptionBuilder
23
        extends DescriptionBuilder<CategoricalData>{
23 24

  
24 25
	@Override
25 26
    public TextData build(CategoricalData data, List<Language> languages) {
cdmlib-model/src/main/java/eu/etaxonomy/cdm/format/description/MicroFormatCategoricalDescriptionBuilder.java
26 26
 * @author m.venin
27 27
 * @since 2010
28 28
 */
29
public class MicroFormatCategoricalDescriptionBuilder extends AbstractCategoricalDescriptionBuilder{
29
public class MicroFormatCategoricalDescriptionBuilder
30
        extends AbstractCategoricalDescriptionBuilder{
30 31

  
31 32
	private final String spanEnd = "</span>";
32 33

  
cdmlib-model/src/main/java/eu/etaxonomy/cdm/jaxb/FormattedTextAdapter.java
5 5
*
6 6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7 7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/ 
8
*/
9 9

  
10 10
package eu.etaxonomy.cdm.jaxb;
11 11

  
......
50 50

  
51 51
	@SuppressWarnings("unused")
52 52
	private static final Log logger = LogFactory.getLog(FormattedTextAdapter.class);
53
	
54
	public FormattedText marshal(String string) throws Exception {
53

  
54
	@Override
55
    public FormattedText marshal(String string) throws Exception {
55 56
		if(string != null) {
56 57
			string = StringEscapeUtils.escapeXml(string);
57 58
			String documentString = "<?xml version=\"1.0\"?><text>"  + string + "</text>";
......
65 66
		    	Node node = childNodes.item(i);
66 67
		    	if(node instanceof org.w3c.dom.Text ) {
67 68
		    		org.w3c.dom.Text textNode = (org.w3c.dom.Text) node;
68
		    		
69

  
69 70
		    		text.getContent().add(textNode.getTextContent());
70 71
		    	} else {
71 72
		    	    text.getContent().add(node);
......
76 77
		return null;
77 78
	}
78 79

  
79
	public String unmarshal(FormattedText text) throws Exception {
80
	@Override
81
    public String unmarshal(FormattedText text) throws Exception {
80 82
		DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
81 83
		Document document = factory.newDocumentBuilder().newDocument();
82 84
		DocumentFragment documentFragment = document.createDocumentFragment();
83
		
85

  
84 86
		for(Object object : text.getContent()) {
85 87
			if(object instanceof String) {
86 88
				String string = (String)object;
......
96 98
							throw de;
97 99
						}
98 100
					}
99
					
101

  
100 102
				}
101 103

  
102 104
				documentFragment.appendChild(document.importNode(node,true));
......
107 109
		TransformerFactory transformerFactory  = TransformerFactory.newInstance();
108 110
		Transformer transformer = transformerFactory.newTransformer();
109 111
		transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION , "yes");
110
		
112

  
111 113
		Source input = new DOMSource(documentFragment);
112 114
		StringWriter stringWriter = new StringWriter();
113 115
		Result output = new StreamResult(stringWriter);
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/TaxonName.java
3376 3376
        return result;
3377 3377
    }
3378 3378

  
3379
    /**
3380
     * {@inheritDoc}
3381
     */
3382 3379
    @Override
3383 3380
    public boolean isHybridName() {
3384 3381
        return this.isMonomHybrid() || this.isBinomHybrid() || this.isTrinomHybrid();
3385 3382
    }
3386 3383

  
3387
    /**
3388
     * {@inheritDoc}
3389
     */
3390 3384
    @Override
3391 3385
    public boolean isHybrid() {
3392 3386
        return this.isHybridName() || this.isHybridFormula();
......
3430 3424
            this.setNameCache(oldNameCache, isProtected);
3431 3425
        }
3432 3426

  
3433

  
3434 3427
        // Compare name cache of taxon names
3435 3428
        if (CdmUtils.isNotBlank(otherNameCache) && CdmUtils.isNotBlank(thisNameCache)) {
3436 3429
            thisNameCache = normalizeName(thisNameCache);
......
3453 3446
    static final String HYBRID_SIGN = UTF8.HYBRID.toString();
3454 3447
    static final String QUOT_SIGN = "[\\u02BA\\u0022\\u0022]";
3455 3448

  
3456
    /**
3457
     * @param thisNameCache
3458
     * @param HYBRID_SIGN
3459
     * @param QUOT_SIGN
3460
     * @return
3461
     */
3462 3449
    private String normalizeName(String thisNameCache) {
3463 3450
        thisNameCache = thisNameCache.replaceAll(HYBRID_SIGN, "");
3464 3451
        thisNameCache = thisNameCache.replaceAll(QUOT_SIGN, "");
......
3499 3486

  
3500 3487
//************************ isType ***********************************************/
3501 3488

  
3502
    /**
3503
     * @return
3504
     */
3505 3489
    @Override
3506 3490
    public boolean isNonViral() {
3507 3491
        return nameType.isNonViral();
3508 3492
    }
3509

  
3510 3493
    @Override
3511 3494
    public boolean isZoological(){
3512 3495
        return nameType.isZoological();
......
3572 3555
        return false;
3573 3556
    }
3574 3557

  
3575

  
3576
    /**
3577
     * @return
3578
     */
3579 3558
    private boolean updateFullTitleCache() {
3580 3559
        if (protectedFullTitleCache == false){
3581 3560
            String oldCache = this.fullTitleCache;
......
3589 3568
        return false;
3590 3569
    }
3591 3570

  
3592

  
3593 3571
//*********************** CLONE ********************************************************/
3594 3572

  
3595 3573
    /**
......
3633 3611
                result.status.add(newStatus);
3634 3612
            }
3635 3613

  
3636

  
3637 3614
            //to relations
3638 3615
            result.relationsToThisName = new HashSet<>();
3639 3616
            for (NameRelationship toRelationship : getRelationsToThisName()){
......
3663 3640
            result.homotypicalGroup = HomotypicalGroup.NewInstance();
3664 3641
            result.homotypicalGroup.addTypifiedName(this);
3665 3642

  
3666

  
3667 3643
            //HybridChildRelations
3668 3644
            result.hybridChildRelations = new HashSet<>();
3669 3645
            for (HybridRelationship hybridRelationship : getHybridChildRelations()){
cdmlib-model/src/main/java/eu/etaxonomy/cdm/validation/constraint/CorrectEpithetsForRankValidator.java
79 79
		return valid;
80 80
	}
81 81

  
82
    /**
83
     * @param specificEpithet
84
     * @return
85
     */
86 82
    private boolean isNotBlank(String str) {
87 83
        return StringUtils.isNotBlank(str);
88 84
    }
cdmlib-model/src/test/java/eu/etaxonomy/cdm/strategy/cache/agent/PersonDefaultCacheStrategyTest.java
6 6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7 7
* See LICENSE.TXT at the top of this package for the full license terms.
8 8
*/
9

  
10 9
package eu.etaxonomy.cdm.strategy.cache.agent;
11 10

  
12

  
13 11
import static org.junit.Assert.assertNotNull;
14 12

  
15 13
import org.apache.commons.lang3.StringUtils;
16 14
import org.apache.log4j.Logger;
17
import org.junit.After;
18
import org.junit.AfterClass;
19 15
import org.junit.Assert;
20 16
import org.junit.Before;
21
import org.junit.BeforeClass;
22 17
import org.junit.Test;
23 18

  
24 19
import eu.etaxonomy.cdm.model.agent.Person;
......
28 23
 * @since 29.09.2009
29 24
 */
30 25
public class PersonDefaultCacheStrategyTest {
31
	@SuppressWarnings("unused")
26

  
27
    @SuppressWarnings("unused")
32 28
	private static final Logger logger = Logger.getLogger(PersonDefaultCacheStrategyTest.class);
33 29

  
34 30
	private static Person person1;
35 31
	private static Person person2;
36 32
	private static Person person3;
37 33

  
38
	/**
39
	 * @throws java.lang.Exception
40
	 */
41
	@BeforeClass
42
	public static void setUpBeforeClass() throws Exception {
43
	}
44

  
45
	/**
46
	 * @throws java.lang.Exception
47
	 */
48
	@AfterClass
49
	public static void tearDownAfterClass() throws Exception {
50

  
51

  
52
	}
53

  
54
	/**
55
	 * @throws java.lang.Exception
56
	 */
57 34
	@Before
58 35
	public void setUp() throws Exception {
59 36
		person1 = Person.NewInstance();
......
70 47
		person2.setSuffix("P2Suff");
71 48

  
72 49
		person3 = Person.NewInstance(); //empty person
73

  
74
	}
75

  
76
	/**
77
	 * @throws java.lang.Exception
78
	 */
79
	@After
80
	public void tearDown() throws Exception {
81 50
	}
82 51

  
83 52
//**************************************** TESTS **************************************
84 53

  
85
	/**
86
	 * Test method for {@link eu.etaxonomy.cdm.strategy.cache.agent.PersonDefaultCacheStrategy#NewInstance()}.
87
	 */
88 54
	@Test
89 55
	public final void testNewInstance() {
90 56
		PersonDefaultCacheStrategy cacheStrategy = PersonDefaultCacheStrategy.NewInstance();
......
106 72
		Assert.assertEquals("Person3 title should start with Person#0", "Person#0", person3.getNomenclaturalTitle().substring(0, 8));
107 73
	}
108 74

  
109

  
110 75
	@Test
111 76
	public final void testGetTitleCacheAdaptedFromOldVersion(){
112 77
	    Assert.assertNotNull("person1 title cache must not to be null", person1.getTitleCache());
......
152 117
                expected, pers.getTitleCache());
153 118
    }
154 119

  
155

  
156 120
    @Test
157 121
    public final void testGetFullTitle(){
158 122
        Assert.assertNotNull("person1 full titlemust not to be null", person1.getFullTitle());
......
292 256
        Assert.assertEquals("W.-H.-", formatter.getInitialsFromGivenName(givenname, force));
293 257
        givenname = "W.-Hennin-";
294 258
        Assert.assertEquals("W.-H.-", formatter.getInitialsFromGivenName(givenname, force));
295

  
296 259
	}
297

  
298 260
}
cdmlib-model/src/test/java/eu/etaxonomy/cdm/strategy/cache/agent/TeamDefaultCacheStrategyTest.java
6 6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7 7
* See LICENSE.TXT at the top of this package for the full license terms.
8 8
*/
9

  
10 9
package eu.etaxonomy.cdm.strategy.cache.agent;
11 10

  
12

  
13 11
import static org.junit.Assert.assertNotNull;
14 12

  
15 13
import org.apache.commons.lang3.StringUtils;
16 14
import org.apache.log4j.Logger;
17 15
import org.junit.After;
18
import org.junit.AfterClass;
19 16
import org.junit.Assert;
20 17
import org.junit.Before;
21
import org.junit.BeforeClass;
22 18
import org.junit.Test;
23 19

  
24 20
import eu.etaxonomy.cdm.model.agent.Person;
......
29 25
 * @since 29.09.2009
30 26
 */
31 27
public class TeamDefaultCacheStrategyTest {
32
	@SuppressWarnings("unused")
28

  
29
    @SuppressWarnings("unused")
33 30
	private static final Logger logger = Logger.getLogger(TeamDefaultCacheStrategyTest.class);
34 31

  
35 32
	private static Team team1;
......
41 38
	private static Person person3;
42 39
	private static Person person4;
43 40

  
44
	/**
45
	 * @throws java.lang.Exception
46
	 */
47
	@BeforeClass
48
	public static void setUpBeforeClass() throws Exception {
49
	}
50

  
51
	/**
52
	 * @throws java.lang.Exception
53
	 */
54
	@AfterClass
55
	public static void tearDownAfterClass() throws Exception {
56

  
57

  
58
	}
59

  
60
	/**
61
	 * @throws java.lang.Exception
62
	 */
63 41
	@Before
64 42
	public void setUp() throws Exception {
65 43
		team1 = Team.NewInstance();
......
89 67
		team2.addTeamMember(person2);
90 68
		team2.addTeamMember(person1);
91 69
		team2.addTeamMember(person3);
92

  
93

  
94

  
95 70
	}
96 71

  
97
	/**
98
	 * @throws java.lang.Exception
99
	 */
100 72
	@After
101 73
	public void tearDown() throws Exception {
102 74
	}
103 75

  
104 76
//**************************************** TESTS **************************************
105 77

  
106
	/**
107
	 * Test method for {@link eu.etaxonomy.cdm.strategy.cache.agent.PersonDefaultCacheStrategy#NewInstance()}.
108
	 */
109 78
	@Test
110 79
	public final void testNewInstance() {
111 80
		TeamDefaultCacheStrategy cacheStrategy = TeamDefaultCacheStrategy.NewInstance();
......
166 135
        Assert.assertEquals("team2 nomenclatural title should still be 'P2LN, P., P1LN, P. & al.' now.",
167 136
                "P2LN, P., P1LN, P. & al.", team2.getTitleCache());
168 137

  
169

  
170 138
		//person3
171 139
		Assert.assertNotNull("team3 title cache must not to be null",
172 140
		        team3.getTitleCache());
......
214 182
		person1.setGivenName("O.");
215 183
		Assert.assertEquals("team1 title cache should be P1LN, O.", "P1LN, O.", team1.getTitleCache());
216 184
	}
217

  
218 185
}
cdmlib-persistence/pom.xml
160 160
        </exclusion>
161 161
      </exclusions>
162 162
    </dependency>
163
    <!-- Since hibernate 5.0.4 the logging for a Dialect throws ClassDefNotFound for javax.transaction.SystemException if jta is missing  -->
164 163
    <dependency>
164
      <!-- Since hibernate 5.0.4 the logging for a Dialect throws ClassDefNotFound for javax.transaction.SystemException if jta is missing  -->
165 165
      <groupId>javax.transaction</groupId>
166 166
      <artifactId>jta</artifactId>
167 167
    </dependency>  
pom.xml
1006 1006
        <version>3.4.1.Final</version>
1007 1007
        <!-- checked 2020-08 -->
1008 1008
      </dependency>
1009
	  <!-- since hibernate 5.0.4 Dialect throws exception if jta is missing  -->
1010 1009
	  <dependency>
1010
	    <!-- since hibernate 5.0.4 Dialect throws exception if jta is missing  -->
1011 1011
        <groupId>javax.transaction</groupId>
1012 1012
        <artifactId>jta</artifactId>
1013 1013
        <version>1.1</version>
......
1209 1209
        <artifactId>xml-apis</artifactId>
1210 1210
        <!-- 
1211 1211
            WARNING: do not upgrade to later versions 2.0.x of xml-apis
1212
            since these are effectivly reloated to the early beta version
1212
            since these are effectivly reloaded to the early beta version
1213 1213
            1.0.b2
1214 1214
        -->
1215 1215
        <version>1.4.01</version>

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)