2 * Copyright (C) 2009 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
10 package eu
.etaxonomy
.cdm
.strategy
.cache
.agent
;
12 import java
.util
.List
;
13 import java
.util
.UUID
;
15 import org
.apache
.log4j
.Logger
;
17 import eu
.etaxonomy
.cdm
.model
.agent
.Person
;
18 import eu
.etaxonomy
.cdm
.model
.agent
.Team
;
19 import eu
.etaxonomy
.cdm
.strategy
.StrategyBase
;
25 public class TeamDefaultCacheStrategy
extends StrategyBase
implements INomenclaturalAuthorCacheStrategy
<Team
> {
26 private static final String FINAL_TEAM_CONCATINATION
= " & ";
27 private static final String STD_TEAM_CONCATINATION
= ", ";
28 private static final long serialVersionUID
= 8375295443642690479L;
29 @SuppressWarnings("unused")
30 private static final Logger logger
= Logger
.getLogger(TeamDefaultCacheStrategy
.class);
32 final static UUID uuid
= UUID
.fromString("1cbda0d1-d5cc-480f-bf38-40a510a3f223");
34 public static final String EMPTY_TEAM
= "-empty team-";
36 static public TeamDefaultCacheStrategy
NewInstance(){
37 return new TeamDefaultCacheStrategy();
40 private TeamDefaultCacheStrategy() {
45 protected UUID
getUuid() {
50 public String
getNomenclaturalTitle(Team team
) {
53 List
<Person
> teamMembers
= team
.getTeamMembers();
55 for (Person teamMember
: teamMembers
){
60 }else if (i
< teamMembers
.size() || ( team
.isHasMoreMembers() && i
== teamMembers
.size()) ){
61 concat
= STD_TEAM_CONCATINATION
;
63 concat
= FINAL_TEAM_CONCATINATION
;
65 result
+= concat
+ teamMember
.getNomenclaturalTitle();
67 if (teamMembers
.size() == 0){
68 result
= team
.getTitleCache();
69 }else if (team
.isHasMoreMembers()){
76 public String
getTitleCache(Team team
) {
77 // TODO is still dummy
79 List
<Person
> teamMembers
= team
.getTeamMembers();//Hibernate.initialize(teamMembers);
82 for (Person teamMember
: teamMembers
){
87 }else if (i
< teamMembers
.size()){
88 concat
= STD_TEAM_CONCATINATION
;
90 concat
= FINAL_TEAM_CONCATINATION
;
92 result
+= concat
+ teamMember
.getTitleCache();
94 if (teamMembers
.size() == 0){