Revision bc7a1271
Added by Andreas Kohlbecker over 5 years ago
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/reference/ReferenceType.java | ||
---|---|---|
10 | 10 |
package eu.etaxonomy.cdm.model.reference; |
11 | 11 |
|
12 | 12 |
import java.io.Serializable; |
13 |
import java.util.HashSet; |
|
13 | 14 |
import java.util.Set; |
14 | 15 |
import java.util.UUID; |
15 | 16 |
|
... | ... | |
159 | 160 |
return this == Section || isKindOf(Section); |
160 | 161 |
} |
161 | 162 |
|
163 |
/** |
|
164 |
* Provides the set of type which are applicable as in-references for |
|
165 |
* the <code>subReferenceType</code> passed to this method: |
|
166 |
* |
|
167 |
* The type specific rules are: |
|
168 |
* <ul> |
|
169 |
* <li>Article -> Journal</li> |
|
170 |
* <li>Book -> PrintSeries | Journal<br>(Journal is needed here to cover historic |
|
171 |
* situations: In Ehrenberg's times (Phycology) some articles (prior to publication in a journal) |
|
172 |
* were printed and delivered to colleagues and libraries (published preprints). Therefore it necessary to allow these as (small) |
|
173 |
* books being a part of a Journal.)</li> |
|
174 |
* <li>BookSection -> Book</li> |
|
175 |
* <li>InProceedings -> Proceedings</li> |
|
176 |
* <li>Section -> Article | Book | Thesis | Patent | Report | Webpage | inProceedings</li> |
|
177 |
* </ul> |
|
178 |
* In case the passed <code>subReferenceType</code> matches none of the above rules the returned set will be empty. |
|
179 |
* <p> |
|
180 |
* NOTE: If these constraints are being used in UI contexts, it might be sensible in specific situations to add {@link #Generic} and <code>null</code> |
|
181 |
* to the list in case it was not empty. |
|
182 |
* |
|
183 |
* @param subReferenceType |
|
184 |
* The type of the part for which the possible in-refrence types are to be returned. |
|
185 |
* @return a set, may be empty, never <code>null</code> |
|
186 |
*/ |
|
187 |
public Set<ReferenceType> inReferenceContraints(ReferenceType subReferenceType){ |
|
188 |
Set<ReferenceType> inRefTypes = new HashSet<>(); |
|
189 |
|
|
190 |
if(subReferenceType != null && !subReferenceType.equals(ReferenceType.Generic)){ |
|
191 |
if(subReferenceType.isArticle()){ |
|
192 |
inRefTypes.add(ReferenceType.Journal); |
|
193 |
} else if (subReferenceType == ReferenceType.BookSection) { |
|
194 |
inRefTypes.add(ReferenceType.Book); |
|
195 |
} else if (subReferenceType.isBook()) { |
|
196 |
inRefTypes.add(ReferenceType.PrintSeries); |
|
197 |
inRefTypes.add(ReferenceType.Journal); |
|
198 |
} else if (subReferenceType == ReferenceType.InProceedings) { |
|
199 |
inRefTypes.add(ReferenceType.Proceedings); |
|
200 |
} else if (subReferenceType == ReferenceType.Section) { |
|
201 |
inRefTypes.add(ReferenceType.Article); |
|
202 |
inRefTypes.add(ReferenceType.Book); |
|
203 |
inRefTypes.add(ReferenceType.Thesis); |
|
204 |
inRefTypes.add(ReferenceType.Patent); |
|
205 |
inRefTypes.add(ReferenceType.Report); |
|
206 |
inRefTypes.add(ReferenceType.WebPage); |
|
207 |
inRefTypes.add(ReferenceType.InProceedings); |
|
208 |
} |
|
209 |
} |
|
210 |
|
|
211 |
return inRefTypes; |
|
212 |
} |
|
213 |
|
|
162 | 214 |
// *************************** DELEGATE **************************************/ |
163 | 215 |
|
164 | 216 |
private static EnumeratedTermVoc<ReferenceType> delegateVoc; |
Also available in: Unified diff
ref #7481 inReference constraints added as method to ReferenceType