Project

General

Profile

« Previous | Next » 

Revision 4399

adding document "cart" feature to metacat. will not be highly published as a feature until well-vetted.

View differences:

MetaCatServlet.java
46 46
import java.text.ParseException;
47 47
import java.text.SimpleDateFormat;
48 48
import java.util.Enumeration;
49
import java.util.HashMap;
49 50
import java.util.Hashtable;
50 51
import java.util.Iterator;
52
import java.util.Map;
51 53
import java.util.Timer;
52 54
import java.util.Vector;
53 55
import java.util.zip.ZipEntry;
......
73 75
import com.oreilly.servlet.multipart.ParamPart;
74 76
import com.oreilly.servlet.multipart.Part;
75 77

  
78
import edu.ucsb.nceas.metacat.cart.CartManager;
76 79
import edu.ucsb.nceas.metacat.dataquery.DataQuery;
77 80
import edu.ucsb.nceas.metacat.service.DatabaseService;
78 81
import edu.ucsb.nceas.metacat.service.PropertyService;
......
706 709
							.debug("******************* DATA QUERY ********************");
707 710
					handleDataquery(params, response, sessionId);
708 711
				}
712
				else if (action.trim().equals("editcart")) {
713
					logMetacat
714
							.debug("******************* EDIT CART ********************");
715
					handleEditCart(params, response, sessionId);
716
				}
709 717
				else if (action.equals("export")) {
710 718

  
711 719
					handleExportAction(params, response, userName, groupNames, password);
......
933 941
		
934 942
	}
935 943
	
944
	private void handleEditCart(
945
			Hashtable<String, String[]> params,
946
            HttpServletResponse response,
947
            String sessionId) throws PropertyNotFoundException, IOException {
948
		
949
		CartManager cm = null;
950
		if (sessionId != null) {
951
			cm = new CartManager(sessionId);
952
		}
953
		else {
954
			cm = new CartManager();
955
		}
956
		
957
    	String editOperation = ((String[])params.get("operation"))[0];
958
    	
959
    	String[] docids = (String[]) params.get("docid");
960
    	String[] field = (String[])params.get("field");
961
    	String[] path = (String[])params.get("path");
962
    	
963
    	Map fields = null;
964
    	if (field != null && path != null) {
965
    		fields = new HashMap();
966
    		fields.put(field[0], path[0]);
967
    	}
968
    	
969
    	//TODO handle attribute map (metadata fields)
970
    	cm.editCart(editOperation, docids, fields);
971
    	
972
	}
973
	
936 974
    // ///////////////////////////// METACAT SPATIAL ///////////////////////////
937 975
    
938 976
    /**

Also available in: Unified diff