Changeset 090204


Ignore:
Timestamp:
Feb 28, 2009, 2:21:46 AM (13 years ago)
Author:
rene <rene@…>
Branches:
lite_0.1, multiEdit, ng_0.6, ng_0.6_help, ng_0.8, ng_0.9
Children:
cc211b
Parents:
74f9c7
Message:

moved upgrade-function to relevant file

Location:
chrome/content/v_identity
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • chrome/content/v_identity/vI_rdfDatasource.js

    r74f9c7 r090204  
    213213    },
    214214   
    215     // only used for upgrade to 0.0.3 - loop through all ressources.
    216     readAllResourcesFromRDF : function (addNewDatum) {
    217         vI_notificationBar.dump("## vI_rdfDatasource: readAllResourcesFromRDF.\n");
    218         var enumerator = vI_rdfDatasource.rdfDataSource.GetAllResources();
    219         while (enumerator && enumerator.hasMoreElements()) {
    220             var resource = enumerator.getNext();
    221             resource.QueryInterface(Components.interfaces.nsIRDFResource);
    222            
    223             var type; var name;
    224             if (resource.ValueUTF8.match(new RegExp(vI_rdfDatasource.rdfNS + vI_rdfDatasource.rdfNSEmail + "/", "i")))
    225                 { type = "email"; name = RegExp.rightContext }
    226             else if (resource.ValueUTF8.match(new RegExp(vI_rdfDatasource.rdfNS + vI_rdfDatasource.rdfNSNewsgroup + "/", "i")))
    227                 { type = "newsgroup"; name = RegExp.rightContext }
    228             else if (resource.ValueUTF8.match(new RegExp(vI_rdfDatasource.rdfNS + vI_rdfDatasource.rdfNSMaillist + "/", "i")))
    229                 { type = "maillist"; name = RegExp.rightContext }
    230             else continue;
    231            
    232             addNewDatum (resource, type, name)
    233         }
    234     },
    235 
    236215    __findMatchingFilter : function (recDescription) {
    237216        vI_notificationBar.dump("## vI_rdfDatasource: __findMatchingFilter for " + recDescription + ".\n");
  • chrome/content/v_identity/vI_upgrade.js

    r74f9c7 r090204  
    9898        vI_notificationBar.dump("checking for previous version of rdf, found " +
    9999            vI_rdfDatasource.getCurrentRDFFileVersion() + "\nrdf-upgrade required.\n")
     100        // upgrade from pre0.0.3 to 0.0.3
    100101        vI_upgrade.__createRDFContainers();
    101102        vI_rdfDatasource.storeRDFVersion();
     
    103104    },
    104105   
    105     __createContainersUpgradeElems: function(resource, type, name) {
    106         var container = vI_rdfDatasource.getContainer(type);
    107         vI_rdfDatasource.__setRDFValue(resource, "name", name);
    108         if (container.IndexOf(resource) == -1) container.AppendElement(resource);
     106    // only used for upgrade to 0.0.3 - loop through all ressources.
     107    __transferAllResources : function () {
     108        vI_notificationBar.dump("upgrade: transferAllResources ");
     109        var enumerator = vI_rdfDatasource.rdfDataSource.GetAllResources();
     110        while (enumerator && enumerator.hasMoreElements()) {
     111            var resource = enumerator.getNext();
     112            resource.QueryInterface(Components.interfaces.nsIRDFResource);
     113           
     114            var type; var name;
     115            if (resource.ValueUTF8.match(new RegExp(vI_rdfDatasource.rdfNS + vI_rdfDatasource.rdfNSEmail + "/", "i")))
     116                { type = "email"; name = RegExp.rightContext }
     117            else if (resource.ValueUTF8.match(new RegExp(vI_rdfDatasource.rdfNS + vI_rdfDatasource.rdfNSNewsgroup + "/", "i")))
     118                { type = "newsgroup"; name = RegExp.rightContext }
     119            else if (resource.ValueUTF8.match(new RegExp(vI_rdfDatasource.rdfNS + vI_rdfDatasource.rdfNSMaillist + "/", "i")))
     120                { type = "maillist"; name = RegExp.rightContext }
     121            else continue;
     122           
     123            var container = vI_rdfDatasource.getContainer(type);
     124            vI_rdfDatasource.__setRDFValue(resource, "name", name);
     125           
     126            if (container.IndexOf(resource) == -1) container.AppendElement(resource);
     127       
     128            vI_notificationBar.dump(".");
     129        }
     130        vI_notificationBar.dump("\n");
    109131    },
    110132
     
    137159        container = Components.classes["@mozilla.org/rdf/container;1"].
    138160            createInstance(Components.interfaces.nsIRDFContainer);
    139 
     161       
     162        // initialize container with storageRes
    140163        container.Init(vI_rdfDatasource.rdfDataSource, storageRes);
     164        // append all new containers to storageRes
    141165        if (container.IndexOf(emailRes) == -1) container.AppendElement(emailRes);
    142166        if (container.IndexOf(maillistRes) == -1) container.AppendElement(maillistRes);
     
    145169       
    146170        vI_rdfDatasource.__initContainers();
    147         vI_rdfDatasource.readAllResourcesFromRDF(vI_upgrade.__createContainersUpgradeElems)
     171       
     172        vI_upgrade.__transferAllResources();
    148173    },
    149174   
Note: See TracChangeset for help on using the changeset viewer.