Coverage Report - org.seasar.teeda.core.config.faces.assembler.impl.DefaultApplicationAssembler
 
Classes in this File Line Coverage Branch Coverage Complexity
DefaultApplicationAssembler
96%
25/26
83%
5/6
2
 
 1  
 /*
 2  
  * Copyright 2004-2011 the Seasar Foundation and the Others.
 3  
  *
 4  
  * Licensed under the Apache License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  *
 8  
  *     http://www.apache.org/licenses/LICENSE-2.0
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 13  
  * either express or implied. See the License for the specific language
 14  
  * governing permissions and limitations under the License.
 15  
  */
 16  
 package org.seasar.teeda.core.config.faces.assembler.impl;
 17  
 
 18  
 import java.util.Iterator;
 19  
 import java.util.LinkedList;
 20  
 import java.util.List;
 21  
 
 22  
 import javax.faces.application.Application;
 23  
 
 24  
 import org.seasar.teeda.core.config.faces.assembler.ApplicationAssembler;
 25  
 import org.seasar.teeda.core.config.faces.assembler.ApplicationAssemblerHelper;
 26  
 import org.seasar.teeda.core.config.faces.assembler.ApplicationChildAssembler;
 27  
 import org.seasar.teeda.core.config.faces.element.ApplicationElement;
 28  
 import org.seasar.teeda.core.util.ApplicationUtil;
 29  
 import org.seasar.teeda.core.util.IteratorUtil;
 30  
 
 31  
 public class DefaultApplicationAssembler extends ApplicationAssembler {
 32  
 
 33  
     private ApplicationAssemblerHelper helper_;
 34  
 
 35  
     public DefaultApplicationAssembler(List applications) {
 36  3
         super(applications);
 37  3
     }
 38  
 
 39  
     public void assemble() {
 40  3
         List assemblers = helper_.getCollectedAssemblers();
 41  3
         for (Iterator itr = IteratorUtil.getIterator(assemblers); itr.hasNext();) {
 42  27
             ApplicationChildAssembler assembler = (ApplicationChildAssembler) itr
 43  
                     .next();
 44  27
             assembler.assemble();
 45  
         }
 46  3
     }
 47  
 
 48  
     protected void setupBeforeAssemble() {
 49  3
         ApplicationElement appElement = null;
 50  3
         helper_ = createApplicationAssemblerHelper();
 51  3
         for (Iterator itr = IteratorUtil.getIterator(getApplications()); itr
 52  6
                 .hasNext();) {
 53  3
             appElement = (ApplicationElement) itr.next();
 54  3
             helper_.setupActionListenerAssembler(appElement
 55  
                     .getActionListeners());
 56  3
             helper_.setupLocaleConfigAssembler(appElement.getLocaleConfigs());
 57  3
             helper_.setupNavigationHandlerAssembler(appElement
 58  
                     .getNavigationHandlers());
 59  3
             helper_.setupPropertyResolverAssembler(appElement
 60  
                     .getPropertyResolvers());
 61  3
             helper_.setupStateManagerAssembler(appElement.getStateManagers());
 62  3
             helper_.setupVariableResolverAssembler(appElement
 63  
                     .getVariableResolvers());
 64  3
             helper_.setupViewHandlerAssembler(appElement.getViewHandlers());
 65  3
             helper_.setupDefaultRenderKitIdAssembler(appElement
 66  
                     .getDefaultRenderKitIds());
 67  3
             helper_.setupMessageBundleAssembler(appElement.getMessageBundles());
 68  
         }
 69  3
     }
 70  
 
 71  
     protected ApplicationAssemblerHelper createApplicationAssemblerHelper() {
 72  3
         if (helper_ != null) {
 73  0
             return helper_;
 74  
         }
 75  3
         Application application = ApplicationUtil.getApplicationFromFactory();
 76  3
         return new ApplicationAssemblerHelperImpl(application, new LinkedList());
 77  
     }
 78  
 
 79  
 }