Revision be6d7785
Added by Katja Luther over 2 years ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/descriptiveDataSet/matrix/MatrixUtility.java | ||
---|---|---|
12 | 12 |
|
13 | 13 |
import org.eclipse.swt.graphics.Image; |
14 | 14 |
|
15 |
import eu.etaxonomy.cdm.api.service.dto.CategoricalDataDto; |
|
16 |
import eu.etaxonomy.cdm.api.service.dto.DescriptionElementDto; |
|
17 |
import eu.etaxonomy.cdm.api.service.dto.RowWrapperDTO; |
|
18 |
import eu.etaxonomy.cdm.api.service.dto.StateDataDto; |
|
15 | 19 |
import eu.etaxonomy.cdm.api.service.dto.TaxonRowWrapperDTO; |
16 | 20 |
import eu.etaxonomy.cdm.model.description.DescriptionType; |
17 | 21 |
import eu.etaxonomy.cdm.model.description.DescriptiveDataSet; |
... | ... | |
19 | 23 |
import eu.etaxonomy.cdm.model.taxon.Classification; |
20 | 24 |
import eu.etaxonomy.cdm.model.taxon.TaxonNode; |
21 | 25 |
import eu.etaxonomy.cdm.persistence.dto.FeatureDto; |
26 |
import eu.etaxonomy.cdm.persistence.dto.FeatureStateDto; |
|
27 |
import eu.etaxonomy.cdm.persistence.dto.TermDto; |
|
28 |
import eu.etaxonomy.cdm.persistence.dto.TermTreeDto; |
|
22 | 29 |
import eu.etaxonomy.taxeditor.model.ImageResources; |
23 | 30 |
|
24 | 31 |
/** |
... | ... | |
86 | 93 |
public static Image getDefaultDescriptionIcon() { |
87 | 94 |
return ImageResources.getImage(ImageResources.VALIDATE_ICON); |
88 | 95 |
} |
96 |
|
|
97 |
private boolean isApplicableCheck(FeatureDto feature, RowWrapperDTO<?> rowWrapperDTO, TermTreeDto tree) { |
|
98 |
// TermTreeDto tree = matrix.getDescriptiveDataSet().getDescriptiveSystem(); |
|
99 |
boolean isApplicableCheck = true; |
|
100 |
if (tree.getOnlyApplicable().containsKey(feature.getUuid())){ |
|
101 |
|
|
102 |
for (FeatureStateDto featureStateDto:tree.getOnlyApplicable().get(feature.getUuid())){ |
|
103 |
isApplicableCheck = false; |
|
104 |
FeatureDto dto = featureStateDto.getFeature(); |
|
105 |
TermDto stateDto = featureStateDto.getState(); |
|
106 |
Set<DescriptionElementDto> descEls = rowWrapperDTO.getDataValueForFeature(dto.getUuid()); |
|
107 |
if (descEls != null){ |
|
108 |
for (DescriptionElementDto el:descEls){ |
|
109 |
if (el instanceof CategoricalDataDto){ |
|
110 |
for (StateDataDto stateData:((CategoricalDataDto) el).getStates()){ |
|
111 |
isApplicableCheck |= stateData.getState().getUuid().equals(stateDto.getUuid()); |
|
112 |
} |
|
113 |
} |
|
114 |
} |
|
115 |
} |
|
116 |
} |
|
117 |
} |
|
118 |
if (tree.getInapplicableMap().containsKey(feature.getUuid())){ |
|
119 |
for (FeatureStateDto featureStateDto:tree.getInapplicableMap().get(feature.getUuid())){ |
|
120 |
FeatureDto dto = featureStateDto.getFeature(); |
|
121 |
TermDto stateDto = featureStateDto.getState(); |
|
122 |
Set<DescriptionElementDto> descEls = rowWrapperDTO.getDataValueForFeature(dto.getUuid()); |
|
123 |
if (descEls != null){ |
|
124 |
for (DescriptionElementDto el:descEls){ |
|
125 |
if (el instanceof CategoricalDataDto){ |
|
126 |
for (StateDataDto stateData:((CategoricalDataDto) el).getStates()){ |
|
127 |
isApplicableCheck &= !stateData.getState().getUuid().equals(stateDto.getUuid()); |
|
128 |
} |
|
129 |
} |
|
130 |
} |
|
131 |
} |
|
132 |
} |
|
133 |
} |
|
134 |
if (!isApplicableCheck){ |
|
135 |
|
|
136 |
} |
|
137 |
return isApplicableCheck; |
|
138 |
} |
|
89 | 139 |
|
90 | 140 |
// private static boolean hasType(TaxonRowWrapperDTO taxonRowWrapperDTO, DescriptionType descriptionType){ |
91 | 141 |
// return taxonRowWrapperDTO.getDescription().getTypes().stream() |
Also available in: Unified diff
ref #9861: do not show values when not applicable