code stringlengths 3 1.18M | language stringclasses 1 value |
|---|---|
/*
* Copyright (c) 2012 Google Inc.
*
* Licensed 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.
*/
package com.google.drive.samples.dredit.model;
import com.google.api.services.drive.model.File;
import com.google.api.services.drive.model.ParentReference;
import com.google.api.services.drive.model.File.Labels;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import java.io.Reader;
import java.util.List;
/**
* An object representing a File and its content, for use while interacting
* with a DrEdit JavaScript client. Can be serialized and deserialized using
* Gson.
*
* @author vicfryzel@google.com (Vic Fryzel)
* @author nivco@google.com (Nicolas Garnier)
*/
public class ClientFile {
/**
* ID of file.
*/
public String resource_id;
/**
* Title of file.
*/
public String title;
/**
* Description of file.
*/
public String description;
/**
* MIME type of file.
*/
public String mimeType;
/**
* Content body of file.
*/
public String content;
/**
* Is the file editable.
*/
public boolean editable;
/**
* Labels.
*/
public Labels labels;
/**
* parents.
*/
public List<ParentReference> parents;
/**
* Empty constructor required by Gson.
*/
public ClientFile() {}
/**
* Creates a new ClientFile based on the given File and content.
*/
public ClientFile(File file, String content) {
this.resource_id = file.getId();
this.title = file.getTitle();
this.description = file.getDescription();
this.mimeType = file.getMimeType();
this.content = content;
this.labels = file.getLabels();
this.editable = file.getEditable();
this.parents = file.getParents();
}
/**
* Construct a new ClientFile from its JSON representation.
*
* @param in Reader of JSON string to parse.
*/
public ClientFile(Reader in) {
GsonBuilder builder = new GsonBuilder();
Gson gson = builder.create();
ClientFile other = gson.fromJson(in, ClientFile.class);
this.resource_id = other.resource_id;
this.title = other.title;
this.description = other.description;
this.mimeType = other.mimeType;
this.content = other.content;
this.labels = other.labels;
this.editable = other.editable;
this.parents = other.parents;
}
/**
* @return JSON representation of this ClientFile.
*/
public String toJson() {
return new Gson().toJson(this).toString();
}
/**
* @return Representation of this ClientFile as a Drive file.
*/
public File toFile() {
File file = new File();
file.setId(resource_id);
file.setTitle(title);
file.setDescription(description);
file.setMimeType(mimeType);
file.setLabels(labels);
file.setEditable(editable);
file.setParents(parents);
return file;
}
} | Java |
package com.ase.jython;
import java.util.List;
import javax.script.Bindings;
import javax.script.ScriptContext;
import org.python.core.Py;
import org.python.core.PyClass;
import org.python.core.PyList;
import org.python.core.PyObject;
import org.python.core.PyString;
public class JythonObject extends PyObject {
/**
*
*/
private static final long serialVersionUID = 1L;
public JythonObject(JythonScriptEngine engine, ScriptContext ctx) {
this.ctx = ctx;
// global module's name is expected to be 'main'
__setitem__("__name__", new PyString("main"));
// JSR-223 requirement: context is exposed as variable
__setitem__("context", Py.java2py(ctx));
// expose current engine as another top-level variable
__setitem__("engine", Py.java2py(engine));
}
private ScriptContext ctx;
public synchronized PyObject invoke(String name) {
if (name.equals("keys")) {
// special case for "keys" so that dir() will
// work for the global "module"
PyList keys = new PyList();
synchronized (ctx) {
List<Integer> scopes = ctx.getScopes();
for (int scope : scopes) {
Bindings b = ctx.getBindings(scope);
if (b != null) {
for (String key : b.keySet()) {
keys.append(new PyString(key));
}
}
}
}
return keys;
} else {
return super.invoke(name);
}
}
public PyObject __findattr_ex__(String key) {
return __finditem__(key);
}
public synchronized PyObject __finditem__(String key) {
synchronized (ctx) {
int scope = ctx.getAttributesScope(key);
if (scope == -1) {
return null;
} else {
Object value = ctx.getAttribute(key, scope);
return JythonScriptEngine.java2py(value);
}
}
}
public void __setattr__(String key, PyObject value) {
__setitem__(key, value);
}
public synchronized void __setitem__(String key, PyObject value) {
synchronized (ctx) {
int scope = ctx.getAttributesScope(key);
if (scope == -1) {
scope = ScriptContext.ENGINE_SCOPE;
}
Object obj = value;
if (!(obj instanceof PyClass)) {
obj = JythonScriptEngine.py2java(value);
}
ctx.setAttribute(key, obj, scope);
}
}
public void __delattr__(String key) {
__delitem__(key);
}
public synchronized void __delitem__(String key) {
synchronized (ctx) {
int scope = ctx.getAttributesScope(key);
if (scope != -1) {
ctx.removeAttribute(key, scope);
}
}
}
public String toString() {
return "<global scope at " + hashCode() + ">";
}
}
| Java |
package com.ase.jython;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineFactory;
public class JythonScriptEngineFactory implements ScriptEngineFactory {
public String getEngineName() {
return "jython";
}
public String getEngineVersion() {
return "2.5.0";
}
public List<String> getExtensions() {
return extensions;
}
public List<String> getMimeTypes() {
return mimeTypes;
}
public List<String> getNames() {
return names;
}
public String getLanguageName() {
return "python";
}
public String getLanguageVersion() {
return "2.5.0";
}
public Object getParameter(String key) {
if (key.equals(ScriptEngine.ENGINE)) {
return getEngineName();
} else if (key.equals(ScriptEngine.ENGINE_VERSION)) {
return getEngineVersion();
} else if (key.equals(ScriptEngine.NAME)) {
return getEngineName();
} else if (key.equals(ScriptEngine.LANGUAGE)) {
return getLanguageName();
} else if (key.equals(ScriptEngine.LANGUAGE_VERSION)) {
return getLanguageVersion();
} else if (key.equals("THREADING")) {
return "MULTITHREADED";
} else {
return null;
}
}
public String getMethodCallSyntax(String obj, String m, String... args) {
StringBuilder buf = new StringBuilder();
buf.append(obj);
buf.append(".");
buf.append(m);
buf.append("(");
if (args.length != 0) {
int i = 0;
for (; i < args.length - 1; i++) {
buf.append(args[i] + ", ");
}
buf.append(args[i]);
}
buf.append(")");
return buf.toString();
}
public String getOutputStatement(String toDisplay) {
StringBuilder buf = new StringBuilder();
int len = toDisplay.length();
buf.append("print(\"");
for (int i = 0; i < len; i++) {
char ch = toDisplay.charAt(i);
switch (ch) {
case '"':
buf.append("\\\"");
break;
case '\\':
buf.append("\\\\");
break;
default:
buf.append(ch);
break;
}
}
buf.append("\")");
return buf.toString();
}
public String getProgram(String... statements) {
StringBuilder buf = new StringBuilder();
for (int i = 0; i < statements.length; i++) {
buf.append("\t");
buf.append(statements[i]);
buf.append("\n");
}
return buf.toString();
}
public ScriptEngine getScriptEngine() {
JythonScriptEngine engine = new JythonScriptEngine();
engine.setFactory(this);
return engine;
}
private static List<String> names;
private static List<String> extensions;
private static List<String> mimeTypes;
static {
names = new ArrayList<String>(2);
names.add("jython");
names.add("python");
names = Collections.unmodifiableList(names);
extensions = new ArrayList<String>(2);
extensions.add("jy");
extensions.add("py");
extensions = Collections.unmodifiableList(extensions);
mimeTypes = new ArrayList<String>(0);
mimeTypes = Collections.unmodifiableList(mimeTypes);
}
}
| Java |
package com.ase.jython;
import java.io.IOException;
import java.io.Reader;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import javax.script.AbstractScriptEngine;
import javax.script.Bindings;
import javax.script.Compilable;
import javax.script.CompiledScript;
import javax.script.Invocable;
import javax.script.ScriptContext;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineFactory;
import javax.script.ScriptException;
import javax.script.SimpleBindings;
import org.python.core.CompileMode;
import org.python.core.Py;
import org.python.core.PyCode;
import org.python.core.PyObject;
import org.python.core.PySystemState;
public class JythonScriptEngine extends AbstractScriptEngine implements
Compilable, Invocable {
private PyObject myScope;
private ScriptEngineFactory factory;
public static final String JYTHON_COMPILE_MODE = "com.sun.script.jython.comp.mode";
private static ThreadLocal<PySystemState> systemState;
static {
PySystemState.initialize();
systemState = new ThreadLocal<PySystemState>();
}
public JythonScriptEngine() {
myScope = newScope(context);
}
private PyObject newScope(ScriptContext ctx) {
return new JythonObject(this, ctx);
}
public Object eval(String str, ScriptContext ctx) throws ScriptException {
PyCode code = compileScript(str, ctx);
return evalCode(code, ctx);
}
public Object eval(Reader reader, ScriptContext ctx) throws ScriptException {
return eval(readFully(reader), ctx);
}
public Bindings createBindings() {
return new SimpleBindings();
}
private class JythonCompiledScript extends CompiledScript {
// my compiled code
private PyCode code;
JythonCompiledScript(PyCode code) {
this.code = code;
}
public ScriptEngine getEngine() {
return JythonScriptEngine.this;
}
public Object eval(ScriptContext ctx) throws ScriptException {
return evalCode(code, ctx);
}
}
// Compilable methods
public CompiledScript compile(String script) throws ScriptException {
PyCode code = compileScript(script, context);
return new JythonCompiledScript(code);
}
public CompiledScript compile(Reader reader) throws ScriptException {
return compile(readFully(reader));
}
// Invocable methods
public Object invokeFunction(String name, Object... args)
throws ScriptException, NoSuchMethodException {
return invokeImpl(null, name, args);
}
public Object invokeMethod(Object obj, String name, Object... args)
throws ScriptException, NoSuchMethodException {
if (obj == null) {
throw new IllegalArgumentException("script object is null");
}
return invokeImpl(obj, name, args);
}
private Object invokeImpl(Object obj, String name, Object... args)
throws ScriptException, NoSuchMethodException {
if (name == null) {
throw new NullPointerException("method name is null");
}
setSystemState();
PyObject thiz;
if (obj instanceof PyObject) {
thiz = (PyObject) obj;
} else if (obj == null) {
thiz = myScope;
} else {
thiz = java2py(obj);
}
PyObject func = thiz.__findattr__(name);
if (func == null || !func.isCallable()) {
if (thiz == myScope) {
systemState.get();
// lookup in built-in functions. This way
// user can call invoke built-in functions.
PyObject builtins = PySystemState.builtins;
func = builtins.__finditem__(name);
}
}
if (func == null || !func.isCallable()) {
throw new NoSuchMethodException(name);
}
PyObject res = func.__call__(wrapArguments(args));
return py2java(res);
}
public <T> T getInterface(Object obj, Class<T> clazz) {
if (obj == null) {
throw new IllegalArgumentException("script object is null");
}
return makeInterface(obj, clazz);
}
public <T> T getInterface(Class<T> clazz) {
return makeInterface(null, clazz);
}
@SuppressWarnings("unchecked")
private <T> T makeInterface(Object obj, Class<T> clazz) {
if (clazz == null || !clazz.isInterface()) {
throw new IllegalArgumentException("interface Class expected");
}
final Object thiz = obj;
return (T) Proxy.newProxyInstance(clazz.getClassLoader(),
new Class[] { clazz }, new InvocationHandler() {
public Object invoke(Object proxy, Method m, Object[] args)
throws Throwable {
Object res = invokeImpl(thiz, m.getName(), args);
return py2java(java2py(res), m.getReturnType());
}
});
}
// ScriptEngine methods
public ScriptEngineFactory getFactory() {
synchronized (this) {
if (factory == null) {
factory = new JythonScriptEngineFactory();
}
}
return factory;
}
public void setContext(ScriptContext ctx) {
super.setContext(ctx);
// update myScope to keep it in-sync
myScope = newScope(context);
}
// package-private methods
void setFactory(ScriptEngineFactory factory) {
this.factory = factory;
}
static PyObject java2py(Object javaObj) {
return Py.java2py(javaObj);
}
static Object py2java(PyObject pyObj, @SuppressWarnings("rawtypes") Class type) {
return (pyObj == null) ? null : pyObj.__tojava__(type);
}
static Object py2java(PyObject pyObj) {
return py2java(pyObj, Object.class);
}
static PyObject[] wrapArguments(Object[] args) {
if (args == null) {
return new PyObject[0];
}
PyObject[] res = new PyObject[args.length];
for (int i = 0; i < args.length; i++) {
res[i] = java2py(args[i]);
}
return res;
}
// internals only below this point
private PyObject getJythonScope(ScriptContext ctx) {
if (ctx == context) {
return myScope;
} else {
return newScope(ctx);
}
}
private void setSystemState() {
/*
* From my reading of Jython source, it appears that PySystemState is
* set on per-thread basis. So, I maintain it in a thread local and set
* it. Besides, this also helps in setting correct class loader -- which
* is thread context class loader.
*/
if (systemState.get() == null) {
// we entering into this thread for the first time.
PySystemState newState = new PySystemState();
ClassLoader cl = Thread.currentThread().getContextClassLoader();
newState.setClassLoader(cl);
systemState.set(newState);
Py.setSystemState(newState);
}
}
private PyCode compileScript(String script, ScriptContext ctx)
throws ScriptException {
try {
setSystemState();
String fileName = (String) ctx.getAttribute(ScriptEngine.FILENAME);
if (fileName == null) {
fileName = "<unknown>";
}
/*
* Jython parser seems to have 3 input modes (called compile "kind")
* These are "single", "eval" and "exec". I don't clearly understand
* the difference. But, with "eval" and "exec" certain features are
* not working. For eg. with "eval" assignments are not working.
* I've used "exec". But, that is customizable by special attribute.
*/
String mode = (String) ctx.getAttribute(JYTHON_COMPILE_MODE);
if (mode == null) {
mode = "exec";
}
return (PyCode) Py.compile_flags(script, fileName,
CompileMode.getMode(mode), Py.getCompilerFlags());
} catch (Exception exp) {
throw new ScriptException(exp);
}
}
private Object evalCode(PyCode code, ScriptContext ctx)
throws ScriptException {
try {
setSystemState();
PyObject scope = getJythonScope(ctx);
PyObject res = Py.runCode(code, scope, scope);
return res.__tojava__(Object.class);
} catch (Exception exp) {
throw new ScriptException(exp);
}
}
private String readFully(Reader reader) throws ScriptException {
char[] arr = new char[8 * 1024]; // 8K at a time
StringBuilder buf = new StringBuilder();
int numChars;
try {
while ((numChars = reader.read(arr, 0, arr.length)) > 0) {
buf.append(arr, 0, numChars);
}
} catch (IOException exp) {
throw new ScriptException(exp);
}
return buf.toString();
}
}
| Java |
/**
* Licensee: DuKe TeAm
* License Type: Purchased
*/
package ormsamples;
import org.orm.*;
public class ListBdAnotacionesData {
private static final int ROW_COUNT = 100;
public void listTestData() throws PersistentException {
orm.DAOFactory lDAOFactory = orm.DAOFactory.getDAOFactory();
System.out.println("Listing Tan_anotador...");
orm.Tan_anotador[] oRMTan_anotadors = lDAOFactory.getTan_anotadorDAO().listTan_anotadorByQuery(null, null);
int length = Math.min(oRMTan_anotadors.length, ROW_COUNT);
for (int i = 0; i < length; i++) {
System.out.println(oRMTan_anotadors[i]);
}
System.out.println(length + " record(s) retrieved.");
System.out.println("Listing Tan_subsector...");
orm.Tan_subsector[] oRMTan_subsectors = lDAOFactory.getTan_subsectorDAO().listTan_subsectorByQuery(null, null);
length = Math.min(oRMTan_subsectors.length, ROW_COUNT);
for (int i = 0; i < length; i++) {
System.out.println(oRMTan_subsectors[i]);
}
System.out.println(length + " record(s) retrieved.");
System.out.println("Listing Tan_curso...");
orm.Tan_curso[] oRMTan_cursos = lDAOFactory.getTan_cursoDAO().listTan_cursoByQuery(null, null);
length = Math.min(oRMTan_cursos.length, ROW_COUNT);
for (int i = 0; i < length; i++) {
System.out.println(oRMTan_cursos[i]);
}
System.out.println(length + " record(s) retrieved.");
System.out.println("Listing Tan_alumno...");
orm.Tan_alumno[] oRMTan_alumnos = lDAOFactory.getTan_alumnoDAO().listTan_alumnoByQuery(null, null);
length = Math.min(oRMTan_alumnos.length, ROW_COUNT);
for (int i = 0; i < length; i++) {
System.out.println(oRMTan_alumnos[i]);
}
System.out.println(length + " record(s) retrieved.");
System.out.println("Listing Tan_anotacion...");
orm.Tan_anotacion[] oRMTan_anotacions = lDAOFactory.getTan_anotacionDAO().listTan_anotacionByQuery(null, null);
length = Math.min(oRMTan_anotacions.length, ROW_COUNT);
for (int i = 0; i < length; i++) {
System.out.println(oRMTan_anotacions[i]);
}
System.out.println(length + " record(s) retrieved.");
System.out.println("Listing Tan_tipo_anotacion...");
orm.Tan_tipo_anotacion[] oRMTan_tipo_anotacions = lDAOFactory.getTan_tipo_anotacionDAO().listTan_tipo_anotacionByQuery(null, null);
length = Math.min(oRMTan_tipo_anotacions.length, ROW_COUNT);
for (int i = 0; i < length; i++) {
System.out.println(oRMTan_tipo_anotacions[i]);
}
System.out.println(length + " record(s) retrieved.");
}
public void listByCriteria() throws PersistentException {
System.out.println("Listing Tan_anotador by Criteria...");
orm.Tan_anotadorCriteria tan_anotadorCriteria = new orm.Tan_anotadorCriteria();
// Please uncomment the follow line and fill in parameter(s)
//tan_anotadorCriteria.an_id.eq();
tan_anotadorCriteria.setMaxResults(ROW_COUNT);
orm.Tan_anotador[] oRMTan_anotadors = tan_anotadorCriteria.listTan_anotador();
int length =oRMTan_anotadors== null ? 0 : Math.min(oRMTan_anotadors.length, ROW_COUNT);
for (int i = 0; i < length; i++) {
System.out.println(oRMTan_anotadors[i]);
}
System.out.println(length + " Tan_anotador record(s) retrieved.");
System.out.println("Listing Tan_subsector by Criteria...");
orm.Tan_subsectorCriteria tan_subsectorCriteria = new orm.Tan_subsectorCriteria();
// Please uncomment the follow line and fill in parameter(s)
//tan_subsectorCriteria.su_id.eq();
tan_subsectorCriteria.setMaxResults(ROW_COUNT);
orm.Tan_subsector[] oRMTan_subsectors = tan_subsectorCriteria.listTan_subsector();
length =oRMTan_subsectors== null ? 0 : Math.min(oRMTan_subsectors.length, ROW_COUNT);
for (int i = 0; i < length; i++) {
System.out.println(oRMTan_subsectors[i]);
}
System.out.println(length + " Tan_subsector record(s) retrieved.");
System.out.println("Listing Tan_curso by Criteria...");
orm.Tan_cursoCriteria tan_cursoCriteria = new orm.Tan_cursoCriteria();
// Please uncomment the follow line and fill in parameter(s)
//tan_cursoCriteria.cu_id.eq();
tan_cursoCriteria.setMaxResults(ROW_COUNT);
orm.Tan_curso[] oRMTan_cursos = tan_cursoCriteria.listTan_curso();
length =oRMTan_cursos== null ? 0 : Math.min(oRMTan_cursos.length, ROW_COUNT);
for (int i = 0; i < length; i++) {
System.out.println(oRMTan_cursos[i]);
}
System.out.println(length + " Tan_curso record(s) retrieved.");
System.out.println("Listing Tan_alumno by Criteria...");
orm.Tan_alumnoCriteria tan_alumnoCriteria = new orm.Tan_alumnoCriteria();
// Please uncomment the follow line and fill in parameter(s)
//tan_alumnoCriteria.al_id.eq();
tan_alumnoCriteria.setMaxResults(ROW_COUNT);
orm.Tan_alumno[] oRMTan_alumnos = tan_alumnoCriteria.listTan_alumno();
length =oRMTan_alumnos== null ? 0 : Math.min(oRMTan_alumnos.length, ROW_COUNT);
for (int i = 0; i < length; i++) {
System.out.println(oRMTan_alumnos[i]);
}
System.out.println(length + " Tan_alumno record(s) retrieved.");
System.out.println("Listing Tan_anotacion by Criteria...");
orm.Tan_anotacionCriteria tan_anotacionCriteria = new orm.Tan_anotacionCriteria();
// Please uncomment the follow line and fill in parameter(s)
//tan_anotacionCriteria.an_id.eq();
tan_anotacionCriteria.setMaxResults(ROW_COUNT);
orm.Tan_anotacion[] oRMTan_anotacions = tan_anotacionCriteria.listTan_anotacion();
length =oRMTan_anotacions== null ? 0 : Math.min(oRMTan_anotacions.length, ROW_COUNT);
for (int i = 0; i < length; i++) {
System.out.println(oRMTan_anotacions[i]);
}
System.out.println(length + " Tan_anotacion record(s) retrieved.");
System.out.println("Listing Tan_tipo_anotacion by Criteria...");
orm.Tan_tipo_anotacionCriteria tan_tipo_anotacionCriteria = new orm.Tan_tipo_anotacionCriteria();
// Please uncomment the follow line and fill in parameter(s)
//tan_tipo_anotacionCriteria.ta_id.eq();
tan_tipo_anotacionCriteria.setMaxResults(ROW_COUNT);
orm.Tan_tipo_anotacion[] oRMTan_tipo_anotacions = tan_tipo_anotacionCriteria.listTan_tipo_anotacion();
length =oRMTan_tipo_anotacions== null ? 0 : Math.min(oRMTan_tipo_anotacions.length, ROW_COUNT);
for (int i = 0; i < length; i++) {
System.out.println(oRMTan_tipo_anotacions[i]);
}
System.out.println(length + " Tan_tipo_anotacion record(s) retrieved.");
}
public static void main(String[] args) {
try {
ListBdAnotacionesData listBdAnotacionesData = new ListBdAnotacionesData();
try {
listBdAnotacionesData.listTestData();
//listBdAnotacionesData.listByCriteria();
}
finally {
orm.BdAnotacionesPersistentManager.instance().disposePersistentManager();
}
}
catch (Exception e) {
e.printStackTrace();
}
}
}
| Java |
/**
* Licensee: DuKe TeAm
* License Type: Purchased
*/
package ormsamples;
import org.orm.*;
public class DropBdAnotacionesDatabaseSchema {
public static void main(String[] args) {
try {
System.out.println("Are you sure to drop table(s)? (Y/N)");
java.io.BufferedReader reader = new java.io.BufferedReader(new java.io.InputStreamReader(System.in));
if (reader.readLine().trim().toUpperCase().equals("Y")) {
ORMDatabaseInitiator.dropSchema(orm.BdAnotacionesPersistentManager.instance());
orm.BdAnotacionesPersistentManager.instance().disposePersistentManager();
}
}
catch (Exception e) {
e.printStackTrace();
}
}
}
| Java |
/**
* Licensee: DuKe TeAm
* License Type: Purchased
*/
package ormsamples;
import org.orm.*;
public class DeleteBdAnotacionesData {
public void deleteTestData() throws PersistentException {
PersistentTransaction t = orm.BdAnotacionesPersistentManager.instance().getSession().beginTransaction();
try {
orm.DAOFactory lDAOFactory = orm.DAOFactory.getDAOFactory();
orm.dao.Tan_anotadorDAO oRMTan_anotadorDAO = lDAOFactory.getTan_anotadorDAO();
orm.Tan_anotador oRMTan_anotador = oRMTan_anotadorDAO.loadTan_anotadorByQuery(null, null);
// Delete the persistent object
oRMTan_anotadorDAO.delete(oRMTan_anotador);
orm.dao.Tan_subsectorDAO oRMTan_subsectorDAO = lDAOFactory.getTan_subsectorDAO();
orm.Tan_subsector oRMTan_subsector = oRMTan_subsectorDAO.loadTan_subsectorByQuery(null, null);
// Delete the persistent object
oRMTan_subsectorDAO.delete(oRMTan_subsector);
orm.dao.Tan_cursoDAO oRMTan_cursoDAO = lDAOFactory.getTan_cursoDAO();
orm.Tan_curso oRMTan_curso = oRMTan_cursoDAO.loadTan_cursoByQuery(null, null);
// Delete the persistent object
oRMTan_cursoDAO.delete(oRMTan_curso);
orm.dao.Tan_alumnoDAO oRMTan_alumnoDAO = lDAOFactory.getTan_alumnoDAO();
orm.Tan_alumno oRMTan_alumno = oRMTan_alumnoDAO.loadTan_alumnoByQuery(null, null);
// Delete the persistent object
oRMTan_alumnoDAO.delete(oRMTan_alumno);
orm.dao.Tan_anotacionDAO oRMTan_anotacionDAO = lDAOFactory.getTan_anotacionDAO();
orm.Tan_anotacion oRMTan_anotacion = oRMTan_anotacionDAO.loadTan_anotacionByQuery(null, null);
// Delete the persistent object
oRMTan_anotacionDAO.delete(oRMTan_anotacion);
orm.dao.Tan_tipo_anotacionDAO oRMTan_tipo_anotacionDAO = lDAOFactory.getTan_tipo_anotacionDAO();
orm.Tan_tipo_anotacion oRMTan_tipo_anotacion = oRMTan_tipo_anotacionDAO.loadTan_tipo_anotacionByQuery(null, null);
// Delete the persistent object
oRMTan_tipo_anotacionDAO.delete(oRMTan_tipo_anotacion);
t.commit();
}
catch (Exception e) {
t.rollback();
}
}
public static void main(String[] args) {
try {
DeleteBdAnotacionesData deleteBdAnotacionesData = new DeleteBdAnotacionesData();
try {
deleteBdAnotacionesData.deleteTestData();
}
finally {
orm.BdAnotacionesPersistentManager.instance().disposePersistentManager();
}
}
catch (Exception e) {
e.printStackTrace();
}
}
}
| Java |
/**
* Licensee: DuKe TeAm
* License Type: Purchased
*/
package ormsamples;
import org.orm.*;
public class RetrieveAndUpdateBdAnotacionesData {
public void retrieveAndUpdateTestData() throws PersistentException {
PersistentTransaction t = orm.BdAnotacionesPersistentManager.instance().getSession().beginTransaction();
try {
orm.DAOFactory lDAOFactory = orm.DAOFactory.getDAOFactory();
orm.dao.Tan_anotadorDAO oRMTan_anotadorDAO = lDAOFactory.getTan_anotadorDAO();
orm.Tan_anotador oRMTan_anotador = oRMTan_anotadorDAO.loadTan_anotadorByQuery(null, null);
// Update the properties of the persistent object
oRMTan_anotadorDAO.save(oRMTan_anotador);
orm.dao.Tan_subsectorDAO oRMTan_subsectorDAO = lDAOFactory.getTan_subsectorDAO();
orm.Tan_subsector oRMTan_subsector = oRMTan_subsectorDAO.loadTan_subsectorByQuery(null, null);
// Update the properties of the persistent object
oRMTan_subsectorDAO.save(oRMTan_subsector);
orm.dao.Tan_cursoDAO oRMTan_cursoDAO = lDAOFactory.getTan_cursoDAO();
orm.Tan_curso oRMTan_curso = oRMTan_cursoDAO.loadTan_cursoByQuery(null, null);
// Update the properties of the persistent object
oRMTan_cursoDAO.save(oRMTan_curso);
orm.dao.Tan_alumnoDAO oRMTan_alumnoDAO = lDAOFactory.getTan_alumnoDAO();
orm.Tan_alumno oRMTan_alumno = oRMTan_alumnoDAO.loadTan_alumnoByQuery(null, null);
// Update the properties of the persistent object
oRMTan_alumnoDAO.save(oRMTan_alumno);
orm.dao.Tan_anotacionDAO oRMTan_anotacionDAO = lDAOFactory.getTan_anotacionDAO();
orm.Tan_anotacion oRMTan_anotacion = oRMTan_anotacionDAO.loadTan_anotacionByQuery(null, null);
// Update the properties of the persistent object
oRMTan_anotacionDAO.save(oRMTan_anotacion);
orm.dao.Tan_tipo_anotacionDAO oRMTan_tipo_anotacionDAO = lDAOFactory.getTan_tipo_anotacionDAO();
orm.Tan_tipo_anotacion oRMTan_tipo_anotacion = oRMTan_tipo_anotacionDAO.loadTan_tipo_anotacionByQuery(null, null);
// Update the properties of the persistent object
oRMTan_tipo_anotacionDAO.save(oRMTan_tipo_anotacion);
t.commit();
}
catch (Exception e) {
t.rollback();
}
}
public void retrieveByCriteria() throws PersistentException {
System.out.println("Retrieving Tan_anotador by Tan_anotadorCriteria");
orm.Tan_anotadorCriteria tan_anotadorCriteria = new orm.Tan_anotadorCriteria();
// Please uncomment the follow line and fill in parameter(s)
//tan_anotadorCriteria.an_id.eq();
System.out.println(tan_anotadorCriteria.uniqueTan_anotador());
System.out.println("Retrieving Tan_subsector by Tan_subsectorCriteria");
orm.Tan_subsectorCriteria tan_subsectorCriteria = new orm.Tan_subsectorCriteria();
// Please uncomment the follow line and fill in parameter(s)
//tan_subsectorCriteria.su_id.eq();
System.out.println(tan_subsectorCriteria.uniqueTan_subsector());
System.out.println("Retrieving Tan_curso by Tan_cursoCriteria");
orm.Tan_cursoCriteria tan_cursoCriteria = new orm.Tan_cursoCriteria();
// Please uncomment the follow line and fill in parameter(s)
//tan_cursoCriteria.cu_id.eq();
System.out.println(tan_cursoCriteria.uniqueTan_curso());
System.out.println("Retrieving Tan_alumno by Tan_alumnoCriteria");
orm.Tan_alumnoCriteria tan_alumnoCriteria = new orm.Tan_alumnoCriteria();
// Please uncomment the follow line and fill in parameter(s)
//tan_alumnoCriteria.al_id.eq();
System.out.println(tan_alumnoCriteria.uniqueTan_alumno());
System.out.println("Retrieving Tan_anotacion by Tan_anotacionCriteria");
orm.Tan_anotacionCriteria tan_anotacionCriteria = new orm.Tan_anotacionCriteria();
// Please uncomment the follow line and fill in parameter(s)
//tan_anotacionCriteria.an_id.eq();
System.out.println(tan_anotacionCriteria.uniqueTan_anotacion());
System.out.println("Retrieving Tan_tipo_anotacion by Tan_tipo_anotacionCriteria");
orm.Tan_tipo_anotacionCriteria tan_tipo_anotacionCriteria = new orm.Tan_tipo_anotacionCriteria();
// Please uncomment the follow line and fill in parameter(s)
//tan_tipo_anotacionCriteria.ta_id.eq();
System.out.println(tan_tipo_anotacionCriteria.uniqueTan_tipo_anotacion());
}
public static void main(String[] args) {
try {
RetrieveAndUpdateBdAnotacionesData retrieveAndUpdateBdAnotacionesData = new RetrieveAndUpdateBdAnotacionesData();
try {
retrieveAndUpdateBdAnotacionesData.retrieveAndUpdateTestData();
//retrieveAndUpdateBdAnotacionesData.retrieveByCriteria();
}
finally {
orm.BdAnotacionesPersistentManager.instance().disposePersistentManager();
}
}
catch (Exception e) {
e.printStackTrace();
}
}
}
| Java |
/**
* Licensee: DuKe TeAm
* License Type: Purchased
*/
package ormsamples;
import org.orm.*;
public class CreateBdAnotacionesDatabaseSchema {
public static void main(String[] args) {
try {
ORMDatabaseInitiator.createSchema(orm.BdAnotacionesPersistentManager.instance());
orm.BdAnotacionesPersistentManager.instance().disposePersistentManager();
}
catch (Exception e) {
e.printStackTrace();
}
}
}
| Java |
/**
* Licensee: DuKe TeAm
* License Type: Purchased
*/
package ormsamples;
import org.orm.*;
public class CreateBdAnotacionesData {
public void createTestData() throws PersistentException {
PersistentTransaction t = orm.BdAnotacionesPersistentManager.instance().getSession().beginTransaction();
try {
orm.DAOFactory lDAOFactory = orm.DAOFactory.getDAOFactory();
orm.dao.Tan_anotadorDAO oRMTan_anotadorDAO = lDAOFactory.getTan_anotadorDAO();
orm.Tan_anotador oRMTan_anotador = oRMTan_anotadorDAO.createTan_anotador();
// TODO Initialize the properties of the persistent object here, the following properties must be initialized before saving : tan_anotacion, an_rut
oRMTan_anotadorDAO.save(oRMTan_anotador);
orm.dao.Tan_subsectorDAO oRMTan_subsectorDAO = lDAOFactory.getTan_subsectorDAO();
orm.Tan_subsector oRMTan_subsector = oRMTan_subsectorDAO.createTan_subsector();
// TODO Initialize the properties of the persistent object here, the following properties must be initialized before saving : tan_cursocu
oRMTan_subsectorDAO.save(oRMTan_subsector);
orm.dao.Tan_cursoDAO oRMTan_cursoDAO = lDAOFactory.getTan_cursoDAO();
orm.Tan_curso oRMTan_curso = oRMTan_cursoDAO.createTan_curso();
// TODO Initialize the properties of the persistent object here, the following properties must be initialized before saving : tan_alumno, tan_subsector
oRMTan_cursoDAO.save(oRMTan_curso);
orm.dao.Tan_alumnoDAO oRMTan_alumnoDAO = lDAOFactory.getTan_alumnoDAO();
orm.Tan_alumno oRMTan_alumno = oRMTan_alumnoDAO.createTan_alumno();
// TODO Initialize the properties of the persistent object here, the following properties must be initialized before saving : tan_anotacion, al_rut, tan_cursocu
oRMTan_alumnoDAO.save(oRMTan_alumno);
orm.dao.Tan_anotacionDAO oRMTan_anotacionDAO = lDAOFactory.getTan_anotacionDAO();
orm.Tan_anotacion oRMTan_anotacion = oRMTan_anotacionDAO.createTan_anotacion();
// TODO Initialize the properties of the persistent object here, the following properties must be initialized before saving : tan_alumnoal, tan_tipo_anotacionta, tan_anotadoran
oRMTan_anotacionDAO.save(oRMTan_anotacion);
orm.dao.Tan_tipo_anotacionDAO oRMTan_tipo_anotacionDAO = lDAOFactory.getTan_tipo_anotacionDAO();
orm.Tan_tipo_anotacion oRMTan_tipo_anotacion = oRMTan_tipo_anotacionDAO.createTan_tipo_anotacion();
// TODO Initialize the properties of the persistent object here, the following properties must be initialized before saving : tan_anotacion
oRMTan_tipo_anotacionDAO.save(oRMTan_tipo_anotacion);
t.commit();
}
catch (Exception e) {
t.rollback();
}
}
public static void main(String[] args) {
try {
CreateBdAnotacionesData createBdAnotacionesData = new CreateBdAnotacionesData();
try {
createBdAnotacionesData.createTestData();
}
finally {
orm.BdAnotacionesPersistentManager.instance().disposePersistentManager();
}
}
catch (Exception e) {
e.printStackTrace();
}
}
}
| Java |
package SOAPVO;
public class CursoSOAPVO {
int id_curso;
String nombre;
public static CursoSOAPVO crearCursoSOAPVO(orm.Tan_curso cursoOrm) {
CursoSOAPVO objeto = new CursoSOAPVO();
objeto.setId_curso(cursoOrm.getCu_id());
objeto.setNombre(cursoOrm.getCu_nombre());
return objeto;
}
public int getId_curso(){
return id_curso;
}
public void setId_curso(int id_curso){
this.id_curso = id_curso ;
}
public String getNombre(){
return nombre;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
}
| Java |
package SOAPVO;
public class AnotadorSOAPVO {
String rut;
String nombre;
int id;
public static AnotadorSOAPVO crearAnotadorSOAPVO(orm.Tan_anotador anotadorOrm) {
AnotadorSOAPVO objeto = new AnotadorSOAPVO();
objeto.setNombre(anotadorOrm.getAn_nombre());
objeto.setRut(anotadorOrm.getAn_rut());
objeto.setId(anotadorOrm.getAn_id());
return objeto;
}
public int getId(){
return id;
}
public void setId(int id){
this.id = id;
}
public String getRut() {
return rut;
}
public void setRut(String rut) {
this.rut = rut;
}
public String getNombre() {
return nombre;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
}
| Java |
package SOAPVO;
public class SubsectorSOAPVO {
int id_subsector;
String descripcion;
int id_curso;
public static SubsectorSOAPVO crearSubsectorSOAPVO(orm.Tan_subsector subsectorOrm) {
SubsectorSOAPVO objeto = new SubsectorSOAPVO();
objeto.setId_subsector(subsectorOrm.getSu_id());
objeto.setDescripcion(subsectorOrm.getSu_descripcion());
objeto.setId_curso(subsectorOrm.getTan_cursocu().getCu_id());
return objeto;
}
public int getId_subsector(){
return id_subsector;
}
public void setId_subsector(int id_subsector){
this.id_subsector = id_subsector;
}
public String getDescripcion(){
return descripcion;
}
public void setDescripcion(String descripcion){
this.descripcion = descripcion;
}
public int getId_curso(){
return id_curso;
}
public void setId_curso(int id_curso){
this.id_curso = id_curso;
}
}
| Java |
package SOAPVO;
public class AlumnoSOAPVO {
int id;
String nombre;
String rut;
String descripcion;
int curso;
public static AlumnoSOAPVO crearAlumnoSOAPVO(orm.Tan_alumno
alumnoOrm) {
AlumnoSOAPVO objeto = new AlumnoSOAPVO();
objeto.setId(alumnoOrm.getAl_id());
objeto.setNombre(alumnoOrm.getAl_nombre());
objeto.setRut(alumnoOrm.getAl_rut());
objeto.setCurso(alumnoOrm.getTan_cursocu().getCu_id());
return objeto;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getNombre() {
return nombre;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
public String getRut() {
return rut;
}
public void setRut(String rut) {
this.rut = rut;
}
public String getDescripcion() {
return descripcion;
}
public void setDescripcion(String descripcion) {
this.descripcion = descripcion;
}
public int getCurso() {
return curso;
}
public void setCurso(int curso) {
this.curso = curso;
}
}
| Java |
package SOAPVO;
import java.util.Date;
public class AnotacionSOAPVO {
int idAnotacion;
int tipo_anotacion;
int idAlumno;
int idAnotador;
String al_nombre;
String an_nombre;
String an_descripcion;
String descripcion;
Date fecha;
public static AnotacionSOAPVO crearPublicacionSOAPVO(orm.Tan_anotacion anotacionOrm) {
AnotacionSOAPVO objeto = new AnotacionSOAPVO();
objeto.setAnotacion(anotacionOrm.getAn_id());
objeto.setTipo_anotacion(anotacionOrm.getTan_tipo_anotacionta().getTa_id());
objeto.setidAlumno(anotacionOrm.getTan_alumnoal().getAl_id());
objeto.setidAnotador(anotacionOrm.getTan_anotadoran().getAn_id());
objeto.setFecha(anotacionOrm.getAn_fecha());
objeto.setDescripcion(anotacionOrm.getAn_descripcion());
objeto.setNomAl(anotacionOrm.getTan_alumnoal().getAl_nombre());
objeto.setNomAn(anotacionOrm.getTan_anotadoran().getAn_nombre());
objeto.setDesAn(anotacionOrm.getTan_tipo_anotacionta().getTa_descripcion());
return objeto;
}
public void setDesAn(String an_descripcion1){
this.an_descripcion = an_descripcion1;
}
public String getNomAl(){
return al_nombre;
}
public void setNomAl(String al_nombre1){
this.al_nombre = al_nombre1;
}
public String getNomAn(){
return an_nombre;
}
public void setNomAn(String an_nombre1){
this.an_nombre = an_nombre1;
}
public int getIdAnotacion() {
return idAnotacion;
}
public void setAnotacion(int idAnotacion1) {
this.idAnotacion = idAnotacion1;
}
public int getidAlumno() {
return idAlumno;
}
public void setidAlumno(int idAlumno1) {
this.idAlumno = idAlumno1;
}
public int getidAnotador() {
return idAnotador;
}
public void setidAnotador(int idAnotador1) {
this.idAnotador = idAnotador1;
}
public int getTipo_anotacion() {
return tipo_anotacion;
}
public void setTipo_anotacion(int tipo_anotacion1) {
this.tipo_anotacion = tipo_anotacion1;
}
public Date getFecha() {
return fecha;
}
public void setFecha(Date fecha1) {
this.fecha = fecha1;
}
public String getDescripcion() {
return descripcion;
}
public void setDescripcion(String descripcion1){
this.descripcion = descripcion1;
}
}
| Java |
/**
* "Visual Paradigm: DO NOT MODIFY THIS FILE!"
*
* This is an automatic generated file. It will be regenerated every time
* you generate persistence class.
*
* Modifying its content may cause the program not work, or your work may lost.
*/
/**
* Licensee: DuKe TeAm
* License Type: Purchased
*/
package orm;
import org.hibernate.Criteria;
import org.orm.PersistentException;
import org.orm.PersistentSession;
import org.orm.criteria.*;
public class Tan_anotacionCriteria extends AbstractORMCriteria {
public final IntegerExpression an_id;
public final DateExpression an_fecha;
public final StringExpression an_descripcion;
public Tan_anotacionCriteria(Criteria criteria) {
super(criteria);
an_id = new IntegerExpression("an_id", this);
an_fecha = new DateExpression("an_fecha", this);
an_descripcion = new StringExpression("an_descripcion", this);
}
public Tan_anotacionCriteria(PersistentSession session) {
this(session.createCriteria(Tan_anotacion.class));
}
public Tan_anotacionCriteria() throws PersistentException {
this(orm.BdAnotacionesPersistentManager.instance().getSession());
}
public Tan_anotadorCriteria createTan_anotadoranCriteria() {
return new Tan_anotadorCriteria(createCriteria("tan_anotadoran"));
}
public Tan_tipo_anotacionCriteria createTan_tipo_anotaciontaCriteria() {
return new Tan_tipo_anotacionCriteria(createCriteria("tan_tipo_anotacionta"));
}
public Tan_alumnoCriteria createTan_alumnoalCriteria() {
return new Tan_alumnoCriteria(createCriteria("tan_alumnoal"));
}
public Tan_anotacion uniqueTan_anotacion() {
return (Tan_anotacion) super.uniqueResult();
}
public Tan_anotacion[] listTan_anotacion() {
java.util.List list = super.list();
return (Tan_anotacion[]) list.toArray(new Tan_anotacion[list.size()]);
}
}
| Java |
/**
* "Visual Paradigm: DO NOT MODIFY THIS FILE!"
*
* This is an automatic generated file. It will be regenerated every time
* you generate persistence class.
*
* Modifying its content may cause the program not work, or your work may lost.
*/
/**
* Licensee: DuKe TeAm
* License Type: Purchased
*/
package orm;
import java.io.Serializable;
public class Tan_curso implements Serializable {
public Tan_curso() {
}
private java.util.Set this_getSet (int key) {
if (key == orm.ORMConstants.KEY_TAN_CURSO_TAN_SUBSECTOR) {
return ORM_tan_subsector;
}
else if (key == orm.ORMConstants.KEY_TAN_CURSO_TAN_ALUMNO) {
return ORM_tan_alumno;
}
return null;
}
org.orm.util.ORMAdapter _ormAdapter = new org.orm.util.AbstractORMAdapter() {
public java.util.Set getSet(int key) {
return this_getSet(key);
}
};
private int cu_id;
private String cu_nombre;
private java.util.Set ORM_tan_subsector = new java.util.HashSet();
private java.util.Set ORM_tan_alumno = new java.util.HashSet();
private void setCu_id(int value) {
this.cu_id = value;
}
public int getCu_id() {
return cu_id;
}
public int getORMID() {
return getCu_id();
}
/**
* nombre del curso
*/
public void setCu_nombre(String value) {
this.cu_nombre = value;
}
/**
* nombre del curso
*/
public String getCu_nombre() {
return cu_nombre;
}
private void setORM_Tan_subsector(java.util.Set value) {
this.ORM_tan_subsector = value;
}
private java.util.Set getORM_Tan_subsector() {
return ORM_tan_subsector;
}
public final orm.Tan_subsectorSetCollection tan_subsector = new orm.Tan_subsectorSetCollection(this, _ormAdapter, orm.ORMConstants.KEY_TAN_CURSO_TAN_SUBSECTOR, orm.ORMConstants.KEY_TAN_SUBSECTOR_TAN_CURSOCU, orm.ORMConstants.KEY_MUL_ONE_TO_MANY);
private void setORM_Tan_alumno(java.util.Set value) {
this.ORM_tan_alumno = value;
}
private java.util.Set getORM_Tan_alumno() {
return ORM_tan_alumno;
}
public final orm.Tan_alumnoSetCollection tan_alumno = new orm.Tan_alumnoSetCollection(this, _ormAdapter, orm.ORMConstants.KEY_TAN_CURSO_TAN_ALUMNO, orm.ORMConstants.KEY_TAN_ALUMNO_TAN_CURSOCU, orm.ORMConstants.KEY_MUL_ONE_TO_MANY);
public String toString() {
return String.valueOf(getCu_id());
}
}
| Java |
/**
* "Visual Paradigm: DO NOT MODIFY THIS FILE!"
*
* This is an automatic generated file. It will be regenerated every time
* you generate persistence class.
*
* Modifying its content may cause the program not work, or your work may lost.
*/
/**
* Licensee: DuKe TeAm
* License Type: Purchased
*/
package orm;
import org.hibernate.Criteria;
import org.orm.PersistentException;
import org.orm.PersistentSession;
import org.orm.criteria.*;
public class Tan_alumnoCriteria extends AbstractORMCriteria {
public final IntegerExpression al_id;
public final StringExpression al_rut;
public final StringExpression al_nombre;
public Tan_alumnoCriteria(Criteria criteria) {
super(criteria);
al_id = new IntegerExpression("al_id", this);
al_rut = new StringExpression("al_rut", this);
al_nombre = new StringExpression("al_nombre", this);
}
public Tan_alumnoCriteria(PersistentSession session) {
this(session.createCriteria(Tan_alumno.class));
}
public Tan_alumnoCriteria() throws PersistentException {
this(orm.BdAnotacionesPersistentManager.instance().getSession());
}
public Tan_cursoCriteria createTan_cursocuCriteria() {
return new Tan_cursoCriteria(createCriteria("tan_cursocu"));
}
public orm.Tan_anotacionCriteria createTan_anotacionCriteria() {
return new orm.Tan_anotacionCriteria(createCriteria("ORM_Tan_anotacion"));
}
public Tan_alumno uniqueTan_alumno() {
return (Tan_alumno) super.uniqueResult();
}
public Tan_alumno[] listTan_alumno() {
java.util.List list = super.list();
return (Tan_alumno[]) list.toArray(new Tan_alumno[list.size()]);
}
}
| Java |
/**
* "Visual Paradigm: DO NOT MODIFY THIS FILE!"
*
* This is an automatic generated file. It will be regenerated every time
* you generate persistence class.
*
* Modifying its content may cause the program not work, or your work may lost.
*/
/**
* Licensee: DuKe TeAm
* License Type: Purchased
*/
package orm;
import java.util.List;
import org.hibernate.criterion.DetachedCriteria;
import org.orm.PersistentSession;
import org.orm.criteria.*;
public class Tan_tipo_anotacionDetachedCriteria extends AbstractORMDetachedCriteria {
public final IntegerExpression ta_id;
public final StringExpression ta_descripcion;
public Tan_tipo_anotacionDetachedCriteria() {
super(orm.Tan_tipo_anotacion.class, orm.Tan_tipo_anotacionCriteria.class);
ta_id = new IntegerExpression("ta_id", this.getDetachedCriteria());
ta_descripcion = new StringExpression("ta_descripcion", this.getDetachedCriteria());
}
public Tan_tipo_anotacionDetachedCriteria(DetachedCriteria aDetachedCriteria) {
super(aDetachedCriteria, orm.Tan_tipo_anotacionCriteria.class);
ta_id = new IntegerExpression("ta_id", this.getDetachedCriteria());
ta_descripcion = new StringExpression("ta_descripcion", this.getDetachedCriteria());
}
public orm.Tan_anotacionDetachedCriteria createTan_anotacionCriteria() {
return new orm.Tan_anotacionDetachedCriteria(createCriteria("ORM_Tan_anotacion"));
}
public Tan_tipo_anotacion uniqueTan_tipo_anotacion(PersistentSession session) {
return (Tan_tipo_anotacion) super.createExecutableCriteria(session).uniqueResult();
}
public Tan_tipo_anotacion[] listTan_tipo_anotacion(PersistentSession session) {
List list = super.createExecutableCriteria(session).list();
return (Tan_tipo_anotacion[]) list.toArray(new Tan_tipo_anotacion[list.size()]);
}
}
| Java |
/**
* "Visual Paradigm: DO NOT MODIFY THIS FILE!"
*
* This is an automatic generated file. It will be regenerated every time
* you generate persistence class.
*
* Modifying its content may cause the program not work, or your work may lost.
*/
/**
* Licensee: DuKe TeAm
* License Type: Purchased
*/
package orm;
import org.hibernate.Criteria;
import org.orm.PersistentException;
import org.orm.PersistentSession;
import org.orm.criteria.*;
public class Tan_tipo_anotacionCriteria extends AbstractORMCriteria {
public final IntegerExpression ta_id;
public final StringExpression ta_descripcion;
public Tan_tipo_anotacionCriteria(Criteria criteria) {
super(criteria);
ta_id = new IntegerExpression("ta_id", this);
ta_descripcion = new StringExpression("ta_descripcion", this);
}
public Tan_tipo_anotacionCriteria(PersistentSession session) {
this(session.createCriteria(Tan_tipo_anotacion.class));
}
public Tan_tipo_anotacionCriteria() throws PersistentException {
this(orm.BdAnotacionesPersistentManager.instance().getSession());
}
public orm.Tan_anotacionCriteria createTan_anotacionCriteria() {
return new orm.Tan_anotacionCriteria(createCriteria("ORM_Tan_anotacion"));
}
public Tan_tipo_anotacion uniqueTan_tipo_anotacion() {
return (Tan_tipo_anotacion) super.uniqueResult();
}
public Tan_tipo_anotacion[] listTan_tipo_anotacion() {
java.util.List list = super.list();
return (Tan_tipo_anotacion[]) list.toArray(new Tan_tipo_anotacion[list.size()]);
}
}
| Java |
/**
* "Visual Paradigm: DO NOT MODIFY THIS FILE!"
*
* This is an automatic generated file. It will be regenerated every time
* you generate persistence class.
*
* Modifying its content may cause the program not work, or your work may lost.
*/
/**
* Licensee: DuKe TeAm
* License Type: Purchased
*/
package orm;
import java.io.Serializable;
public class Tan_tipo_anotacion implements Serializable {
public Tan_tipo_anotacion() {
}
private java.util.Set this_getSet (int key) {
if (key == orm.ORMConstants.KEY_TAN_TIPO_ANOTACION_TAN_ANOTACION) {
return ORM_tan_anotacion;
}
return null;
}
org.orm.util.ORMAdapter _ormAdapter = new org.orm.util.AbstractORMAdapter() {
public java.util.Set getSet(int key) {
return this_getSet(key);
}
};
private int ta_id;
private String ta_descripcion;
private java.util.Set ORM_tan_anotacion = new java.util.HashSet();
private void setTa_id(int value) {
this.ta_id = value;
}
public int getTa_id() {
return ta_id;
}
public int getORMID() {
return getTa_id();
}
/**
* nombre del tipo-anotacion
*/
public void setTa_descripcion(String value) {
this.ta_descripcion = value;
}
/**
* nombre del tipo-anotacion
*/
public String getTa_descripcion() {
return ta_descripcion;
}
private void setORM_Tan_anotacion(java.util.Set value) {
this.ORM_tan_anotacion = value;
}
private java.util.Set getORM_Tan_anotacion() {
return ORM_tan_anotacion;
}
public final orm.Tan_anotacionSetCollection tan_anotacion = new orm.Tan_anotacionSetCollection(this, _ormAdapter, orm.ORMConstants.KEY_TAN_TIPO_ANOTACION_TAN_ANOTACION, orm.ORMConstants.KEY_TAN_ANOTACION_TAN_TIPO_ANOTACIONTA, orm.ORMConstants.KEY_MUL_ONE_TO_MANY);
public String toString() {
return String.valueOf(getTa_id());
}
}
| Java |
/**
* "Visual Paradigm: DO NOT MODIFY THIS FILE!"
*
* This is an automatic generated file. It will be regenerated every time
* you generate persistence class.
*
* Modifying its content may cause the program not work, or your work may lost.
*/
/**
* Licensee: DuKe TeAm
* License Type: Purchased
*/
package orm;
import java.util.List;
import org.hibernate.criterion.DetachedCriteria;
import org.orm.PersistentSession;
import org.orm.criteria.*;
public class Tan_anotacionDetachedCriteria extends AbstractORMDetachedCriteria {
public final IntegerExpression an_id;
public final DateExpression an_fecha;
public final StringExpression an_descripcion;
public Tan_anotacionDetachedCriteria() {
super(orm.Tan_anotacion.class, orm.Tan_anotacionCriteria.class);
an_id = new IntegerExpression("an_id", this.getDetachedCriteria());
an_fecha = new DateExpression("an_fecha", this.getDetachedCriteria());
an_descripcion = new StringExpression("an_descripcion", this.getDetachedCriteria());
}
public Tan_anotacionDetachedCriteria(DetachedCriteria aDetachedCriteria) {
super(aDetachedCriteria, orm.Tan_anotacionCriteria.class);
an_id = new IntegerExpression("an_id", this.getDetachedCriteria());
an_fecha = new DateExpression("an_fecha", this.getDetachedCriteria());
an_descripcion = new StringExpression("an_descripcion", this.getDetachedCriteria());
}
public Tan_anotadorDetachedCriteria createTan_anotadoranCriteria() {
return new Tan_anotadorDetachedCriteria(createCriteria("tan_anotadoran"));
}
public Tan_tipo_anotacionDetachedCriteria createTan_tipo_anotaciontaCriteria() {
return new Tan_tipo_anotacionDetachedCriteria(createCriteria("tan_tipo_anotacionta"));
}
public Tan_alumnoDetachedCriteria createTan_alumnoalCriteria() {
return new Tan_alumnoDetachedCriteria(createCriteria("tan_alumnoal"));
}
public Tan_anotacion uniqueTan_anotacion(PersistentSession session) {
return (Tan_anotacion) super.createExecutableCriteria(session).uniqueResult();
}
public Tan_anotacion[] listTan_anotacion(PersistentSession session) {
List list = super.createExecutableCriteria(session).list();
return (Tan_anotacion[]) list.toArray(new Tan_anotacion[list.size()]);
}
}
| Java |
/**
* "Visual Paradigm: DO NOT MODIFY THIS FILE!"
*
* This is an automatic generated file. It will be regenerated every time
* you generate persistence class.
*
* Modifying its content may cause the program not work, or your work may lost.
*/
/**
* Licensee: DuKe TeAm
* License Type: Purchased
*/
package orm;
import java.util.List;
import org.hibernate.criterion.DetachedCriteria;
import org.orm.PersistentSession;
import org.orm.criteria.*;
public class Tan_anotadorDetachedCriteria extends AbstractORMDetachedCriteria {
public final IntegerExpression an_id;
public final StringExpression an_nombre;
public final StringExpression an_rut;
public Tan_anotadorDetachedCriteria() {
super(orm.Tan_anotador.class, orm.Tan_anotadorCriteria.class);
an_id = new IntegerExpression("an_id", this.getDetachedCriteria());
an_nombre = new StringExpression("an_nombre", this.getDetachedCriteria());
an_rut = new StringExpression("an_rut", this.getDetachedCriteria());
}
public Tan_anotadorDetachedCriteria(DetachedCriteria aDetachedCriteria) {
super(aDetachedCriteria, orm.Tan_anotadorCriteria.class);
an_id = new IntegerExpression("an_id", this.getDetachedCriteria());
an_nombre = new StringExpression("an_nombre", this.getDetachedCriteria());
an_rut = new StringExpression("an_rut", this.getDetachedCriteria());
}
public orm.Tan_anotacionDetachedCriteria createTan_anotacionCriteria() {
return new orm.Tan_anotacionDetachedCriteria(createCriteria("ORM_Tan_anotacion"));
}
public Tan_anotador uniqueTan_anotador(PersistentSession session) {
return (Tan_anotador) super.createExecutableCriteria(session).uniqueResult();
}
public Tan_anotador[] listTan_anotador(PersistentSession session) {
List list = super.createExecutableCriteria(session).list();
return (Tan_anotador[]) list.toArray(new Tan_anotador[list.size()]);
}
}
| Java |
/**
* "Visual Paradigm: DO NOT MODIFY THIS FILE!"
*
* This is an automatic generated file. It will be regenerated every time
* you generate persistence class.
*
* Modifying its content may cause the program not work, or your work may lost.
*/
/**
* Licensee: DuKe TeAm
* License Type: Purchased
*/
package orm;
import java.util.List;
import org.hibernate.criterion.DetachedCriteria;
import org.orm.PersistentSession;
import org.orm.criteria.*;
public class Tan_alumnoDetachedCriteria extends AbstractORMDetachedCriteria {
public final IntegerExpression al_id;
public final StringExpression al_rut;
public final StringExpression al_nombre;
public Tan_alumnoDetachedCriteria() {
super(orm.Tan_alumno.class, orm.Tan_alumnoCriteria.class);
al_id = new IntegerExpression("al_id", this.getDetachedCriteria());
al_rut = new StringExpression("al_rut", this.getDetachedCriteria());
al_nombre = new StringExpression("al_nombre", this.getDetachedCriteria());
}
public Tan_alumnoDetachedCriteria(DetachedCriteria aDetachedCriteria) {
super(aDetachedCriteria, orm.Tan_alumnoCriteria.class);
al_id = new IntegerExpression("al_id", this.getDetachedCriteria());
al_rut = new StringExpression("al_rut", this.getDetachedCriteria());
al_nombre = new StringExpression("al_nombre", this.getDetachedCriteria());
}
public Tan_cursoDetachedCriteria createTan_cursocuCriteria() {
return new Tan_cursoDetachedCriteria(createCriteria("tan_cursocu"));
}
public orm.Tan_anotacionDetachedCriteria createTan_anotacionCriteria() {
return new orm.Tan_anotacionDetachedCriteria(createCriteria("ORM_Tan_anotacion"));
}
public Tan_alumno uniqueTan_alumno(PersistentSession session) {
return (Tan_alumno) super.createExecutableCriteria(session).uniqueResult();
}
public Tan_alumno[] listTan_alumno(PersistentSession session) {
List list = super.createExecutableCriteria(session).list();
return (Tan_alumno[]) list.toArray(new Tan_alumno[list.size()]);
}
}
| Java |
/**
* "Visual Paradigm: DO NOT MODIFY THIS FILE!"
*
* This is an automatic generated file. It will be regenerated every time
* you generate persistence class.
*
* Modifying its content may cause the program not work, or your work may lost.
*/
/**
* Licensee: DuKe TeAm
* License Type: Purchased
*/
package orm;
import java.io.Serializable;
public class Tan_alumno implements Serializable {
public Tan_alumno() {
}
private java.util.Set this_getSet (int key) {
if (key == orm.ORMConstants.KEY_TAN_ALUMNO_TAN_ANOTACION) {
return ORM_tan_anotacion;
}
return null;
}
private void this_setOwner(Object owner, int key) {
if (key == orm.ORMConstants.KEY_TAN_ALUMNO_TAN_CURSOCU) {
this.tan_cursocu = (orm.Tan_curso) owner;
}
}
org.orm.util.ORMAdapter _ormAdapter = new org.orm.util.AbstractORMAdapter() {
public java.util.Set getSet(int key) {
return this_getSet(key);
}
public void setOwner(Object owner, int key) {
this_setOwner(owner, key);
}
};
private int al_id;
private orm.Tan_curso tan_cursocu;
private String al_rut;
private String al_nombre;
private java.util.Set ORM_tan_anotacion = new java.util.HashSet();
private void setAl_id(int value) {
this.al_id = value;
}
public int getAl_id() {
return al_id;
}
public int getORMID() {
return getAl_id();
}
/**
* rut del alumno
*/
public void setAl_rut(String value) {
this.al_rut = value;
}
/**
* rut del alumno
*/
public String getAl_rut() {
return al_rut;
}
/**
* nombre del alumno
*/
public void setAl_nombre(String value) {
this.al_nombre = value;
}
/**
* nombre del alumno
*/
public String getAl_nombre() {
return al_nombre;
}
public void setTan_cursocu(orm.Tan_curso value) {
if (tan_cursocu != null) {
tan_cursocu.tan_alumno.remove(this);
}
if (value != null) {
value.tan_alumno.add(this);
}
}
public orm.Tan_curso getTan_cursocu() {
return tan_cursocu;
}
/**
* This method is for internal use only.
*/
public void setORM_Tan_cursocu(orm.Tan_curso value) {
this.tan_cursocu = value;
}
private orm.Tan_curso getORM_Tan_cursocu() {
return tan_cursocu;
}
private void setORM_Tan_anotacion(java.util.Set value) {
this.ORM_tan_anotacion = value;
}
private java.util.Set getORM_Tan_anotacion() {
return ORM_tan_anotacion;
}
public final orm.Tan_anotacionSetCollection tan_anotacion = new orm.Tan_anotacionSetCollection(this, _ormAdapter, orm.ORMConstants.KEY_TAN_ALUMNO_TAN_ANOTACION, orm.ORMConstants.KEY_TAN_ANOTACION_TAN_ALUMNOAL, orm.ORMConstants.KEY_MUL_ONE_TO_MANY);
public String toString() {
return String.valueOf(getAl_id());
}
}
| Java |
/**
* "Visual Paradigm: DO NOT MODIFY THIS FILE!"
*
* This is an automatic generated file. It will be regenerated every time
* you generate persistence class.
*
* Modifying its content may cause the program not work, or your work may lost.
*/
/**
* Licensee: DuKe TeAm
* License Type: Purchased
*/
package orm;
import org.hibernate.Criteria;
import org.orm.PersistentException;
import org.orm.PersistentSession;
import org.orm.criteria.*;
public class Tan_subsectorCriteria extends AbstractORMCriteria {
public final IntegerExpression su_id;
public final StringExpression su_descripcion;
public Tan_subsectorCriteria(Criteria criteria) {
super(criteria);
su_id = new IntegerExpression("su_id", this);
su_descripcion = new StringExpression("su_descripcion", this);
}
public Tan_subsectorCriteria(PersistentSession session) {
this(session.createCriteria(Tan_subsector.class));
}
public Tan_subsectorCriteria() throws PersistentException {
this(orm.BdAnotacionesPersistentManager.instance().getSession());
}
public Tan_cursoCriteria createTan_cursocuCriteria() {
return new Tan_cursoCriteria(createCriteria("tan_cursocu"));
}
public Tan_subsector uniqueTan_subsector() {
return (Tan_subsector) super.uniqueResult();
}
public Tan_subsector[] listTan_subsector() {
java.util.List list = super.list();
return (Tan_subsector[]) list.toArray(new Tan_subsector[list.size()]);
}
}
| Java |
/**
* "Visual Paradigm: DO NOT MODIFY THIS FILE!"
*
* This is an automatic generated file. It will be regenerated every time
* you generate persistence class.
*
* Modifying its content may cause the program not work, or your work may lost.
*/
/**
* Licensee: DuKe TeAm
* License Type: Purchased
*/
package orm.dao;
import org.orm.*;
import orm.*;
public interface Tan_anotacionDAO {
public Tan_anotacion loadTan_anotacionByORMID(int an_id) throws PersistentException;
public Tan_anotacion getTan_anotacionByORMID(int an_id) throws PersistentException;
public Tan_anotacion loadTan_anotacionByORMID(int an_id, org.hibernate.LockMode lockMode) throws PersistentException;
public Tan_anotacion getTan_anotacionByORMID(int an_id, org.hibernate.LockMode lockMode) throws PersistentException;
public Tan_anotacion loadTan_anotacionByORMID(PersistentSession session, int an_id) throws PersistentException;
public Tan_anotacion getTan_anotacionByORMID(PersistentSession session, int an_id) throws PersistentException;
public Tan_anotacion loadTan_anotacionByORMID(PersistentSession session, int an_id, org.hibernate.LockMode lockMode) throws PersistentException;
public Tan_anotacion getTan_anotacionByORMID(PersistentSession session, int an_id, org.hibernate.LockMode lockMode) throws PersistentException;
public Tan_anotacion[] listTan_anotacionByQuery(String condition, String orderBy) throws PersistentException;
public Tan_anotacion[] listTan_anotacionByQuery(String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException;
public Tan_anotacion[] listTan_anotacionByQuery(PersistentSession session, String condition, String orderBy) throws PersistentException;
public Tan_anotacion[] listTan_anotacionByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException;
public Tan_anotacion loadTan_anotacionByQuery(String condition, String orderBy) throws PersistentException;
public Tan_anotacion loadTan_anotacionByQuery(String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException;
public Tan_anotacion loadTan_anotacionByQuery(PersistentSession session, String condition, String orderBy) throws PersistentException;
public Tan_anotacion loadTan_anotacionByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException;
public Tan_anotacion createTan_anotacion();
public boolean save(orm.Tan_anotacion tan_anotacion) throws PersistentException;
public boolean delete(orm.Tan_anotacion tan_anotacion) throws PersistentException;
public boolean deleteAndDissociate(orm.Tan_anotacion tan_anotacion) throws PersistentException;
public boolean deleteAndDissociate(orm.Tan_anotacion tan_anotacion, org.orm.PersistentSession session) throws PersistentException;
public boolean refresh(orm.Tan_anotacion tan_anotacion) throws PersistentException;
public boolean evict(orm.Tan_anotacion tan_anotacion) throws PersistentException;
public Tan_anotacion loadTan_anotacionByCriteria(Tan_anotacionCriteria tan_anotacionCriteria);
public Tan_anotacion[] listTan_anotacionByCriteria(Tan_anotacionCriteria tan_anotacionCriteria);
}
| Java |
/**
* "Visual Paradigm: DO NOT MODIFY THIS FILE!"
*
* This is an automatic generated file. It will be regenerated every time
* you generate persistence class.
*
* Modifying its content may cause the program not work, or your work may lost.
*/
/**
* Licensee: DuKe TeAm
* License Type: Purchased
*/
package orm.dao;
import org.orm.*;
import orm.*;
public interface Tan_cursoDAO {
public Tan_curso loadTan_cursoByORMID(int cu_id) throws PersistentException;
public Tan_curso getTan_cursoByORMID(int cu_id) throws PersistentException;
public Tan_curso loadTan_cursoByORMID(int cu_id, org.hibernate.LockMode lockMode) throws PersistentException;
public Tan_curso getTan_cursoByORMID(int cu_id, org.hibernate.LockMode lockMode) throws PersistentException;
public Tan_curso loadTan_cursoByORMID(PersistentSession session, int cu_id) throws PersistentException;
public Tan_curso getTan_cursoByORMID(PersistentSession session, int cu_id) throws PersistentException;
public Tan_curso loadTan_cursoByORMID(PersistentSession session, int cu_id, org.hibernate.LockMode lockMode) throws PersistentException;
public Tan_curso getTan_cursoByORMID(PersistentSession session, int cu_id, org.hibernate.LockMode lockMode) throws PersistentException;
public Tan_curso[] listTan_cursoByQuery(String condition, String orderBy) throws PersistentException;
public Tan_curso[] listTan_cursoByQuery(String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException;
public Tan_curso[] listTan_cursoByQuery(PersistentSession session, String condition, String orderBy) throws PersistentException;
public Tan_curso[] listTan_cursoByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException;
public Tan_curso loadTan_cursoByQuery(String condition, String orderBy) throws PersistentException;
public Tan_curso loadTan_cursoByQuery(String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException;
public Tan_curso loadTan_cursoByQuery(PersistentSession session, String condition, String orderBy) throws PersistentException;
public Tan_curso loadTan_cursoByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException;
public Tan_curso createTan_curso();
public boolean save(orm.Tan_curso tan_curso) throws PersistentException;
public boolean delete(orm.Tan_curso tan_curso) throws PersistentException;
public boolean deleteAndDissociate(orm.Tan_curso tan_curso) throws PersistentException;
public boolean deleteAndDissociate(orm.Tan_curso tan_curso, org.orm.PersistentSession session) throws PersistentException;
public boolean refresh(orm.Tan_curso tan_curso) throws PersistentException;
public boolean evict(orm.Tan_curso tan_curso) throws PersistentException;
public Tan_curso loadTan_cursoByCriteria(Tan_cursoCriteria tan_cursoCriteria);
public Tan_curso[] listTan_cursoByCriteria(Tan_cursoCriteria tan_cursoCriteria);
}
| Java |
/**
* "Visual Paradigm: DO NOT MODIFY THIS FILE!"
*
* This is an automatic generated file. It will be regenerated every time
* you generate persistence class.
*
* Modifying its content may cause the program not work, or your work may lost.
*/
/**
* Licensee: DuKe TeAm
* License Type: Purchased
*/
package orm.dao;
import org.orm.*;
import orm.*;
public interface Tan_tipo_anotacionDAO {
public Tan_tipo_anotacion loadTan_tipo_anotacionByORMID(int ta_id) throws PersistentException;
public Tan_tipo_anotacion getTan_tipo_anotacionByORMID(int ta_id) throws PersistentException;
public Tan_tipo_anotacion loadTan_tipo_anotacionByORMID(int ta_id, org.hibernate.LockMode lockMode) throws PersistentException;
public Tan_tipo_anotacion getTan_tipo_anotacionByORMID(int ta_id, org.hibernate.LockMode lockMode) throws PersistentException;
public Tan_tipo_anotacion loadTan_tipo_anotacionByORMID(PersistentSession session, int ta_id) throws PersistentException;
public Tan_tipo_anotacion getTan_tipo_anotacionByORMID(PersistentSession session, int ta_id) throws PersistentException;
public Tan_tipo_anotacion loadTan_tipo_anotacionByORMID(PersistentSession session, int ta_id, org.hibernate.LockMode lockMode) throws PersistentException;
public Tan_tipo_anotacion getTan_tipo_anotacionByORMID(PersistentSession session, int ta_id, org.hibernate.LockMode lockMode) throws PersistentException;
public Tan_tipo_anotacion[] listTan_tipo_anotacionByQuery(String condition, String orderBy) throws PersistentException;
public Tan_tipo_anotacion[] listTan_tipo_anotacionByQuery(String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException;
public Tan_tipo_anotacion[] listTan_tipo_anotacionByQuery(PersistentSession session, String condition, String orderBy) throws PersistentException;
public Tan_tipo_anotacion[] listTan_tipo_anotacionByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException;
public Tan_tipo_anotacion loadTan_tipo_anotacionByQuery(String condition, String orderBy) throws PersistentException;
public Tan_tipo_anotacion loadTan_tipo_anotacionByQuery(String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException;
public Tan_tipo_anotacion loadTan_tipo_anotacionByQuery(PersistentSession session, String condition, String orderBy) throws PersistentException;
public Tan_tipo_anotacion loadTan_tipo_anotacionByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException;
public Tan_tipo_anotacion createTan_tipo_anotacion();
public boolean save(orm.Tan_tipo_anotacion tan_tipo_anotacion) throws PersistentException;
public boolean delete(orm.Tan_tipo_anotacion tan_tipo_anotacion) throws PersistentException;
public boolean deleteAndDissociate(orm.Tan_tipo_anotacion tan_tipo_anotacion) throws PersistentException;
public boolean deleteAndDissociate(orm.Tan_tipo_anotacion tan_tipo_anotacion, org.orm.PersistentSession session) throws PersistentException;
public boolean refresh(orm.Tan_tipo_anotacion tan_tipo_anotacion) throws PersistentException;
public boolean evict(orm.Tan_tipo_anotacion tan_tipo_anotacion) throws PersistentException;
public Tan_tipo_anotacion loadTan_tipo_anotacionByCriteria(Tan_tipo_anotacionCriteria tan_tipo_anotacionCriteria);
public Tan_tipo_anotacion[] listTan_tipo_anotacionByCriteria(Tan_tipo_anotacionCriteria tan_tipo_anotacionCriteria);
}
| Java |
/**
* "Visual Paradigm: DO NOT MODIFY THIS FILE!"
*
* This is an automatic generated file. It will be regenerated every time
* you generate persistence class.
*
* Modifying its content may cause the program not work, or your work may lost.
*/
/**
* Licensee: DuKe TeAm
* License Type: Purchased
*/
package orm.dao;
import org.orm.*;
import orm.*;
public interface Tan_subsectorDAO {
public Tan_subsector loadTan_subsectorByORMID(int su_id) throws PersistentException;
public Tan_subsector getTan_subsectorByORMID(int su_id) throws PersistentException;
public Tan_subsector loadTan_subsectorByORMID(int su_id, org.hibernate.LockMode lockMode) throws PersistentException;
public Tan_subsector getTan_subsectorByORMID(int su_id, org.hibernate.LockMode lockMode) throws PersistentException;
public Tan_subsector loadTan_subsectorByORMID(PersistentSession session, int su_id) throws PersistentException;
public Tan_subsector getTan_subsectorByORMID(PersistentSession session, int su_id) throws PersistentException;
public Tan_subsector loadTan_subsectorByORMID(PersistentSession session, int su_id, org.hibernate.LockMode lockMode) throws PersistentException;
public Tan_subsector getTan_subsectorByORMID(PersistentSession session, int su_id, org.hibernate.LockMode lockMode) throws PersistentException;
public Tan_subsector[] listTan_subsectorByQuery(String condition, String orderBy) throws PersistentException;
public Tan_subsector[] listTan_subsectorByQuery(String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException;
public Tan_subsector[] listTan_subsectorByQuery(PersistentSession session, String condition, String orderBy) throws PersistentException;
public Tan_subsector[] listTan_subsectorByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException;
public Tan_subsector loadTan_subsectorByQuery(String condition, String orderBy) throws PersistentException;
public Tan_subsector loadTan_subsectorByQuery(String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException;
public Tan_subsector loadTan_subsectorByQuery(PersistentSession session, String condition, String orderBy) throws PersistentException;
public Tan_subsector loadTan_subsectorByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException;
public Tan_subsector createTan_subsector();
public boolean save(orm.Tan_subsector tan_subsector) throws PersistentException;
public boolean delete(orm.Tan_subsector tan_subsector) throws PersistentException;
public boolean deleteAndDissociate(orm.Tan_subsector tan_subsector) throws PersistentException;
public boolean deleteAndDissociate(orm.Tan_subsector tan_subsector, org.orm.PersistentSession session) throws PersistentException;
public boolean refresh(orm.Tan_subsector tan_subsector) throws PersistentException;
public boolean evict(orm.Tan_subsector tan_subsector) throws PersistentException;
public Tan_subsector loadTan_subsectorByCriteria(Tan_subsectorCriteria tan_subsectorCriteria);
public Tan_subsector[] listTan_subsectorByCriteria(Tan_subsectorCriteria tan_subsectorCriteria);
}
| Java |
/**
* "Visual Paradigm: DO NOT MODIFY THIS FILE!"
*
* This is an automatic generated file. It will be regenerated every time
* you generate persistence class.
*
* Modifying its content may cause the program not work, or your work may lost.
*/
/**
* Licensee: DuKe TeAm
* License Type: Purchased
*/
package orm.dao;
import org.orm.*;
import orm.*;
public interface Tan_alumnoDAO {
public Tan_alumno loadTan_alumnoByORMID(int al_id) throws PersistentException;
public Tan_alumno getTan_alumnoByORMID(int al_id) throws PersistentException;
public Tan_alumno loadTan_alumnoByORMID(int al_id, org.hibernate.LockMode lockMode) throws PersistentException;
public Tan_alumno getTan_alumnoByORMID(int al_id, org.hibernate.LockMode lockMode) throws PersistentException;
public Tan_alumno loadTan_alumnoByORMID(PersistentSession session, int al_id) throws PersistentException;
public Tan_alumno getTan_alumnoByORMID(PersistentSession session, int al_id) throws PersistentException;
public Tan_alumno loadTan_alumnoByORMID(PersistentSession session, int al_id, org.hibernate.LockMode lockMode) throws PersistentException;
public Tan_alumno getTan_alumnoByORMID(PersistentSession session, int al_id, org.hibernate.LockMode lockMode) throws PersistentException;
public Tan_alumno[] listTan_alumnoByQuery(String condition, String orderBy) throws PersistentException;
public Tan_alumno[] listTan_alumnoByQuery(String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException;
public Tan_alumno[] listTan_alumnoByQuery(PersistentSession session, String condition, String orderBy) throws PersistentException;
public Tan_alumno[] listTan_alumnoByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException;
public Tan_alumno loadTan_alumnoByQuery(String condition, String orderBy) throws PersistentException;
public Tan_alumno loadTan_alumnoByQuery(String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException;
public Tan_alumno loadTan_alumnoByQuery(PersistentSession session, String condition, String orderBy) throws PersistentException;
public Tan_alumno loadTan_alumnoByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException;
public Tan_alumno createTan_alumno();
public boolean save(orm.Tan_alumno tan_alumno) throws PersistentException;
public boolean delete(orm.Tan_alumno tan_alumno) throws PersistentException;
public boolean deleteAndDissociate(orm.Tan_alumno tan_alumno) throws PersistentException;
public boolean deleteAndDissociate(orm.Tan_alumno tan_alumno, org.orm.PersistentSession session) throws PersistentException;
public boolean refresh(orm.Tan_alumno tan_alumno) throws PersistentException;
public boolean evict(orm.Tan_alumno tan_alumno) throws PersistentException;
public Tan_alumno loadTan_alumnoByCriteria(Tan_alumnoCriteria tan_alumnoCriteria);
public Tan_alumno[] listTan_alumnoByCriteria(Tan_alumnoCriteria tan_alumnoCriteria);
}
| Java |
/**
* "Visual Paradigm: DO NOT MODIFY THIS FILE!"
*
* This is an automatic generated file. It will be regenerated every time
* you generate persistence class.
*
* Modifying its content may cause the program not work, or your work may lost.
*/
/**
* Licensee: DuKe TeAm
* License Type: Purchased
*/
package orm.dao;
import org.orm.*;
import orm.*;
public interface Tan_anotadorDAO {
public Tan_anotador loadTan_anotadorByORMID(int an_id) throws PersistentException;
public Tan_anotador getTan_anotadorByORMID(int an_id) throws PersistentException;
public Tan_anotador loadTan_anotadorByORMID(int an_id, org.hibernate.LockMode lockMode) throws PersistentException;
public Tan_anotador getTan_anotadorByORMID(int an_id, org.hibernate.LockMode lockMode) throws PersistentException;
public Tan_anotador loadTan_anotadorByORMID(PersistentSession session, int an_id) throws PersistentException;
public Tan_anotador getTan_anotadorByORMID(PersistentSession session, int an_id) throws PersistentException;
public Tan_anotador loadTan_anotadorByORMID(PersistentSession session, int an_id, org.hibernate.LockMode lockMode) throws PersistentException;
public Tan_anotador getTan_anotadorByORMID(PersistentSession session, int an_id, org.hibernate.LockMode lockMode) throws PersistentException;
public Tan_anotador[] listTan_anotadorByQuery(String condition, String orderBy) throws PersistentException;
public Tan_anotador[] listTan_anotadorByQuery(String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException;
public Tan_anotador[] listTan_anotadorByQuery(PersistentSession session, String condition, String orderBy) throws PersistentException;
public Tan_anotador[] listTan_anotadorByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException;
public Tan_anotador loadTan_anotadorByQuery(String condition, String orderBy) throws PersistentException;
public Tan_anotador loadTan_anotadorByQuery(String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException;
public Tan_anotador loadTan_anotadorByQuery(PersistentSession session, String condition, String orderBy) throws PersistentException;
public Tan_anotador loadTan_anotadorByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException;
public Tan_anotador createTan_anotador();
public boolean save(orm.Tan_anotador tan_anotador) throws PersistentException;
public boolean delete(orm.Tan_anotador tan_anotador) throws PersistentException;
public boolean deleteAndDissociate(orm.Tan_anotador tan_anotador) throws PersistentException;
public boolean deleteAndDissociate(orm.Tan_anotador tan_anotador, org.orm.PersistentSession session) throws PersistentException;
public boolean refresh(orm.Tan_anotador tan_anotador) throws PersistentException;
public boolean evict(orm.Tan_anotador tan_anotador) throws PersistentException;
public Tan_anotador loadTan_anotadorByCriteria(Tan_anotadorCriteria tan_anotadorCriteria);
public Tan_anotador[] listTan_anotadorByCriteria(Tan_anotadorCriteria tan_anotadorCriteria);
}
| Java |
/**
* "Visual Paradigm: DO NOT MODIFY THIS FILE!"
*
* This is an automatic generated file. It will be regenerated every time
* you generate persistence class.
*
* Modifying its content may cause the program not work, or your work may lost.
*/
/**
* Licensee: DuKe TeAm
* License Type: Purchased
*/
package orm;
import org.hibernate.Criteria;
import org.orm.PersistentException;
import org.orm.PersistentSession;
import org.orm.criteria.*;
public class Tan_anotadorCriteria extends AbstractORMCriteria {
public final IntegerExpression an_id;
public final StringExpression an_nombre;
public final StringExpression an_rut;
public Tan_anotadorCriteria(Criteria criteria) {
super(criteria);
an_id = new IntegerExpression("an_id", this);
an_nombre = new StringExpression("an_nombre", this);
an_rut = new StringExpression("an_rut", this);
}
public Tan_anotadorCriteria(PersistentSession session) {
this(session.createCriteria(Tan_anotador.class));
}
public Tan_anotadorCriteria() throws PersistentException {
this(orm.BdAnotacionesPersistentManager.instance().getSession());
}
public orm.Tan_anotacionCriteria createTan_anotacionCriteria() {
return new orm.Tan_anotacionCriteria(createCriteria("ORM_Tan_anotacion"));
}
public Tan_anotador uniqueTan_anotador() {
return (Tan_anotador) super.uniqueResult();
}
public Tan_anotador[] listTan_anotador() {
java.util.List list = super.list();
return (Tan_anotador[]) list.toArray(new Tan_anotador[list.size()]);
}
}
| Java |
/**
* "Visual Paradigm: DO NOT MODIFY THIS FILE!"
*
* This is an automatic generated file. It will be regenerated every time
* you generate persistence class.
*
* Modifying its content may cause the program not work, or your work may lost.
*/
/**
* Licensee: DuKe TeAm
* License Type: Purchased
*/
package orm;
import org.orm.*;
public class Tan_subsectorSetCollection extends org.orm.util.ORMSet {
public Tan_subsectorSetCollection(Object owner, org.orm.util.ORMAdapter adapter, int ownerKey, int targetKey, int collType) {
super(owner, adapter, ownerKey, targetKey, true, collType);
}
public Tan_subsectorSetCollection(Object owner, org.orm.util.ORMAdapter adapter, int ownerKey, int collType) {
super(owner, adapter, ownerKey, -1, false, collType);
}
/**
* Return an iterator over the persistent objects
* @return The persisten objects iterator
*/
public java.util.Iterator getIterator() {
return super.getIterator(_ownerAdapter);
}
/**
* Add the specified persistent object to ORMSet
* @param value the persistent object
*/
public void add(Tan_subsector value) {
if (value != null) {
super.add(value, value._ormAdapter);
}
}
/**
* Remove the specified persistent object from ORMSet
* @param value the persistent object
*/
public void remove(Tan_subsector value) {
super.remove(value, value._ormAdapter);
}
/**
* Return true if ORMSet contains the specified persistent object
* @param value the persistent object
* @return True if this contains the specified persistent object
*/
public boolean contains(Tan_subsector value) {
return super.contains(value);
}
/**
* Return an array containing all of the persistent objects in ORMSet
* @return The persistent objects array
*/
public Tan_subsector[] toArray() {
return (Tan_subsector[]) super.toArray(new Tan_subsector[size()]);
}
/**
* Return an sorted array containing all of the persistent objects in ORMSet
* @param propertyName Name of the property for sorting:<ul>
* <li>su_id</li>
* <li>su_descripcion</li>
* </ul>
* @return The persistent objects sorted array
*/
public Tan_subsector[] toArray(String propertyName) {
return toArray(propertyName, true);
}
/**
* Return an sorted array containing all of the persistent objects in ORMSet
* @param propertyName Name of the property for sorting:<ul>
* <li>su_id</li>
* <li>su_descripcion</li>
* </ul>
* @param ascending true for ascending, false for descending
* @return The persistent objects sorted array
*/
public Tan_subsector[] toArray(String propertyName, boolean ascending) {
return (Tan_subsector[]) super.toArray(new Tan_subsector[size()], propertyName, ascending);
}
protected PersistentManager getPersistentManager() throws PersistentException {
return orm.BdAnotacionesPersistentManager.instance();
}
}
| Java |
/**
* "Visual Paradigm: DO NOT MODIFY THIS FILE!"
*
* This is an automatic generated file. It will be regenerated every time
* you generate persistence class.
*
* Modifying its content may cause the program not work, or your work may lost.
*/
/**
* Licensee: DuKe TeAm
* License Type: Purchased
*/
package orm;
import org.orm.*;
public class Tan_anotacionSetCollection extends org.orm.util.ORMSet {
public Tan_anotacionSetCollection(Object owner, org.orm.util.ORMAdapter adapter, int ownerKey, int targetKey, int collType) {
super(owner, adapter, ownerKey, targetKey, true, collType);
}
public Tan_anotacionSetCollection(Object owner, org.orm.util.ORMAdapter adapter, int ownerKey, int collType) {
super(owner, adapter, ownerKey, -1, false, collType);
}
/**
* Return an iterator over the persistent objects
* @return The persisten objects iterator
*/
public java.util.Iterator getIterator() {
return super.getIterator(_ownerAdapter);
}
/**
* Add the specified persistent object to ORMSet
* @param value the persistent object
*/
public void add(Tan_anotacion value) {
if (value != null) {
super.add(value, value._ormAdapter);
}
}
/**
* Remove the specified persistent object from ORMSet
* @param value the persistent object
*/
public void remove(Tan_anotacion value) {
super.remove(value, value._ormAdapter);
}
/**
* Return true if ORMSet contains the specified persistent object
* @param value the persistent object
* @return True if this contains the specified persistent object
*/
public boolean contains(Tan_anotacion value) {
return super.contains(value);
}
/**
* Return an array containing all of the persistent objects in ORMSet
* @return The persistent objects array
*/
public Tan_anotacion[] toArray() {
return (Tan_anotacion[]) super.toArray(new Tan_anotacion[size()]);
}
/**
* Return an sorted array containing all of the persistent objects in ORMSet
* @param propertyName Name of the property for sorting:<ul>
* <li>an_id</li>
* <li>an_fecha</li>
* <li>an_descripcion</li>
* </ul>
* @return The persistent objects sorted array
*/
public Tan_anotacion[] toArray(String propertyName) {
return toArray(propertyName, true);
}
/**
* Return an sorted array containing all of the persistent objects in ORMSet
* @param propertyName Name of the property for sorting:<ul>
* <li>an_id</li>
* <li>an_fecha</li>
* <li>an_descripcion</li>
* </ul>
* @param ascending true for ascending, false for descending
* @return The persistent objects sorted array
*/
public Tan_anotacion[] toArray(String propertyName, boolean ascending) {
return (Tan_anotacion[]) super.toArray(new Tan_anotacion[size()], propertyName, ascending);
}
protected PersistentManager getPersistentManager() throws PersistentException {
return orm.BdAnotacionesPersistentManager.instance();
}
}
| Java |
/**
* "Visual Paradigm: DO NOT MODIFY THIS FILE!"
*
* This is an automatic generated file. It will be regenerated every time
* you generate persistence class.
*
* Modifying its content may cause the program not work, or your work may lost.
*/
/**
* Licensee: DuKe TeAm
* License Type: Purchased
*/
package orm.impl;
import org.orm.*;
import org.hibernate.Query;
import java.util.List;
import orm.*;
public class Tan_anotacionDAOImpl implements orm.dao.Tan_anotacionDAO {
public Tan_anotacion loadTan_anotacionByORMID(int an_id) throws PersistentException {
try {
PersistentSession session = orm.BdAnotacionesPersistentManager.instance().getSession();
return loadTan_anotacionByORMID(session, an_id);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_anotacion getTan_anotacionByORMID(int an_id) throws PersistentException {
try {
PersistentSession session = orm.BdAnotacionesPersistentManager.instance().getSession();
return getTan_anotacionByORMID(session, an_id);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_anotacion loadTan_anotacionByORMID(int an_id, org.hibernate.LockMode lockMode) throws PersistentException {
try {
PersistentSession session = orm.BdAnotacionesPersistentManager.instance().getSession();
return loadTan_anotacionByORMID(session, an_id, lockMode);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_anotacion getTan_anotacionByORMID(int an_id, org.hibernate.LockMode lockMode) throws PersistentException {
try {
PersistentSession session = orm.BdAnotacionesPersistentManager.instance().getSession();
return getTan_anotacionByORMID(session, an_id, lockMode);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_anotacion loadTan_anotacionByORMID(PersistentSession session, int an_id) throws PersistentException {
try {
return (Tan_anotacion) session.load(orm.Tan_anotacion.class, new Integer(an_id));
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_anotacion getTan_anotacionByORMID(PersistentSession session, int an_id) throws PersistentException {
try {
return (Tan_anotacion) session.get(orm.Tan_anotacion.class, new Integer(an_id));
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_anotacion loadTan_anotacionByORMID(PersistentSession session, int an_id, org.hibernate.LockMode lockMode) throws PersistentException {
try {
return (Tan_anotacion) session.load(orm.Tan_anotacion.class, new Integer(an_id), lockMode);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_anotacion getTan_anotacionByORMID(PersistentSession session, int an_id, org.hibernate.LockMode lockMode) throws PersistentException {
try {
return (Tan_anotacion) session.get(orm.Tan_anotacion.class, new Integer(an_id), lockMode);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_anotacion[] listTan_anotacionByQuery(String condition, String orderBy) throws PersistentException {
try {
PersistentSession session = orm.BdAnotacionesPersistentManager.instance().getSession();
return listTan_anotacionByQuery(session, condition, orderBy);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_anotacion[] listTan_anotacionByQuery(String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
try {
PersistentSession session = orm.BdAnotacionesPersistentManager.instance().getSession();
return listTan_anotacionByQuery(session, condition, orderBy, lockMode);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_anotacion[] listTan_anotacionByQuery(PersistentSession session, String condition, String orderBy) throws PersistentException {
StringBuffer sb = new StringBuffer("From orm.Tan_anotacion as Tan_anotacion");
if (condition != null)
sb.append(" Where ").append(condition);
if (orderBy != null)
sb.append(" Order By ").append(orderBy);
try {
Query query = session.createQuery(sb.toString());
List list = query.list();
return (Tan_anotacion[]) list.toArray(new Tan_anotacion[list.size()]);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_anotacion[] listTan_anotacionByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
StringBuffer sb = new StringBuffer("From orm.Tan_anotacion as Tan_anotacion");
if (condition != null)
sb.append(" Where ").append(condition);
if (orderBy != null)
sb.append(" Order By ").append(orderBy);
try {
Query query = session.createQuery(sb.toString());
query.setLockMode("this", lockMode);
List list = query.list();
return (Tan_anotacion[]) list.toArray(new Tan_anotacion[list.size()]);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_anotacion loadTan_anotacionByQuery(String condition, String orderBy) throws PersistentException {
try {
PersistentSession session = orm.BdAnotacionesPersistentManager.instance().getSession();
return loadTan_anotacionByQuery(session, condition, orderBy);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_anotacion loadTan_anotacionByQuery(String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
try {
PersistentSession session = orm.BdAnotacionesPersistentManager.instance().getSession();
return loadTan_anotacionByQuery(session, condition, orderBy, lockMode);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_anotacion loadTan_anotacionByQuery(PersistentSession session, String condition, String orderBy) throws PersistentException {
Tan_anotacion[] tan_anotacions = listTan_anotacionByQuery(session, condition, orderBy);
if (tan_anotacions != null && tan_anotacions.length > 0)
return tan_anotacions[0];
else
return null;
}
public Tan_anotacion loadTan_anotacionByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
Tan_anotacion[] tan_anotacions = listTan_anotacionByQuery(session, condition, orderBy, lockMode);
if (tan_anotacions != null && tan_anotacions.length > 0)
return tan_anotacions[0];
else
return null;
}
public static java.util.Iterator iterateTan_anotacionByQuery(String condition, String orderBy) throws PersistentException {
try {
PersistentSession session = orm.BdAnotacionesPersistentManager.instance().getSession();
return iterateTan_anotacionByQuery(session, condition, orderBy);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public static java.util.Iterator iterateTan_anotacionByQuery(String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
try {
PersistentSession session = orm.BdAnotacionesPersistentManager.instance().getSession();
return iterateTan_anotacionByQuery(session, condition, orderBy, lockMode);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public static java.util.Iterator iterateTan_anotacionByQuery(PersistentSession session, String condition, String orderBy) throws PersistentException {
StringBuffer sb = new StringBuffer("From orm.Tan_anotacion as Tan_anotacion");
if (condition != null)
sb.append(" Where ").append(condition);
if (orderBy != null)
sb.append(" Order By ").append(orderBy);
try {
Query query = session.createQuery(sb.toString());
return query.iterate();
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public static java.util.Iterator iterateTan_anotacionByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
StringBuffer sb = new StringBuffer("From orm.Tan_anotacion as Tan_anotacion");
if (condition != null)
sb.append(" Where ").append(condition);
if (orderBy != null)
sb.append(" Order By ").append(orderBy);
try {
Query query = session.createQuery(sb.toString());
query.setLockMode("this", lockMode);
return query.iterate();
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_anotacion createTan_anotacion() {
return new orm.Tan_anotacion();
}
public boolean save(orm.Tan_anotacion tan_anotacion) throws PersistentException {
try {
orm.BdAnotacionesPersistentManager.instance().saveObject(tan_anotacion);
return true;
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public boolean delete(orm.Tan_anotacion tan_anotacion) throws PersistentException {
try {
orm.BdAnotacionesPersistentManager.instance().deleteObject(tan_anotacion);
return true;
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public boolean deleteAndDissociate(orm.Tan_anotacion tan_anotacion)throws PersistentException {
try {
if(tan_anotacion.getTan_anotadoran() != null) {
tan_anotacion.getTan_anotadoran().tan_anotacion.remove(tan_anotacion);
}
if(tan_anotacion.getTan_tipo_anotacionta() != null) {
tan_anotacion.getTan_tipo_anotacionta().tan_anotacion.remove(tan_anotacion);
}
if(tan_anotacion.getTan_alumnoal() != null) {
tan_anotacion.getTan_alumnoal().tan_anotacion.remove(tan_anotacion);
}
return delete(tan_anotacion);
}
catch(Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public boolean deleteAndDissociate(orm.Tan_anotacion tan_anotacion, org.orm.PersistentSession session)throws PersistentException {
try {
if(tan_anotacion.getTan_anotadoran() != null) {
tan_anotacion.getTan_anotadoran().tan_anotacion.remove(tan_anotacion);
}
if(tan_anotacion.getTan_tipo_anotacionta() != null) {
tan_anotacion.getTan_tipo_anotacionta().tan_anotacion.remove(tan_anotacion);
}
if(tan_anotacion.getTan_alumnoal() != null) {
tan_anotacion.getTan_alumnoal().tan_anotacion.remove(tan_anotacion);
}
try {
session.delete(tan_anotacion);
return true;
} catch (Exception e) {
return false;
}
}
catch(Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public boolean refresh(orm.Tan_anotacion tan_anotacion) throws PersistentException {
try {
orm.BdAnotacionesPersistentManager.instance().getSession().refresh(tan_anotacion);
return true;
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public boolean evict(orm.Tan_anotacion tan_anotacion) throws PersistentException {
try {
orm.BdAnotacionesPersistentManager.instance().getSession().evict(tan_anotacion);
return true;
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_anotacion loadTan_anotacionByCriteria(Tan_anotacionCriteria tan_anotacionCriteria) {
Tan_anotacion[] tan_anotacions = listTan_anotacionByCriteria(tan_anotacionCriteria);
if(tan_anotacions == null || tan_anotacions.length == 0) {
return null;
}
return tan_anotacions[0];
}
public Tan_anotacion[] listTan_anotacionByCriteria(Tan_anotacionCriteria tan_anotacionCriteria) {
return tan_anotacionCriteria.listTan_anotacion();
}
}
| Java |
/**
* "Visual Paradigm: DO NOT MODIFY THIS FILE!"
*
* This is an automatic generated file. It will be regenerated every time
* you generate persistence class.
*
* Modifying its content may cause the program not work, or your work may lost.
*/
/**
* Licensee: DuKe TeAm
* License Type: Purchased
*/
package orm.impl;
import org.orm.*;
import org.hibernate.Query;
import java.util.List;
import orm.*;
public class Tan_anotadorDAOImpl implements orm.dao.Tan_anotadorDAO {
public Tan_anotador loadTan_anotadorByORMID(int an_id) throws PersistentException {
try {
PersistentSession session = orm.BdAnotacionesPersistentManager.instance().getSession();
return loadTan_anotadorByORMID(session, an_id);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_anotador getTan_anotadorByORMID(int an_id) throws PersistentException {
try {
PersistentSession session = orm.BdAnotacionesPersistentManager.instance().getSession();
return getTan_anotadorByORMID(session, an_id);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_anotador loadTan_anotadorByORMID(int an_id, org.hibernate.LockMode lockMode) throws PersistentException {
try {
PersistentSession session = orm.BdAnotacionesPersistentManager.instance().getSession();
return loadTan_anotadorByORMID(session, an_id, lockMode);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_anotador getTan_anotadorByORMID(int an_id, org.hibernate.LockMode lockMode) throws PersistentException {
try {
PersistentSession session = orm.BdAnotacionesPersistentManager.instance().getSession();
return getTan_anotadorByORMID(session, an_id, lockMode);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_anotador loadTan_anotadorByORMID(PersistentSession session, int an_id) throws PersistentException {
try {
return (Tan_anotador) session.load(orm.Tan_anotador.class, new Integer(an_id));
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_anotador getTan_anotadorByORMID(PersistentSession session, int an_id) throws PersistentException {
try {
return (Tan_anotador) session.get(orm.Tan_anotador.class, new Integer(an_id));
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_anotador loadTan_anotadorByORMID(PersistentSession session, int an_id, org.hibernate.LockMode lockMode) throws PersistentException {
try {
return (Tan_anotador) session.load(orm.Tan_anotador.class, new Integer(an_id), lockMode);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_anotador getTan_anotadorByORMID(PersistentSession session, int an_id, org.hibernate.LockMode lockMode) throws PersistentException {
try {
return (Tan_anotador) session.get(orm.Tan_anotador.class, new Integer(an_id), lockMode);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_anotador[] listTan_anotadorByQuery(String condition, String orderBy) throws PersistentException {
try {
PersistentSession session = orm.BdAnotacionesPersistentManager.instance().getSession();
return listTan_anotadorByQuery(session, condition, orderBy);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_anotador[] listTan_anotadorByQuery(String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
try {
PersistentSession session = orm.BdAnotacionesPersistentManager.instance().getSession();
return listTan_anotadorByQuery(session, condition, orderBy, lockMode);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_anotador[] listTan_anotadorByQuery(PersistentSession session, String condition, String orderBy) throws PersistentException {
StringBuffer sb = new StringBuffer("From orm.Tan_anotador as Tan_anotador");
if (condition != null)
sb.append(" Where ").append(condition);
if (orderBy != null)
sb.append(" Order By ").append(orderBy);
try {
Query query = session.createQuery(sb.toString());
List list = query.list();
return (Tan_anotador[]) list.toArray(new Tan_anotador[list.size()]);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_anotador[] listTan_anotadorByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
StringBuffer sb = new StringBuffer("From orm.Tan_anotador as Tan_anotador");
if (condition != null)
sb.append(" Where ").append(condition);
if (orderBy != null)
sb.append(" Order By ").append(orderBy);
try {
Query query = session.createQuery(sb.toString());
query.setLockMode("this", lockMode);
List list = query.list();
return (Tan_anotador[]) list.toArray(new Tan_anotador[list.size()]);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_anotador loadTan_anotadorByQuery(String condition, String orderBy) throws PersistentException {
try {
PersistentSession session = orm.BdAnotacionesPersistentManager.instance().getSession();
return loadTan_anotadorByQuery(session, condition, orderBy);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_anotador loadTan_anotadorByQuery(String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
try {
PersistentSession session = orm.BdAnotacionesPersistentManager.instance().getSession();
return loadTan_anotadorByQuery(session, condition, orderBy, lockMode);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_anotador loadTan_anotadorByQuery(PersistentSession session, String condition, String orderBy) throws PersistentException {
Tan_anotador[] tan_anotadors = listTan_anotadorByQuery(session, condition, orderBy);
if (tan_anotadors != null && tan_anotadors.length > 0)
return tan_anotadors[0];
else
return null;
}
public Tan_anotador loadTan_anotadorByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
Tan_anotador[] tan_anotadors = listTan_anotadorByQuery(session, condition, orderBy, lockMode);
if (tan_anotadors != null && tan_anotadors.length > 0)
return tan_anotadors[0];
else
return null;
}
public static java.util.Iterator iterateTan_anotadorByQuery(String condition, String orderBy) throws PersistentException {
try {
PersistentSession session = orm.BdAnotacionesPersistentManager.instance().getSession();
return iterateTan_anotadorByQuery(session, condition, orderBy);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public static java.util.Iterator iterateTan_anotadorByQuery(String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
try {
PersistentSession session = orm.BdAnotacionesPersistentManager.instance().getSession();
return iterateTan_anotadorByQuery(session, condition, orderBy, lockMode);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public static java.util.Iterator iterateTan_anotadorByQuery(PersistentSession session, String condition, String orderBy) throws PersistentException {
StringBuffer sb = new StringBuffer("From orm.Tan_anotador as Tan_anotador");
if (condition != null)
sb.append(" Where ").append(condition);
if (orderBy != null)
sb.append(" Order By ").append(orderBy);
try {
Query query = session.createQuery(sb.toString());
return query.iterate();
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public static java.util.Iterator iterateTan_anotadorByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
StringBuffer sb = new StringBuffer("From orm.Tan_anotador as Tan_anotador");
if (condition != null)
sb.append(" Where ").append(condition);
if (orderBy != null)
sb.append(" Order By ").append(orderBy);
try {
Query query = session.createQuery(sb.toString());
query.setLockMode("this", lockMode);
return query.iterate();
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_anotador createTan_anotador() {
return new orm.Tan_anotador();
}
public boolean save(orm.Tan_anotador tan_anotador) throws PersistentException {
try {
orm.BdAnotacionesPersistentManager.instance().saveObject(tan_anotador);
return true;
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public boolean delete(orm.Tan_anotador tan_anotador) throws PersistentException {
try {
orm.BdAnotacionesPersistentManager.instance().deleteObject(tan_anotador);
return true;
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public boolean deleteAndDissociate(orm.Tan_anotador tan_anotador)throws PersistentException {
try {
orm.Tan_anotacion[] lTan_anotacions = tan_anotador.tan_anotacion.toArray();
for(int i = 0; i < lTan_anotacions.length; i++) {
lTan_anotacions[i].setTan_anotadoran(null);
}
return delete(tan_anotador);
}
catch(Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public boolean deleteAndDissociate(orm.Tan_anotador tan_anotador, org.orm.PersistentSession session)throws PersistentException {
try {
orm.Tan_anotacion[] lTan_anotacions = tan_anotador.tan_anotacion.toArray();
for(int i = 0; i < lTan_anotacions.length; i++) {
lTan_anotacions[i].setTan_anotadoran(null);
}
try {
session.delete(tan_anotador);
return true;
} catch (Exception e) {
return false;
}
}
catch(Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public boolean refresh(orm.Tan_anotador tan_anotador) throws PersistentException {
try {
orm.BdAnotacionesPersistentManager.instance().getSession().refresh(tan_anotador);
return true;
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public boolean evict(orm.Tan_anotador tan_anotador) throws PersistentException {
try {
orm.BdAnotacionesPersistentManager.instance().getSession().evict(tan_anotador);
return true;
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_anotador loadTan_anotadorByCriteria(Tan_anotadorCriteria tan_anotadorCriteria) {
Tan_anotador[] tan_anotadors = listTan_anotadorByCriteria(tan_anotadorCriteria);
if(tan_anotadors == null || tan_anotadors.length == 0) {
return null;
}
return tan_anotadors[0];
}
public Tan_anotador[] listTan_anotadorByCriteria(Tan_anotadorCriteria tan_anotadorCriteria) {
return tan_anotadorCriteria.listTan_anotador();
}
}
| Java |
/**
* "Visual Paradigm: DO NOT MODIFY THIS FILE!"
*
* This is an automatic generated file. It will be regenerated every time
* you generate persistence class.
*
* Modifying its content may cause the program not work, or your work may lost.
*/
/**
* Licensee: DuKe TeAm
* License Type: Purchased
*/
package orm.impl;
import org.orm.*;
import org.hibernate.Query;
import java.util.List;
import orm.*;
public class Tan_subsectorDAOImpl implements orm.dao.Tan_subsectorDAO {
public Tan_subsector loadTan_subsectorByORMID(int su_id) throws PersistentException {
try {
PersistentSession session = orm.BdAnotacionesPersistentManager.instance().getSession();
return loadTan_subsectorByORMID(session, su_id);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_subsector getTan_subsectorByORMID(int su_id) throws PersistentException {
try {
PersistentSession session = orm.BdAnotacionesPersistentManager.instance().getSession();
return getTan_subsectorByORMID(session, su_id);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_subsector loadTan_subsectorByORMID(int su_id, org.hibernate.LockMode lockMode) throws PersistentException {
try {
PersistentSession session = orm.BdAnotacionesPersistentManager.instance().getSession();
return loadTan_subsectorByORMID(session, su_id, lockMode);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_subsector getTan_subsectorByORMID(int su_id, org.hibernate.LockMode lockMode) throws PersistentException {
try {
PersistentSession session = orm.BdAnotacionesPersistentManager.instance().getSession();
return getTan_subsectorByORMID(session, su_id, lockMode);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_subsector loadTan_subsectorByORMID(PersistentSession session, int su_id) throws PersistentException {
try {
return (Tan_subsector) session.load(orm.Tan_subsector.class, new Integer(su_id));
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_subsector getTan_subsectorByORMID(PersistentSession session, int su_id) throws PersistentException {
try {
return (Tan_subsector) session.get(orm.Tan_subsector.class, new Integer(su_id));
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_subsector loadTan_subsectorByORMID(PersistentSession session, int su_id, org.hibernate.LockMode lockMode) throws PersistentException {
try {
return (Tan_subsector) session.load(orm.Tan_subsector.class, new Integer(su_id), lockMode);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_subsector getTan_subsectorByORMID(PersistentSession session, int su_id, org.hibernate.LockMode lockMode) throws PersistentException {
try {
return (Tan_subsector) session.get(orm.Tan_subsector.class, new Integer(su_id), lockMode);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_subsector[] listTan_subsectorByQuery(String condition, String orderBy) throws PersistentException {
try {
PersistentSession session = orm.BdAnotacionesPersistentManager.instance().getSession();
return listTan_subsectorByQuery(session, condition, orderBy);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_subsector[] listTan_subsectorByQuery(String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
try {
PersistentSession session = orm.BdAnotacionesPersistentManager.instance().getSession();
return listTan_subsectorByQuery(session, condition, orderBy, lockMode);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_subsector[] listTan_subsectorByQuery(PersistentSession session, String condition, String orderBy) throws PersistentException {
StringBuffer sb = new StringBuffer("From orm.Tan_subsector as Tan_subsector");
if (condition != null)
sb.append(" Where ").append(condition);
if (orderBy != null)
sb.append(" Order By ").append(orderBy);
try {
Query query = session.createQuery(sb.toString());
List list = query.list();
return (Tan_subsector[]) list.toArray(new Tan_subsector[list.size()]);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_subsector[] listTan_subsectorByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
StringBuffer sb = new StringBuffer("From orm.Tan_subsector as Tan_subsector");
if (condition != null)
sb.append(" Where ").append(condition);
if (orderBy != null)
sb.append(" Order By ").append(orderBy);
try {
Query query = session.createQuery(sb.toString());
query.setLockMode("this", lockMode);
List list = query.list();
return (Tan_subsector[]) list.toArray(new Tan_subsector[list.size()]);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_subsector loadTan_subsectorByQuery(String condition, String orderBy) throws PersistentException {
try {
PersistentSession session = orm.BdAnotacionesPersistentManager.instance().getSession();
return loadTan_subsectorByQuery(session, condition, orderBy);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_subsector loadTan_subsectorByQuery(String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
try {
PersistentSession session = orm.BdAnotacionesPersistentManager.instance().getSession();
return loadTan_subsectorByQuery(session, condition, orderBy, lockMode);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_subsector loadTan_subsectorByQuery(PersistentSession session, String condition, String orderBy) throws PersistentException {
Tan_subsector[] tan_subsectors = listTan_subsectorByQuery(session, condition, orderBy);
if (tan_subsectors != null && tan_subsectors.length > 0)
return tan_subsectors[0];
else
return null;
}
public Tan_subsector loadTan_subsectorByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
Tan_subsector[] tan_subsectors = listTan_subsectorByQuery(session, condition, orderBy, lockMode);
if (tan_subsectors != null && tan_subsectors.length > 0)
return tan_subsectors[0];
else
return null;
}
public static java.util.Iterator iterateTan_subsectorByQuery(String condition, String orderBy) throws PersistentException {
try {
PersistentSession session = orm.BdAnotacionesPersistentManager.instance().getSession();
return iterateTan_subsectorByQuery(session, condition, orderBy);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public static java.util.Iterator iterateTan_subsectorByQuery(String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
try {
PersistentSession session = orm.BdAnotacionesPersistentManager.instance().getSession();
return iterateTan_subsectorByQuery(session, condition, orderBy, lockMode);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public static java.util.Iterator iterateTan_subsectorByQuery(PersistentSession session, String condition, String orderBy) throws PersistentException {
StringBuffer sb = new StringBuffer("From orm.Tan_subsector as Tan_subsector");
if (condition != null)
sb.append(" Where ").append(condition);
if (orderBy != null)
sb.append(" Order By ").append(orderBy);
try {
Query query = session.createQuery(sb.toString());
return query.iterate();
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public static java.util.Iterator iterateTan_subsectorByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
StringBuffer sb = new StringBuffer("From orm.Tan_subsector as Tan_subsector");
if (condition != null)
sb.append(" Where ").append(condition);
if (orderBy != null)
sb.append(" Order By ").append(orderBy);
try {
Query query = session.createQuery(sb.toString());
query.setLockMode("this", lockMode);
return query.iterate();
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_subsector createTan_subsector() {
return new orm.Tan_subsector();
}
public boolean save(orm.Tan_subsector tan_subsector) throws PersistentException {
try {
orm.BdAnotacionesPersistentManager.instance().saveObject(tan_subsector);
return true;
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public boolean delete(orm.Tan_subsector tan_subsector) throws PersistentException {
try {
orm.BdAnotacionesPersistentManager.instance().deleteObject(tan_subsector);
return true;
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public boolean deleteAndDissociate(orm.Tan_subsector tan_subsector)throws PersistentException {
try {
if(tan_subsector.getTan_cursocu() != null) {
tan_subsector.getTan_cursocu().tan_subsector.remove(tan_subsector);
}
return delete(tan_subsector);
}
catch(Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public boolean deleteAndDissociate(orm.Tan_subsector tan_subsector, org.orm.PersistentSession session)throws PersistentException {
try {
if(tan_subsector.getTan_cursocu() != null) {
tan_subsector.getTan_cursocu().tan_subsector.remove(tan_subsector);
}
try {
session.delete(tan_subsector);
return true;
} catch (Exception e) {
return false;
}
}
catch(Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public boolean refresh(orm.Tan_subsector tan_subsector) throws PersistentException {
try {
orm.BdAnotacionesPersistentManager.instance().getSession().refresh(tan_subsector);
return true;
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public boolean evict(orm.Tan_subsector tan_subsector) throws PersistentException {
try {
orm.BdAnotacionesPersistentManager.instance().getSession().evict(tan_subsector);
return true;
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_subsector loadTan_subsectorByCriteria(Tan_subsectorCriteria tan_subsectorCriteria) {
Tan_subsector[] tan_subsectors = listTan_subsectorByCriteria(tan_subsectorCriteria);
if(tan_subsectors == null || tan_subsectors.length == 0) {
return null;
}
return tan_subsectors[0];
}
public Tan_subsector[] listTan_subsectorByCriteria(Tan_subsectorCriteria tan_subsectorCriteria) {
return tan_subsectorCriteria.listTan_subsector();
}
}
| Java |
/**
* "Visual Paradigm: DO NOT MODIFY THIS FILE!"
*
* This is an automatic generated file. It will be regenerated every time
* you generate persistence class.
*
* Modifying its content may cause the program not work, or your work may lost.
*/
/**
* Licensee: DuKe TeAm
* License Type: Purchased
*/
package orm.impl;
import org.orm.*;
import org.hibernate.Query;
import java.util.List;
import orm.*;
public class Tan_tipo_anotacionDAOImpl implements orm.dao.Tan_tipo_anotacionDAO {
public Tan_tipo_anotacion loadTan_tipo_anotacionByORMID(int ta_id) throws PersistentException {
try {
PersistentSession session = orm.BdAnotacionesPersistentManager.instance().getSession();
return loadTan_tipo_anotacionByORMID(session, ta_id);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_tipo_anotacion getTan_tipo_anotacionByORMID(int ta_id) throws PersistentException {
try {
PersistentSession session = orm.BdAnotacionesPersistentManager.instance().getSession();
return getTan_tipo_anotacionByORMID(session, ta_id);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_tipo_anotacion loadTan_tipo_anotacionByORMID(int ta_id, org.hibernate.LockMode lockMode) throws PersistentException {
try {
PersistentSession session = orm.BdAnotacionesPersistentManager.instance().getSession();
return loadTan_tipo_anotacionByORMID(session, ta_id, lockMode);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_tipo_anotacion getTan_tipo_anotacionByORMID(int ta_id, org.hibernate.LockMode lockMode) throws PersistentException {
try {
PersistentSession session = orm.BdAnotacionesPersistentManager.instance().getSession();
return getTan_tipo_anotacionByORMID(session, ta_id, lockMode);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_tipo_anotacion loadTan_tipo_anotacionByORMID(PersistentSession session, int ta_id) throws PersistentException {
try {
return (Tan_tipo_anotacion) session.load(orm.Tan_tipo_anotacion.class, new Integer(ta_id));
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_tipo_anotacion getTan_tipo_anotacionByORMID(PersistentSession session, int ta_id) throws PersistentException {
try {
return (Tan_tipo_anotacion) session.get(orm.Tan_tipo_anotacion.class, new Integer(ta_id));
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_tipo_anotacion loadTan_tipo_anotacionByORMID(PersistentSession session, int ta_id, org.hibernate.LockMode lockMode) throws PersistentException {
try {
return (Tan_tipo_anotacion) session.load(orm.Tan_tipo_anotacion.class, new Integer(ta_id), lockMode);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_tipo_anotacion getTan_tipo_anotacionByORMID(PersistentSession session, int ta_id, org.hibernate.LockMode lockMode) throws PersistentException {
try {
return (Tan_tipo_anotacion) session.get(orm.Tan_tipo_anotacion.class, new Integer(ta_id), lockMode);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_tipo_anotacion[] listTan_tipo_anotacionByQuery(String condition, String orderBy) throws PersistentException {
try {
PersistentSession session = orm.BdAnotacionesPersistentManager.instance().getSession();
return listTan_tipo_anotacionByQuery(session, condition, orderBy);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_tipo_anotacion[] listTan_tipo_anotacionByQuery(String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
try {
PersistentSession session = orm.BdAnotacionesPersistentManager.instance().getSession();
return listTan_tipo_anotacionByQuery(session, condition, orderBy, lockMode);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_tipo_anotacion[] listTan_tipo_anotacionByQuery(PersistentSession session, String condition, String orderBy) throws PersistentException {
StringBuffer sb = new StringBuffer("From orm.Tan_tipo_anotacion as Tan_tipo_anotacion");
if (condition != null)
sb.append(" Where ").append(condition);
if (orderBy != null)
sb.append(" Order By ").append(orderBy);
try {
Query query = session.createQuery(sb.toString());
List list = query.list();
return (Tan_tipo_anotacion[]) list.toArray(new Tan_tipo_anotacion[list.size()]);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_tipo_anotacion[] listTan_tipo_anotacionByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
StringBuffer sb = new StringBuffer("From orm.Tan_tipo_anotacion as Tan_tipo_anotacion");
if (condition != null)
sb.append(" Where ").append(condition);
if (orderBy != null)
sb.append(" Order By ").append(orderBy);
try {
Query query = session.createQuery(sb.toString());
query.setLockMode("this", lockMode);
List list = query.list();
return (Tan_tipo_anotacion[]) list.toArray(new Tan_tipo_anotacion[list.size()]);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_tipo_anotacion loadTan_tipo_anotacionByQuery(String condition, String orderBy) throws PersistentException {
try {
PersistentSession session = orm.BdAnotacionesPersistentManager.instance().getSession();
return loadTan_tipo_anotacionByQuery(session, condition, orderBy);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_tipo_anotacion loadTan_tipo_anotacionByQuery(String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
try {
PersistentSession session = orm.BdAnotacionesPersistentManager.instance().getSession();
return loadTan_tipo_anotacionByQuery(session, condition, orderBy, lockMode);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_tipo_anotacion loadTan_tipo_anotacionByQuery(PersistentSession session, String condition, String orderBy) throws PersistentException {
Tan_tipo_anotacion[] tan_tipo_anotacions = listTan_tipo_anotacionByQuery(session, condition, orderBy);
if (tan_tipo_anotacions != null && tan_tipo_anotacions.length > 0)
return tan_tipo_anotacions[0];
else
return null;
}
public Tan_tipo_anotacion loadTan_tipo_anotacionByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
Tan_tipo_anotacion[] tan_tipo_anotacions = listTan_tipo_anotacionByQuery(session, condition, orderBy, lockMode);
if (tan_tipo_anotacions != null && tan_tipo_anotacions.length > 0)
return tan_tipo_anotacions[0];
else
return null;
}
public static java.util.Iterator iterateTan_tipo_anotacionByQuery(String condition, String orderBy) throws PersistentException {
try {
PersistentSession session = orm.BdAnotacionesPersistentManager.instance().getSession();
return iterateTan_tipo_anotacionByQuery(session, condition, orderBy);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public static java.util.Iterator iterateTan_tipo_anotacionByQuery(String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
try {
PersistentSession session = orm.BdAnotacionesPersistentManager.instance().getSession();
return iterateTan_tipo_anotacionByQuery(session, condition, orderBy, lockMode);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public static java.util.Iterator iterateTan_tipo_anotacionByQuery(PersistentSession session, String condition, String orderBy) throws PersistentException {
StringBuffer sb = new StringBuffer("From orm.Tan_tipo_anotacion as Tan_tipo_anotacion");
if (condition != null)
sb.append(" Where ").append(condition);
if (orderBy != null)
sb.append(" Order By ").append(orderBy);
try {
Query query = session.createQuery(sb.toString());
return query.iterate();
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public static java.util.Iterator iterateTan_tipo_anotacionByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
StringBuffer sb = new StringBuffer("From orm.Tan_tipo_anotacion as Tan_tipo_anotacion");
if (condition != null)
sb.append(" Where ").append(condition);
if (orderBy != null)
sb.append(" Order By ").append(orderBy);
try {
Query query = session.createQuery(sb.toString());
query.setLockMode("this", lockMode);
return query.iterate();
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_tipo_anotacion createTan_tipo_anotacion() {
return new orm.Tan_tipo_anotacion();
}
public boolean save(orm.Tan_tipo_anotacion tan_tipo_anotacion) throws PersistentException {
try {
orm.BdAnotacionesPersistentManager.instance().saveObject(tan_tipo_anotacion);
return true;
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public boolean delete(orm.Tan_tipo_anotacion tan_tipo_anotacion) throws PersistentException {
try {
orm.BdAnotacionesPersistentManager.instance().deleteObject(tan_tipo_anotacion);
return true;
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public boolean deleteAndDissociate(orm.Tan_tipo_anotacion tan_tipo_anotacion)throws PersistentException {
try {
orm.Tan_anotacion[] lTan_anotacions = tan_tipo_anotacion.tan_anotacion.toArray();
for(int i = 0; i < lTan_anotacions.length; i++) {
lTan_anotacions[i].setTan_tipo_anotacionta(null);
}
return delete(tan_tipo_anotacion);
}
catch(Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public boolean deleteAndDissociate(orm.Tan_tipo_anotacion tan_tipo_anotacion, org.orm.PersistentSession session)throws PersistentException {
try {
orm.Tan_anotacion[] lTan_anotacions = tan_tipo_anotacion.tan_anotacion.toArray();
for(int i = 0; i < lTan_anotacions.length; i++) {
lTan_anotacions[i].setTan_tipo_anotacionta(null);
}
try {
session.delete(tan_tipo_anotacion);
return true;
} catch (Exception e) {
return false;
}
}
catch(Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public boolean refresh(orm.Tan_tipo_anotacion tan_tipo_anotacion) throws PersistentException {
try {
orm.BdAnotacionesPersistentManager.instance().getSession().refresh(tan_tipo_anotacion);
return true;
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public boolean evict(orm.Tan_tipo_anotacion tan_tipo_anotacion) throws PersistentException {
try {
orm.BdAnotacionesPersistentManager.instance().getSession().evict(tan_tipo_anotacion);
return true;
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_tipo_anotacion loadTan_tipo_anotacionByCriteria(Tan_tipo_anotacionCriteria tan_tipo_anotacionCriteria) {
Tan_tipo_anotacion[] tan_tipo_anotacions = listTan_tipo_anotacionByCriteria(tan_tipo_anotacionCriteria);
if(tan_tipo_anotacions == null || tan_tipo_anotacions.length == 0) {
return null;
}
return tan_tipo_anotacions[0];
}
public Tan_tipo_anotacion[] listTan_tipo_anotacionByCriteria(Tan_tipo_anotacionCriteria tan_tipo_anotacionCriteria) {
return tan_tipo_anotacionCriteria.listTan_tipo_anotacion();
}
}
| Java |
/**
* "Visual Paradigm: DO NOT MODIFY THIS FILE!"
*
* This is an automatic generated file. It will be regenerated every time
* you generate persistence class.
*
* Modifying its content may cause the program not work, or your work may lost.
*/
/**
* Licensee: DuKe TeAm
* License Type: Purchased
*/
package orm.impl;
import org.orm.*;
import org.hibernate.Query;
import java.util.List;
import orm.*;
public class Tan_cursoDAOImpl implements orm.dao.Tan_cursoDAO {
public Tan_curso loadTan_cursoByORMID(int cu_id) throws PersistentException {
try {
PersistentSession session = orm.BdAnotacionesPersistentManager.instance().getSession();
return loadTan_cursoByORMID(session, cu_id);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_curso getTan_cursoByORMID(int cu_id) throws PersistentException {
try {
PersistentSession session = orm.BdAnotacionesPersistentManager.instance().getSession();
return getTan_cursoByORMID(session, cu_id);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_curso loadTan_cursoByORMID(int cu_id, org.hibernate.LockMode lockMode) throws PersistentException {
try {
PersistentSession session = orm.BdAnotacionesPersistentManager.instance().getSession();
return loadTan_cursoByORMID(session, cu_id, lockMode);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_curso getTan_cursoByORMID(int cu_id, org.hibernate.LockMode lockMode) throws PersistentException {
try {
PersistentSession session = orm.BdAnotacionesPersistentManager.instance().getSession();
return getTan_cursoByORMID(session, cu_id, lockMode);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_curso loadTan_cursoByORMID(PersistentSession session, int cu_id) throws PersistentException {
try {
return (Tan_curso) session.load(orm.Tan_curso.class, new Integer(cu_id));
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_curso getTan_cursoByORMID(PersistentSession session, int cu_id) throws PersistentException {
try {
return (Tan_curso) session.get(orm.Tan_curso.class, new Integer(cu_id));
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_curso loadTan_cursoByORMID(PersistentSession session, int cu_id, org.hibernate.LockMode lockMode) throws PersistentException {
try {
return (Tan_curso) session.load(orm.Tan_curso.class, new Integer(cu_id), lockMode);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_curso getTan_cursoByORMID(PersistentSession session, int cu_id, org.hibernate.LockMode lockMode) throws PersistentException {
try {
return (Tan_curso) session.get(orm.Tan_curso.class, new Integer(cu_id), lockMode);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_curso[] listTan_cursoByQuery(String condition, String orderBy) throws PersistentException {
try {
PersistentSession session = orm.BdAnotacionesPersistentManager.instance().getSession();
return listTan_cursoByQuery(session, condition, orderBy);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_curso[] listTan_cursoByQuery(String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
try {
PersistentSession session = orm.BdAnotacionesPersistentManager.instance().getSession();
return listTan_cursoByQuery(session, condition, orderBy, lockMode);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_curso[] listTan_cursoByQuery(PersistentSession session, String condition, String orderBy) throws PersistentException {
StringBuffer sb = new StringBuffer("From orm.Tan_curso as Tan_curso");
if (condition != null)
sb.append(" Where ").append(condition);
if (orderBy != null)
sb.append(" Order By ").append(orderBy);
try {
Query query = session.createQuery(sb.toString());
List list = query.list();
return (Tan_curso[]) list.toArray(new Tan_curso[list.size()]);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_curso[] listTan_cursoByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
StringBuffer sb = new StringBuffer("From orm.Tan_curso as Tan_curso");
if (condition != null)
sb.append(" Where ").append(condition);
if (orderBy != null)
sb.append(" Order By ").append(orderBy);
try {
Query query = session.createQuery(sb.toString());
query.setLockMode("this", lockMode);
List list = query.list();
return (Tan_curso[]) list.toArray(new Tan_curso[list.size()]);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_curso loadTan_cursoByQuery(String condition, String orderBy) throws PersistentException {
try {
PersistentSession session = orm.BdAnotacionesPersistentManager.instance().getSession();
return loadTan_cursoByQuery(session, condition, orderBy);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_curso loadTan_cursoByQuery(String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
try {
PersistentSession session = orm.BdAnotacionesPersistentManager.instance().getSession();
return loadTan_cursoByQuery(session, condition, orderBy, lockMode);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_curso loadTan_cursoByQuery(PersistentSession session, String condition, String orderBy) throws PersistentException {
Tan_curso[] tan_cursos = listTan_cursoByQuery(session, condition, orderBy);
if (tan_cursos != null && tan_cursos.length > 0)
return tan_cursos[0];
else
return null;
}
public Tan_curso loadTan_cursoByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
Tan_curso[] tan_cursos = listTan_cursoByQuery(session, condition, orderBy, lockMode);
if (tan_cursos != null && tan_cursos.length > 0)
return tan_cursos[0];
else
return null;
}
public static java.util.Iterator iterateTan_cursoByQuery(String condition, String orderBy) throws PersistentException {
try {
PersistentSession session = orm.BdAnotacionesPersistentManager.instance().getSession();
return iterateTan_cursoByQuery(session, condition, orderBy);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public static java.util.Iterator iterateTan_cursoByQuery(String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
try {
PersistentSession session = orm.BdAnotacionesPersistentManager.instance().getSession();
return iterateTan_cursoByQuery(session, condition, orderBy, lockMode);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public static java.util.Iterator iterateTan_cursoByQuery(PersistentSession session, String condition, String orderBy) throws PersistentException {
StringBuffer sb = new StringBuffer("From orm.Tan_curso as Tan_curso");
if (condition != null)
sb.append(" Where ").append(condition);
if (orderBy != null)
sb.append(" Order By ").append(orderBy);
try {
Query query = session.createQuery(sb.toString());
return query.iterate();
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public static java.util.Iterator iterateTan_cursoByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
StringBuffer sb = new StringBuffer("From orm.Tan_curso as Tan_curso");
if (condition != null)
sb.append(" Where ").append(condition);
if (orderBy != null)
sb.append(" Order By ").append(orderBy);
try {
Query query = session.createQuery(sb.toString());
query.setLockMode("this", lockMode);
return query.iterate();
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_curso createTan_curso() {
return new orm.Tan_curso();
}
public boolean save(orm.Tan_curso tan_curso) throws PersistentException {
try {
orm.BdAnotacionesPersistentManager.instance().saveObject(tan_curso);
return true;
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public boolean delete(orm.Tan_curso tan_curso) throws PersistentException {
try {
orm.BdAnotacionesPersistentManager.instance().deleteObject(tan_curso);
return true;
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public boolean deleteAndDissociate(orm.Tan_curso tan_curso)throws PersistentException {
try {
orm.Tan_subsector[] lTan_subsectors = tan_curso.tan_subsector.toArray();
for(int i = 0; i < lTan_subsectors.length; i++) {
lTan_subsectors[i].setTan_cursocu(null);
}
orm.Tan_alumno[] lTan_alumnos = tan_curso.tan_alumno.toArray();
for(int i = 0; i < lTan_alumnos.length; i++) {
lTan_alumnos[i].setTan_cursocu(null);
}
return delete(tan_curso);
}
catch(Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public boolean deleteAndDissociate(orm.Tan_curso tan_curso, org.orm.PersistentSession session)throws PersistentException {
try {
orm.Tan_subsector[] lTan_subsectors = tan_curso.tan_subsector.toArray();
for(int i = 0; i < lTan_subsectors.length; i++) {
lTan_subsectors[i].setTan_cursocu(null);
}
orm.Tan_alumno[] lTan_alumnos = tan_curso.tan_alumno.toArray();
for(int i = 0; i < lTan_alumnos.length; i++) {
lTan_alumnos[i].setTan_cursocu(null);
}
try {
session.delete(tan_curso);
return true;
} catch (Exception e) {
return false;
}
}
catch(Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public boolean refresh(orm.Tan_curso tan_curso) throws PersistentException {
try {
orm.BdAnotacionesPersistentManager.instance().getSession().refresh(tan_curso);
return true;
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public boolean evict(orm.Tan_curso tan_curso) throws PersistentException {
try {
orm.BdAnotacionesPersistentManager.instance().getSession().evict(tan_curso);
return true;
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_curso loadTan_cursoByCriteria(Tan_cursoCriteria tan_cursoCriteria) {
Tan_curso[] tan_cursos = listTan_cursoByCriteria(tan_cursoCriteria);
if(tan_cursos == null || tan_cursos.length == 0) {
return null;
}
return tan_cursos[0];
}
public Tan_curso[] listTan_cursoByCriteria(Tan_cursoCriteria tan_cursoCriteria) {
return tan_cursoCriteria.listTan_curso();
}
}
| Java |
/**
* "Visual Paradigm: DO NOT MODIFY THIS FILE!"
*
* This is an automatic generated file. It will be regenerated every time
* you generate persistence class.
*
* Modifying its content may cause the program not work, or your work may lost.
*/
/**
* Licensee: DuKe TeAm
* License Type: Purchased
*/
package orm.impl;
import org.orm.*;
import org.hibernate.Query;
import java.util.List;
import orm.*;
public class Tan_alumnoDAOImpl implements orm.dao.Tan_alumnoDAO {
public Tan_alumno loadTan_alumnoByORMID(int al_id) throws PersistentException {
try {
PersistentSession session = orm.BdAnotacionesPersistentManager.instance().getSession();
return loadTan_alumnoByORMID(session, al_id);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_alumno getTan_alumnoByORMID(int al_id) throws PersistentException {
try {
PersistentSession session = orm.BdAnotacionesPersistentManager.instance().getSession();
return getTan_alumnoByORMID(session, al_id);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_alumno loadTan_alumnoByORMID(int al_id, org.hibernate.LockMode lockMode) throws PersistentException {
try {
PersistentSession session = orm.BdAnotacionesPersistentManager.instance().getSession();
return loadTan_alumnoByORMID(session, al_id, lockMode);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_alumno getTan_alumnoByORMID(int al_id, org.hibernate.LockMode lockMode) throws PersistentException {
try {
PersistentSession session = orm.BdAnotacionesPersistentManager.instance().getSession();
return getTan_alumnoByORMID(session, al_id, lockMode);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_alumno loadTan_alumnoByORMID(PersistentSession session, int al_id) throws PersistentException {
try {
return (Tan_alumno) session.load(orm.Tan_alumno.class, new Integer(al_id));
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_alumno getTan_alumnoByORMID(PersistentSession session, int al_id) throws PersistentException {
try {
return (Tan_alumno) session.get(orm.Tan_alumno.class, new Integer(al_id));
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_alumno loadTan_alumnoByORMID(PersistentSession session, int al_id, org.hibernate.LockMode lockMode) throws PersistentException {
try {
return (Tan_alumno) session.load(orm.Tan_alumno.class, new Integer(al_id), lockMode);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_alumno getTan_alumnoByORMID(PersistentSession session, int al_id, org.hibernate.LockMode lockMode) throws PersistentException {
try {
return (Tan_alumno) session.get(orm.Tan_alumno.class, new Integer(al_id), lockMode);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_alumno[] listTan_alumnoByQuery(String condition, String orderBy) throws PersistentException {
try {
PersistentSession session = orm.BdAnotacionesPersistentManager.instance().getSession();
return listTan_alumnoByQuery(session, condition, orderBy);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_alumno[] listTan_alumnoByQuery(String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
try {
PersistentSession session = orm.BdAnotacionesPersistentManager.instance().getSession();
return listTan_alumnoByQuery(session, condition, orderBy, lockMode);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_alumno[] listTan_alumnoByQuery(PersistentSession session, String condition, String orderBy) throws PersistentException {
StringBuffer sb = new StringBuffer("From orm.Tan_alumno as Tan_alumno");
if (condition != null)
sb.append(" Where ").append(condition);
if (orderBy != null)
sb.append(" Order By ").append(orderBy);
try {
Query query = session.createQuery(sb.toString());
List list = query.list();
return (Tan_alumno[]) list.toArray(new Tan_alumno[list.size()]);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_alumno[] listTan_alumnoByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
StringBuffer sb = new StringBuffer("From orm.Tan_alumno as Tan_alumno");
if (condition != null)
sb.append(" Where ").append(condition);
if (orderBy != null)
sb.append(" Order By ").append(orderBy);
try {
Query query = session.createQuery(sb.toString());
query.setLockMode("this", lockMode);
List list = query.list();
return (Tan_alumno[]) list.toArray(new Tan_alumno[list.size()]);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_alumno loadTan_alumnoByQuery(String condition, String orderBy) throws PersistentException {
try {
PersistentSession session = orm.BdAnotacionesPersistentManager.instance().getSession();
return loadTan_alumnoByQuery(session, condition, orderBy);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_alumno loadTan_alumnoByQuery(String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
try {
PersistentSession session = orm.BdAnotacionesPersistentManager.instance().getSession();
return loadTan_alumnoByQuery(session, condition, orderBy, lockMode);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_alumno loadTan_alumnoByQuery(PersistentSession session, String condition, String orderBy) throws PersistentException {
Tan_alumno[] tan_alumnos = listTan_alumnoByQuery(session, condition, orderBy);
if (tan_alumnos != null && tan_alumnos.length > 0)
return tan_alumnos[0];
else
return null;
}
public Tan_alumno loadTan_alumnoByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
Tan_alumno[] tan_alumnos = listTan_alumnoByQuery(session, condition, orderBy, lockMode);
if (tan_alumnos != null && tan_alumnos.length > 0)
return tan_alumnos[0];
else
return null;
}
public static java.util.Iterator iterateTan_alumnoByQuery(String condition, String orderBy) throws PersistentException {
try {
PersistentSession session = orm.BdAnotacionesPersistentManager.instance().getSession();
return iterateTan_alumnoByQuery(session, condition, orderBy);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public static java.util.Iterator iterateTan_alumnoByQuery(String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
try {
PersistentSession session = orm.BdAnotacionesPersistentManager.instance().getSession();
return iterateTan_alumnoByQuery(session, condition, orderBy, lockMode);
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public static java.util.Iterator iterateTan_alumnoByQuery(PersistentSession session, String condition, String orderBy) throws PersistentException {
StringBuffer sb = new StringBuffer("From orm.Tan_alumno as Tan_alumno");
if (condition != null)
sb.append(" Where ").append(condition);
if (orderBy != null)
sb.append(" Order By ").append(orderBy);
try {
Query query = session.createQuery(sb.toString());
return query.iterate();
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public static java.util.Iterator iterateTan_alumnoByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
StringBuffer sb = new StringBuffer("From orm.Tan_alumno as Tan_alumno");
if (condition != null)
sb.append(" Where ").append(condition);
if (orderBy != null)
sb.append(" Order By ").append(orderBy);
try {
Query query = session.createQuery(sb.toString());
query.setLockMode("this", lockMode);
return query.iterate();
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_alumno createTan_alumno() {
return new orm.Tan_alumno();
}
public boolean save(orm.Tan_alumno tan_alumno) throws PersistentException {
try {
orm.BdAnotacionesPersistentManager.instance().saveObject(tan_alumno);
return true;
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public boolean delete(orm.Tan_alumno tan_alumno) throws PersistentException {
try {
orm.BdAnotacionesPersistentManager.instance().deleteObject(tan_alumno);
return true;
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public boolean deleteAndDissociate(orm.Tan_alumno tan_alumno)throws PersistentException {
try {
if(tan_alumno.getTan_cursocu() != null) {
tan_alumno.getTan_cursocu().tan_alumno.remove(tan_alumno);
}
orm.Tan_anotacion[] lTan_anotacions = tan_alumno.tan_anotacion.toArray();
for(int i = 0; i < lTan_anotacions.length; i++) {
lTan_anotacions[i].setTan_alumnoal(null);
}
return delete(tan_alumno);
}
catch(Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public boolean deleteAndDissociate(orm.Tan_alumno tan_alumno, org.orm.PersistentSession session)throws PersistentException {
try {
if(tan_alumno.getTan_cursocu() != null) {
tan_alumno.getTan_cursocu().tan_alumno.remove(tan_alumno);
}
orm.Tan_anotacion[] lTan_anotacions = tan_alumno.tan_anotacion.toArray();
for(int i = 0; i < lTan_anotacions.length; i++) {
lTan_anotacions[i].setTan_alumnoal(null);
}
try {
session.delete(tan_alumno);
return true;
} catch (Exception e) {
return false;
}
}
catch(Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public boolean refresh(orm.Tan_alumno tan_alumno) throws PersistentException {
try {
orm.BdAnotacionesPersistentManager.instance().getSession().refresh(tan_alumno);
return true;
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public boolean evict(orm.Tan_alumno tan_alumno) throws PersistentException {
try {
orm.BdAnotacionesPersistentManager.instance().getSession().evict(tan_alumno);
return true;
}
catch (Exception e) {
e.printStackTrace();
throw new PersistentException(e);
}
}
public Tan_alumno loadTan_alumnoByCriteria(Tan_alumnoCriteria tan_alumnoCriteria) {
Tan_alumno[] tan_alumnos = listTan_alumnoByCriteria(tan_alumnoCriteria);
if(tan_alumnos == null || tan_alumnos.length == 0) {
return null;
}
return tan_alumnos[0];
}
public Tan_alumno[] listTan_alumnoByCriteria(Tan_alumnoCriteria tan_alumnoCriteria) {
return tan_alumnoCriteria.listTan_alumno();
}
}
| Java |
/**
* "Visual Paradigm: DO NOT MODIFY THIS FILE!"
*
* This is an automatic generated file. It will be regenerated every time
* you generate persistence class.
*
* Modifying its content may cause the program not work, or your work may lost.
*/
/**
* Licensee: DuKe TeAm
* License Type: Purchased
*/
package orm;
import java.util.List;
import org.hibernate.criterion.DetachedCriteria;
import org.orm.PersistentSession;
import org.orm.criteria.*;
public class Tan_subsectorDetachedCriteria extends AbstractORMDetachedCriteria {
public final IntegerExpression su_id;
public final StringExpression su_descripcion;
public Tan_subsectorDetachedCriteria() {
super(orm.Tan_subsector.class, orm.Tan_subsectorCriteria.class);
su_id = new IntegerExpression("su_id", this.getDetachedCriteria());
su_descripcion = new StringExpression("su_descripcion", this.getDetachedCriteria());
}
public Tan_subsectorDetachedCriteria(DetachedCriteria aDetachedCriteria) {
super(aDetachedCriteria, orm.Tan_subsectorCriteria.class);
su_id = new IntegerExpression("su_id", this.getDetachedCriteria());
su_descripcion = new StringExpression("su_descripcion", this.getDetachedCriteria());
}
public Tan_cursoDetachedCriteria createTan_cursocuCriteria() {
return new Tan_cursoDetachedCriteria(createCriteria("tan_cursocu"));
}
public Tan_subsector uniqueTan_subsector(PersistentSession session) {
return (Tan_subsector) super.createExecutableCriteria(session).uniqueResult();
}
public Tan_subsector[] listTan_subsector(PersistentSession session) {
List list = super.createExecutableCriteria(session).list();
return (Tan_subsector[]) list.toArray(new Tan_subsector[list.size()]);
}
}
| Java |
/**
* "Visual Paradigm: DO NOT MODIFY THIS FILE!"
*
* This is an automatic generated file. It will be regenerated every time
* you generate persistence class.
*
* Modifying its content may cause the program not work, or your work may lost.
*/
/**
* Licensee: DuKe TeAm
* License Type: Purchased
*/
package orm;
import java.io.Serializable;
public class Tan_anotacion implements Serializable {
public Tan_anotacion() {
}
private void this_setOwner(Object owner, int key) {
if (key == orm.ORMConstants.KEY_TAN_ANOTACION_TAN_ANOTADORAN) {
this.tan_anotadoran = (orm.Tan_anotador) owner;
}
else if (key == orm.ORMConstants.KEY_TAN_ANOTACION_TAN_TIPO_ANOTACIONTA) {
this.tan_tipo_anotacionta = (orm.Tan_tipo_anotacion) owner;
}
else if (key == orm.ORMConstants.KEY_TAN_ANOTACION_TAN_ALUMNOAL) {
this.tan_alumnoal = (orm.Tan_alumno) owner;
}
}
org.orm.util.ORMAdapter _ormAdapter = new org.orm.util.AbstractORMAdapter() {
public void setOwner(Object owner, int key) {
this_setOwner(owner, key);
}
};
private int an_id;
private orm.Tan_anotador tan_anotadoran;
private orm.Tan_tipo_anotacion tan_tipo_anotacionta;
private orm.Tan_alumno tan_alumnoal;
private java.util.Date an_fecha;
private String an_descripcion;
private void setAn_id(int value) {
this.an_id = value;
}
public int getAn_id() {
return an_id;
}
public int getORMID() {
return getAn_id();
}
/**
* fecha anotacion
*/
public void setAn_fecha(java.util.Date value) {
this.an_fecha = value;
}
/**
* fecha anotacion
*/
public java.util.Date getAn_fecha() {
return an_fecha;
}
/**
* descripcion anotacion
*/
public void setAn_descripcion(String value) {
this.an_descripcion = value;
}
/**
* descripcion anotacion
*/
public String getAn_descripcion() {
return an_descripcion;
}
public void setTan_anotadoran(orm.Tan_anotador value) {
if (tan_anotadoran != null) {
tan_anotadoran.tan_anotacion.remove(this);
}
if (value != null) {
value.tan_anotacion.add(this);
}
}
public orm.Tan_anotador getTan_anotadoran() {
return tan_anotadoran;
}
/**
* This method is for internal use only.
*/
public void setORM_Tan_anotadoran(orm.Tan_anotador value) {
this.tan_anotadoran = value;
}
private orm.Tan_anotador getORM_Tan_anotadoran() {
return tan_anotadoran;
}
public void setTan_tipo_anotacionta(orm.Tan_tipo_anotacion value) {
if (tan_tipo_anotacionta != null) {
tan_tipo_anotacionta.tan_anotacion.remove(this);
}
if (value != null) {
value.tan_anotacion.add(this);
}
}
public orm.Tan_tipo_anotacion getTan_tipo_anotacionta() {
return tan_tipo_anotacionta;
}
/**
* This method is for internal use only.
*/
public void setORM_Tan_tipo_anotacionta(orm.Tan_tipo_anotacion value) {
this.tan_tipo_anotacionta = value;
}
private orm.Tan_tipo_anotacion getORM_Tan_tipo_anotacionta() {
return tan_tipo_anotacionta;
}
public void setTan_alumnoal(orm.Tan_alumno value) {
if (tan_alumnoal != null) {
tan_alumnoal.tan_anotacion.remove(this);
}
if (value != null) {
value.tan_anotacion.add(this);
}
}
public orm.Tan_alumno getTan_alumnoal() {
return tan_alumnoal;
}
/**
* This method is for internal use only.
*/
public void setORM_Tan_alumnoal(orm.Tan_alumno value) {
this.tan_alumnoal = value;
}
private orm.Tan_alumno getORM_Tan_alumnoal() {
return tan_alumnoal;
}
public String toString() {
return String.valueOf(getAn_id());
}
}
| Java |
/**
* "Visual Paradigm: DO NOT MODIFY THIS FILE!"
*
* This is an automatic generated file. It will be regenerated every time
* you generate persistence class.
*
* Modifying its content may cause the program not work, or your work may lost.
*/
/**
* Licensee: DuKe TeAm
* License Type: Purchased
*/
package orm;
import org.hibernate.Criteria;
import org.orm.PersistentException;
import org.orm.PersistentSession;
import org.orm.criteria.*;
public class Tan_cursoCriteria extends AbstractORMCriteria {
public final IntegerExpression cu_id;
public final StringExpression cu_nombre;
public Tan_cursoCriteria(Criteria criteria) {
super(criteria);
cu_id = new IntegerExpression("cu_id", this);
cu_nombre = new StringExpression("cu_nombre", this);
}
public Tan_cursoCriteria(PersistentSession session) {
this(session.createCriteria(Tan_curso.class));
}
public Tan_cursoCriteria() throws PersistentException {
this(orm.BdAnotacionesPersistentManager.instance().getSession());
}
public orm.Tan_subsectorCriteria createTan_subsectorCriteria() {
return new orm.Tan_subsectorCriteria(createCriteria("ORM_Tan_subsector"));
}
public orm.Tan_alumnoCriteria createTan_alumnoCriteria() {
return new orm.Tan_alumnoCriteria(createCriteria("ORM_Tan_alumno"));
}
public Tan_curso uniqueTan_curso() {
return (Tan_curso) super.uniqueResult();
}
public Tan_curso[] listTan_curso() {
java.util.List list = super.list();
return (Tan_curso[]) list.toArray(new Tan_curso[list.size()]);
}
}
| Java |
/**
* "Visual Paradigm: DO NOT MODIFY THIS FILE!"
*
* This is an automatic generated file. It will be regenerated every time
* you generate persistence class.
*
* Modifying its content may cause the program not work, or your work may lost.
*/
/**
* Licensee: DuKe TeAm
* License Type: Purchased
*/
package orm;
import orm.impl.*;
import orm.dao.*;
public class DAOFactoryImpl extends DAOFactory {
private Tan_anotadorDAO _tan_anotadorDAO = new Tan_anotadorDAOImpl();
public Tan_anotadorDAO getTan_anotadorDAO() {
return _tan_anotadorDAO;
}
private Tan_subsectorDAO _tan_subsectorDAO = new Tan_subsectorDAOImpl();
public Tan_subsectorDAO getTan_subsectorDAO() {
return _tan_subsectorDAO;
}
private Tan_cursoDAO _tan_cursoDAO = new Tan_cursoDAOImpl();
public Tan_cursoDAO getTan_cursoDAO() {
return _tan_cursoDAO;
}
private Tan_alumnoDAO _tan_alumnoDAO = new Tan_alumnoDAOImpl();
public Tan_alumnoDAO getTan_alumnoDAO() {
return _tan_alumnoDAO;
}
private Tan_anotacionDAO _tan_anotacionDAO = new Tan_anotacionDAOImpl();
public Tan_anotacionDAO getTan_anotacionDAO() {
return _tan_anotacionDAO;
}
private Tan_tipo_anotacionDAO _tan_tipo_anotacionDAO = new Tan_tipo_anotacionDAOImpl();
public Tan_tipo_anotacionDAO getTan_tipo_anotacionDAO() {
return _tan_tipo_anotacionDAO;
}
}
| Java |
/**
* "Visual Paradigm: DO NOT MODIFY THIS FILE!"
*
* This is an automatic generated file. It will be regenerated every time
* you generate persistence class.
*
* Modifying its content may cause the program not work, or your work may lost.
*/
/**
* Licensee: DuKe TeAm
* License Type: Purchased
*/
package orm;
import java.io.Serializable;
public class Tan_anotador implements Serializable {
public Tan_anotador() {
}
private java.util.Set this_getSet (int key) {
if (key == orm.ORMConstants.KEY_TAN_ANOTADOR_TAN_ANOTACION) {
return ORM_tan_anotacion;
}
return null;
}
org.orm.util.ORMAdapter _ormAdapter = new org.orm.util.AbstractORMAdapter() {
public java.util.Set getSet(int key) {
return this_getSet(key);
}
};
private int an_id;
private String an_nombre;
private String an_rut;
private java.util.Set ORM_tan_anotacion = new java.util.HashSet();
private void setAn_id(int value) {
this.an_id = value;
}
public int getAn_id() {
return an_id;
}
public int getORMID() {
return getAn_id();
}
/**
* nombre del anotador
*/
public void setAn_nombre(String value) {
this.an_nombre = value;
}
/**
* nombre del anotador
*/
public String getAn_nombre() {
return an_nombre;
}
/**
* rut del anotador
*/
public void setAn_rut(String value) {
this.an_rut = value;
}
/**
* rut del anotador
*/
public String getAn_rut() {
return an_rut;
}
private void setORM_Tan_anotacion(java.util.Set value) {
this.ORM_tan_anotacion = value;
}
private java.util.Set getORM_Tan_anotacion() {
return ORM_tan_anotacion;
}
public final orm.Tan_anotacionSetCollection tan_anotacion = new orm.Tan_anotacionSetCollection(this, _ormAdapter, orm.ORMConstants.KEY_TAN_ANOTADOR_TAN_ANOTACION, orm.ORMConstants.KEY_TAN_ANOTACION_TAN_ANOTADORAN, orm.ORMConstants.KEY_MUL_ONE_TO_MANY);
public String toString() {
return String.valueOf(getAn_id());
}
}
| Java |
/**
* "Visual Paradigm: DO NOT MODIFY THIS FILE!"
*
* This is an automatic generated file. It will be regenerated every time
* you generate persistence class.
*
* Modifying its content may cause the program not work, or your work may lost.
*/
/**
* Licensee: DuKe TeAm
* License Type: Purchased
*/
package orm;
import orm.dao.*;
public abstract class DAOFactory {
private static DAOFactory _factory = new DAOFactoryImpl();
public static DAOFactory getDAOFactory() {
return _factory;
}
public abstract Tan_anotadorDAO getTan_anotadorDAO();
public abstract Tan_subsectorDAO getTan_subsectorDAO();
public abstract Tan_cursoDAO getTan_cursoDAO();
public abstract Tan_alumnoDAO getTan_alumnoDAO();
public abstract Tan_anotacionDAO getTan_anotacionDAO();
public abstract Tan_tipo_anotacionDAO getTan_tipo_anotacionDAO();
}
| Java |
/**
* "Visual Paradigm: DO NOT MODIFY THIS FILE!"
*
* This is an automatic generated file. It will be regenerated every time
* you generate persistence class.
*
* Modifying its content may cause the program not work, or your work may lost.
*/
/**
* Licensee: DuKe TeAm
* License Type: Purchased
*/
package orm;
import java.util.List;
import org.hibernate.criterion.DetachedCriteria;
import org.orm.PersistentSession;
import org.orm.criteria.*;
public class Tan_cursoDetachedCriteria extends AbstractORMDetachedCriteria {
public final IntegerExpression cu_id;
public final StringExpression cu_nombre;
public Tan_cursoDetachedCriteria() {
super(orm.Tan_curso.class, orm.Tan_cursoCriteria.class);
cu_id = new IntegerExpression("cu_id", this.getDetachedCriteria());
cu_nombre = new StringExpression("cu_nombre", this.getDetachedCriteria());
}
public Tan_cursoDetachedCriteria(DetachedCriteria aDetachedCriteria) {
super(aDetachedCriteria, orm.Tan_cursoCriteria.class);
cu_id = new IntegerExpression("cu_id", this.getDetachedCriteria());
cu_nombre = new StringExpression("cu_nombre", this.getDetachedCriteria());
}
public orm.Tan_subsectorDetachedCriteria createTan_subsectorCriteria() {
return new orm.Tan_subsectorDetachedCriteria(createCriteria("ORM_Tan_subsector"));
}
public orm.Tan_alumnoDetachedCriteria createTan_alumnoCriteria() {
return new orm.Tan_alumnoDetachedCriteria(createCriteria("ORM_Tan_alumno"));
}
public Tan_curso uniqueTan_curso(PersistentSession session) {
return (Tan_curso) super.createExecutableCriteria(session).uniqueResult();
}
public Tan_curso[] listTan_curso(PersistentSession session) {
List list = super.createExecutableCriteria(session).list();
return (Tan_curso[]) list.toArray(new Tan_curso[list.size()]);
}
}
| Java |
/**
* "Visual Paradigm: DO NOT MODIFY THIS FILE!"
*
* This is an automatic generated file. It will be regenerated every time
* you generate persistence class.
*
* Modifying its content may cause the program not work, or your work may lost.
*/
/**
* Licensee: DuKe TeAm
* License Type: Purchased
*/
package orm;
import org.orm.*;
public class Tan_alumnoSetCollection extends org.orm.util.ORMSet {
public Tan_alumnoSetCollection(Object owner, org.orm.util.ORMAdapter adapter, int ownerKey, int targetKey, int collType) {
super(owner, adapter, ownerKey, targetKey, true, collType);
}
public Tan_alumnoSetCollection(Object owner, org.orm.util.ORMAdapter adapter, int ownerKey, int collType) {
super(owner, adapter, ownerKey, -1, false, collType);
}
/**
* Return an iterator over the persistent objects
* @return The persisten objects iterator
*/
public java.util.Iterator getIterator() {
return super.getIterator(_ownerAdapter);
}
/**
* Add the specified persistent object to ORMSet
* @param value the persistent object
*/
public void add(Tan_alumno value) {
if (value != null) {
super.add(value, value._ormAdapter);
}
}
/**
* Remove the specified persistent object from ORMSet
* @param value the persistent object
*/
public void remove(Tan_alumno value) {
super.remove(value, value._ormAdapter);
}
/**
* Return true if ORMSet contains the specified persistent object
* @param value the persistent object
* @return True if this contains the specified persistent object
*/
public boolean contains(Tan_alumno value) {
return super.contains(value);
}
/**
* Return an array containing all of the persistent objects in ORMSet
* @return The persistent objects array
*/
public Tan_alumno[] toArray() {
return (Tan_alumno[]) super.toArray(new Tan_alumno[size()]);
}
/**
* Return an sorted array containing all of the persistent objects in ORMSet
* @param propertyName Name of the property for sorting:<ul>
* <li>al_id</li>
* <li>al_rut</li>
* <li>al_nombre</li>
* </ul>
* @return The persistent objects sorted array
*/
public Tan_alumno[] toArray(String propertyName) {
return toArray(propertyName, true);
}
/**
* Return an sorted array containing all of the persistent objects in ORMSet
* @param propertyName Name of the property for sorting:<ul>
* <li>al_id</li>
* <li>al_rut</li>
* <li>al_nombre</li>
* </ul>
* @param ascending true for ascending, false for descending
* @return The persistent objects sorted array
*/
public Tan_alumno[] toArray(String propertyName, boolean ascending) {
return (Tan_alumno[]) super.toArray(new Tan_alumno[size()], propertyName, ascending);
}
protected PersistentManager getPersistentManager() throws PersistentException {
return orm.BdAnotacionesPersistentManager.instance();
}
}
| Java |
/**
* "Visual Paradigm: DO NOT MODIFY THIS FILE!"
*
* This is an automatic generated file. It will be regenerated every time
* you generate persistence class.
*
* Modifying its content may cause the program not work, or your work may lost.
*/
/**
* Licensee: DuKe TeAm
* License Type: Purchased
*/
package orm;
import org.orm.*;
import org.orm.cfg.JDBCConnectionSetting;
import org.hibernate.*;
import java.util.Properties;
public class BdAnotacionesPersistentManager extends PersistentManager {
private static final String PROJECT_NAME = "BdAnotaciones";
private static PersistentManager _instance = null;
private static SessionType _sessionType = SessionType.THREAD_BASE;
private static int _timeToAlive = 60000;
private static JDBCConnectionSetting _connectionSetting = null;
private static Properties _extraProperties = null;
private BdAnotacionesPersistentManager() throws PersistentException {
super(_connectionSetting, _sessionType, _timeToAlive, new String[] {}, _extraProperties);
setFlushMode(FlushMode.AUTO);
}
public String getProjectName() {
return PROJECT_NAME;
}
public static synchronized final PersistentManager instance() throws PersistentException {
if (_instance == null) {
_instance = new BdAnotacionesPersistentManager();
}
return _instance;
}
public void disposePersistentManager() throws PersistentException {
_instance = null;
super.disposePersistentManager();
}
public static void setSessionType(SessionType sessionType) throws PersistentException {
if (_instance != null) {
throw new PersistentException("Cannot set session type after create PersistentManager instance");
}
else {
_sessionType = sessionType;
}
}
public static void setAppBaseSessionTimeToAlive(int timeInMs) throws PersistentException {
if (_instance != null) {
throw new PersistentException("Cannot set session time to alive after create PersistentManager instance");
}
else {
_timeToAlive = timeInMs;
}
}
public static void setJDBCConnectionSetting(JDBCConnectionSetting aConnectionSetting) throws PersistentException {
if (_instance != null) {
throw new PersistentException("Cannot set connection setting after create PersistentManager instance");
}
else {
_connectionSetting = aConnectionSetting;
}
}
public static void setHibernateProperties(Properties aProperties) throws PersistentException {
if (_instance != null) {
throw new PersistentException("Cannot set hibernate properties after create PersistentManager instance");
}
else {
_extraProperties = aProperties;
}
}
public static void saveJDBCConnectionSetting() {
PersistentManager.saveJDBCConnectionSetting(PROJECT_NAME, _connectionSetting);
}
}
| Java |
/**
* "Visual Paradigm: DO NOT MODIFY THIS FILE!"
*
* This is an automatic generated file. It will be regenerated every time
* you generate persistence class.
*
* Modifying its content may cause the program not work, or your work may lost.
*/
/**
* Licensee: DuKe TeAm
* License Type: Purchased
*/
package orm;
public interface ORMConstants extends org.orm.util.ORMBaseConstants {
final int KEY_TAN_ALUMNO_TAN_ANOTACION = -569908231;
final int KEY_TAN_ALUMNO_TAN_CURSOCU = -2143093197;
final int KEY_TAN_ANOTACION_TAN_ALUMNOAL = -1665665322;
final int KEY_TAN_ANOTACION_TAN_ANOTADORAN = 1667204652;
final int KEY_TAN_ANOTACION_TAN_TIPO_ANOTACIONTA = 643235229;
final int KEY_TAN_ANOTADOR_TAN_ANOTACION = 1367866253;
final int KEY_TAN_CURSO_TAN_ALUMNO = -1062439965;
final int KEY_TAN_CURSO_TAN_SUBSECTOR = -723491225;
final int KEY_TAN_SUBSECTOR_TAN_CURSOCU = -1968076775;
final int KEY_TAN_TIPO_ANOTACION_TAN_ANOTACION = 1157857790;
}
| Java |
/**
* "Visual Paradigm: DO NOT MODIFY THIS FILE!"
*
* This is an automatic generated file. It will be regenerated every time
* you generate persistence class.
*
* Modifying its content may cause the program not work, or your work may lost.
*/
/**
* Licensee: DuKe TeAm
* License Type: Purchased
*/
package orm;
import java.io.Serializable;
public class Tan_subsector implements Serializable {
public Tan_subsector() {
}
private void this_setOwner(Object owner, int key) {
if (key == orm.ORMConstants.KEY_TAN_SUBSECTOR_TAN_CURSOCU) {
this.tan_cursocu = (orm.Tan_curso) owner;
}
}
org.orm.util.ORMAdapter _ormAdapter = new org.orm.util.AbstractORMAdapter() {
public void setOwner(Object owner, int key) {
this_setOwner(owner, key);
}
};
private int su_id;
private orm.Tan_curso tan_cursocu;
private String su_descripcion;
private void setSu_id(int value) {
this.su_id = value;
}
public int getSu_id() {
return su_id;
}
public int getORMID() {
return getSu_id();
}
/**
* nombre del subsector
*/
public void setSu_descripcion(String value) {
this.su_descripcion = value;
}
/**
* nombre del subsector
*/
public String getSu_descripcion() {
return su_descripcion;
}
public void setTan_cursocu(orm.Tan_curso value) {
if (tan_cursocu != null) {
tan_cursocu.tan_subsector.remove(this);
}
if (value != null) {
value.tan_subsector.add(this);
}
}
public orm.Tan_curso getTan_cursocu() {
return tan_cursocu;
}
/**
* This method is for internal use only.
*/
public void setORM_Tan_cursocu(orm.Tan_curso value) {
this.tan_cursocu = value;
}
private orm.Tan_curso getORM_Tan_cursocu() {
return tan_cursocu;
}
public String toString() {
return String.valueOf(getSu_id());
}
}
| Java |
package Otros;
public class Validar {
public boolean vacio(String texto)
{
for(int i=0;i< texto.length();i++){
if(texto.charAt(i) != ' '){
return false;
}
}
return true;
}
}
| Java |
package Otros;
import org.orm.PersistentException;
import org.orm.PersistentTransaction;
import orm.BdAnotacionesPersistentManager;
public class CreateAnotadorData {
public void createTestData() throws PersistentException {
PersistentTransaction t = BdAnotacionesPersistentManager.instance().getSession().beginTransaction();
try {
orm.DAOFactory lDAOFactory = orm.DAOFactory.getDAOFactory();
orm.dao.Tan_anotadorDAO lormTan_anotadorDAO = lDAOFactory.getTan_anotadorDAO();
orm.Tan_anotador lormTan_anotador = lormTan_anotadorDAO.createTan_anotador();
// TODO Initialize the properties of the persistent object here, the following properties must be initialized before saving : tda_anotacion, tan_nombre
lormTan_anotador.setAn_rut("123451");
lormTan_anotador.setAn_nombre("Pedro Monsalves Pelayo");
lormTan_anotadorDAO.save(lormTan_anotador);
orm.Tan_anotador lormTan_anotador2 = lormTan_anotadorDAO.createTan_anotador();
// TODO Initialize the properties of the persistent object here, the following properties must be initialized before saving : tda_anotacion, tan_nombre
lormTan_anotador2.setAn_rut("12345412");
lormTan_anotador2.setAn_nombre("Pablo Hans Poso");
lormTan_anotadorDAO.save(lormTan_anotador2);
orm.Tan_anotador lormTan_anotador3 = lormTan_anotadorDAO.createTan_anotador();
// TODO Initialize the properties of the persistent object here, the following properties must be initialized before saving : tda_anotacion, tan_nombre
lormTan_anotador3.setAn_rut("12345112");
lormTan_anotador3.setAn_nombre("Pepe Le Pu");
lormTan_anotadorDAO.save(lormTan_anotador3);
t.commit();
}
catch (Exception e) {
t.rollback();
}
}
public static void main(String[] args) {
try {
CreateAnotadorData CreateData = new CreateAnotadorData();
try {
CreateData.createTestData();
}
finally {
orm.BdAnotacionesPersistentManager.instance().disposePersistentManager();
}
}
catch (Exception e) {
e.printStackTrace();
}
}
} | Java |
package Otros;
import org.orm.PersistentException;
import org.orm.PersistentTransaction;
import orm.BdAnotacionesPersistentManager;
public class CreateAlumnoData {
int a=1;
public void createTestData() throws PersistentException {
PersistentTransaction t = BdAnotacionesPersistentManager.instance().getSession().beginTransaction();
try {
orm.DAOFactory lDAOFactory = orm.DAOFactory.getDAOFactory();
orm.dao.Tan_alumnoDAO lormTan_alumnoDAO = lDAOFactory.getTan_alumnoDAO();
orm.Tan_alumno lormTan_alumno = lormTan_alumnoDAO.createTan_alumno();
orm.dao.Tan_cursoDAO lormTan_cursoDAO = lDAOFactory.getTan_cursoDAO();
orm.Tan_curso lormTan_curso = lormTan_cursoDAO.getTan_cursoByORMID(a);
lormTan_alumno.setAl_nombre("Pepito Matamoros");
lormTan_alumno.setAl_rut("1234321");
lormTan_alumno.setTan_cursocu(lormTan_curso);
lormTan_alumnoDAO.save(lormTan_alumno);
orm.Tan_alumno lormTan_alumno2 = lormTan_alumnoDAO.createTan_alumno();
orm.Tan_curso lormTan_curso2 = lormTan_cursoDAO.getTan_cursoByORMID(a+1);
lormTan_alumno2.setAl_nombre("Juan Perez Pereira");
lormTan_alumno2.setAl_rut("1322123");
lormTan_alumno2.setTan_cursocu(lormTan_curso2);
lormTan_alumnoDAO.save(lormTan_alumno2);
orm.Tan_alumno lormTan_alumno3 = lormTan_alumnoDAO.createTan_alumno();
orm.Tan_curso lormTan_curso3 = lormTan_cursoDAO.getTan_cursoByORMID(a+1);
lormTan_alumno3.setAl_nombre("Luis Jara Pereira");
lormTan_alumno3.setAl_rut("13235623");
lormTan_alumno3.setTan_cursocu(lormTan_curso3);
lormTan_alumnoDAO.save(lormTan_alumno3);
orm.Tan_alumno lormTan_alumno4 = lormTan_alumnoDAO.createTan_alumno();
orm.Tan_curso lormTan_curso4 = lormTan_cursoDAO.getTan_cursoByORMID(a+2);
lormTan_alumno4.setAl_nombre("Pedro Fernandez Monsalve");
lormTan_alumno4.setAl_rut("1632621253");
lormTan_alumno4.setTan_cursocu(lormTan_curso4);
lormTan_alumnoDAO.save(lormTan_alumno4);
orm.Tan_alumno lormTan_alumno5 = lormTan_alumnoDAO.createTan_alumno();
orm.Tan_curso lormTan_curso5 = lormTan_cursoDAO.getTan_cursoByORMID(a);
lormTan_alumno5.setAl_nombre("Patricio Ruminot");
lormTan_alumno5.setAl_rut("18322123");
lormTan_alumno5.setTan_cursocu(lormTan_curso5);
lormTan_alumnoDAO.save(lormTan_alumno5);
orm.Tan_alumno lormTan_alumno6 = lormTan_alumnoDAO.createTan_alumno();
orm.Tan_curso lormTan_curso6 = lormTan_cursoDAO.getTan_cursoByORMID(a+1);
lormTan_alumno6.setAl_nombre("Jorge Alezandri");
lormTan_alumno6.setAl_rut("178322123");
lormTan_alumno6.setTan_cursocu(lormTan_curso6);
lormTan_alumnoDAO.save(lormTan_alumno6);
orm.Tan_alumno lormTan_alumno7 = lormTan_alumnoDAO.createTan_alumno();
orm.Tan_curso lormTan_curso7 = lormTan_cursoDAO.getTan_cursoByORMID(a+2);
lormTan_alumno7.setAl_nombre("Macarena Arriagada");
lormTan_alumno7.setAl_rut("1322312843");
lormTan_alumno7.setTan_cursocu(lormTan_curso7);
lormTan_alumnoDAO.save(lormTan_alumno7);
orm.Tan_alumno lormTan_alumno8 = lormTan_alumnoDAO.createTan_alumno();
orm.Tan_curso lormTan_curso8 = lormTan_cursoDAO.getTan_cursoByORMID(a);
lormTan_alumno8.setAl_nombre("Patty Cofre");
lormTan_alumno8.setAl_rut("1322665523");
lormTan_alumno8.setTan_cursocu(lormTan_curso8);
lormTan_alumnoDAO.save(lormTan_alumno8);
orm.Tan_alumno lormTan_alumno9 = lormTan_alumnoDAO.createTan_alumno();
orm.Tan_curso lormTan_curso9 = lormTan_cursoDAO.getTan_cursoByORMID(a+1);
lormTan_alumno9.setAl_nombre("Chicholina");
lormTan_alumno9.setAl_rut("132212427875433");
lormTan_alumno9.setTan_cursocu(lormTan_curso9);
lormTan_alumnoDAO.save(lormTan_alumno9);
orm.Tan_alumno lormTan_alumno11 = lormTan_alumnoDAO.createTan_alumno();
orm.Tan_curso lormTan_curso11 = lormTan_cursoDAO.getTan_cursoByORMID(a+2);
lormTan_alumno11.setAl_nombre("riki ricon");
lormTan_alumno11.setAl_rut("1322145454523");
lormTan_alumno11.setTan_cursocu(lormTan_curso11);
lormTan_alumnoDAO.save(lormTan_alumno11);
orm.Tan_alumno lormTan_alumno12 = lormTan_alumnoDAO.createTan_alumno();
orm.Tan_curso lormTan_curso12 = lormTan_cursoDAO.getTan_cursoByORMID(a);
lormTan_alumno12.setAl_nombre("mac pato");
lormTan_alumno12.setAl_rut("13244433322662123");
lormTan_alumno12.setTan_cursocu(lormTan_curso12);
lormTan_alumnoDAO.save(lormTan_alumno12);
orm.Tan_alumno lormTan_alumno13 = lormTan_alumnoDAO.createTan_alumno();
orm.Tan_curso lormTan_curso13 = lormTan_cursoDAO.getTan_cursoByORMID(a+1);
lormTan_alumno13.setAl_nombre("cua cuac");
lormTan_alumno13.setAl_rut("13246465423");
lormTan_alumno13.setTan_cursocu(lormTan_curso13);
lormTan_alumnoDAO.save(lormTan_alumno13);
orm.Tan_alumno lormTan_alumno14 = lormTan_alumnoDAO.createTan_alumno();
orm.Tan_curso lormTan_curso14 = lormTan_cursoDAO.getTan_cursoByORMID(a+2);
lormTan_alumno14.setAl_nombre("donatelo");
lormTan_alumno14.setAl_rut("1345565423");
lormTan_alumno14.setTan_cursocu(lormTan_curso14);
lormTan_alumnoDAO.save(lormTan_alumno14);
orm.Tan_alumno lormTan_alumno15 = lormTan_alumnoDAO.createTan_alumno();
orm.Tan_curso lormTan_curso15 = lormTan_cursoDAO.getTan_cursoByORMID(a);
lormTan_alumno15.setAl_nombre("miguel angel");
lormTan_alumno15.setAl_rut("1365423");
lormTan_alumno15.setTan_cursocu(lormTan_curso15);
lormTan_alumnoDAO.save(lormTan_alumno15);
t.commit();
}
catch (Exception e) {
t.rollback();
}
}
public static void main(String[] args) {
try {
CreateAlumnoData CreateData = new CreateAlumnoData();
try {
CreateData.createTestData();
}
finally {
orm.BdAnotacionesPersistentManager.instance().disposePersistentManager();
}
}
catch (Exception e) {
e.printStackTrace();
}
}
}
| Java |
package Otros;
import org.orm.PersistentException;
import org.orm.PersistentTransaction;
import orm.BdAnotacionesPersistentManager;
public class CreateCursoData {
public void createTestData() throws PersistentException {
PersistentTransaction t = BdAnotacionesPersistentManager.instance().getSession().beginTransaction();
try {
orm.DAOFactory lDAOFactory = orm.DAOFactory.getDAOFactory();
orm.dao.Tan_cursoDAO lormTan_cursoDAO = lDAOFactory.getTan_cursoDAO();
orm.Tan_curso lormTan_curso = lormTan_cursoDAO.createTan_curso();
// TODO Initialize the properties of the persistent object here, the following properties must be initialized before saving : tda_anotacion, tan_nombre
lormTan_curso.setCu_nombre("Primero A");
lormTan_cursoDAO.save(lormTan_curso);
orm.Tan_curso lormTan_curso2 = lormTan_cursoDAO.createTan_curso();
// TODO Initialize the properties of the persistent object here, the following properties must be initialized before saving : tda_anotacion, tan_nombre
lormTan_curso2.setCu_nombre("Primero B");
lormTan_cursoDAO.save(lormTan_curso2);
orm.Tan_curso lormTan_curso3 = lormTan_cursoDAO.createTan_curso();
// TODO Initialize the properties of the persistent object here, the following properties must be initialized before saving : tda_anotacion, tan_nombre
lormTan_curso3.setCu_nombre("Segundo A");
lormTan_cursoDAO.save(lormTan_curso3);
orm.Tan_curso lormTan_curso4 = lormTan_cursoDAO.createTan_curso();
// TODO Initialize the properties of the persistent object here, the following properties must be initialized before saving : tda_anotacion, tan_nombre
lormTan_curso4.setCu_nombre("Segundo B");
lormTan_cursoDAO.save(lormTan_curso4);
orm.Tan_curso lormTan_curso5 = lormTan_cursoDAO.createTan_curso();
// TODO Initialize the properties of the persistent object here, the following properties must be initialized before saving : tda_anotacion, tan_nombre
lormTan_curso5.setCu_nombre("Tercero A");
lormTan_cursoDAO.save(lormTan_curso5);
t.commit();
}
catch (Exception e) {
t.rollback();
}
}
public static void main(String[] args) {
try {
CreateCursoData CreateData = new CreateCursoData();
try {
CreateData.createTestData();
}
finally {
orm.BdAnotacionesPersistentManager.instance().disposePersistentManager();
}
}
catch (Exception e) {
e.printStackTrace();
}
}
}
| Java |
package Otros;
public class Respuestas {
}
| Java |
package Otros;
import org.orm.PersistentException;
import org.orm.PersistentTransaction;
import orm.BdAnotacionesPersistentManager;
public class CreateSubsectorData {
int a=1;
public void createTestData() throws PersistentException {
PersistentTransaction t = BdAnotacionesPersistentManager.instance().getSession().beginTransaction();
try {
orm.DAOFactory lDAOFactory = orm.DAOFactory.getDAOFactory();
orm.dao.Tan_subsectorDAO lormTan_subsectorDAO = lDAOFactory.getTan_subsectorDAO();
orm.dao.Tan_cursoDAO lormTan_cursoDAO = lDAOFactory.getTan_cursoDAO();
orm.Tan_subsector lormTan_subsector = lormTan_subsectorDAO.createTan_subsector();
orm.Tan_curso lormTan_curso = lormTan_cursoDAO.getTan_cursoByORMID(a);
// TODO Initialize the properties of the persistent object here, the following properties must be initialized before saving : tda_anotacion, tan_nombre
lormTan_subsector.setSu_descripcion("Matematicas");
lormTan_subsector.setTan_cursocu(lormTan_curso );
lormTan_subsectorDAO.save(lormTan_subsector);
orm.Tan_curso lormTan_curso2 = lormTan_cursoDAO.getTan_cursoByORMID(a+1);
orm.Tan_subsector lormTan_subsector2 = lormTan_subsectorDAO.createTan_subsector();
// TODO Initialize the properties of the persistent object here, the following properties must be initialized before saving : tda_anotacion, tan_nombre
lormTan_subsector2.setSu_descripcion("Matematicas");
lormTan_subsector2.setTan_cursocu(lormTan_curso2 );
lormTan_subsectorDAO.save(lormTan_subsector2);
orm.Tan_curso lormTan_curso3 = lormTan_cursoDAO.getTan_cursoByORMID(a+2);
orm.Tan_subsector lormTan_subsector3 = lormTan_subsectorDAO.createTan_subsector();
// TODO Initialize the properties of the persistent object here, the following properties must be initialized before saving : tda_anotacion, tan_nombre
lormTan_subsector3.setSu_descripcion("Matematicas");
lormTan_subsector3.setTan_cursocu(lormTan_curso3 );
lormTan_subsectorDAO.save(lormTan_subsector3);
orm.Tan_curso lormTan_curso4 = lormTan_cursoDAO.getTan_cursoByORMID(a+3);
orm.Tan_subsector lormTan_subsector4 = lormTan_subsectorDAO.createTan_subsector();
// TODO Initialize the properties of the persistent object here, the following properties must be initialized before saving : tda_anotacion, tan_nombre
lormTan_subsector4.setSu_descripcion("Matematicas");
lormTan_subsector4.setTan_cursocu(lormTan_curso4 );
lormTan_subsectorDAO.save(lormTan_subsector4);
orm.Tan_curso lormTan_curso5 = lormTan_cursoDAO.getTan_cursoByORMID(a+4);
orm.Tan_subsector lormTan_subsector5 = lormTan_subsectorDAO.createTan_subsector();
// TODO Initialize the properties of the persistent object here, the following properties must be initialized before saving : tda_anotacion, tan_nombre
lormTan_subsector5.setSu_descripcion("Matemtacias");
lormTan_subsector5.setTan_cursocu(lormTan_curso5 );
lormTan_subsectorDAO.save(lormTan_subsector5);
orm.Tan_subsector lormTan_subsector6 = lormTan_subsectorDAO.createTan_subsector();
orm.Tan_curso lormTan_curso6 = lormTan_cursoDAO.getTan_cursoByORMID(a);
// TODO Initialize the properties of the persistent object here, the following properties must be initialized before saving : tda_anotacion, tan_nombre
lormTan_subsector6.setSu_descripcion("Lenguaje");
lormTan_subsector6.setTan_cursocu(lormTan_curso6 );
lormTan_subsectorDAO.save(lormTan_subsector6);
orm.Tan_curso lormTan_curso7 = lormTan_cursoDAO.getTan_cursoByORMID(a+1);
orm.Tan_subsector lormTan_subsector7 = lormTan_subsectorDAO.createTan_subsector();
// TODO Initialize the properties of the persistent object here, the following properties must be initialized before saving : tda_anotacion, tan_nombre
lormTan_subsector7.setSu_descripcion("Lenguaje");
lormTan_subsector7.setTan_cursocu(lormTan_curso7 );
lormTan_subsectorDAO.save(lormTan_subsector7);
orm.Tan_curso lormTan_curso8 = lormTan_cursoDAO.getTan_cursoByORMID(a+2);
orm.Tan_subsector lormTan_subsector8 = lormTan_subsectorDAO.createTan_subsector();
// TODO Initialize the properties of the persistent object here, the following properties must be initialized before saving : tda_anotacion, tan_nombre
lormTan_subsector8.setSu_descripcion("Lenguaje");
lormTan_subsector8.setTan_cursocu(lormTan_curso8 );
lormTan_subsectorDAO.save(lormTan_subsector8);
orm.Tan_curso lormTan_curso9 = lormTan_cursoDAO.getTan_cursoByORMID(a+3);
orm.Tan_subsector lormTan_subsector9 = lormTan_subsectorDAO.createTan_subsector();
// TODO Initialize the properties of the persistent object here, the following properties must be initialized before saving : tda_anotacion, tan_nombre
lormTan_subsector9.setSu_descripcion("Lenguaje");
lormTan_subsector9.setTan_cursocu(lormTan_curso9 );
lormTan_subsectorDAO.save(lormTan_subsector9);
orm.Tan_curso lormTan_curso10 = lormTan_cursoDAO.getTan_cursoByORMID(a+4);
orm.Tan_subsector lormTan_subsector10 = lormTan_subsectorDAO.createTan_subsector();
// TODO Initialize the properties of the persistent object here, the following properties must be initialized before saving : tda_anotacion, tan_nombre
lormTan_subsector10.setSu_descripcion("Lenguaje");
lormTan_subsector10.setTan_cursocu(lormTan_curso10 );
lormTan_subsectorDAO.save(lormTan_subsector10);
orm.Tan_curso lormTan_curso11 = lormTan_cursoDAO.getTan_cursoByORMID(a);
orm.Tan_subsector lormTan_subsector11 = lormTan_subsectorDAO.createTan_subsector();
// TODO Initialize the properties of the persistent object here, the following properties must be initialized before saving : tda_anotacion, tan_nombre
lormTan_subsector11.setSu_descripcion("Ingles");
lormTan_subsector11.setTan_cursocu(lormTan_curso11 );
lormTan_subsectorDAO.save(lormTan_subsector11);
orm.Tan_curso lormTan_curso12 = lormTan_cursoDAO.getTan_cursoByORMID(a+1);
orm.Tan_subsector lormTan_subsector12 = lormTan_subsectorDAO.createTan_subsector();
// TODO Initialize the properties of the persistent object here, the following properties must be initialized before saving : tda_anotacion, tan_nombre
lormTan_subsector12.setTan_cursocu(lormTan_curso12 );
lormTan_subsector12.setSu_descripcion("Ingles");
lormTan_subsectorDAO.save(lormTan_subsector12);
orm.Tan_curso lormTan_curso13 = lormTan_cursoDAO.getTan_cursoByORMID(a+2);
orm.Tan_subsector lormTan_subsector13 = lormTan_subsectorDAO.createTan_subsector();
// TODO Initialize the properties of the persistent object here, the following properties must be initialized before saving : tda_anotacion, tan_nombre
lormTan_subsector13.setSu_descripcion("Ingles");
lormTan_subsector13.setTan_cursocu(lormTan_curso13 );
lormTan_subsectorDAO.save(lormTan_subsector13);
orm.Tan_curso lormTan_curso14 = lormTan_cursoDAO.getTan_cursoByORMID(a+3);
orm.Tan_subsector lormTan_subsector14 = lormTan_subsectorDAO.createTan_subsector();
// TODO Initialize the properties of the persistent object here, the following properties must be initialized before saving : tda_anotacion, tan_nombre
lormTan_subsector14.setSu_descripcion("Ingles");
lormTan_subsector14.setTan_cursocu(lormTan_curso14 );
lormTan_subsectorDAO.save(lormTan_subsector14);
orm.Tan_curso lormTan_curso15 = lormTan_cursoDAO.getTan_cursoByORMID(a+4);
orm.Tan_subsector lormTan_subsector15 = lormTan_subsectorDAO.createTan_subsector();
// TODO Initialize the properties of the persistent object here, the following properties must be initialized before saving : tda_anotacion, tan_nombre
lormTan_subsector15.setSu_descripcion("Ingles");
lormTan_subsector15.setTan_cursocu(lormTan_curso15 );
lormTan_subsectorDAO.save(lormTan_subsector15);
t.commit();
}
catch (Exception e) {
t.rollback();
}
}
public static void main(String[] args) {
try {
CreateSubsectorData CreateData = new CreateSubsectorData();
try {
CreateData.createTestData();
}
finally {
orm.BdAnotacionesPersistentManager.instance().disposePersistentManager();
}
}
catch (Exception e) {
e.printStackTrace();
}
}
}
| Java |
/**
* Licensee: DuKe TeAm
* License Type: Purchased
*/
package Otros;
import org.orm.*;
import orm.BdAnotacionesPersistentManager;
public class CreateTipoAnotacionesData {
public void createTestData() throws PersistentException {
PersistentTransaction t = BdAnotacionesPersistentManager.instance().getSession().beginTransaction();
try {
orm.DAOFactory lDAOFactory = orm.DAOFactory.getDAOFactory();
orm.dao.Tan_tipo_anotacionDAO lormTan_tipo_anotacionDAO = lDAOFactory.getTan_tipo_anotacionDAO();
orm.Tan_tipo_anotacion lormTan_tipo_anotacion = lormTan_tipo_anotacionDAO.createTan_tipo_anotacion();
// TODO Initialize the properties of the persistent object here, the following properties must be initialized before saving : tda_anotacion, tan_nombre
lormTan_tipo_anotacion.setTa_descripcion("neutro");
lormTan_tipo_anotacionDAO.save(lormTan_tipo_anotacion);
orm.Tan_tipo_anotacion lormTan_tipo_anotacion2 = lormTan_tipo_anotacionDAO.createTan_tipo_anotacion();
// TODO Initialize the properties of the persistent object here, the following properties must be initialized before saving : tda_anotacion, tan_nombre
lormTan_tipo_anotacion2.setTa_descripcion("positivo");
lormTan_tipo_anotacionDAO.save(lormTan_tipo_anotacion2);
orm.Tan_tipo_anotacion lormTan_tipo_anotacion3 = lormTan_tipo_anotacionDAO.createTan_tipo_anotacion();
// TODO Initialize the properties of the persistent object here, the following properties must be initialized before saving : tda_anotacion, tan_nombre
lormTan_tipo_anotacion3.setTa_descripcion("negativo");
lormTan_tipo_anotacionDAO.save(lormTan_tipo_anotacion3);
t.commit();
}
catch (Exception e) {
t.rollback();
}
}
public static void main(String[] args) {
try {
CreateTipoAnotacionesData createAnotacionesData = new CreateTipoAnotacionesData();
try {
createAnotacionesData.createTestData();
}
finally {
orm.BdAnotacionesPersistentManager.instance().disposePersistentManager();
}
}
catch (Exception e) {
e.printStackTrace();
}
}
} | Java |
package ws;
import java.util.ArrayList;
import java.util.Collection;
import org.orm.PersistentException;
import SOAPVO.AlumnoSOAPVO;
import com.google.gson.Gson;
public class AlumnoSOA {
/**
* Metodo que realiza una busqueda por curso de todos los alumnos existentes.
* @return json almacena todos los registros encontrados
*/
public static String find(int cursoId) {
String json = null;
orm.DAOFactory lDAOFactory = orm.DAOFactory.getDAOFactory();
Collection<AlumnoSOAPVO> colectionAlumnoSOAPVO = new ArrayList<AlumnoSOAPVO>();
orm.Tan_alumno[] ormAlumnos;
try { // Buscamos alumnos por id del curso.
ormAlumnos = lDAOFactory.getTan_alumnoDAO().listTan_alumnoByQuery( "tan_cursocu_id='" + cursoId + "'", null);
for (int i = 0; i < ormAlumnos.length; i++) {
System.out.println(ormAlumnos[i].getAl_nombre());
AlumnoSOAPVO objeto = AlumnoSOAPVO.crearAlumnoSOAPVO(ormAlumnos[i]);
colectionAlumnoSOAPVO.add(objeto);
}// Guardamos los datos en json.
Gson gson = new Gson();
json = gson.toJson(colectionAlumnoSOAPVO);
} catch (PersistentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return json;
}
}
| Java |
package cl.clientesws;
import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.PropertyInfo;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapPrimitive;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.AndroidHttpTransport;
public class PersonasSOAWS {
private static String METHOD_NAME ;
private static String NAMESPACE ;
private static String URL;
/*
*
*/
public void coneccionwsPropio(){
NAMESPACE = "http://ws";
METHOD_NAME = "add";
URL = "http://192.168.1.2:8080/TallerSOA/services/PersonaSOA";
}
/**
*
* @param rut
* @param verificador
* @param nombre
* @param sexo
* @return
*/
public String addPersona(String rut, String verificador, String nombre,
int sexo){
coneccionwsPropio();
METHOD_NAME = "add";
String SOAP_ACTION = NAMESPACE + METHOD_NAME;
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
PropertyInfo addrut = new PropertyInfo();
PropertyInfo addverificador = new PropertyInfo();
PropertyInfo addnombre = new PropertyInfo();
PropertyInfo addsexo = new PropertyInfo();
addrut.setName("rut");
addrut.setValue(rut);
addrut.setType(String.class);
addverificador.setName("verificador");
addverificador.setValue(verificador);
addverificador.setType(String.class);
addnombre.setName("nombre");
addnombre.setValue(nombre);
addnombre.setType(String.class);
addsexo.setName("sexo");
addsexo.setValue(sexo);
addsexo.setType(int.class);
request.addProperty(addrut);
request.addProperty(addverificador);
request.addProperty(addnombre);
request.addProperty(addsexo);
SoapSerializationEnvelope soapEnvelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
soapEnvelope.dotNet = true;
soapEnvelope.implicitTypes =true;
soapEnvelope.setOutputSoapObject(request);
AndroidHttpTransport aht = new AndroidHttpTransport(URL);
String datosJsonString;
try
{
aht.call(SOAP_ACTION, soapEnvelope);
SoapPrimitive resultString = (SoapPrimitive)soapEnvelope.getResponse();
datosJsonString =resultString.toString();
return datosJsonString;
}
catch (Exception e)
{
e.printStackTrace();
// en caso de no tener acceso al web service
datosJsonString = "Error Conexion";}
return datosJsonString;
}
public String updatePersona(String nomRut, int campo, String nuevoRutName
){
coneccionwsPropio();
METHOD_NAME = "update";
String SOAP_ACTION = NAMESPACE + METHOD_NAME;
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
PropertyInfo updatenomRut = new PropertyInfo();
PropertyInfo updatecampo = new PropertyInfo();
PropertyInfo updatenuevoRutName = new PropertyInfo();
updatenomRut.setName("rut");
updatenomRut.setValue(nomRut);
updatenomRut.setType(String.class);
updatecampo.setName("campo");
updatecampo.setValue(campo);
updatecampo.setType(int.class);
updatenuevoRutName.setName("verificador");
updatenuevoRutName.setValue(nuevoRutName);
updatenuevoRutName.setType(String.class);
request.addProperty(updatenomRut);
request.addProperty(updatecampo);
request.addProperty(updatenuevoRutName);
SoapSerializationEnvelope soapEnvelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
soapEnvelope.dotNet = true;
soapEnvelope.implicitTypes =true;
soapEnvelope.setOutputSoapObject(request);
AndroidHttpTransport aht = new AndroidHttpTransport(URL);
String datosJsonString;
try
{
aht.call(SOAP_ACTION, soapEnvelope);
SoapPrimitive resultString = (SoapPrimitive)soapEnvelope.getResponse();
datosJsonString =resultString.toString();
return datosJsonString;
}
catch (Exception e)
{
e.printStackTrace();
// en caso de no tener acceso al web service
datosJsonString = "Error Conexion";}
return datosJsonString;
}
public String borrarPersona(String rut){
coneccionwsPropio();
METHOD_NAME = "borrar";
String SOAP_ACTION = NAMESPACE + METHOD_NAME;
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
PropertyInfo borrarRut = new PropertyInfo();
borrarRut.setName("rut");
borrarRut.setValue(rut);
borrarRut.setType(String.class);
request.addProperty(borrarRut);
SoapSerializationEnvelope soapEnvelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
soapEnvelope.dotNet = true;
soapEnvelope.implicitTypes =true;
soapEnvelope.setOutputSoapObject(request);
AndroidHttpTransport aht = new AndroidHttpTransport(URL);
String datosJsonString;
try
{
aht.call(SOAP_ACTION, soapEnvelope);
SoapPrimitive resultString = (SoapPrimitive)soapEnvelope.getResponse();
datosJsonString =resultString.toString();
return datosJsonString;
}
catch (Exception e)
{
e.printStackTrace();
// en caso de no tener acceso al web service
datosJsonString = "Error Conexion";}
return datosJsonString;
}
public String findPersona(String buscar){
coneccionwsPropio();
METHOD_NAME = "find";
String SOAP_ACTION = NAMESPACE + METHOD_NAME;
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
PropertyInfo findBuscar = new PropertyInfo();
findBuscar.setName("buscar");
findBuscar.setValue(buscar);
findBuscar.setType(String.class);
request.addProperty(findBuscar);
SoapSerializationEnvelope soapEnvelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
soapEnvelope.dotNet = true;
soapEnvelope.implicitTypes =true;
soapEnvelope.setOutputSoapObject(request);
AndroidHttpTransport aht = new AndroidHttpTransport(URL);
String datosJsonString;
try
{
aht.call(SOAP_ACTION, soapEnvelope);
SoapPrimitive resultString = (SoapPrimitive)soapEnvelope.getResponse();
datosJsonString =resultString.toString();
return datosJsonString;
}
catch (Exception e)
{
e.printStackTrace();
// en caso de no tener acceso al web service
datosJsonString = "Error Conexion";}
return datosJsonString;
}
public String finAllPersona(String buscar){
coneccionwsPropio();
METHOD_NAME = "borrar";
String SOAP_ACTION = NAMESPACE + METHOD_NAME;
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
PropertyInfo findBuscar = new PropertyInfo();
findBuscar.setName("buscar");
findBuscar.setValue(buscar);
findBuscar.setType(String.class);
request.addProperty(findBuscar);
SoapSerializationEnvelope soapEnvelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
soapEnvelope.dotNet = true;
soapEnvelope.implicitTypes =true;
soapEnvelope.setOutputSoapObject(request);
AndroidHttpTransport aht = new AndroidHttpTransport(URL);
String datosJsonString;
try
{
aht.call(SOAP_ACTION, soapEnvelope);
SoapPrimitive resultString = (SoapPrimitive)soapEnvelope.getResponse();
datosJsonString =resultString.toString();
return datosJsonString;
}
catch (Exception e)
{
e.printStackTrace();
// en caso de no tener acceso al web service
datosJsonString = "Error Conexion";}
return datosJsonString;
}
}
| Java |
package cl.clientesws;
import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.PropertyInfo;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapPrimitive;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.AndroidHttpTransport;
public class PublicacionesSOAWS {
private static String METHOD_NAME ;
private static String NAMESPACE ;
private static String URL;
/*
*
*/
public void coneccionwsPropio(){
NAMESPACE = "http://ws";
METHOD_NAME = "add";
URL = "http://192.168.1.2:8080/TallerSOA/services/PublicacionSOA";
}
/**
*
* @param rut
* @param verificador
* @param nombre
* @param sexo
* @return
*/
public String addPublicacion(String pub_mon, String pub_des, String pers_rut){
coneccionwsPropio();
METHOD_NAME = "add";
String SOAP_ACTION = NAMESPACE + METHOD_NAME;
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
PropertyInfo addMonto = new PropertyInfo();
PropertyInfo addDescripcion = new PropertyInfo();
PropertyInfo addRut = new PropertyInfo();
addMonto.setName("pub_mon");
addMonto.setValue(pub_mon);
addMonto.setType(String.class);
addDescripcion.setName("pub_des");
addDescripcion.setValue(pub_des);
addDescripcion.setType(String.class);
addRut.setName("pers_rut");
addRut.setValue(pers_rut);
addRut.setType(String.class);
request.addProperty(addMonto);
request.addProperty(addDescripcion);
request.addProperty(addRut);
SoapSerializationEnvelope soapEnvelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
soapEnvelope.dotNet = true;
soapEnvelope.implicitTypes =true;
soapEnvelope.setOutputSoapObject(request);
AndroidHttpTransport aht = new AndroidHttpTransport(URL);
String datosJsonString;
try
{
aht.call(SOAP_ACTION, soapEnvelope);
SoapPrimitive resultString = (SoapPrimitive)soapEnvelope.getResponse();
datosJsonString =resultString.toString();
return datosJsonString;
}
catch (Exception e)
{
e.printStackTrace();
// en caso de no tener acceso al web service
datosJsonString = "Error Conexion";}
return datosJsonString;
}
public String updatePublicacion(String id, int campo, String nuevoValor
){
coneccionwsPropio();
METHOD_NAME = "update";
String SOAP_ACTION = NAMESPACE + METHOD_NAME;
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
PropertyInfo updateId = new PropertyInfo();
PropertyInfo updatecampo= new PropertyInfo();
PropertyInfo updatenuevoValor = new PropertyInfo();
updateId.setName("id");
updateId.setValue(id);
updateId.setType(String.class);
updatecampo.setName("campo");
updatecampo.setValue(campo);
updatecampo.setType(int.class);
updatenuevoValor.setName("nuevoValor");
updatenuevoValor.setValue(nuevoValor);
updatenuevoValor.setType(String.class);
request.addProperty(updateId);
request.addProperty(updatecampo);
request.addProperty(updatenuevoValor);
SoapSerializationEnvelope soapEnvelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
soapEnvelope.dotNet = true;
soapEnvelope.implicitTypes =true;
soapEnvelope.setOutputSoapObject(request);
AndroidHttpTransport aht = new AndroidHttpTransport(URL);
String datosJsonString;
try
{
aht.call(SOAP_ACTION, soapEnvelope);
SoapPrimitive resultString = (SoapPrimitive)soapEnvelope.getResponse();
datosJsonString =resultString.toString();
return datosJsonString;
}
catch (Exception e)
{
e.printStackTrace();
// en caso de no tener acceso al web service
datosJsonString = "Error Conexion";}
return datosJsonString;
}
public String borrarPublicacion(String id){
coneccionwsPropio();
METHOD_NAME = "borrar";
String SOAP_ACTION = NAMESPACE + METHOD_NAME;
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
PropertyInfo borrarId = new PropertyInfo();
borrarId.setName("id");
borrarId.setValue(id);
borrarId.setType(String.class);
request.addProperty(borrarId);
SoapSerializationEnvelope soapEnvelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
soapEnvelope.dotNet = true;
soapEnvelope.implicitTypes =true;
soapEnvelope.setOutputSoapObject(request);
AndroidHttpTransport aht = new AndroidHttpTransport(URL);
String datosJsonString;
try
{
aht.call(SOAP_ACTION, soapEnvelope);
SoapPrimitive resultString = (SoapPrimitive)soapEnvelope.getResponse();
datosJsonString =resultString.toString();
return datosJsonString;
}
catch (Exception e)
{
e.printStackTrace();
// en caso de no tener acceso al web service
datosJsonString = "Error Conexion";}
return datosJsonString;
}
public String findPublicacion(String buscar){
coneccionwsPropio();
METHOD_NAME = "find";
String SOAP_ACTION = NAMESPACE + METHOD_NAME;
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
PropertyInfo findBuscar = new PropertyInfo();
findBuscar.setName("buscar");
findBuscar.setValue(buscar);
findBuscar.setType(String.class);
request.addProperty(findBuscar);
SoapSerializationEnvelope soapEnvelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
soapEnvelope.dotNet = true;
soapEnvelope.implicitTypes =true;
soapEnvelope.setOutputSoapObject(request);
AndroidHttpTransport aht = new AndroidHttpTransport(URL);
String datosJsonString;
try
{
aht.call(SOAP_ACTION, soapEnvelope);
SoapPrimitive resultString = (SoapPrimitive)soapEnvelope.getResponse();
datosJsonString =resultString.toString();
return datosJsonString;
}
catch (Exception e)
{
e.printStackTrace();
// en caso de no tener acceso al web service
datosJsonString = "Error Conexion";}
return datosJsonString;
}
public String finAllPublicacion(String buscar){
coneccionwsPropio();
METHOD_NAME = "borrar";
String SOAP_ACTION = NAMESPACE + METHOD_NAME;
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
PropertyInfo findBuscar = new PropertyInfo();
findBuscar.setName("buscar");
findBuscar.setValue(buscar);
findBuscar.setType(String.class);
request.addProperty(findBuscar);
SoapSerializationEnvelope soapEnvelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
soapEnvelope.dotNet = true;
soapEnvelope.implicitTypes =true;
soapEnvelope.setOutputSoapObject(request);
AndroidHttpTransport aht = new AndroidHttpTransport(URL);
String datosJsonString;
try
{
aht.call(SOAP_ACTION, soapEnvelope);
SoapPrimitive resultString = (SoapPrimitive)soapEnvelope.getResponse();
datosJsonString =resultString.toString();
return datosJsonString;
}
catch (Exception e)
{
e.printStackTrace();
// en caso de no tener acceso al web service
datosJsonString = "Error Conexion";}
return datosJsonString;
}
}
| Java |
package cl.vo;
public class DatosPublicaciones {
/**
*
*/
public String monto;
/**
*
*/
public String descripcion;
/**
*
*/
public String rut;
/**
*
* @return
*/
public String getMonto() {
return monto;
}
/**
*
* @param monto
*/
public void setMonto(String monto) {
this.monto = monto;
}
/**
*
* @return
*/
public String getDescripcion() {
return descripcion;
}
/**
*
* @param descripcion
*/
public void setDescripcion(String descripcion) {
this.descripcion = descripcion;
}
/**
*
* @return
*/
public String getRut() {
return rut;
}
/**
*
* @param rut
*/
public void setRut(String rut) {
this.rut = rut;
}
} | Java |
package cl.vo;
public class DatosPersona {
/**
*
*/
public String rut;
/**
*
*/
public String nombre;
/**
*
*/
public String sexo;
/**
*
* @return
*/
public String getRut() {
return rut;
}
/**
*
* @param rut
*/
public void setRut(String rut) {
this.rut = rut;
}
/**
*
* @return
*/
public String getNombre() {
return nombre;
}
/**
*
* @param nombre
*/
public void setNombre(String nombre) {
this.nombre = nombre;
}
public String getSexo() {
return sexo;
}
/**
*
* @param sexo
*/
public void setSexo(String sexo) {
this.sexo = sexo;
}
}
| Java |
package cl.clientesoa;
import android.app.Activity;
import android.os.Bundle;
public class ClienteSOAOFERTA extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
} | Java |
package cl.clientesoa;
import android.app.TabActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.widget.TabHost;
/**
* Clase que contiene las Tab de la aplicacion
* @author MariaJose
*
*/
public class TabSoaOferta extends TabActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.tabsoa);
Resources res = getResources();
TabHost tabHost = getTabHost();
TabHost.TabSpec spec;
Intent intent;
// Se crea cada Tab en la tabHost
// Se crea Intent por cada llamada de la actividad del tab
//TabPersonas
intent = new Intent().setClass(this, Tab_PersonasSoa.class);
spec = tabHost.newTabSpec("personas").setIndicator("Personas",res.getDrawable(R.drawable.ic_launcher)).setContent(intent);
tabHost.addTab(spec);
//TabPublicaciones
intent = new Intent().setClass(this, Tab_PublicacionesSoa.class);
spec = tabHost.newTabSpec("publicaciones").setIndicator("Publicaciones",
res.getDrawable(R.drawable.ic_launcher)).setContent(intent);
tabHost.addTab(spec);
}
} | Java |
package cl.clientesoa;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.Toast;
import cl.clientesws.*;
/**
* Clase que maneja las operaciones CRUD de las personas
* @author Renato
*
*/ public class Tab_PersonasSoa extends Activity{
private Button btn_add;
private Button btn_update;
private Button btn_delete;
private Button btn_findall;
private Button btn_find;
private PersonasSOAWS pws = new PersonasSOAWS();
private String respuesta;
@Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
/*carga la vista del layout opcionessoa*/
this.setContentView(R.layout.opcionessoa);
btn_add = (Button) findViewById(R.id.btnadd);
btn_update = (Button) findViewById(R.id.btn_update);
btn_delete = (Button) findViewById(R.id.btn_delete);
btn_findall = (Button) findViewById(R.id.btn_allfind);
btn_find = (Button) findViewById(R.id.btn_find);
btn_add.setOnClickListener(clickbtn);
btn_update.setOnClickListener(clickbtn);
btn_delete.setOnClickListener(clickbtn);
btn_findall.setOnClickListener(clickbtn);
btn_find.setOnClickListener(clickbtn);
}
//evento on Click que se genera con los botones
private OnClickListener clickbtn = new OnClickListener() {
// @Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.btnadd:
//llamada al metodo ingresar persona
alertDialodIngreasarPersona();
break;
case R.id.btn_update:
//llamada al metodo actualizar persona
alertDialodActualizarPersona();
break;
case R.id.btn_delete:
//llamada al metodo eliminar persona
alertDialodDeletePersona();
break;
case R.id.btn_allfind:
//llamada al metodo buscar todas las personas
alertDialodFindAllPersona();
break;
case R.id.btn_find:
//llamada al metodo de buscar persona
alertDialodFindPersona();
break;
}
}
};
/**
* Metodo que ingresa los datos de una persona.
* @return void
* @author MariaJose
*/
public void alertDialodIngreasarPersona(){
LayoutInflater factory = LayoutInflater.from(this);
final View textEntryView = factory.inflate(R.layout.addpersona, null);
AlertDialog.Builder alert = new AlertDialog.Builder(this);
alert.setTitle("Ingrese Persona");
alert.setView(textEntryView);
alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
/*declara variables de los compontes que se encuentran
en la vista del layout del AlertDialog*/
EditText textorut;
EditText textodig;
EditText textnombre;
RadioButton radio_masculino;
RadioButton radio_femenino;
textorut = (EditText) textEntryView.findViewById(R.id.edit_rut);
textodig = (EditText) textEntryView.findViewById(R.id.edit_dig);
textnombre = (EditText) textEntryView.findViewById(R.id.edit_nombre);
radio_femenino = (RadioButton) textEntryView.findViewById(R.id.radioFemenino);
radio_masculino = (RadioButton) textEntryView.findViewById(R.id.radioMasculino);
//extrae el valor que fue escrito en los EditText por el usuario
String rut = textorut.getText().toString();
String verificador = textodig.getText().toString();
String nombre = textnombre.getText().toString();
//le da un valor al sexo segun radioButton seleccionado
int sexo = -1;
if(radio_femenino.isChecked())
{
sexo = 0;
}
if(radio_masculino.isChecked())
{
sexo = 1;
}
if(rut.equals("") || verificador.equals("") || nombre.equals("")|| sexo == -1){
alertDialodIngreasarPersona();
}
else{
//llama al Servicio Web addPersona()
String resultado = pws.addPersona(rut, verificador, nombre, sexo);
Toast.makeText(getBaseContext(), resultado,
Toast.LENGTH_SHORT).show();
return;
}
}
});
alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
return;
}
});
alert.show();
}
/**
* Metodo que actualiza los datos de una persona.
* @return void
* @author MariaJose
*/
public void alertDialodActualizarPersona(){
LayoutInflater factory = LayoutInflater.from(this);
final View textEntryView = factory.inflate(R.layout.updatepersona, null);
AlertDialog.Builder alert = new AlertDialog.Builder(this);
alert.setTitle("Actualizar Persona");
alert.setView(textEntryView);
alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
EditText textorutonombre;
EditText textonuevo;
RadioButton radio_nombre;
RadioButton radio_rut;
RadioButton radio_digito;
RadioButton radio_sexo;
textorutonombre = (EditText) textEntryView.findViewById(R.id.edit_rut_nombre);
textonuevo = (EditText) textEntryView.findViewById(R.id.edit_nuevovalor);
radio_nombre = (RadioButton) textEntryView.findViewById(R.id.radionombre);
radio_rut = (RadioButton) textEntryView.findViewById(R.id.radiorut);
radio_digito = (RadioButton) textEntryView.findViewById(R.id.radiodigito);
radio_sexo = (RadioButton) textEntryView.findViewById(R.id.radiosexo);
String rutonombre = textorutonombre.getText().toString();
String nuevocampo = textonuevo.getText().toString();
int opcionRbtn = -1;
if(radio_nombre.isChecked())
{
opcionRbtn = 0;
}
if(radio_rut.isChecked()){
opcionRbtn = 1;
}
if(radio_digito.isChecked()){
opcionRbtn = 2;
}
if(radio_sexo.isChecked()){
opcionRbtn = 3;
}
if(rutonombre.equals("") || nuevocampo.equals("")|| opcionRbtn == -1){
alertDialodActualizarPersona();
}
else{
String resultado = pws.updatePersona(rutonombre, opcionRbtn, nuevocampo);
Toast.makeText(getBaseContext(), resultado,
Toast.LENGTH_SHORT).show();
return;
}
}
});
alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
return;
}
});
alert.show();
}
/**
* Metodo que elimina una persona segun su rut.
* @return void
* @author MariaJose
*/
public void alertDialodDeletePersona(){
LayoutInflater factory = LayoutInflater.from(this);
final View textEntryView = factory.inflate(R.layout.deletepersona, null);
AlertDialog.Builder alert = new AlertDialog.Builder(this);
alert.setTitle("Eliminar Persona");
alert.setView(textEntryView);
alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
EditText textorut;
textorut = (EditText) textEntryView.findViewById(R.id.edit_rut_delete);
String rut = textorut.getText().toString();
if(rut.equals("")){
alertDialodDeletePersona();
}
else{
String resultado = pws.borrarPersona(rut);
Toast.makeText(getBaseContext(), resultado,
Toast.LENGTH_SHORT).show();
return;
}
}
});
alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
return;
}
});
alert.show();
}
/**
* Metodo que busca a una persona.
* @return void
* @author MariaJose
*/
public void alertDialodFindPersona(){
LayoutInflater factory = LayoutInflater.from(this);
final View textEntryView = factory.inflate(R.layout.findpersona, null);
AlertDialog.Builder alert = new AlertDialog.Builder(this);
alert.setTitle("Buscar Persona");
alert.setView(textEntryView);
alert.setPositiveButton("Buscar", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
EditText textoFind;
textoFind = (EditText) textEntryView.findViewById(R.id.edit_find_persona);
String buscar = textoFind.getText().toString();
if(buscar.equals("")){
alertDialodFindPersona();
}
else{
/**
* realiza la llamada de buscar al Ws
*/
respuesta = pws.findPersona(buscar); Toast.makeText(Tab_PersonasSoa.this, respuesta, Toast.LENGTH_LONG).show();
return;
}
}
});
alert.setNegativeButton("Salir", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
return;
}
});
alert.show();
}
/**
* Metodo que busca a todas las personas segun parametro de busqueda.
* @return void
* @author MariaJose
*/
public void alertDialodFindAllPersona(){
LayoutInflater factory = LayoutInflater.from(this);
final View textEntryView = factory.inflate(R.layout.findpersona, null);
AlertDialog.Builder alert = new AlertDialog.Builder(this);
alert.setTitle("Buscar registros con :");
alert.setView(textEntryView);
alert.setPositiveButton("Buscar", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
EditText textoFind;
textoFind = (EditText) textEntryView.findViewById(R.id.edit_find_persona);
String buscar = textoFind.getText().toString();
/*
* realiza la llamada de buscar al Ws y lanza una nueva actividad
* para mostrar los datos de la busqueda.
*/
respuesta = pws.finAllPersona(buscar);
Intent i = new Intent(); i.setClass(Tab_PersonasSoa.this, ResultadoFindPersona.class);
//entrega el Json que es devuelto por el servicio
i.putExtra("datos", respuesta);
startActivity(i);
return;
}
});
alert.setNegativeButton("Salir", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
return;
}
});
alert.show();
}
} | Java |
package ufro.pdssoaws;
import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.PropertyInfo;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapPrimitive;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.AndroidHttpTransport;
public class AlumnoSOAWS {
private static String METHOD_NAME ;
private static String NAMESPACE ;
private static String URL;
/*
*
*/
public void coneccionwsPropio(){
NAMESPACE = "http://ws";
URL = "http://192.168.1.2:8080/ProyectoAnotacionesFinal/services/AlumnoSOA?wsdl";
}
/**
* Metodo que llama al metodo find del ws
* @param cursoId
* @return Json
*/
public String findAlumno(int cursoId){
coneccionwsPropio();
METHOD_NAME = "find";
String SOAP_ACTION = NAMESPACE + METHOD_NAME;
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
PropertyInfo findcursoId = new PropertyInfo();
findcursoId.setName("cursoId");
findcursoId.setValue(cursoId);
findcursoId.setType(int.class);
request.addProperty(findcursoId);
SoapSerializationEnvelope soapEnvelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
soapEnvelope.dotNet = true;
soapEnvelope.implicitTypes =true;
soapEnvelope.setOutputSoapObject(request);
AndroidHttpTransport aht = new AndroidHttpTransport(URL);
String datosJsonString;
try
{
aht.call(SOAP_ACTION, soapEnvelope);
SoapPrimitive resultString = (SoapPrimitive)soapEnvelope.getResponse();
datosJsonString =resultString.toString();
return datosJsonString;
}
catch (Exception e)
{
e.printStackTrace();
// en caso de no tener acceso al web service
datosJsonString = "Error Conexion";}
return datosJsonString;
}
}
| Java |
package ufro.pdssoaws;
import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.PropertyInfo;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapPrimitive;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.AndroidHttpTransport;
public class AnotacionesSOAWS {
private static String METHOD_NAME ;
private static String NAMESPACE ;
private static String URL;
/*
*
*/
public void coneccionwsPropio(){
NAMESPACE = "http://ws";
METHOD_NAME = "add";
URL = "http://192.168.1.2:8080/ProyectoAnotacionesFinal/services/AnotacionSOA?wsdl";
}
/**
*
* @param fecha String
* @param descripcion String
* @param id_tipo_anotacion int
* @param rut_anotador String
* @param rut_alumno String
* @return json
*/
public String add( String fecha, String descripcion,int id_tipo_anotacion, String rut_anotador, String rut_alumno) {
coneccionwsPropio();
METHOD_NAME = "add";
String SOAP_ACTION = NAMESPACE + METHOD_NAME;
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
PropertyInfo addfecha = new PropertyInfo();
PropertyInfo adddescrip = new PropertyInfo();
PropertyInfo addid_tipo_anotacion = new PropertyInfo();
PropertyInfo addrut_anotador = new PropertyInfo();
PropertyInfo addrut_alumno = new PropertyInfo();
addfecha.setName("fecha");
addfecha.setValue(fecha);
addfecha.setType(String.class);
request.addProperty(addfecha);
adddescrip.setName("descripcion");
adddescrip.setValue(descripcion);
adddescrip.setType(String.class);
request.addProperty(adddescrip);
addid_tipo_anotacion.setName("tipoAnotacion");
addid_tipo_anotacion.setValue(id_tipo_anotacion);
addid_tipo_anotacion.setType(int.class);
request.addProperty(addid_tipo_anotacion);
addrut_anotador.setName("rutAnotador");
addrut_anotador.setValue(rut_anotador);
addrut_anotador.setType(String.class);
request.addProperty(addrut_anotador);
addrut_alumno.setName("rutAlumno");
addrut_alumno.setValue(rut_alumno);
addrut_alumno.setType(String.class);
request.addProperty(addrut_alumno);
SoapSerializationEnvelope soapEnvelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
soapEnvelope.dotNet = true;
soapEnvelope.implicitTypes =true;
soapEnvelope.setOutputSoapObject(request);
AndroidHttpTransport aht = new AndroidHttpTransport(URL);
String datosJsonString;
try
{
aht.call(SOAP_ACTION, soapEnvelope);
SoapPrimitive resultString = (SoapPrimitive)soapEnvelope.getResponse();
datosJsonString =resultString.toString();
return datosJsonString;
}
catch (Exception e)
{
e.printStackTrace();
// en caso de no tener acceso al web service
datosJsonString = "Error ";}
return datosJsonString;
}
/**
*
* @return json
*/
public String verAnotaciones(){
coneccionwsPropio();
METHOD_NAME = "verAnotaciones";
String SOAP_ACTION = NAMESPACE + METHOD_NAME;
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
SoapSerializationEnvelope soapEnvelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
soapEnvelope.dotNet = true;
soapEnvelope.implicitTypes =true;
soapEnvelope.setOutputSoapObject(request);
AndroidHttpTransport aht = new AndroidHttpTransport(URL);
String datosJsonString;
try
{
aht.call(SOAP_ACTION, soapEnvelope);
SoapPrimitive resultString = (SoapPrimitive)soapEnvelope.getResponse();
datosJsonString =resultString.toString();
return datosJsonString;
}
catch (Exception e)
{
e.printStackTrace();
// en caso de no tener acceso al web service
datosJsonString = "Error Conexion";}
return datosJsonString;
}
}
| Java |
package ufro.pdsvo;
public class DatosAnotador{
String rut;
String nombre;
int id;
/**
*
* @return
*/
public int getId(){
return id;
}
/**
*
* @param id
*/
public void setId(int id){
this.id = id;
}
/**
*
* @return
*/
public String getRut() {
return rut;
}
/**
*
* @param rut
*/
public void setRut(String rut) {
this.rut = rut;
}
/**
*
* @return
*/
public String getNombre() {
return nombre;
}
/**
*
* @param nombre
*/
public void setNombre(String nombre) {
this.nombre = nombre;
}
}
| Java |
package ufro.pdsvo;
public class DatosAnotacion {
/**
*
*/
int idAnotacion;
int tipo_anotacion;
String tipo_anotacion2;
int idAlumno;
int idAnotador;
String al_nombre;
String an_nombre;
String an_descripcion;
String descripcion;
String ta_descripcion;
String fecha;
/**
*
* @return
*/
public String getTa_descripcion() {
return ta_descripcion;
}
/**
*
* @param ta_descripcion
*/
public void setTa_descripcion(String ta_descripcion) {
this.ta_descripcion = ta_descripcion;
}
/**
*
* @return
*/
public int getIdAnotacion() {
return idAnotacion;
}
/**
*
* @param idAnotacion
*/
public void setIdAnotacion(int idAnotacion) {
this.idAnotacion = idAnotacion;
}
/**
*
* @return
*/
public int getTipo_anotacion() {
return tipo_anotacion;
}
/**
*
* @param tipo_anotacion
*/
public void setTipo_anotacion(int tipo_anotacion) {
this.tipo_anotacion = tipo_anotacion;
}
/**
*
* @return
*/
public String getTipo_anotacion2() {
return tipo_anotacion2;
}
/**
*
* @param tipo_anotacion2
*/
public void setTipo_anotacion2(String tipo_anotacion2) {
this.tipo_anotacion2 = tipo_anotacion2;
}
/**
*
* @return
*/
public int getIdAlumno() {
return idAlumno;
}
/**
*
* @param idAlumno
*/
public void setIdAlumno(int idAlumno) {
this.idAlumno = idAlumno;
}
/**
*
* @return
*/
public int getIdAnotador() {
return idAnotador;
}
/**
*
* @param idAnotador
*/
public void setIdAnotador(int idAnotador) {
this.idAnotador = idAnotador;
}
/**
*
* @return
*/
public String getAl_nombre() {
return al_nombre;
}
/**
*
* @param al_nombre
*/
public void setAl_nombre(String al_nombre) {
this.al_nombre = al_nombre;
}
/**
*
* @return
*/
public String getAn_nombre() {
return an_nombre;
}
/**
*
* @param an_nombre
*/
public void setAn_nombre(String an_nombre) {
this.an_nombre = an_nombre;
}
/**
*
* @return
*/
public String getAn_descripcion() {
return an_descripcion;
}
/**
*
* @param an_descripcion
*/
public void setAn_descripcion(String an_descripcion) {
this.an_descripcion = an_descripcion;
}
/**
*
* @return
*/
public String getDescripcion() {
return descripcion;
}
/**
*
* @param descripcion
*/
public void setDescripcion(String descripcion) {
this.descripcion = descripcion;
}
/**
*
* @return
*/
public String getFecha() {
return fecha;
}
/**
*
* @param fecha
*/
public void setFecha(String fecha) {
this.fecha = fecha;
}
}
| Java |
package ufro.pdsvo;
public class DatosSubsector {
int id_subsector;
String descripcion;
int id_curso;
/**
*
* @return
*/
public int getId_subsector(){
return id_subsector;
}
/**
*
* @param id_subsector
*/
public void setId_subsector(int id_subsector){
this.id_subsector = id_subsector;
}
/**
*
* @return
*/
public String getDescripcion(){
return descripcion;
}
/**
*
* @param descripcion
*/
public void setDescripcion(String descripcion){
this.descripcion = descripcion;
}
/**
*
* @return
*/
public int getId_curso(){
return id_curso;
}
/**
*
* @param id_curso
*/
public void setId_curso(int id_curso){
this.id_curso = id_curso;
}
}
| Java |
package ufro.pdsvo;
public class DatosCurso {
int id_curso;
String nombre;
/**
*
* @return
*/
public int getId_curso(){
return id_curso;
}
/**
*
* @param id_curso
*/
public void setId_curso(int id_curso){
this.id_curso = id_curso ;
}
/**
*
* @return
*/
public String getNombre(){
return nombre;
}
/**
*
* @param nombre
*/
public void setNombre(String nombre) {
this.nombre = nombre;
}
}
| Java |
package ufro.pdsvo;
public class DatosTipoAnotacion {
int ta_id;
public int getTa_id() {
return ta_id;
}
public void setTa_id(int ta_id) {
this.ta_id = ta_id;
}
public String getTa_descripcion() {
return ta_descripcion;
}
public void setTa_descripcion(String ta_descripcion) {
this.ta_descripcion = ta_descripcion;
}
String ta_descripcion;
}
| Java |
package ufro.pdsvo;
public class DatosAlumno {
public int id;
public String nombre;
public String rut;
public String descripcion;
public int curso;
/**
*
* @return
*/
public int getId() {
return id;
}
/**
*
* @param id
*/
public void setId(int id) {
this.id = id;
}
/**
*
* @return
*/
public String getNombre() {
return nombre;
}
/**
*
* @param nombre
*/
public void setNombre(String nombre) {
this.nombre = nombre;
}
/**
*
* @return
*/
public String getRut() {
return rut;
}
/**
*
* @param rut
*/
public void setRut(String rut) {
this.rut = rut;
}
/**
*
* @return
*/
public String getDescripcion() {
return descripcion;
}
/**
*
* @param descripcion
*/
public void setDescripcion(String descripcion) {
this.descripcion = descripcion;
}
/**
*
* @return
*/
public int getCurso() {
return curso;
}
/**
*
* @param curso
*/
public void setCurso(int curso) {
this.curso = curso;
}
}
| Java |
package ufro.pds;
import ufro.pdssoaws.AnotacionesSOAWS;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
public class AnotacionesActivity extends Activity {
/** Called when the activity is first created. */
private Button btningresar;
private Button btnbuscar;
private Button btnsalir;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
btningresar = (Button) findViewById(R.id.button1);
btnbuscar = (Button) findViewById(R.id.button2);
btnsalir = (Button) findViewById(R.id.button3);
btningresar.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
Intent i = new Intent();
i.setClass(getApplicationContext(), IngresarAnotacion.class);
startActivity(i);
}
});
btnbuscar.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
AnotacionesSOAWS anot = new AnotacionesSOAWS();
String recibe = "";
recibe = anot.verAnotaciones();
Intent i = new Intent();
i.setClass(getApplicationContext(), BuscarAnotaciones.class);
i.putExtra("datos",recibe );
startActivity(i);
}
});
btnsalir.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
finish();
}
});
}
} | Java |
package ufro.pds;
import java.util.ArrayList;
import java.util.Calendar;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import ufro.pdssoaws.AlumnoSOAWS;
import ufro.pdssoaws.AnotacionesSOAWS;
import android.app.Activity;
import android.app.DatePickerDialog;
import android.app.Dialog;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
public class IngresarAnotacion extends Activity {
//Global variable declaration
private AnotacionesSOAWS pws = new AnotacionesSOAWS();
private AlumnoSOAWS a= new AlumnoSOAWS();
private Spinner spinnercurso;
private Spinner spinnersubsector;
private Spinner spinneralumno;
private RadioButton radio_positivo;
private RadioButton radio_negativo;
private RadioButton radio_neutro;
private EditText anotacion;
private Button btnguardar;
private int ajustarCurso = 1;
private int tipo_anotacion = 1;
private int mYear;
private int mMonth;
private int mDay;
ArrayList<String> listalumnos ;
ArrayList<String> listaid;
String rutAlumno;
private String rutAnotador = "123451";
private String fechaSeleccionada;
private String anotacionAlumno;
private String resultado = null;
private TextView mDateDisplay;
private Button mPickDate;
static final int DATE_DIALOG_ID = 0;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.ingresar);
/**
* se hace referencia a los datos de xml , para unir la vista con el xml.
*/
spinnercurso = (Spinner)findViewById(R.id.spiner1);
spinnersubsector = (Spinner)findViewById(R.id.spiner2);
spinneralumno = (Spinner)findViewById(R.id.spiner3);
anotacion = (EditText) findViewById(R.id.textoanotac);
btnguardar = (Button)findViewById(R.id.btnguardar);
mDateDisplay = (TextView) findViewById(R.id.dateDisplay);
mPickDate = (Button) findViewById(R.id.pickDate);
// Se escucha cuando se hace click en el boton
mPickDate.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
showDialog(DATE_DIALOG_ID);
}
});
// Obtener la fecha actual
final Calendar c = Calendar.getInstance();
mYear = c.get(Calendar.YEAR);
mMonth = c.get(Calendar.MONTH);
mDay = c.get(Calendar.DAY_OF_MONTH);
// Mostrar la fecha actual
updateDisplay();
//Cargamos Cursos estaticamente en un spinner
String[] listacurso = {"Primero A","Primero B","Segundo A","Segundo B","Tercero A"};
ArrayAdapter<String> adaptador = new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item, listacurso);
adaptador.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
//Escuchamos la seleccion del curso, para cargar los alumnos.
spinnercurso.setOnItemSelectedListener(new MyOnItemSelectedListener());
spinnercurso.setAdapter(adaptador);
//Cargamos los datos de subsector de manera estatica.
String[] listasubsector = {"Matematicas","Lenguaje","Ingles"};
ArrayAdapter<String> adaptador2 = new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item, listasubsector);
adaptador2.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinnersubsector.setAdapter(adaptador2);
//Llamamos al webservices con los parametros pasados por el usuario. Rut del anotador estatico.
btnguardar.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// fechaSeleccionada = fecha.getText().toString();
fechaSeleccionada = mDateDisplay.getText().toString();
anotacionAlumno = anotacion.getText().toString();
resultado = pws.add(fechaSeleccionada,anotacionAlumno,radioButtonSelected(),rutAnotador, rutAlumno);
Toast.makeText(getBaseContext(), resultado,
Toast.LENGTH_SHORT).show();
}
});
}
/**
* @author Team "El experimento"
* Escucha la posicion del spinner alumno.
*
*/
public class MyOnItemSelectedListenerAlumno implements OnItemSelectedListener {
public void onItemSelected(AdapterView<?> parent,
View view, int pos, long id) {
//Intancia al metodo con posicion escuchada del spinner
rutAlumnoSelected(pos);
}
public void onNothingSelected(AdapterView<?> parent) {
// No hacer nada.
}
}
/**
* Metodo que inicia la llamada y crea el dialogo tipo "flash"
*/
protected Dialog onCreateDialog(int id) {
switch (id) {
case DATE_DIALOG_ID:
return new DatePickerDialog(this,
mDateSetListener,
mYear, mMonth, mDay);
}
return null;
}
/**
* Devolucion de la llamada cuando el usuario "setea" la fecha en el cuadro de dialogo
*/
private DatePickerDialog.OnDateSetListener mDateSetListener =
new DatePickerDialog.OnDateSetListener() {
public void onDateSet(DatePicker view, int year,
int monthOfYear, int dayOfMonth) {
mYear = year;
mMonth = monthOfYear;
mDay = dayOfMonth;
updateDisplay();
}
};
/**
* Actualizacion de la fecha en el TextView
*/
private void updateDisplay() {
mDateDisplay.setText(
new StringBuilder()
.append(mDay).append("-")
.append(mMonth + 1).append("-")
.append(mYear).append(" "));
}
/**
* @author Team "El experimento"
* Se escucha el spinner de curso y se usa la posicion para llamar al metodo.
*
*/
public class MyOnItemSelectedListener implements OnItemSelectedListener {
public void onItemSelected(AdapterView<?> parent,
View view, int pos, long id) {
//Intancia al metodo con posicion escuchada del spinner
cargarSpinnerAlumno(pos+ajustarCurso);
}
public void onNothingSelected(AdapterView<?> parent) {
// Hacer nada.
}
}
/**
* Guarda el rut seleccionado de un alumno.
* @param post int
*/
public void rutAlumnoSelected(int post){
rutAlumno = "";
rutAlumno = listaid.get(post);
}
/**
* Devuelve el id del tipo_anotacion seleccionada.
* @return tipo_anotacion int
*/
public int radioButtonSelected(){
radio_positivo =(RadioButton)findViewById(R.id.radio0);
radio_negativo =(RadioButton)findViewById(R.id.radio1);
radio_neutro =(RadioButton)findViewById(R.id.radio2);
if(radio_positivo.isChecked())
{
tipo_anotacion = 2;
}
if(radio_negativo.isChecked())
{
tipo_anotacion = 3;
}
if(radio_neutro.isChecked())
{
tipo_anotacion = 1;
}
return tipo_anotacion;
}
/**
* Metodo que carga un spinner con alumnos, segun el id del curso seleccionado
* @param idCurso int
*/
public void cargarSpinnerAlumno(int idCurso){
cargarLista(idCurso);
ArrayAdapter<String> adaptador3 = new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item, this.listalumnos);
adaptador3.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinneralumno.setOnItemSelectedListener(new MyOnItemSelectedListenerAlumno());
spinneralumno.setAdapter(adaptador3);
}
/**
* Metodo que carga una lista de alumnos y una lista de rut de un curso segun id del curso
* @param idCurso int
*/
public void cargarLista(int idCurso){
JSONArray jsonArray = null;
listalumnos = new ArrayList<String>();
listaid = new ArrayList<String>();
String datosjson = a.findAlumno(idCurso);
try {
jsonArray = new JSONArray(datosjson);
for (int i = 0; i < jsonArray.length(); i++) {
JSONObject objeto = (JSONObject) jsonArray.get(i);
this.listalumnos.add(objeto.getString("nombre"));
this.listaid.add(objeto.getString("rut"));
}
} catch (JSONException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
}
| Java |
package earthalbumext;
public class FlickrAPI {
private final static String API_KEY = "188156d91f52c365f7baf9a384330176";
private final static String FORMAT = "rest";
private final static String FLICKR_PHOTOS_SEARCH = "flickr.photos.search";
private final static String FLICKR_PHOTOS_GETINFO = "flickr.photos.getInfo";
private final static int IMAGE_PER_PAGE = 100;
private final static String REQUEST_URL_PREFIX
= "http://api.flickr.com/services/rest/?";
private FlickrAPI(){}
public static String getFlickrPhotosSearchByLatLon(double lat, double lon){
return REQUEST_URL_PREFIX +
"method=" + FLICKR_PHOTOS_SEARCH +
"&format=" + FORMAT +
"&api_key=" + API_KEY +
"&radius=30" +
"&radius_units=km" +
"&min_upload_date=0000000000" +
"&per_page=" + IMAGE_PER_PAGE +
"&lat=" + lat +
"&lon=" + lon;
}
public static String getFlickrPhotosInfo(String photo_id, String secret){
return REQUEST_URL_PREFIX +
"method=" + FLICKR_PHOTOS_GETINFO +
"&format=" + FORMAT +
"&api_key=" + API_KEY +
"&photo_id=" + photo_id +
"&secret=" + secret;
}
}
| Java |
package earthalbumext;
import java.io.IOException;
import javax.servlet.http.*;
import java.io.PrintWriter;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
@SuppressWarnings("serial")
public class earthalbumextServlet extends HttpServlet {
@Override
public void doGet(HttpServletRequest req, HttpServletResponse resp)
throws IOException {
resp.setContentType("text/xml");
PrintWriter out = resp.getWriter();
try {
double lat = Double.parseDouble(req.getParameter("lat"));
double lon = Double.parseDouble(req.getParameter("lon"));
URL flickr_url = new URL(FlickrAPI.getFlickrPhotosSearchByLatLon(lat, lon));
HttpURLConnection connection = (HttpURLConnection) flickr_url.openConnection();
connection.setRequestMethod("GET");
connection.setDoInput(true);
connection.setDoOutput(true);
connection.connect();
InputStream is = connection.getInputStream();
int c;
String flickrResponse = "";
while (true) {
c = is.read();
if (c == -1) {
break;
} else {
flickrResponse += (char) c;
}
}
out.println(flickrResponse);
}
catch (Exception ex) {
System.out.println("Got exception! " + ex.getMessage());
}
finally {
out.close();
}
}
}
| Java |
package earthalbumext;
import java.io.IOException;
import javax.servlet.http.*;
import java.io.PrintWriter;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
@SuppressWarnings("serial")
public class getInfoServlet extends HttpServlet {
@Override
public void doGet(HttpServletRequest req, HttpServletResponse resp)
throws IOException {
resp.setContentType("text/xml");
PrintWriter out = resp.getWriter();
try {
String photo_id = req.getParameter("photo_id");
String secret = req.getParameter("secret");
URL flickr_url = new URL(FlickrAPI.getFlickrPhotosInfo(photo_id, secret));
HttpURLConnection connection = (HttpURLConnection) flickr_url.openConnection();
connection.setRequestMethod("GET");
connection.setDoInput(true);
connection.setDoOutput(true);
connection.connect();
InputStream is = connection.getInputStream();
int c;
String flickrResponse = "";
while (true) {
c = is.read();
if (c == -1) {
break;
} else {
flickrResponse += (char) c;
}
}
out.println(flickrResponse);
}
catch (Exception ex) {
System.out.println("Got exception! " + ex.getMessage());
}
finally {
out.close();
}
}
}
| Java |
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.anote.ui;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JToggleButton;
import javax.swing.UIManager;
import javax.swing.WindowConstants;
import org.anote.Note;
import org.tools.ui.helper.LookAndFeel;
/**
*
* @author Trilarion 2012
*/
public class NoteExample extends JFrame {
private static final long serialVersionUID = 1L;
/**
* Creates new form NoteExample
*/
public NoteExample() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
noteDisplayToggleButton = new JToggleButton();
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
setTitle("Note Example");
setLocationByPlatform(true);
setResizable(false);
noteDisplayToggleButton.setText("Show/Hide note");
noteDisplayToggleButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
noteDisplayToggleButtonActionPerformed(evt);
}
});
GroupLayout layout = new GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(noteDisplayToggleButton)
.addContainerGap(281, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(noteDisplayToggleButton)
.addContainerGap(266, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
/**
* The show/hide note button was toggled.
* @param evt
*/
private void noteDisplayToggleButtonActionPerformed(ActionEvent evt) {//GEN-FIRST:event_noteDisplayToggleButtonActionPerformed
// create new Note
Note note = new Note();
note.setPosition(200, 200);
note.setTitle("Untitled");
NotePanel panel = new NotePanel(note);
JDialog dlg = panel.getAsDialog();
dlg.setVisible(true);
}//GEN-LAST:event_noteDisplayToggleButtonActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
LookAndFeel.setSystemLookAndFeel();
boolean supportsWindowDecorations = UIManager.getLookAndFeel().getSupportsWindowDecorations();
System.out.println(supportsWindowDecorations);
/*
* Create and display the form
*/
java.awt.EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
new NoteExample().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
JToggleButton noteDisplayToggleButton;
// End of variables declaration//GEN-END:variables
}
| Java |
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.anote;
import java.awt.Point;
/**
*
* @author Trilarion 2012
*/
public class Note {
private String title;
private Point pos = new Point();
public void setTitle(String title) {
this.title = title;
}
public String getTitle() {
return title;
}
public void setPosition(int x, int y) {
pos.x = x;
pos.y = y;
}
public Point getPosition() {
return pos;
}
}
| Java |
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.anote;
import java.util.logging.ConsoleHandler;
import java.util.logging.Handler;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.logging.SimpleFormatter;
import org.anote.ui.TrayMenu;
import org.tools.ui.helper.LookAndFeel;
/**
*
* @author Trilarion 2012
*/
public class Main {
/** */
private static final Logger LOG = Logger.getLogger(Main.class.getName());
/** Private constructor to avoid instantiation. */
private Main() {}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
setupLogger();
// set system look and feel (we might need it already in the choose language dialog)
LookAndFeel.setSystemLookAndFeel();
// setup the tray menu
TrayMenu.start();
}
private static void setupLogger() {
// setup of the logger
Handler handler = null;
handler = new ConsoleHandler();
handler.setFormatter(new SimpleFormatter());
handler.setLevel(Level.INFO);
Logger.getLogger("").addHandler(handler);
// our first log message (just to get the date and time)
LOG.log(Level.INFO, "A Note starting");
}
public static void ShutDown() {
System.exit(0);
}
}
| Java |
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.anote.ui;
/**
*
* @author Trilarion 2012
*/
public class BrowserDlg {
}
| Java |
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.anote.ui;
import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Insets;
import java.awt.LayoutManager;
import javax.swing.*;
import org.anote.Note;
/**
*
* @author Trilarion 2012
*/
public class NotePanel {
private JPanel panel;
private JDialog dialog;
private Note note;
private JLabel title;
private JScrollPane textScroller;
private JTextArea text;
public NotePanel(Note note) {
this.note = note;
panel = new JPanel(new LayoutManager() {
/*
* Required by LayoutManager.
*/
@Override
public void addLayoutComponent(String name, Component comp) {
}
/*
* Required by LayoutManager.
*/
@Override
public void removeLayoutComponent(Component comp) {
}
@Override
public Dimension preferredLayoutSize(Container parent) {
Insets insets = parent.getInsets();
Dimension dim = new Dimension();
Dimension dimA = title.getPreferredSize();
dim.width = insets.left + insets.right + 80; // at least 80 pixel wide
dim.height = insets.top + insets.bottom + dimA.height; // at least title should be displayed
return dim;
}
@Override
public Dimension minimumLayoutSize(Container parent) {
Insets insets = parent.getInsets();
Dimension dim = new Dimension();
Dimension dimA = title.getPreferredSize();
dim.width = insets.left + insets.right + 80; // at least 80 pixel wide
dim.height = insets.top + insets.bottom + dimA.height; // at least title should be displayed
return dim;
}
@Override
public void layoutContainer(Container parent) {
Insets insets = parent.getInsets();
int x0 = insets.left;
int y0 = insets.top;
Dimension dimA = title.getPreferredSize();
Dimension dimB = textScroller.getPreferredSize();
int maxWidth = parent.getWidth() - (insets.left + insets.right);
int maxHeight = parent.getHeight() - (insets.top + insets.bottom);
// put title on the left uper corner
title.setBounds(x0, y0, Math.min(maxWidth, dimA.width), Math.min(maxHeight, dimA.height));
// put text box below, filling the whole width and the remaining height
textScroller.setBounds(x0, y0 + dimA.height, maxWidth, Math.max(0, maxHeight - dimA.height));
}
});
panel.setBorder(BorderFactory.createLineBorder(Color.BLACK));
panel.setBackground(Color.YELLOW);
title = new JLabel(note.getTitle());
panel.add(title);
text = new JTextArea();
text.setColumns(20);
text.setRows(5);
text.setLineWrap(true);
text.setBackground(Color.YELLOW);
textScroller = new JScrollPane();
textScroller.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
textScroller.setViewportView(text);
panel.add(textScroller);
}
JDialog getAsDialog() {
if (dialog == null) {
// create dialog and add panel
dialog = new JDialog();
dialog.setUndecorated(true);
dialog.getRootPane().getWindowDecorationStyle();
dialog.getRootPane().setWindowDecorationStyle(JRootPane.PLAIN_DIALOG);
dialog.add(panel);
dialog.setLocation(note.getPosition());
dialog.pack();
}
return dialog;
}
}
| Java |
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.anote.ui;
import java.awt.AWTException;
import java.awt.Image;
import java.awt.MenuItem;
import java.awt.PopupMenu;
import java.awt.SystemTray;
import java.awt.Toolkit;
import java.awt.TrayIcon;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.util.logging.Logger;
import org.anote.Main;
/**
*
* @author Trilarion 2012
*/
public class TrayMenu {
private static final Logger LOG = Logger.getLogger(TrayMenu.class.getName());
private TrayMenu() {
}
public static void start() {
final TrayIcon trayIcon;
if (SystemTray.isSupported()) {
SystemTray tray = SystemTray.getSystemTray();
Image image = Toolkit.getDefaultToolkit().getImage(Main.class.getClass().getResource("/icons/tray.png"));
// TODO instead of PopupMenu create a custom JPopuMenu with icons and such
PopupMenu menu = TrayMenu.createMenu();
trayIcon = new TrayIcon(image, "A Note", menu);
trayIcon.setImageAutoSize(true);
trayIcon.displayMessage("Event", "A Note started", TrayIcon.MessageType.INFO);
// left click on tray icon, open note browser
MouseListener mouseListener = new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent evt) {
}
};
trayIcon.addMouseListener(mouseListener);
try {
tray.add(trayIcon);
} catch (AWTException e) {
// TODO better error handling
LOG.info("TrayIcon could not be added.");
}
} else {
// TODO error handling: System Tray is not supported
}
}
/**
* The popup menu of the tray.
*
* @return The popup menu.
*/
private static PopupMenu createMenu() {
PopupMenu menu = new PopupMenu();
// new note menu item
MenuItem newNoteItem = new MenuItem("New Note");
newNoteItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
throw new UnsupportedOperationException("Not supported yet.");
}
});
menu.add(newNoteItem);
// note browser menu item
MenuItem noteBrowserItem = new MenuItem("Note Browser");
noteBrowserItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
throw new UnsupportedOperationException("Not supported yet.");
}
});
menu.add(noteBrowserItem);
menu.addSeparator();
// synchronization menu item
MenuItem synchroItem = new MenuItem("Synchronization");
synchroItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
throw new UnsupportedOperationException("Not supported yet.");
}
});
menu.add(synchroItem);
menu.addSeparator();
// options menu item
MenuItem optionsItem = new MenuItem("Options");
optionsItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
throw new UnsupportedOperationException("Not supported yet.");
}
});
menu.add(optionsItem);
// help menu item
MenuItem helpItem = new MenuItem("Help");
helpItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
throw new UnsupportedOperationException("Not supported yet.");
}
});
menu.add(helpItem);
menu.addSeparator();
// exit item
MenuItem exitItem = new MenuItem("Exit");
exitItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
Main.ShutDown();
}
});
menu.add(exitItem);
return menu;
}
}
| Java |
/*
* Copyright (C) 2012 Trilarion
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.anote;
import java.awt.Color;
import java.awt.EventQueue;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTextPane;
import javax.swing.LayoutStyle.ComponentPlacement;
import javax.swing.WindowConstants;
import javax.swing.text.SimpleAttributeSet;
import javax.swing.text.StyleConstants;
import org.tools.ui.helper.LookAndFeel;
/**
*
* @author Trilarion 2012
*/
public class TextPaneTest extends JFrame {
private static final long serialVersionUID = 1L;
/**
* Creates new form TextPaneTest
*/
public TextPaneTest() {
initComponents();
textPane.setContentType("text/html"); // or any other styled content type
textPane.setText("White text on a red background");
textPane.setBackground(Color.blue);
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
scrollPane = new JScrollPane();
textPane = new JTextPane();
linkButton = new JButton();
bgButton = new JButton();
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
setTitle("Text Pane Test");
scrollPane.setViewportView(textPane);
linkButton.setText("Add Link");
bgButton.setText("Set Background");
bgButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
bgButtonActionPerformed(evt);
}
});
GroupLayout layout = new GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(Alignment.LEADING)
.addComponent(scrollPane)
.addGroup(layout.createSequentialGroup()
.addComponent(linkButton)
.addPreferredGap(ComponentPlacement.RELATED)
.addComponent(bgButton)
.addGap(0, 539, Short.MAX_VALUE)))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(Alignment.BASELINE)
.addComponent(linkButton)
.addComponent(bgButton))
.addPreferredGap(ComponentPlacement.RELATED)
.addComponent(scrollPane, GroupLayout.DEFAULT_SIZE, 473, Short.MAX_VALUE)
.addContainerGap())
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void bgButtonActionPerformed(ActionEvent evt) {//GEN-FIRST:event_bgButtonActionPerformed
ColorChooserDlg dlg = new ColorChooserDlg(this);
dlg.setVisible(true);
Color backgroundColor = Color.red;
SimpleAttributeSet background = new SimpleAttributeSet();
StyleConstants.setBackground(background, backgroundColor);
textPane.getStyledDocument().setParagraphAttributes(0, textPane.getDocument().getLength(), background, false);
// And remove default (white) margin
// textPane.setBorder(BorderFactory.createEmptyBorder());
// Alternative: Leave a 2px border but draw it in the same color
// textPane.setBorder(BorderFactory.createLineBorder(backgroundColor, 2));
}//GEN-LAST:event_bgButtonActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
LookAndFeel.setSystemLookAndFeel();
/*
* Create and display the form
*/
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
new TextPaneTest().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private JButton bgButton;
private JButton linkButton;
private JScrollPane scrollPane;
private JTextPane textPane;
// End of variables declaration//GEN-END:variables
}
| Java |
/*
* Copyright (C) 2012 Trilarion
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.anote;
import java.awt.EventQueue;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import java.net.URL;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.JButton;
import javax.swing.JEditorPane;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.LayoutStyle.ComponentPlacement;
import javax.swing.WindowConstants;
import javax.swing.event.HyperlinkEvent;
import javax.swing.event.HyperlinkListener;
import org.tools.ui.helper.LookAndFeel;
/**
*
* @author Trilarion 2012
*/
public class HelpBrowserExample extends JFrame {
private static final Logger LOG = Logger.getLogger(HelpBrowserExample.class.getName());
private static final long serialVersionUID = 1L;
/**
* Creates new form HelpBrowserExample
*/
public HelpBrowserExample() {
initComponents();
URL url = HelpBrowserExample.class.getClass().getResource("/html/index.html");
try {
editorPane.setPage(url);
} catch (IOException ex) {
LOG.log(Level.SEVERE, null, ex);
}
editorPane.addHyperlinkListener(new HyperlinkListener() {
@Override
public void hyperlinkUpdate(HyperlinkEvent e) {
if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
try {
editorPane.setPage(e.getURL());
} catch (IOException ex) {
LOG.log(Level.SEVERE, null, ex);
}
}
}
});
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
backButton = new JButton();
scrollPane = new JScrollPane();
editorPane = new JEditorPane();
forwardButton = new JButton();
indexButton = new JButton();
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
setTitle("HelpBrowser Test");
backButton.setText("<<");
backButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
backButtonActionPerformed(evt);
}
});
editorPane.setContentType("text/html");
editorPane.setEditable(false);
scrollPane.setViewportView(editorPane);
forwardButton.setText(">>");
forwardButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
forwardButtonActionPerformed(evt);
}
});
indexButton.setText("Index");
indexButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
indexButtonActionPerformed(evt);
}
});
GroupLayout layout = new GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(backButton)
.addPreferredGap(ComponentPlacement.RELATED)
.addComponent(indexButton)
.addPreferredGap(ComponentPlacement.RELATED)
.addComponent(forwardButton)
.addContainerGap(380, Short.MAX_VALUE))
.addComponent(scrollPane)
);
layout.setVerticalGroup(
layout.createParallelGroup(Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(Alignment.BASELINE)
.addComponent(backButton)
.addComponent(forwardButton)
.addComponent(indexButton))
.addPreferredGap(ComponentPlacement.RELATED)
.addComponent(scrollPane, GroupLayout.DEFAULT_SIZE, 340, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void backButtonActionPerformed(ActionEvent evt) {//GEN-FIRST:event_backButtonActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_backButtonActionPerformed
private void indexButtonActionPerformed(ActionEvent evt) {//GEN-FIRST:event_indexButtonActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_indexButtonActionPerformed
private void forwardButtonActionPerformed(ActionEvent evt) {//GEN-FIRST:event_forwardButtonActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_forwardButtonActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
LookAndFeel.setSystemLookAndFeel();
/*
* Create and display the form
*/
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
new HelpBrowserExample().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private JButton backButton;
private JEditorPane editorPane;
private JButton forwardButton;
private JButton indexButton;
private JScrollPane scrollPane;
// End of variables declaration//GEN-END:variables
}
| Java |
/*
* Copyright (C) 2012 Trilarion
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.anote;
import java.awt.Frame;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.JButton;
import javax.swing.JColorChooser;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.LayoutStyle.ComponentPlacement;
import javax.swing.WindowConstants;
/**
*
* @author Trilarion
*/
public class ColorChooserDlg extends JDialog {
private static final long serialVersionUID = 1L;
/**
* Creates new form ColorChooserDlg
* @param parent
*/
public ColorChooserDlg(Frame parent) {
super(parent);
initComponents();
colorChooser.setPreviewPanel(new JPanel());
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
colorChooser = new JColorChooser();
okButton = new JButton();
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
setTitle("Choose Color");
setModal(true);
okButton.setText("Okay");
okButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
okButtonActionPerformed(evt);
}
});
GroupLayout layout = new GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(Alignment.TRAILING)
.addComponent(okButton)
.addComponent(colorChooser, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
.addGap(0, 0, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(colorChooser, GroupLayout.PREFERRED_SIZE, 223, GroupLayout.PREFERRED_SIZE)
.addPreferredGap(ComponentPlacement.RELATED)
.addComponent(okButton)
.addContainerGap())
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void okButtonActionPerformed(ActionEvent evt) {//GEN-FIRST:event_okButtonActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_okButtonActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private JColorChooser colorChooser;
private JButton okButton;
// End of variables declaration//GEN-END:variables
}
| Java |
/*
* Copyright (C) 2012 Trilarion
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.anote;
import java.awt.Cursor;
import java.awt.EventQueue;
import java.awt.Frame;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JEditorPane;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.JTextPane;
import javax.swing.LayoutStyle.ComponentPlacement;
import javax.swing.WindowConstants;
import javax.swing.event.HyperlinkEvent;
import javax.swing.event.HyperlinkListener;
import org.tools.ui.helper.LookAndFeel;
/**
*
* @author Trilarion 2012
*/
public class EditorPaneTest extends JDialog {
private static final Logger LOG = Logger.getLogger(EditorPaneTest.class.getName());
private static final long serialVersionUID = 1L;
/**
* Creates new form EditorPaneTest
* @param parent
* @param modal
*/
public EditorPaneTest(Frame parent, boolean modal) {
super(parent, modal);
initComponents();
String content = "<html><h1>Heading</h1><b>bold</b><br><a href=\"http://www.google.de\">Link</a></html>";
editorPane.setText(content);
textPane.setText(content);
editorPane.addHyperlinkListener(new HyperlinkListener() {
@Override
public void hyperlinkUpdate(HyperlinkEvent e) {
if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
textArea.setText("clicked on " + e.getURL());
}
}
});
transferButtonActionPerformed(null);
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
scrollPane = new JScrollPane();
editorPane = new JEditorPane();
transferButton = new JButton();
scrollPane2 = new JScrollPane();
textArea = new JTextArea();
loadButton = new JButton();
urlTextField = new JTextField();
jScrollPane1 = new JScrollPane();
textPane = new JTextPane();
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
setTitle("EditorPane Test");
setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
setLocationByPlatform(true);
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent evt) {
formWindowClosing(evt);
}
});
editorPane.setContentType("text/html");
editorPane.setEditable(false);
scrollPane.setViewportView(editorPane);
transferButton.setText("Update");
transferButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
transferButtonActionPerformed(evt);
}
});
textArea.setColumns(20);
textArea.setEditable(false);
textArea.setRows(5);
scrollPane2.setViewportView(textArea);
loadButton.setText("Load");
loadButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
loadButtonActionPerformed(evt);
}
});
urlTextField.setText("http://www.google.de");
textPane.setContentType("text/html");
jScrollPane1.setViewportView(textPane);
GroupLayout layout = new GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(Alignment.LEADING)
.addComponent(scrollPane, Alignment.TRAILING)
.addComponent(jScrollPane1, Alignment.TRAILING)
.addComponent(scrollPane2)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(loadButton)
.addPreferredGap(ComponentPlacement.RELATED)
.addComponent(urlTextField, GroupLayout.PREFERRED_SIZE, 168, GroupLayout.PREFERRED_SIZE))
.addComponent(transferButton))
.addGap(0, 490, Short.MAX_VALUE)))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(Alignment.BASELINE)
.addComponent(loadButton)
.addComponent(urlTextField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
.addPreferredGap(ComponentPlacement.RELATED)
.addComponent(jScrollPane1, GroupLayout.DEFAULT_SIZE, 142, Short.MAX_VALUE)
.addPreferredGap(ComponentPlacement.RELATED)
.addComponent(scrollPane, GroupLayout.PREFERRED_SIZE, 147, GroupLayout.PREFERRED_SIZE)
.addPreferredGap(ComponentPlacement.RELATED)
.addComponent(transferButton)
.addPreferredGap(ComponentPlacement.RELATED)
.addComponent(scrollPane2, GroupLayout.PREFERRED_SIZE, 225, GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void transferButtonActionPerformed(ActionEvent evt) {//GEN-FIRST:event_transferButtonActionPerformed
textArea.setText(editorPane.getText());
}//GEN-LAST:event_transferButtonActionPerformed
private void loadButtonActionPerformed(ActionEvent evt) {//GEN-FIRST:event_loadButtonActionPerformed
try {
editorPane.setPage(urlTextField.getText());
} catch (IOException ex) {
LOG.log(Level.INFO, null, ex);
}
}//GEN-LAST:event_loadButtonActionPerformed
private void formWindowClosing(WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
System.exit(0);
}//GEN-LAST:event_formWindowClosing
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
LookAndFeel.setSystemLookAndFeel();
/*
* Create and display the dialog
*/
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
EditorPaneTest dialog = new EditorPaneTest(new JFrame(), true);
dialog.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
dialog.setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private JEditorPane editorPane;
private JScrollPane jScrollPane1;
private JButton loadButton;
private JScrollPane scrollPane;
private JScrollPane scrollPane2;
private JTextArea textArea;
private JTextPane textPane;
private JButton transferButton;
private JTextField urlTextField;
// End of variables declaration//GEN-END:variables
}
| Java |
/*
* Copyright (C) 2009 The Android Open Source Project
*
* Licensed 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.
*/
package com.android.spritemethodtest;
import android.graphics.Bitmap;
import android.graphics.Canvas;
/**
* The Canvas version of a sprite. This class keeps a pointer to a bitmap
* and draws it at the Sprite's current location.
*/
public class CanvasSprite extends Renderable {
private Bitmap mBitmap;
public CanvasSprite(Bitmap bitmap) {
mBitmap = bitmap;
}
public void draw(Canvas canvas) {
// The Canvas system uses a screen-space coordinate system, that is,
// 0,0 is the top-left point of the canvas. But in order to align
// with OpenGL's coordinate space (which places 0,0 and the lower-left),
// for this test I flip the y coordinate.
canvas.drawBitmap(mBitmap, x, canvas.getHeight() - (y + height), null);
}
}
| Java |
/*
* Copyright (C) 2009 The Android Open Source Project
*
* Licensed 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.
*/
package com.android.spritemethodtest;
import android.os.SystemClock;
/**
* Implements a simple runtime profiler. The profiler records start and stop
* times for several different types of profiles and can then return min, max
* and average execution times per type. Profile types are independent and may
* be nested in calling code. This object is a singleton for convenience.
*/
public class ProfileRecorder {
// A type for recording actual draw command time.
public static final int PROFILE_DRAW = 0;
// A type for recording the time it takes to display the scene.
public static final int PROFILE_PAGE_FLIP = 1;
// A type for recording the time it takes to run a single simulation step.
public static final int PROFILE_SIM = 2;
// A type for recording the total amount of time spent rendering a frame.
public static final int PROFILE_FRAME = 3;
private static final int PROFILE_COUNT = PROFILE_FRAME + 1;
private ProfileRecord[] mProfiles;
private int mFrameCount;
public static ProfileRecorder sSingleton = new ProfileRecorder();
public ProfileRecorder() {
mProfiles = new ProfileRecord[PROFILE_COUNT];
for (int x = 0; x < PROFILE_COUNT; x++) {
mProfiles[x] = new ProfileRecord();
}
}
/** Starts recording execution time for a specific profile type.*/
public void start(int profileType) {
if (profileType < PROFILE_COUNT) {
mProfiles[profileType].start(SystemClock.uptimeMillis());
}
}
/** Stops recording time for this profile type. */
public void stop(int profileType) {
if (profileType < PROFILE_COUNT) {
mProfiles[profileType].stop(SystemClock.uptimeMillis());
}
}
/** Indicates the end of the frame.*/
public void endFrame() {
mFrameCount++;
}
/* Flushes all recorded timings from the profiler. */
public void resetAll() {
for (int x = 0; x < PROFILE_COUNT; x++) {
mProfiles[x].reset();
}
mFrameCount = 0;
}
/* Returns the average execution time, in milliseconds, for a given type. */
public long getAverageTime(int profileType) {
long time = 0;
if (profileType < PROFILE_COUNT) {
time = mProfiles[profileType].getAverageTime(mFrameCount);
}
return time;
}
/* Returns the minimum execution time in milliseconds for a given type. */
public long getMinTime(int profileType) {
long time = 0;
if (profileType < PROFILE_COUNT) {
time = mProfiles[profileType].getMinTime();
}
return time;
}
/* Returns the maximum execution time in milliseconds for a given type. */
public long getMaxTime(int profileType) {
long time = 0;
if (profileType < PROFILE_COUNT) {
time = mProfiles[profileType].getMaxTime();
}
return time;
}
/**
* A simple class for storing timing information about a single profile
* type.
*/
protected class ProfileRecord {
private long mStartTime;
private long mTotalTime;
private long mMinTime;
private long mMaxTime;
public void start(long time) {
mStartTime = time;
}
public void stop(long time) {
final long timeDelta = time - mStartTime;
mTotalTime += timeDelta;
if (mMinTime == 0 || timeDelta < mMinTime) {
mMinTime = timeDelta;
}
if (mMaxTime == 0 || timeDelta > mMaxTime) {
mMaxTime = timeDelta;
}
}
public long getAverageTime(int frameCount) {
long time = frameCount > 0 ? mTotalTime / frameCount : 0;
return time;
}
public long getMinTime() {
return mMinTime;
}
public long getMaxTime() {
return mMaxTime;
}
public void startNewProfilePeriod() {
mTotalTime = 0;
}
public void reset() {
mTotalTime = 0;
mStartTime = 0;
mMinTime = 0;
mMaxTime = 0;
}
}
}
| Java |
/*
* Copyright (C) 2009 The Android Open Source Project
*
* Licensed 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.
*/
package com.android.spritemethodtest;
import android.content.Context;
import android.graphics.Canvas;
import android.util.AttributeSet;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
/**
* Implements a surface view which writes updates to the surface's canvas using
* a separate rendering thread. This class is based heavily on GLSurfaceView.
*/
public class CanvasSurfaceView extends SurfaceView
implements SurfaceHolder.Callback {
private boolean mSizeChanged = true;
private SurfaceHolder mHolder;
private CanvasThread mCanvasThread;
public CanvasSurfaceView(Context context) {
super(context);
init();
}
public CanvasSurfaceView(Context context, AttributeSet attrs) {
super(context, attrs);
init();
}
private void init() {
// Install a SurfaceHolder.Callback so we get notified when the
// underlying surface is created and destroyed
mHolder = getHolder();
mHolder.addCallback(this);
mHolder.setType(SurfaceHolder.SURFACE_TYPE_NORMAL);
}
public SurfaceHolder getSurfaceHolder() {
return mHolder;
}
/** Sets the user's renderer and kicks off the rendering thread. */
public void setRenderer(Renderer renderer) {
mCanvasThread = new CanvasThread(mHolder, renderer);
mCanvasThread.start();
}
public void surfaceCreated(SurfaceHolder holder) {
mCanvasThread.surfaceCreated();
}
public void surfaceDestroyed(SurfaceHolder holder) {
// Surface will be destroyed when we return
mCanvasThread.surfaceDestroyed();
}
public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
// Surface size or format has changed. This should not happen in this
// example.
mCanvasThread.onWindowResize(w, h);
}
/** Inform the view that the activity is paused.*/
public void onPause() {
mCanvasThread.onPause();
}
/** Inform the view that the activity is resumed. */
public void onResume() {
mCanvasThread.onResume();
}
/** Inform the view that the window focus has changed. */
@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
mCanvasThread.onWindowFocusChanged(hasFocus);
}
/**
* Set an "event" to be run on the rendering thread.
* @param r the runnable to be run on the rendering thread.
*/
public void setEvent(Runnable r) {
mCanvasThread.setEvent(r);
}
/** Clears the runnable event, if any, from the rendering thread. */
public void clearEvent() {
mCanvasThread.clearEvent();
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
mCanvasThread.requestExitAndWait();
}
protected void stopDrawing() {
mCanvasThread.requestExitAndWait();
}
// ----------------------------------------------------------------------
/** A generic renderer interface. */
public interface Renderer {
/**
* Surface changed size.
* Called after the surface is created and whenever
* the surface size changes. Set your viewport here.
* @param width
* @param height
*/
void sizeChanged(int width, int height);
/**
* Draw the current frame.
* @param canvas The target canvas to draw into.
*/
void drawFrame(Canvas canvas);
}
/**
* A generic Canvas rendering Thread. Delegates to a Renderer instance to do
* the actual drawing.
*/
class CanvasThread extends Thread {
private boolean mDone;
private boolean mPaused;
private boolean mHasFocus;
private boolean mHasSurface;
private boolean mContextLost;
private int mWidth;
private int mHeight;
private Renderer mRenderer;
private Runnable mEvent;
private SurfaceHolder mSurfaceHolder;
CanvasThread(SurfaceHolder holder, Renderer renderer) {
super();
mDone = false;
mWidth = 0;
mHeight = 0;
mRenderer = renderer;
mSurfaceHolder = holder;
setName("CanvasThread");
}
@Override
public void run() {
boolean tellRendererSurfaceChanged = true;
/*
* This is our main activity thread's loop, we go until
* asked to quit.
*/
final ProfileRecorder profiler = ProfileRecorder.sSingleton;
while (!mDone) {
profiler.start(ProfileRecorder.PROFILE_FRAME);
/*
* Update the asynchronous state (window size)
*/
int w;
int h;
synchronized (this) {
// If the user has set a runnable to run in this thread,
// execute it and record the amount of time it takes to
// run.
if (mEvent != null) {
profiler.start(ProfileRecorder.PROFILE_SIM);
mEvent.run();
profiler.stop(ProfileRecorder.PROFILE_SIM);
}
if(needToWait()) {
while (needToWait()) {
try {
wait();
} catch (InterruptedException e) {
}
}
}
if (mDone) {
break;
}
tellRendererSurfaceChanged = mSizeChanged;
w = mWidth;
h = mHeight;
mSizeChanged = false;
}
if (tellRendererSurfaceChanged) {
mRenderer.sizeChanged(w, h);
tellRendererSurfaceChanged = false;
}
if ((w > 0) && (h > 0)) {
// Get ready to draw.
// We record both lockCanvas() and unlockCanvasAndPost()
// as part of "page flip" time because either may block
// until the previous frame is complete.
profiler.start(ProfileRecorder.PROFILE_PAGE_FLIP);
Canvas canvas = mSurfaceHolder.lockCanvas();
profiler.start(ProfileRecorder.PROFILE_PAGE_FLIP);
if (canvas != null) {
// Draw a frame!
profiler.start(ProfileRecorder.PROFILE_DRAW);
mRenderer.drawFrame(canvas);
profiler.stop(ProfileRecorder.PROFILE_DRAW);
profiler.start(ProfileRecorder.PROFILE_PAGE_FLIP);
mSurfaceHolder.unlockCanvasAndPost(canvas);
profiler.stop(ProfileRecorder.PROFILE_PAGE_FLIP);
}
}
profiler.stop(ProfileRecorder.PROFILE_FRAME);
profiler.endFrame();
}
}
private boolean needToWait() {
return (mPaused || (! mHasFocus) || (! mHasSurface) || mContextLost)
&& (! mDone);
}
public void surfaceCreated() {
synchronized(this) {
mHasSurface = true;
mContextLost = false;
notify();
}
}
public void surfaceDestroyed() {
synchronized(this) {
mHasSurface = false;
notify();
}
}
public void onPause() {
synchronized (this) {
mPaused = true;
}
}
public void onResume() {
synchronized (this) {
mPaused = false;
notify();
}
}
public void onWindowFocusChanged(boolean hasFocus) {
synchronized (this) {
mHasFocus = hasFocus;
if (mHasFocus == true) {
notify();
}
}
}
public void onWindowResize(int w, int h) {
synchronized (this) {
mWidth = w;
mHeight = h;
mSizeChanged = true;
}
}
public void requestExitAndWait() {
// don't call this from CanvasThread thread or it is a guaranteed
// deadlock!
synchronized(this) {
mDone = true;
notify();
}
try {
join();
} catch (InterruptedException ex) {
Thread.currentThread().interrupt();
}
}
/**
* Queue an "event" to be run on the rendering thread.
* @param r the runnable to be run on the rendering thread.
*/
public void setEvent(Runnable r) {
synchronized(this) {
mEvent = r;
}
}
public void clearEvent() {
synchronized(this) {
mEvent = null;
}
}
}
}
| Java |
/*
* Copyright (C) 2009 The Android Open Source Project
*
* Licensed 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.
*/
package com.android.spritemethodtest;
/**
* Base class defining the core set of information necessary to render (and move
* an object on the screen. This is an abstract type and must be derived to
* add methods to actually draw (see CanvasSprite and GLSprite).
*/
public abstract class Renderable {
// Position.
public float x;
public float y;
public float z;
// Velocity.
public float velocityX;
public float velocityY;
public float velocityZ;
// Size.
public float width;
public float height;
}
| Java |
/*
* Copyright (C) 2009 The Android Open Source Project
*
* Licensed 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.
*/
package com.android.spritemethodtest;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.os.Bundle;
import android.util.DisplayMetrics;
/**
* Activity for testing OpenGL ES drawing speed. This activity sets up sprites
* and passes them off to an OpenGLSurfaceView for rendering and movement.
*/
public class OpenGLTestActivity extends Activity {
private final static int SPRITE_WIDTH = 64;
private final static int SPRITE_HEIGHT = 64;
private GLSurfaceView mGLSurfaceView;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mGLSurfaceView = new GLSurfaceView(this);
SimpleGLRenderer spriteRenderer = new SimpleGLRenderer(this);
// Clear out any old profile results.
ProfileRecorder.sSingleton.resetAll();
final Intent callingIntent = getIntent();
// Allocate our sprites and add them to an array.
final int robotCount = callingIntent.getIntExtra("spriteCount", 10);
final boolean animate = callingIntent.getBooleanExtra("animate", true);
final boolean useVerts =
callingIntent.getBooleanExtra("useVerts", false);
final boolean useHardwareBuffers =
callingIntent.getBooleanExtra("useHardwareBuffers", false);
// Allocate space for the robot sprites + one background sprite.
GLSprite[] spriteArray = new GLSprite[robotCount + 1];
// We need to know the width and height of the display pretty soon,
// so grab the information now.
DisplayMetrics dm = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(dm);
GLSprite background = new GLSprite(R.drawable.background);
BitmapDrawable backgroundImage = (BitmapDrawable)getResources().getDrawable(R.drawable.background);
Bitmap backgoundBitmap = backgroundImage.getBitmap();
background.width = backgoundBitmap.getWidth();
background.height = backgoundBitmap.getHeight();
if (useVerts) {
// Setup the background grid. This is just a quad.
Grid backgroundGrid = new Grid(2, 2, false);
backgroundGrid.set(0, 0, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, null);
backgroundGrid.set(1, 0, background.width, 0.0f, 0.0f, 1.0f, 1.0f, null);
backgroundGrid.set(0, 1, 0.0f, background.height, 0.0f, 0.0f, 0.0f, null);
backgroundGrid.set(1, 1, background.width, background.height, 0.0f,
1.0f, 0.0f, null );
background.setGrid(backgroundGrid);
}
spriteArray[0] = background;
Grid spriteGrid = null;
if (useVerts) {
// Setup a quad for the sprites to use. All sprites will use the
// same sprite grid intance.
spriteGrid = new Grid(2, 2, false);
spriteGrid.set(0, 0, 0.0f, 0.0f, 0.0f, 0.0f , 1.0f, null);
spriteGrid.set(1, 0, SPRITE_WIDTH, 0.0f, 0.0f, 1.0f, 1.0f, null);
spriteGrid.set(0, 1, 0.0f, SPRITE_HEIGHT, 0.0f, 0.0f, 0.0f, null);
spriteGrid.set(1, 1, SPRITE_WIDTH, SPRITE_HEIGHT, 0.0f, 1.0f, 0.0f, null);
}
// This list of things to move. It points to the same content as the
// sprite list except for the background.
Renderable[] renderableArray = new Renderable[robotCount];
final int robotBucketSize = robotCount / 3;
for (int x = 0; x < robotCount; x++) {
GLSprite robot;
// Our robots come in three flavors. Split them up accordingly.
if (x < robotBucketSize) {
robot = new GLSprite(R.drawable.skate1);
} else if (x < robotBucketSize * 2) {
robot = new GLSprite(R.drawable.skate2);
} else {
robot = new GLSprite(R.drawable.skate3);
}
robot.width = SPRITE_WIDTH;
robot.height = SPRITE_HEIGHT;
// Pick a random location for this sprite.
robot.x = (float)(Math.random() * dm.widthPixels);
robot.y = (float)(Math.random() * dm.heightPixels);
// All sprites can reuse the same grid. If we're running the
// DrawTexture extension test, this is null.
robot.setGrid(spriteGrid);
// Add this robot to the spriteArray so it gets drawn and to the
// renderableArray so that it gets moved.
spriteArray[x + 1] = robot;
renderableArray[x] = robot;
}
// Now's a good time to run the GC. Since we won't do any explicit
// allocation during the test, the GC should stay dormant and not
// influence our results.
Runtime r = Runtime.getRuntime();
r.gc();
spriteRenderer.setSprites(spriteArray);
spriteRenderer.setVertMode(useVerts, useHardwareBuffers);
mGLSurfaceView.setRenderer(spriteRenderer);
if (animate) {
Mover simulationRuntime = new Mover();
simulationRuntime.setRenderables(renderableArray);
simulationRuntime.setViewSize(dm.widthPixels, dm.heightPixels);
mGLSurfaceView.setEvent(simulationRuntime);
}
setContentView(mGLSurfaceView);
}
}
| Java |
/*
* Copyright (C) 2009 The Android Open Source Project
*
* Licensed 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.
*/
package com.android.spritemethodtest;
import android.graphics.Canvas;
import com.android.spritemethodtest.CanvasSurfaceView.Renderer;
/**
* An extremely simple renderer based on the CanvasSurfaceView drawing
* framework. Simply draws a list of sprites to a canvas every frame.
*/
public class SimpleCanvasRenderer implements Renderer {
private CanvasSprite[] mSprites;
public void setSprites(CanvasSprite[] sprites) {
mSprites = sprites;
}
public void drawFrame(Canvas canvas) {
if (mSprites != null) {
for (int x = 0; x < mSprites.length; x++) {
mSprites[x].draw(canvas);
}
}
}
public void sizeChanged(int width, int height) {
}
}
| Java |
/*
* Copyright (C) 2009 The Android Open Source Project
*
* Licensed 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.
*/
// This file was lifted from the APIDemos sample. See:
// http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/graphics/index.html
package com.android.spritemethodtest;
import java.util.concurrent.Semaphore;
import javax.microedition.khronos.egl.EGL10;
import javax.microedition.khronos.egl.EGL11;
import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.egl.EGLContext;
import javax.microedition.khronos.egl.EGLDisplay;
import javax.microedition.khronos.egl.EGLSurface;
import javax.microedition.khronos.opengles.GL;
import javax.microedition.khronos.opengles.GL10;
import android.content.Context;
import android.util.AttributeSet;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
/**
* An implementation of SurfaceView that uses the dedicated surface for
* displaying an OpenGL animation. This allows the animation to run in a
* separate thread, without requiring that it be driven by the update mechanism
* of the view hierarchy.
*
* The application-specific rendering code is delegated to a GLView.Renderer
* instance.
*/
public class GLSurfaceView extends SurfaceView implements SurfaceHolder.Callback {
public GLSurfaceView(Context context) {
super(context);
init();
}
public GLSurfaceView(Context context, AttributeSet attrs) {
super(context, attrs);
init();
}
private void init() {
// Install a SurfaceHolder.Callback so we get notified when the
// underlying surface is created and destroyed
mHolder = getHolder();
mHolder.addCallback(this);
mHolder.setType(SurfaceHolder.SURFACE_TYPE_GPU);
}
public SurfaceHolder getSurfaceHolder() {
return mHolder;
}
public void setGLWrapper(GLWrapper glWrapper) {
mGLWrapper = glWrapper;
}
public void setRenderer(Renderer renderer) {
mGLThread = new GLThread(renderer);
mGLThread.start();
}
public void surfaceCreated(SurfaceHolder holder) {
mGLThread.surfaceCreated();
}
public void surfaceDestroyed(SurfaceHolder holder) {
// Surface will be destroyed when we return
mGLThread.surfaceDestroyed();
}
public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
// Surface size or format has changed. This should not happen in this
// example.
mGLThread.onWindowResize(w, h);
}
/**
* Inform the view that the activity is paused.
*/
public void onPause() {
mGLThread.onPause();
}
/**
* Inform the view that the activity is resumed.
*/
public void onResume() {
mGLThread.onResume();
}
/**
* Inform the view that the window focus has changed.
*/
@Override public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
mGLThread.onWindowFocusChanged(hasFocus);
}
/**
* Set an "event" to be run on the GL rendering thread.
* @param r the runnable to be run on the GL rendering thread.
*/
public void setEvent(Runnable r) {
mGLThread.setEvent(r);
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
mGLThread.requestExitAndWait();
}
// ----------------------------------------------------------------------
public interface GLWrapper {
GL wrap(GL gl);
}
// ----------------------------------------------------------------------
/**
* A generic renderer interface.
*/
public interface Renderer {
/**
* @return the EGL configuration specification desired by the renderer.
*/
int[] getConfigSpec();
/**
* Surface created.
* Called when the surface is created. Called when the application
* starts, and whenever the GPU is reinitialized. This will
* typically happen when the device awakes after going to sleep.
* Set your textures here.
*/
void surfaceCreated(GL10 gl);
/**
* Called when the rendering thread is about to shut down. This is a
* good place to release OpenGL ES resources (textures, buffers, etc).
* @param gl
*/
void shutdown(GL10 gl);
/**
* Surface changed size.
* Called after the surface is created and whenever
* the OpenGL ES surface size changes. Set your viewport here.
* @param gl
* @param width
* @param height
*/
void sizeChanged(GL10 gl, int width, int height);
/**
* Draw the current frame.
* @param gl
*/
void drawFrame(GL10 gl);
}
/**
* An EGL helper class.
*/
private class EglHelper {
public EglHelper() {
}
/**
* Initialize EGL for a given configuration spec.
* @param configSpec
*/
public void start(int[] configSpec){
/*
* Get an EGL instance
*/
mEgl = (EGL10) EGLContext.getEGL();
/*
* Get to the default display.
*/
mEglDisplay = mEgl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);
/*
* We can now initialize EGL for that display
*/
int[] version = new int[2];
mEgl.eglInitialize(mEglDisplay, version);
EGLConfig[] configs = new EGLConfig[1];
int[] num_config = new int[1];
mEgl.eglChooseConfig(mEglDisplay, configSpec, configs, 1,
num_config);
mEglConfig = configs[0];
/*
* Create an OpenGL ES context. This must be done only once, an
* OpenGL context is a somewhat heavy object.
*/
mEglContext = mEgl.eglCreateContext(mEglDisplay, mEglConfig,
EGL10.EGL_NO_CONTEXT, null);
mEglSurface = null;
}
/*
* Create and return an OpenGL surface
*/
public GL createSurface(SurfaceHolder holder) {
/*
* The window size has changed, so we need to create a new
* surface.
*/
if (mEglSurface != null) {
/*
* Unbind and destroy the old EGL surface, if
* there is one.
*/
mEgl.eglMakeCurrent(mEglDisplay, EGL10.EGL_NO_SURFACE,
EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_CONTEXT);
mEgl.eglDestroySurface(mEglDisplay, mEglSurface);
}
/*
* Create an EGL surface we can render into.
*/
mEglSurface = mEgl.eglCreateWindowSurface(mEglDisplay,
mEglConfig, holder, null);
/*
* Before we can issue GL commands, we need to make sure
* the context is current and bound to a surface.
*/
mEgl.eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface,
mEglContext);
GL gl = mEglContext.getGL();
if (mGLWrapper != null) {
gl = mGLWrapper.wrap(gl);
}
return gl;
}
/**
* Display the current render surface.
* @return false if the context has been lost.
*/
public boolean swap() {
mEgl.eglSwapBuffers(mEglDisplay, mEglSurface);
/*
* Always check for EGL_CONTEXT_LOST, which means the context
* and all associated data were lost (For instance because
* the device went to sleep). We need to sleep until we
* get a new surface.
*/
return mEgl.eglGetError() != EGL11.EGL_CONTEXT_LOST;
}
public void finish() {
if (mEglSurface != null) {
mEgl.eglMakeCurrent(mEglDisplay, EGL10.EGL_NO_SURFACE,
EGL10.EGL_NO_SURFACE,
EGL10.EGL_NO_CONTEXT);
mEgl.eglDestroySurface(mEglDisplay, mEglSurface);
mEglSurface = null;
}
if (mEglContext != null) {
mEgl.eglDestroyContext(mEglDisplay, mEglContext);
mEglContext = null;
}
if (mEglDisplay != null) {
mEgl.eglTerminate(mEglDisplay);
mEglDisplay = null;
}
}
EGL10 mEgl;
EGLDisplay mEglDisplay;
EGLSurface mEglSurface;
EGLConfig mEglConfig;
EGLContext mEglContext;
}
/**
* A generic GL Thread. Takes care of initializing EGL and GL. Delegates
* to a Renderer instance to do the actual drawing.
*
*/
class GLThread extends Thread {
GLThread(Renderer renderer) {
super();
mDone = false;
mWidth = 0;
mHeight = 0;
mRenderer = renderer;
setName("GLThread");
}
@Override
public void run() {
/*
* When the android framework launches a second instance of
* an activity, the new instance's onCreate() method may be
* called before the first instance returns from onDestroy().
*
* This semaphore ensures that only one instance at a time
* accesses EGL.
*/
try {
try {
sEglSemaphore.acquire();
} catch (InterruptedException e) {
return;
}
guardedRun();
} catch (InterruptedException e) {
// fall thru and exit normally
} finally {
sEglSemaphore.release();
}
}
private void guardedRun() throws InterruptedException {
mEglHelper = new EglHelper();
/*
* Specify a configuration for our opengl session
* and grab the first configuration that matches is
*/
int[] configSpec = mRenderer.getConfigSpec();
mEglHelper.start(configSpec);
GL10 gl = null;
boolean tellRendererSurfaceCreated = true;
boolean tellRendererSurfaceChanged = true;
/*
* This is our main activity thread's loop, we go until
* asked to quit.
*/
while (!mDone) {
ProfileRecorder.sSingleton.start(ProfileRecorder.PROFILE_FRAME);
/*
* Update the asynchronous state (window size)
*/
int w, h;
boolean changed;
boolean needStart = false;
synchronized (this) {
if (mEvent != null) {
ProfileRecorder.sSingleton.start(ProfileRecorder.PROFILE_SIM);
mEvent.run();
ProfileRecorder.sSingleton.stop(ProfileRecorder.PROFILE_SIM);
}
if (mPaused) {
mEglHelper.finish();
needStart = true;
}
if(needToWait()) {
while (needToWait()) {
wait();
}
}
if (mDone) {
break;
}
changed = mSizeChanged;
w = mWidth;
h = mHeight;
mSizeChanged = false;
}
if (needStart) {
mEglHelper.start(configSpec);
tellRendererSurfaceCreated = true;
changed = true;
}
if (changed) {
gl = (GL10) mEglHelper.createSurface(mHolder);
tellRendererSurfaceChanged = true;
}
if (tellRendererSurfaceCreated) {
mRenderer.surfaceCreated(gl);
tellRendererSurfaceCreated = false;
}
if (tellRendererSurfaceChanged) {
mRenderer.sizeChanged(gl, w, h);
tellRendererSurfaceChanged = false;
}
if ((w > 0) && (h > 0)) {
ProfileRecorder.sSingleton.start(ProfileRecorder.PROFILE_DRAW);
/* draw a frame here */
mRenderer.drawFrame(gl);
ProfileRecorder.sSingleton.stop(ProfileRecorder.PROFILE_DRAW);
/*
* Once we're done with GL, we need to call swapBuffers()
* to instruct the system to display the rendered frame
*/
ProfileRecorder.sSingleton.start(ProfileRecorder.PROFILE_PAGE_FLIP);
mEglHelper.swap();
ProfileRecorder.sSingleton.stop(ProfileRecorder.PROFILE_PAGE_FLIP);
}
ProfileRecorder.sSingleton.stop(ProfileRecorder.PROFILE_FRAME);
ProfileRecorder.sSingleton.endFrame();
}
/*
* clean-up everything...
*/
if (gl != null) {
mRenderer.shutdown(gl);
}
mEglHelper.finish();
}
private boolean needToWait() {
return (mPaused || (! mHasFocus) || (! mHasSurface) || mContextLost)
&& (! mDone);
}
public void surfaceCreated() {
synchronized(this) {
mHasSurface = true;
mContextLost = false;
notify();
}
}
public void surfaceDestroyed() {
synchronized(this) {
mHasSurface = false;
notify();
}
}
public void onPause() {
synchronized (this) {
mPaused = true;
}
}
public void onResume() {
synchronized (this) {
mPaused = false;
notify();
}
}
public void onWindowFocusChanged(boolean hasFocus) {
synchronized (this) {
mHasFocus = hasFocus;
if (mHasFocus == true) {
notify();
}
}
}
public void onWindowResize(int w, int h) {
synchronized (this) {
mWidth = w;
mHeight = h;
mSizeChanged = true;
}
}
public void requestExitAndWait() {
// don't call this from GLThread thread or it is a guaranteed
// deadlock!
synchronized(this) {
mDone = true;
notify();
}
try {
join();
} catch (InterruptedException ex) {
Thread.currentThread().interrupt();
}
}
/**
* Queue an "event" to be run on the GL rendering thread.
* @param r the runnable to be run on the GL rendering thread.
*/
public void setEvent(Runnable r) {
synchronized(this) {
mEvent = r;
}
}
public void clearEvent() {
synchronized(this) {
mEvent = null;
}
}
private boolean mDone;
private boolean mPaused;
private boolean mHasFocus;
private boolean mHasSurface;
private boolean mContextLost;
private int mWidth;
private int mHeight;
private Renderer mRenderer;
private Runnable mEvent;
private EglHelper mEglHelper;
}
private static final Semaphore sEglSemaphore = new Semaphore(1);
private boolean mSizeChanged = true;
private SurfaceHolder mHolder;
private GLThread mGLThread;
private GLWrapper mGLWrapper;
}
| Java |
/*
* Copyright (C) 2008 The Android Open Source Project
*
* Licensed 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.
*/
package com.android.spritemethodtest;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.RadioGroup;
/**
* Main entry point for the SpriteMethodTest application. This application
* provides a simple interface for testing the relative speed of 2D rendering
* systems available on Android, namely the Canvas system and OpenGL ES. It
* also serves as an example of how SurfaceHolders can be used to create an
* efficient rendering thread for drawing.
*/
public class SpriteMethodTest extends Activity {
private static final int ACTIVITY_TEST = 0;
private static final int RESULTS_DIALOG = 0;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
// Sets up a click listener for the Run Test button.
Button button;
button = (Button) findViewById(R.id.runTest);
button.setOnClickListener(mRunTestListener);
// Turns on one item by default in our radio groups--as it should be!
RadioGroup group = (RadioGroup)findViewById(R.id.renderMethod);
group.setOnCheckedChangeListener(mMethodChangedListener);
group.check(R.id.methodCanvas);
RadioGroup glSettings = (RadioGroup)findViewById(R.id.GLSettings);
glSettings.check(R.id.settingVerts);
}
/** Passes preferences about the test via its intent. */
protected void initializeIntent(Intent i) {
final CheckBox checkBox = (CheckBox) findViewById(R.id.animateSprites);
final boolean animate = checkBox.isChecked();
final EditText editText = (EditText) findViewById(R.id.spriteCount);
final String spriteCountText = editText.getText().toString();
final int stringCount = Integer.parseInt(spriteCountText);
i.putExtra("animate", animate);
i.putExtra("spriteCount", stringCount);
}
/**
* Responds to a click on the Run Test button by launching a new test
* activity.
*/
View.OnClickListener mRunTestListener = new OnClickListener() {
public void onClick(View v) {
RadioGroup group = (RadioGroup)findViewById(R.id.renderMethod);
Intent i;
if (group.getCheckedRadioButtonId() == R.id.methodCanvas) {
i = new Intent(v.getContext(), CanvasTestActivity.class);
} else {
i = new Intent(v.getContext(), OpenGLTestActivity.class);
RadioGroup glSettings =
(RadioGroup)findViewById(R.id.GLSettings);
if (glSettings.getCheckedRadioButtonId() == R.id.settingVerts) {
i.putExtra("useVerts", true);
} else if (glSettings.getCheckedRadioButtonId()
== R.id.settingVBO) {
i.putExtra("useVerts", true);
i.putExtra("useHardwareBuffers", true);
}
}
initializeIntent(i);
startActivityForResult(i, ACTIVITY_TEST);
}
};
/**
* Enables or disables OpenGL ES-specific settings controls when the render
* method option changes.
*/
RadioGroup.OnCheckedChangeListener mMethodChangedListener
= new RadioGroup.OnCheckedChangeListener() {
public void onCheckedChanged(RadioGroup group, int checkedId) {
if (checkedId == R.id.methodCanvas) {
findViewById(R.id.settingDrawTexture).setEnabled(false);
findViewById(R.id.settingVerts).setEnabled(false);
findViewById(R.id.settingVBO).setEnabled(false);
} else {
findViewById(R.id.settingDrawTexture).setEnabled(true);
findViewById(R.id.settingVerts).setEnabled(true);
findViewById(R.id.settingVBO).setEnabled(true);
}
}
};
/** Creates the test results dialog and fills in a dummy message. */
@Override
protected Dialog onCreateDialog(int id) {
Dialog dialog = null;
if (id == RESULTS_DIALOG) {
String dummy = "No results yet.";
CharSequence sequence = dummy.subSequence(0, dummy.length() -1);
dialog = new AlertDialog.Builder(this)
.setTitle(R.string.dialog_title)
.setPositiveButton(R.string.dialog_ok, null)
.setMessage(sequence)
.create();
}
return dialog;
}
/**
* Replaces the dummy message in the test results dialog with a string that
* describes the actual test results.
*/
protected void onPrepareDialog (int id, Dialog dialog) {
if (id == RESULTS_DIALOG) {
// Extract final timing information from the profiler.
final ProfileRecorder profiler = ProfileRecorder.sSingleton;
final long frameTime =
profiler.getAverageTime(ProfileRecorder.PROFILE_FRAME);
final long frameMin =
profiler.getMinTime(ProfileRecorder.PROFILE_FRAME);
final long frameMax =
profiler.getMaxTime(ProfileRecorder.PROFILE_FRAME);
final long drawTime =
profiler.getAverageTime(ProfileRecorder.PROFILE_DRAW);
final long drawMin =
profiler.getMinTime(ProfileRecorder.PROFILE_DRAW);
final long drawMax =
profiler.getMaxTime(ProfileRecorder.PROFILE_DRAW);
final long flipTime =
profiler.getAverageTime(ProfileRecorder.PROFILE_PAGE_FLIP);
final long flipMin =
profiler.getMinTime(ProfileRecorder.PROFILE_PAGE_FLIP);
final long flipMax =
profiler.getMaxTime(ProfileRecorder.PROFILE_PAGE_FLIP);
final long simTime =
profiler.getAverageTime(ProfileRecorder.PROFILE_SIM);
final long simMin =
profiler.getMinTime(ProfileRecorder.PROFILE_SIM);
final long simMax =
profiler.getMaxTime(ProfileRecorder.PROFILE_SIM);
final float fps = frameTime > 0 ? 1000.0f / frameTime : 0.0f;
String result = "Frame: " + frameTime + "ms (" + fps + " fps)\n"
+ "\t\tMin: " + frameMin + "ms\t\tMax: " + frameMax + "\n"
+ "Draw: " + drawTime + "ms\n"
+ "\t\tMin: " + drawMin + "ms\t\tMax: " + drawMax + "\n"
+ "Page Flip: " + flipTime + "ms\n"
+ "\t\tMin: " + flipMin + "ms\t\tMax: " + flipMax + "\n"
+ "Sim: " + simTime + "ms\n"
+ "\t\tMin: " + simMin + "ms\t\tMax: " + simMax + "\n";
CharSequence sequence = result.subSequence(0, result.length() -1);
AlertDialog alertDialog = (AlertDialog)dialog;
alertDialog.setMessage(sequence);
}
}
/** Shows the results dialog when the test activity closes. */
@Override
protected void onActivityResult(int requestCode, int resultCode,
Intent intent) {
super.onActivityResult(requestCode, resultCode, intent);
showDialog(RESULTS_DIALOG);
}
} | Java |
/*
* Copyright (C) 2009 The Android Open Source Project
*
* Licensed 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.
*/
package com.android.spritemethodtest;
import javax.microedition.khronos.opengles.GL10;
import javax.microedition.khronos.opengles.GL11Ext;
/**
* This is the OpenGL ES version of a sprite. It is more complicated than the
* CanvasSprite class because it can be used in more than one way. This class
* can draw using a grid of verts, a grid of verts stored in VBO objects, or
* using the DrawTexture extension.
*/
public class GLSprite extends Renderable {
// The OpenGL ES texture handle to draw.
private int mTextureName;
// The id of the original resource that mTextureName is based on.
private int mResourceId;
// If drawing with verts or VBO verts, the grid object defining those verts.
private Grid mGrid;
public GLSprite(int resourceId) {
super();
mResourceId = resourceId;
}
public void setTextureName(int name) {
mTextureName = name;
}
public int getTextureName() {
return mTextureName;
}
public void setResourceId(int id) {
mResourceId = id;
}
public int getResourceId() {
return mResourceId;
}
public void setGrid(Grid grid) {
mGrid = grid;
}
public Grid getGrid() {
return mGrid;
}
public void draw(GL10 gl) {
gl.glBindTexture(GL10.GL_TEXTURE_2D, mTextureName);
if (mGrid == null) {
// Draw using the DrawTexture extension.
((GL11Ext) gl).glDrawTexfOES(x, y, z, width, height);
} else {
// Draw using verts or VBO verts.
gl.glPushMatrix();
gl.glLoadIdentity();
gl.glTranslatef(
x,
y,
z);
mGrid.draw(gl, true, false);
gl.glPopMatrix();
}
}
}
| Java |
/*
* Copyright (C) 2009 The Android Open Source Project
*
* Licensed 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.
*/
package com.android.spritemethodtest;
import java.io.IOException;
import java.io.InputStream;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.util.DisplayMetrics;
/**
* Activity for testing Canvas drawing speed. This activity sets up sprites and
* passes them off to a CanvasSurfaceView for rendering and movement. It is
* very similar to OpenGLTestActivity. Note that Bitmap objects come out of a
* pool and must be explicitly recycled on shutdown. See onDestroy().
*/
public class CanvasTestActivity extends Activity {
private CanvasSurfaceView mCanvasSurfaceView;
// Describes the image format our bitmaps should be converted to.
private static BitmapFactory.Options sBitmapOptions
= new BitmapFactory.Options();
private Bitmap[] mBitmaps;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mCanvasSurfaceView = new CanvasSurfaceView(this);
SimpleCanvasRenderer spriteRenderer = new SimpleCanvasRenderer();
// Sets our preferred image format to 16-bit, 565 format.
sBitmapOptions.inPreferredConfig = Bitmap.Config.RGB_565;
// Clear out any old profile results.
ProfileRecorder.sSingleton.resetAll();
final Intent callingIntent = getIntent();
// Allocate our sprites and add them to an array.
final int robotCount = callingIntent.getIntExtra("spriteCount", 10);
final boolean animate = callingIntent.getBooleanExtra("animate", true);
// Allocate space for the robot sprites + one background sprite.
CanvasSprite[] spriteArray = new CanvasSprite[robotCount + 1];
mBitmaps = new Bitmap[4];
mBitmaps[0] = loadBitmap(this, R.drawable.background);
mBitmaps[1] = loadBitmap(this, R.drawable.skate1);
mBitmaps[2] = loadBitmap(this, R.drawable.skate2);
mBitmaps[3] = loadBitmap(this, R.drawable.skate3);
// We need to know the width and height of the display pretty soon,
// so grab the information now.
DisplayMetrics dm = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(dm);
// Make the background.
// Note that the background image is larger than the screen,
// so some clipping will occur when it is drawn.
CanvasSprite background = new CanvasSprite(mBitmaps[0]);
background.width = mBitmaps[0].getWidth();
background.height = mBitmaps[0].getHeight();
spriteArray[0] = background;
// This list of things to move. It points to the same content as
// spriteArray except for the background.
Renderable[] renderableArray = new Renderable[robotCount];
final int robotBucketSize = robotCount / 3;
for (int x = 0; x < robotCount; x++) {
CanvasSprite robot;
// Our robots come in three flavors. Split them up accordingly.
if (x < robotBucketSize) {
robot = new CanvasSprite(mBitmaps[1]);
} else if (x < robotBucketSize * 2) {
robot = new CanvasSprite(mBitmaps[2]);
} else {
robot = new CanvasSprite(mBitmaps[3]);
}
robot.width = 64;
robot.height = 64;
// Pick a random location for this sprite.
robot.x = (float)(Math.random() * dm.widthPixels);
robot.y = (float)(Math.random() * dm.heightPixels);
// Add this robot to the spriteArray so it gets drawn and to the
// renderableArray so that it gets moved.
spriteArray[x + 1] = robot;
renderableArray[x] = robot;
}
// Now's a good time to run the GC. Since we won't do any explicit
// allocation during the test, the GC should stay dormant and not
// influence our results.
Runtime r = Runtime.getRuntime();
r.gc();
spriteRenderer.setSprites(spriteArray);
mCanvasSurfaceView.setRenderer(spriteRenderer);
if (animate) {
Mover simulationRuntime = new Mover();
simulationRuntime.setRenderables(renderableArray);
simulationRuntime.setViewSize(dm.widthPixels, dm.heightPixels);
mCanvasSurfaceView.setEvent(simulationRuntime);
}
setContentView(mCanvasSurfaceView);
}
/** Recycles all of the bitmaps loaded in onCreate(). */
@Override
protected void onDestroy() {
super.onDestroy();
mCanvasSurfaceView.clearEvent();
mCanvasSurfaceView.stopDrawing();
for (int x = 0; x < mBitmaps.length; x++) {
mBitmaps[x].recycle();
mBitmaps[x] = null;
}
}
/**
* Loads a bitmap from a resource and converts it to a bitmap. This is
* a much-simplified version of the loadBitmap() that appears in
* SimpleGLRenderer.
* @param context The application context.
* @param resourceId The id of the resource to load.
* @return A bitmap containing the image contents of the resource, or null
* if there was an error.
*/
protected Bitmap loadBitmap(Context context, int resourceId) {
Bitmap bitmap = null;
if (context != null) {
InputStream is = context.getResources().openRawResource(resourceId);
try {
bitmap = BitmapFactory.decodeStream(is, null, sBitmapOptions);
} finally {
try {
is.close();
} catch (IOException e) {
// Ignore.
}
}
}
return bitmap;
}
}
| Java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.