Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * This program is free software; you can redistribute it and/or modify it under the
   * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software
   * Foundation.
   *
   * You should have received a copy of the GNU Lesser General Public License along with this
   * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html
   * or from the Free Software Foundation, Inc.,
   * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  *
  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * See the GNU Lesser General Public License for more details.
  *
  * Copyright (c) 2009 Pentaho Corporation..  All rights reserved.
  */
 package org.pentaho.pms.schema.concept.types.aggregation;
 
 import java.util.List;
 
 import  org.pentaho.di.core.xml.XMLHandler;
This property allows for a list of aggregations to be selected.

Deprecated:
as of metadata 3.0.
Author(s):
Will Gorman (wgorman@pentaho.com)
 
 public class ConceptPropertyAggregationList extends ConceptPropertyBase implements Cloneable
 {
     private List<AggregationSettingsvalue;
 
     public ConceptPropertyAggregationList(String nameList<AggregationSettingsvalue) {
         this(namevaluefalse);
     }
 
     public ConceptPropertyAggregationList(String nameList<AggregationSettingsvalueboolean required) {
         super(namerequired);
         setValue(value);
     }
 
     public String toString(){
       return new ToStringBuilder(this.).
       append(getId()).append(isRequired()).append().
       toString();
     }
 
     public Object clone() throws CloneNotSupportedException
     {
       if ( != null) {
         rtn.value = new ArrayList<AggregationSettings>();
         rtn.value.addAll();
       }
       return rtn;
     }
 
     public ConceptPropertyType getType()
     {
         return .;
     }
 
     public Object getValue()
     {
         return ;
     }
 
     public String toXML()
     {
         StringBuffer xml = new StringBuffer();
         
         xml.append("<aggregationlist>").append(.); //$NON-NLS-1$
         for (AggregationSettings setting : ) {
           xml.append("  <aggregation>").append(setting.getCode());
           xml.append("</aggregation>").append(.); //$NON-NLS-1$
         }
         xml.append("</aggregationlist>").append(.); //$NON-NLS-1$
         return xml.toString();
     }
     
     public static List<AggregationSettingsfromXML(String valuethrows Exception
     {
         try
         {
             Document doc = XMLHandler.loadXMLString(value);
             List<AggregationSettingsaggSettings = new ArrayList<AggregationSettings>();
             Node node = XMLHandler.getSubNode(doc"aggregationlist"); //$NON-NLS-1$
             int nrAggs = XMLHandler.countNodes(node"aggregation"); //$NON-NLS-1$
             for (int i=0;i<nrAggs;i++) {
                Node aggNode = XMLHandler.getSubNodeByNr(node"aggregation"i); //$NON-NLS-1$
                String type = XMLHandler.getNodeValue(aggNode); //$NON-NLS-1$
                if (type != null) {
                  AggregationSettings setting = AggregationSettings.getType(type);
                  if (setting != null) {
                    aggSettings.add(setting);
                  }
                }
            }
            if (aggSettings.size() != 0) {
              return aggSettings;
            } else {
              return null;
            }
        }
        catch(Exception e)
        {
            throw new Exception(Messages.getString("ConceptPropertyAggregationList.ERROR_0001_CANT_CREATE_AGGLIST_OBJECT"), e); //$NON-NLS-1$
        }
    }
    
    @SuppressWarnings("unchecked")
    public void setValue(Object value){ 
      if (value != null) {
        this. = (List<AggregationSettings>) value;
      } else {
        this. = new ArrayList<AggregationSettings>();
      }
    }
    public boolean equals(Object obj)
    {
        return .equals(obj);
    }
    public int hashCode()
    {
        return .hashCode();
    }
New to GrepCode? Check out our FAQ X