All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.tentackle.wurblet.ColumnNames Maven / Gradle / Ivy

There is a newer version: 21.16.1.0
Show newest version
// wurblet generated by Wurbelizer 2.0.6, see http://www.wurbelizer.org

package org.tentackle.wurblet;

import org.tentackle.buildsupport.*;
import java.util.*;
import java.io.*;
import org.tentackle.common.*;
import org.wurbelizer.wurbel.*;
import org.tentackle.model.*;
import org.wurbelizer.wurblet.*;


public class ColumnNames extends ModelWurblet {

  @Override
  public void run() throws WurbelException {
    super.run();
    try {
      // ----------------- begin wurblet code -----------------

    /**
     * Tentackle - http://www.tentackle.org
     *
     * This library is free software; you can redistribute it and/or
     * modify it under the terms of the GNU Lesser General Public
     * License as published by the Free Software Foundation; either
     * version 2.1 of the License, or (at your option) any later version.
     *
     * This library 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.
     *
     * You should have received a copy of the GNU Lesser General Public
     * License along with this library; if not, write to the Free Software
     * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
     */



    /**
     * Generate code to define the database column names.
     *
     * usage:  @wurblet  ColumnNames [--model=]
     *
     *          is the mapping description
     */

    for (Attribute attr: getEntity().getAttributes())  {
      if (!attr.getOptions().isNoConstant() && !attr.getOptions().isFromSuper()) {
        String name = attr.getJavaName().toUpperCase();
        if (!attr.getOptions().isNoDeclare() || attr.getOptions().isFromSuper())    {
          for (DataType.SqlTypeWithPostfix sp: attr.getDataType().getSqlTypesWithPostfix()) {
            out.print(source[0]); // 36:2 = "  /** database column name for '"
            out.print(attr);
            out.print(source[1]); // 38:40 = "'. */  public static final String CN_"
            out.print(name);
            out.print(sp.getPostfix());
            out.print(source[2]); // 39:59 = " = ""
            out.print(attr.getColumnName());
            out.print(sp.getPostfix());
            out.print(source[3]); // 39:106 = "";"
          }
        }
      }
    }

      // ----------------- end wurblet code -----------------
    }
    catch (Exception ex) {
      throw new WurbelException("wurblet " + this + " failed", ex);
    }
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy