package net.canadensys.dataportal.occurrence.dao;

import net.canadensys.dataportal.occurrence.model.ResourceMetadataModel;

/**
 * Interface for accessing resource information data.
 * 
 * @author Pedro Guimarães
 */
public interface ResourceMetadataDAO {

	/**
	 * Save a ResourceMetadataModel
	 * 
	 * @param ResourceMetadataModel
	 * @return success or not
	 */
	public boolean save(ResourceMetadataModel resourceMetadataModel);

	/**
	 * Load a ResourceMetadataModel from an id
	 * 
	 * @param id
	 * @return ResourceMetadataModel or null if nothing is found
	 */
	public ResourceMetadataModel load(Integer dwca_resource_id);

	/**
	 * Load a ResourceMetadataModel from a resource_uuid
	 * 
	 * @param resource_uuid
	 * @return ResourceMetadataModel list or an empty list if nothing is found
	 */
	public ResourceMetadataModel load(String resource_uuid);

	/**
	 * Drop a ResourceMetadata record from the table and all its associated resourceContacts;
	 * 
	 * @param resourceMetadataModel
	 */
	public boolean delete(ResourceMetadataModel resourceMetadataModel);

}

@@ -207,16 +207,37 @@
 imar%C3%A3es%0A
+ * @author cgendreau%0A
  */%0Apubl
@@ -272,16 +272,719 @@
 aDAO %7B%0A%0A
+%09/**%0A%09 * Possible values for ContactModel role attribute%0A%09 * %0A%09 * @author cgendreau%0A%09 * %0A%09 */%0A%09public enum ContactRole %7B%0A%09%09CONTACT(%22contact%22),%0A%09%09AGENT(%22agent%22),%0A%09%09METADATA_PROVIDER(%22metadata_provider%22),%0A%09%09RESOURCE_CREATOR(%22resource_creator%22);%0A%0A%09%09private String key;%0A%0A%09%09private ContactRole(String key) %7B%0A%09%09%09this.key = key;%0A%09%09%7D%0A%0A%09%09public String getKey() %7B%0A%09%09%09return key;%0A%09%09%7D%0A%0A%09%09/**%0A%09%09 * Return the matching ContactRole or null.%0A%09%09 * The matching is case insensitive.%0A%09%09 * %0A%09%09 * @param key%0A%09%09 * @return%0A%09%09 */%0A%09%09public static ContactRole fromKey(String key) %7B%0A%09%09%09for (ContactRole curr : ContactRole.values()) %7B%0A%09%09%09%09if (curr.key.equalsIgnoreCase(key)) %7B%0A%09%09%09%09%09return curr;%0A%09%09%09%09%7D%0A%09%09%09%7D%0A%09%09%09return null;%0A%09%09%7D%0A%09%7D;%0A%0A
 %09/**%0A%09 *

update ResourceMetadataDAO