Revision 0dbb43aa
Added by Patrick Plitzner over 9 years ago
- fixed persistent saving of media of a MediaSpecimen (#3339)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/media/MediaSpecimenGeneralDetailElement.java | ||
---|---|---|
10 | 10 |
package eu.etaxonomy.taxeditor.ui.section.occurrence.media; |
11 | 11 |
|
12 | 12 |
import java.net.URISyntaxException; |
13 |
import java.util.List; |
|
13 | 14 |
import java.util.Set; |
14 | 15 |
|
15 | 16 |
import org.eclipse.swt.widgets.Label; |
... | ... | |
179 | 180 |
} |
180 | 181 |
|
181 | 182 |
private MediaRepresentationPart getMediaRepresentationPart(Media media) { |
182 |
if(mediaRepresentationPart!=null){ |
|
183 |
return mediaRepresentationPart; |
|
184 |
} |
|
185 |
else { |
|
186 |
MediaRepresentationPart part = MediaRepresentationPart.NewInstance(null, null); |
|
187 |
|
|
183 |
if(mediaRepresentationPart==null){ |
|
188 | 184 |
Set<MediaRepresentation> representations = media.getRepresentations(); |
189 |
MediaRepresentation mediaRepresentation = MediaRepresentation.NewInstance(); |
|
190 |
mediaRepresentation.addRepresentationPart(part); |
|
191 |
media.addRepresentation(mediaRepresentation); |
|
192 |
return part; |
|
185 |
if(representations!=null && representations.size()>0){ |
|
186 |
MediaRepresentation mediaRepresentation = representations.iterator().next(); |
|
187 |
List<MediaRepresentationPart> parts = mediaRepresentation.getParts(); |
|
188 |
if(parts!=null && parts.size()>0){ |
|
189 |
mediaRepresentationPart = parts.iterator().next(); |
|
190 |
} |
|
191 |
else{ |
|
192 |
mediaRepresentationPart = MediaRepresentationPart.NewInstance(null, null); |
|
193 |
mediaRepresentation.addRepresentationPart(mediaRepresentationPart); |
|
194 |
} |
|
195 |
} |
|
196 |
else{ |
|
197 |
mediaRepresentationPart = MediaRepresentationPart.NewInstance(null, null); |
|
198 |
|
|
199 |
MediaRepresentation mediaRepresentation = MediaRepresentation.NewInstance(); |
|
200 |
mediaRepresentation.addRepresentationPart(mediaRepresentationPart); |
|
201 |
media.addRepresentation(mediaRepresentation); |
|
202 |
} |
|
193 | 203 |
} |
204 |
return mediaRepresentationPart; |
|
194 | 205 |
} |
195 | 206 |
|
196 | 207 |
} |
Also available in: Unified diff