Changeset 2087


Ignore:
Timestamp:
Nov 7, 2011, 12:12:42 PM (12 years ago)
Author:
tjeerd@…
Message:

Possible fix for VIS-46, all fieldId's are now Base64-encoded

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/controllers/dbnp/visualization/VisualizeController.groovy

    r2065 r2087  
    285285            }
    286286            if(type=="templatefields"){
    287                 fields << [ "id": createFieldId( id: collectionOfFields.id, name: collectionOfFields.name, source: source, type: category ), "source": source, "category": category, "name": collectionOfFields.name ]
     287                fields << [ "id": createFieldId( id: collectionOfFields.id.toString(), name: collectionOfFields.name, source: source, type: category ), "source": source, "category": category, "name": collectionOfFields.name ]
    288288            }
    289289            return fields
     
    10871087        protected Map parseFieldId( String fieldId ) {
    10881088                def attrs = [:]
    1089                
    1090                 def parts = fieldId.split(",")
     1089
     1090                def parts = fieldId.split(",",5)
    10911091               
    10921092                attrs = [
    1093                         "id": parts[ 0 ],
    1094                         "name": parts[ 1 ],
    1095                         "source": parts[ 2 ],
    1096                         "type": parts[ 3 ]
     1093                        "id": new String(parts[ 0 ].decodeBase64()),
     1094                        "name": new String(parts[ 1 ].decodeBase64()),
     1095                        "source": new String(parts[ 2 ].decodeBase64()),
     1096                        "type": new String(parts[ 3 ].decodeBase64()),
     1097            "unit": parts.length>4? new String(parts[ 4 ].decodeBase64()) : null
    10971098                ]
     1099
     1100        return attrs
    10981101        }
    10991102       
     
    11101113                def source = attrs.source;
    11111114                def type = attrs.type ?: ""
    1112                
    1113                 return id + "," + name + "," + source + "," + type;
     1115        def unit = attrs.unit ?: ""
     1116
     1117                return id.bytes.encodeBase64().toString() + "," +
     1118                name.bytes.encodeBase64().toString() + "," +
     1119                source.bytes.encodeBase64().toString() + "," +
     1120                type.bytes.encodeBase64().toString() + "," +
     1121                unit.bytes.encodeBase64().toString();
    11141122        }
    11151123
Note: See TracChangeset for help on using the changeset viewer.