package gov.nih.nci.calab.service.workflow;

/**
 * Generalizes Mask functionality for masking Aliquot, File, etc.  
 * @author doswellj
 * @param strType Type of Mask (e.g., aliquot, file, run, etc.)
 * @param strId	  The id associated to the type
 * @param strDescription The mask description associated to the mask type and Id. 
 *
 */
public class MaskService 
{
    
	//This functionality is pending the completed Object Model
	public void setMask(String strType, String strId, String strDescription)
    {
        if (strType.equals("aliquot"))
        {
            //TODO Find Aliquot record based on the strID
        	
        	//TODO Set File Status record to "Masked". 
        	
        }
        if (strType.equals("file"))
        {
        	//TODO Find File record based on the its strID
        	
        	//TODO Set File Status record to "Masked". 
        }
        	
        	 
    }
    
}

@@ -38,16 +38,266 @@
 kflow;%0A%0A
+import gov.nih.nci.calab.db.DataAccessProxy;%0Aimport gov.nih.nci.calab.db.IDataAccess;%0Aimport gov.nih.nci.calab.domain.Aliquot;%0Aimport gov.nih.nci.calab.domain.DataStatus;%0Aimport gov.nih.nci.calab.service.util.CalabConstants;%0A%0Aimport java.util.List;%0A%0A
 /**%0A * G
@@ -752,15 +752,159 @@
 ion)
-%0A    %7B%0A
+ throws Exception%0A    %7B%0A        IDataAccess ida = (new DataAccessProxy()).getInstance(IDataAccess.HIBERNATE);%0A%0A%09%09try %7B%0A%09        ida.open();%0A%09        %0A%09
     
@@ -934,24 +934,25 @@
 %22aliquot%22))%0A
+%09
         %7B%0A  
@@ -941,32 +941,33 @@
 t%22))%0A%09        %7B%0A
+%09
             //TO
@@ -1012,71 +1012,358 @@
 rID%0A
-        %09%0A        %09//TODO Set File Status record to %22Masked%22. %0A
+%09%09%09%09List aliquots = ida.search(%22from Aliquot aliquot where aliquot.name='%22 + strId + %22'%22);%0A%09%09%09%09Aliquot aliquot = (Aliquot)aliquots.get(0);%0A%09%09%09%09DataStatus maskStatus = new DataStatus();%0A%09%09%09%09maskStatus.setReason(strDescription);%0A%09%09%09%09maskStatus.setStatus(CalabConstants.MASK_STATUS);%0A%09%09%09%09%0A%09%09%09%09aliquot.setDataStatus(maskStatus);%0A%09%09%09%09ida.store(aliquot); %09
     
@@ -1360,32 +1360,33 @@
 ot); %09        %09%0A
+%09
         %7D%0A      
@@ -1371,32 +1371,33 @@
    %09%0A%09        %7D%0A
+%09
         if (strT
@@ -1416,16 +1416,17 @@
 file%22))%0A
+%09
         
@@ -1423,24 +1423,25 @@
 %0A%09        %7B%0A
+%09
         %09//T
@@ -1484,16 +1484,17 @@
 s strID%0A
+%09
         
@@ -1487,32 +1487,33 @@
 trID%0A%09        %09%0A
+%09
         %09//TODO 
@@ -1549,16 +1549,17 @@
 sked%22. %0A
+%09
         
@@ -1556,24 +1556,183 @@
 %0A%09        %7D%0A
+%09%09%09ida.close();%0A%09%09%7Dcatch (Exception e) %7B%0A%09%09%09%0A%09%09%09ida.rollback();%0A%09%09%09ida.close();%0A%09%09%09%0A%09%09%09e.printStackTrace();%0A%09%09%09throw new RuntimeException(e.getMessage());%0A%09%09%7D%0A
         %09%0A  

Implement the mask aliquot section.