package ca.corefacility.bioinformatics.irida.model.sample;

import java.util.HashMap;
import java.util.Map;

import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;

/**
 * Stores unstructured metadata for a given {@link Sample}.
 */
@Document
public class SampleMetadata {

	@Field(value = "metadata")
	Map<String, Object> metadata;

	@Id
	Long sampleId;

	public SampleMetadata() {
		metadata = new HashMap<>();
	}

	public Map<String, Object> getMetadata() {
		if (this.metadata == null) {
			this.metadata = new HashMap<>();
		}
		return metadata;
	}

	public void setMetadata(Map<String, Object> metadata) {
		this.metadata = metadata;
	}

	public Long getSampleId() {
		return sampleId;
	}

	public void setSampleId(Long sampleId) {
		this.sampleId = sampleId;
	}
}

@@ -573,79 +573,8 @@
 ) %7B%0A
-%09%09if (this.metadata == null) %7B%0A%09%09%09this.metadata = new HashMap%3C%3E();%0A%09%09%7D%0A
 %09%09re

Revert "Need a check for an emtpy hash"