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

org.tentackle.wurblet.AttributeNames 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 AttributeNames 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 java attribute and relation names.
     *
     * usage:  @wurblet  AttributeNames [--model=] [--noif]
     *
     *          is the mapping description
     *         --noif if not part of an interface (adds "public static final")
     */

    String mainClass = getClassName();
    String lead = getOption("noif") == null ? "" : "public static final ";

    for (Relation rel: getEntity().getRelations()) {
      String var = rel.getVariableName();
      out.print(source[0]); // 37:2 = "  /** relation name for '"
      out.print(rel);
      out.print(source[1]); // 39:32 = "'. */  "
      out.print(lead);
      out.print(source[2]); // 40:10 = "String RN_"
      out.print(var.toUpperCase());
      out.print(source[3]); // 40:41 = " = ""
      out.print(var);
      out.print(source[4]); // 40:52 = "";"
    }

    for (Attribute attr: getEntity().getAttributes())  {
      if (!attr.getOptions().isNoConstant() && !attr.getOptions().isFromSuper())    {
          String name = attr.getJavaName().toUpperCase();
          out.print(source[5]); // 47:2 = "  /** attribute name for database colum..."
          out.print(attr.getColumnName());
          out.print(source[6]); // 49:66 = "'. */  "
          out.print(lead);
          out.print(source[7]); // 50:10 = "String AN_"
          out.print(name);
          out.print(source[8]); // 50:28 = " = ""
          out.print(attr.getJavaName());
          out.print(source[9]); // 50:54 = "";"
      }
    }

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy