[EDIT] Cambios

parent 3524a041
<?xml version="1.0" encoding="UTF-8"?>
<!-- You may freely edit this file. See commented blocks below for -->
<!-- some examples of how to customize the build. -->
<!-- (If you delete it and reopen the project it will be recreated.) -->
<!-- By default, only the Clean and Build commands use this build script. -->
<!-- Commands such as Run, Debug, and Test only use this build script if -->
<!-- the Compile on Save feature is turned off for the project. -->
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
<!-- in the project's Project Properties dialog box.-->
<project name="demojsoncrud" default="default" basedir=".">
<description>Builds, tests, and runs the project demojsoncrud.</description>
<import file="nbproject/build-impl.xml"/>
<!--
There exist several targets which are by default empty and which can be
used for execution of your tasks. These targets are usually executed
before and after some main targets. They are:
-pre-init: called before initialization of project properties
-post-init: called after initialization of project properties
-pre-compile: called before javac compilation
-post-compile: called after javac compilation
-pre-compile-single: called before javac compilation of single file
-post-compile-single: called after javac compilation of single file
-pre-compile-test: called before javac compilation of JUnit tests
-post-compile-test: called after javac compilation of JUnit tests
-pre-compile-test-single: called before javac compilation of single JUnit test
-post-compile-test-single: called after javac compilation of single JUunit test
-pre-dist: called before archive building
-post-dist: called after archive building
-post-clean: called after cleaning build products
-pre-run-deploy: called before deploying
-post-run-deploy: called after deploying
Example of pluging an obfuscator after the compilation could look like
<target name="-post-compile">
<obfuscate>
<fileset dir="${build.classes.dir}"/>
</obfuscate>
</target>
For list of available properties check the imported
nbproject/build-impl.xml file.
Other way how to customize the build is by overriding existing main targets.
The target of interest are:
init-macrodef-javac: defines macro for javac compilation
init-macrodef-junit: defines macro for junit execution
init-macrodef-debug: defines macro for class debugging
do-dist: archive building
run: execution of project
javadoc-build: javadoc generation
Example of overriding the target for project execution could look like
<target name="run" depends="<PROJNAME>-impl.jar">
<exec dir="bin" executable="launcher.exe">
<arg file="${dist.jar}"/>
</exec>
</target>
Notice that overridden target depends on jar target and not only on
compile target as regular run target does. Again, for list of available
properties which you can use check the target you are overriding in
nbproject/build-impl.xml file.
-->
</project>
<?xml version="1.0" encoding="UTF-8"?>
<!-- You may freely edit this file. See commented blocks below for -->
<!-- some examples of how to customize the build. -->
<!-- (If you delete it and reopen the project it will be recreated.) -->
<!-- By default, only the Clean and Build commands use this build script. -->
<!-- Commands such as Run, Debug, and Test only use this build script if -->
<!-- the Compile on Save feature is turned off for the project. -->
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
<!-- in the project's Project Properties dialog box.-->
<project name="demojsoncrud" default="default" basedir=".">
<description>Builds, tests, and runs the project demojsoncrud.</description>
<import file="nbproject/build-impl.xml"/>
<!--
There exist several targets which are by default empty and which can be
used for execution of your tasks. These targets are usually executed
before and after some main targets. They are:
-pre-init: called before initialization of project properties
-post-init: called after initialization of project properties
-pre-compile: called before javac compilation
-post-compile: called after javac compilation
-pre-compile-single: called before javac compilation of single file
-post-compile-single: called after javac compilation of single file
-pre-compile-test: called before javac compilation of JUnit tests
-post-compile-test: called after javac compilation of JUnit tests
-pre-compile-test-single: called before javac compilation of single JUnit test
-post-compile-test-single: called after javac compilation of single JUunit test
-pre-dist: called before archive building
-post-dist: called after archive building
-post-clean: called after cleaning build products
-pre-run-deploy: called before deploying
-post-run-deploy: called after deploying
Example of pluging an obfuscator after the compilation could look like
<target name="-post-compile">
<obfuscate>
<fileset dir="${build.classes.dir}"/>
</obfuscate>
</target>
For list of available properties check the imported
nbproject/build-impl.xml file.
Other way how to customize the build is by overriding existing main targets.
The target of interest are:
init-macrodef-javac: defines macro for javac compilation
init-macrodef-junit: defines macro for junit execution
init-macrodef-debug: defines macro for class debugging
do-dist: archive building
run: execution of project
javadoc-build: javadoc generation
Example of overriding the target for project execution could look like
<target name="run" depends="<PROJNAME>-impl.jar">
<exec dir="bin" executable="launcher.exe">
<arg file="${dist.jar}"/>
</exec>
</target>
Notice that overridden target depends on jar target and not only on
compile target as regular run target does. Again, for list of available
properties which you can use check the target you are overriding in
nbproject/build-impl.xml file.
-->
</project>
This source diff could not be displayed because it is too large. You can view the blob instead.
build.xml.data.CRC32=4cd4cb5e
build.xml.script.CRC32=615931b7
build.xml.stylesheet.CRC32=651128d4@1.77.1.1
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=4cd4cb5e
nbproject/build-impl.xml.script.CRC32=efa11df6
nbproject/build-impl.xml.stylesheet.CRC32=99ea4b56@1.77.1.1
build.xml.data.CRC32=66ba06da
build.xml.script.CRC32=615931b7
build.xml.stylesheet.CRC32=651128d4@1.77.1.1
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=66ba06da
nbproject/build-impl.xml.script.CRC32=816bdc64
nbproject/build-impl.xml.stylesheet.CRC32=99ea4b56@1.77.1.1
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.web.project</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/web-project/3">
<name>demojsoncrud</name>
<minimum-ant-version>1.6.5</minimum-ant-version>
<web-module-libraries>
<library dirs="200">
<file>${file.reference.json-20160810.jar}</file>
<path-in-war>WEB-INF/lib</path-in-war>
</library>
<library dirs="200">
<file>${file.reference.sqljdbc4-2.0.jar}</file>
<path-in-war>WEB-INF/lib</path-in-war>
</library>
</web-module-libraries>
<web-module-additional-libraries/>
<source-roots>
<root id="src.dir"/>
</source-roots>
<test-roots>
<root id="test.src.dir"/>
</test-roots>
</data>
</configuration>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.web.project</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/web-project/3">
<name>demojsoncrud</name>
<minimum-ant-version>1.6.5</minimum-ant-version>
<web-module-libraries>
<library dirs="200">
<file>${file.reference.json-20160212.jar}</file>
<path-in-war>WEB-INF/lib</path-in-war>
</library>
<library dirs="200">
<file>${file.reference.sqljdbc4.jar}</file>
<path-in-war>WEB-INF/lib</path-in-war>
</library>
</web-module-libraries>
<web-module-additional-libraries/>
<source-roots>
<root id="src.dir"/>
</source-roots>
<test-roots>
<root id="test.src.dir"/>
</test-roots>
</data>
</configuration>
</project>
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package demojsoncrud.beans;
import java.io.Serializable;
/**
*
* @author Alonso
*/
public class PersonaBean implements Serializable {
private String codigo;
private String dni;
private String apellidos;
private String nombres;
private String edad;
private String correo;
private String estado;
public PersonaBean() {
}
public String getCodigo() {
return codigo;
}
public void setCodigo(String codigo) {
this.codigo = codigo;
}
public String getDni() {
return dni;
}
public void setDni(String dni) {
this.dni = dni;
}
public String getApellidos() {
return apellidos;
}
public void setApellidos(String apellidos) {
this.apellidos = apellidos;
}
public String getNombres() {
return nombres;
}
public void setNombres(String nombres) {
this.nombres = nombres;
}
public String getEdad() {
return edad;
}
public void setEdad(String edad) {
this.edad = edad;
}
public String getCorreo() {
return correo;
}
public void setCorreo(String correo) {
this.correo = correo;
}
public String getEstado() {
return estado;
}
public void setEstado(String estado) {
this.estado = estado;
}
}
package demojsoncrud.beans;
import java.io.Serializable;
/**
*
* @author Alonso
*/
public class PersonaBean implements Serializable {
private String codigo;
private String dni;
private String apellidos;
private String nombres;
private String edad;
private String correo;
private String estado;
public PersonaBean() {
}
public String getCodigo() {
return codigo;
}
public void setCodigo(String codigo) {
this.codigo = codigo;
}
public String getDni() {
return dni;
}
public void setDni(String dni) {
this.dni = dni;
}
public String getApellidos() {
return apellidos;
}
public void setApellidos(String apellidos) {
this.apellidos = apellidos;
}
public String getNombres() {
return nombres;
}
public void setNombres(String nombres) {
this.nombres = nombres;
}
public String getEdad() {
return edad;
}
public void setEdad(String edad) {
this.edad = edad;
}
public String getCorreo() {
return correo;
}
public void setCorreo(String correo) {
this.correo = correo;
}
public String getEstado() {
return estado;
}
public void setEstado(String estado) {
this.estado = estado;
}
}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package demojsoncrud.dao;
import demojsoncrud.sqlserverdao.SqlserverDAOFactory;
/**
*
* @author Alonso
*/
public abstract class DAOFactory {
public static final int SQL_SERVER = 1;
public static final int MYSQL = 2;
public static DAOFactory getDAOFactory(int whichFactory) {
switch (whichFactory) {
case SQL_SERVER:
return new SqlserverDAOFactory();
default:
return null;
}
}
public abstract PersonaDAO getPersonaDAO();
}
package demojsoncrud.dao;
import demojsoncrud.sqlserverdao.SqlserverDAOFactory;
public abstract class DAOFactory {
public static final int SQL_SERVER = 1;
public static final int MYSQL = 2;
public static DAOFactory getDAOFactory(int whichFactory) {
switch (whichFactory) {
case SQL_SERVER:
return new SqlserverDAOFactory();
default:
return null;
}
}
public abstract PersonaDAO getPersonaDAO();
}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package demojsoncrud.dao;
import demojsoncrud.beans.PersonaBean;
import org.json.JSONObject;
/**
*
* @author Alonso
*/
public interface PersonaDAO {
public JSONObject listarPersonaTest();
public JSONObject listarPersona(String search, String draw, String start, String length);
public JSONObject registrarPersona(PersonaBean bean);
public JSONObject editarPersona(PersonaBean bean);
public JSONObject activarPersona(PersonaBean bean);
public JSONObject desactivarPersona(PersonaBean bean);
}
package demojsoncrud.dao;
import demojsoncrud.beans.PersonaBean;
import org.json.JSONObject;
public interface PersonaDAO {
public JSONObject listarPersonaTest();
public JSONObject listarPersona(String search, String draw, String start, String length);
public JSONObject registrarPersona(PersonaBean bean);
public JSONObject editarPersona(PersonaBean bean);
public JSONObject activarPersona(PersonaBean bean);
public JSONObject desactivarPersona(PersonaBean bean);
}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package demojsoncrud.services;
import demojsoncrud.beans.PersonaBean;
import demojsoncrud.dao.DAOFactory;
import demojsoncrud.dao.PersonaDAO;
import org.json.JSONObject;
/**
*
* @author Alonso
*/
public class PersonaService {
DAOFactory daoFactory = DAOFactory.getDAOFactory(DAOFactory.SQL_SERVER);
PersonaDAO service = daoFactory.getPersonaDAO();
public JSONObject listarPersonaTest() {
JSONObject jsonReturn = null;
try {
jsonReturn = service.listarPersonaTest();
} catch (Exception e) {
e.getMessage();
}
return jsonReturn;
}
public JSONObject listarPersona(String search, String draw, String start, String length) {
JSONObject jsonReturn = null;
try {
jsonReturn = service.listarPersona(search, draw, start, length);
} catch (Exception e) {
e.getMessage();
}
return jsonReturn;
}
public JSONObject registrarPersona(PersonaBean bean) {
JSONObject jsonReturn = null;
try {
jsonReturn = service.registrarPersona(bean);
} catch (Exception e) {
e.getMessage();
}
return jsonReturn;
}
public JSONObject editarPersona(PersonaBean bean) {
JSONObject jsonReturn = null;
try {
jsonReturn = service.editarPersona(bean);
} catch (Exception e) {
e.getMessage();
}
return jsonReturn;
}
public JSONObject activarPersona(PersonaBean bean) {
JSONObject jsonReturn = null;
try {
jsonReturn = service.activarPersona(bean);
} catch (Exception e) {
}
return jsonReturn;
}
public JSONObject desactivarPersona(PersonaBean bean) {
JSONObject jsonReturn = null;
try {
jsonReturn = service.desactivarPersona(bean);
} catch (Exception e) {
}
return jsonReturn;
}
}
package demojsoncrud.services;
import demojsoncrud.beans.PersonaBean;
import demojsoncrud.dao.DAOFactory;
import demojsoncrud.dao.PersonaDAO;
import org.json.JSONObject;
public class PersonaService {
DAOFactory daoFactory = DAOFactory.getDAOFactory(DAOFactory.SQL_SERVER);
PersonaDAO service = daoFactory.getPersonaDAO();
public JSONObject listarPersonaTest() {
JSONObject jsonReturn = null;
try {
jsonReturn = service.listarPersonaTest();
} catch (Exception e) {
e.getMessage();
}
return jsonReturn;
}
public JSONObject listarPersona(String search, String draw, String start, String length) {
JSONObject jsonReturn = null;
try {
jsonReturn = service.listarPersona(search, draw, start, length);
} catch (Exception e) {
e.getMessage();
}
return jsonReturn;
}
public JSONObject registrarPersona(PersonaBean bean) {
JSONObject jsonReturn = null;
try {
jsonReturn = service.registrarPersona(bean);
} catch (Exception e) {
e.getMessage();
}
return jsonReturn;
}
public JSONObject editarPersona(PersonaBean bean) {
JSONObject jsonReturn = null;
try {
jsonReturn = service.editarPersona(bean);
} catch (Exception e) {
e.getMessage();
}
return jsonReturn;
}
public JSONObject activarPersona(PersonaBean bean) {
JSONObject jsonReturn = null;
try {
jsonReturn = service.activarPersona(bean);
} catch (Exception e) {
}
return jsonReturn;
}
public JSONObject desactivarPersona(PersonaBean bean) {
JSONObject jsonReturn = null;
try {
jsonReturn = service.desactivarPersona(bean);
} catch (Exception e) {
}
return jsonReturn;
}
}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package demojsoncrud.sqlserverdao;
import demojsoncrud.dao.DAOFactory;
import demojsoncrud.dao.PersonaDAO;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
/**
*
* @author Alonso
*/
public class SqlserverDAOFactory extends DAOFactory {
public static Connection obtenerConexion(String base) {
Connection connection = null;
if (base.equalsIgnoreCase("demojsoncrud")) {
String user = "sa";
String pwd = "Saco1357$";
String url = "jdbc:sqlserver://localhost:1433;databaseName=demojsoncrud";
String driver = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
try {
Class.forName(driver);
connection = DriverManager.getConnection(url, user, pwd);
} catch (ClassNotFoundException | SQLException e) {
System.out.println("Error al conectarse => " + e.getMessage());
}
}
return connection;
}
// public static void main(String[] args) {
// SqlserverDAOFactory sqlserverDAOFactory = new SqlserverDAOFactory();
// System.out.println(sqlserverDAOFactory.obtenerConexion("demojsoncrud"));
// }
@Override
public PersonaDAO getPersonaDAO() {
return new PersonaSqlserverDAO();
}
}
package demojsoncrud.sqlserverdao;
import demojsoncrud.dao.DAOFactory;
import demojsoncrud.dao.PersonaDAO;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class SqlserverDAOFactory extends DAOFactory {
public static Connection obtenerConexion(String base) {
Connection connection = null;
if (base.equalsIgnoreCase("demojsoncrud")) {
String user = "sa";
String pwd = "Saco1357$";
String url = "jdbc:sqlserver://172.16.2.118:1433;databaseName=demojsoncrud";
String driver = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
try {
Class.forName(driver);
connection = DriverManager.getConnection(url, user, pwd);
} catch (ClassNotFoundException | SQLException e) {
System.out.println("Error al conectarse => " + e.getMessage());
}
}
return connection;
}
// public static void main(String[] args) {
// SqlserverDAOFactory sqlserverDAOFactory = new SqlserverDAOFactory();
// System.out.println(sqlserverDAOFactory.obtenerConexion("demojsoncrud"));
// }
@Override
public PersonaDAO getPersonaDAO() {
return new PersonaSqlserverDAO();
}
}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package demojsoncrud.utils;
import java.io.Serializable;
import org.json.JSONObject;
/**
*
* @author Alonso
*/
public class ResponseHelper implements Serializable {
private JSONObject data;
private boolean status;
private String message;
public ResponseHelper() {
}
public JSONObject getData() {
return data;
}
public boolean isStatus() {
return status;
}
public String getMessage() {
return message;
}
public void setData(JSONObject data) {
this.data = data;
}
public void setStatus(boolean status) {
this.status = status;
}
public void setMessage(String message) {
this.message = message;
}
}
package demojsoncrud.utilities;
import java.io.Serializable;
import org.json.JSONObject;
public class ResponseHelper implements Serializable {
private JSONObject data;
private boolean status;
private String message;
public ResponseHelper() {
}
public JSONObject getData() {
return data;
}
public boolean isStatus() {
return status;
}
public String getMessage() {
return message;
}
public void setData(JSONObject data) {
this.data = data;
}
public void setStatus(boolean status) {
this.status = status;
}
public void setMessage(String message) {
this.message = message;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment