Author: apico
Date: 2010-09-21 00:28:38 -0700 (Tue, 21 Sep 2010)
New Revision: 21962

Modified:
   
csplugins/trunk/soc/jgao/IDMapping/src/csplugins/id/mapping/AttributeBasedIDMappingImpl.java
   
csplugins/trunk/soc/jgao/IDMapping/src/csplugins/id/mapping/service/CyThesaurusNamespace.java
Log:
Found a use case for overwriting existing attributes for attribute mapping.  
These minor changes allow this to happen. Not sure if we want to keep these 
since we should discuss if other use cases fail with this allowed and if 
regressions are introduced.

Modified: 
csplugins/trunk/soc/jgao/IDMapping/src/csplugins/id/mapping/AttributeBasedIDMappingImpl.java
===================================================================
--- 
csplugins/trunk/soc/jgao/IDMapping/src/csplugins/id/mapping/AttributeBasedIDMappingImpl.java
        2010-09-21 01:25:00 UTC (rev 21961)
+++ 
csplugins/trunk/soc/jgao/IDMapping/src/csplugins/id/mapping/AttributeBasedIDMappingImpl.java
        2010-09-21 07:28:38 UTC (rev 21962)
@@ -94,6 +94,16 @@
         for (Map.Entry<String,Byte> entry : attrNameType.entrySet()) {
             String attrname = entry.getKey();
             byte attrtype = entry.getValue();
+            
+            //hack to allow overwriting existing attributes
+            boolean skip = false;
+            for (String existingName : nodeAttributes.getAttributeNames()){
+               if (attrname.equals(existingName)){
+                       skip = true;
+               }
+            }
+            if(skip)
+               break;
 
             byte[] keyTypes;
             if (attrtype==CyAttributes.TYPE_STRING) {

Modified: 
csplugins/trunk/soc/jgao/IDMapping/src/csplugins/id/mapping/service/CyThesaurusNamespace.java
===================================================================
--- 
csplugins/trunk/soc/jgao/IDMapping/src/csplugins/id/mapping/service/CyThesaurusNamespace.java
       2010-09-21 01:25:00 UTC (rev 21961)
+++ 
csplugins/trunk/soc/jgao/IDMapping/src/csplugins/id/mapping/service/CyThesaurusNamespace.java
       2010-09-21 07:28:38 UTC (rev 21962)
@@ -587,8 +587,8 @@
             }
         } else {
             if (attributes.contains(tgtAttr)) {
-                throw new CyCommandException(tgtAttr+" is an existing 
attribute "
-                        + "and hence cannot be used as target attribute 
name.");
+//                throw new CyCommandException(tgtAttr+" is an existing 
attribute "
+//                        + "and hence cannot be used as target attribute 
name.");
             }
         }
 

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