Author: pwang
Date: 2011-07-07 18:17:36 -0700 (Thu, 07 Jul 2011)
New Revision: 26114

Modified:
   
core3/table-import-impl/trunk/src/main/java/org/cytoscape/tableimport/internal/reader/AttributeLineParser.java
Log:
Support load based on alternative key and clean up

Modified: 
core3/table-import-impl/trunk/src/main/java/org/cytoscape/tableimport/internal/reader/AttributeLineParser.java
===================================================================
--- 
core3/table-import-impl/trunk/src/main/java/org/cytoscape/tableimport/internal/reader/AttributeLineParser.java
      2011-07-08 00:02:23 UTC (rev 26113)
+++ 
core3/table-import-impl/trunk/src/main/java/org/cytoscape/tableimport/internal/reader/AttributeLineParser.java
      2011-07-08 01:17:36 UTC (rev 26114)
@@ -107,9 +107,6 @@
         */
        public void parseEntry(CyTable table, String[] parts) {
 
-               //System.out.println("Entering 
AttributeLineParser.parseEntry()....");
-
-
                /*
                 * Split the line and extract values
                 */
@@ -145,72 +142,27 @@
                 * Case 1: use node ID as the key
                 */
                if (mapping.getMappingAttribute().equals(mapping.ID)) {
-
-                       //System.out.println("AttributeLineParser.parseEntry(): 
case 1: use node ID as the key");
-
                        transfer2cyattributes(table, primaryKey, aliasSet, 
parts);
                } else {
                        /*
                         * Case 2: use an attribute as the key.
                         */
+                               
+                       //String altKey = 
mapping.getAttributeNames()[mapping.getKeyIndex()];
 
-                       //System.out.println("AttributeLineParser.parseEntry(): 
case 2: use an attribute as the key");
-
-                       List<String> objectIDs = null;
-
-                       for (String id : aliasSet) {
-                               // Normal Mapping.  Case sensitive.
-
-                               if 
(mapping.getAttributeToIDMap().containsKey(id)) {
-                                       objectIDs = mapping.toID(id);
-
-                                       for (String objectID : objectIDs) {
-                                               
//mapping.getAlias().add(objectID, new ArrayList<String>(aliasSet));
-                                       }
-
-                                       break;
-                               } else if (mapping.getCaseSensitive() == false) 
{
-
-                                       Set<String> keySet = 
mapping.getAttributeToIDMap().keySet();
-
-                                       String newKey = null;
-
-                                       for (String key : keySet) {
-                                               if (key.equalsIgnoreCase(id)) {
-                                                       newKey = key;
-
-                                                       break;
-                                               }
-                                       }
-
-                                       if (newKey != null) {
-                                               objectIDs = 
mapping.toID(newKey);
-
-                                               for (String objectID : 
objectIDs) {
-                                                       
//mapping.getAlias().add(objectID, new ArrayList<String>(aliasSet));
-                                               }
-
-                                               break;
-                                       }
-                               }
-                       }
-
-                       if (objectIDs != null) {
-                               for (String key : objectIDs) {
-                                       transfer2cyattributes(table, key, 
aliasSet, parts);
-                               }
-                       }
+                       // load it the same as case 1 for now
+                       transfer2cyattributes(table, primaryKey, aliasSet, 
parts);
                }
        }
 
        private void transfer2cyattributes(CyTable table, String primaryKey, 
Set<String> aliasSet, String[] parts) {
 
-               //System.out.println("Entering 
AttributeLineParser.transfer2cyattributes()....");
-
-
                String altKey = null;
                String targetNetworkID = null;
 
+
+               altKey =primaryKey;
+
                /*
                 * Search the key
                 */
@@ -389,9 +341,15 @@
                                else if (altKey == null) {
                                        mapAttribute(table, primaryKey, 
parts[i].trim(), i);
                                } else {
-                                       mapAttribute(table, altKey, 
parts[i].trim(), i);
+                                       //mapAttribute(table, altKey, 
parts[i].trim(), i);
                                }
                        }
+                       
+                       if (altKey != null) {
+                               //System.out.println("\tuse altKey to 
mapAttribute ....");
+                               mapAttribute(table, primaryKey, 
parts[i].trim(), i);                    
+                       
+                       }
                }
 
                /*
@@ -416,8 +374,6 @@
         */
        private void mapAttribute(CyTable table, final String key, final String 
entry, final int index) {
 
-               //System.out.println("MapAttribute(): key ="+ 
key+"\tattributeName ="+ mapping.getAttributeNames()[index] + ", value = "+ 
entry);
-
                final Byte type = mapping.getAttributeTypes()[index];
 
                switch (type) {

-- 
You received this message because you are subscribed to the Google Groups 
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/cytoscape-cvs?hl=en.

Reply via email to