Project

General

Profile

Revision 8147e611

ID8147e61120e31ba6a0d6a18ae7530fbcaf2983b9
Parent c4d4c070
Child ee0f2cda

Added by Andreas Müller over 1 year ago

fix #9009 add MediaMetaData (cont.)

View differences:

cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/media/MediaMetaData.java
44 44
 */
45 45
@XmlAccessorType(XmlAccessType.FIELD)
46 46
@XmlType(name = "MediaMetaData", propOrder = {
47
    "mediaRepresentationPart",
47
    "mediaRepresentation",
48 48
    "key",
49 49
    "value"
50 50
 })
51 51
@Entity
52 52
@Audited  //necessary because otherwise mapping from MediaRepresentationPart to MediaMetaData is not possible
53 53
@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
54
public class MediaMetaData extends CdmBase {
54
public class MediaMetaData extends CdmBase implements Cloneable {
55 55

  
56 56
    private static final long serialVersionUID = -2523716526037575324L;
57 57

  
......
115 115
        this.value = value;
116 116
    }
117 117

  
118
// ************************* clone ************************/
119

  
120
    @Override
121
    public MediaMetaData clone() throws CloneNotSupportedException {
122
        MediaMetaData result = (MediaMetaData)super.clone();
123

  
124
        //need to change mediaRepresentation?
125

  
126
        //no change: key, value
127
        return result;
128
    }
129

  
118 130
// ************************** toString ************************/
119 131

  
120 132
    @Override
121 133
    public String toString() {
122 134
        return "MediaMetaData [" + key + "=" + value + "]";
123 135
    }
124

  
125 136
}
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/media/MediaRepresentationPart.java
46 46
@XmlType(name = "MediaRepresentationPart", propOrder = {
47 47
		"uri",
48 48
        "size",
49
        "mediaRepresentation"
49
        "mediaRepresentation",
50
        "mediaMetaData"
50 51
  })
51 52
@Entity
52 53
@Audited
53
public class MediaRepresentationPart extends VersionableEntity implements Cloneable{
54
public class MediaRepresentationPart extends VersionableEntity {
54 55
	private static final long serialVersionUID = -1674422508643785796L;
55 56
	@SuppressWarnings("unused")
56 57
	private static final Logger logger = Logger.getLogger(MediaRepresentationPart.class);
......
128 129
		this.size = size;
129 130
	}
130 131

  
132
	//metadata
133

  
134

  
131 135
	public void addMediaMetaData(MediaMetaData metaData){
132 136
	    this.mediaMetaData.add(metaData);
133 137
	    if(metaData.getMediaRepresentation() != this){
......
135 139
	    }
136 140
    }
137 141

  
142
    public Set<MediaMetaData> getMediaMetaData() {
143
        return mediaMetaData;
144
    }
145

  
146
//    public void setMediaMetaData(Set<MediaMetaData> mediaMetaData) {
147
//        this.mediaMetaData = mediaMetaData;
148
//    }
149

  
138 150
    public void removeMediaMetaData(MediaMetaData metaData){
139 151
        this.mediaMetaData.remove(metaData);
140 152
        if(metaData.getMediaRepresentation() == this){
......
152 164
		//media representation
153 165
		result.setMediaRepresentation(null);
154 166

  
167
		for (MediaMetaData metaData : this.getMediaMetaData()) {
168
		    result.addMediaMetaData(metaData.clone());
169
		}
170

  
155 171
		//no changes to: size, uri
156 172
		return result;
157 173
	}

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)