Changeset 25773

Show
Ignore:
Timestamp:
06.06.2012 20:07:19 (7 years ago)
Author:
ak19
Message:

Fixed the bug where basing a GS3 collection on another one that had collection descriptions and collection names in multiple languages would copy all those additional names and descriptions across to the new collection.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/gli/src/org/greenstone/gatherer/collection/CollectionManager.java

    r24636 r25773  
    661661 
    662662        // We always set title and description here rather than calling mkcol.pl with Unicode arguments 
    663         CollectionMeta collection_name_collectionmeta = collection.cdm.collectionmeta_manager.getMetadatum(StaticStrings.COLLECTIONMETADATA_COLLECTIONNAME_STR); 
     663 
     664        // First though, if we based this collection on another collection and thereyby inherited multilingual 
     665        // collection names and descriptions, clear those before setting description and name to new values. 
     666        ArrayList colname_metas = collection.cdm.collectionmeta_manager.getMetadata(StaticStrings.COLLECTIONMETADATA_COLLECTIONNAME_STR); // retrieves all languages 
     667        ArrayList coldesc_metas = collection.cdm.collectionmeta_manager.getMetadata(StaticStrings.COLLECTIONMETADATA_COLLECTIONEXTRA_STR); 
     668        for(int i = 0; i < colname_metas.size(); i++) { 
     669        CollectionMeta colname_meta = (CollectionMeta)colname_metas.get(i); 
     670        colname_meta.setValue(""); 
     671        }  
     672        for(int i = 0; i < coldesc_metas.size(); i++) { 
     673        CollectionMeta coldesc_meta = (CollectionMeta)coldesc_metas.get(i); 
     674        coldesc_meta.setValue(""); 
     675        } 
     676 
     677        // set the collection name and description (in the default language) 
     678        CollectionMeta collection_name_collectionmeta = collection.cdm.collectionmeta_manager.getMetadatum(StaticStrings.COLLECTIONMETADATA_COLLECTIONNAME_STR); // retrieves default language 
    664679        collection_name_collectionmeta.setValue(title); 
    665680        CollectionMeta collection_extra_collectionmeta = collection.cdm.collectionmeta_manager.getMetadatum(StaticStrings.COLLECTIONMETADATA_COLLECTIONEXTRA_STR);