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;
	}
}

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() {
		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;
	}
}

Revert "Need a check for an emtpy hash"
Revert "Need a check for an emtpy hash"

This reverts commit 07100389c363710260f4c0f5799da548672ad06a.
