pire-db.empire-db-codegen.3.2.0.source-code.View.vm Maven / Gradle / Ivy
The newest version!
#*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*#
#if($nestViews == false)
package $viewPackageName;
#if($baseViewClassName.equals('DBView'))
import org.apache.empire.db.DBView;
#end
import org.apache.empire.data.DataType;
import org.apache.empire.db.DBCommandExpr;
import org.apache.empire.exceptions.NotImplementedException;
import $basePackageName.${dbClassName};
#end
#if($nestViews == true)
public static class $parser.getViewClassName($view.name) extends ${baseViewClassName} {
#else
public class $parser.getViewClassName($view.name) extends ${baseViewClassName} {
#end
// private static final long serialVersionUID = 1L;
// define columns
#foreach ($col in $view.columns)
public final DBViewColumn ${parser.getColumnName($col)};
#end
public $parser.getViewClassName($view.name)(${dbClassName} db) {
super("$view.name", db);
// create all columns
#foreach ($col in $view.columns)
${parser.getColumnName($col)} = super.addColumn("${col.name}", DataType.${col.getDataType()});
#end
}
@Override
public DBCommandExpr createCommand()
{
/*
Supply a command for the creation of this view here
or return null to skip view creation
*/
throw new NotImplementedException(this, "createCommand");
}
#if($nestViews == true)
}
#else
}
#end