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) 2006 - 2009 Pentaho Corporation..  All rights reserved.
  */
 package org.pentaho.pms.schema.concept;
 
 
 @SuppressWarnings("deprecation")
 public class DefaultPropertyID
 {
     private static final Log logger = LogFactory.getLog(DefaultPropertyID.class);
     private ConceptPropertyType type;
     private String id;
     private String description;
 
     public static final DefaultPropertyID defaults[] = new DefaultPropertyID[]
          {
             new DefaultPropertyID("name",              Messages.getString("DefaultPropertyID.USER_NAME_DESC"), .new ConceptPropertyLocalizedString("name"new LocalizedStringSettings())), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
             new DefaultPropertyID("description",       Messages.getString("DefaultPropertyID.USER_DESCRIPTION_DESC"), .new ConceptPropertyLocalizedString("description"new LocalizedStringSettings())), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
             new DefaultPropertyID("comments",          Messages.getString("DefaultPropertyID.USER_COMMENTS_DESC"), .new ConceptPropertyLocalizedString("comments"new LocalizedStringSettings())), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
             new DefaultPropertyID("aggregation",       Messages.getString("DefaultPropertyID.USER_AGGREGATION_RULE_DESC"), .new ConceptPropertyAggregation("aggregation".)), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
             new DefaultPropertyID("formula",           Messages.getString("DefaultPropertyID.USER_FORMULA_DESC"), .new ConceptPropertyString("formula"null)), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
             new DefaultPropertyID("hidden",            Messages.getString("DefaultPropertyID.USER_HIDDEN_DESC"), .new ConceptPropertyBoolean("hidden".)), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
             new DefaultPropertyID("exact",             Messages.getString("DefaultPropertyID.USER_FORMULA_EXACT"), .new ConceptPropertyBoolean("exact".)), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
             new DefaultPropertyID("datatype",          Messages.getString("DefaultPropertyID.USER_DATA_TYPE_DESC"), .new ConceptPropertyDataType("datatype".)), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
             new DefaultPropertyID("mask",              Messages.getString("DefaultPropertyID.USER_MASK_DESC"), .new ConceptPropertyString("mask"null)), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
             new DefaultPropertyID("foreground_color",  Messages.getString("DefaultPropertyID.USER_FOREGROUND_COLOR_DESC"), .new ConceptPropertyColor("foreground_color".)), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
             new DefaultPropertyID("background_color",  Messages.getString("DefaultPropertyID.USER_BACKGROUND_COLOR_DESC"), .new ConceptPropertyColor("background_color".)), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
             new DefaultPropertyID("font",              Messages.getString("DefaultPropertyID.USER_FONT_DESC"), .new ConceptPropertyFont("font"null)), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
             new DefaultPropertyID("fieldtype",         Messages.getString("DefaultPropertyID.USER_FIELD_TYPE_DESC"), .new ConceptPropertyFieldType("fieldtype".)), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
             new DefaultPropertyID("tabletype",         Messages.getString("DefaultPropertyID.USER_TABLE_TYPE_DESC"), .new ConceptPropertyTableType("tabletype".)), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
             new DefaultPropertyID("relative_size",     Messages.getString("DefaultPropertyID.USER_RELATIVE_SIZE_DESC"), .new ConceptPropertyNumber("relative_size"null)), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
             new DefaultPropertyID("target_table",      Messages.getString("DefaultPropertyID.USER_TARGET_TABLE_DESC"), .new ConceptPropertyString("target_table"null)), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
             new DefaultPropertyID("target_schema",      Messages.getString("DefaultPropertyID.USER_TARGET_SCHEMA_DESC"), .new ConceptPropertyString("target_schema"null)), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
             new DefaultPropertyID("alignment",         Messages.getString("DefaultPropertyID.USER_TEXT_ALIGNMENT_DESC"), .new ConceptPropertyAlignment("alignment".)), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
             new DefaultPropertyID("column_width",      Messages.getString("DefaultPropertyID.USER_COLUMN_WIDTH_DESC"), .new ConceptPropertyColumnWidth("column_width".)), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
             new DefaultPropertyID("security",          Messages.getString("DefaultPropertyID.USER_SECURITY_INFORMATION_DESC"), .new ConceptPropertySecurity("security"new Security())), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
             new DefaultPropertyID("row_level_security",Messages.getString("DefaultPropertyID.USER_ROW_LEVEL_SECURITY_DESC"), .new ConceptPropertyRowLevelSecurity("row_level_security"new RowLevelSecurity())), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
             new DefaultPropertyID("aggregation_list",  Messages.getString("DefaultPropertyID.USER_AGGREGATION_LIST_DESC"), .new ConceptPropertyAggregationList("aggregation_list"null)), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
          };
 
     public static final DefaultPropertyID NAME            = [ 0];
     public static final DefaultPropertyID DESCRIPTION     = [ 1];
     public static final DefaultPropertyID COMMENTS        = [ 2];
     public static final DefaultPropertyID AGGREGATION     = [ 3];
     public static final DefaultPropertyID FORMULA         = [ 4];
     public static final DefaultPropertyID HIDDEN          = [ 5];
     public static final DefaultPropertyID EXACT           = [ 6];
     public static final DefaultPropertyID DATA_TYPE       = [ 7];
     public static final DefaultPropertyID MASK            = [ 8];
     public static final DefaultPropertyID COLOR_FG        = [ 9];
     public static final DefaultPropertyID COLOR_BG        = [10];
     public static final DefaultPropertyID FONT            = [11];
     public static final DefaultPropertyID FIELD_TYPE      = [12];
     public static final DefaultPropertyID TABLE_TYPE      = [13];
    public static final DefaultPropertyID RELATIVE_SIZE   = [14];
    public static final DefaultPropertyID TARGET_TABLE    = [15];
    public static final DefaultPropertyID TARGET_SCHEMA   = [16];
    public static final DefaultPropertyID ALIGNMENT       = [17];
    public static final DefaultPropertyID COLUMN_WIDTH    = [18];
    public static final DefaultPropertyID SECURITY        = [19];
    public static final DefaultPropertyID ROW_LEVEL_SECURITY        = [20];
    public static final DefaultPropertyID AGGREGATION_LIST     = [21];


    

Parameters:
type The concept property type
id The possible id to use
    public DefaultPropertyID(String idString descriptionConceptPropertyType typeConceptPropertyInterface defaultValue)
    {
        this. = id;
        this. = description;
        this. = type;
        this. = defaultValue;
    }

    

Returns:
the id
    public String getId()
    {
        return ;
    }

    

Parameters:
id the id to set
    public void setId(String id)
    {
        this. = id;
    }

    

Returns:
the type
    public ConceptPropertyType getType()
    {
        return ;
    }

    

Parameters:
type the type to set
    public void setType(ConceptPropertyType type)
    {
        this. = type;
    }

    

Returns:
the defaultValue
    {
        try
        {
          return (ConceptPropertyInterface.clone();
        }
        catch (CloneNotSupportedException e)
        {
          .error("an exception occurred"e);
          return null;
        }
    }

    

Parameters:
defaultValue the defaultValue to set
    public void setDefaultValue(ConceptPropertyInterface defaultValue)
    {
        this. = defaultValue;
    }

    

Returns:
the description
    public String getDescription()
    {
        return ;
    }

    

Parameters:
description the description to set
    public void setDescription(String description)
    {
        this. = description;
    }

    

Returns:
an array containing the default proposed (recognized) property id's
    public static final String[] getDefaultPropertyIDs()
    {
        String[] ids = new String[.];
        for (int i=0;i<ids.length;i++)
        {
            ids[i] = [i].getId();
        }
        return ids;
    }

    

Returns:
an array containing the default proposed (recognized) property types corresponding with the ID's array
    public static final ConceptPropertyType[] getDefaultPropertyTypes()
    {
        ConceptPropertyType[] types = new ConceptPropertyType[.];
        for (int i=0;i<types.length;i++)
        {
            types[i] = [i].getType();
        }
        return types;
    }

    
Create a new

Parameters:
conceptPropertyType the property type to generate a default for.
Returns:
    public static final ConceptPropertyInterface getDefaultEmptyProperty(ConceptPropertyType conceptPropertyTypeString name)
    {
        ConceptPropertyInterface property = null;
        switch(conceptPropertyType.getType())
        {
        case .           : property = new ConceptPropertyString(namenull); break;
        case .             : property = new ConceptPropertyDate(namenull); break;
        case .           : property = new ConceptPropertyNumber(namenull); break;
        case .            : property = new ConceptPropertyColor(namenull); break;
        case .             : property = new ConceptPropertyFont(namenull); break;
        case .        : property = new ConceptPropertyFieldType(namenull); break;
        case .      : property = new ConceptPropertyAggregation(namenull); break;
        case .          : property = new ConceptPropertyBoolean(namenull); break;
        case .         : property = new ConceptPropertyDataType(namenull); break;
        case . : property = new ConceptPropertyLocalizedString(namenull); break;
        case .        : property = new ConceptPropertyTableType(namenull); break;
        case .              : property = new ConceptPropertyURL(namenull); break;
        case .         : property = new ConceptPropertySecurity(namenull); break;
        case .        : property = new ConceptPropertyAlignment(namenull); break;
        case .     : property = new ConceptPropertyColumnWidth(namenull); break;
        case . : property = new ConceptPropertyRowLevelSecurity(namenull); break;
        case . : property = new ConceptPropertyAggregationList(namenull); break;        
        }
        return property;
    }

    

Returns:
the defined default IDs, types, default values, etc.
    public static DefaultPropertyID[] getDefaults()
    {
        return ;
    }
    public static DefaultPropertyID findDefaultPropertyID(String id)
    {
        for (int i=0;i<.;i++)
        {
            if ([i].getId().equals(id)) return [i];
        }
        return null;
    }
    public static int findDefaultPropertyOrder(String id)
    {
        for (int i=0;i<.;i++)
        {
            if ([i].getId().equals(id)) return i;
        }
        return .// put non-default properties always at the back
    }
New to GrepCode? Check out our FAQ X