Ignore:
Timestamp:
02/25/14 09:35:47 (10 years ago)
Author:
twagoo
Message:

Fixed errors due to schema change allowing only one root element in a profile or component (see r4525)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ComponentRegistry/trunk/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/frontend/StatisticsPage.java

    r1419 r4550  
    2121import clarin.cmdi.componentregistry.model.ComponentDescription;
    2222import clarin.cmdi.componentregistry.model.ProfileDescription;
     23import java.util.Collection;
     24import java.util.Collections;
    2325
    2426/**
     
    6971        CMDComponentSpec profile = CMDComponentSpecExpanderDbImpl.expandProfile(pd.getId(), (ComponentRegistryDbImpl) registry);
    7072        Statistics stats = new Statistics();
    71         componentCounter(profile.getCMDComponent(), stats);
     73        componentCounter(profile, stats);
    7274        item.add(new Label("nrcomp", "" + stats.componentnumber));
    7375        item.add(new Label("nrprofelem", "" + stats.elementcounter));
     
    8284        CMDComponentSpec compspec = CMDComponentSpecExpanderDbImpl.expandComponent(cd.getId(), (ComponentRegistryDbImpl) registry);
    8385        Statistics stats = new Statistics();
    84         componentCounter(compspec.getCMDComponent(), stats);
     86        componentCounter(compspec, stats);
    8587        item.add(new Label("nrcomp", "" + stats.componentnumber));
    8688        item.add(new Label("nrelem", "" + stats.elementcounter));
     
    8890    }
    8991
    90     private void componentCounter(List<CMDComponentType> components, Statistics stats) {
     92    private void componentCounter(CMDComponentSpec components, Statistics stats) {
     93        componentCounter(Collections.singleton(components.getCMDComponent()), stats);
     94    }
     95   
     96    private void componentCounter(Collection<CMDComponentType> components, Statistics stats) {
    9197        if (components != null) {
    9298            for (CMDComponentType component : components) {
Note: See TracChangeset for help on using the changeset viewer.