repo_name
stringlengths
7
104
file_path
stringlengths
13
198
context
stringlengths
67
7.15k
import_statement
stringlengths
16
4.43k
code
stringlengths
40
6.98k
prompt
stringlengths
227
8.27k
next_line
stringlengths
8
795
fblupi/master_informatica-DSS
P2-previo/jpa.eclipselink/src/jpa/eclipselink/principal/JpaTest.java
// Path: P2-previo/jpa.eclipselink/src/jpa/eclipselink/modelo/Familia.java // @Entity // public class Familia { // @Id // @GeneratedValue(strategy = GenerationType.TABLE) // private int id; // private String descripcion; // // @OneToMany(mappedBy = "familia") // private final List<Persona> miembros = new ArrayList<Persona>(); // // public int getId() { // return id; // } // // public void setId(int id) { // this.id = id; // } // // public String getDescripcion() { // return descripcion; // } // // public void setDescripcion(String descripcion) { // this.descripcion = descripcion; // } // // public List<Persona> getMiembros() { // return miembros; // } // // } // // Path: P2-previo/jpa.eclipselink/src/jpa/eclipselink/modelo/Persona.java // @Entity // public class Persona { // @Id // @GeneratedValue(strategy = GenerationType.TABLE) // private String id; // private String nombre; // private String apellidos; // // private Familia familia; // // private String campoSinSentido = ""; // // private List<Empleo> listaEmpleos = new ArrayList<Empleo>(); // // public String getId() { // return id; // } // // public void setId(String id) { // this.id = id; // } // // public String getNombre() { // return nombre; // } // // public void setNombre(String nombre) { // this.nombre = nombre; // } // // public String getApellidos() { // return apellidos; // } // // public void setApellidos(String apellidos) { // this.apellidos = apellidos; // } // // @ManyToOne // public Familia getFamilia() { // return familia; // } // // public void setFamilia(Familia familia) { // this.familia = familia; // } // // @Transient // public String getCampoSinSentido() { // return campoSinSentido; // } // // public void setCampoSinSentido(String campoSinSentido) { // this.campoSinSentido = campoSinSentido; // } // // @OneToMany // public List<Empleo> getListaEmpleos() { // return this.listaEmpleos; // } // // public void setListaEmpleos(List<Empleo> listaEmpleos) { // this.listaEmpleos = listaEmpleos; // } // // }
import static org.junit.Assert.assertTrue; import org.junit.Before; import org.junit.Test; import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; import javax.persistence.Persistence; import javax.persistence.Query; import jpa.eclipselink.modelo.Familia; import jpa.eclipselink.modelo.Persona;
package jpa.eclipselink.principal; public class JpaTest { private static final String PERSISTENCE_UNIT_NAME = "relaciones_persistentes"; private EntityManagerFactory factoria; @Before public void setUp() throws Exception { factoria = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME); EntityManager em = factoria.createEntityManager(); // Comenzar una nueva transaccion local de tal forma que pueda persistir como una nueva entidad em.getTransaction().begin(); // Leer las entradas que ya hay en la base de datos // Las personas no deben tener ningun atributo asignado todavia Query q = em.createQuery("select m from Persona m"); // Comprobar si necesitamos crear entradas en la base boolean createNewEntries = (q.getResultList().size() == 0); if (createNewEntries) { // Vamos a ello assertTrue(q.getResultList().size() == 0);
// Path: P2-previo/jpa.eclipselink/src/jpa/eclipselink/modelo/Familia.java // @Entity // public class Familia { // @Id // @GeneratedValue(strategy = GenerationType.TABLE) // private int id; // private String descripcion; // // @OneToMany(mappedBy = "familia") // private final List<Persona> miembros = new ArrayList<Persona>(); // // public int getId() { // return id; // } // // public void setId(int id) { // this.id = id; // } // // public String getDescripcion() { // return descripcion; // } // // public void setDescripcion(String descripcion) { // this.descripcion = descripcion; // } // // public List<Persona> getMiembros() { // return miembros; // } // // } // // Path: P2-previo/jpa.eclipselink/src/jpa/eclipselink/modelo/Persona.java // @Entity // public class Persona { // @Id // @GeneratedValue(strategy = GenerationType.TABLE) // private String id; // private String nombre; // private String apellidos; // // private Familia familia; // // private String campoSinSentido = ""; // // private List<Empleo> listaEmpleos = new ArrayList<Empleo>(); // // public String getId() { // return id; // } // // public void setId(String id) { // this.id = id; // } // // public String getNombre() { // return nombre; // } // // public void setNombre(String nombre) { // this.nombre = nombre; // } // // public String getApellidos() { // return apellidos; // } // // public void setApellidos(String apellidos) { // this.apellidos = apellidos; // } // // @ManyToOne // public Familia getFamilia() { // return familia; // } // // public void setFamilia(Familia familia) { // this.familia = familia; // } // // @Transient // public String getCampoSinSentido() { // return campoSinSentido; // } // // public void setCampoSinSentido(String campoSinSentido) { // this.campoSinSentido = campoSinSentido; // } // // @OneToMany // public List<Empleo> getListaEmpleos() { // return this.listaEmpleos; // } // // public void setListaEmpleos(List<Empleo> listaEmpleos) { // this.listaEmpleos = listaEmpleos; // } // // } // Path: P2-previo/jpa.eclipselink/src/jpa/eclipselink/principal/JpaTest.java import static org.junit.Assert.assertTrue; import org.junit.Before; import org.junit.Test; import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; import javax.persistence.Persistence; import javax.persistence.Query; import jpa.eclipselink.modelo.Familia; import jpa.eclipselink.modelo.Persona; package jpa.eclipselink.principal; public class JpaTest { private static final String PERSISTENCE_UNIT_NAME = "relaciones_persistentes"; private EntityManagerFactory factoria; @Before public void setUp() throws Exception { factoria = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME); EntityManager em = factoria.createEntityManager(); // Comenzar una nueva transaccion local de tal forma que pueda persistir como una nueva entidad em.getTransaction().begin(); // Leer las entradas que ya hay en la base de datos // Las personas no deben tener ningun atributo asignado todavia Query q = em.createQuery("select m from Persona m"); // Comprobar si necesitamos crear entradas en la base boolean createNewEntries = (q.getResultList().size() == 0); if (createNewEntries) { // Vamos a ello assertTrue(q.getResultList().size() == 0);
Familia familia = new Familia();
fblupi/master_informatica-DSS
P2-previo/jpa.eclipselink/src/jpa/eclipselink/principal/JpaTest.java
// Path: P2-previo/jpa.eclipselink/src/jpa/eclipselink/modelo/Familia.java // @Entity // public class Familia { // @Id // @GeneratedValue(strategy = GenerationType.TABLE) // private int id; // private String descripcion; // // @OneToMany(mappedBy = "familia") // private final List<Persona> miembros = new ArrayList<Persona>(); // // public int getId() { // return id; // } // // public void setId(int id) { // this.id = id; // } // // public String getDescripcion() { // return descripcion; // } // // public void setDescripcion(String descripcion) { // this.descripcion = descripcion; // } // // public List<Persona> getMiembros() { // return miembros; // } // // } // // Path: P2-previo/jpa.eclipselink/src/jpa/eclipselink/modelo/Persona.java // @Entity // public class Persona { // @Id // @GeneratedValue(strategy = GenerationType.TABLE) // private String id; // private String nombre; // private String apellidos; // // private Familia familia; // // private String campoSinSentido = ""; // // private List<Empleo> listaEmpleos = new ArrayList<Empleo>(); // // public String getId() { // return id; // } // // public void setId(String id) { // this.id = id; // } // // public String getNombre() { // return nombre; // } // // public void setNombre(String nombre) { // this.nombre = nombre; // } // // public String getApellidos() { // return apellidos; // } // // public void setApellidos(String apellidos) { // this.apellidos = apellidos; // } // // @ManyToOne // public Familia getFamilia() { // return familia; // } // // public void setFamilia(Familia familia) { // this.familia = familia; // } // // @Transient // public String getCampoSinSentido() { // return campoSinSentido; // } // // public void setCampoSinSentido(String campoSinSentido) { // this.campoSinSentido = campoSinSentido; // } // // @OneToMany // public List<Empleo> getListaEmpleos() { // return this.listaEmpleos; // } // // public void setListaEmpleos(List<Empleo> listaEmpleos) { // this.listaEmpleos = listaEmpleos; // } // // }
import static org.junit.Assert.assertTrue; import org.junit.Before; import org.junit.Test; import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; import javax.persistence.Persistence; import javax.persistence.Query; import jpa.eclipselink.modelo.Familia; import jpa.eclipselink.modelo.Persona;
package jpa.eclipselink.principal; public class JpaTest { private static final String PERSISTENCE_UNIT_NAME = "relaciones_persistentes"; private EntityManagerFactory factoria; @Before public void setUp() throws Exception { factoria = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME); EntityManager em = factoria.createEntityManager(); // Comenzar una nueva transaccion local de tal forma que pueda persistir como una nueva entidad em.getTransaction().begin(); // Leer las entradas que ya hay en la base de datos // Las personas no deben tener ningun atributo asignado todavia Query q = em.createQuery("select m from Persona m"); // Comprobar si necesitamos crear entradas en la base boolean createNewEntries = (q.getResultList().size() == 0); if (createNewEntries) { // Vamos a ello assertTrue(q.getResultList().size() == 0); Familia familia = new Familia(); familia.setDescripcion("Familia Martinez"); em.persist(familia); for (int i = 0; i < 20; i++) {
// Path: P2-previo/jpa.eclipselink/src/jpa/eclipselink/modelo/Familia.java // @Entity // public class Familia { // @Id // @GeneratedValue(strategy = GenerationType.TABLE) // private int id; // private String descripcion; // // @OneToMany(mappedBy = "familia") // private final List<Persona> miembros = new ArrayList<Persona>(); // // public int getId() { // return id; // } // // public void setId(int id) { // this.id = id; // } // // public String getDescripcion() { // return descripcion; // } // // public void setDescripcion(String descripcion) { // this.descripcion = descripcion; // } // // public List<Persona> getMiembros() { // return miembros; // } // // } // // Path: P2-previo/jpa.eclipselink/src/jpa/eclipselink/modelo/Persona.java // @Entity // public class Persona { // @Id // @GeneratedValue(strategy = GenerationType.TABLE) // private String id; // private String nombre; // private String apellidos; // // private Familia familia; // // private String campoSinSentido = ""; // // private List<Empleo> listaEmpleos = new ArrayList<Empleo>(); // // public String getId() { // return id; // } // // public void setId(String id) { // this.id = id; // } // // public String getNombre() { // return nombre; // } // // public void setNombre(String nombre) { // this.nombre = nombre; // } // // public String getApellidos() { // return apellidos; // } // // public void setApellidos(String apellidos) { // this.apellidos = apellidos; // } // // @ManyToOne // public Familia getFamilia() { // return familia; // } // // public void setFamilia(Familia familia) { // this.familia = familia; // } // // @Transient // public String getCampoSinSentido() { // return campoSinSentido; // } // // public void setCampoSinSentido(String campoSinSentido) { // this.campoSinSentido = campoSinSentido; // } // // @OneToMany // public List<Empleo> getListaEmpleos() { // return this.listaEmpleos; // } // // public void setListaEmpleos(List<Empleo> listaEmpleos) { // this.listaEmpleos = listaEmpleos; // } // // } // Path: P2-previo/jpa.eclipselink/src/jpa/eclipselink/principal/JpaTest.java import static org.junit.Assert.assertTrue; import org.junit.Before; import org.junit.Test; import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; import javax.persistence.Persistence; import javax.persistence.Query; import jpa.eclipselink.modelo.Familia; import jpa.eclipselink.modelo.Persona; package jpa.eclipselink.principal; public class JpaTest { private static final String PERSISTENCE_UNIT_NAME = "relaciones_persistentes"; private EntityManagerFactory factoria; @Before public void setUp() throws Exception { factoria = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME); EntityManager em = factoria.createEntityManager(); // Comenzar una nueva transaccion local de tal forma que pueda persistir como una nueva entidad em.getTransaction().begin(); // Leer las entradas que ya hay en la base de datos // Las personas no deben tener ningun atributo asignado todavia Query q = em.createQuery("select m from Persona m"); // Comprobar si necesitamos crear entradas en la base boolean createNewEntries = (q.getResultList().size() == 0); if (createNewEntries) { // Vamos a ello assertTrue(q.getResultList().size() == 0); Familia familia = new Familia(); familia.setDescripcion("Familia Martinez"); em.persist(familia); for (int i = 0; i < 20; i++) {
Persona persona = new Persona();
fblupi/master_informatica-DSS
P2/BolivarFrancisco-p2/src/interfaz/Cliente.java
// Path: P2/BolivarFrancisco-p2/src/modelo/Usuario.java // @Entity // public class Usuario implements Serializable { // private static final long serialVersionUID = 1L; // // @Id // @GeneratedValue(strategy = GenerationType.TABLE) // private long id; // private String nombre; // private String apellido; // private String email; // // /** // * Constructor por defecto. Crea un usuario con cadenas vacías en sus datos // */ // public Usuario() { // nombre = apellido = email = ""; // } // // /** // * Constructor por copia. Copia los datos de un usuario y crea un usuario con estos // * @param usuario // */ // public Usuario(Usuario usuario) { // nombre = usuario.getNombre(); // apellido = usuario.getApellido(); // email = usuario.getEmail(); // } // // @Override // public String toString() { // return "Usuario [nombre=" + nombre + ", apellido=" + apellido + ", email=" + email + "]"; // } // // public long getId() { // return id; // } // // public void setId(long id) { // this.id = id; // } // // public String getNombre() { // return nombre; // } // // public void setNombre(String nombre) { // this.nombre = nombre; // } // // public String getApellido() { // return apellido; // } // // public void setApellido(String apellido) { // this.apellido = apellido; // } // // public String getEmail() { // return email; // } // // public void setEmail(String email) { // this.email = email; // } // }
import java.awt.BorderLayout; import java.awt.Dialog.ModalExclusionType; import java.awt.EventQueue; import java.awt.FlowLayout; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.IOException; import java.io.InputStream; import java.io.ObjectInputStream; import java.io.OutputStream; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.ProtocolException; import java.net.URL; import java.net.URLEncoder; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; import javax.swing.AbstractAction; import javax.swing.Action; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.JTextField; import javax.swing.JToolBar; import javax.swing.SwingConstants; import javax.swing.UIManager; import javax.swing.border.EmptyBorder; import javax.swing.event.ChangeEvent; import javax.swing.table.TableCellEditor; import modelo.Usuario;
private TablaUsuarios modeloTablaUsuarios; //Para lanzar la aplicacion public static void main(String[] args) { try { // Queremos que se vea con el look-and-feel del sistema, no con el normal de Swing UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { System.err.println("Unable to load System look and feel"); } EventQueue.invokeLater(new Runnable() { public void run() { try { Cliente frame = new Cliente(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } //Ahora crearemos la ventana public Cliente() { setTitle("Desarrollo de Sistemas Basados en Componentes y Servicios-2016. Pr\u00E1ctica 2"); setModalExclusionType(ModalExclusionType.TOOLKIT_EXCLUDE); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 550, 300); setLocationRelativeTo(null); panelContenido = new JPanel(); panelContenido.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(panelContenido); panelContenido.setLayout(new BorderLayout(0, 0));
// Path: P2/BolivarFrancisco-p2/src/modelo/Usuario.java // @Entity // public class Usuario implements Serializable { // private static final long serialVersionUID = 1L; // // @Id // @GeneratedValue(strategy = GenerationType.TABLE) // private long id; // private String nombre; // private String apellido; // private String email; // // /** // * Constructor por defecto. Crea un usuario con cadenas vacías en sus datos // */ // public Usuario() { // nombre = apellido = email = ""; // } // // /** // * Constructor por copia. Copia los datos de un usuario y crea un usuario con estos // * @param usuario // */ // public Usuario(Usuario usuario) { // nombre = usuario.getNombre(); // apellido = usuario.getApellido(); // email = usuario.getEmail(); // } // // @Override // public String toString() { // return "Usuario [nombre=" + nombre + ", apellido=" + apellido + ", email=" + email + "]"; // } // // public long getId() { // return id; // } // // public void setId(long id) { // this.id = id; // } // // public String getNombre() { // return nombre; // } // // public void setNombre(String nombre) { // this.nombre = nombre; // } // // public String getApellido() { // return apellido; // } // // public void setApellido(String apellido) { // this.apellido = apellido; // } // // public String getEmail() { // return email; // } // // public void setEmail(String email) { // this.email = email; // } // } // Path: P2/BolivarFrancisco-p2/src/interfaz/Cliente.java import java.awt.BorderLayout; import java.awt.Dialog.ModalExclusionType; import java.awt.EventQueue; import java.awt.FlowLayout; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.IOException; import java.io.InputStream; import java.io.ObjectInputStream; import java.io.OutputStream; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.ProtocolException; import java.net.URL; import java.net.URLEncoder; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; import javax.swing.AbstractAction; import javax.swing.Action; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.JTextField; import javax.swing.JToolBar; import javax.swing.SwingConstants; import javax.swing.UIManager; import javax.swing.border.EmptyBorder; import javax.swing.event.ChangeEvent; import javax.swing.table.TableCellEditor; import modelo.Usuario; private TablaUsuarios modeloTablaUsuarios; //Para lanzar la aplicacion public static void main(String[] args) { try { // Queremos que se vea con el look-and-feel del sistema, no con el normal de Swing UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { System.err.println("Unable to load System look and feel"); } EventQueue.invokeLater(new Runnable() { public void run() { try { Cliente frame = new Cliente(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } //Ahora crearemos la ventana public Cliente() { setTitle("Desarrollo de Sistemas Basados en Componentes y Servicios-2016. Pr\u00E1ctica 2"); setModalExclusionType(ModalExclusionType.TOOLKIT_EXCLUDE); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 550, 300); setLocationRelativeTo(null); panelContenido = new JPanel(); panelContenido.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(panelContenido); panelContenido.setLayout(new BorderLayout(0, 0));
List<Usuario> listaUsuarios = obtenerListaUsuarios();
fblupi/master_informatica-DSS
P3/BolivarFrancisco-p3/src/cliente/Probador.java
// Path: P3/BolivarFrancisco-p3/src/modelo/Jugador.java // @XmlRootElement // public class Jugador { // private String id; // private String nombre; // private String nombreCompleto; // private String posicion; // private int calidad; // // public Jugador() { // // } // // public Jugador(String id, String nombre, String posicion, int calidad) { // this.id = id; // this.nombre = nombre; // this.posicion = posicion; // this.calidad = calidad; // } // // public String getId() { // return nombre; // } // // public void setId(String id) { // this.id = id; // } // // public String getNombre() { // return nombre; // } // // public void setNombre(String nombre) { // this.nombre = nombre; // } // // public String getNombreCompleto() { // return nombreCompleto; // } // // public void setNombreCompleto(String nombreCompleto) { // this.nombreCompleto = nombreCompleto; // } // // public String getPosicion() { // return posicion; // } // // public void setPosicion(String posicion) { // this.posicion = posicion; // } // // public int getCalidad() { // return calidad; // } // // public void setCalidad(int calidad) { // this.calidad = calidad; // } // }
import java.net.URI; import javax.ws.rs.client.Client; import javax.ws.rs.client.ClientBuilder; import javax.ws.rs.client.Entity; import javax.ws.rs.client.WebTarget; import javax.ws.rs.core.Form; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.ws.rs.core.UriBuilder; import org.glassfish.jersey.client.ClientConfig; import modelo.Jugador;
package cliente; public class Probador { public static void main(String[] args) { ClientConfig config = new ClientConfig(); Client cliente = ClientBuilder.newClient(config); WebTarget servicio = cliente.target(getBaseURI()); // crearse un tercer "objeto" jugador, aparte de los otros 2
// Path: P3/BolivarFrancisco-p3/src/modelo/Jugador.java // @XmlRootElement // public class Jugador { // private String id; // private String nombre; // private String nombreCompleto; // private String posicion; // private int calidad; // // public Jugador() { // // } // // public Jugador(String id, String nombre, String posicion, int calidad) { // this.id = id; // this.nombre = nombre; // this.posicion = posicion; // this.calidad = calidad; // } // // public String getId() { // return nombre; // } // // public void setId(String id) { // this.id = id; // } // // public String getNombre() { // return nombre; // } // // public void setNombre(String nombre) { // this.nombre = nombre; // } // // public String getNombreCompleto() { // return nombreCompleto; // } // // public void setNombreCompleto(String nombreCompleto) { // this.nombreCompleto = nombreCompleto; // } // // public String getPosicion() { // return posicion; // } // // public void setPosicion(String posicion) { // this.posicion = posicion; // } // // public int getCalidad() { // return calidad; // } // // public void setCalidad(int calidad) { // this.calidad = calidad; // } // } // Path: P3/BolivarFrancisco-p3/src/cliente/Probador.java import java.net.URI; import javax.ws.rs.client.Client; import javax.ws.rs.client.ClientBuilder; import javax.ws.rs.client.Entity; import javax.ws.rs.client.WebTarget; import javax.ws.rs.core.Form; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.ws.rs.core.UriBuilder; import org.glassfish.jersey.client.ClientConfig; import modelo.Jugador; package cliente; public class Probador { public static void main(String[] args) { ClientConfig config = new ClientConfig(); Client cliente = ClientBuilder.newClient(config); WebTarget servicio = cliente.target(getBaseURI()); // crearse un tercer "objeto" jugador, aparte de los otros 2
Jugador jugador = new Jugador("3", "Lupi", "Mediocentro defensivo", 71);
tunaemre/Face-Swap-Android
faceSwap/src/main/java/com/tunaemre/opencv/faceswap/MainActivity.java
// Path: faceSwap/src/main/java/com/tunaemre/opencv/faceswap/app/ExtendedCompatActivity.java // @SuppressLint("InlinedApi") // public abstract class ExtendedCompatActivity extends AppCompatActivity // { // // @Override // public void setContentView(int layoutResID) // { // super.setContentView(layoutResID); // // prepareActivity(); // } // // protected abstract void prepareActivity(); // // } // // Path: faceSwap/src/main/java/com/tunaemre/opencv/faceswap/constant/Constant.java // public class Constant // { // public static String FaceLandmarksURL = "https://github.com/tzutalin/dlib-android/raw/master/data/shape_predictor_68_face_landmarks.dat"; // // public static String FaceLandmarksDownloadPath = "PoseModel"; // // public static String FaceLandmarksFileName = "face_landmarks.dat"; // } // // Path: faceSwap/src/main/java/com/tunaemre/opencv/faceswap/util/CacheOperator.java // public class CacheOperator // { // private static CacheOperator instance = null; // // String PREF_NAME = "PREF_FACESWAP_CACHE"; // // String IS_FACELANDMARKS_DOWNLOADED= "ISFACELANDMARKSDOWNLOADED"; // // SharedPreferences mPreference; // Editor mEditor; // // public static CacheOperator getInstance(Context context) // { // if (instance != null) // return instance; // // instance = new CacheOperator(context); // return instance; // } // // private CacheOperator(Context context) // { // mPreference = context.getApplicationContext().getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE); // } // // public void setFaceLandmarksDownloaded(boolean value) // { // mEditor = mPreference.edit(); // mEditor.putBoolean(IS_FACELANDMARKS_DOWNLOADED, value); // mEditor.commit(); // } // // public boolean getFaceLandmarksDownloaded() // { // return mPreference.getBoolean(IS_FACELANDMARKS_DOWNLOADED, false); // } // } // // Path: faceSwap/src/main/java/com/tunaemre/opencv/faceswap/util/PermissionOperator.java // public class PermissionOperator // { // public static int REQUEST_STORAGE_PERMISSION = 11; // public static int REQUEST_CAMERA_PERMISSION = 12; // // // public boolean isStoragePermissionGranded(Context context) // { // if (Build.VERSION.SDK_INT < 23) return true; // // if (ContextCompat.checkSelfPermission(context, Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) return true; // // return false; // } // // public boolean requestStoragePermission(Activity context) // { // if (isStoragePermissionGranded(context)) return true; // // ActivityCompat.requestPermissions(context, new String[] {Manifest.permission.WRITE_EXTERNAL_STORAGE}, REQUEST_STORAGE_PERMISSION); // // return true; // } // // public boolean isCameraPermissionGranded(Context context) // { // if (Build.VERSION.SDK_INT < 23) return true; // // if (ContextCompat.checkSelfPermission(context, Manifest.permission.CAMERA) == PackageManager.PERMISSION_GRANTED) return true; // // return false; // } // // public boolean requestCameraPermission(Activity context) // { // if (isCameraPermissionGranded(context)) return true; // // ActivityCompat.requestPermissions(context, new String[] {Manifest.permission.CAMERA}, REQUEST_CAMERA_PERMISSION); // // return true; // } // }
import java.io.File; import com.tunaemre.opencv.faceswap.app.ExtendedCompatActivity; import com.tunaemre.opencv.faceswap.constant.Constant; import com.tunaemre.opencv.faceswap.util.CacheOperator; import com.tunaemre.opencv.faceswap.util.PermissionOperator; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Toast;
package com.tunaemre.opencv.faceswap; public class MainActivity extends ExtendedCompatActivity {
// Path: faceSwap/src/main/java/com/tunaemre/opencv/faceswap/app/ExtendedCompatActivity.java // @SuppressLint("InlinedApi") // public abstract class ExtendedCompatActivity extends AppCompatActivity // { // // @Override // public void setContentView(int layoutResID) // { // super.setContentView(layoutResID); // // prepareActivity(); // } // // protected abstract void prepareActivity(); // // } // // Path: faceSwap/src/main/java/com/tunaemre/opencv/faceswap/constant/Constant.java // public class Constant // { // public static String FaceLandmarksURL = "https://github.com/tzutalin/dlib-android/raw/master/data/shape_predictor_68_face_landmarks.dat"; // // public static String FaceLandmarksDownloadPath = "PoseModel"; // // public static String FaceLandmarksFileName = "face_landmarks.dat"; // } // // Path: faceSwap/src/main/java/com/tunaemre/opencv/faceswap/util/CacheOperator.java // public class CacheOperator // { // private static CacheOperator instance = null; // // String PREF_NAME = "PREF_FACESWAP_CACHE"; // // String IS_FACELANDMARKS_DOWNLOADED= "ISFACELANDMARKSDOWNLOADED"; // // SharedPreferences mPreference; // Editor mEditor; // // public static CacheOperator getInstance(Context context) // { // if (instance != null) // return instance; // // instance = new CacheOperator(context); // return instance; // } // // private CacheOperator(Context context) // { // mPreference = context.getApplicationContext().getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE); // } // // public void setFaceLandmarksDownloaded(boolean value) // { // mEditor = mPreference.edit(); // mEditor.putBoolean(IS_FACELANDMARKS_DOWNLOADED, value); // mEditor.commit(); // } // // public boolean getFaceLandmarksDownloaded() // { // return mPreference.getBoolean(IS_FACELANDMARKS_DOWNLOADED, false); // } // } // // Path: faceSwap/src/main/java/com/tunaemre/opencv/faceswap/util/PermissionOperator.java // public class PermissionOperator // { // public static int REQUEST_STORAGE_PERMISSION = 11; // public static int REQUEST_CAMERA_PERMISSION = 12; // // // public boolean isStoragePermissionGranded(Context context) // { // if (Build.VERSION.SDK_INT < 23) return true; // // if (ContextCompat.checkSelfPermission(context, Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) return true; // // return false; // } // // public boolean requestStoragePermission(Activity context) // { // if (isStoragePermissionGranded(context)) return true; // // ActivityCompat.requestPermissions(context, new String[] {Manifest.permission.WRITE_EXTERNAL_STORAGE}, REQUEST_STORAGE_PERMISSION); // // return true; // } // // public boolean isCameraPermissionGranded(Context context) // { // if (Build.VERSION.SDK_INT < 23) return true; // // if (ContextCompat.checkSelfPermission(context, Manifest.permission.CAMERA) == PackageManager.PERMISSION_GRANTED) return true; // // return false; // } // // public boolean requestCameraPermission(Activity context) // { // if (isCameraPermissionGranded(context)) return true; // // ActivityCompat.requestPermissions(context, new String[] {Manifest.permission.CAMERA}, REQUEST_CAMERA_PERMISSION); // // return true; // } // } // Path: faceSwap/src/main/java/com/tunaemre/opencv/faceswap/MainActivity.java import java.io.File; import com.tunaemre.opencv.faceswap.app.ExtendedCompatActivity; import com.tunaemre.opencv.faceswap.constant.Constant; import com.tunaemre.opencv.faceswap.util.CacheOperator; import com.tunaemre.opencv.faceswap.util.PermissionOperator; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Toast; package com.tunaemre.opencv.faceswap; public class MainActivity extends ExtendedCompatActivity {
private PermissionOperator permissionOperator = new PermissionOperator();
tunaemre/Face-Swap-Android
faceSwap/src/main/java/com/tunaemre/opencv/faceswap/MainActivity.java
// Path: faceSwap/src/main/java/com/tunaemre/opencv/faceswap/app/ExtendedCompatActivity.java // @SuppressLint("InlinedApi") // public abstract class ExtendedCompatActivity extends AppCompatActivity // { // // @Override // public void setContentView(int layoutResID) // { // super.setContentView(layoutResID); // // prepareActivity(); // } // // protected abstract void prepareActivity(); // // } // // Path: faceSwap/src/main/java/com/tunaemre/opencv/faceswap/constant/Constant.java // public class Constant // { // public static String FaceLandmarksURL = "https://github.com/tzutalin/dlib-android/raw/master/data/shape_predictor_68_face_landmarks.dat"; // // public static String FaceLandmarksDownloadPath = "PoseModel"; // // public static String FaceLandmarksFileName = "face_landmarks.dat"; // } // // Path: faceSwap/src/main/java/com/tunaemre/opencv/faceswap/util/CacheOperator.java // public class CacheOperator // { // private static CacheOperator instance = null; // // String PREF_NAME = "PREF_FACESWAP_CACHE"; // // String IS_FACELANDMARKS_DOWNLOADED= "ISFACELANDMARKSDOWNLOADED"; // // SharedPreferences mPreference; // Editor mEditor; // // public static CacheOperator getInstance(Context context) // { // if (instance != null) // return instance; // // instance = new CacheOperator(context); // return instance; // } // // private CacheOperator(Context context) // { // mPreference = context.getApplicationContext().getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE); // } // // public void setFaceLandmarksDownloaded(boolean value) // { // mEditor = mPreference.edit(); // mEditor.putBoolean(IS_FACELANDMARKS_DOWNLOADED, value); // mEditor.commit(); // } // // public boolean getFaceLandmarksDownloaded() // { // return mPreference.getBoolean(IS_FACELANDMARKS_DOWNLOADED, false); // } // } // // Path: faceSwap/src/main/java/com/tunaemre/opencv/faceswap/util/PermissionOperator.java // public class PermissionOperator // { // public static int REQUEST_STORAGE_PERMISSION = 11; // public static int REQUEST_CAMERA_PERMISSION = 12; // // // public boolean isStoragePermissionGranded(Context context) // { // if (Build.VERSION.SDK_INT < 23) return true; // // if (ContextCompat.checkSelfPermission(context, Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) return true; // // return false; // } // // public boolean requestStoragePermission(Activity context) // { // if (isStoragePermissionGranded(context)) return true; // // ActivityCompat.requestPermissions(context, new String[] {Manifest.permission.WRITE_EXTERNAL_STORAGE}, REQUEST_STORAGE_PERMISSION); // // return true; // } // // public boolean isCameraPermissionGranded(Context context) // { // if (Build.VERSION.SDK_INT < 23) return true; // // if (ContextCompat.checkSelfPermission(context, Manifest.permission.CAMERA) == PackageManager.PERMISSION_GRANTED) return true; // // return false; // } // // public boolean requestCameraPermission(Activity context) // { // if (isCameraPermissionGranded(context)) return true; // // ActivityCompat.requestPermissions(context, new String[] {Manifest.permission.CAMERA}, REQUEST_CAMERA_PERMISSION); // // return true; // } // }
import java.io.File; import com.tunaemre.opencv.faceswap.app.ExtendedCompatActivity; import com.tunaemre.opencv.faceswap.constant.Constant; import com.tunaemre.opencv.faceswap.util.CacheOperator; import com.tunaemre.opencv.faceswap.util.PermissionOperator; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Toast;
findViewById(R.id.btnMainPhotoMask).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (!checkPermission()) return; //TODO Toast.makeText(MainActivity.this, "In development.", Toast.LENGTH_SHORT).show(); } }); checkPermission(); } private boolean checkPermission() { if (!permissionOperator.isCameraPermissionGranded(this)) { permissionOperator.requestCameraPermission(this); return false; } return true; } private boolean checkFaceLandmarkFile() {
// Path: faceSwap/src/main/java/com/tunaemre/opencv/faceswap/app/ExtendedCompatActivity.java // @SuppressLint("InlinedApi") // public abstract class ExtendedCompatActivity extends AppCompatActivity // { // // @Override // public void setContentView(int layoutResID) // { // super.setContentView(layoutResID); // // prepareActivity(); // } // // protected abstract void prepareActivity(); // // } // // Path: faceSwap/src/main/java/com/tunaemre/opencv/faceswap/constant/Constant.java // public class Constant // { // public static String FaceLandmarksURL = "https://github.com/tzutalin/dlib-android/raw/master/data/shape_predictor_68_face_landmarks.dat"; // // public static String FaceLandmarksDownloadPath = "PoseModel"; // // public static String FaceLandmarksFileName = "face_landmarks.dat"; // } // // Path: faceSwap/src/main/java/com/tunaemre/opencv/faceswap/util/CacheOperator.java // public class CacheOperator // { // private static CacheOperator instance = null; // // String PREF_NAME = "PREF_FACESWAP_CACHE"; // // String IS_FACELANDMARKS_DOWNLOADED= "ISFACELANDMARKSDOWNLOADED"; // // SharedPreferences mPreference; // Editor mEditor; // // public static CacheOperator getInstance(Context context) // { // if (instance != null) // return instance; // // instance = new CacheOperator(context); // return instance; // } // // private CacheOperator(Context context) // { // mPreference = context.getApplicationContext().getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE); // } // // public void setFaceLandmarksDownloaded(boolean value) // { // mEditor = mPreference.edit(); // mEditor.putBoolean(IS_FACELANDMARKS_DOWNLOADED, value); // mEditor.commit(); // } // // public boolean getFaceLandmarksDownloaded() // { // return mPreference.getBoolean(IS_FACELANDMARKS_DOWNLOADED, false); // } // } // // Path: faceSwap/src/main/java/com/tunaemre/opencv/faceswap/util/PermissionOperator.java // public class PermissionOperator // { // public static int REQUEST_STORAGE_PERMISSION = 11; // public static int REQUEST_CAMERA_PERMISSION = 12; // // // public boolean isStoragePermissionGranded(Context context) // { // if (Build.VERSION.SDK_INT < 23) return true; // // if (ContextCompat.checkSelfPermission(context, Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) return true; // // return false; // } // // public boolean requestStoragePermission(Activity context) // { // if (isStoragePermissionGranded(context)) return true; // // ActivityCompat.requestPermissions(context, new String[] {Manifest.permission.WRITE_EXTERNAL_STORAGE}, REQUEST_STORAGE_PERMISSION); // // return true; // } // // public boolean isCameraPermissionGranded(Context context) // { // if (Build.VERSION.SDK_INT < 23) return true; // // if (ContextCompat.checkSelfPermission(context, Manifest.permission.CAMERA) == PackageManager.PERMISSION_GRANTED) return true; // // return false; // } // // public boolean requestCameraPermission(Activity context) // { // if (isCameraPermissionGranded(context)) return true; // // ActivityCompat.requestPermissions(context, new String[] {Manifest.permission.CAMERA}, REQUEST_CAMERA_PERMISSION); // // return true; // } // } // Path: faceSwap/src/main/java/com/tunaemre/opencv/faceswap/MainActivity.java import java.io.File; import com.tunaemre.opencv.faceswap.app.ExtendedCompatActivity; import com.tunaemre.opencv.faceswap.constant.Constant; import com.tunaemre.opencv.faceswap.util.CacheOperator; import com.tunaemre.opencv.faceswap.util.PermissionOperator; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Toast; findViewById(R.id.btnMainPhotoMask).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (!checkPermission()) return; //TODO Toast.makeText(MainActivity.this, "In development.", Toast.LENGTH_SHORT).show(); } }); checkPermission(); } private boolean checkPermission() { if (!permissionOperator.isCameraPermissionGranded(this)) { permissionOperator.requestCameraPermission(this); return false; } return true; } private boolean checkFaceLandmarkFile() {
File localFile = new File(MainActivity.this.getDir(Constant.FaceLandmarksDownloadPath, Context.MODE_PRIVATE), Constant.FaceLandmarksFileName);
tunaemre/Face-Swap-Android
faceSwap/src/main/java/com/tunaemre/opencv/faceswap/MainActivity.java
// Path: faceSwap/src/main/java/com/tunaemre/opencv/faceswap/app/ExtendedCompatActivity.java // @SuppressLint("InlinedApi") // public abstract class ExtendedCompatActivity extends AppCompatActivity // { // // @Override // public void setContentView(int layoutResID) // { // super.setContentView(layoutResID); // // prepareActivity(); // } // // protected abstract void prepareActivity(); // // } // // Path: faceSwap/src/main/java/com/tunaemre/opencv/faceswap/constant/Constant.java // public class Constant // { // public static String FaceLandmarksURL = "https://github.com/tzutalin/dlib-android/raw/master/data/shape_predictor_68_face_landmarks.dat"; // // public static String FaceLandmarksDownloadPath = "PoseModel"; // // public static String FaceLandmarksFileName = "face_landmarks.dat"; // } // // Path: faceSwap/src/main/java/com/tunaemre/opencv/faceswap/util/CacheOperator.java // public class CacheOperator // { // private static CacheOperator instance = null; // // String PREF_NAME = "PREF_FACESWAP_CACHE"; // // String IS_FACELANDMARKS_DOWNLOADED= "ISFACELANDMARKSDOWNLOADED"; // // SharedPreferences mPreference; // Editor mEditor; // // public static CacheOperator getInstance(Context context) // { // if (instance != null) // return instance; // // instance = new CacheOperator(context); // return instance; // } // // private CacheOperator(Context context) // { // mPreference = context.getApplicationContext().getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE); // } // // public void setFaceLandmarksDownloaded(boolean value) // { // mEditor = mPreference.edit(); // mEditor.putBoolean(IS_FACELANDMARKS_DOWNLOADED, value); // mEditor.commit(); // } // // public boolean getFaceLandmarksDownloaded() // { // return mPreference.getBoolean(IS_FACELANDMARKS_DOWNLOADED, false); // } // } // // Path: faceSwap/src/main/java/com/tunaemre/opencv/faceswap/util/PermissionOperator.java // public class PermissionOperator // { // public static int REQUEST_STORAGE_PERMISSION = 11; // public static int REQUEST_CAMERA_PERMISSION = 12; // // // public boolean isStoragePermissionGranded(Context context) // { // if (Build.VERSION.SDK_INT < 23) return true; // // if (ContextCompat.checkSelfPermission(context, Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) return true; // // return false; // } // // public boolean requestStoragePermission(Activity context) // { // if (isStoragePermissionGranded(context)) return true; // // ActivityCompat.requestPermissions(context, new String[] {Manifest.permission.WRITE_EXTERNAL_STORAGE}, REQUEST_STORAGE_PERMISSION); // // return true; // } // // public boolean isCameraPermissionGranded(Context context) // { // if (Build.VERSION.SDK_INT < 23) return true; // // if (ContextCompat.checkSelfPermission(context, Manifest.permission.CAMERA) == PackageManager.PERMISSION_GRANTED) return true; // // return false; // } // // public boolean requestCameraPermission(Activity context) // { // if (isCameraPermissionGranded(context)) return true; // // ActivityCompat.requestPermissions(context, new String[] {Manifest.permission.CAMERA}, REQUEST_CAMERA_PERMISSION); // // return true; // } // }
import java.io.File; import com.tunaemre.opencv.faceswap.app.ExtendedCompatActivity; import com.tunaemre.opencv.faceswap.constant.Constant; import com.tunaemre.opencv.faceswap.util.CacheOperator; import com.tunaemre.opencv.faceswap.util.PermissionOperator; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Toast;
findViewById(R.id.btnMainPhotoMask).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (!checkPermission()) return; //TODO Toast.makeText(MainActivity.this, "In development.", Toast.LENGTH_SHORT).show(); } }); checkPermission(); } private boolean checkPermission() { if (!permissionOperator.isCameraPermissionGranded(this)) { permissionOperator.requestCameraPermission(this); return false; } return true; } private boolean checkFaceLandmarkFile() { File localFile = new File(MainActivity.this.getDir(Constant.FaceLandmarksDownloadPath, Context.MODE_PRIVATE), Constant.FaceLandmarksFileName);
// Path: faceSwap/src/main/java/com/tunaemre/opencv/faceswap/app/ExtendedCompatActivity.java // @SuppressLint("InlinedApi") // public abstract class ExtendedCompatActivity extends AppCompatActivity // { // // @Override // public void setContentView(int layoutResID) // { // super.setContentView(layoutResID); // // prepareActivity(); // } // // protected abstract void prepareActivity(); // // } // // Path: faceSwap/src/main/java/com/tunaemre/opencv/faceswap/constant/Constant.java // public class Constant // { // public static String FaceLandmarksURL = "https://github.com/tzutalin/dlib-android/raw/master/data/shape_predictor_68_face_landmarks.dat"; // // public static String FaceLandmarksDownloadPath = "PoseModel"; // // public static String FaceLandmarksFileName = "face_landmarks.dat"; // } // // Path: faceSwap/src/main/java/com/tunaemre/opencv/faceswap/util/CacheOperator.java // public class CacheOperator // { // private static CacheOperator instance = null; // // String PREF_NAME = "PREF_FACESWAP_CACHE"; // // String IS_FACELANDMARKS_DOWNLOADED= "ISFACELANDMARKSDOWNLOADED"; // // SharedPreferences mPreference; // Editor mEditor; // // public static CacheOperator getInstance(Context context) // { // if (instance != null) // return instance; // // instance = new CacheOperator(context); // return instance; // } // // private CacheOperator(Context context) // { // mPreference = context.getApplicationContext().getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE); // } // // public void setFaceLandmarksDownloaded(boolean value) // { // mEditor = mPreference.edit(); // mEditor.putBoolean(IS_FACELANDMARKS_DOWNLOADED, value); // mEditor.commit(); // } // // public boolean getFaceLandmarksDownloaded() // { // return mPreference.getBoolean(IS_FACELANDMARKS_DOWNLOADED, false); // } // } // // Path: faceSwap/src/main/java/com/tunaemre/opencv/faceswap/util/PermissionOperator.java // public class PermissionOperator // { // public static int REQUEST_STORAGE_PERMISSION = 11; // public static int REQUEST_CAMERA_PERMISSION = 12; // // // public boolean isStoragePermissionGranded(Context context) // { // if (Build.VERSION.SDK_INT < 23) return true; // // if (ContextCompat.checkSelfPermission(context, Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) return true; // // return false; // } // // public boolean requestStoragePermission(Activity context) // { // if (isStoragePermissionGranded(context)) return true; // // ActivityCompat.requestPermissions(context, new String[] {Manifest.permission.WRITE_EXTERNAL_STORAGE}, REQUEST_STORAGE_PERMISSION); // // return true; // } // // public boolean isCameraPermissionGranded(Context context) // { // if (Build.VERSION.SDK_INT < 23) return true; // // if (ContextCompat.checkSelfPermission(context, Manifest.permission.CAMERA) == PackageManager.PERMISSION_GRANTED) return true; // // return false; // } // // public boolean requestCameraPermission(Activity context) // { // if (isCameraPermissionGranded(context)) return true; // // ActivityCompat.requestPermissions(context, new String[] {Manifest.permission.CAMERA}, REQUEST_CAMERA_PERMISSION); // // return true; // } // } // Path: faceSwap/src/main/java/com/tunaemre/opencv/faceswap/MainActivity.java import java.io.File; import com.tunaemre.opencv.faceswap.app.ExtendedCompatActivity; import com.tunaemre.opencv.faceswap.constant.Constant; import com.tunaemre.opencv.faceswap.util.CacheOperator; import com.tunaemre.opencv.faceswap.util.PermissionOperator; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Toast; findViewById(R.id.btnMainPhotoMask).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (!checkPermission()) return; //TODO Toast.makeText(MainActivity.this, "In development.", Toast.LENGTH_SHORT).show(); } }); checkPermission(); } private boolean checkPermission() { if (!permissionOperator.isCameraPermissionGranded(this)) { permissionOperator.requestCameraPermission(this); return false; } return true; } private boolean checkFaceLandmarkFile() { File localFile = new File(MainActivity.this.getDir(Constant.FaceLandmarksDownloadPath, Context.MODE_PRIVATE), Constant.FaceLandmarksFileName);
return localFile.exists() && CacheOperator.getInstance(MainActivity.this).getFaceLandmarksDownloaded();
fiware-cybercaptor/cybercaptor-server
src/main/java/org/fiware/cybercaptor/server/attackgraph/MulvalAttackGraph.java
// Path: src/main/java/org/fiware/cybercaptor/server/attackgraph/fact/Fact.java // public class Fact implements Cloneable { // /** // * The string of the fact // */ // public String factString = ""; // /** // * The type of fact // */ // public FactType type; // /** // * If the fact contains a rule, refer to this rule // */ // public Rule factRule = null; // /** // * If the fact contains a Datalog command, refer to this Datalog command // */ // public DatalogCommand datalogCommand = null; // /** // * The related attack graph vertex // */ // public Vertex attackGraphVertex = null; // // /** // * Create a new fact from a string // * // * @param fact the fact string // */ // public Fact(String fact, Vertex vertex) { // this.factString = fact; // if (Rule.isARule(fact)) { // factRule = new Rule(fact); // type = FactType.RULE; // } else if (DatalogCommand.isADatalogFact(fact)) { // this.datalogCommand = new DatalogCommand(fact, this); // type = FactType.DATALOG_FACT; // } // this.attackGraphVertex = vertex; // } // // @Override // public Fact clone() throws CloneNotSupportedException { // Fact copie = (Fact) super.clone(); // if (copie.factRule != null) // copie.factRule = this.factRule.clone(); // if (this.datalogCommand != null) { // copie.datalogCommand = this.datalogCommand.clone(); // copie.datalogCommand.fact = copie; // } // // return copie; // } // // @Override // public String toString() { // return "Fact [factDatalog=" + datalogCommand + ", factRule=" + factRule // + ", factString=" + factString + ", type=" + type + "]"; // } // // /** // * Possible types of facts // */ // public static enum FactType { // RULE, DATALOG_FACT // } // // }
import org.fiware.cybercaptor.server.attackgraph.fact.Fact; import org.jdom2.Document; import org.jdom2.Element; import org.jdom2.input.SAXBuilder; import java.io.FileInputStream; import java.util.List;
/**************************************************************************************** * This file is part of FIWARE CyberCAPTOR, * * instance of FIWARE Cyber Security Generic Enabler * * Copyright (C) 2012-2015 Thales Services S.A.S., * * 20-22 rue Grande Dame Rose 78140 VELIZY-VILACOUBLAY FRANCE * * * * FIWARE CyberCAPTOR 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. * * * * FIWARE CyberCAPTOR 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 FIWARE CyberCAPTOR. * * If not, see <http://www.gnu.org/licenses/>. * ****************************************************************************************/ package org.fiware.cybercaptor.server.attackgraph; /** * Represent a MulVAL attack graph * * @author Francois-Xavier Aguessy */ public class MulvalAttackGraph extends AttackGraph implements Cloneable { /** * The path to the xml path of the attack graph */ public String xmlFilePath = ""; public MulvalAttackGraph() { } /** * Create an attack graph from an output xml file from Mulval * * @param xmlPath The path to the xml file * @throws Exception */ public MulvalAttackGraph(String xmlPath) throws Exception { this.loadFromFile(xmlPath); } /** * Load the attack graph from the XML file generated by MulVAL * @param xmlPath the path of the XML file * @throws Exception */ public void loadFromFile(String xmlPath) throws Exception { this.xmlFilePath = xmlPath; FileInputStream file = new FileInputStream(xmlPath); SAXBuilder sxb = new SAXBuilder(); Document document = sxb.build(file); Element root = document.getRootElement(); addArcsAndVerticesFromDomElement(root); } /** * Create the attack graph from the XML DOM element * @param root */ public void addArcsAndVerticesFromDomElement(Element root) { if (root == null) return; /* Add all the vertices */ Element vertices_element = root.getChild("vertices"); if (vertices_element != null) { List<Element> vertices = vertices_element.getChildren("vertex"); for (Element vertex_element : vertices) { //All arcs Element id_element = vertex_element.getChild("id"); if (id_element != null && Integer.parseInt(id_element.getText()) > 0) { int id_vertex = Integer.parseInt(id_element.getText()); Vertex vertex = getExistingOrCreateVertex(id_vertex); Element fact_element = vertex_element.getChild("fact"); if (fact_element != null) {
// Path: src/main/java/org/fiware/cybercaptor/server/attackgraph/fact/Fact.java // public class Fact implements Cloneable { // /** // * The string of the fact // */ // public String factString = ""; // /** // * The type of fact // */ // public FactType type; // /** // * If the fact contains a rule, refer to this rule // */ // public Rule factRule = null; // /** // * If the fact contains a Datalog command, refer to this Datalog command // */ // public DatalogCommand datalogCommand = null; // /** // * The related attack graph vertex // */ // public Vertex attackGraphVertex = null; // // /** // * Create a new fact from a string // * // * @param fact the fact string // */ // public Fact(String fact, Vertex vertex) { // this.factString = fact; // if (Rule.isARule(fact)) { // factRule = new Rule(fact); // type = FactType.RULE; // } else if (DatalogCommand.isADatalogFact(fact)) { // this.datalogCommand = new DatalogCommand(fact, this); // type = FactType.DATALOG_FACT; // } // this.attackGraphVertex = vertex; // } // // @Override // public Fact clone() throws CloneNotSupportedException { // Fact copie = (Fact) super.clone(); // if (copie.factRule != null) // copie.factRule = this.factRule.clone(); // if (this.datalogCommand != null) { // copie.datalogCommand = this.datalogCommand.clone(); // copie.datalogCommand.fact = copie; // } // // return copie; // } // // @Override // public String toString() { // return "Fact [factDatalog=" + datalogCommand + ", factRule=" + factRule // + ", factString=" + factString + ", type=" + type + "]"; // } // // /** // * Possible types of facts // */ // public static enum FactType { // RULE, DATALOG_FACT // } // // } // Path: src/main/java/org/fiware/cybercaptor/server/attackgraph/MulvalAttackGraph.java import org.fiware.cybercaptor.server.attackgraph.fact.Fact; import org.jdom2.Document; import org.jdom2.Element; import org.jdom2.input.SAXBuilder; import java.io.FileInputStream; import java.util.List; /**************************************************************************************** * This file is part of FIWARE CyberCAPTOR, * * instance of FIWARE Cyber Security Generic Enabler * * Copyright (C) 2012-2015 Thales Services S.A.S., * * 20-22 rue Grande Dame Rose 78140 VELIZY-VILACOUBLAY FRANCE * * * * FIWARE CyberCAPTOR 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. * * * * FIWARE CyberCAPTOR 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 FIWARE CyberCAPTOR. * * If not, see <http://www.gnu.org/licenses/>. * ****************************************************************************************/ package org.fiware.cybercaptor.server.attackgraph; /** * Represent a MulVAL attack graph * * @author Francois-Xavier Aguessy */ public class MulvalAttackGraph extends AttackGraph implements Cloneable { /** * The path to the xml path of the attack graph */ public String xmlFilePath = ""; public MulvalAttackGraph() { } /** * Create an attack graph from an output xml file from Mulval * * @param xmlPath The path to the xml file * @throws Exception */ public MulvalAttackGraph(String xmlPath) throws Exception { this.loadFromFile(xmlPath); } /** * Load the attack graph from the XML file generated by MulVAL * @param xmlPath the path of the XML file * @throws Exception */ public void loadFromFile(String xmlPath) throws Exception { this.xmlFilePath = xmlPath; FileInputStream file = new FileInputStream(xmlPath); SAXBuilder sxb = new SAXBuilder(); Document document = sxb.build(file); Element root = document.getRootElement(); addArcsAndVerticesFromDomElement(root); } /** * Create the attack graph from the XML DOM element * @param root */ public void addArcsAndVerticesFromDomElement(Element root) { if (root == null) return; /* Add all the vertices */ Element vertices_element = root.getChild("vertices"); if (vertices_element != null) { List<Element> vertices = vertices_element.getChildren("vertex"); for (Element vertex_element : vertices) { //All arcs Element id_element = vertex_element.getChild("id"); if (id_element != null && Integer.parseInt(id_element.getText()) > 0) { int id_vertex = Integer.parseInt(id_element.getText()); Vertex vertex = getExistingOrCreateVertex(id_vertex); Element fact_element = vertex_element.getChild("fact"); if (fact_element != null) {
vertex.fact = new Fact(fact_element.getText(), vertex);
zsavely/PatternedTextWatcher
patternedtextwatcher/src/androidTest/java/com/szagurskii/patternedtextwatcher/FormattingTests.java
// Path: patternedtextwatcher/src/androidTest/java/com/szagurskii/patternedtextwatcher/utils/Utils.java // public class Utils { // /** // * Type inserted strings by character, like in real life. // * // * @param input input string which needs to be typed. // * @param expectedOutput expected output from this input which will be checked. // */ // public static void typeTextAndAssert(String input, String expectedOutput) { // // Type text. // onView(withId(android.R.id.primary)) // .perform(typeText(input), closeSoftKeyboard()); // // // Check that the text was changed. // assertExpectedOutput(expectedOutput); // } // // /** // * Insert a text into a view. // * // * @param input input string which needs to be typed. // * @param expectedOutput expected output from this input which will be checked. // */ // public static void insertTextAtOnceAndAssert(String input, String expectedOutput) { // // Type input. // onView(withId(android.R.id.primary)) // .perform(ViewActions.replaceText(input)); // assertExpectedOutput(expectedOutput); // // } // // /** // * Assert expected output. // * // * @param expectedOutput the string to assert. // */ // public static void assertExpectedOutput(String expectedOutput) { // // Check that the input was changed. // onView(withId(android.R.id.primary)) // .check(matches(withText(expectedOutput))); // } // // /** // * Delete one character from the edit text. // */ // public static void deleteOneCharacter() { // onView(withId(android.R.id.primary)).perform(ViewActions.pressKey(KeyEvent.KEYCODE_DEL)); // } // }
import android.support.test.runner.AndroidJUnit4; import com.szagurskii.patternedtextwatcher.utils.Utils; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith;
package com.szagurskii.patternedtextwatcher; @RunWith(AndroidJUnit4.class) public class FormattingTests extends BaseTests { @Test public void aSimpleTextChanged() {
// Path: patternedtextwatcher/src/androidTest/java/com/szagurskii/patternedtextwatcher/utils/Utils.java // public class Utils { // /** // * Type inserted strings by character, like in real life. // * // * @param input input string which needs to be typed. // * @param expectedOutput expected output from this input which will be checked. // */ // public static void typeTextAndAssert(String input, String expectedOutput) { // // Type text. // onView(withId(android.R.id.primary)) // .perform(typeText(input), closeSoftKeyboard()); // // // Check that the text was changed. // assertExpectedOutput(expectedOutput); // } // // /** // * Insert a text into a view. // * // * @param input input string which needs to be typed. // * @param expectedOutput expected output from this input which will be checked. // */ // public static void insertTextAtOnceAndAssert(String input, String expectedOutput) { // // Type input. // onView(withId(android.R.id.primary)) // .perform(ViewActions.replaceText(input)); // assertExpectedOutput(expectedOutput); // // } // // /** // * Assert expected output. // * // * @param expectedOutput the string to assert. // */ // public static void assertExpectedOutput(String expectedOutput) { // // Check that the input was changed. // onView(withId(android.R.id.primary)) // .check(matches(withText(expectedOutput))); // } // // /** // * Delete one character from the edit text. // */ // public static void deleteOneCharacter() { // onView(withId(android.R.id.primary)).perform(ViewActions.pressKey(KeyEvent.KEYCODE_DEL)); // } // } // Path: patternedtextwatcher/src/androidTest/java/com/szagurskii/patternedtextwatcher/FormattingTests.java import android.support.test.runner.AndroidJUnit4; import com.szagurskii.patternedtextwatcher.utils.Utils; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; package com.szagurskii.patternedtextwatcher; @RunWith(AndroidJUnit4.class) public class FormattingTests extends BaseTests { @Test public void aSimpleTextChanged() {
Utils.typeTextAndAssert(STRING_TO_BE_TYPED, STRING_TO_BE_TYPED);
zsavely/PatternedTextWatcher
patternedtextwatcher/src/test/java/com/szagurskii/patternedtextwatcher/PreconditionsTests.java
// Path: patternedtextwatcher/src/test/java/com/szagurskii/patternedtextwatcher/utils/TestUtils.java // public final class TestUtils { // /** // * Verifies that a utility class is well defined. // * <br> // * Author: <a href="https://stackoverflow.com/users/242042/archimedes-trajano">Archimedes Trajano</a> // * // * @param clazz utility class to verify. // * @see <a href="http://stackoverflow.com/a/10872497/4271064">http://stackoverflow.com/a/10872497/4271064</a> // */ // public static void assertUtilityClassWellDefined(Class<?> clazz) // throws NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException { // Assert.assertTrue("Class must be final.", Modifier.isFinal(clazz.getModifiers())); // Assert.assertEquals("There must be only one constructor.", 1, clazz.getDeclaredConstructors().length); // // Constructor<?> constructor = clazz.getDeclaredConstructor(); // if (constructor.isAccessible() || !Modifier.isPrivate(constructor.getModifiers())) { // Assert.fail("Constructor is not private."); // } // constructor.setAccessible(true); // constructor.newInstance(); // constructor.setAccessible(false); // // for (Method method : clazz.getMethods()) { // if (!Modifier.isStatic(method.getModifiers()) && method.getDeclaringClass().equals(clazz)) { // Assert.fail("There exists a non-static method:" + method); // } // } // } // }
import android.os.Build; import com.szagurskii.patternedtextwatcher.utils.TestUtils; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.robolectric.annotation.Config; import java.lang.reflect.InvocationTargetException;
public void shouldThrowIfNullChar() { PatternedTextWatcher patternedTextWatcher = new PatternedTextWatcher.Builder("(#)") .specialChar(null) .build(); } @Test(expected = IllegalArgumentException.class) public void shouldThrowIfEmptyChar() { PatternedTextWatcher patternedTextWatcher = new PatternedTextWatcher.Builder("(#)") .specialChar("") .build(); } @Test(expected = IllegalArgumentException.class) public void shouldThrowIfMoreThanOneInLengthChar() { PatternedTextWatcher patternedTextWatcher = new PatternedTextWatcher.Builder("(#)") .specialChar("LongSpecialChar") .build(); } @Test(expected = IllegalArgumentException.class) public void shouldThrowIfSaveAndFillAreTrue() { PatternedTextWatcher patternedTextWatcher = new PatternedTextWatcher.Builder("(#)") .fillExtraCharactersAutomatically(true) .saveAllInput(true) .build(); } @Test public void constructorShouldBePrivate() throws NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException {
// Path: patternedtextwatcher/src/test/java/com/szagurskii/patternedtextwatcher/utils/TestUtils.java // public final class TestUtils { // /** // * Verifies that a utility class is well defined. // * <br> // * Author: <a href="https://stackoverflow.com/users/242042/archimedes-trajano">Archimedes Trajano</a> // * // * @param clazz utility class to verify. // * @see <a href="http://stackoverflow.com/a/10872497/4271064">http://stackoverflow.com/a/10872497/4271064</a> // */ // public static void assertUtilityClassWellDefined(Class<?> clazz) // throws NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException { // Assert.assertTrue("Class must be final.", Modifier.isFinal(clazz.getModifiers())); // Assert.assertEquals("There must be only one constructor.", 1, clazz.getDeclaredConstructors().length); // // Constructor<?> constructor = clazz.getDeclaredConstructor(); // if (constructor.isAccessible() || !Modifier.isPrivate(constructor.getModifiers())) { // Assert.fail("Constructor is not private."); // } // constructor.setAccessible(true); // constructor.newInstance(); // constructor.setAccessible(false); // // for (Method method : clazz.getMethods()) { // if (!Modifier.isStatic(method.getModifiers()) && method.getDeclaringClass().equals(clazz)) { // Assert.fail("There exists a non-static method:" + method); // } // } // } // } // Path: patternedtextwatcher/src/test/java/com/szagurskii/patternedtextwatcher/PreconditionsTests.java import android.os.Build; import com.szagurskii.patternedtextwatcher.utils.TestUtils; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.robolectric.annotation.Config; import java.lang.reflect.InvocationTargetException; public void shouldThrowIfNullChar() { PatternedTextWatcher patternedTextWatcher = new PatternedTextWatcher.Builder("(#)") .specialChar(null) .build(); } @Test(expected = IllegalArgumentException.class) public void shouldThrowIfEmptyChar() { PatternedTextWatcher patternedTextWatcher = new PatternedTextWatcher.Builder("(#)") .specialChar("") .build(); } @Test(expected = IllegalArgumentException.class) public void shouldThrowIfMoreThanOneInLengthChar() { PatternedTextWatcher patternedTextWatcher = new PatternedTextWatcher.Builder("(#)") .specialChar("LongSpecialChar") .build(); } @Test(expected = IllegalArgumentException.class) public void shouldThrowIfSaveAndFillAreTrue() { PatternedTextWatcher patternedTextWatcher = new PatternedTextWatcher.Builder("(#)") .fillExtraCharactersAutomatically(true) .saveAllInput(true) .build(); } @Test public void constructorShouldBePrivate() throws NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException {
TestUtils.assertUtilityClassWellDefined(Preconditions.class);
zsavely/PatternedTextWatcher
patternedtextwatcher/src/androidTest/java/com/szagurskii/patternedtextwatcher/BaseTests.java
// Path: patternedtextwatcher/src/androidTest/java/com/szagurskii/patternedtextwatcher/utils/ViewDirtyIdlingResource.java // public final class ViewDirtyIdlingResource implements IdlingResource { // private final View decorView; // private ResourceCallback resourceCallback; // // public ViewDirtyIdlingResource(Activity activity) { // decorView = activity.getWindow().getDecorView(); // } // // @Override public String getName() { // return "view dirty"; // } // // @Override public boolean isIdleNow() { // boolean clean = !decorView.isDirty(); // if (clean) { // resourceCallback.onTransitionToIdle(); // } // return clean; // } // // @Override public void registerIdleTransitionCallback(ResourceCallback resourceCallback) { // this.resourceCallback = resourceCallback; // } // }
import android.support.test.espresso.Espresso; import android.support.test.rule.ActivityTestRule; import android.widget.EditText; import com.szagurskii.patternedtextwatcher.utils.ViewDirtyIdlingResource; import org.junit.After; import org.junit.Before; import org.junit.Rule;
package com.szagurskii.patternedtextwatcher; public abstract class BaseTests { static final String STRING_TO_BE_TYPED = "Espresso"; @Rule public ActivityTestRule<TestActivity> activityRule = new ActivityTestRule<>(TestActivity.class);
// Path: patternedtextwatcher/src/androidTest/java/com/szagurskii/patternedtextwatcher/utils/ViewDirtyIdlingResource.java // public final class ViewDirtyIdlingResource implements IdlingResource { // private final View decorView; // private ResourceCallback resourceCallback; // // public ViewDirtyIdlingResource(Activity activity) { // decorView = activity.getWindow().getDecorView(); // } // // @Override public String getName() { // return "view dirty"; // } // // @Override public boolean isIdleNow() { // boolean clean = !decorView.isDirty(); // if (clean) { // resourceCallback.onTransitionToIdle(); // } // return clean; // } // // @Override public void registerIdleTransitionCallback(ResourceCallback resourceCallback) { // this.resourceCallback = resourceCallback; // } // } // Path: patternedtextwatcher/src/androidTest/java/com/szagurskii/patternedtextwatcher/BaseTests.java import android.support.test.espresso.Espresso; import android.support.test.rule.ActivityTestRule; import android.widget.EditText; import com.szagurskii.patternedtextwatcher.utils.ViewDirtyIdlingResource; import org.junit.After; import org.junit.Before; import org.junit.Rule; package com.szagurskii.patternedtextwatcher; public abstract class BaseTests { static final String STRING_TO_BE_TYPED = "Espresso"; @Rule public ActivityTestRule<TestActivity> activityRule = new ActivityTestRule<>(TestActivity.class);
ViewDirtyIdlingResource viewDirtyIdler;
zsavely/PatternedTextWatcher
patternedtextwatcher/src/main/java/com/szagurskii/patternedtextwatcher/PatternedTextWatcher.java
// Path: patternedtextwatcher/src/main/java/com/szagurskii/patternedtextwatcher/Preconditions.java // static void checkInput(String specialChar, boolean saveInput, boolean fillExtraChars) { // if (specialChar == null) { // throw new NullPointerException("Special char can't be null."); // } // if (specialChar.isEmpty()) { // throw new IllegalArgumentException("Special char can't be empty."); // } // if (specialChar.length() > 1) { // throw new IllegalArgumentException("Special char must be length = 1."); // } // if (saveInput && fillExtraChars) { // throw new IllegalArgumentException("It is impossible to save input when the characters are " + // "filled automatically instead of characters."); // } // } // // Path: patternedtextwatcher/src/main/java/com/szagurskii/patternedtextwatcher/Preconditions.java // static void checkPatternInInput(String pattern, String specialChar) { // if (!pattern.contains(specialChar)) { // throw new IllegalStateException("There should be at least one special character in the " + // "pattern string."); // } // } // // Path: patternedtextwatcher/src/main/java/com/szagurskii/patternedtextwatcher/Preconditions.java // static void checkPatternInput(String pattern) { // if (pattern == null) { // throw new NullPointerException("Pattern can't be null."); // } // if (pattern.isEmpty()) { // throw new IllegalArgumentException("Pattern can't be empty."); // } // }
import android.text.Editable; import android.text.TextWatcher; import android.util.SparseArray; import static com.szagurskii.patternedtextwatcher.Preconditions.checkInput; import static com.szagurskii.patternedtextwatcher.Preconditions.checkPatternInInput; import static com.szagurskii.patternedtextwatcher.Preconditions.checkPatternInput;
package com.szagurskii.patternedtextwatcher; /** * A customizable text watcher which can be constructed via {@link Builder}. * * @author Savelii Zagurskii */ public class PatternedTextWatcher implements TextWatcher { static final String DEFAULT_CHAR = "#"; private final int maxLength; private final char specialCharacter; /** Indexes of secondary characters (not inserted by user). */ private final SparseArray<Character> patternCharactersByIndex; /** Indexes of symbols inserted by user. */ private final SparseArray<Character> normalCharactersByIndex; private final boolean fillExtra; private final boolean deleteExtra; private final boolean saveInput; private final boolean respectPatternLength; private final boolean debug; private int firstIndexToCheck; private int lastIndexToCheck; private String lastText; private boolean enabled; private StringBuilder savedText; /** * Initialize {@link PatternedTextWatcher} with {@code pattern} and default parameters. * For advanced tweaking use {@link Builder}. * * @param pattern the pattern of the text watcher. */ public PatternedTextWatcher(String pattern) { this(new Builder(pattern)); } PatternedTextWatcher(Builder builder) {
// Path: patternedtextwatcher/src/main/java/com/szagurskii/patternedtextwatcher/Preconditions.java // static void checkInput(String specialChar, boolean saveInput, boolean fillExtraChars) { // if (specialChar == null) { // throw new NullPointerException("Special char can't be null."); // } // if (specialChar.isEmpty()) { // throw new IllegalArgumentException("Special char can't be empty."); // } // if (specialChar.length() > 1) { // throw new IllegalArgumentException("Special char must be length = 1."); // } // if (saveInput && fillExtraChars) { // throw new IllegalArgumentException("It is impossible to save input when the characters are " + // "filled automatically instead of characters."); // } // } // // Path: patternedtextwatcher/src/main/java/com/szagurskii/patternedtextwatcher/Preconditions.java // static void checkPatternInInput(String pattern, String specialChar) { // if (!pattern.contains(specialChar)) { // throw new IllegalStateException("There should be at least one special character in the " + // "pattern string."); // } // } // // Path: patternedtextwatcher/src/main/java/com/szagurskii/patternedtextwatcher/Preconditions.java // static void checkPatternInput(String pattern) { // if (pattern == null) { // throw new NullPointerException("Pattern can't be null."); // } // if (pattern.isEmpty()) { // throw new IllegalArgumentException("Pattern can't be empty."); // } // } // Path: patternedtextwatcher/src/main/java/com/szagurskii/patternedtextwatcher/PatternedTextWatcher.java import android.text.Editable; import android.text.TextWatcher; import android.util.SparseArray; import static com.szagurskii.patternedtextwatcher.Preconditions.checkInput; import static com.szagurskii.patternedtextwatcher.Preconditions.checkPatternInInput; import static com.szagurskii.patternedtextwatcher.Preconditions.checkPatternInput; package com.szagurskii.patternedtextwatcher; /** * A customizable text watcher which can be constructed via {@link Builder}. * * @author Savelii Zagurskii */ public class PatternedTextWatcher implements TextWatcher { static final String DEFAULT_CHAR = "#"; private final int maxLength; private final char specialCharacter; /** Indexes of secondary characters (not inserted by user). */ private final SparseArray<Character> patternCharactersByIndex; /** Indexes of symbols inserted by user. */ private final SparseArray<Character> normalCharactersByIndex; private final boolean fillExtra; private final boolean deleteExtra; private final boolean saveInput; private final boolean respectPatternLength; private final boolean debug; private int firstIndexToCheck; private int lastIndexToCheck; private String lastText; private boolean enabled; private StringBuilder savedText; /** * Initialize {@link PatternedTextWatcher} with {@code pattern} and default parameters. * For advanced tweaking use {@link Builder}. * * @param pattern the pattern of the text watcher. */ public PatternedTextWatcher(String pattern) { this(new Builder(pattern)); } PatternedTextWatcher(Builder builder) {
checkPatternInput(builder.pattern);
zsavely/PatternedTextWatcher
patternedtextwatcher/src/main/java/com/szagurskii/patternedtextwatcher/PatternedTextWatcher.java
// Path: patternedtextwatcher/src/main/java/com/szagurskii/patternedtextwatcher/Preconditions.java // static void checkInput(String specialChar, boolean saveInput, boolean fillExtraChars) { // if (specialChar == null) { // throw new NullPointerException("Special char can't be null."); // } // if (specialChar.isEmpty()) { // throw new IllegalArgumentException("Special char can't be empty."); // } // if (specialChar.length() > 1) { // throw new IllegalArgumentException("Special char must be length = 1."); // } // if (saveInput && fillExtraChars) { // throw new IllegalArgumentException("It is impossible to save input when the characters are " + // "filled automatically instead of characters."); // } // } // // Path: patternedtextwatcher/src/main/java/com/szagurskii/patternedtextwatcher/Preconditions.java // static void checkPatternInInput(String pattern, String specialChar) { // if (!pattern.contains(specialChar)) { // throw new IllegalStateException("There should be at least one special character in the " + // "pattern string."); // } // } // // Path: patternedtextwatcher/src/main/java/com/szagurskii/patternedtextwatcher/Preconditions.java // static void checkPatternInput(String pattern) { // if (pattern == null) { // throw new NullPointerException("Pattern can't be null."); // } // if (pattern.isEmpty()) { // throw new IllegalArgumentException("Pattern can't be empty."); // } // }
import android.text.Editable; import android.text.TextWatcher; import android.util.SparseArray; import static com.szagurskii.patternedtextwatcher.Preconditions.checkInput; import static com.szagurskii.patternedtextwatcher.Preconditions.checkPatternInInput; import static com.szagurskii.patternedtextwatcher.Preconditions.checkPatternInput;
package com.szagurskii.patternedtextwatcher; /** * A customizable text watcher which can be constructed via {@link Builder}. * * @author Savelii Zagurskii */ public class PatternedTextWatcher implements TextWatcher { static final String DEFAULT_CHAR = "#"; private final int maxLength; private final char specialCharacter; /** Indexes of secondary characters (not inserted by user). */ private final SparseArray<Character> patternCharactersByIndex; /** Indexes of symbols inserted by user. */ private final SparseArray<Character> normalCharactersByIndex; private final boolean fillExtra; private final boolean deleteExtra; private final boolean saveInput; private final boolean respectPatternLength; private final boolean debug; private int firstIndexToCheck; private int lastIndexToCheck; private String lastText; private boolean enabled; private StringBuilder savedText; /** * Initialize {@link PatternedTextWatcher} with {@code pattern} and default parameters. * For advanced tweaking use {@link Builder}. * * @param pattern the pattern of the text watcher. */ public PatternedTextWatcher(String pattern) { this(new Builder(pattern)); } PatternedTextWatcher(Builder builder) { checkPatternInput(builder.pattern);
// Path: patternedtextwatcher/src/main/java/com/szagurskii/patternedtextwatcher/Preconditions.java // static void checkInput(String specialChar, boolean saveInput, boolean fillExtraChars) { // if (specialChar == null) { // throw new NullPointerException("Special char can't be null."); // } // if (specialChar.isEmpty()) { // throw new IllegalArgumentException("Special char can't be empty."); // } // if (specialChar.length() > 1) { // throw new IllegalArgumentException("Special char must be length = 1."); // } // if (saveInput && fillExtraChars) { // throw new IllegalArgumentException("It is impossible to save input when the characters are " + // "filled automatically instead of characters."); // } // } // // Path: patternedtextwatcher/src/main/java/com/szagurskii/patternedtextwatcher/Preconditions.java // static void checkPatternInInput(String pattern, String specialChar) { // if (!pattern.contains(specialChar)) { // throw new IllegalStateException("There should be at least one special character in the " + // "pattern string."); // } // } // // Path: patternedtextwatcher/src/main/java/com/szagurskii/patternedtextwatcher/Preconditions.java // static void checkPatternInput(String pattern) { // if (pattern == null) { // throw new NullPointerException("Pattern can't be null."); // } // if (pattern.isEmpty()) { // throw new IllegalArgumentException("Pattern can't be empty."); // } // } // Path: patternedtextwatcher/src/main/java/com/szagurskii/patternedtextwatcher/PatternedTextWatcher.java import android.text.Editable; import android.text.TextWatcher; import android.util.SparseArray; import static com.szagurskii.patternedtextwatcher.Preconditions.checkInput; import static com.szagurskii.patternedtextwatcher.Preconditions.checkPatternInInput; import static com.szagurskii.patternedtextwatcher.Preconditions.checkPatternInput; package com.szagurskii.patternedtextwatcher; /** * A customizable text watcher which can be constructed via {@link Builder}. * * @author Savelii Zagurskii */ public class PatternedTextWatcher implements TextWatcher { static final String DEFAULT_CHAR = "#"; private final int maxLength; private final char specialCharacter; /** Indexes of secondary characters (not inserted by user). */ private final SparseArray<Character> patternCharactersByIndex; /** Indexes of symbols inserted by user. */ private final SparseArray<Character> normalCharactersByIndex; private final boolean fillExtra; private final boolean deleteExtra; private final boolean saveInput; private final boolean respectPatternLength; private final boolean debug; private int firstIndexToCheck; private int lastIndexToCheck; private String lastText; private boolean enabled; private StringBuilder savedText; /** * Initialize {@link PatternedTextWatcher} with {@code pattern} and default parameters. * For advanced tweaking use {@link Builder}. * * @param pattern the pattern of the text watcher. */ public PatternedTextWatcher(String pattern) { this(new Builder(pattern)); } PatternedTextWatcher(Builder builder) { checkPatternInput(builder.pattern);
checkInput(builder.specialChar, builder.saveInput, builder.fillExtraChars);
zsavely/PatternedTextWatcher
patternedtextwatcher/src/main/java/com/szagurskii/patternedtextwatcher/PatternedTextWatcher.java
// Path: patternedtextwatcher/src/main/java/com/szagurskii/patternedtextwatcher/Preconditions.java // static void checkInput(String specialChar, boolean saveInput, boolean fillExtraChars) { // if (specialChar == null) { // throw new NullPointerException("Special char can't be null."); // } // if (specialChar.isEmpty()) { // throw new IllegalArgumentException("Special char can't be empty."); // } // if (specialChar.length() > 1) { // throw new IllegalArgumentException("Special char must be length = 1."); // } // if (saveInput && fillExtraChars) { // throw new IllegalArgumentException("It is impossible to save input when the characters are " + // "filled automatically instead of characters."); // } // } // // Path: patternedtextwatcher/src/main/java/com/szagurskii/patternedtextwatcher/Preconditions.java // static void checkPatternInInput(String pattern, String specialChar) { // if (!pattern.contains(specialChar)) { // throw new IllegalStateException("There should be at least one special character in the " + // "pattern string."); // } // } // // Path: patternedtextwatcher/src/main/java/com/szagurskii/patternedtextwatcher/Preconditions.java // static void checkPatternInput(String pattern) { // if (pattern == null) { // throw new NullPointerException("Pattern can't be null."); // } // if (pattern.isEmpty()) { // throw new IllegalArgumentException("Pattern can't be empty."); // } // }
import android.text.Editable; import android.text.TextWatcher; import android.util.SparseArray; import static com.szagurskii.patternedtextwatcher.Preconditions.checkInput; import static com.szagurskii.patternedtextwatcher.Preconditions.checkPatternInInput; import static com.szagurskii.patternedtextwatcher.Preconditions.checkPatternInput;
package com.szagurskii.patternedtextwatcher; /** * A customizable text watcher which can be constructed via {@link Builder}. * * @author Savelii Zagurskii */ public class PatternedTextWatcher implements TextWatcher { static final String DEFAULT_CHAR = "#"; private final int maxLength; private final char specialCharacter; /** Indexes of secondary characters (not inserted by user). */ private final SparseArray<Character> patternCharactersByIndex; /** Indexes of symbols inserted by user. */ private final SparseArray<Character> normalCharactersByIndex; private final boolean fillExtra; private final boolean deleteExtra; private final boolean saveInput; private final boolean respectPatternLength; private final boolean debug; private int firstIndexToCheck; private int lastIndexToCheck; private String lastText; private boolean enabled; private StringBuilder savedText; /** * Initialize {@link PatternedTextWatcher} with {@code pattern} and default parameters. * For advanced tweaking use {@link Builder}. * * @param pattern the pattern of the text watcher. */ public PatternedTextWatcher(String pattern) { this(new Builder(pattern)); } PatternedTextWatcher(Builder builder) { checkPatternInput(builder.pattern); checkInput(builder.specialChar, builder.saveInput, builder.fillExtraChars);
// Path: patternedtextwatcher/src/main/java/com/szagurskii/patternedtextwatcher/Preconditions.java // static void checkInput(String specialChar, boolean saveInput, boolean fillExtraChars) { // if (specialChar == null) { // throw new NullPointerException("Special char can't be null."); // } // if (specialChar.isEmpty()) { // throw new IllegalArgumentException("Special char can't be empty."); // } // if (specialChar.length() > 1) { // throw new IllegalArgumentException("Special char must be length = 1."); // } // if (saveInput && fillExtraChars) { // throw new IllegalArgumentException("It is impossible to save input when the characters are " + // "filled automatically instead of characters."); // } // } // // Path: patternedtextwatcher/src/main/java/com/szagurskii/patternedtextwatcher/Preconditions.java // static void checkPatternInInput(String pattern, String specialChar) { // if (!pattern.contains(specialChar)) { // throw new IllegalStateException("There should be at least one special character in the " + // "pattern string."); // } // } // // Path: patternedtextwatcher/src/main/java/com/szagurskii/patternedtextwatcher/Preconditions.java // static void checkPatternInput(String pattern) { // if (pattern == null) { // throw new NullPointerException("Pattern can't be null."); // } // if (pattern.isEmpty()) { // throw new IllegalArgumentException("Pattern can't be empty."); // } // } // Path: patternedtextwatcher/src/main/java/com/szagurskii/patternedtextwatcher/PatternedTextWatcher.java import android.text.Editable; import android.text.TextWatcher; import android.util.SparseArray; import static com.szagurskii.patternedtextwatcher.Preconditions.checkInput; import static com.szagurskii.patternedtextwatcher.Preconditions.checkPatternInInput; import static com.szagurskii.patternedtextwatcher.Preconditions.checkPatternInput; package com.szagurskii.patternedtextwatcher; /** * A customizable text watcher which can be constructed via {@link Builder}. * * @author Savelii Zagurskii */ public class PatternedTextWatcher implements TextWatcher { static final String DEFAULT_CHAR = "#"; private final int maxLength; private final char specialCharacter; /** Indexes of secondary characters (not inserted by user). */ private final SparseArray<Character> patternCharactersByIndex; /** Indexes of symbols inserted by user. */ private final SparseArray<Character> normalCharactersByIndex; private final boolean fillExtra; private final boolean deleteExtra; private final boolean saveInput; private final boolean respectPatternLength; private final boolean debug; private int firstIndexToCheck; private int lastIndexToCheck; private String lastText; private boolean enabled; private StringBuilder savedText; /** * Initialize {@link PatternedTextWatcher} with {@code pattern} and default parameters. * For advanced tweaking use {@link Builder}. * * @param pattern the pattern of the text watcher. */ public PatternedTextWatcher(String pattern) { this(new Builder(pattern)); } PatternedTextWatcher(Builder builder) { checkPatternInput(builder.pattern); checkInput(builder.specialChar, builder.saveInput, builder.fillExtraChars);
checkPatternInInput(builder.pattern, builder.specialChar);
zsavely/PatternedTextWatcher
patternedtextwatcher/src/androidTest/java/com/szagurskii/patternedtextwatcher/BasicDeletionTests.java
// Path: patternedtextwatcher/src/androidTest/java/com/szagurskii/patternedtextwatcher/utils/Utils.java // public class Utils { // /** // * Type inserted strings by character, like in real life. // * // * @param input input string which needs to be typed. // * @param expectedOutput expected output from this input which will be checked. // */ // public static void typeTextAndAssert(String input, String expectedOutput) { // // Type text. // onView(withId(android.R.id.primary)) // .perform(typeText(input), closeSoftKeyboard()); // // // Check that the text was changed. // assertExpectedOutput(expectedOutput); // } // // /** // * Insert a text into a view. // * // * @param input input string which needs to be typed. // * @param expectedOutput expected output from this input which will be checked. // */ // public static void insertTextAtOnceAndAssert(String input, String expectedOutput) { // // Type input. // onView(withId(android.R.id.primary)) // .perform(ViewActions.replaceText(input)); // assertExpectedOutput(expectedOutput); // // } // // /** // * Assert expected output. // * // * @param expectedOutput the string to assert. // */ // public static void assertExpectedOutput(String expectedOutput) { // // Check that the input was changed. // onView(withId(android.R.id.primary)) // .check(matches(withText(expectedOutput))); // } // // /** // * Delete one character from the edit text. // */ // public static void deleteOneCharacter() { // onView(withId(android.R.id.primary)).perform(ViewActions.pressKey(KeyEvent.KEYCODE_DEL)); // } // }
import android.support.test.runner.AndroidJUnit4; import com.szagurskii.patternedtextwatcher.utils.Utils; import org.junit.Test; import org.junit.runner.RunWith;
package com.szagurskii.patternedtextwatcher; @RunWith(AndroidJUnit4.class) public class BasicDeletionTests extends BaseTests { @Test public void simpleTextChanged() {
// Path: patternedtextwatcher/src/androidTest/java/com/szagurskii/patternedtextwatcher/utils/Utils.java // public class Utils { // /** // * Type inserted strings by character, like in real life. // * // * @param input input string which needs to be typed. // * @param expectedOutput expected output from this input which will be checked. // */ // public static void typeTextAndAssert(String input, String expectedOutput) { // // Type text. // onView(withId(android.R.id.primary)) // .perform(typeText(input), closeSoftKeyboard()); // // // Check that the text was changed. // assertExpectedOutput(expectedOutput); // } // // /** // * Insert a text into a view. // * // * @param input input string which needs to be typed. // * @param expectedOutput expected output from this input which will be checked. // */ // public static void insertTextAtOnceAndAssert(String input, String expectedOutput) { // // Type input. // onView(withId(android.R.id.primary)) // .perform(ViewActions.replaceText(input)); // assertExpectedOutput(expectedOutput); // // } // // /** // * Assert expected output. // * // * @param expectedOutput the string to assert. // */ // public static void assertExpectedOutput(String expectedOutput) { // // Check that the input was changed. // onView(withId(android.R.id.primary)) // .check(matches(withText(expectedOutput))); // } // // /** // * Delete one character from the edit text. // */ // public static void deleteOneCharacter() { // onView(withId(android.R.id.primary)).perform(ViewActions.pressKey(KeyEvent.KEYCODE_DEL)); // } // } // Path: patternedtextwatcher/src/androidTest/java/com/szagurskii/patternedtextwatcher/BasicDeletionTests.java import android.support.test.runner.AndroidJUnit4; import com.szagurskii.patternedtextwatcher.utils.Utils; import org.junit.Test; import org.junit.runner.RunWith; package com.szagurskii.patternedtextwatcher; @RunWith(AndroidJUnit4.class) public class BasicDeletionTests extends BaseTests { @Test public void simpleTextChanged() {
Utils.typeTextAndAssert(STRING_TO_BE_TYPED, STRING_TO_BE_TYPED);
zsavely/PatternedTextWatcher
patternedtextwatcher/src/androidTest/java/com/szagurskii/patternedtextwatcher/TextInsertionPatternTests.java
// Path: patternedtextwatcher/src/androidTest/java/com/szagurskii/patternedtextwatcher/utils/Utils.java // public class Utils { // /** // * Type inserted strings by character, like in real life. // * // * @param input input string which needs to be typed. // * @param expectedOutput expected output from this input which will be checked. // */ // public static void typeTextAndAssert(String input, String expectedOutput) { // // Type text. // onView(withId(android.R.id.primary)) // .perform(typeText(input), closeSoftKeyboard()); // // // Check that the text was changed. // assertExpectedOutput(expectedOutput); // } // // /** // * Insert a text into a view. // * // * @param input input string which needs to be typed. // * @param expectedOutput expected output from this input which will be checked. // */ // public static void insertTextAtOnceAndAssert(String input, String expectedOutput) { // // Type input. // onView(withId(android.R.id.primary)) // .perform(ViewActions.replaceText(input)); // assertExpectedOutput(expectedOutput); // // } // // /** // * Assert expected output. // * // * @param expectedOutput the string to assert. // */ // public static void assertExpectedOutput(String expectedOutput) { // // Check that the input was changed. // onView(withId(android.R.id.primary)) // .check(matches(withText(expectedOutput))); // } // // /** // * Delete one character from the edit text. // */ // public static void deleteOneCharacter() { // onView(withId(android.R.id.primary)).perform(ViewActions.pressKey(KeyEvent.KEYCODE_DEL)); // } // }
import android.support.test.runner.AndroidJUnit4; import com.szagurskii.patternedtextwatcher.utils.Utils; import org.junit.Test; import org.junit.runner.RunWith;
package com.szagurskii.patternedtextwatcher; @RunWith(AndroidJUnit4.class) public class TextInsertionPatternTests extends BaseTests { @Test public void simpleTextChanged() { addTextChangedListener("(##-##)");
// Path: patternedtextwatcher/src/androidTest/java/com/szagurskii/patternedtextwatcher/utils/Utils.java // public class Utils { // /** // * Type inserted strings by character, like in real life. // * // * @param input input string which needs to be typed. // * @param expectedOutput expected output from this input which will be checked. // */ // public static void typeTextAndAssert(String input, String expectedOutput) { // // Type text. // onView(withId(android.R.id.primary)) // .perform(typeText(input), closeSoftKeyboard()); // // // Check that the text was changed. // assertExpectedOutput(expectedOutput); // } // // /** // * Insert a text into a view. // * // * @param input input string which needs to be typed. // * @param expectedOutput expected output from this input which will be checked. // */ // public static void insertTextAtOnceAndAssert(String input, String expectedOutput) { // // Type input. // onView(withId(android.R.id.primary)) // .perform(ViewActions.replaceText(input)); // assertExpectedOutput(expectedOutput); // // } // // /** // * Assert expected output. // * // * @param expectedOutput the string to assert. // */ // public static void assertExpectedOutput(String expectedOutput) { // // Check that the input was changed. // onView(withId(android.R.id.primary)) // .check(matches(withText(expectedOutput))); // } // // /** // * Delete one character from the edit text. // */ // public static void deleteOneCharacter() { // onView(withId(android.R.id.primary)).perform(ViewActions.pressKey(KeyEvent.KEYCODE_DEL)); // } // } // Path: patternedtextwatcher/src/androidTest/java/com/szagurskii/patternedtextwatcher/TextInsertionPatternTests.java import android.support.test.runner.AndroidJUnit4; import com.szagurskii.patternedtextwatcher.utils.Utils; import org.junit.Test; import org.junit.runner.RunWith; package com.szagurskii.patternedtextwatcher; @RunWith(AndroidJUnit4.class) public class TextInsertionPatternTests extends BaseTests { @Test public void simpleTextChanged() { addTextChangedListener("(##-##)");
Utils.insertTextAtOnceAndAssert("Espr", "(Es-pr)");
zsavely/PatternedTextWatcher
patternedtextwatcher/src/test/java/com/szagurskii/patternedtextwatcher/LogUtilsTest.java
// Path: patternedtextwatcher/src/test/java/com/szagurskii/patternedtextwatcher/utils/TestUtils.java // public final class TestUtils { // /** // * Verifies that a utility class is well defined. // * <br> // * Author: <a href="https://stackoverflow.com/users/242042/archimedes-trajano">Archimedes Trajano</a> // * // * @param clazz utility class to verify. // * @see <a href="http://stackoverflow.com/a/10872497/4271064">http://stackoverflow.com/a/10872497/4271064</a> // */ // public static void assertUtilityClassWellDefined(Class<?> clazz) // throws NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException { // Assert.assertTrue("Class must be final.", Modifier.isFinal(clazz.getModifiers())); // Assert.assertEquals("There must be only one constructor.", 1, clazz.getDeclaredConstructors().length); // // Constructor<?> constructor = clazz.getDeclaredConstructor(); // if (constructor.isAccessible() || !Modifier.isPrivate(constructor.getModifiers())) { // Assert.fail("Constructor is not private."); // } // constructor.setAccessible(true); // constructor.newInstance(); // constructor.setAccessible(false); // // for (Method method : clazz.getMethods()) { // if (!Modifier.isStatic(method.getModifiers()) && method.getDeclaringClass().equals(clazz)) { // Assert.fail("There exists a non-static method:" + method); // } // } // } // }
import com.szagurskii.patternedtextwatcher.utils.TestUtils; import org.junit.Test; import java.lang.reflect.InvocationTargetException;
package com.szagurskii.patternedtextwatcher; public class LogUtilsTest { @Test public void constructorShouldBePrivate() throws NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException {
// Path: patternedtextwatcher/src/test/java/com/szagurskii/patternedtextwatcher/utils/TestUtils.java // public final class TestUtils { // /** // * Verifies that a utility class is well defined. // * <br> // * Author: <a href="https://stackoverflow.com/users/242042/archimedes-trajano">Archimedes Trajano</a> // * // * @param clazz utility class to verify. // * @see <a href="http://stackoverflow.com/a/10872497/4271064">http://stackoverflow.com/a/10872497/4271064</a> // */ // public static void assertUtilityClassWellDefined(Class<?> clazz) // throws NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException { // Assert.assertTrue("Class must be final.", Modifier.isFinal(clazz.getModifiers())); // Assert.assertEquals("There must be only one constructor.", 1, clazz.getDeclaredConstructors().length); // // Constructor<?> constructor = clazz.getDeclaredConstructor(); // if (constructor.isAccessible() || !Modifier.isPrivate(constructor.getModifiers())) { // Assert.fail("Constructor is not private."); // } // constructor.setAccessible(true); // constructor.newInstance(); // constructor.setAccessible(false); // // for (Method method : clazz.getMethods()) { // if (!Modifier.isStatic(method.getModifiers()) && method.getDeclaringClass().equals(clazz)) { // Assert.fail("There exists a non-static method:" + method); // } // } // } // } // Path: patternedtextwatcher/src/test/java/com/szagurskii/patternedtextwatcher/LogUtilsTest.java import com.szagurskii.patternedtextwatcher.utils.TestUtils; import org.junit.Test; import java.lang.reflect.InvocationTargetException; package com.szagurskii.patternedtextwatcher; public class LogUtilsTest { @Test public void constructorShouldBePrivate() throws NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException {
TestUtils.assertUtilityClassWellDefined(LogUtils.class);
zsavely/PatternedTextWatcher
patternedtextwatcher/src/androidTest/java/com/szagurskii/patternedtextwatcher/BasicAdditionTests.java
// Path: patternedtextwatcher/src/androidTest/java/com/szagurskii/patternedtextwatcher/utils/Utils.java // public class Utils { // /** // * Type inserted strings by character, like in real life. // * // * @param input input string which needs to be typed. // * @param expectedOutput expected output from this input which will be checked. // */ // public static void typeTextAndAssert(String input, String expectedOutput) { // // Type text. // onView(withId(android.R.id.primary)) // .perform(typeText(input), closeSoftKeyboard()); // // // Check that the text was changed. // assertExpectedOutput(expectedOutput); // } // // /** // * Insert a text into a view. // * // * @param input input string which needs to be typed. // * @param expectedOutput expected output from this input which will be checked. // */ // public static void insertTextAtOnceAndAssert(String input, String expectedOutput) { // // Type input. // onView(withId(android.R.id.primary)) // .perform(ViewActions.replaceText(input)); // assertExpectedOutput(expectedOutput); // // } // // /** // * Assert expected output. // * // * @param expectedOutput the string to assert. // */ // public static void assertExpectedOutput(String expectedOutput) { // // Check that the input was changed. // onView(withId(android.R.id.primary)) // .check(matches(withText(expectedOutput))); // } // // /** // * Delete one character from the edit text. // */ // public static void deleteOneCharacter() { // onView(withId(android.R.id.primary)).perform(ViewActions.pressKey(KeyEvent.KEYCODE_DEL)); // } // }
import android.support.test.runner.AndroidJUnit4; import com.szagurskii.patternedtextwatcher.utils.Utils; import org.junit.Test; import org.junit.runner.RunWith;
package com.szagurskii.patternedtextwatcher; @RunWith(AndroidJUnit4.class) public class BasicAdditionTests extends BaseTests { @Test public void simpleTextChanged() {
// Path: patternedtextwatcher/src/androidTest/java/com/szagurskii/patternedtextwatcher/utils/Utils.java // public class Utils { // /** // * Type inserted strings by character, like in real life. // * // * @param input input string which needs to be typed. // * @param expectedOutput expected output from this input which will be checked. // */ // public static void typeTextAndAssert(String input, String expectedOutput) { // // Type text. // onView(withId(android.R.id.primary)) // .perform(typeText(input), closeSoftKeyboard()); // // // Check that the text was changed. // assertExpectedOutput(expectedOutput); // } // // /** // * Insert a text into a view. // * // * @param input input string which needs to be typed. // * @param expectedOutput expected output from this input which will be checked. // */ // public static void insertTextAtOnceAndAssert(String input, String expectedOutput) { // // Type input. // onView(withId(android.R.id.primary)) // .perform(ViewActions.replaceText(input)); // assertExpectedOutput(expectedOutput); // // } // // /** // * Assert expected output. // * // * @param expectedOutput the string to assert. // */ // public static void assertExpectedOutput(String expectedOutput) { // // Check that the input was changed. // onView(withId(android.R.id.primary)) // .check(matches(withText(expectedOutput))); // } // // /** // * Delete one character from the edit text. // */ // public static void deleteOneCharacter() { // onView(withId(android.R.id.primary)).perform(ViewActions.pressKey(KeyEvent.KEYCODE_DEL)); // } // } // Path: patternedtextwatcher/src/androidTest/java/com/szagurskii/patternedtextwatcher/BasicAdditionTests.java import android.support.test.runner.AndroidJUnit4; import com.szagurskii.patternedtextwatcher.utils.Utils; import org.junit.Test; import org.junit.runner.RunWith; package com.szagurskii.patternedtextwatcher; @RunWith(AndroidJUnit4.class) public class BasicAdditionTests extends BaseTests { @Test public void simpleTextChanged() {
Utils.typeTextAndAssert(STRING_TO_BE_TYPED, STRING_TO_BE_TYPED);
sjamesr/jfreesane
src/main/java/au/com/southsky/jfreesane/SaneOptionDescriptor.java
// Path: src/main/java/au/com/southsky/jfreesane/SaneOption.java // public enum OptionUnits implements SaneEnum { // /** // * The option has no units. // */ // UNIT_NONE(0), // // /** // * The option unit is pixels. // */ // UNIT_PIXEL(1), // // /** // * The option unit is bits. // */ // UNIT_BIT(2), // // /** // * The option unit is millimeters. // */ // UNIT_MM(3), // // /** // * The option unit is dots per inch. // */ // UNIT_DPI(4), // // /** // * The option unit is a percentage. // */ // UNIT_PERCENT(5), // // /** // * The option unit is microseconds. // */ // UNIT_MICROSECOND(6); // // private final int wireValue; // // OptionUnits(int wireValue) { // this.wireValue = wireValue; // } // // @Override // public int getWireValue() { // return wireValue; // } // }
import java.util.List; import java.util.Set; import au.com.southsky.jfreesane.SaneOption.OptionUnits;
package au.com.southsky.jfreesane; /** * Describes a SANE option. * * @author James Ring (sjr@jdns.org) */ class SaneOptionDescriptor { private final String name; private final String title; private final String description; private final OptionGroup group; private final OptionValueType valueType;
// Path: src/main/java/au/com/southsky/jfreesane/SaneOption.java // public enum OptionUnits implements SaneEnum { // /** // * The option has no units. // */ // UNIT_NONE(0), // // /** // * The option unit is pixels. // */ // UNIT_PIXEL(1), // // /** // * The option unit is bits. // */ // UNIT_BIT(2), // // /** // * The option unit is millimeters. // */ // UNIT_MM(3), // // /** // * The option unit is dots per inch. // */ // UNIT_DPI(4), // // /** // * The option unit is a percentage. // */ // UNIT_PERCENT(5), // // /** // * The option unit is microseconds. // */ // UNIT_MICROSECOND(6); // // private final int wireValue; // // OptionUnits(int wireValue) { // this.wireValue = wireValue; // } // // @Override // public int getWireValue() { // return wireValue; // } // } // Path: src/main/java/au/com/southsky/jfreesane/SaneOptionDescriptor.java import java.util.List; import java.util.Set; import au.com.southsky.jfreesane.SaneOption.OptionUnits; package au.com.southsky.jfreesane; /** * Describes a SANE option. * * @author James Ring (sjr@jdns.org) */ class SaneOptionDescriptor { private final String name; private final String title; private final String description; private final OptionGroup group; private final OptionValueType valueType;
private final OptionUnits units;
sjamesr/jfreesane
src/test/java/au/com/southsky/jfreesane/SaneClientAuthenticationTest.java
// Path: src/main/java/au/com/southsky/jfreesane/SaneClientAuthentication.java // public static class ClientCredential { // private final String backend; // private final String username; // private final String password; // // protected ClientCredential(String backend, String username, String password) { // this.backend = backend; // this.username = username; // this.password = password; // } // // public static ClientCredential fromAuthString(String authString) { // @SuppressWarnings("StringSplitter") // String[] fields = authString.split(":"); // if (fields.length < 3) { // return null; // } // // return new ClientCredential(fields[2], fields[0], fields[1]); // } // // public String getBackend() { // return backend; // } // // public String getUsername() { // return username; // } // // public String getPassword() { // return password; // } // }
import au.com.southsky.jfreesane.SaneClientAuthentication.ClientCredential; import com.google.common.truth.Truth; import org.junit.Test; import java.io.Reader; import java.io.StringReader; import java.util.UUID;
package au.com.southsky.jfreesane; public class SaneClientAuthenticationTest { @Test public void testSaneClientAuthenticationWithMissingFileDoesNotFail() { String filepath = "NON_EXISTENT_PATH_" + UUID.randomUUID().toString(); SaneClientAuthentication sca = new SaneClientAuthentication(filepath); sca.getCredentialForResource(""); } @Test public void testInitialize() { SaneClientAuthentication sca = new SaneClientAuthentication(getTestConfigurationSource());
// Path: src/main/java/au/com/southsky/jfreesane/SaneClientAuthentication.java // public static class ClientCredential { // private final String backend; // private final String username; // private final String password; // // protected ClientCredential(String backend, String username, String password) { // this.backend = backend; // this.username = username; // this.password = password; // } // // public static ClientCredential fromAuthString(String authString) { // @SuppressWarnings("StringSplitter") // String[] fields = authString.split(":"); // if (fields.length < 3) { // return null; // } // // return new ClientCredential(fields[2], fields[0], fields[1]); // } // // public String getBackend() { // return backend; // } // // public String getUsername() { // return username; // } // // public String getPassword() { // return password; // } // } // Path: src/test/java/au/com/southsky/jfreesane/SaneClientAuthenticationTest.java import au.com.southsky.jfreesane.SaneClientAuthentication.ClientCredential; import com.google.common.truth.Truth; import org.junit.Test; import java.io.Reader; import java.io.StringReader; import java.util.UUID; package au.com.southsky.jfreesane; public class SaneClientAuthenticationTest { @Test public void testSaneClientAuthenticationWithMissingFileDoesNotFail() { String filepath = "NON_EXISTENT_PATH_" + UUID.randomUUID().toString(); SaneClientAuthentication sca = new SaneClientAuthentication(filepath); sca.getCredentialForResource(""); } @Test public void testInitialize() { SaneClientAuthentication sca = new SaneClientAuthentication(getTestConfigurationSource());
ClientCredential pixmaCreds = sca.getCredentialForResource("pixma");
sjamesr/jfreesane
src/main/java/au/com/southsky/jfreesane/SaneInputStream.java
// Path: src/main/java/au/com/southsky/jfreesane/SaneOption.java // public enum OptionUnits implements SaneEnum { // /** // * The option has no units. // */ // UNIT_NONE(0), // // /** // * The option unit is pixels. // */ // UNIT_PIXEL(1), // // /** // * The option unit is bits. // */ // UNIT_BIT(2), // // /** // * The option unit is millimeters. // */ // UNIT_MM(3), // // /** // * The option unit is dots per inch. // */ // UNIT_DPI(4), // // /** // * The option unit is a percentage. // */ // UNIT_PERCENT(5), // // /** // * The option unit is microseconds. // */ // UNIT_MICROSECOND(6); // // private final int wireValue; // // OptionUnits(int wireValue) { // this.wireValue = wireValue; // } // // @Override // public int getWireValue() { // return wireValue; // } // }
import java.io.IOException; import java.io.InputStream; import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; import au.com.southsky.jfreesane.SaneOption.OptionUnits;
return new SaneParameters(frame, lastFrame, bytesPerLine, pixelsPerLine, lines, depth); } public SaneStatus readStatus() throws IOException { return SaneStatus.fromWireValue(readWord().integerValue()); } public SaneWord readWord() throws IOException { return SaneWord.fromStream(this); } public SaneOptionDescriptor readOptionDescriptor() throws IOException { // discard pointer readWord(); String optionName = readString(); String optionTitle = readString(); String optionDescription = readString(); int typeInt = readWord().integerValue(); // TODO: range check here OptionValueType valueType = SaneEnums.valueOf(OptionValueType.class, typeInt); if (valueType == OptionValueType.GROUP) { // a new group applies! currentGroup = new OptionGroup(optionTitle); } int unitsInt = readWord().integerValue(); // TODO: range check here
// Path: src/main/java/au/com/southsky/jfreesane/SaneOption.java // public enum OptionUnits implements SaneEnum { // /** // * The option has no units. // */ // UNIT_NONE(0), // // /** // * The option unit is pixels. // */ // UNIT_PIXEL(1), // // /** // * The option unit is bits. // */ // UNIT_BIT(2), // // /** // * The option unit is millimeters. // */ // UNIT_MM(3), // // /** // * The option unit is dots per inch. // */ // UNIT_DPI(4), // // /** // * The option unit is a percentage. // */ // UNIT_PERCENT(5), // // /** // * The option unit is microseconds. // */ // UNIT_MICROSECOND(6); // // private final int wireValue; // // OptionUnits(int wireValue) { // this.wireValue = wireValue; // } // // @Override // public int getWireValue() { // return wireValue; // } // } // Path: src/main/java/au/com/southsky/jfreesane/SaneInputStream.java import java.io.IOException; import java.io.InputStream; import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; import au.com.southsky.jfreesane.SaneOption.OptionUnits; return new SaneParameters(frame, lastFrame, bytesPerLine, pixelsPerLine, lines, depth); } public SaneStatus readStatus() throws IOException { return SaneStatus.fromWireValue(readWord().integerValue()); } public SaneWord readWord() throws IOException { return SaneWord.fromStream(this); } public SaneOptionDescriptor readOptionDescriptor() throws IOException { // discard pointer readWord(); String optionName = readString(); String optionTitle = readString(); String optionDescription = readString(); int typeInt = readWord().integerValue(); // TODO: range check here OptionValueType valueType = SaneEnums.valueOf(OptionValueType.class, typeInt); if (valueType == OptionValueType.GROUP) { // a new group applies! currentGroup = new OptionGroup(optionTitle); } int unitsInt = readWord().integerValue(); // TODO: range check here
OptionUnits units = SaneEnums.valueOf(OptionUnits.class, unitsInt);
dingwpmz/Mycat-Demo
src/main/java/persistent/prestige/modules/eshop/dao/SellerDao.java
// Path: src/main/java/persistent/prestige/modules/eshop/model/Seller.java // public class Seller extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "Seller"; // // //columns START // /**商家名称*/ // private java.lang.String sellerName; // /**商家uid*/ // private java.lang.String uid; // /**联系地址*/ // private java.lang.String address; // /**电话*/ // private java.lang.String phone; // /**0:禁用;1:启用*/ // private Integer status; // //columns END // // // // public java.lang.String getSellerName() { // return this.sellerName; // } // // public void setSellerName(java.lang.String value) { // this.sellerName = value; // } // // public java.lang.String getUid() { // return this.uid; // } // // public void setUid(java.lang.String value) { // this.uid = value; // } // // public java.lang.String getAddress() { // return this.address; // } // // public void setAddress(java.lang.String value) { // this.address = value; // } // // public java.lang.String getPhone() { // return this.phone; // } // // public void setPhone(java.lang.String value) { // this.phone = value; // } // // public Integer getStatus() { // return this.status; // } // // public void setStatus(Integer value) { // this.status = value; // } // // } // // Path: src/main/java/persistent/prestige/platform/base/dao/Dao.java // @MybatisScan // public interface Dao<T extends Entity, PK extends Serializable> extends Serializable { // /** // * 根据主键查找 // * @param id // * @return // */ // T find(PK id); // // /** // * // * @param ids // * @return // */ // List<T> findByIds(PK[] ids); // // /** // * 根据查询条件查找 // * @param params // * @return // */ // List<T> query(Map params); // // /** // * 查询总数 // * @return // */ // Long countAll(); // // /** // * 查询总数 // * @return // */ // Long count(Map params); // // /** // * 增加新实体 // * 主键值会自动填充到entity // * @param entity // */ // void create(Object entity); // // /** // * 更新实体 // * @param entity // * @return // */ // int update(Object entity); // // // /** // * 根据ID 删除实体 // * // * @param id // */ // void deleteById(PK id); // // /** // * 此处不想设计成 T entity,主要是考虑在前端需要创建对象实体,设计成Map,灵活性更高 // * @param entity // */ // void delete(Map params); // // /** 树型节点 方法 start */ // T findRoot(); // // List<T> findRoots(Map params); // // /** // * 根据code 获取所有节点(包括子孙节点) // * @param code // * @return // */ // List<T> findAllChilds(String code); // // /** // * 根据父节点获取所有直接子节点 // * @param parentId // * @return // */ // List<T> findChilds(Integer parentId); // /** 树型节点 方法 end */ // // void createExcelBatch(List<Map> datas); // // // }
import org.springframework.stereotype.Repository; import persistent.prestige.modules.eshop.model.Seller; import persistent.prestige.platform.api.annotation.MybatisScan; import persistent.prestige.platform.base.dao.Dao;
/* * Powered By agile * Web Site: http://www.agile.com * Since 2008 - 2016 */ package persistent.prestige.modules.eshop.dao; /** * Seller DAO类 * @author 雅居乐 2016-8-27 10:22:34 * @version 1.0 */ @Repository("sellerDao") @MybatisScan
// Path: src/main/java/persistent/prestige/modules/eshop/model/Seller.java // public class Seller extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "Seller"; // // //columns START // /**商家名称*/ // private java.lang.String sellerName; // /**商家uid*/ // private java.lang.String uid; // /**联系地址*/ // private java.lang.String address; // /**电话*/ // private java.lang.String phone; // /**0:禁用;1:启用*/ // private Integer status; // //columns END // // // // public java.lang.String getSellerName() { // return this.sellerName; // } // // public void setSellerName(java.lang.String value) { // this.sellerName = value; // } // // public java.lang.String getUid() { // return this.uid; // } // // public void setUid(java.lang.String value) { // this.uid = value; // } // // public java.lang.String getAddress() { // return this.address; // } // // public void setAddress(java.lang.String value) { // this.address = value; // } // // public java.lang.String getPhone() { // return this.phone; // } // // public void setPhone(java.lang.String value) { // this.phone = value; // } // // public Integer getStatus() { // return this.status; // } // // public void setStatus(Integer value) { // this.status = value; // } // // } // // Path: src/main/java/persistent/prestige/platform/base/dao/Dao.java // @MybatisScan // public interface Dao<T extends Entity, PK extends Serializable> extends Serializable { // /** // * 根据主键查找 // * @param id // * @return // */ // T find(PK id); // // /** // * // * @param ids // * @return // */ // List<T> findByIds(PK[] ids); // // /** // * 根据查询条件查找 // * @param params // * @return // */ // List<T> query(Map params); // // /** // * 查询总数 // * @return // */ // Long countAll(); // // /** // * 查询总数 // * @return // */ // Long count(Map params); // // /** // * 增加新实体 // * 主键值会自动填充到entity // * @param entity // */ // void create(Object entity); // // /** // * 更新实体 // * @param entity // * @return // */ // int update(Object entity); // // // /** // * 根据ID 删除实体 // * // * @param id // */ // void deleteById(PK id); // // /** // * 此处不想设计成 T entity,主要是考虑在前端需要创建对象实体,设计成Map,灵活性更高 // * @param entity // */ // void delete(Map params); // // /** 树型节点 方法 start */ // T findRoot(); // // List<T> findRoots(Map params); // // /** // * 根据code 获取所有节点(包括子孙节点) // * @param code // * @return // */ // List<T> findAllChilds(String code); // // /** // * 根据父节点获取所有直接子节点 // * @param parentId // * @return // */ // List<T> findChilds(Integer parentId); // /** 树型节点 方法 end */ // // void createExcelBatch(List<Map> datas); // // // } // Path: src/main/java/persistent/prestige/modules/eshop/dao/SellerDao.java import org.springframework.stereotype.Repository; import persistent.prestige.modules.eshop.model.Seller; import persistent.prestige.platform.api.annotation.MybatisScan; import persistent.prestige.platform.base.dao.Dao; /* * Powered By agile * Web Site: http://www.agile.com * Since 2008 - 2016 */ package persistent.prestige.modules.eshop.dao; /** * Seller DAO类 * @author 雅居乐 2016-8-27 10:22:34 * @version 1.0 */ @Repository("sellerDao") @MybatisScan
public interface SellerDao extends Dao<Seller,java.lang.Integer>{
dingwpmz/Mycat-Demo
src/main/java/persistent/prestige/modules/eshop/dao/SellerDao.java
// Path: src/main/java/persistent/prestige/modules/eshop/model/Seller.java // public class Seller extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "Seller"; // // //columns START // /**商家名称*/ // private java.lang.String sellerName; // /**商家uid*/ // private java.lang.String uid; // /**联系地址*/ // private java.lang.String address; // /**电话*/ // private java.lang.String phone; // /**0:禁用;1:启用*/ // private Integer status; // //columns END // // // // public java.lang.String getSellerName() { // return this.sellerName; // } // // public void setSellerName(java.lang.String value) { // this.sellerName = value; // } // // public java.lang.String getUid() { // return this.uid; // } // // public void setUid(java.lang.String value) { // this.uid = value; // } // // public java.lang.String getAddress() { // return this.address; // } // // public void setAddress(java.lang.String value) { // this.address = value; // } // // public java.lang.String getPhone() { // return this.phone; // } // // public void setPhone(java.lang.String value) { // this.phone = value; // } // // public Integer getStatus() { // return this.status; // } // // public void setStatus(Integer value) { // this.status = value; // } // // } // // Path: src/main/java/persistent/prestige/platform/base/dao/Dao.java // @MybatisScan // public interface Dao<T extends Entity, PK extends Serializable> extends Serializable { // /** // * 根据主键查找 // * @param id // * @return // */ // T find(PK id); // // /** // * // * @param ids // * @return // */ // List<T> findByIds(PK[] ids); // // /** // * 根据查询条件查找 // * @param params // * @return // */ // List<T> query(Map params); // // /** // * 查询总数 // * @return // */ // Long countAll(); // // /** // * 查询总数 // * @return // */ // Long count(Map params); // // /** // * 增加新实体 // * 主键值会自动填充到entity // * @param entity // */ // void create(Object entity); // // /** // * 更新实体 // * @param entity // * @return // */ // int update(Object entity); // // // /** // * 根据ID 删除实体 // * // * @param id // */ // void deleteById(PK id); // // /** // * 此处不想设计成 T entity,主要是考虑在前端需要创建对象实体,设计成Map,灵活性更高 // * @param entity // */ // void delete(Map params); // // /** 树型节点 方法 start */ // T findRoot(); // // List<T> findRoots(Map params); // // /** // * 根据code 获取所有节点(包括子孙节点) // * @param code // * @return // */ // List<T> findAllChilds(String code); // // /** // * 根据父节点获取所有直接子节点 // * @param parentId // * @return // */ // List<T> findChilds(Integer parentId); // /** 树型节点 方法 end */ // // void createExcelBatch(List<Map> datas); // // // }
import org.springframework.stereotype.Repository; import persistent.prestige.modules.eshop.model.Seller; import persistent.prestige.platform.api.annotation.MybatisScan; import persistent.prestige.platform.base.dao.Dao;
/* * Powered By agile * Web Site: http://www.agile.com * Since 2008 - 2016 */ package persistent.prestige.modules.eshop.dao; /** * Seller DAO类 * @author 雅居乐 2016-8-27 10:22:34 * @version 1.0 */ @Repository("sellerDao") @MybatisScan
// Path: src/main/java/persistent/prestige/modules/eshop/model/Seller.java // public class Seller extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "Seller"; // // //columns START // /**商家名称*/ // private java.lang.String sellerName; // /**商家uid*/ // private java.lang.String uid; // /**联系地址*/ // private java.lang.String address; // /**电话*/ // private java.lang.String phone; // /**0:禁用;1:启用*/ // private Integer status; // //columns END // // // // public java.lang.String getSellerName() { // return this.sellerName; // } // // public void setSellerName(java.lang.String value) { // this.sellerName = value; // } // // public java.lang.String getUid() { // return this.uid; // } // // public void setUid(java.lang.String value) { // this.uid = value; // } // // public java.lang.String getAddress() { // return this.address; // } // // public void setAddress(java.lang.String value) { // this.address = value; // } // // public java.lang.String getPhone() { // return this.phone; // } // // public void setPhone(java.lang.String value) { // this.phone = value; // } // // public Integer getStatus() { // return this.status; // } // // public void setStatus(Integer value) { // this.status = value; // } // // } // // Path: src/main/java/persistent/prestige/platform/base/dao/Dao.java // @MybatisScan // public interface Dao<T extends Entity, PK extends Serializable> extends Serializable { // /** // * 根据主键查找 // * @param id // * @return // */ // T find(PK id); // // /** // * // * @param ids // * @return // */ // List<T> findByIds(PK[] ids); // // /** // * 根据查询条件查找 // * @param params // * @return // */ // List<T> query(Map params); // // /** // * 查询总数 // * @return // */ // Long countAll(); // // /** // * 查询总数 // * @return // */ // Long count(Map params); // // /** // * 增加新实体 // * 主键值会自动填充到entity // * @param entity // */ // void create(Object entity); // // /** // * 更新实体 // * @param entity // * @return // */ // int update(Object entity); // // // /** // * 根据ID 删除实体 // * // * @param id // */ // void deleteById(PK id); // // /** // * 此处不想设计成 T entity,主要是考虑在前端需要创建对象实体,设计成Map,灵活性更高 // * @param entity // */ // void delete(Map params); // // /** 树型节点 方法 start */ // T findRoot(); // // List<T> findRoots(Map params); // // /** // * 根据code 获取所有节点(包括子孙节点) // * @param code // * @return // */ // List<T> findAllChilds(String code); // // /** // * 根据父节点获取所有直接子节点 // * @param parentId // * @return // */ // List<T> findChilds(Integer parentId); // /** 树型节点 方法 end */ // // void createExcelBatch(List<Map> datas); // // // } // Path: src/main/java/persistent/prestige/modules/eshop/dao/SellerDao.java import org.springframework.stereotype.Repository; import persistent.prestige.modules.eshop.model.Seller; import persistent.prestige.platform.api.annotation.MybatisScan; import persistent.prestige.platform.base.dao.Dao; /* * Powered By agile * Web Site: http://www.agile.com * Since 2008 - 2016 */ package persistent.prestige.modules.eshop.dao; /** * Seller DAO类 * @author 雅居乐 2016-8-27 10:22:34 * @version 1.0 */ @Repository("sellerDao") @MybatisScan
public interface SellerDao extends Dao<Seller,java.lang.Integer>{
dingwpmz/Mycat-Demo
src/main/java/persistent/prestige/modules/common/tenant/TenantControlInteceper.java
// Path: src/main/java/persistent/prestige/modules/edu/service/UserSchemeService.java // public interface UserSchemeService { // String findTenant(String account); // // Integer findDbPos(String account); // }
import org.aopalliance.intercept.MethodInterceptor; import org.aopalliance.intercept.MethodInvocation; import org.springframework.beans.factory.annotation.Autowired; import persistent.prestige.modules.edu.service.UserSchemeService;
package persistent.prestige.modules.common.tenant; public class TenantControlInteceper implements MethodInterceptor { @Autowired
// Path: src/main/java/persistent/prestige/modules/edu/service/UserSchemeService.java // public interface UserSchemeService { // String findTenant(String account); // // Integer findDbPos(String account); // } // Path: src/main/java/persistent/prestige/modules/common/tenant/TenantControlInteceper.java import org.aopalliance.intercept.MethodInterceptor; import org.aopalliance.intercept.MethodInvocation; import org.springframework.beans.factory.annotation.Autowired; import persistent.prestige.modules.edu.service.UserSchemeService; package persistent.prestige.modules.common.tenant; public class TenantControlInteceper implements MethodInterceptor { @Autowired
private UserSchemeService userScemeService;
dingwpmz/Mycat-Demo
src/main/java/persistent/prestige/modules/edu/service/EduDemoService.java
// Path: src/main/java/persistent/prestige/modules/edu/model/Organization.java // public class Organization extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "Organization"; // // //columns START // /**title*/ // private java.lang.String title; // // private Integer dbPos; // //columns END // // // // public java.lang.String getTitle() { // return this.title; // } // // public void setTitle(java.lang.String value) { // this.title = value; // } // // public Integer getDbPos() { // return dbPos; // } // // public void setDbPos(Integer dbPos) { // this.dbPos = dbPos; // } // // // // // // }
import java.util.List; import java.util.Map; import persistent.prestige.modules.edu.model.Organization;
package persistent.prestige.modules.edu.service; public interface EduDemoService { public Map saveLogin(String account, String password); /** * 查组织机构 * @param title * @return */
// Path: src/main/java/persistent/prestige/modules/edu/model/Organization.java // public class Organization extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "Organization"; // // //columns START // /**title*/ // private java.lang.String title; // // private Integer dbPos; // //columns END // // // // public java.lang.String getTitle() { // return this.title; // } // // public void setTitle(java.lang.String value) { // this.title = value; // } // // public Integer getDbPos() { // return dbPos; // } // // public void setDbPos(Integer dbPos) { // this.dbPos = dbPos; // } // // // // // // } // Path: src/main/java/persistent/prestige/modules/edu/service/EduDemoService.java import java.util.List; import java.util.Map; import persistent.prestige.modules.edu.model.Organization; package persistent.prestige.modules.edu.service; public interface EduDemoService { public Map saveLogin(String account, String password); /** * 查组织机构 * @param title * @return */
public List<Organization> searchOrgs(String title);
dingwpmz/Mycat-Demo
src/main/java/persistent/prestige/modules/eshop/dao/SkuDao.java
// Path: src/main/java/persistent/prestige/modules/eshop/model/Sku.java // public class Sku extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "Sku"; // // //columns START // /**商品ID*/ // private java.lang.Integer goodsId; // /**商品价格,单位分*/ // private java.lang.Long price; // /**库存*/ // private java.lang.Integer storeCount; // // private String skuNo; // //columns END // // // // public java.lang.Integer getGoodsId() { // return this.goodsId; // } // // public void setGoodsId(java.lang.Integer value) { // this.goodsId = value; // } // // public java.lang.Long getPrice() { // return this.price; // } // // public void setPrice(java.lang.Long value) { // this.price = value; // } // // public java.lang.Integer getStoreCount() { // return this.storeCount; // } // // public void setStoreCount(java.lang.Integer value) { // this.storeCount = value; // } // // public String getSkuNo() { // return skuNo; // } // // public void setSkuNo(String skuNo) { // this.skuNo = skuNo; // } // // // // } // // Path: src/main/java/persistent/prestige/platform/base/dao/Dao.java // @MybatisScan // public interface Dao<T extends Entity, PK extends Serializable> extends Serializable { // /** // * 根据主键查找 // * @param id // * @return // */ // T find(PK id); // // /** // * // * @param ids // * @return // */ // List<T> findByIds(PK[] ids); // // /** // * 根据查询条件查找 // * @param params // * @return // */ // List<T> query(Map params); // // /** // * 查询总数 // * @return // */ // Long countAll(); // // /** // * 查询总数 // * @return // */ // Long count(Map params); // // /** // * 增加新实体 // * 主键值会自动填充到entity // * @param entity // */ // void create(Object entity); // // /** // * 更新实体 // * @param entity // * @return // */ // int update(Object entity); // // // /** // * 根据ID 删除实体 // * // * @param id // */ // void deleteById(PK id); // // /** // * 此处不想设计成 T entity,主要是考虑在前端需要创建对象实体,设计成Map,灵活性更高 // * @param entity // */ // void delete(Map params); // // /** 树型节点 方法 start */ // T findRoot(); // // List<T> findRoots(Map params); // // /** // * 根据code 获取所有节点(包括子孙节点) // * @param code // * @return // */ // List<T> findAllChilds(String code); // // /** // * 根据父节点获取所有直接子节点 // * @param parentId // * @return // */ // List<T> findChilds(Integer parentId); // /** 树型节点 方法 end */ // // void createExcelBatch(List<Map> datas); // // // }
import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Repository; import persistent.prestige.modules.eshop.model.Sku; import persistent.prestige.platform.api.annotation.MybatisScan; import persistent.prestige.platform.base.dao.Dao;
/* * Powered By agile * Web Site: http://www.agile.com * Since 2008 - 2016 */ package persistent.prestige.modules.eshop.dao; /** * Sku DAO类 * @author 雅居乐 2016-8-31 20:45:42 * @version 1.0 */ @Repository("skuDao") @MybatisScan
// Path: src/main/java/persistent/prestige/modules/eshop/model/Sku.java // public class Sku extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "Sku"; // // //columns START // /**商品ID*/ // private java.lang.Integer goodsId; // /**商品价格,单位分*/ // private java.lang.Long price; // /**库存*/ // private java.lang.Integer storeCount; // // private String skuNo; // //columns END // // // // public java.lang.Integer getGoodsId() { // return this.goodsId; // } // // public void setGoodsId(java.lang.Integer value) { // this.goodsId = value; // } // // public java.lang.Long getPrice() { // return this.price; // } // // public void setPrice(java.lang.Long value) { // this.price = value; // } // // public java.lang.Integer getStoreCount() { // return this.storeCount; // } // // public void setStoreCount(java.lang.Integer value) { // this.storeCount = value; // } // // public String getSkuNo() { // return skuNo; // } // // public void setSkuNo(String skuNo) { // this.skuNo = skuNo; // } // // // // } // // Path: src/main/java/persistent/prestige/platform/base/dao/Dao.java // @MybatisScan // public interface Dao<T extends Entity, PK extends Serializable> extends Serializable { // /** // * 根据主键查找 // * @param id // * @return // */ // T find(PK id); // // /** // * // * @param ids // * @return // */ // List<T> findByIds(PK[] ids); // // /** // * 根据查询条件查找 // * @param params // * @return // */ // List<T> query(Map params); // // /** // * 查询总数 // * @return // */ // Long countAll(); // // /** // * 查询总数 // * @return // */ // Long count(Map params); // // /** // * 增加新实体 // * 主键值会自动填充到entity // * @param entity // */ // void create(Object entity); // // /** // * 更新实体 // * @param entity // * @return // */ // int update(Object entity); // // // /** // * 根据ID 删除实体 // * // * @param id // */ // void deleteById(PK id); // // /** // * 此处不想设计成 T entity,主要是考虑在前端需要创建对象实体,设计成Map,灵活性更高 // * @param entity // */ // void delete(Map params); // // /** 树型节点 方法 start */ // T findRoot(); // // List<T> findRoots(Map params); // // /** // * 根据code 获取所有节点(包括子孙节点) // * @param code // * @return // */ // List<T> findAllChilds(String code); // // /** // * 根据父节点获取所有直接子节点 // * @param parentId // * @return // */ // List<T> findChilds(Integer parentId); // /** 树型节点 方法 end */ // // void createExcelBatch(List<Map> datas); // // // } // Path: src/main/java/persistent/prestige/modules/eshop/dao/SkuDao.java import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Repository; import persistent.prestige.modules.eshop.model.Sku; import persistent.prestige.platform.api.annotation.MybatisScan; import persistent.prestige.platform.base.dao.Dao; /* * Powered By agile * Web Site: http://www.agile.com * Since 2008 - 2016 */ package persistent.prestige.modules.eshop.dao; /** * Sku DAO类 * @author 雅居乐 2016-8-31 20:45:42 * @version 1.0 */ @Repository("skuDao") @MybatisScan
public interface SkuDao extends Dao<Sku,java.lang.Integer>{
dingwpmz/Mycat-Demo
src/main/java/persistent/prestige/modules/eshop/dao/SkuDao.java
// Path: src/main/java/persistent/prestige/modules/eshop/model/Sku.java // public class Sku extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "Sku"; // // //columns START // /**商品ID*/ // private java.lang.Integer goodsId; // /**商品价格,单位分*/ // private java.lang.Long price; // /**库存*/ // private java.lang.Integer storeCount; // // private String skuNo; // //columns END // // // // public java.lang.Integer getGoodsId() { // return this.goodsId; // } // // public void setGoodsId(java.lang.Integer value) { // this.goodsId = value; // } // // public java.lang.Long getPrice() { // return this.price; // } // // public void setPrice(java.lang.Long value) { // this.price = value; // } // // public java.lang.Integer getStoreCount() { // return this.storeCount; // } // // public void setStoreCount(java.lang.Integer value) { // this.storeCount = value; // } // // public String getSkuNo() { // return skuNo; // } // // public void setSkuNo(String skuNo) { // this.skuNo = skuNo; // } // // // // } // // Path: src/main/java/persistent/prestige/platform/base/dao/Dao.java // @MybatisScan // public interface Dao<T extends Entity, PK extends Serializable> extends Serializable { // /** // * 根据主键查找 // * @param id // * @return // */ // T find(PK id); // // /** // * // * @param ids // * @return // */ // List<T> findByIds(PK[] ids); // // /** // * 根据查询条件查找 // * @param params // * @return // */ // List<T> query(Map params); // // /** // * 查询总数 // * @return // */ // Long countAll(); // // /** // * 查询总数 // * @return // */ // Long count(Map params); // // /** // * 增加新实体 // * 主键值会自动填充到entity // * @param entity // */ // void create(Object entity); // // /** // * 更新实体 // * @param entity // * @return // */ // int update(Object entity); // // // /** // * 根据ID 删除实体 // * // * @param id // */ // void deleteById(PK id); // // /** // * 此处不想设计成 T entity,主要是考虑在前端需要创建对象实体,设计成Map,灵活性更高 // * @param entity // */ // void delete(Map params); // // /** 树型节点 方法 start */ // T findRoot(); // // List<T> findRoots(Map params); // // /** // * 根据code 获取所有节点(包括子孙节点) // * @param code // * @return // */ // List<T> findAllChilds(String code); // // /** // * 根据父节点获取所有直接子节点 // * @param parentId // * @return // */ // List<T> findChilds(Integer parentId); // /** 树型节点 方法 end */ // // void createExcelBatch(List<Map> datas); // // // }
import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Repository; import persistent.prestige.modules.eshop.model.Sku; import persistent.prestige.platform.api.annotation.MybatisScan; import persistent.prestige.platform.base.dao.Dao;
/* * Powered By agile * Web Site: http://www.agile.com * Since 2008 - 2016 */ package persistent.prestige.modules.eshop.dao; /** * Sku DAO类 * @author 雅居乐 2016-8-31 20:45:42 * @version 1.0 */ @Repository("skuDao") @MybatisScan
// Path: src/main/java/persistent/prestige/modules/eshop/model/Sku.java // public class Sku extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "Sku"; // // //columns START // /**商品ID*/ // private java.lang.Integer goodsId; // /**商品价格,单位分*/ // private java.lang.Long price; // /**库存*/ // private java.lang.Integer storeCount; // // private String skuNo; // //columns END // // // // public java.lang.Integer getGoodsId() { // return this.goodsId; // } // // public void setGoodsId(java.lang.Integer value) { // this.goodsId = value; // } // // public java.lang.Long getPrice() { // return this.price; // } // // public void setPrice(java.lang.Long value) { // this.price = value; // } // // public java.lang.Integer getStoreCount() { // return this.storeCount; // } // // public void setStoreCount(java.lang.Integer value) { // this.storeCount = value; // } // // public String getSkuNo() { // return skuNo; // } // // public void setSkuNo(String skuNo) { // this.skuNo = skuNo; // } // // // // } // // Path: src/main/java/persistent/prestige/platform/base/dao/Dao.java // @MybatisScan // public interface Dao<T extends Entity, PK extends Serializable> extends Serializable { // /** // * 根据主键查找 // * @param id // * @return // */ // T find(PK id); // // /** // * // * @param ids // * @return // */ // List<T> findByIds(PK[] ids); // // /** // * 根据查询条件查找 // * @param params // * @return // */ // List<T> query(Map params); // // /** // * 查询总数 // * @return // */ // Long countAll(); // // /** // * 查询总数 // * @return // */ // Long count(Map params); // // /** // * 增加新实体 // * 主键值会自动填充到entity // * @param entity // */ // void create(Object entity); // // /** // * 更新实体 // * @param entity // * @return // */ // int update(Object entity); // // // /** // * 根据ID 删除实体 // * // * @param id // */ // void deleteById(PK id); // // /** // * 此处不想设计成 T entity,主要是考虑在前端需要创建对象实体,设计成Map,灵活性更高 // * @param entity // */ // void delete(Map params); // // /** 树型节点 方法 start */ // T findRoot(); // // List<T> findRoots(Map params); // // /** // * 根据code 获取所有节点(包括子孙节点) // * @param code // * @return // */ // List<T> findAllChilds(String code); // // /** // * 根据父节点获取所有直接子节点 // * @param parentId // * @return // */ // List<T> findChilds(Integer parentId); // /** 树型节点 方法 end */ // // void createExcelBatch(List<Map> datas); // // // } // Path: src/main/java/persistent/prestige/modules/eshop/dao/SkuDao.java import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Repository; import persistent.prestige.modules.eshop.model.Sku; import persistent.prestige.platform.api.annotation.MybatisScan; import persistent.prestige.platform.base.dao.Dao; /* * Powered By agile * Web Site: http://www.agile.com * Since 2008 - 2016 */ package persistent.prestige.modules.eshop.dao; /** * Sku DAO类 * @author 雅居乐 2016-8-31 20:45:42 * @version 1.0 */ @Repository("skuDao") @MybatisScan
public interface SkuDao extends Dao<Sku,java.lang.Integer>{
dingwpmz/Mycat-Demo
src/main/java/persistent/prestige/modules/passport/action/UserControl.java
// Path: src/main/java/persistent/prestige/modules/passport/model/User.java // public class User extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "User"; // // //columns START // /**用户uid*/ // private java.lang.String uid; // /**名称*/ // private java.lang.String name; // /**邮箱*/ // private java.lang.String email; // /**电话号码*/ // private java.lang.String phone; // /**0:禁用;1:启用*/ // private Integer status; // //columns END // // // // public java.lang.String getUid() { // return this.uid; // } // // public void setUid(java.lang.String value) { // this.uid = value; // } // // public java.lang.String getName() { // return this.name; // } // // public void setName(java.lang.String value) { // this.name = value; // } // // public java.lang.String getEmail() { // return this.email; // } // // public void setEmail(java.lang.String value) { // this.email = value; // } // // public java.lang.String getPhone() { // return this.phone; // } // // public void setPhone(java.lang.String value) { // this.phone = value; // } // // public Integer getStatus() { // return this.status; // } // // public void setStatus(Integer value) { // this.status = value; // } // // } // // Path: src/main/java/persistent/prestige/modules/passport/service/UserService.java // public interface UserService { // /** // * 保存信息 // * @param datas // * @return // */ // Integer saveUser(User user); // // /** // * 测试带事务的 // * @return // */ // Integer saveTest(); // // /** // * 测试非事务的 // * @return // */ // Integer listTest(); // } // // Path: src/main/java/persistent/prestige/platform/utils/UUidUtils.java // public class UUidUtils { // // public static final String uuid() { // return UUID.randomUUID().toString().replaceAll("-", ""); // } // // }
import java.util.Date; import java.util.HashMap; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import persistent.prestige.modules.passport.model.User; import persistent.prestige.modules.passport.service.UserService; import persistent.prestige.platform.utils.UUidUtils;
/* * Powered By agile * Web Site: http://www.agile.com * Since 2008 - 2016 */ package persistent.prestige.modules.passport.action; /** * User控制类 * @author 雅居乐 2016-8-27 10:00:04 * @version 1.0 */ @Controller @RequestMapping("/passport/user") public class UserControl{ @Autowired
// Path: src/main/java/persistent/prestige/modules/passport/model/User.java // public class User extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "User"; // // //columns START // /**用户uid*/ // private java.lang.String uid; // /**名称*/ // private java.lang.String name; // /**邮箱*/ // private java.lang.String email; // /**电话号码*/ // private java.lang.String phone; // /**0:禁用;1:启用*/ // private Integer status; // //columns END // // // // public java.lang.String getUid() { // return this.uid; // } // // public void setUid(java.lang.String value) { // this.uid = value; // } // // public java.lang.String getName() { // return this.name; // } // // public void setName(java.lang.String value) { // this.name = value; // } // // public java.lang.String getEmail() { // return this.email; // } // // public void setEmail(java.lang.String value) { // this.email = value; // } // // public java.lang.String getPhone() { // return this.phone; // } // // public void setPhone(java.lang.String value) { // this.phone = value; // } // // public Integer getStatus() { // return this.status; // } // // public void setStatus(Integer value) { // this.status = value; // } // // } // // Path: src/main/java/persistent/prestige/modules/passport/service/UserService.java // public interface UserService { // /** // * 保存信息 // * @param datas // * @return // */ // Integer saveUser(User user); // // /** // * 测试带事务的 // * @return // */ // Integer saveTest(); // // /** // * 测试非事务的 // * @return // */ // Integer listTest(); // } // // Path: src/main/java/persistent/prestige/platform/utils/UUidUtils.java // public class UUidUtils { // // public static final String uuid() { // return UUID.randomUUID().toString().replaceAll("-", ""); // } // // } // Path: src/main/java/persistent/prestige/modules/passport/action/UserControl.java import java.util.Date; import java.util.HashMap; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import persistent.prestige.modules.passport.model.User; import persistent.prestige.modules.passport.service.UserService; import persistent.prestige.platform.utils.UUidUtils; /* * Powered By agile * Web Site: http://www.agile.com * Since 2008 - 2016 */ package persistent.prestige.modules.passport.action; /** * User控制类 * @author 雅居乐 2016-8-27 10:00:04 * @version 1.0 */ @Controller @RequestMapping("/passport/user") public class UserControl{ @Autowired
private UserService userService;
dingwpmz/Mycat-Demo
src/main/java/persistent/prestige/modules/edu/service/impl/UserSchemServiceImpl.java
// Path: src/main/java/persistent/prestige/modules/edu/dao/TeacherUserDao.java // @Repository("teacherUserDao") // @MybatisScan // public interface TeacherUserDao extends Dao<TeacherUser,java.lang.Long>{ // // GlobalUser findGlobalUser(String account); // // // List<TeacherUser> findAllUser(); // // // } // // Path: src/main/java/persistent/prestige/modules/edu/model/GlobalUser.java // public class GlobalUser implements Serializable{ // // private String account; // // private Integer dbPos; // // private String tenant; // // public String getAccount() { // return account; // } // // public void setAccount(String account) { // this.account = account; // } // // public Integer getDbPos() { // return dbPos; // } // // public void setDbPos(Integer dbPos) { // this.dbPos = dbPos; // } // // public String getTenant() { // return tenant; // } // // public void setTenant(String tenant) { // this.tenant = tenant; // } // // // // } // // Path: src/main/java/persistent/prestige/modules/edu/service/UserSchemeService.java // public interface UserSchemeService { // String findTenant(String account); // // Integer findDbPos(String account); // }
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import persistent.prestige.modules.edu.dao.TeacherUserDao; import persistent.prestige.modules.edu.model.GlobalUser; import persistent.prestige.modules.edu.service.UserSchemeService;
package persistent.prestige.modules.edu.service.impl; @Service("userSchemService") public class UserSchemServiceImpl implements UserSchemeService { @Autowired
// Path: src/main/java/persistent/prestige/modules/edu/dao/TeacherUserDao.java // @Repository("teacherUserDao") // @MybatisScan // public interface TeacherUserDao extends Dao<TeacherUser,java.lang.Long>{ // // GlobalUser findGlobalUser(String account); // // // List<TeacherUser> findAllUser(); // // // } // // Path: src/main/java/persistent/prestige/modules/edu/model/GlobalUser.java // public class GlobalUser implements Serializable{ // // private String account; // // private Integer dbPos; // // private String tenant; // // public String getAccount() { // return account; // } // // public void setAccount(String account) { // this.account = account; // } // // public Integer getDbPos() { // return dbPos; // } // // public void setDbPos(Integer dbPos) { // this.dbPos = dbPos; // } // // public String getTenant() { // return tenant; // } // // public void setTenant(String tenant) { // this.tenant = tenant; // } // // // // } // // Path: src/main/java/persistent/prestige/modules/edu/service/UserSchemeService.java // public interface UserSchemeService { // String findTenant(String account); // // Integer findDbPos(String account); // } // Path: src/main/java/persistent/prestige/modules/edu/service/impl/UserSchemServiceImpl.java import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import persistent.prestige.modules.edu.dao.TeacherUserDao; import persistent.prestige.modules.edu.model.GlobalUser; import persistent.prestige.modules.edu.service.UserSchemeService; package persistent.prestige.modules.edu.service.impl; @Service("userSchemService") public class UserSchemServiceImpl implements UserSchemeService { @Autowired
private TeacherUserDao teacherUserDao;
dingwpmz/Mycat-Demo
src/main/java/persistent/prestige/modules/edu/service/impl/UserSchemServiceImpl.java
// Path: src/main/java/persistent/prestige/modules/edu/dao/TeacherUserDao.java // @Repository("teacherUserDao") // @MybatisScan // public interface TeacherUserDao extends Dao<TeacherUser,java.lang.Long>{ // // GlobalUser findGlobalUser(String account); // // // List<TeacherUser> findAllUser(); // // // } // // Path: src/main/java/persistent/prestige/modules/edu/model/GlobalUser.java // public class GlobalUser implements Serializable{ // // private String account; // // private Integer dbPos; // // private String tenant; // // public String getAccount() { // return account; // } // // public void setAccount(String account) { // this.account = account; // } // // public Integer getDbPos() { // return dbPos; // } // // public void setDbPos(Integer dbPos) { // this.dbPos = dbPos; // } // // public String getTenant() { // return tenant; // } // // public void setTenant(String tenant) { // this.tenant = tenant; // } // // // // } // // Path: src/main/java/persistent/prestige/modules/edu/service/UserSchemeService.java // public interface UserSchemeService { // String findTenant(String account); // // Integer findDbPos(String account); // }
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import persistent.prestige.modules.edu.dao.TeacherUserDao; import persistent.prestige.modules.edu.model.GlobalUser; import persistent.prestige.modules.edu.service.UserSchemeService;
package persistent.prestige.modules.edu.service.impl; @Service("userSchemService") public class UserSchemServiceImpl implements UserSchemeService { @Autowired private TeacherUserDao teacherUserDao; @Override public String findTenant(String account) {
// Path: src/main/java/persistent/prestige/modules/edu/dao/TeacherUserDao.java // @Repository("teacherUserDao") // @MybatisScan // public interface TeacherUserDao extends Dao<TeacherUser,java.lang.Long>{ // // GlobalUser findGlobalUser(String account); // // // List<TeacherUser> findAllUser(); // // // } // // Path: src/main/java/persistent/prestige/modules/edu/model/GlobalUser.java // public class GlobalUser implements Serializable{ // // private String account; // // private Integer dbPos; // // private String tenant; // // public String getAccount() { // return account; // } // // public void setAccount(String account) { // this.account = account; // } // // public Integer getDbPos() { // return dbPos; // } // // public void setDbPos(Integer dbPos) { // this.dbPos = dbPos; // } // // public String getTenant() { // return tenant; // } // // public void setTenant(String tenant) { // this.tenant = tenant; // } // // // // } // // Path: src/main/java/persistent/prestige/modules/edu/service/UserSchemeService.java // public interface UserSchemeService { // String findTenant(String account); // // Integer findDbPos(String account); // } // Path: src/main/java/persistent/prestige/modules/edu/service/impl/UserSchemServiceImpl.java import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import persistent.prestige.modules.edu.dao.TeacherUserDao; import persistent.prestige.modules.edu.model.GlobalUser; import persistent.prestige.modules.edu.service.UserSchemeService; package persistent.prestige.modules.edu.service.impl; @Service("userSchemService") public class UserSchemServiceImpl implements UserSchemeService { @Autowired private TeacherUserDao teacherUserDao; @Override public String findTenant(String account) {
GlobalUser user = teacherUserDao.findGlobalUser(account);
dingwpmz/Mycat-Demo
src/main/java/persistent/prestige/modules/edu/action/EduControl2.java
// Path: src/main/java/persistent/prestige/modules/common/tenant/TenantContextHolder.java // public class TenantContextHolder { // // private static ThreadLocal<String> tenanThreadLocal = new ThreadLocal<String>(); // // public static final void setTenant(String scheme) { // tenanThreadLocal.set(scheme); // } // // public static final String getTenant() { // String scheme = tenanThreadLocal.get(); // if (scheme == null) { // scheme = ""; // } // return scheme; // } // // public static final void remove() { // tenanThreadLocal.remove(); // } // // } // // Path: src/main/java/persistent/prestige/modules/edu/model/Organization.java // public class Organization extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "Organization"; // // //columns START // /**title*/ // private java.lang.String title; // // private Integer dbPos; // //columns END // // // // public java.lang.String getTitle() { // return this.title; // } // // public void setTitle(java.lang.String value) { // this.title = value; // } // // public Integer getDbPos() { // return dbPos; // } // // public void setDbPos(Integer dbPos) { // this.dbPos = dbPos; // } // // // // // // } // // Path: src/main/java/persistent/prestige/modules/edu/service/EduDemoService2.java // public interface EduDemoService2 { // // // public Map saveLogin(Integer dbPos, String account, String password); // // /** // * 查组织机构 // * @param title // * @return // */ // public List<Organization> searchOrgs(Integer dbPos, String title); // // // public Organization saveOrg(Integer dbPos, String title); // // // // // } // // Path: src/main/java/persistent/prestige/modules/edu/service/UserSchemeService.java // public interface UserSchemeService { // String findTenant(String account); // // Integer findDbPos(String account); // }
import java.util.HashMap; import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import persistent.prestige.modules.common.tenant.TenantContextHolder; import persistent.prestige.modules.edu.model.Organization; import persistent.prestige.modules.edu.service.EduDemoService2; import persistent.prestige.modules.edu.service.UserSchemeService;
package persistent.prestige.modules.edu.action; /** * 多租户,但逻辑库 * @author Administrator * */ @Controller @RequestMapping("/edu/demo2") public class EduControl2 { @Autowired
// Path: src/main/java/persistent/prestige/modules/common/tenant/TenantContextHolder.java // public class TenantContextHolder { // // private static ThreadLocal<String> tenanThreadLocal = new ThreadLocal<String>(); // // public static final void setTenant(String scheme) { // tenanThreadLocal.set(scheme); // } // // public static final String getTenant() { // String scheme = tenanThreadLocal.get(); // if (scheme == null) { // scheme = ""; // } // return scheme; // } // // public static final void remove() { // tenanThreadLocal.remove(); // } // // } // // Path: src/main/java/persistent/prestige/modules/edu/model/Organization.java // public class Organization extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "Organization"; // // //columns START // /**title*/ // private java.lang.String title; // // private Integer dbPos; // //columns END // // // // public java.lang.String getTitle() { // return this.title; // } // // public void setTitle(java.lang.String value) { // this.title = value; // } // // public Integer getDbPos() { // return dbPos; // } // // public void setDbPos(Integer dbPos) { // this.dbPos = dbPos; // } // // // // // // } // // Path: src/main/java/persistent/prestige/modules/edu/service/EduDemoService2.java // public interface EduDemoService2 { // // // public Map saveLogin(Integer dbPos, String account, String password); // // /** // * 查组织机构 // * @param title // * @return // */ // public List<Organization> searchOrgs(Integer dbPos, String title); // // // public Organization saveOrg(Integer dbPos, String title); // // // // // } // // Path: src/main/java/persistent/prestige/modules/edu/service/UserSchemeService.java // public interface UserSchemeService { // String findTenant(String account); // // Integer findDbPos(String account); // } // Path: src/main/java/persistent/prestige/modules/edu/action/EduControl2.java import java.util.HashMap; import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import persistent.prestige.modules.common.tenant.TenantContextHolder; import persistent.prestige.modules.edu.model.Organization; import persistent.prestige.modules.edu.service.EduDemoService2; import persistent.prestige.modules.edu.service.UserSchemeService; package persistent.prestige.modules.edu.action; /** * 多租户,但逻辑库 * @author Administrator * */ @Controller @RequestMapping("/edu/demo2") public class EduControl2 { @Autowired
private EduDemoService2 eduDemoService;
dingwpmz/Mycat-Demo
src/main/java/persistent/prestige/modules/edu/action/EduControl2.java
// Path: src/main/java/persistent/prestige/modules/common/tenant/TenantContextHolder.java // public class TenantContextHolder { // // private static ThreadLocal<String> tenanThreadLocal = new ThreadLocal<String>(); // // public static final void setTenant(String scheme) { // tenanThreadLocal.set(scheme); // } // // public static final String getTenant() { // String scheme = tenanThreadLocal.get(); // if (scheme == null) { // scheme = ""; // } // return scheme; // } // // public static final void remove() { // tenanThreadLocal.remove(); // } // // } // // Path: src/main/java/persistent/prestige/modules/edu/model/Organization.java // public class Organization extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "Organization"; // // //columns START // /**title*/ // private java.lang.String title; // // private Integer dbPos; // //columns END // // // // public java.lang.String getTitle() { // return this.title; // } // // public void setTitle(java.lang.String value) { // this.title = value; // } // // public Integer getDbPos() { // return dbPos; // } // // public void setDbPos(Integer dbPos) { // this.dbPos = dbPos; // } // // // // // // } // // Path: src/main/java/persistent/prestige/modules/edu/service/EduDemoService2.java // public interface EduDemoService2 { // // // public Map saveLogin(Integer dbPos, String account, String password); // // /** // * 查组织机构 // * @param title // * @return // */ // public List<Organization> searchOrgs(Integer dbPos, String title); // // // public Organization saveOrg(Integer dbPos, String title); // // // // // } // // Path: src/main/java/persistent/prestige/modules/edu/service/UserSchemeService.java // public interface UserSchemeService { // String findTenant(String account); // // Integer findDbPos(String account); // }
import java.util.HashMap; import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import persistent.prestige.modules.common.tenant.TenantContextHolder; import persistent.prestige.modules.edu.model.Organization; import persistent.prestige.modules.edu.service.EduDemoService2; import persistent.prestige.modules.edu.service.UserSchemeService;
package persistent.prestige.modules.edu.action; /** * 多租户,但逻辑库 * @author Administrator * */ @Controller @RequestMapping("/edu/demo2") public class EduControl2 { @Autowired private EduDemoService2 eduDemoService; @Autowired
// Path: src/main/java/persistent/prestige/modules/common/tenant/TenantContextHolder.java // public class TenantContextHolder { // // private static ThreadLocal<String> tenanThreadLocal = new ThreadLocal<String>(); // // public static final void setTenant(String scheme) { // tenanThreadLocal.set(scheme); // } // // public static final String getTenant() { // String scheme = tenanThreadLocal.get(); // if (scheme == null) { // scheme = ""; // } // return scheme; // } // // public static final void remove() { // tenanThreadLocal.remove(); // } // // } // // Path: src/main/java/persistent/prestige/modules/edu/model/Organization.java // public class Organization extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "Organization"; // // //columns START // /**title*/ // private java.lang.String title; // // private Integer dbPos; // //columns END // // // // public java.lang.String getTitle() { // return this.title; // } // // public void setTitle(java.lang.String value) { // this.title = value; // } // // public Integer getDbPos() { // return dbPos; // } // // public void setDbPos(Integer dbPos) { // this.dbPos = dbPos; // } // // // // // // } // // Path: src/main/java/persistent/prestige/modules/edu/service/EduDemoService2.java // public interface EduDemoService2 { // // // public Map saveLogin(Integer dbPos, String account, String password); // // /** // * 查组织机构 // * @param title // * @return // */ // public List<Organization> searchOrgs(Integer dbPos, String title); // // // public Organization saveOrg(Integer dbPos, String title); // // // // // } // // Path: src/main/java/persistent/prestige/modules/edu/service/UserSchemeService.java // public interface UserSchemeService { // String findTenant(String account); // // Integer findDbPos(String account); // } // Path: src/main/java/persistent/prestige/modules/edu/action/EduControl2.java import java.util.HashMap; import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import persistent.prestige.modules.common.tenant.TenantContextHolder; import persistent.prestige.modules.edu.model.Organization; import persistent.prestige.modules.edu.service.EduDemoService2; import persistent.prestige.modules.edu.service.UserSchemeService; package persistent.prestige.modules.edu.action; /** * 多租户,但逻辑库 * @author Administrator * */ @Controller @RequestMapping("/edu/demo2") public class EduControl2 { @Autowired private EduDemoService2 eduDemoService; @Autowired
private UserSchemeService userSchemeService;
dingwpmz/Mycat-Demo
src/main/java/persistent/prestige/modules/edu/action/EduControl2.java
// Path: src/main/java/persistent/prestige/modules/common/tenant/TenantContextHolder.java // public class TenantContextHolder { // // private static ThreadLocal<String> tenanThreadLocal = new ThreadLocal<String>(); // // public static final void setTenant(String scheme) { // tenanThreadLocal.set(scheme); // } // // public static final String getTenant() { // String scheme = tenanThreadLocal.get(); // if (scheme == null) { // scheme = ""; // } // return scheme; // } // // public static final void remove() { // tenanThreadLocal.remove(); // } // // } // // Path: src/main/java/persistent/prestige/modules/edu/model/Organization.java // public class Organization extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "Organization"; // // //columns START // /**title*/ // private java.lang.String title; // // private Integer dbPos; // //columns END // // // // public java.lang.String getTitle() { // return this.title; // } // // public void setTitle(java.lang.String value) { // this.title = value; // } // // public Integer getDbPos() { // return dbPos; // } // // public void setDbPos(Integer dbPos) { // this.dbPos = dbPos; // } // // // // // // } // // Path: src/main/java/persistent/prestige/modules/edu/service/EduDemoService2.java // public interface EduDemoService2 { // // // public Map saveLogin(Integer dbPos, String account, String password); // // /** // * 查组织机构 // * @param title // * @return // */ // public List<Organization> searchOrgs(Integer dbPos, String title); // // // public Organization saveOrg(Integer dbPos, String title); // // // // // } // // Path: src/main/java/persistent/prestige/modules/edu/service/UserSchemeService.java // public interface UserSchemeService { // String findTenant(String account); // // Integer findDbPos(String account); // }
import java.util.HashMap; import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import persistent.prestige.modules.common.tenant.TenantContextHolder; import persistent.prestige.modules.edu.model.Organization; import persistent.prestige.modules.edu.service.EduDemoService2; import persistent.prestige.modules.edu.service.UserSchemeService;
package persistent.prestige.modules.edu.action; /** * 多租户,但逻辑库 * @author Administrator * */ @Controller @RequestMapping("/edu/demo2") public class EduControl2 { @Autowired private EduDemoService2 eduDemoService; @Autowired private UserSchemeService userSchemeService; // /** // * 登录方法 // * @param account // * @param password // * @return // */ // @RequestMapping("/login") // @ResponseBody // public Map login(String account, String password) { // // Map result = new HashMap(); // try { // //第一步,,先获取 用户tenant // String tenant = userSchemeService.findTenant(account);//此处,可以考虑放入redis缓存中 // //此处不需要担心默认库,因为,默认会走 jdbc.url=jdbc:mysql://localhost:8066/h_xsgjzx?characterEncoding=UTF8&allowMultiQueries\=true // //登录方法,特殊,需要处理 tenant // result = eduDemoService.saveLogin(tenant, account, password); // return result; // // } catch (Exception e) { // // TODO: handle exception // e.printStackTrace(); // result.put("msg", "系统异常"); // result.put("code", 1); // } // // return result; // // } /** * 查询组织机构 * @param account * @param password * @return */ @RequestMapping("/searchOrg") @ResponseBody public Map searchOrgs(Integer dbPos, String title) { Map result = new HashMap(); try {
// Path: src/main/java/persistent/prestige/modules/common/tenant/TenantContextHolder.java // public class TenantContextHolder { // // private static ThreadLocal<String> tenanThreadLocal = new ThreadLocal<String>(); // // public static final void setTenant(String scheme) { // tenanThreadLocal.set(scheme); // } // // public static final String getTenant() { // String scheme = tenanThreadLocal.get(); // if (scheme == null) { // scheme = ""; // } // return scheme; // } // // public static final void remove() { // tenanThreadLocal.remove(); // } // // } // // Path: src/main/java/persistent/prestige/modules/edu/model/Organization.java // public class Organization extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "Organization"; // // //columns START // /**title*/ // private java.lang.String title; // // private Integer dbPos; // //columns END // // // // public java.lang.String getTitle() { // return this.title; // } // // public void setTitle(java.lang.String value) { // this.title = value; // } // // public Integer getDbPos() { // return dbPos; // } // // public void setDbPos(Integer dbPos) { // this.dbPos = dbPos; // } // // // // // // } // // Path: src/main/java/persistent/prestige/modules/edu/service/EduDemoService2.java // public interface EduDemoService2 { // // // public Map saveLogin(Integer dbPos, String account, String password); // // /** // * 查组织机构 // * @param title // * @return // */ // public List<Organization> searchOrgs(Integer dbPos, String title); // // // public Organization saveOrg(Integer dbPos, String title); // // // // // } // // Path: src/main/java/persistent/prestige/modules/edu/service/UserSchemeService.java // public interface UserSchemeService { // String findTenant(String account); // // Integer findDbPos(String account); // } // Path: src/main/java/persistent/prestige/modules/edu/action/EduControl2.java import java.util.HashMap; import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import persistent.prestige.modules.common.tenant.TenantContextHolder; import persistent.prestige.modules.edu.model.Organization; import persistent.prestige.modules.edu.service.EduDemoService2; import persistent.prestige.modules.edu.service.UserSchemeService; package persistent.prestige.modules.edu.action; /** * 多租户,但逻辑库 * @author Administrator * */ @Controller @RequestMapping("/edu/demo2") public class EduControl2 { @Autowired private EduDemoService2 eduDemoService; @Autowired private UserSchemeService userSchemeService; // /** // * 登录方法 // * @param account // * @param password // * @return // */ // @RequestMapping("/login") // @ResponseBody // public Map login(String account, String password) { // // Map result = new HashMap(); // try { // //第一步,,先获取 用户tenant // String tenant = userSchemeService.findTenant(account);//此处,可以考虑放入redis缓存中 // //此处不需要担心默认库,因为,默认会走 jdbc.url=jdbc:mysql://localhost:8066/h_xsgjzx?characterEncoding=UTF8&allowMultiQueries\=true // //登录方法,特殊,需要处理 tenant // result = eduDemoService.saveLogin(tenant, account, password); // return result; // // } catch (Exception e) { // // TODO: handle exception // e.printStackTrace(); // result.put("msg", "系统异常"); // result.put("code", 1); // } // // return result; // // } /** * 查询组织机构 * @param account * @param password * @return */ @RequestMapping("/searchOrg") @ResponseBody public Map searchOrgs(Integer dbPos, String title) { Map result = new HashMap(); try {
List<Organization> orgs = eduDemoService.searchOrgs(dbPos, title);
dingwpmz/Mycat-Demo
src/main/java/persistent/prestige/modules/eshop/dao/SkuItemDao.java
// Path: src/main/java/persistent/prestige/modules/eshop/model/SkuItem.java // public class SkuItem extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "SkuItem"; // // //columns START // /**货品id*/ // private java.lang.Integer skuId; // /**选项名称,作为演示表,选项名称,选项值没有单独定义表*/ // private java.lang.String itemName; // /**选项字面值*/ // private java.lang.String itemValue; // // private Integer goodsId; // //columns END // // // // public java.lang.Integer getSkuId() { // return this.skuId; // } // // public void setSkuId(java.lang.Integer value) { // this.skuId = value; // } // // public java.lang.String getItemName() { // return this.itemName; // } // // public void setItemName(java.lang.String value) { // this.itemName = value; // } // // public java.lang.String getItemValue() { // return this.itemValue; // } // // public void setItemValue(java.lang.String value) { // this.itemValue = value; // } // // public Integer getGoodsId() { // return goodsId; // } // // public void setGoodsId(Integer goodsId) { // this.goodsId = goodsId; // } // // // // } // // Path: src/main/java/persistent/prestige/platform/base/dao/Dao.java // @MybatisScan // public interface Dao<T extends Entity, PK extends Serializable> extends Serializable { // /** // * 根据主键查找 // * @param id // * @return // */ // T find(PK id); // // /** // * // * @param ids // * @return // */ // List<T> findByIds(PK[] ids); // // /** // * 根据查询条件查找 // * @param params // * @return // */ // List<T> query(Map params); // // /** // * 查询总数 // * @return // */ // Long countAll(); // // /** // * 查询总数 // * @return // */ // Long count(Map params); // // /** // * 增加新实体 // * 主键值会自动填充到entity // * @param entity // */ // void create(Object entity); // // /** // * 更新实体 // * @param entity // * @return // */ // int update(Object entity); // // // /** // * 根据ID 删除实体 // * // * @param id // */ // void deleteById(PK id); // // /** // * 此处不想设计成 T entity,主要是考虑在前端需要创建对象实体,设计成Map,灵活性更高 // * @param entity // */ // void delete(Map params); // // /** 树型节点 方法 start */ // T findRoot(); // // List<T> findRoots(Map params); // // /** // * 根据code 获取所有节点(包括子孙节点) // * @param code // * @return // */ // List<T> findAllChilds(String code); // // /** // * 根据父节点获取所有直接子节点 // * @param parentId // * @return // */ // List<T> findChilds(Integer parentId); // /** 树型节点 方法 end */ // // void createExcelBatch(List<Map> datas); // // // }
import org.springframework.stereotype.Repository; import persistent.prestige.modules.eshop.model.SkuItem; import persistent.prestige.platform.api.annotation.MybatisScan; import persistent.prestige.platform.base.dao.Dao;
/* * Powered By agile * Web Site: http://www.agile.com * Since 2008 - 2016 */ package persistent.prestige.modules.eshop.dao; /** * SkuItem DAO类 * @author 雅居乐 2016-8-31 20:47:08 * @version 1.0 */ @Repository("skuItemDao") @MybatisScan
// Path: src/main/java/persistent/prestige/modules/eshop/model/SkuItem.java // public class SkuItem extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "SkuItem"; // // //columns START // /**货品id*/ // private java.lang.Integer skuId; // /**选项名称,作为演示表,选项名称,选项值没有单独定义表*/ // private java.lang.String itemName; // /**选项字面值*/ // private java.lang.String itemValue; // // private Integer goodsId; // //columns END // // // // public java.lang.Integer getSkuId() { // return this.skuId; // } // // public void setSkuId(java.lang.Integer value) { // this.skuId = value; // } // // public java.lang.String getItemName() { // return this.itemName; // } // // public void setItemName(java.lang.String value) { // this.itemName = value; // } // // public java.lang.String getItemValue() { // return this.itemValue; // } // // public void setItemValue(java.lang.String value) { // this.itemValue = value; // } // // public Integer getGoodsId() { // return goodsId; // } // // public void setGoodsId(Integer goodsId) { // this.goodsId = goodsId; // } // // // // } // // Path: src/main/java/persistent/prestige/platform/base/dao/Dao.java // @MybatisScan // public interface Dao<T extends Entity, PK extends Serializable> extends Serializable { // /** // * 根据主键查找 // * @param id // * @return // */ // T find(PK id); // // /** // * // * @param ids // * @return // */ // List<T> findByIds(PK[] ids); // // /** // * 根据查询条件查找 // * @param params // * @return // */ // List<T> query(Map params); // // /** // * 查询总数 // * @return // */ // Long countAll(); // // /** // * 查询总数 // * @return // */ // Long count(Map params); // // /** // * 增加新实体 // * 主键值会自动填充到entity // * @param entity // */ // void create(Object entity); // // /** // * 更新实体 // * @param entity // * @return // */ // int update(Object entity); // // // /** // * 根据ID 删除实体 // * // * @param id // */ // void deleteById(PK id); // // /** // * 此处不想设计成 T entity,主要是考虑在前端需要创建对象实体,设计成Map,灵活性更高 // * @param entity // */ // void delete(Map params); // // /** 树型节点 方法 start */ // T findRoot(); // // List<T> findRoots(Map params); // // /** // * 根据code 获取所有节点(包括子孙节点) // * @param code // * @return // */ // List<T> findAllChilds(String code); // // /** // * 根据父节点获取所有直接子节点 // * @param parentId // * @return // */ // List<T> findChilds(Integer parentId); // /** 树型节点 方法 end */ // // void createExcelBatch(List<Map> datas); // // // } // Path: src/main/java/persistent/prestige/modules/eshop/dao/SkuItemDao.java import org.springframework.stereotype.Repository; import persistent.prestige.modules.eshop.model.SkuItem; import persistent.prestige.platform.api.annotation.MybatisScan; import persistent.prestige.platform.base.dao.Dao; /* * Powered By agile * Web Site: http://www.agile.com * Since 2008 - 2016 */ package persistent.prestige.modules.eshop.dao; /** * SkuItem DAO类 * @author 雅居乐 2016-8-31 20:47:08 * @version 1.0 */ @Repository("skuItemDao") @MybatisScan
public interface SkuItemDao extends Dao<SkuItem,java.lang.Integer>{
dingwpmz/Mycat-Demo
src/main/java/persistent/prestige/modules/eshop/dao/SkuItemDao.java
// Path: src/main/java/persistent/prestige/modules/eshop/model/SkuItem.java // public class SkuItem extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "SkuItem"; // // //columns START // /**货品id*/ // private java.lang.Integer skuId; // /**选项名称,作为演示表,选项名称,选项值没有单独定义表*/ // private java.lang.String itemName; // /**选项字面值*/ // private java.lang.String itemValue; // // private Integer goodsId; // //columns END // // // // public java.lang.Integer getSkuId() { // return this.skuId; // } // // public void setSkuId(java.lang.Integer value) { // this.skuId = value; // } // // public java.lang.String getItemName() { // return this.itemName; // } // // public void setItemName(java.lang.String value) { // this.itemName = value; // } // // public java.lang.String getItemValue() { // return this.itemValue; // } // // public void setItemValue(java.lang.String value) { // this.itemValue = value; // } // // public Integer getGoodsId() { // return goodsId; // } // // public void setGoodsId(Integer goodsId) { // this.goodsId = goodsId; // } // // // // } // // Path: src/main/java/persistent/prestige/platform/base/dao/Dao.java // @MybatisScan // public interface Dao<T extends Entity, PK extends Serializable> extends Serializable { // /** // * 根据主键查找 // * @param id // * @return // */ // T find(PK id); // // /** // * // * @param ids // * @return // */ // List<T> findByIds(PK[] ids); // // /** // * 根据查询条件查找 // * @param params // * @return // */ // List<T> query(Map params); // // /** // * 查询总数 // * @return // */ // Long countAll(); // // /** // * 查询总数 // * @return // */ // Long count(Map params); // // /** // * 增加新实体 // * 主键值会自动填充到entity // * @param entity // */ // void create(Object entity); // // /** // * 更新实体 // * @param entity // * @return // */ // int update(Object entity); // // // /** // * 根据ID 删除实体 // * // * @param id // */ // void deleteById(PK id); // // /** // * 此处不想设计成 T entity,主要是考虑在前端需要创建对象实体,设计成Map,灵活性更高 // * @param entity // */ // void delete(Map params); // // /** 树型节点 方法 start */ // T findRoot(); // // List<T> findRoots(Map params); // // /** // * 根据code 获取所有节点(包括子孙节点) // * @param code // * @return // */ // List<T> findAllChilds(String code); // // /** // * 根据父节点获取所有直接子节点 // * @param parentId // * @return // */ // List<T> findChilds(Integer parentId); // /** 树型节点 方法 end */ // // void createExcelBatch(List<Map> datas); // // // }
import org.springframework.stereotype.Repository; import persistent.prestige.modules.eshop.model.SkuItem; import persistent.prestige.platform.api.annotation.MybatisScan; import persistent.prestige.platform.base.dao.Dao;
/* * Powered By agile * Web Site: http://www.agile.com * Since 2008 - 2016 */ package persistent.prestige.modules.eshop.dao; /** * SkuItem DAO类 * @author 雅居乐 2016-8-31 20:47:08 * @version 1.0 */ @Repository("skuItemDao") @MybatisScan
// Path: src/main/java/persistent/prestige/modules/eshop/model/SkuItem.java // public class SkuItem extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "SkuItem"; // // //columns START // /**货品id*/ // private java.lang.Integer skuId; // /**选项名称,作为演示表,选项名称,选项值没有单独定义表*/ // private java.lang.String itemName; // /**选项字面值*/ // private java.lang.String itemValue; // // private Integer goodsId; // //columns END // // // // public java.lang.Integer getSkuId() { // return this.skuId; // } // // public void setSkuId(java.lang.Integer value) { // this.skuId = value; // } // // public java.lang.String getItemName() { // return this.itemName; // } // // public void setItemName(java.lang.String value) { // this.itemName = value; // } // // public java.lang.String getItemValue() { // return this.itemValue; // } // // public void setItemValue(java.lang.String value) { // this.itemValue = value; // } // // public Integer getGoodsId() { // return goodsId; // } // // public void setGoodsId(Integer goodsId) { // this.goodsId = goodsId; // } // // // // } // // Path: src/main/java/persistent/prestige/platform/base/dao/Dao.java // @MybatisScan // public interface Dao<T extends Entity, PK extends Serializable> extends Serializable { // /** // * 根据主键查找 // * @param id // * @return // */ // T find(PK id); // // /** // * // * @param ids // * @return // */ // List<T> findByIds(PK[] ids); // // /** // * 根据查询条件查找 // * @param params // * @return // */ // List<T> query(Map params); // // /** // * 查询总数 // * @return // */ // Long countAll(); // // /** // * 查询总数 // * @return // */ // Long count(Map params); // // /** // * 增加新实体 // * 主键值会自动填充到entity // * @param entity // */ // void create(Object entity); // // /** // * 更新实体 // * @param entity // * @return // */ // int update(Object entity); // // // /** // * 根据ID 删除实体 // * // * @param id // */ // void deleteById(PK id); // // /** // * 此处不想设计成 T entity,主要是考虑在前端需要创建对象实体,设计成Map,灵活性更高 // * @param entity // */ // void delete(Map params); // // /** 树型节点 方法 start */ // T findRoot(); // // List<T> findRoots(Map params); // // /** // * 根据code 获取所有节点(包括子孙节点) // * @param code // * @return // */ // List<T> findAllChilds(String code); // // /** // * 根据父节点获取所有直接子节点 // * @param parentId // * @return // */ // List<T> findChilds(Integer parentId); // /** 树型节点 方法 end */ // // void createExcelBatch(List<Map> datas); // // // } // Path: src/main/java/persistent/prestige/modules/eshop/dao/SkuItemDao.java import org.springframework.stereotype.Repository; import persistent.prestige.modules.eshop.model.SkuItem; import persistent.prestige.platform.api.annotation.MybatisScan; import persistent.prestige.platform.base.dao.Dao; /* * Powered By agile * Web Site: http://www.agile.com * Since 2008 - 2016 */ package persistent.prestige.modules.eshop.dao; /** * SkuItem DAO类 * @author 雅居乐 2016-8-31 20:47:08 * @version 1.0 */ @Repository("skuItemDao") @MybatisScan
public interface SkuItemDao extends Dao<SkuItem,java.lang.Integer>{
dingwpmz/Mycat-Demo
src/main/java/persistent/prestige/modules/eshop/service/impl/OrderItemServiceImpl.java
// Path: src/main/java/persistent/prestige/modules/eshop/dao/OrderItemDao.java // @Repository("orderItemDao") // @MybatisScan // public interface OrderItemDao extends Dao<OrderItem,java.lang.Integer>{ // // // } // // Path: src/main/java/persistent/prestige/modules/eshop/service/OrderItemService.java // public interface OrderItemService { // /** // * 保存信息 // * @param datas // * @return // */ // Integer saveOrderItem(Map datas); // }
import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import persistent.prestige.modules.eshop.dao.OrderItemDao; import persistent.prestige.modules.eshop.service.OrderItemService;
/* * Powered By agile * Web Site: http://www.agile.com * Since 2008 - 2016 */ package persistent.prestige.modules.eshop.service.impl; /** * OrderItem service实现类 * @author 雅居乐 2016-8-27 10:31:06 * @version 1.0 */ @Service("orderItemService") /** * beanId 为@Service配置中的名称 * modelClass 对应实体类的名称 * type AwareType.SERVICE */ public class OrderItemServiceImpl implements OrderItemService{ @Autowired
// Path: src/main/java/persistent/prestige/modules/eshop/dao/OrderItemDao.java // @Repository("orderItemDao") // @MybatisScan // public interface OrderItemDao extends Dao<OrderItem,java.lang.Integer>{ // // // } // // Path: src/main/java/persistent/prestige/modules/eshop/service/OrderItemService.java // public interface OrderItemService { // /** // * 保存信息 // * @param datas // * @return // */ // Integer saveOrderItem(Map datas); // } // Path: src/main/java/persistent/prestige/modules/eshop/service/impl/OrderItemServiceImpl.java import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import persistent.prestige.modules.eshop.dao.OrderItemDao; import persistent.prestige.modules.eshop.service.OrderItemService; /* * Powered By agile * Web Site: http://www.agile.com * Since 2008 - 2016 */ package persistent.prestige.modules.eshop.service.impl; /** * OrderItem service实现类 * @author 雅居乐 2016-8-27 10:31:06 * @version 1.0 */ @Service("orderItemService") /** * beanId 为@Service配置中的名称 * modelClass 对应实体类的名称 * type AwareType.SERVICE */ public class OrderItemServiceImpl implements OrderItemService{ @Autowired
private OrderItemDao orderItemDao;
dingwpmz/Mycat-Demo
src/main/java/persistent/prestige/modules/edu/action/EduControl.java
// Path: src/main/java/persistent/prestige/modules/common/tenant/TenantContextHolder.java // public class TenantContextHolder { // // private static ThreadLocal<String> tenanThreadLocal = new ThreadLocal<String>(); // // public static final void setTenant(String scheme) { // tenanThreadLocal.set(scheme); // } // // public static final String getTenant() { // String scheme = tenanThreadLocal.get(); // if (scheme == null) { // scheme = ""; // } // return scheme; // } // // public static final void remove() { // tenanThreadLocal.remove(); // } // // } // // Path: src/main/java/persistent/prestige/modules/edu/model/Organization.java // public class Organization extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "Organization"; // // //columns START // /**title*/ // private java.lang.String title; // // private Integer dbPos; // //columns END // // // // public java.lang.String getTitle() { // return this.title; // } // // public void setTitle(java.lang.String value) { // this.title = value; // } // // public Integer getDbPos() { // return dbPos; // } // // public void setDbPos(Integer dbPos) { // this.dbPos = dbPos; // } // // // // // // } // // Path: src/main/java/persistent/prestige/modules/edu/service/EduDemoService.java // public interface EduDemoService { // // // public Map saveLogin(String account, String password); // // /** // * 查组织机构 // * @param title // * @return // */ // public List<Organization> searchOrgs(String title); // // // // // } // // Path: src/main/java/persistent/prestige/modules/edu/service/UserSchemeService.java // public interface UserSchemeService { // String findTenant(String account); // // Integer findDbPos(String account); // }
import java.util.HashMap; import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import persistent.prestige.modules.common.tenant.TenantContextHolder; import persistent.prestige.modules.edu.model.Organization; import persistent.prestige.modules.edu.service.EduDemoService; import persistent.prestige.modules.edu.service.UserSchemeService;
package persistent.prestige.modules.edu.action; /** * 多租户多逻辑库 案例 * @author Administrator * */ @Controller @RequestMapping("/edu/demo") public class EduControl { @Autowired
// Path: src/main/java/persistent/prestige/modules/common/tenant/TenantContextHolder.java // public class TenantContextHolder { // // private static ThreadLocal<String> tenanThreadLocal = new ThreadLocal<String>(); // // public static final void setTenant(String scheme) { // tenanThreadLocal.set(scheme); // } // // public static final String getTenant() { // String scheme = tenanThreadLocal.get(); // if (scheme == null) { // scheme = ""; // } // return scheme; // } // // public static final void remove() { // tenanThreadLocal.remove(); // } // // } // // Path: src/main/java/persistent/prestige/modules/edu/model/Organization.java // public class Organization extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "Organization"; // // //columns START // /**title*/ // private java.lang.String title; // // private Integer dbPos; // //columns END // // // // public java.lang.String getTitle() { // return this.title; // } // // public void setTitle(java.lang.String value) { // this.title = value; // } // // public Integer getDbPos() { // return dbPos; // } // // public void setDbPos(Integer dbPos) { // this.dbPos = dbPos; // } // // // // // // } // // Path: src/main/java/persistent/prestige/modules/edu/service/EduDemoService.java // public interface EduDemoService { // // // public Map saveLogin(String account, String password); // // /** // * 查组织机构 // * @param title // * @return // */ // public List<Organization> searchOrgs(String title); // // // // // } // // Path: src/main/java/persistent/prestige/modules/edu/service/UserSchemeService.java // public interface UserSchemeService { // String findTenant(String account); // // Integer findDbPos(String account); // } // Path: src/main/java/persistent/prestige/modules/edu/action/EduControl.java import java.util.HashMap; import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import persistent.prestige.modules.common.tenant.TenantContextHolder; import persistent.prestige.modules.edu.model.Organization; import persistent.prestige.modules.edu.service.EduDemoService; import persistent.prestige.modules.edu.service.UserSchemeService; package persistent.prestige.modules.edu.action; /** * 多租户多逻辑库 案例 * @author Administrator * */ @Controller @RequestMapping("/edu/demo") public class EduControl { @Autowired
private EduDemoService eduDemoService;
dingwpmz/Mycat-Demo
src/main/java/persistent/prestige/modules/edu/action/EduControl.java
// Path: src/main/java/persistent/prestige/modules/common/tenant/TenantContextHolder.java // public class TenantContextHolder { // // private static ThreadLocal<String> tenanThreadLocal = new ThreadLocal<String>(); // // public static final void setTenant(String scheme) { // tenanThreadLocal.set(scheme); // } // // public static final String getTenant() { // String scheme = tenanThreadLocal.get(); // if (scheme == null) { // scheme = ""; // } // return scheme; // } // // public static final void remove() { // tenanThreadLocal.remove(); // } // // } // // Path: src/main/java/persistent/prestige/modules/edu/model/Organization.java // public class Organization extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "Organization"; // // //columns START // /**title*/ // private java.lang.String title; // // private Integer dbPos; // //columns END // // // // public java.lang.String getTitle() { // return this.title; // } // // public void setTitle(java.lang.String value) { // this.title = value; // } // // public Integer getDbPos() { // return dbPos; // } // // public void setDbPos(Integer dbPos) { // this.dbPos = dbPos; // } // // // // // // } // // Path: src/main/java/persistent/prestige/modules/edu/service/EduDemoService.java // public interface EduDemoService { // // // public Map saveLogin(String account, String password); // // /** // * 查组织机构 // * @param title // * @return // */ // public List<Organization> searchOrgs(String title); // // // // // } // // Path: src/main/java/persistent/prestige/modules/edu/service/UserSchemeService.java // public interface UserSchemeService { // String findTenant(String account); // // Integer findDbPos(String account); // }
import java.util.HashMap; import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import persistent.prestige.modules.common.tenant.TenantContextHolder; import persistent.prestige.modules.edu.model.Organization; import persistent.prestige.modules.edu.service.EduDemoService; import persistent.prestige.modules.edu.service.UserSchemeService;
package persistent.prestige.modules.edu.action; /** * 多租户多逻辑库 案例 * @author Administrator * */ @Controller @RequestMapping("/edu/demo") public class EduControl { @Autowired private EduDemoService eduDemoService; @Autowired
// Path: src/main/java/persistent/prestige/modules/common/tenant/TenantContextHolder.java // public class TenantContextHolder { // // private static ThreadLocal<String> tenanThreadLocal = new ThreadLocal<String>(); // // public static final void setTenant(String scheme) { // tenanThreadLocal.set(scheme); // } // // public static final String getTenant() { // String scheme = tenanThreadLocal.get(); // if (scheme == null) { // scheme = ""; // } // return scheme; // } // // public static final void remove() { // tenanThreadLocal.remove(); // } // // } // // Path: src/main/java/persistent/prestige/modules/edu/model/Organization.java // public class Organization extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "Organization"; // // //columns START // /**title*/ // private java.lang.String title; // // private Integer dbPos; // //columns END // // // // public java.lang.String getTitle() { // return this.title; // } // // public void setTitle(java.lang.String value) { // this.title = value; // } // // public Integer getDbPos() { // return dbPos; // } // // public void setDbPos(Integer dbPos) { // this.dbPos = dbPos; // } // // // // // // } // // Path: src/main/java/persistent/prestige/modules/edu/service/EduDemoService.java // public interface EduDemoService { // // // public Map saveLogin(String account, String password); // // /** // * 查组织机构 // * @param title // * @return // */ // public List<Organization> searchOrgs(String title); // // // // // } // // Path: src/main/java/persistent/prestige/modules/edu/service/UserSchemeService.java // public interface UserSchemeService { // String findTenant(String account); // // Integer findDbPos(String account); // } // Path: src/main/java/persistent/prestige/modules/edu/action/EduControl.java import java.util.HashMap; import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import persistent.prestige.modules.common.tenant.TenantContextHolder; import persistent.prestige.modules.edu.model.Organization; import persistent.prestige.modules.edu.service.EduDemoService; import persistent.prestige.modules.edu.service.UserSchemeService; package persistent.prestige.modules.edu.action; /** * 多租户多逻辑库 案例 * @author Administrator * */ @Controller @RequestMapping("/edu/demo") public class EduControl { @Autowired private EduDemoService eduDemoService; @Autowired
private UserSchemeService userSchemeService;
dingwpmz/Mycat-Demo
src/main/java/persistent/prestige/modules/edu/action/EduControl.java
// Path: src/main/java/persistent/prestige/modules/common/tenant/TenantContextHolder.java // public class TenantContextHolder { // // private static ThreadLocal<String> tenanThreadLocal = new ThreadLocal<String>(); // // public static final void setTenant(String scheme) { // tenanThreadLocal.set(scheme); // } // // public static final String getTenant() { // String scheme = tenanThreadLocal.get(); // if (scheme == null) { // scheme = ""; // } // return scheme; // } // // public static final void remove() { // tenanThreadLocal.remove(); // } // // } // // Path: src/main/java/persistent/prestige/modules/edu/model/Organization.java // public class Organization extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "Organization"; // // //columns START // /**title*/ // private java.lang.String title; // // private Integer dbPos; // //columns END // // // // public java.lang.String getTitle() { // return this.title; // } // // public void setTitle(java.lang.String value) { // this.title = value; // } // // public Integer getDbPos() { // return dbPos; // } // // public void setDbPos(Integer dbPos) { // this.dbPos = dbPos; // } // // // // // // } // // Path: src/main/java/persistent/prestige/modules/edu/service/EduDemoService.java // public interface EduDemoService { // // // public Map saveLogin(String account, String password); // // /** // * 查组织机构 // * @param title // * @return // */ // public List<Organization> searchOrgs(String title); // // // // // } // // Path: src/main/java/persistent/prestige/modules/edu/service/UserSchemeService.java // public interface UserSchemeService { // String findTenant(String account); // // Integer findDbPos(String account); // }
import java.util.HashMap; import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import persistent.prestige.modules.common.tenant.TenantContextHolder; import persistent.prestige.modules.edu.model.Organization; import persistent.prestige.modules.edu.service.EduDemoService; import persistent.prestige.modules.edu.service.UserSchemeService;
package persistent.prestige.modules.edu.action; /** * 多租户多逻辑库 案例 * @author Administrator * */ @Controller @RequestMapping("/edu/demo") public class EduControl { @Autowired private EduDemoService eduDemoService; @Autowired private UserSchemeService userSchemeService; /** * 登录方法 * @param account * @param password * @return */ @RequestMapping("/login") @ResponseBody public Map login(String account, String password) { Map result = new HashMap(); try { //第一步,,先获取 用户tenant String tenant = userSchemeService.findTenant(account);//此处,可以考虑放入redis缓存中 //此处不需要担心默认库,因为,默认会走 jdbc.url=jdbc:mysql://localhost:8066/h_xsgjzx?characterEncoding=UTF8&allowMultiQueries\=true //登录方法,特殊,需要处理 tenant try {
// Path: src/main/java/persistent/prestige/modules/common/tenant/TenantContextHolder.java // public class TenantContextHolder { // // private static ThreadLocal<String> tenanThreadLocal = new ThreadLocal<String>(); // // public static final void setTenant(String scheme) { // tenanThreadLocal.set(scheme); // } // // public static final String getTenant() { // String scheme = tenanThreadLocal.get(); // if (scheme == null) { // scheme = ""; // } // return scheme; // } // // public static final void remove() { // tenanThreadLocal.remove(); // } // // } // // Path: src/main/java/persistent/prestige/modules/edu/model/Organization.java // public class Organization extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "Organization"; // // //columns START // /**title*/ // private java.lang.String title; // // private Integer dbPos; // //columns END // // // // public java.lang.String getTitle() { // return this.title; // } // // public void setTitle(java.lang.String value) { // this.title = value; // } // // public Integer getDbPos() { // return dbPos; // } // // public void setDbPos(Integer dbPos) { // this.dbPos = dbPos; // } // // // // // // } // // Path: src/main/java/persistent/prestige/modules/edu/service/EduDemoService.java // public interface EduDemoService { // // // public Map saveLogin(String account, String password); // // /** // * 查组织机构 // * @param title // * @return // */ // public List<Organization> searchOrgs(String title); // // // // // } // // Path: src/main/java/persistent/prestige/modules/edu/service/UserSchemeService.java // public interface UserSchemeService { // String findTenant(String account); // // Integer findDbPos(String account); // } // Path: src/main/java/persistent/prestige/modules/edu/action/EduControl.java import java.util.HashMap; import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import persistent.prestige.modules.common.tenant.TenantContextHolder; import persistent.prestige.modules.edu.model.Organization; import persistent.prestige.modules.edu.service.EduDemoService; import persistent.prestige.modules.edu.service.UserSchemeService; package persistent.prestige.modules.edu.action; /** * 多租户多逻辑库 案例 * @author Administrator * */ @Controller @RequestMapping("/edu/demo") public class EduControl { @Autowired private EduDemoService eduDemoService; @Autowired private UserSchemeService userSchemeService; /** * 登录方法 * @param account * @param password * @return */ @RequestMapping("/login") @ResponseBody public Map login(String account, String password) { Map result = new HashMap(); try { //第一步,,先获取 用户tenant String tenant = userSchemeService.findTenant(account);//此处,可以考虑放入redis缓存中 //此处不需要担心默认库,因为,默认会走 jdbc.url=jdbc:mysql://localhost:8066/h_xsgjzx?characterEncoding=UTF8&allowMultiQueries\=true //登录方法,特殊,需要处理 tenant try {
TenantContextHolder.setTenant(tenant);
dingwpmz/Mycat-Demo
src/main/java/persistent/prestige/modules/edu/action/EduControl.java
// Path: src/main/java/persistent/prestige/modules/common/tenant/TenantContextHolder.java // public class TenantContextHolder { // // private static ThreadLocal<String> tenanThreadLocal = new ThreadLocal<String>(); // // public static final void setTenant(String scheme) { // tenanThreadLocal.set(scheme); // } // // public static final String getTenant() { // String scheme = tenanThreadLocal.get(); // if (scheme == null) { // scheme = ""; // } // return scheme; // } // // public static final void remove() { // tenanThreadLocal.remove(); // } // // } // // Path: src/main/java/persistent/prestige/modules/edu/model/Organization.java // public class Organization extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "Organization"; // // //columns START // /**title*/ // private java.lang.String title; // // private Integer dbPos; // //columns END // // // // public java.lang.String getTitle() { // return this.title; // } // // public void setTitle(java.lang.String value) { // this.title = value; // } // // public Integer getDbPos() { // return dbPos; // } // // public void setDbPos(Integer dbPos) { // this.dbPos = dbPos; // } // // // // // // } // // Path: src/main/java/persistent/prestige/modules/edu/service/EduDemoService.java // public interface EduDemoService { // // // public Map saveLogin(String account, String password); // // /** // * 查组织机构 // * @param title // * @return // */ // public List<Organization> searchOrgs(String title); // // // // // } // // Path: src/main/java/persistent/prestige/modules/edu/service/UserSchemeService.java // public interface UserSchemeService { // String findTenant(String account); // // Integer findDbPos(String account); // }
import java.util.HashMap; import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import persistent.prestige.modules.common.tenant.TenantContextHolder; import persistent.prestige.modules.edu.model.Organization; import persistent.prestige.modules.edu.service.EduDemoService; import persistent.prestige.modules.edu.service.UserSchemeService;
} } finally { TenantContextHolder.remove(); } } catch (Exception e) { // TODO: handle exception e.printStackTrace(); result.put("msg", "系统异常"); result.put("code", 1); } return result; } /** * 查询组织机构 * @param account * @param password * @return */ @RequestMapping("/searchOrg") @ResponseBody public Map searchOrgs(String tenant, String title) { Map result = new HashMap(); try {
// Path: src/main/java/persistent/prestige/modules/common/tenant/TenantContextHolder.java // public class TenantContextHolder { // // private static ThreadLocal<String> tenanThreadLocal = new ThreadLocal<String>(); // // public static final void setTenant(String scheme) { // tenanThreadLocal.set(scheme); // } // // public static final String getTenant() { // String scheme = tenanThreadLocal.get(); // if (scheme == null) { // scheme = ""; // } // return scheme; // } // // public static final void remove() { // tenanThreadLocal.remove(); // } // // } // // Path: src/main/java/persistent/prestige/modules/edu/model/Organization.java // public class Organization extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "Organization"; // // //columns START // /**title*/ // private java.lang.String title; // // private Integer dbPos; // //columns END // // // // public java.lang.String getTitle() { // return this.title; // } // // public void setTitle(java.lang.String value) { // this.title = value; // } // // public Integer getDbPos() { // return dbPos; // } // // public void setDbPos(Integer dbPos) { // this.dbPos = dbPos; // } // // // // // // } // // Path: src/main/java/persistent/prestige/modules/edu/service/EduDemoService.java // public interface EduDemoService { // // // public Map saveLogin(String account, String password); // // /** // * 查组织机构 // * @param title // * @return // */ // public List<Organization> searchOrgs(String title); // // // // // } // // Path: src/main/java/persistent/prestige/modules/edu/service/UserSchemeService.java // public interface UserSchemeService { // String findTenant(String account); // // Integer findDbPos(String account); // } // Path: src/main/java/persistent/prestige/modules/edu/action/EduControl.java import java.util.HashMap; import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import persistent.prestige.modules.common.tenant.TenantContextHolder; import persistent.prestige.modules.edu.model.Organization; import persistent.prestige.modules.edu.service.EduDemoService; import persistent.prestige.modules.edu.service.UserSchemeService; } } finally { TenantContextHolder.remove(); } } catch (Exception e) { // TODO: handle exception e.printStackTrace(); result.put("msg", "系统异常"); result.put("code", 1); } return result; } /** * 查询组织机构 * @param account * @param password * @return */ @RequestMapping("/searchOrg") @ResponseBody public Map searchOrgs(String tenant, String title) { Map result = new HashMap(); try {
List<Organization> orgs = eduDemoService.searchOrgs(title);
dingwpmz/Mycat-Demo
src/main/java/persistent/prestige/modules/eshop/service/impl/SellerServiceImpl.java
// Path: src/main/java/persistent/prestige/modules/eshop/dao/SellerDao.java // @Repository("sellerDao") // @MybatisScan // public interface SellerDao extends Dao<Seller,java.lang.Integer>{ // // // } // // Path: src/main/java/persistent/prestige/modules/eshop/service/SellerService.java // public interface SellerService { // /** // * 保存信息 // * @param datas // * @return // */ // Integer saveSeller(Map datas); // }
import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import persistent.prestige.modules.eshop.dao.SellerDao; import persistent.prestige.modules.eshop.service.SellerService;
/* * Powered By agile * Web Site: http://www.agile.com * Since 2008 - 2016 */ package persistent.prestige.modules.eshop.service.impl; /** * Seller service实现类 * @author 雅居乐 2016-8-27 10:22:35 * @version 1.0 */ @Service("sellerService") /** * beanId 为@Service配置中的名称 * modelClass 对应实体类的名称 * type AwareType.SERVICE */ public class SellerServiceImpl implements SellerService{ @Autowired
// Path: src/main/java/persistent/prestige/modules/eshop/dao/SellerDao.java // @Repository("sellerDao") // @MybatisScan // public interface SellerDao extends Dao<Seller,java.lang.Integer>{ // // // } // // Path: src/main/java/persistent/prestige/modules/eshop/service/SellerService.java // public interface SellerService { // /** // * 保存信息 // * @param datas // * @return // */ // Integer saveSeller(Map datas); // } // Path: src/main/java/persistent/prestige/modules/eshop/service/impl/SellerServiceImpl.java import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import persistent.prestige.modules.eshop.dao.SellerDao; import persistent.prestige.modules.eshop.service.SellerService; /* * Powered By agile * Web Site: http://www.agile.com * Since 2008 - 2016 */ package persistent.prestige.modules.eshop.service.impl; /** * Seller service实现类 * @author 雅居乐 2016-8-27 10:22:35 * @version 1.0 */ @Service("sellerService") /** * beanId 为@Service配置中的名称 * modelClass 对应实体类的名称 * type AwareType.SERVICE */ public class SellerServiceImpl implements SellerService{ @Autowired
private SellerDao sellerDao;
dingwpmz/Mycat-Demo
src/main/java/persistent/prestige/modules/edu/dao/TeacherPossitionDao.java
// Path: src/main/java/persistent/prestige/modules/edu/model/TeacherPossition.java // public class TeacherPossition extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "TeacherPossition"; // // //columns START // /**title*/ // private java.lang.String title; // /**delFlag*/ // private java.lang.Integer delFlag; // /**remark*/ // private java.lang.String remark; // //columns END // // // // public java.lang.String getTitle() { // return this.title; // } // // public void setTitle(java.lang.String value) { // this.title = value; // } // // public java.lang.Integer getDelFlag() { // return this.delFlag; // } // // public void setDelFlag(java.lang.Integer value) { // this.delFlag = value; // } // // public java.lang.String getRemark() { // return this.remark; // } // // public void setRemark(java.lang.String value) { // this.remark = value; // } // // private Set teacherPossitionUsers = new HashSet(0); // @Transient // public Set<TeacherPossitionUser> getTeacherPossitionUsers() { // return teacherPossitionUsers; // } // public void setTeacherPossitionUsers(Set<TeacherPossitionUser> teacherPossitionUser){ // this.teacherPossitionUsers = teacherPossitionUser; // } // // } // // Path: src/main/java/persistent/prestige/platform/base/dao/Dao.java // @MybatisScan // public interface Dao<T extends Entity, PK extends Serializable> extends Serializable { // /** // * 根据主键查找 // * @param id // * @return // */ // T find(PK id); // // /** // * // * @param ids // * @return // */ // List<T> findByIds(PK[] ids); // // /** // * 根据查询条件查找 // * @param params // * @return // */ // List<T> query(Map params); // // /** // * 查询总数 // * @return // */ // Long countAll(); // // /** // * 查询总数 // * @return // */ // Long count(Map params); // // /** // * 增加新实体 // * 主键值会自动填充到entity // * @param entity // */ // void create(Object entity); // // /** // * 更新实体 // * @param entity // * @return // */ // int update(Object entity); // // // /** // * 根据ID 删除实体 // * // * @param id // */ // void deleteById(PK id); // // /** // * 此处不想设计成 T entity,主要是考虑在前端需要创建对象实体,设计成Map,灵活性更高 // * @param entity // */ // void delete(Map params); // // /** 树型节点 方法 start */ // T findRoot(); // // List<T> findRoots(Map params); // // /** // * 根据code 获取所有节点(包括子孙节点) // * @param code // * @return // */ // List<T> findAllChilds(String code); // // /** // * 根据父节点获取所有直接子节点 // * @param parentId // * @return // */ // List<T> findChilds(Integer parentId); // /** 树型节点 方法 end */ // // void createExcelBatch(List<Map> datas); // // // }
import org.springframework.stereotype.Repository; import persistent.prestige.modules.edu.model.TeacherPossition; import persistent.prestige.platform.api.annotation.MybatisScan; import persistent.prestige.platform.base.dao.Dao;
/* * Powered By agile * Web Site: http://www.agile.com * Since 2008 - 2016 */ package persistent.prestige.modules.edu.dao; /** * TeacherPossition DAO类 * @author 雅居乐 2016-9-10 22:41:36 * @version 1.0 */ @Repository("teacherPossitionDao") @MybatisScan
// Path: src/main/java/persistent/prestige/modules/edu/model/TeacherPossition.java // public class TeacherPossition extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "TeacherPossition"; // // //columns START // /**title*/ // private java.lang.String title; // /**delFlag*/ // private java.lang.Integer delFlag; // /**remark*/ // private java.lang.String remark; // //columns END // // // // public java.lang.String getTitle() { // return this.title; // } // // public void setTitle(java.lang.String value) { // this.title = value; // } // // public java.lang.Integer getDelFlag() { // return this.delFlag; // } // // public void setDelFlag(java.lang.Integer value) { // this.delFlag = value; // } // // public java.lang.String getRemark() { // return this.remark; // } // // public void setRemark(java.lang.String value) { // this.remark = value; // } // // private Set teacherPossitionUsers = new HashSet(0); // @Transient // public Set<TeacherPossitionUser> getTeacherPossitionUsers() { // return teacherPossitionUsers; // } // public void setTeacherPossitionUsers(Set<TeacherPossitionUser> teacherPossitionUser){ // this.teacherPossitionUsers = teacherPossitionUser; // } // // } // // Path: src/main/java/persistent/prestige/platform/base/dao/Dao.java // @MybatisScan // public interface Dao<T extends Entity, PK extends Serializable> extends Serializable { // /** // * 根据主键查找 // * @param id // * @return // */ // T find(PK id); // // /** // * // * @param ids // * @return // */ // List<T> findByIds(PK[] ids); // // /** // * 根据查询条件查找 // * @param params // * @return // */ // List<T> query(Map params); // // /** // * 查询总数 // * @return // */ // Long countAll(); // // /** // * 查询总数 // * @return // */ // Long count(Map params); // // /** // * 增加新实体 // * 主键值会自动填充到entity // * @param entity // */ // void create(Object entity); // // /** // * 更新实体 // * @param entity // * @return // */ // int update(Object entity); // // // /** // * 根据ID 删除实体 // * // * @param id // */ // void deleteById(PK id); // // /** // * 此处不想设计成 T entity,主要是考虑在前端需要创建对象实体,设计成Map,灵活性更高 // * @param entity // */ // void delete(Map params); // // /** 树型节点 方法 start */ // T findRoot(); // // List<T> findRoots(Map params); // // /** // * 根据code 获取所有节点(包括子孙节点) // * @param code // * @return // */ // List<T> findAllChilds(String code); // // /** // * 根据父节点获取所有直接子节点 // * @param parentId // * @return // */ // List<T> findChilds(Integer parentId); // /** 树型节点 方法 end */ // // void createExcelBatch(List<Map> datas); // // // } // Path: src/main/java/persistent/prestige/modules/edu/dao/TeacherPossitionDao.java import org.springframework.stereotype.Repository; import persistent.prestige.modules.edu.model.TeacherPossition; import persistent.prestige.platform.api.annotation.MybatisScan; import persistent.prestige.platform.base.dao.Dao; /* * Powered By agile * Web Site: http://www.agile.com * Since 2008 - 2016 */ package persistent.prestige.modules.edu.dao; /** * TeacherPossition DAO类 * @author 雅居乐 2016-9-10 22:41:36 * @version 1.0 */ @Repository("teacherPossitionDao") @MybatisScan
public interface TeacherPossitionDao extends Dao<TeacherPossition,java.lang.Integer>{
dingwpmz/Mycat-Demo
src/main/java/persistent/prestige/modules/edu/dao/TeacherPossitionDao.java
// Path: src/main/java/persistent/prestige/modules/edu/model/TeacherPossition.java // public class TeacherPossition extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "TeacherPossition"; // // //columns START // /**title*/ // private java.lang.String title; // /**delFlag*/ // private java.lang.Integer delFlag; // /**remark*/ // private java.lang.String remark; // //columns END // // // // public java.lang.String getTitle() { // return this.title; // } // // public void setTitle(java.lang.String value) { // this.title = value; // } // // public java.lang.Integer getDelFlag() { // return this.delFlag; // } // // public void setDelFlag(java.lang.Integer value) { // this.delFlag = value; // } // // public java.lang.String getRemark() { // return this.remark; // } // // public void setRemark(java.lang.String value) { // this.remark = value; // } // // private Set teacherPossitionUsers = new HashSet(0); // @Transient // public Set<TeacherPossitionUser> getTeacherPossitionUsers() { // return teacherPossitionUsers; // } // public void setTeacherPossitionUsers(Set<TeacherPossitionUser> teacherPossitionUser){ // this.teacherPossitionUsers = teacherPossitionUser; // } // // } // // Path: src/main/java/persistent/prestige/platform/base/dao/Dao.java // @MybatisScan // public interface Dao<T extends Entity, PK extends Serializable> extends Serializable { // /** // * 根据主键查找 // * @param id // * @return // */ // T find(PK id); // // /** // * // * @param ids // * @return // */ // List<T> findByIds(PK[] ids); // // /** // * 根据查询条件查找 // * @param params // * @return // */ // List<T> query(Map params); // // /** // * 查询总数 // * @return // */ // Long countAll(); // // /** // * 查询总数 // * @return // */ // Long count(Map params); // // /** // * 增加新实体 // * 主键值会自动填充到entity // * @param entity // */ // void create(Object entity); // // /** // * 更新实体 // * @param entity // * @return // */ // int update(Object entity); // // // /** // * 根据ID 删除实体 // * // * @param id // */ // void deleteById(PK id); // // /** // * 此处不想设计成 T entity,主要是考虑在前端需要创建对象实体,设计成Map,灵活性更高 // * @param entity // */ // void delete(Map params); // // /** 树型节点 方法 start */ // T findRoot(); // // List<T> findRoots(Map params); // // /** // * 根据code 获取所有节点(包括子孙节点) // * @param code // * @return // */ // List<T> findAllChilds(String code); // // /** // * 根据父节点获取所有直接子节点 // * @param parentId // * @return // */ // List<T> findChilds(Integer parentId); // /** 树型节点 方法 end */ // // void createExcelBatch(List<Map> datas); // // // }
import org.springframework.stereotype.Repository; import persistent.prestige.modules.edu.model.TeacherPossition; import persistent.prestige.platform.api.annotation.MybatisScan; import persistent.prestige.platform.base.dao.Dao;
/* * Powered By agile * Web Site: http://www.agile.com * Since 2008 - 2016 */ package persistent.prestige.modules.edu.dao; /** * TeacherPossition DAO类 * @author 雅居乐 2016-9-10 22:41:36 * @version 1.0 */ @Repository("teacherPossitionDao") @MybatisScan
// Path: src/main/java/persistent/prestige/modules/edu/model/TeacherPossition.java // public class TeacherPossition extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "TeacherPossition"; // // //columns START // /**title*/ // private java.lang.String title; // /**delFlag*/ // private java.lang.Integer delFlag; // /**remark*/ // private java.lang.String remark; // //columns END // // // // public java.lang.String getTitle() { // return this.title; // } // // public void setTitle(java.lang.String value) { // this.title = value; // } // // public java.lang.Integer getDelFlag() { // return this.delFlag; // } // // public void setDelFlag(java.lang.Integer value) { // this.delFlag = value; // } // // public java.lang.String getRemark() { // return this.remark; // } // // public void setRemark(java.lang.String value) { // this.remark = value; // } // // private Set teacherPossitionUsers = new HashSet(0); // @Transient // public Set<TeacherPossitionUser> getTeacherPossitionUsers() { // return teacherPossitionUsers; // } // public void setTeacherPossitionUsers(Set<TeacherPossitionUser> teacherPossitionUser){ // this.teacherPossitionUsers = teacherPossitionUser; // } // // } // // Path: src/main/java/persistent/prestige/platform/base/dao/Dao.java // @MybatisScan // public interface Dao<T extends Entity, PK extends Serializable> extends Serializable { // /** // * 根据主键查找 // * @param id // * @return // */ // T find(PK id); // // /** // * // * @param ids // * @return // */ // List<T> findByIds(PK[] ids); // // /** // * 根据查询条件查找 // * @param params // * @return // */ // List<T> query(Map params); // // /** // * 查询总数 // * @return // */ // Long countAll(); // // /** // * 查询总数 // * @return // */ // Long count(Map params); // // /** // * 增加新实体 // * 主键值会自动填充到entity // * @param entity // */ // void create(Object entity); // // /** // * 更新实体 // * @param entity // * @return // */ // int update(Object entity); // // // /** // * 根据ID 删除实体 // * // * @param id // */ // void deleteById(PK id); // // /** // * 此处不想设计成 T entity,主要是考虑在前端需要创建对象实体,设计成Map,灵活性更高 // * @param entity // */ // void delete(Map params); // // /** 树型节点 方法 start */ // T findRoot(); // // List<T> findRoots(Map params); // // /** // * 根据code 获取所有节点(包括子孙节点) // * @param code // * @return // */ // List<T> findAllChilds(String code); // // /** // * 根据父节点获取所有直接子节点 // * @param parentId // * @return // */ // List<T> findChilds(Integer parentId); // /** 树型节点 方法 end */ // // void createExcelBatch(List<Map> datas); // // // } // Path: src/main/java/persistent/prestige/modules/edu/dao/TeacherPossitionDao.java import org.springframework.stereotype.Repository; import persistent.prestige.modules.edu.model.TeacherPossition; import persistent.prestige.platform.api.annotation.MybatisScan; import persistent.prestige.platform.base.dao.Dao; /* * Powered By agile * Web Site: http://www.agile.com * Since 2008 - 2016 */ package persistent.prestige.modules.edu.dao; /** * TeacherPossition DAO类 * @author 雅居乐 2016-9-10 22:41:36 * @version 1.0 */ @Repository("teacherPossitionDao") @MybatisScan
public interface TeacherPossitionDao extends Dao<TeacherPossition,java.lang.Integer>{
dingwpmz/Mycat-Demo
src/main/java/persistent/prestige/modules/eshop/action/SellerControl.java
// Path: src/main/java/persistent/prestige/modules/eshop/service/SellerService.java // public interface SellerService { // /** // * 保存信息 // * @param datas // * @return // */ // Integer saveSeller(Map datas); // }
import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import persistent.prestige.modules.eshop.service.SellerService;
/* * Powered By agile * Web Site: http://www.agile.com * Since 2008 - 2016 */ package persistent.prestige.modules.eshop.action; /** * Seller控制类 * @author 雅居乐 2016-8-27 10:22:34 * @version 1.0 */ @Controller @RequestMapping("/passport/seller") public class SellerControl { @Autowired
// Path: src/main/java/persistent/prestige/modules/eshop/service/SellerService.java // public interface SellerService { // /** // * 保存信息 // * @param datas // * @return // */ // Integer saveSeller(Map datas); // } // Path: src/main/java/persistent/prestige/modules/eshop/action/SellerControl.java import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import persistent.prestige.modules.eshop.service.SellerService; /* * Powered By agile * Web Site: http://www.agile.com * Since 2008 - 2016 */ package persistent.prestige.modules.eshop.action; /** * Seller控制类 * @author 雅居乐 2016-8-27 10:22:34 * @version 1.0 */ @Controller @RequestMapping("/passport/seller") public class SellerControl { @Autowired
private SellerService sellerService;
dingwpmz/Mycat-Demo
src/main/java/persistent/prestige/modules/edu/service/impl/EduDemoServiceImpl.java
// Path: src/main/java/persistent/prestige/modules/edu/dao/OrganizationDao.java // @Repository("organizationDao") // @MybatisScan // public interface OrganizationDao extends Dao<Organization,java.lang.Integer>{ // // // } // // Path: src/main/java/persistent/prestige/modules/edu/dao/TeacherUserDao.java // @Repository("teacherUserDao") // @MybatisScan // public interface TeacherUserDao extends Dao<TeacherUser,java.lang.Long>{ // // GlobalUser findGlobalUser(String account); // // // List<TeacherUser> findAllUser(); // // // } // // Path: src/main/java/persistent/prestige/modules/edu/model/Organization.java // public class Organization extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "Organization"; // // //columns START // /**title*/ // private java.lang.String title; // // private Integer dbPos; // //columns END // // // // public java.lang.String getTitle() { // return this.title; // } // // public void setTitle(java.lang.String value) { // this.title = value; // } // // public Integer getDbPos() { // return dbPos; // } // // public void setDbPos(Integer dbPos) { // this.dbPos = dbPos; // } // // // // // // } // // Path: src/main/java/persistent/prestige/modules/edu/model/TeacherUser.java // public class TeacherUser extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "TeacherUser"; // // //columns START // /**account*/ // private java.lang.String account; // /**password*/ // private java.lang.String password; // /**username*/ // private java.lang.String username; // /**sex*/ // private java.lang.Integer sex; // /**delFlag*/ // private java.lang.Integer delFlag; // //columns END // // // // public java.lang.String getAccount() { // return this.account; // } // // public void setAccount(java.lang.String value) { // this.account = value; // } // // public java.lang.String getPassword() { // return this.password; // } // // public void setPassword(java.lang.String value) { // this.password = value; // } // // public java.lang.String getUsername() { // return this.username; // } // // public void setUsername(java.lang.String value) { // this.username = value; // } // // public java.lang.Integer getSex() { // return this.sex; // } // // public void setSex(java.lang.Integer value) { // this.sex = value; // } // // public java.lang.Integer getDelFlag() { // return this.delFlag; // } // // public void setDelFlag(java.lang.Integer value) { // this.delFlag = value; // } // // private Set teacherPossitionUsers = new HashSet(0); // @Transient // public Set<TeacherPossitionUser> getTeacherPossitionUsers() { // return teacherPossitionUsers; // } // public void setTeacherPossitionUsers(Set<TeacherPossitionUser> teacherPossitionUser){ // this.teacherPossitionUsers = teacherPossitionUser; // } // // } // // Path: src/main/java/persistent/prestige/modules/edu/service/EduDemoService.java // public interface EduDemoService { // // // public Map saveLogin(String account, String password); // // /** // * 查组织机构 // * @param title // * @return // */ // public List<Organization> searchOrgs(String title); // // // // // }
import java.util.HashMap; import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import persistent.prestige.modules.edu.dao.OrganizationDao; import persistent.prestige.modules.edu.dao.TeacherUserDao; import persistent.prestige.modules.edu.model.Organization; import persistent.prestige.modules.edu.model.TeacherUser; import persistent.prestige.modules.edu.service.EduDemoService;
package persistent.prestige.modules.edu.service.impl; @Service("eduDemoService") public class EduDemoServiceImpl implements EduDemoService { @Autowired
// Path: src/main/java/persistent/prestige/modules/edu/dao/OrganizationDao.java // @Repository("organizationDao") // @MybatisScan // public interface OrganizationDao extends Dao<Organization,java.lang.Integer>{ // // // } // // Path: src/main/java/persistent/prestige/modules/edu/dao/TeacherUserDao.java // @Repository("teacherUserDao") // @MybatisScan // public interface TeacherUserDao extends Dao<TeacherUser,java.lang.Long>{ // // GlobalUser findGlobalUser(String account); // // // List<TeacherUser> findAllUser(); // // // } // // Path: src/main/java/persistent/prestige/modules/edu/model/Organization.java // public class Organization extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "Organization"; // // //columns START // /**title*/ // private java.lang.String title; // // private Integer dbPos; // //columns END // // // // public java.lang.String getTitle() { // return this.title; // } // // public void setTitle(java.lang.String value) { // this.title = value; // } // // public Integer getDbPos() { // return dbPos; // } // // public void setDbPos(Integer dbPos) { // this.dbPos = dbPos; // } // // // // // // } // // Path: src/main/java/persistent/prestige/modules/edu/model/TeacherUser.java // public class TeacherUser extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "TeacherUser"; // // //columns START // /**account*/ // private java.lang.String account; // /**password*/ // private java.lang.String password; // /**username*/ // private java.lang.String username; // /**sex*/ // private java.lang.Integer sex; // /**delFlag*/ // private java.lang.Integer delFlag; // //columns END // // // // public java.lang.String getAccount() { // return this.account; // } // // public void setAccount(java.lang.String value) { // this.account = value; // } // // public java.lang.String getPassword() { // return this.password; // } // // public void setPassword(java.lang.String value) { // this.password = value; // } // // public java.lang.String getUsername() { // return this.username; // } // // public void setUsername(java.lang.String value) { // this.username = value; // } // // public java.lang.Integer getSex() { // return this.sex; // } // // public void setSex(java.lang.Integer value) { // this.sex = value; // } // // public java.lang.Integer getDelFlag() { // return this.delFlag; // } // // public void setDelFlag(java.lang.Integer value) { // this.delFlag = value; // } // // private Set teacherPossitionUsers = new HashSet(0); // @Transient // public Set<TeacherPossitionUser> getTeacherPossitionUsers() { // return teacherPossitionUsers; // } // public void setTeacherPossitionUsers(Set<TeacherPossitionUser> teacherPossitionUser){ // this.teacherPossitionUsers = teacherPossitionUser; // } // // } // // Path: src/main/java/persistent/prestige/modules/edu/service/EduDemoService.java // public interface EduDemoService { // // // public Map saveLogin(String account, String password); // // /** // * 查组织机构 // * @param title // * @return // */ // public List<Organization> searchOrgs(String title); // // // // // } // Path: src/main/java/persistent/prestige/modules/edu/service/impl/EduDemoServiceImpl.java import java.util.HashMap; import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import persistent.prestige.modules.edu.dao.OrganizationDao; import persistent.prestige.modules.edu.dao.TeacherUserDao; import persistent.prestige.modules.edu.model.Organization; import persistent.prestige.modules.edu.model.TeacherUser; import persistent.prestige.modules.edu.service.EduDemoService; package persistent.prestige.modules.edu.service.impl; @Service("eduDemoService") public class EduDemoServiceImpl implements EduDemoService { @Autowired
private TeacherUserDao teacherUserDao;
dingwpmz/Mycat-Demo
src/main/java/persistent/prestige/modules/edu/service/impl/EduDemoServiceImpl.java
// Path: src/main/java/persistent/prestige/modules/edu/dao/OrganizationDao.java // @Repository("organizationDao") // @MybatisScan // public interface OrganizationDao extends Dao<Organization,java.lang.Integer>{ // // // } // // Path: src/main/java/persistent/prestige/modules/edu/dao/TeacherUserDao.java // @Repository("teacherUserDao") // @MybatisScan // public interface TeacherUserDao extends Dao<TeacherUser,java.lang.Long>{ // // GlobalUser findGlobalUser(String account); // // // List<TeacherUser> findAllUser(); // // // } // // Path: src/main/java/persistent/prestige/modules/edu/model/Organization.java // public class Organization extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "Organization"; // // //columns START // /**title*/ // private java.lang.String title; // // private Integer dbPos; // //columns END // // // // public java.lang.String getTitle() { // return this.title; // } // // public void setTitle(java.lang.String value) { // this.title = value; // } // // public Integer getDbPos() { // return dbPos; // } // // public void setDbPos(Integer dbPos) { // this.dbPos = dbPos; // } // // // // // // } // // Path: src/main/java/persistent/prestige/modules/edu/model/TeacherUser.java // public class TeacherUser extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "TeacherUser"; // // //columns START // /**account*/ // private java.lang.String account; // /**password*/ // private java.lang.String password; // /**username*/ // private java.lang.String username; // /**sex*/ // private java.lang.Integer sex; // /**delFlag*/ // private java.lang.Integer delFlag; // //columns END // // // // public java.lang.String getAccount() { // return this.account; // } // // public void setAccount(java.lang.String value) { // this.account = value; // } // // public java.lang.String getPassword() { // return this.password; // } // // public void setPassword(java.lang.String value) { // this.password = value; // } // // public java.lang.String getUsername() { // return this.username; // } // // public void setUsername(java.lang.String value) { // this.username = value; // } // // public java.lang.Integer getSex() { // return this.sex; // } // // public void setSex(java.lang.Integer value) { // this.sex = value; // } // // public java.lang.Integer getDelFlag() { // return this.delFlag; // } // // public void setDelFlag(java.lang.Integer value) { // this.delFlag = value; // } // // private Set teacherPossitionUsers = new HashSet(0); // @Transient // public Set<TeacherPossitionUser> getTeacherPossitionUsers() { // return teacherPossitionUsers; // } // public void setTeacherPossitionUsers(Set<TeacherPossitionUser> teacherPossitionUser){ // this.teacherPossitionUsers = teacherPossitionUser; // } // // } // // Path: src/main/java/persistent/prestige/modules/edu/service/EduDemoService.java // public interface EduDemoService { // // // public Map saveLogin(String account, String password); // // /** // * 查组织机构 // * @param title // * @return // */ // public List<Organization> searchOrgs(String title); // // // // // }
import java.util.HashMap; import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import persistent.prestige.modules.edu.dao.OrganizationDao; import persistent.prestige.modules.edu.dao.TeacherUserDao; import persistent.prestige.modules.edu.model.Organization; import persistent.prestige.modules.edu.model.TeacherUser; import persistent.prestige.modules.edu.service.EduDemoService;
package persistent.prestige.modules.edu.service.impl; @Service("eduDemoService") public class EduDemoServiceImpl implements EduDemoService { @Autowired private TeacherUserDao teacherUserDao; @Autowired
// Path: src/main/java/persistent/prestige/modules/edu/dao/OrganizationDao.java // @Repository("organizationDao") // @MybatisScan // public interface OrganizationDao extends Dao<Organization,java.lang.Integer>{ // // // } // // Path: src/main/java/persistent/prestige/modules/edu/dao/TeacherUserDao.java // @Repository("teacherUserDao") // @MybatisScan // public interface TeacherUserDao extends Dao<TeacherUser,java.lang.Long>{ // // GlobalUser findGlobalUser(String account); // // // List<TeacherUser> findAllUser(); // // // } // // Path: src/main/java/persistent/prestige/modules/edu/model/Organization.java // public class Organization extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "Organization"; // // //columns START // /**title*/ // private java.lang.String title; // // private Integer dbPos; // //columns END // // // // public java.lang.String getTitle() { // return this.title; // } // // public void setTitle(java.lang.String value) { // this.title = value; // } // // public Integer getDbPos() { // return dbPos; // } // // public void setDbPos(Integer dbPos) { // this.dbPos = dbPos; // } // // // // // // } // // Path: src/main/java/persistent/prestige/modules/edu/model/TeacherUser.java // public class TeacherUser extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "TeacherUser"; // // //columns START // /**account*/ // private java.lang.String account; // /**password*/ // private java.lang.String password; // /**username*/ // private java.lang.String username; // /**sex*/ // private java.lang.Integer sex; // /**delFlag*/ // private java.lang.Integer delFlag; // //columns END // // // // public java.lang.String getAccount() { // return this.account; // } // // public void setAccount(java.lang.String value) { // this.account = value; // } // // public java.lang.String getPassword() { // return this.password; // } // // public void setPassword(java.lang.String value) { // this.password = value; // } // // public java.lang.String getUsername() { // return this.username; // } // // public void setUsername(java.lang.String value) { // this.username = value; // } // // public java.lang.Integer getSex() { // return this.sex; // } // // public void setSex(java.lang.Integer value) { // this.sex = value; // } // // public java.lang.Integer getDelFlag() { // return this.delFlag; // } // // public void setDelFlag(java.lang.Integer value) { // this.delFlag = value; // } // // private Set teacherPossitionUsers = new HashSet(0); // @Transient // public Set<TeacherPossitionUser> getTeacherPossitionUsers() { // return teacherPossitionUsers; // } // public void setTeacherPossitionUsers(Set<TeacherPossitionUser> teacherPossitionUser){ // this.teacherPossitionUsers = teacherPossitionUser; // } // // } // // Path: src/main/java/persistent/prestige/modules/edu/service/EduDemoService.java // public interface EduDemoService { // // // public Map saveLogin(String account, String password); // // /** // * 查组织机构 // * @param title // * @return // */ // public List<Organization> searchOrgs(String title); // // // // // } // Path: src/main/java/persistent/prestige/modules/edu/service/impl/EduDemoServiceImpl.java import java.util.HashMap; import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import persistent.prestige.modules.edu.dao.OrganizationDao; import persistent.prestige.modules.edu.dao.TeacherUserDao; import persistent.prestige.modules.edu.model.Organization; import persistent.prestige.modules.edu.model.TeacherUser; import persistent.prestige.modules.edu.service.EduDemoService; package persistent.prestige.modules.edu.service.impl; @Service("eduDemoService") public class EduDemoServiceImpl implements EduDemoService { @Autowired private TeacherUserDao teacherUserDao; @Autowired
private OrganizationDao organizationDao;
dingwpmz/Mycat-Demo
src/main/java/persistent/prestige/modules/edu/service/impl/EduDemoServiceImpl.java
// Path: src/main/java/persistent/prestige/modules/edu/dao/OrganizationDao.java // @Repository("organizationDao") // @MybatisScan // public interface OrganizationDao extends Dao<Organization,java.lang.Integer>{ // // // } // // Path: src/main/java/persistent/prestige/modules/edu/dao/TeacherUserDao.java // @Repository("teacherUserDao") // @MybatisScan // public interface TeacherUserDao extends Dao<TeacherUser,java.lang.Long>{ // // GlobalUser findGlobalUser(String account); // // // List<TeacherUser> findAllUser(); // // // } // // Path: src/main/java/persistent/prestige/modules/edu/model/Organization.java // public class Organization extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "Organization"; // // //columns START // /**title*/ // private java.lang.String title; // // private Integer dbPos; // //columns END // // // // public java.lang.String getTitle() { // return this.title; // } // // public void setTitle(java.lang.String value) { // this.title = value; // } // // public Integer getDbPos() { // return dbPos; // } // // public void setDbPos(Integer dbPos) { // this.dbPos = dbPos; // } // // // // // // } // // Path: src/main/java/persistent/prestige/modules/edu/model/TeacherUser.java // public class TeacherUser extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "TeacherUser"; // // //columns START // /**account*/ // private java.lang.String account; // /**password*/ // private java.lang.String password; // /**username*/ // private java.lang.String username; // /**sex*/ // private java.lang.Integer sex; // /**delFlag*/ // private java.lang.Integer delFlag; // //columns END // // // // public java.lang.String getAccount() { // return this.account; // } // // public void setAccount(java.lang.String value) { // this.account = value; // } // // public java.lang.String getPassword() { // return this.password; // } // // public void setPassword(java.lang.String value) { // this.password = value; // } // // public java.lang.String getUsername() { // return this.username; // } // // public void setUsername(java.lang.String value) { // this.username = value; // } // // public java.lang.Integer getSex() { // return this.sex; // } // // public void setSex(java.lang.Integer value) { // this.sex = value; // } // // public java.lang.Integer getDelFlag() { // return this.delFlag; // } // // public void setDelFlag(java.lang.Integer value) { // this.delFlag = value; // } // // private Set teacherPossitionUsers = new HashSet(0); // @Transient // public Set<TeacherPossitionUser> getTeacherPossitionUsers() { // return teacherPossitionUsers; // } // public void setTeacherPossitionUsers(Set<TeacherPossitionUser> teacherPossitionUser){ // this.teacherPossitionUsers = teacherPossitionUser; // } // // } // // Path: src/main/java/persistent/prestige/modules/edu/service/EduDemoService.java // public interface EduDemoService { // // // public Map saveLogin(String account, String password); // // /** // * 查组织机构 // * @param title // * @return // */ // public List<Organization> searchOrgs(String title); // // // // // }
import java.util.HashMap; import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import persistent.prestige.modules.edu.dao.OrganizationDao; import persistent.prestige.modules.edu.dao.TeacherUserDao; import persistent.prestige.modules.edu.model.Organization; import persistent.prestige.modules.edu.model.TeacherUser; import persistent.prestige.modules.edu.service.EduDemoService;
package persistent.prestige.modules.edu.service.impl; @Service("eduDemoService") public class EduDemoServiceImpl implements EduDemoService { @Autowired private TeacherUserDao teacherUserDao; @Autowired private OrganizationDao organizationDao; @Override public Map saveLogin(String account, String password) { Map result = new HashMap(); try { // TODO Auto-generated method stub Map params = new HashMap(); params.put("account", account); params.put("password", password); Map data = new HashMap();
// Path: src/main/java/persistent/prestige/modules/edu/dao/OrganizationDao.java // @Repository("organizationDao") // @MybatisScan // public interface OrganizationDao extends Dao<Organization,java.lang.Integer>{ // // // } // // Path: src/main/java/persistent/prestige/modules/edu/dao/TeacherUserDao.java // @Repository("teacherUserDao") // @MybatisScan // public interface TeacherUserDao extends Dao<TeacherUser,java.lang.Long>{ // // GlobalUser findGlobalUser(String account); // // // List<TeacherUser> findAllUser(); // // // } // // Path: src/main/java/persistent/prestige/modules/edu/model/Organization.java // public class Organization extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "Organization"; // // //columns START // /**title*/ // private java.lang.String title; // // private Integer dbPos; // //columns END // // // // public java.lang.String getTitle() { // return this.title; // } // // public void setTitle(java.lang.String value) { // this.title = value; // } // // public Integer getDbPos() { // return dbPos; // } // // public void setDbPos(Integer dbPos) { // this.dbPos = dbPos; // } // // // // // // } // // Path: src/main/java/persistent/prestige/modules/edu/model/TeacherUser.java // public class TeacherUser extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "TeacherUser"; // // //columns START // /**account*/ // private java.lang.String account; // /**password*/ // private java.lang.String password; // /**username*/ // private java.lang.String username; // /**sex*/ // private java.lang.Integer sex; // /**delFlag*/ // private java.lang.Integer delFlag; // //columns END // // // // public java.lang.String getAccount() { // return this.account; // } // // public void setAccount(java.lang.String value) { // this.account = value; // } // // public java.lang.String getPassword() { // return this.password; // } // // public void setPassword(java.lang.String value) { // this.password = value; // } // // public java.lang.String getUsername() { // return this.username; // } // // public void setUsername(java.lang.String value) { // this.username = value; // } // // public java.lang.Integer getSex() { // return this.sex; // } // // public void setSex(java.lang.Integer value) { // this.sex = value; // } // // public java.lang.Integer getDelFlag() { // return this.delFlag; // } // // public void setDelFlag(java.lang.Integer value) { // this.delFlag = value; // } // // private Set teacherPossitionUsers = new HashSet(0); // @Transient // public Set<TeacherPossitionUser> getTeacherPossitionUsers() { // return teacherPossitionUsers; // } // public void setTeacherPossitionUsers(Set<TeacherPossitionUser> teacherPossitionUser){ // this.teacherPossitionUsers = teacherPossitionUser; // } // // } // // Path: src/main/java/persistent/prestige/modules/edu/service/EduDemoService.java // public interface EduDemoService { // // // public Map saveLogin(String account, String password); // // /** // * 查组织机构 // * @param title // * @return // */ // public List<Organization> searchOrgs(String title); // // // // // } // Path: src/main/java/persistent/prestige/modules/edu/service/impl/EduDemoServiceImpl.java import java.util.HashMap; import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import persistent.prestige.modules.edu.dao.OrganizationDao; import persistent.prestige.modules.edu.dao.TeacherUserDao; import persistent.prestige.modules.edu.model.Organization; import persistent.prestige.modules.edu.model.TeacherUser; import persistent.prestige.modules.edu.service.EduDemoService; package persistent.prestige.modules.edu.service.impl; @Service("eduDemoService") public class EduDemoServiceImpl implements EduDemoService { @Autowired private TeacherUserDao teacherUserDao; @Autowired private OrganizationDao organizationDao; @Override public Map saveLogin(String account, String password) { Map result = new HashMap(); try { // TODO Auto-generated method stub Map params = new HashMap(); params.put("account", account); params.put("password", password); Map data = new HashMap();
List<TeacherUser> users = teacherUserDao.query(params);
dingwpmz/Mycat-Demo
src/main/java/persistent/prestige/modules/edu/service/impl/EduDemoServiceImpl.java
// Path: src/main/java/persistent/prestige/modules/edu/dao/OrganizationDao.java // @Repository("organizationDao") // @MybatisScan // public interface OrganizationDao extends Dao<Organization,java.lang.Integer>{ // // // } // // Path: src/main/java/persistent/prestige/modules/edu/dao/TeacherUserDao.java // @Repository("teacherUserDao") // @MybatisScan // public interface TeacherUserDao extends Dao<TeacherUser,java.lang.Long>{ // // GlobalUser findGlobalUser(String account); // // // List<TeacherUser> findAllUser(); // // // } // // Path: src/main/java/persistent/prestige/modules/edu/model/Organization.java // public class Organization extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "Organization"; // // //columns START // /**title*/ // private java.lang.String title; // // private Integer dbPos; // //columns END // // // // public java.lang.String getTitle() { // return this.title; // } // // public void setTitle(java.lang.String value) { // this.title = value; // } // // public Integer getDbPos() { // return dbPos; // } // // public void setDbPos(Integer dbPos) { // this.dbPos = dbPos; // } // // // // // // } // // Path: src/main/java/persistent/prestige/modules/edu/model/TeacherUser.java // public class TeacherUser extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "TeacherUser"; // // //columns START // /**account*/ // private java.lang.String account; // /**password*/ // private java.lang.String password; // /**username*/ // private java.lang.String username; // /**sex*/ // private java.lang.Integer sex; // /**delFlag*/ // private java.lang.Integer delFlag; // //columns END // // // // public java.lang.String getAccount() { // return this.account; // } // // public void setAccount(java.lang.String value) { // this.account = value; // } // // public java.lang.String getPassword() { // return this.password; // } // // public void setPassword(java.lang.String value) { // this.password = value; // } // // public java.lang.String getUsername() { // return this.username; // } // // public void setUsername(java.lang.String value) { // this.username = value; // } // // public java.lang.Integer getSex() { // return this.sex; // } // // public void setSex(java.lang.Integer value) { // this.sex = value; // } // // public java.lang.Integer getDelFlag() { // return this.delFlag; // } // // public void setDelFlag(java.lang.Integer value) { // this.delFlag = value; // } // // private Set teacherPossitionUsers = new HashSet(0); // @Transient // public Set<TeacherPossitionUser> getTeacherPossitionUsers() { // return teacherPossitionUsers; // } // public void setTeacherPossitionUsers(Set<TeacherPossitionUser> teacherPossitionUser){ // this.teacherPossitionUsers = teacherPossitionUser; // } // // } // // Path: src/main/java/persistent/prestige/modules/edu/service/EduDemoService.java // public interface EduDemoService { // // // public Map saveLogin(String account, String password); // // /** // * 查组织机构 // * @param title // * @return // */ // public List<Organization> searchOrgs(String title); // // // // // }
import java.util.HashMap; import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import persistent.prestige.modules.edu.dao.OrganizationDao; import persistent.prestige.modules.edu.dao.TeacherUserDao; import persistent.prestige.modules.edu.model.Organization; import persistent.prestige.modules.edu.model.TeacherUser; import persistent.prestige.modules.edu.service.EduDemoService;
params.put("account", account); params.put("password", password); Map data = new HashMap(); List<TeacherUser> users = teacherUserDao.query(params); if(users == null || users.isEmpty()) { result.put("code", 1); result.put("msg", "用户名错误"); return result; } TeacherUser user = users.get(0); data.put("id", user.getId()); data.put("account", user.getAccount()); result.put("code", 0); result.put("data", data); return result; } catch (Exception e) { e.printStackTrace(); result.put("code", 1); result.put("msg", "用户名错误"); return result; } } @Override
// Path: src/main/java/persistent/prestige/modules/edu/dao/OrganizationDao.java // @Repository("organizationDao") // @MybatisScan // public interface OrganizationDao extends Dao<Organization,java.lang.Integer>{ // // // } // // Path: src/main/java/persistent/prestige/modules/edu/dao/TeacherUserDao.java // @Repository("teacherUserDao") // @MybatisScan // public interface TeacherUserDao extends Dao<TeacherUser,java.lang.Long>{ // // GlobalUser findGlobalUser(String account); // // // List<TeacherUser> findAllUser(); // // // } // // Path: src/main/java/persistent/prestige/modules/edu/model/Organization.java // public class Organization extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "Organization"; // // //columns START // /**title*/ // private java.lang.String title; // // private Integer dbPos; // //columns END // // // // public java.lang.String getTitle() { // return this.title; // } // // public void setTitle(java.lang.String value) { // this.title = value; // } // // public Integer getDbPos() { // return dbPos; // } // // public void setDbPos(Integer dbPos) { // this.dbPos = dbPos; // } // // // // // // } // // Path: src/main/java/persistent/prestige/modules/edu/model/TeacherUser.java // public class TeacherUser extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "TeacherUser"; // // //columns START // /**account*/ // private java.lang.String account; // /**password*/ // private java.lang.String password; // /**username*/ // private java.lang.String username; // /**sex*/ // private java.lang.Integer sex; // /**delFlag*/ // private java.lang.Integer delFlag; // //columns END // // // // public java.lang.String getAccount() { // return this.account; // } // // public void setAccount(java.lang.String value) { // this.account = value; // } // // public java.lang.String getPassword() { // return this.password; // } // // public void setPassword(java.lang.String value) { // this.password = value; // } // // public java.lang.String getUsername() { // return this.username; // } // // public void setUsername(java.lang.String value) { // this.username = value; // } // // public java.lang.Integer getSex() { // return this.sex; // } // // public void setSex(java.lang.Integer value) { // this.sex = value; // } // // public java.lang.Integer getDelFlag() { // return this.delFlag; // } // // public void setDelFlag(java.lang.Integer value) { // this.delFlag = value; // } // // private Set teacherPossitionUsers = new HashSet(0); // @Transient // public Set<TeacherPossitionUser> getTeacherPossitionUsers() { // return teacherPossitionUsers; // } // public void setTeacherPossitionUsers(Set<TeacherPossitionUser> teacherPossitionUser){ // this.teacherPossitionUsers = teacherPossitionUser; // } // // } // // Path: src/main/java/persistent/prestige/modules/edu/service/EduDemoService.java // public interface EduDemoService { // // // public Map saveLogin(String account, String password); // // /** // * 查组织机构 // * @param title // * @return // */ // public List<Organization> searchOrgs(String title); // // // // // } // Path: src/main/java/persistent/prestige/modules/edu/service/impl/EduDemoServiceImpl.java import java.util.HashMap; import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import persistent.prestige.modules.edu.dao.OrganizationDao; import persistent.prestige.modules.edu.dao.TeacherUserDao; import persistent.prestige.modules.edu.model.Organization; import persistent.prestige.modules.edu.model.TeacherUser; import persistent.prestige.modules.edu.service.EduDemoService; params.put("account", account); params.put("password", password); Map data = new HashMap(); List<TeacherUser> users = teacherUserDao.query(params); if(users == null || users.isEmpty()) { result.put("code", 1); result.put("msg", "用户名错误"); return result; } TeacherUser user = users.get(0); data.put("id", user.getId()); data.put("account", user.getAccount()); result.put("code", 0); result.put("data", data); return result; } catch (Exception e) { e.printStackTrace(); result.put("code", 1); result.put("msg", "用户名错误"); return result; } } @Override
public List<Organization> searchOrgs(String title) {
dingwpmz/Mycat-Demo
src/main/java/persistent/prestige/modules/edu/dao/OrganizationDao.java
// Path: src/main/java/persistent/prestige/modules/edu/model/Organization.java // public class Organization extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "Organization"; // // //columns START // /**title*/ // private java.lang.String title; // // private Integer dbPos; // //columns END // // // // public java.lang.String getTitle() { // return this.title; // } // // public void setTitle(java.lang.String value) { // this.title = value; // } // // public Integer getDbPos() { // return dbPos; // } // // public void setDbPos(Integer dbPos) { // this.dbPos = dbPos; // } // // // // // // } // // Path: src/main/java/persistent/prestige/platform/base/dao/Dao.java // @MybatisScan // public interface Dao<T extends Entity, PK extends Serializable> extends Serializable { // /** // * 根据主键查找 // * @param id // * @return // */ // T find(PK id); // // /** // * // * @param ids // * @return // */ // List<T> findByIds(PK[] ids); // // /** // * 根据查询条件查找 // * @param params // * @return // */ // List<T> query(Map params); // // /** // * 查询总数 // * @return // */ // Long countAll(); // // /** // * 查询总数 // * @return // */ // Long count(Map params); // // /** // * 增加新实体 // * 主键值会自动填充到entity // * @param entity // */ // void create(Object entity); // // /** // * 更新实体 // * @param entity // * @return // */ // int update(Object entity); // // // /** // * 根据ID 删除实体 // * // * @param id // */ // void deleteById(PK id); // // /** // * 此处不想设计成 T entity,主要是考虑在前端需要创建对象实体,设计成Map,灵活性更高 // * @param entity // */ // void delete(Map params); // // /** 树型节点 方法 start */ // T findRoot(); // // List<T> findRoots(Map params); // // /** // * 根据code 获取所有节点(包括子孙节点) // * @param code // * @return // */ // List<T> findAllChilds(String code); // // /** // * 根据父节点获取所有直接子节点 // * @param parentId // * @return // */ // List<T> findChilds(Integer parentId); // /** 树型节点 方法 end */ // // void createExcelBatch(List<Map> datas); // // // }
import org.springframework.stereotype.Repository; import persistent.prestige.modules.edu.model.Organization; import persistent.prestige.platform.api.annotation.MybatisScan; import persistent.prestige.platform.base.dao.Dao;
/* * Powered By agile * Web Site: http://www.agile.com * Since 2008 - 2016 */ package persistent.prestige.modules.edu.dao; /** * Organization DAO类 * @author 雅居乐 2016-9-10 22:28:24 * @version 1.0 */ @Repository("organizationDao") @MybatisScan
// Path: src/main/java/persistent/prestige/modules/edu/model/Organization.java // public class Organization extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "Organization"; // // //columns START // /**title*/ // private java.lang.String title; // // private Integer dbPos; // //columns END // // // // public java.lang.String getTitle() { // return this.title; // } // // public void setTitle(java.lang.String value) { // this.title = value; // } // // public Integer getDbPos() { // return dbPos; // } // // public void setDbPos(Integer dbPos) { // this.dbPos = dbPos; // } // // // // // // } // // Path: src/main/java/persistent/prestige/platform/base/dao/Dao.java // @MybatisScan // public interface Dao<T extends Entity, PK extends Serializable> extends Serializable { // /** // * 根据主键查找 // * @param id // * @return // */ // T find(PK id); // // /** // * // * @param ids // * @return // */ // List<T> findByIds(PK[] ids); // // /** // * 根据查询条件查找 // * @param params // * @return // */ // List<T> query(Map params); // // /** // * 查询总数 // * @return // */ // Long countAll(); // // /** // * 查询总数 // * @return // */ // Long count(Map params); // // /** // * 增加新实体 // * 主键值会自动填充到entity // * @param entity // */ // void create(Object entity); // // /** // * 更新实体 // * @param entity // * @return // */ // int update(Object entity); // // // /** // * 根据ID 删除实体 // * // * @param id // */ // void deleteById(PK id); // // /** // * 此处不想设计成 T entity,主要是考虑在前端需要创建对象实体,设计成Map,灵活性更高 // * @param entity // */ // void delete(Map params); // // /** 树型节点 方法 start */ // T findRoot(); // // List<T> findRoots(Map params); // // /** // * 根据code 获取所有节点(包括子孙节点) // * @param code // * @return // */ // List<T> findAllChilds(String code); // // /** // * 根据父节点获取所有直接子节点 // * @param parentId // * @return // */ // List<T> findChilds(Integer parentId); // /** 树型节点 方法 end */ // // void createExcelBatch(List<Map> datas); // // // } // Path: src/main/java/persistent/prestige/modules/edu/dao/OrganizationDao.java import org.springframework.stereotype.Repository; import persistent.prestige.modules.edu.model.Organization; import persistent.prestige.platform.api.annotation.MybatisScan; import persistent.prestige.platform.base.dao.Dao; /* * Powered By agile * Web Site: http://www.agile.com * Since 2008 - 2016 */ package persistent.prestige.modules.edu.dao; /** * Organization DAO类 * @author 雅居乐 2016-9-10 22:28:24 * @version 1.0 */ @Repository("organizationDao") @MybatisScan
public interface OrganizationDao extends Dao<Organization,java.lang.Integer>{
dingwpmz/Mycat-Demo
src/main/java/persistent/prestige/modules/edu/dao/OrganizationDao.java
// Path: src/main/java/persistent/prestige/modules/edu/model/Organization.java // public class Organization extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "Organization"; // // //columns START // /**title*/ // private java.lang.String title; // // private Integer dbPos; // //columns END // // // // public java.lang.String getTitle() { // return this.title; // } // // public void setTitle(java.lang.String value) { // this.title = value; // } // // public Integer getDbPos() { // return dbPos; // } // // public void setDbPos(Integer dbPos) { // this.dbPos = dbPos; // } // // // // // // } // // Path: src/main/java/persistent/prestige/platform/base/dao/Dao.java // @MybatisScan // public interface Dao<T extends Entity, PK extends Serializable> extends Serializable { // /** // * 根据主键查找 // * @param id // * @return // */ // T find(PK id); // // /** // * // * @param ids // * @return // */ // List<T> findByIds(PK[] ids); // // /** // * 根据查询条件查找 // * @param params // * @return // */ // List<T> query(Map params); // // /** // * 查询总数 // * @return // */ // Long countAll(); // // /** // * 查询总数 // * @return // */ // Long count(Map params); // // /** // * 增加新实体 // * 主键值会自动填充到entity // * @param entity // */ // void create(Object entity); // // /** // * 更新实体 // * @param entity // * @return // */ // int update(Object entity); // // // /** // * 根据ID 删除实体 // * // * @param id // */ // void deleteById(PK id); // // /** // * 此处不想设计成 T entity,主要是考虑在前端需要创建对象实体,设计成Map,灵活性更高 // * @param entity // */ // void delete(Map params); // // /** 树型节点 方法 start */ // T findRoot(); // // List<T> findRoots(Map params); // // /** // * 根据code 获取所有节点(包括子孙节点) // * @param code // * @return // */ // List<T> findAllChilds(String code); // // /** // * 根据父节点获取所有直接子节点 // * @param parentId // * @return // */ // List<T> findChilds(Integer parentId); // /** 树型节点 方法 end */ // // void createExcelBatch(List<Map> datas); // // // }
import org.springframework.stereotype.Repository; import persistent.prestige.modules.edu.model.Organization; import persistent.prestige.platform.api.annotation.MybatisScan; import persistent.prestige.platform.base.dao.Dao;
/* * Powered By agile * Web Site: http://www.agile.com * Since 2008 - 2016 */ package persistent.prestige.modules.edu.dao; /** * Organization DAO类 * @author 雅居乐 2016-9-10 22:28:24 * @version 1.0 */ @Repository("organizationDao") @MybatisScan
// Path: src/main/java/persistent/prestige/modules/edu/model/Organization.java // public class Organization extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "Organization"; // // //columns START // /**title*/ // private java.lang.String title; // // private Integer dbPos; // //columns END // // // // public java.lang.String getTitle() { // return this.title; // } // // public void setTitle(java.lang.String value) { // this.title = value; // } // // public Integer getDbPos() { // return dbPos; // } // // public void setDbPos(Integer dbPos) { // this.dbPos = dbPos; // } // // // // // // } // // Path: src/main/java/persistent/prestige/platform/base/dao/Dao.java // @MybatisScan // public interface Dao<T extends Entity, PK extends Serializable> extends Serializable { // /** // * 根据主键查找 // * @param id // * @return // */ // T find(PK id); // // /** // * // * @param ids // * @return // */ // List<T> findByIds(PK[] ids); // // /** // * 根据查询条件查找 // * @param params // * @return // */ // List<T> query(Map params); // // /** // * 查询总数 // * @return // */ // Long countAll(); // // /** // * 查询总数 // * @return // */ // Long count(Map params); // // /** // * 增加新实体 // * 主键值会自动填充到entity // * @param entity // */ // void create(Object entity); // // /** // * 更新实体 // * @param entity // * @return // */ // int update(Object entity); // // // /** // * 根据ID 删除实体 // * // * @param id // */ // void deleteById(PK id); // // /** // * 此处不想设计成 T entity,主要是考虑在前端需要创建对象实体,设计成Map,灵活性更高 // * @param entity // */ // void delete(Map params); // // /** 树型节点 方法 start */ // T findRoot(); // // List<T> findRoots(Map params); // // /** // * 根据code 获取所有节点(包括子孙节点) // * @param code // * @return // */ // List<T> findAllChilds(String code); // // /** // * 根据父节点获取所有直接子节点 // * @param parentId // * @return // */ // List<T> findChilds(Integer parentId); // /** 树型节点 方法 end */ // // void createExcelBatch(List<Map> datas); // // // } // Path: src/main/java/persistent/prestige/modules/edu/dao/OrganizationDao.java import org.springframework.stereotype.Repository; import persistent.prestige.modules.edu.model.Organization; import persistent.prestige.platform.api.annotation.MybatisScan; import persistent.prestige.platform.base.dao.Dao; /* * Powered By agile * Web Site: http://www.agile.com * Since 2008 - 2016 */ package persistent.prestige.modules.edu.dao; /** * Organization DAO类 * @author 雅居乐 2016-9-10 22:28:24 * @version 1.0 */ @Repository("organizationDao") @MybatisScan
public interface OrganizationDao extends Dao<Organization,java.lang.Integer>{
dingwpmz/Mycat-Demo
src/main/java/persistent/prestige/modules/edu/service/impl/EduDemoServiceImpl2.java
// Path: src/main/java/persistent/prestige/modules/edu/dao/DemoDao.java // @Repository("demoDao") // @MybatisScan // public interface DemoDao extends Dao { // // /** 查询用户新 */ // TeacherUser findUser(@Param("dbPos") Integer dbPos, @Param("account") String account, @Param("password") String password); // // List<Organization> searchOrgs(@Param("dbPos") Integer dbPos, @Param("title") String title); // // /** 保存机构*/ // void saveOrg(Organization org); // // // } // // Path: src/main/java/persistent/prestige/modules/edu/model/Organization.java // public class Organization extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "Organization"; // // //columns START // /**title*/ // private java.lang.String title; // // private Integer dbPos; // //columns END // // // // public java.lang.String getTitle() { // return this.title; // } // // public void setTitle(java.lang.String value) { // this.title = value; // } // // public Integer getDbPos() { // return dbPos; // } // // public void setDbPos(Integer dbPos) { // this.dbPos = dbPos; // } // // // // // // } // // Path: src/main/java/persistent/prestige/modules/edu/service/EduDemoService2.java // public interface EduDemoService2 { // // // public Map saveLogin(Integer dbPos, String account, String password); // // /** // * 查组织机构 // * @param title // * @return // */ // public List<Organization> searchOrgs(Integer dbPos, String title); // // // public Organization saveOrg(Integer dbPos, String title); // // // // // }
import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import persistent.prestige.modules.edu.dao.DemoDao; import persistent.prestige.modules.edu.model.Organization; import persistent.prestige.modules.edu.service.EduDemoService2;
package persistent.prestige.modules.edu.service.impl; @Service("eduDemoService2") public class EduDemoServiceImpl2 implements EduDemoService2 { @Autowired
// Path: src/main/java/persistent/prestige/modules/edu/dao/DemoDao.java // @Repository("demoDao") // @MybatisScan // public interface DemoDao extends Dao { // // /** 查询用户新 */ // TeacherUser findUser(@Param("dbPos") Integer dbPos, @Param("account") String account, @Param("password") String password); // // List<Organization> searchOrgs(@Param("dbPos") Integer dbPos, @Param("title") String title); // // /** 保存机构*/ // void saveOrg(Organization org); // // // } // // Path: src/main/java/persistent/prestige/modules/edu/model/Organization.java // public class Organization extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "Organization"; // // //columns START // /**title*/ // private java.lang.String title; // // private Integer dbPos; // //columns END // // // // public java.lang.String getTitle() { // return this.title; // } // // public void setTitle(java.lang.String value) { // this.title = value; // } // // public Integer getDbPos() { // return dbPos; // } // // public void setDbPos(Integer dbPos) { // this.dbPos = dbPos; // } // // // // // // } // // Path: src/main/java/persistent/prestige/modules/edu/service/EduDemoService2.java // public interface EduDemoService2 { // // // public Map saveLogin(Integer dbPos, String account, String password); // // /** // * 查组织机构 // * @param title // * @return // */ // public List<Organization> searchOrgs(Integer dbPos, String title); // // // public Organization saveOrg(Integer dbPos, String title); // // // // // } // Path: src/main/java/persistent/prestige/modules/edu/service/impl/EduDemoServiceImpl2.java import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import persistent.prestige.modules.edu.dao.DemoDao; import persistent.prestige.modules.edu.model.Organization; import persistent.prestige.modules.edu.service.EduDemoService2; package persistent.prestige.modules.edu.service.impl; @Service("eduDemoService2") public class EduDemoServiceImpl2 implements EduDemoService2 { @Autowired
private DemoDao demoDao;
dingwpmz/Mycat-Demo
src/main/java/persistent/prestige/modules/edu/service/impl/EduDemoServiceImpl2.java
// Path: src/main/java/persistent/prestige/modules/edu/dao/DemoDao.java // @Repository("demoDao") // @MybatisScan // public interface DemoDao extends Dao { // // /** 查询用户新 */ // TeacherUser findUser(@Param("dbPos") Integer dbPos, @Param("account") String account, @Param("password") String password); // // List<Organization> searchOrgs(@Param("dbPos") Integer dbPos, @Param("title") String title); // // /** 保存机构*/ // void saveOrg(Organization org); // // // } // // Path: src/main/java/persistent/prestige/modules/edu/model/Organization.java // public class Organization extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "Organization"; // // //columns START // /**title*/ // private java.lang.String title; // // private Integer dbPos; // //columns END // // // // public java.lang.String getTitle() { // return this.title; // } // // public void setTitle(java.lang.String value) { // this.title = value; // } // // public Integer getDbPos() { // return dbPos; // } // // public void setDbPos(Integer dbPos) { // this.dbPos = dbPos; // } // // // // // // } // // Path: src/main/java/persistent/prestige/modules/edu/service/EduDemoService2.java // public interface EduDemoService2 { // // // public Map saveLogin(Integer dbPos, String account, String password); // // /** // * 查组织机构 // * @param title // * @return // */ // public List<Organization> searchOrgs(Integer dbPos, String title); // // // public Organization saveOrg(Integer dbPos, String title); // // // // // }
import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import persistent.prestige.modules.edu.dao.DemoDao; import persistent.prestige.modules.edu.model.Organization; import persistent.prestige.modules.edu.service.EduDemoService2;
package persistent.prestige.modules.edu.service.impl; @Service("eduDemoService2") public class EduDemoServiceImpl2 implements EduDemoService2 { @Autowired private DemoDao demoDao; @Override public Map saveLogin(Integer dbPos,String account, String password) { // TODO Auto-generated method stub return null; } @Override
// Path: src/main/java/persistent/prestige/modules/edu/dao/DemoDao.java // @Repository("demoDao") // @MybatisScan // public interface DemoDao extends Dao { // // /** 查询用户新 */ // TeacherUser findUser(@Param("dbPos") Integer dbPos, @Param("account") String account, @Param("password") String password); // // List<Organization> searchOrgs(@Param("dbPos") Integer dbPos, @Param("title") String title); // // /** 保存机构*/ // void saveOrg(Organization org); // // // } // // Path: src/main/java/persistent/prestige/modules/edu/model/Organization.java // public class Organization extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "Organization"; // // //columns START // /**title*/ // private java.lang.String title; // // private Integer dbPos; // //columns END // // // // public java.lang.String getTitle() { // return this.title; // } // // public void setTitle(java.lang.String value) { // this.title = value; // } // // public Integer getDbPos() { // return dbPos; // } // // public void setDbPos(Integer dbPos) { // this.dbPos = dbPos; // } // // // // // // } // // Path: src/main/java/persistent/prestige/modules/edu/service/EduDemoService2.java // public interface EduDemoService2 { // // // public Map saveLogin(Integer dbPos, String account, String password); // // /** // * 查组织机构 // * @param title // * @return // */ // public List<Organization> searchOrgs(Integer dbPos, String title); // // // public Organization saveOrg(Integer dbPos, String title); // // // // // } // Path: src/main/java/persistent/prestige/modules/edu/service/impl/EduDemoServiceImpl2.java import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import persistent.prestige.modules.edu.dao.DemoDao; import persistent.prestige.modules.edu.model.Organization; import persistent.prestige.modules.edu.service.EduDemoService2; package persistent.prestige.modules.edu.service.impl; @Service("eduDemoService2") public class EduDemoServiceImpl2 implements EduDemoService2 { @Autowired private DemoDao demoDao; @Override public Map saveLogin(Integer dbPos,String account, String password) { // TODO Auto-generated method stub return null; } @Override
public List<Organization> searchOrgs(Integer dbPos, String title) {
dingwpmz/Mycat-Demo
src/main/java/persistent/prestige/modules/edu/service/EduDemoService2.java
// Path: src/main/java/persistent/prestige/modules/edu/model/Organization.java // public class Organization extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "Organization"; // // //columns START // /**title*/ // private java.lang.String title; // // private Integer dbPos; // //columns END // // // // public java.lang.String getTitle() { // return this.title; // } // // public void setTitle(java.lang.String value) { // this.title = value; // } // // public Integer getDbPos() { // return dbPos; // } // // public void setDbPos(Integer dbPos) { // this.dbPos = dbPos; // } // // // // // // }
import java.util.List; import java.util.Map; import persistent.prestige.modules.edu.model.Organization;
package persistent.prestige.modules.edu.service; public interface EduDemoService2 { public Map saveLogin(Integer dbPos, String account, String password); /** * 查组织机构 * @param title * @return */
// Path: src/main/java/persistent/prestige/modules/edu/model/Organization.java // public class Organization extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "Organization"; // // //columns START // /**title*/ // private java.lang.String title; // // private Integer dbPos; // //columns END // // // // public java.lang.String getTitle() { // return this.title; // } // // public void setTitle(java.lang.String value) { // this.title = value; // } // // public Integer getDbPos() { // return dbPos; // } // // public void setDbPos(Integer dbPos) { // this.dbPos = dbPos; // } // // // // // // } // Path: src/main/java/persistent/prestige/modules/edu/service/EduDemoService2.java import java.util.List; import java.util.Map; import persistent.prestige.modules.edu.model.Organization; package persistent.prestige.modules.edu.service; public interface EduDemoService2 { public Map saveLogin(Integer dbPos, String account, String password); /** * 查组织机构 * @param title * @return */
public List<Organization> searchOrgs(Integer dbPos, String title);
dingwpmz/Mycat-Demo
src/main/java/persistent/prestige/modules/eshop/action/EshopDataInitControl.java
// Path: src/main/java/persistent/prestige/modules/eshop/service/EsDataInitService.java // public interface EsDataInitService { // // void saveInitGoodsData(); // // }
import java.util.HashMap; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import persistent.prestige.modules.eshop.service.EsDataInitService;
package persistent.prestige.modules.eshop.action; /** * 电商平台数据初始化 * @author Administrator * */ @Controller @RequestMapping("/es/data") public class EshopDataInitControl { @Autowired
// Path: src/main/java/persistent/prestige/modules/eshop/service/EsDataInitService.java // public interface EsDataInitService { // // void saveInitGoodsData(); // // } // Path: src/main/java/persistent/prestige/modules/eshop/action/EshopDataInitControl.java import java.util.HashMap; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import persistent.prestige.modules.eshop.service.EsDataInitService; package persistent.prestige.modules.eshop.action; /** * 电商平台数据初始化 * @author Administrator * */ @Controller @RequestMapping("/es/data") public class EshopDataInitControl { @Autowired
private EsDataInitService esDataInitService;
dingwpmz/Mycat-Demo
src/main/java/persistent/prestige/modules/edu/service/impl/DepartmentServiceImpl.java
// Path: src/main/java/persistent/prestige/modules/edu/dao/DepartmentDao.java // @Repository("departmentDao") // @MybatisScan // public interface DepartmentDao extends Dao<Department,java.lang.Integer>{ // // // } // // Path: src/main/java/persistent/prestige/modules/edu/dao/TeacherUserDao.java // @Repository("teacherUserDao") // @MybatisScan // public interface TeacherUserDao extends Dao<TeacherUser,java.lang.Long>{ // // GlobalUser findGlobalUser(String account); // // // List<TeacherUser> findAllUser(); // // // } // // Path: src/main/java/persistent/prestige/modules/edu/model/TeacherUser.java // public class TeacherUser extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "TeacherUser"; // // //columns START // /**account*/ // private java.lang.String account; // /**password*/ // private java.lang.String password; // /**username*/ // private java.lang.String username; // /**sex*/ // private java.lang.Integer sex; // /**delFlag*/ // private java.lang.Integer delFlag; // //columns END // // // // public java.lang.String getAccount() { // return this.account; // } // // public void setAccount(java.lang.String value) { // this.account = value; // } // // public java.lang.String getPassword() { // return this.password; // } // // public void setPassword(java.lang.String value) { // this.password = value; // } // // public java.lang.String getUsername() { // return this.username; // } // // public void setUsername(java.lang.String value) { // this.username = value; // } // // public java.lang.Integer getSex() { // return this.sex; // } // // public void setSex(java.lang.Integer value) { // this.sex = value; // } // // public java.lang.Integer getDelFlag() { // return this.delFlag; // } // // public void setDelFlag(java.lang.Integer value) { // this.delFlag = value; // } // // private Set teacherPossitionUsers = new HashSet(0); // @Transient // public Set<TeacherPossitionUser> getTeacherPossitionUsers() { // return teacherPossitionUsers; // } // public void setTeacherPossitionUsers(Set<TeacherPossitionUser> teacherPossitionUser){ // this.teacherPossitionUsers = teacherPossitionUser; // } // // } // // Path: src/main/java/persistent/prestige/modules/edu/service/DepartmentService.java // public interface DepartmentService { // /** // * 保存信息 // * @param datas // * @return // */ // Integer saveDepartment(Map datas); // }
import java.util.HashMap; import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import persistent.prestige.modules.edu.dao.DepartmentDao; import persistent.prestige.modules.edu.dao.TeacherUserDao; import persistent.prestige.modules.edu.model.TeacherUser; import persistent.prestige.modules.edu.service.DepartmentService;
/* * Powered By agile * Web Site: http://www.agile.com * Since 2008 - 2016 */ package persistent.prestige.modules.edu.service.impl; /** * beanId 为@Service配置中的名称 * modelClass 对应实体类的名称 * type AwareType.SERVICE */ @Service("departmentService") public class DepartmentServiceImpl implements DepartmentService{ @Autowired
// Path: src/main/java/persistent/prestige/modules/edu/dao/DepartmentDao.java // @Repository("departmentDao") // @MybatisScan // public interface DepartmentDao extends Dao<Department,java.lang.Integer>{ // // // } // // Path: src/main/java/persistent/prestige/modules/edu/dao/TeacherUserDao.java // @Repository("teacherUserDao") // @MybatisScan // public interface TeacherUserDao extends Dao<TeacherUser,java.lang.Long>{ // // GlobalUser findGlobalUser(String account); // // // List<TeacherUser> findAllUser(); // // // } // // Path: src/main/java/persistent/prestige/modules/edu/model/TeacherUser.java // public class TeacherUser extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "TeacherUser"; // // //columns START // /**account*/ // private java.lang.String account; // /**password*/ // private java.lang.String password; // /**username*/ // private java.lang.String username; // /**sex*/ // private java.lang.Integer sex; // /**delFlag*/ // private java.lang.Integer delFlag; // //columns END // // // // public java.lang.String getAccount() { // return this.account; // } // // public void setAccount(java.lang.String value) { // this.account = value; // } // // public java.lang.String getPassword() { // return this.password; // } // // public void setPassword(java.lang.String value) { // this.password = value; // } // // public java.lang.String getUsername() { // return this.username; // } // // public void setUsername(java.lang.String value) { // this.username = value; // } // // public java.lang.Integer getSex() { // return this.sex; // } // // public void setSex(java.lang.Integer value) { // this.sex = value; // } // // public java.lang.Integer getDelFlag() { // return this.delFlag; // } // // public void setDelFlag(java.lang.Integer value) { // this.delFlag = value; // } // // private Set teacherPossitionUsers = new HashSet(0); // @Transient // public Set<TeacherPossitionUser> getTeacherPossitionUsers() { // return teacherPossitionUsers; // } // public void setTeacherPossitionUsers(Set<TeacherPossitionUser> teacherPossitionUser){ // this.teacherPossitionUsers = teacherPossitionUser; // } // // } // // Path: src/main/java/persistent/prestige/modules/edu/service/DepartmentService.java // public interface DepartmentService { // /** // * 保存信息 // * @param datas // * @return // */ // Integer saveDepartment(Map datas); // } // Path: src/main/java/persistent/prestige/modules/edu/service/impl/DepartmentServiceImpl.java import java.util.HashMap; import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import persistent.prestige.modules.edu.dao.DepartmentDao; import persistent.prestige.modules.edu.dao.TeacherUserDao; import persistent.prestige.modules.edu.model.TeacherUser; import persistent.prestige.modules.edu.service.DepartmentService; /* * Powered By agile * Web Site: http://www.agile.com * Since 2008 - 2016 */ package persistent.prestige.modules.edu.service.impl; /** * beanId 为@Service配置中的名称 * modelClass 对应实体类的名称 * type AwareType.SERVICE */ @Service("departmentService") public class DepartmentServiceImpl implements DepartmentService{ @Autowired
private DepartmentDao departmentDao;
dingwpmz/Mycat-Demo
src/main/java/persistent/prestige/modules/edu/service/impl/DepartmentServiceImpl.java
// Path: src/main/java/persistent/prestige/modules/edu/dao/DepartmentDao.java // @Repository("departmentDao") // @MybatisScan // public interface DepartmentDao extends Dao<Department,java.lang.Integer>{ // // // } // // Path: src/main/java/persistent/prestige/modules/edu/dao/TeacherUserDao.java // @Repository("teacherUserDao") // @MybatisScan // public interface TeacherUserDao extends Dao<TeacherUser,java.lang.Long>{ // // GlobalUser findGlobalUser(String account); // // // List<TeacherUser> findAllUser(); // // // } // // Path: src/main/java/persistent/prestige/modules/edu/model/TeacherUser.java // public class TeacherUser extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "TeacherUser"; // // //columns START // /**account*/ // private java.lang.String account; // /**password*/ // private java.lang.String password; // /**username*/ // private java.lang.String username; // /**sex*/ // private java.lang.Integer sex; // /**delFlag*/ // private java.lang.Integer delFlag; // //columns END // // // // public java.lang.String getAccount() { // return this.account; // } // // public void setAccount(java.lang.String value) { // this.account = value; // } // // public java.lang.String getPassword() { // return this.password; // } // // public void setPassword(java.lang.String value) { // this.password = value; // } // // public java.lang.String getUsername() { // return this.username; // } // // public void setUsername(java.lang.String value) { // this.username = value; // } // // public java.lang.Integer getSex() { // return this.sex; // } // // public void setSex(java.lang.Integer value) { // this.sex = value; // } // // public java.lang.Integer getDelFlag() { // return this.delFlag; // } // // public void setDelFlag(java.lang.Integer value) { // this.delFlag = value; // } // // private Set teacherPossitionUsers = new HashSet(0); // @Transient // public Set<TeacherPossitionUser> getTeacherPossitionUsers() { // return teacherPossitionUsers; // } // public void setTeacherPossitionUsers(Set<TeacherPossitionUser> teacherPossitionUser){ // this.teacherPossitionUsers = teacherPossitionUser; // } // // } // // Path: src/main/java/persistent/prestige/modules/edu/service/DepartmentService.java // public interface DepartmentService { // /** // * 保存信息 // * @param datas // * @return // */ // Integer saveDepartment(Map datas); // }
import java.util.HashMap; import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import persistent.prestige.modules.edu.dao.DepartmentDao; import persistent.prestige.modules.edu.dao.TeacherUserDao; import persistent.prestige.modules.edu.model.TeacherUser; import persistent.prestige.modules.edu.service.DepartmentService;
/* * Powered By agile * Web Site: http://www.agile.com * Since 2008 - 2016 */ package persistent.prestige.modules.edu.service.impl; /** * beanId 为@Service配置中的名称 * modelClass 对应实体类的名称 * type AwareType.SERVICE */ @Service("departmentService") public class DepartmentServiceImpl implements DepartmentService{ @Autowired private DepartmentDao departmentDao; @Autowired
// Path: src/main/java/persistent/prestige/modules/edu/dao/DepartmentDao.java // @Repository("departmentDao") // @MybatisScan // public interface DepartmentDao extends Dao<Department,java.lang.Integer>{ // // // } // // Path: src/main/java/persistent/prestige/modules/edu/dao/TeacherUserDao.java // @Repository("teacherUserDao") // @MybatisScan // public interface TeacherUserDao extends Dao<TeacherUser,java.lang.Long>{ // // GlobalUser findGlobalUser(String account); // // // List<TeacherUser> findAllUser(); // // // } // // Path: src/main/java/persistent/prestige/modules/edu/model/TeacherUser.java // public class TeacherUser extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "TeacherUser"; // // //columns START // /**account*/ // private java.lang.String account; // /**password*/ // private java.lang.String password; // /**username*/ // private java.lang.String username; // /**sex*/ // private java.lang.Integer sex; // /**delFlag*/ // private java.lang.Integer delFlag; // //columns END // // // // public java.lang.String getAccount() { // return this.account; // } // // public void setAccount(java.lang.String value) { // this.account = value; // } // // public java.lang.String getPassword() { // return this.password; // } // // public void setPassword(java.lang.String value) { // this.password = value; // } // // public java.lang.String getUsername() { // return this.username; // } // // public void setUsername(java.lang.String value) { // this.username = value; // } // // public java.lang.Integer getSex() { // return this.sex; // } // // public void setSex(java.lang.Integer value) { // this.sex = value; // } // // public java.lang.Integer getDelFlag() { // return this.delFlag; // } // // public void setDelFlag(java.lang.Integer value) { // this.delFlag = value; // } // // private Set teacherPossitionUsers = new HashSet(0); // @Transient // public Set<TeacherPossitionUser> getTeacherPossitionUsers() { // return teacherPossitionUsers; // } // public void setTeacherPossitionUsers(Set<TeacherPossitionUser> teacherPossitionUser){ // this.teacherPossitionUsers = teacherPossitionUser; // } // // } // // Path: src/main/java/persistent/prestige/modules/edu/service/DepartmentService.java // public interface DepartmentService { // /** // * 保存信息 // * @param datas // * @return // */ // Integer saveDepartment(Map datas); // } // Path: src/main/java/persistent/prestige/modules/edu/service/impl/DepartmentServiceImpl.java import java.util.HashMap; import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import persistent.prestige.modules.edu.dao.DepartmentDao; import persistent.prestige.modules.edu.dao.TeacherUserDao; import persistent.prestige.modules.edu.model.TeacherUser; import persistent.prestige.modules.edu.service.DepartmentService; /* * Powered By agile * Web Site: http://www.agile.com * Since 2008 - 2016 */ package persistent.prestige.modules.edu.service.impl; /** * beanId 为@Service配置中的名称 * modelClass 对应实体类的名称 * type AwareType.SERVICE */ @Service("departmentService") public class DepartmentServiceImpl implements DepartmentService{ @Autowired private DepartmentDao departmentDao; @Autowired
private TeacherUserDao teacherUserDao;
dingwpmz/Mycat-Demo
src/main/java/persistent/prestige/modules/edu/service/impl/DepartmentServiceImpl.java
// Path: src/main/java/persistent/prestige/modules/edu/dao/DepartmentDao.java // @Repository("departmentDao") // @MybatisScan // public interface DepartmentDao extends Dao<Department,java.lang.Integer>{ // // // } // // Path: src/main/java/persistent/prestige/modules/edu/dao/TeacherUserDao.java // @Repository("teacherUserDao") // @MybatisScan // public interface TeacherUserDao extends Dao<TeacherUser,java.lang.Long>{ // // GlobalUser findGlobalUser(String account); // // // List<TeacherUser> findAllUser(); // // // } // // Path: src/main/java/persistent/prestige/modules/edu/model/TeacherUser.java // public class TeacherUser extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "TeacherUser"; // // //columns START // /**account*/ // private java.lang.String account; // /**password*/ // private java.lang.String password; // /**username*/ // private java.lang.String username; // /**sex*/ // private java.lang.Integer sex; // /**delFlag*/ // private java.lang.Integer delFlag; // //columns END // // // // public java.lang.String getAccount() { // return this.account; // } // // public void setAccount(java.lang.String value) { // this.account = value; // } // // public java.lang.String getPassword() { // return this.password; // } // // public void setPassword(java.lang.String value) { // this.password = value; // } // // public java.lang.String getUsername() { // return this.username; // } // // public void setUsername(java.lang.String value) { // this.username = value; // } // // public java.lang.Integer getSex() { // return this.sex; // } // // public void setSex(java.lang.Integer value) { // this.sex = value; // } // // public java.lang.Integer getDelFlag() { // return this.delFlag; // } // // public void setDelFlag(java.lang.Integer value) { // this.delFlag = value; // } // // private Set teacherPossitionUsers = new HashSet(0); // @Transient // public Set<TeacherPossitionUser> getTeacherPossitionUsers() { // return teacherPossitionUsers; // } // public void setTeacherPossitionUsers(Set<TeacherPossitionUser> teacherPossitionUser){ // this.teacherPossitionUsers = teacherPossitionUser; // } // // } // // Path: src/main/java/persistent/prestige/modules/edu/service/DepartmentService.java // public interface DepartmentService { // /** // * 保存信息 // * @param datas // * @return // */ // Integer saveDepartment(Map datas); // }
import java.util.HashMap; import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import persistent.prestige.modules.edu.dao.DepartmentDao; import persistent.prestige.modules.edu.dao.TeacherUserDao; import persistent.prestige.modules.edu.model.TeacherUser; import persistent.prestige.modules.edu.service.DepartmentService;
/* * Powered By agile * Web Site: http://www.agile.com * Since 2008 - 2016 */ package persistent.prestige.modules.edu.service.impl; /** * beanId 为@Service配置中的名称 * modelClass 对应实体类的名称 * type AwareType.SERVICE */ @Service("departmentService") public class DepartmentServiceImpl implements DepartmentService{ @Autowired private DepartmentDao departmentDao; @Autowired private TeacherUserDao teacherUserDao; @Override public Integer saveDepartment(Map datas) { // TODO Auto-generated method stub Map params = new HashMap();
// Path: src/main/java/persistent/prestige/modules/edu/dao/DepartmentDao.java // @Repository("departmentDao") // @MybatisScan // public interface DepartmentDao extends Dao<Department,java.lang.Integer>{ // // // } // // Path: src/main/java/persistent/prestige/modules/edu/dao/TeacherUserDao.java // @Repository("teacherUserDao") // @MybatisScan // public interface TeacherUserDao extends Dao<TeacherUser,java.lang.Long>{ // // GlobalUser findGlobalUser(String account); // // // List<TeacherUser> findAllUser(); // // // } // // Path: src/main/java/persistent/prestige/modules/edu/model/TeacherUser.java // public class TeacherUser extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "TeacherUser"; // // //columns START // /**account*/ // private java.lang.String account; // /**password*/ // private java.lang.String password; // /**username*/ // private java.lang.String username; // /**sex*/ // private java.lang.Integer sex; // /**delFlag*/ // private java.lang.Integer delFlag; // //columns END // // // // public java.lang.String getAccount() { // return this.account; // } // // public void setAccount(java.lang.String value) { // this.account = value; // } // // public java.lang.String getPassword() { // return this.password; // } // // public void setPassword(java.lang.String value) { // this.password = value; // } // // public java.lang.String getUsername() { // return this.username; // } // // public void setUsername(java.lang.String value) { // this.username = value; // } // // public java.lang.Integer getSex() { // return this.sex; // } // // public void setSex(java.lang.Integer value) { // this.sex = value; // } // // public java.lang.Integer getDelFlag() { // return this.delFlag; // } // // public void setDelFlag(java.lang.Integer value) { // this.delFlag = value; // } // // private Set teacherPossitionUsers = new HashSet(0); // @Transient // public Set<TeacherPossitionUser> getTeacherPossitionUsers() { // return teacherPossitionUsers; // } // public void setTeacherPossitionUsers(Set<TeacherPossitionUser> teacherPossitionUser){ // this.teacherPossitionUsers = teacherPossitionUser; // } // // } // // Path: src/main/java/persistent/prestige/modules/edu/service/DepartmentService.java // public interface DepartmentService { // /** // * 保存信息 // * @param datas // * @return // */ // Integer saveDepartment(Map datas); // } // Path: src/main/java/persistent/prestige/modules/edu/service/impl/DepartmentServiceImpl.java import java.util.HashMap; import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import persistent.prestige.modules.edu.dao.DepartmentDao; import persistent.prestige.modules.edu.dao.TeacherUserDao; import persistent.prestige.modules.edu.model.TeacherUser; import persistent.prestige.modules.edu.service.DepartmentService; /* * Powered By agile * Web Site: http://www.agile.com * Since 2008 - 2016 */ package persistent.prestige.modules.edu.service.impl; /** * beanId 为@Service配置中的名称 * modelClass 对应实体类的名称 * type AwareType.SERVICE */ @Service("departmentService") public class DepartmentServiceImpl implements DepartmentService{ @Autowired private DepartmentDao departmentDao; @Autowired private TeacherUserDao teacherUserDao; @Override public Integer saveDepartment(Map datas) { // TODO Auto-generated method stub Map params = new HashMap();
List<TeacherUser> users = teacherUserDao.query(params);
dingwpmz/Mycat-Demo
src/main/java/persistent/prestige/modules/passport/service/impl/UserServiceImpl.java
// Path: src/main/java/persistent/prestige/modules/passport/dao/UserDao.java // @Repository("userDao") // @MybatisScan // public interface UserDao extends Dao<User, Integer>{ // // public List<AccTest> findAccTest(); // // } // // Path: src/main/java/persistent/prestige/modules/passport/model/AccTest.java // public class AccTest implements Serializable{ // // private Integer id; // // private String name; // // public Integer getId() { // return id; // } // // public void setId(Integer id) { // this.id = id; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // // // } // // Path: src/main/java/persistent/prestige/modules/passport/model/User.java // public class User extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "User"; // // //columns START // /**用户uid*/ // private java.lang.String uid; // /**名称*/ // private java.lang.String name; // /**邮箱*/ // private java.lang.String email; // /**电话号码*/ // private java.lang.String phone; // /**0:禁用;1:启用*/ // private Integer status; // //columns END // // // // public java.lang.String getUid() { // return this.uid; // } // // public void setUid(java.lang.String value) { // this.uid = value; // } // // public java.lang.String getName() { // return this.name; // } // // public void setName(java.lang.String value) { // this.name = value; // } // // public java.lang.String getEmail() { // return this.email; // } // // public void setEmail(java.lang.String value) { // this.email = value; // } // // public java.lang.String getPhone() { // return this.phone; // } // // public void setPhone(java.lang.String value) { // this.phone = value; // } // // public Integer getStatus() { // return this.status; // } // // public void setStatus(Integer value) { // this.status = value; // } // // } // // Path: src/main/java/persistent/prestige/modules/passport/service/UserService.java // public interface UserService { // /** // * 保存信息 // * @param datas // * @return // */ // Integer saveUser(User user); // // /** // * 测试带事务的 // * @return // */ // Integer saveTest(); // // /** // * 测试非事务的 // * @return // */ // Integer listTest(); // } // // Path: src/main/java/persistent/prestige/platform/utils/UUidUtils.java // public class UUidUtils { // // public static final String uuid() { // return UUID.randomUUID().toString().replaceAll("-", ""); // } // // }
import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import persistent.prestige.modules.passport.dao.UserDao; import persistent.prestige.modules.passport.model.AccTest; import persistent.prestige.modules.passport.model.User; import persistent.prestige.modules.passport.service.UserService; import persistent.prestige.platform.utils.UUidUtils;
/* * Powered By agile * Web Site: http://www.agile.com * Since 2008 - 2016 */ package persistent.prestige.modules.passport.service.impl; /** * User service实现类 * @author 雅居乐 2016-8-27 10:00:05 * @version 1.0 */ @Service("userService") /** * beanId 为@Service配置中的名称 * modelClass 对应实体类的名称 * type AwareType.SERVICE */ public class UserServiceImpl implements UserService{ @Autowired
// Path: src/main/java/persistent/prestige/modules/passport/dao/UserDao.java // @Repository("userDao") // @MybatisScan // public interface UserDao extends Dao<User, Integer>{ // // public List<AccTest> findAccTest(); // // } // // Path: src/main/java/persistent/prestige/modules/passport/model/AccTest.java // public class AccTest implements Serializable{ // // private Integer id; // // private String name; // // public Integer getId() { // return id; // } // // public void setId(Integer id) { // this.id = id; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // // // } // // Path: src/main/java/persistent/prestige/modules/passport/model/User.java // public class User extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "User"; // // //columns START // /**用户uid*/ // private java.lang.String uid; // /**名称*/ // private java.lang.String name; // /**邮箱*/ // private java.lang.String email; // /**电话号码*/ // private java.lang.String phone; // /**0:禁用;1:启用*/ // private Integer status; // //columns END // // // // public java.lang.String getUid() { // return this.uid; // } // // public void setUid(java.lang.String value) { // this.uid = value; // } // // public java.lang.String getName() { // return this.name; // } // // public void setName(java.lang.String value) { // this.name = value; // } // // public java.lang.String getEmail() { // return this.email; // } // // public void setEmail(java.lang.String value) { // this.email = value; // } // // public java.lang.String getPhone() { // return this.phone; // } // // public void setPhone(java.lang.String value) { // this.phone = value; // } // // public Integer getStatus() { // return this.status; // } // // public void setStatus(Integer value) { // this.status = value; // } // // } // // Path: src/main/java/persistent/prestige/modules/passport/service/UserService.java // public interface UserService { // /** // * 保存信息 // * @param datas // * @return // */ // Integer saveUser(User user); // // /** // * 测试带事务的 // * @return // */ // Integer saveTest(); // // /** // * 测试非事务的 // * @return // */ // Integer listTest(); // } // // Path: src/main/java/persistent/prestige/platform/utils/UUidUtils.java // public class UUidUtils { // // public static final String uuid() { // return UUID.randomUUID().toString().replaceAll("-", ""); // } // // } // Path: src/main/java/persistent/prestige/modules/passport/service/impl/UserServiceImpl.java import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import persistent.prestige.modules.passport.dao.UserDao; import persistent.prestige.modules.passport.model.AccTest; import persistent.prestige.modules.passport.model.User; import persistent.prestige.modules.passport.service.UserService; import persistent.prestige.platform.utils.UUidUtils; /* * Powered By agile * Web Site: http://www.agile.com * Since 2008 - 2016 */ package persistent.prestige.modules.passport.service.impl; /** * User service实现类 * @author 雅居乐 2016-8-27 10:00:05 * @version 1.0 */ @Service("userService") /** * beanId 为@Service配置中的名称 * modelClass 对应实体类的名称 * type AwareType.SERVICE */ public class UserServiceImpl implements UserService{ @Autowired
private UserDao userDao;
dingwpmz/Mycat-Demo
src/main/java/persistent/prestige/modules/passport/service/impl/UserServiceImpl.java
// Path: src/main/java/persistent/prestige/modules/passport/dao/UserDao.java // @Repository("userDao") // @MybatisScan // public interface UserDao extends Dao<User, Integer>{ // // public List<AccTest> findAccTest(); // // } // // Path: src/main/java/persistent/prestige/modules/passport/model/AccTest.java // public class AccTest implements Serializable{ // // private Integer id; // // private String name; // // public Integer getId() { // return id; // } // // public void setId(Integer id) { // this.id = id; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // // // } // // Path: src/main/java/persistent/prestige/modules/passport/model/User.java // public class User extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "User"; // // //columns START // /**用户uid*/ // private java.lang.String uid; // /**名称*/ // private java.lang.String name; // /**邮箱*/ // private java.lang.String email; // /**电话号码*/ // private java.lang.String phone; // /**0:禁用;1:启用*/ // private Integer status; // //columns END // // // // public java.lang.String getUid() { // return this.uid; // } // // public void setUid(java.lang.String value) { // this.uid = value; // } // // public java.lang.String getName() { // return this.name; // } // // public void setName(java.lang.String value) { // this.name = value; // } // // public java.lang.String getEmail() { // return this.email; // } // // public void setEmail(java.lang.String value) { // this.email = value; // } // // public java.lang.String getPhone() { // return this.phone; // } // // public void setPhone(java.lang.String value) { // this.phone = value; // } // // public Integer getStatus() { // return this.status; // } // // public void setStatus(Integer value) { // this.status = value; // } // // } // // Path: src/main/java/persistent/prestige/modules/passport/service/UserService.java // public interface UserService { // /** // * 保存信息 // * @param datas // * @return // */ // Integer saveUser(User user); // // /** // * 测试带事务的 // * @return // */ // Integer saveTest(); // // /** // * 测试非事务的 // * @return // */ // Integer listTest(); // } // // Path: src/main/java/persistent/prestige/platform/utils/UUidUtils.java // public class UUidUtils { // // public static final String uuid() { // return UUID.randomUUID().toString().replaceAll("-", ""); // } // // }
import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import persistent.prestige.modules.passport.dao.UserDao; import persistent.prestige.modules.passport.model.AccTest; import persistent.prestige.modules.passport.model.User; import persistent.prestige.modules.passport.service.UserService; import persistent.prestige.platform.utils.UUidUtils;
/* * Powered By agile * Web Site: http://www.agile.com * Since 2008 - 2016 */ package persistent.prestige.modules.passport.service.impl; /** * User service实现类 * @author 雅居乐 2016-8-27 10:00:05 * @version 1.0 */ @Service("userService") /** * beanId 为@Service配置中的名称 * modelClass 对应实体类的名称 * type AwareType.SERVICE */ public class UserServiceImpl implements UserService{ @Autowired private UserDao userDao; @Override public Integer saveTest() { /** 测试在事务中,,读走 写节点 start */ // User u = userDao.find(113); // System.out.println(u.getId()); /** 测试在事务中,,读走 写节点 end */ /** 测试Mycat 事务 */
// Path: src/main/java/persistent/prestige/modules/passport/dao/UserDao.java // @Repository("userDao") // @MybatisScan // public interface UserDao extends Dao<User, Integer>{ // // public List<AccTest> findAccTest(); // // } // // Path: src/main/java/persistent/prestige/modules/passport/model/AccTest.java // public class AccTest implements Serializable{ // // private Integer id; // // private String name; // // public Integer getId() { // return id; // } // // public void setId(Integer id) { // this.id = id; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // // // } // // Path: src/main/java/persistent/prestige/modules/passport/model/User.java // public class User extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "User"; // // //columns START // /**用户uid*/ // private java.lang.String uid; // /**名称*/ // private java.lang.String name; // /**邮箱*/ // private java.lang.String email; // /**电话号码*/ // private java.lang.String phone; // /**0:禁用;1:启用*/ // private Integer status; // //columns END // // // // public java.lang.String getUid() { // return this.uid; // } // // public void setUid(java.lang.String value) { // this.uid = value; // } // // public java.lang.String getName() { // return this.name; // } // // public void setName(java.lang.String value) { // this.name = value; // } // // public java.lang.String getEmail() { // return this.email; // } // // public void setEmail(java.lang.String value) { // this.email = value; // } // // public java.lang.String getPhone() { // return this.phone; // } // // public void setPhone(java.lang.String value) { // this.phone = value; // } // // public Integer getStatus() { // return this.status; // } // // public void setStatus(Integer value) { // this.status = value; // } // // } // // Path: src/main/java/persistent/prestige/modules/passport/service/UserService.java // public interface UserService { // /** // * 保存信息 // * @param datas // * @return // */ // Integer saveUser(User user); // // /** // * 测试带事务的 // * @return // */ // Integer saveTest(); // // /** // * 测试非事务的 // * @return // */ // Integer listTest(); // } // // Path: src/main/java/persistent/prestige/platform/utils/UUidUtils.java // public class UUidUtils { // // public static final String uuid() { // return UUID.randomUUID().toString().replaceAll("-", ""); // } // // } // Path: src/main/java/persistent/prestige/modules/passport/service/impl/UserServiceImpl.java import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import persistent.prestige.modules.passport.dao.UserDao; import persistent.prestige.modules.passport.model.AccTest; import persistent.prestige.modules.passport.model.User; import persistent.prestige.modules.passport.service.UserService; import persistent.prestige.platform.utils.UUidUtils; /* * Powered By agile * Web Site: http://www.agile.com * Since 2008 - 2016 */ package persistent.prestige.modules.passport.service.impl; /** * User service实现类 * @author 雅居乐 2016-8-27 10:00:05 * @version 1.0 */ @Service("userService") /** * beanId 为@Service配置中的名称 * modelClass 对应实体类的名称 * type AwareType.SERVICE */ public class UserServiceImpl implements UserService{ @Autowired private UserDao userDao; @Override public Integer saveTest() { /** 测试在事务中,,读走 写节点 start */ // User u = userDao.find(113); // System.out.println(u.getId()); /** 测试在事务中,,读走 写节点 end */ /** 测试Mycat 事务 */
User u = new User();
dingwpmz/Mycat-Demo
src/main/java/persistent/prestige/modules/passport/service/impl/UserServiceImpl.java
// Path: src/main/java/persistent/prestige/modules/passport/dao/UserDao.java // @Repository("userDao") // @MybatisScan // public interface UserDao extends Dao<User, Integer>{ // // public List<AccTest> findAccTest(); // // } // // Path: src/main/java/persistent/prestige/modules/passport/model/AccTest.java // public class AccTest implements Serializable{ // // private Integer id; // // private String name; // // public Integer getId() { // return id; // } // // public void setId(Integer id) { // this.id = id; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // // // } // // Path: src/main/java/persistent/prestige/modules/passport/model/User.java // public class User extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "User"; // // //columns START // /**用户uid*/ // private java.lang.String uid; // /**名称*/ // private java.lang.String name; // /**邮箱*/ // private java.lang.String email; // /**电话号码*/ // private java.lang.String phone; // /**0:禁用;1:启用*/ // private Integer status; // //columns END // // // // public java.lang.String getUid() { // return this.uid; // } // // public void setUid(java.lang.String value) { // this.uid = value; // } // // public java.lang.String getName() { // return this.name; // } // // public void setName(java.lang.String value) { // this.name = value; // } // // public java.lang.String getEmail() { // return this.email; // } // // public void setEmail(java.lang.String value) { // this.email = value; // } // // public java.lang.String getPhone() { // return this.phone; // } // // public void setPhone(java.lang.String value) { // this.phone = value; // } // // public Integer getStatus() { // return this.status; // } // // public void setStatus(Integer value) { // this.status = value; // } // // } // // Path: src/main/java/persistent/prestige/modules/passport/service/UserService.java // public interface UserService { // /** // * 保存信息 // * @param datas // * @return // */ // Integer saveUser(User user); // // /** // * 测试带事务的 // * @return // */ // Integer saveTest(); // // /** // * 测试非事务的 // * @return // */ // Integer listTest(); // } // // Path: src/main/java/persistent/prestige/platform/utils/UUidUtils.java // public class UUidUtils { // // public static final String uuid() { // return UUID.randomUUID().toString().replaceAll("-", ""); // } // // }
import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import persistent.prestige.modules.passport.dao.UserDao; import persistent.prestige.modules.passport.model.AccTest; import persistent.prestige.modules.passport.model.User; import persistent.prestige.modules.passport.service.UserService; import persistent.prestige.platform.utils.UUidUtils;
/* * Powered By agile * Web Site: http://www.agile.com * Since 2008 - 2016 */ package persistent.prestige.modules.passport.service.impl; /** * User service实现类 * @author 雅居乐 2016-8-27 10:00:05 * @version 1.0 */ @Service("userService") /** * beanId 为@Service配置中的名称 * modelClass 对应实体类的名称 * type AwareType.SERVICE */ public class UserServiceImpl implements UserService{ @Autowired private UserDao userDao; @Override public Integer saveTest() { /** 测试在事务中,,读走 写节点 start */ // User u = userDao.find(113); // System.out.println(u.getId()); /** 测试在事务中,,读走 写节点 end */ /** 测试Mycat 事务 */ User u = new User(); u.setCreateTime(new Date(System.currentTimeMillis()));
// Path: src/main/java/persistent/prestige/modules/passport/dao/UserDao.java // @Repository("userDao") // @MybatisScan // public interface UserDao extends Dao<User, Integer>{ // // public List<AccTest> findAccTest(); // // } // // Path: src/main/java/persistent/prestige/modules/passport/model/AccTest.java // public class AccTest implements Serializable{ // // private Integer id; // // private String name; // // public Integer getId() { // return id; // } // // public void setId(Integer id) { // this.id = id; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // // // } // // Path: src/main/java/persistent/prestige/modules/passport/model/User.java // public class User extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "User"; // // //columns START // /**用户uid*/ // private java.lang.String uid; // /**名称*/ // private java.lang.String name; // /**邮箱*/ // private java.lang.String email; // /**电话号码*/ // private java.lang.String phone; // /**0:禁用;1:启用*/ // private Integer status; // //columns END // // // // public java.lang.String getUid() { // return this.uid; // } // // public void setUid(java.lang.String value) { // this.uid = value; // } // // public java.lang.String getName() { // return this.name; // } // // public void setName(java.lang.String value) { // this.name = value; // } // // public java.lang.String getEmail() { // return this.email; // } // // public void setEmail(java.lang.String value) { // this.email = value; // } // // public java.lang.String getPhone() { // return this.phone; // } // // public void setPhone(java.lang.String value) { // this.phone = value; // } // // public Integer getStatus() { // return this.status; // } // // public void setStatus(Integer value) { // this.status = value; // } // // } // // Path: src/main/java/persistent/prestige/modules/passport/service/UserService.java // public interface UserService { // /** // * 保存信息 // * @param datas // * @return // */ // Integer saveUser(User user); // // /** // * 测试带事务的 // * @return // */ // Integer saveTest(); // // /** // * 测试非事务的 // * @return // */ // Integer listTest(); // } // // Path: src/main/java/persistent/prestige/platform/utils/UUidUtils.java // public class UUidUtils { // // public static final String uuid() { // return UUID.randomUUID().toString().replaceAll("-", ""); // } // // } // Path: src/main/java/persistent/prestige/modules/passport/service/impl/UserServiceImpl.java import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import persistent.prestige.modules.passport.dao.UserDao; import persistent.prestige.modules.passport.model.AccTest; import persistent.prestige.modules.passport.model.User; import persistent.prestige.modules.passport.service.UserService; import persistent.prestige.platform.utils.UUidUtils; /* * Powered By agile * Web Site: http://www.agile.com * Since 2008 - 2016 */ package persistent.prestige.modules.passport.service.impl; /** * User service实现类 * @author 雅居乐 2016-8-27 10:00:05 * @version 1.0 */ @Service("userService") /** * beanId 为@Service配置中的名称 * modelClass 对应实体类的名称 * type AwareType.SERVICE */ public class UserServiceImpl implements UserService{ @Autowired private UserDao userDao; @Override public Integer saveTest() { /** 测试在事务中,,读走 写节点 start */ // User u = userDao.find(113); // System.out.println(u.getId()); /** 测试在事务中,,读走 写节点 end */ /** 测试Mycat 事务 */ User u = new User(); u.setCreateTime(new Date(System.currentTimeMillis()));
u.setUid(UUidUtils.uuid());
dingwpmz/Mycat-Demo
src/main/java/persistent/prestige/modules/eshop/action/OrderItemControl.java
// Path: src/main/java/persistent/prestige/modules/eshop/service/OrderItemService.java // public interface OrderItemService { // /** // * 保存信息 // * @param datas // * @return // */ // Integer saveOrderItem(Map datas); // }
import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import persistent.prestige.modules.eshop.service.OrderItemService;
/* * Powered By agile * Web Site: http://www.agile.com * Since 2008 - 2016 */ package persistent.prestige.modules.eshop.action; /** * OrderItem控制类 * @author 雅居乐 2016-8-27 10:31:06 * @version 1.0 */ @Controller @RequestMapping("/passport/orderitem") public class OrderItemControl { @Autowired
// Path: src/main/java/persistent/prestige/modules/eshop/service/OrderItemService.java // public interface OrderItemService { // /** // * 保存信息 // * @param datas // * @return // */ // Integer saveOrderItem(Map datas); // } // Path: src/main/java/persistent/prestige/modules/eshop/action/OrderItemControl.java import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import persistent.prestige.modules.eshop.service.OrderItemService; /* * Powered By agile * Web Site: http://www.agile.com * Since 2008 - 2016 */ package persistent.prestige.modules.eshop.action; /** * OrderItem控制类 * @author 雅居乐 2016-8-27 10:31:06 * @version 1.0 */ @Controller @RequestMapping("/passport/orderitem") public class OrderItemControl { @Autowired
private OrderItemService orderItemService;
dingwpmz/Mycat-Demo
src/main/java/persistent/prestige/modules/edu/service/impl/OrganizationServiceImpl.java
// Path: src/main/java/persistent/prestige/modules/edu/dao/OrganizationDao.java // @Repository("organizationDao") // @MybatisScan // public interface OrganizationDao extends Dao<Organization,java.lang.Integer>{ // // // } // // Path: src/main/java/persistent/prestige/modules/edu/service/OrganizationService.java // public interface OrganizationService{ // /** // * 保存信息 // * @param datas // * @return // */ // Integer saveOrganization(Map datas); // }
import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import persistent.prestige.modules.edu.dao.OrganizationDao; import persistent.prestige.modules.edu.service.OrganizationService;
/* * Powered By agile * Web Site: http://www.agile.com * Since 2008 - 2016 */ package persistent.prestige.modules.edu.service.impl; /** * beanId 为@Service配置中的名称 * modelClass 对应实体类的名称 * type AwareType.SERVICE */ @Service("organizationService") public class OrganizationServiceImpl implements OrganizationService{ @Autowired
// Path: src/main/java/persistent/prestige/modules/edu/dao/OrganizationDao.java // @Repository("organizationDao") // @MybatisScan // public interface OrganizationDao extends Dao<Organization,java.lang.Integer>{ // // // } // // Path: src/main/java/persistent/prestige/modules/edu/service/OrganizationService.java // public interface OrganizationService{ // /** // * 保存信息 // * @param datas // * @return // */ // Integer saveOrganization(Map datas); // } // Path: src/main/java/persistent/prestige/modules/edu/service/impl/OrganizationServiceImpl.java import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import persistent.prestige.modules.edu.dao.OrganizationDao; import persistent.prestige.modules.edu.service.OrganizationService; /* * Powered By agile * Web Site: http://www.agile.com * Since 2008 - 2016 */ package persistent.prestige.modules.edu.service.impl; /** * beanId 为@Service配置中的名称 * modelClass 对应实体类的名称 * type AwareType.SERVICE */ @Service("organizationService") public class OrganizationServiceImpl implements OrganizationService{ @Autowired
private OrganizationDao organizationDao;
dingwpmz/Mycat-Demo
src/main/java/persistent/prestige/modules/eshop/dao/GoodsDao.java
// Path: src/main/java/persistent/prestige/modules/eshop/model/Goods.java // public class Goods extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "Goods"; // // //columns START // /**商品分类id*/ // private java.lang.Integer goodsClassId; // /**商品名称*/ // private java.lang.String goodsName; // /**商品默认图片*/ // private java.lang.String goodsImgKey; // /**商品描述*/ // private java.lang.String goodsDesc; // /**状态1:启用;0禁用*/ // private Integer status; // //columns END // // // // public java.lang.Integer getGoodsClassId() { // return this.goodsClassId; // } // // public void setGoodsClassId(java.lang.Integer value) { // this.goodsClassId = value; // } // // public java.lang.String getGoodsName() { // return this.goodsName; // } // // public void setGoodsName(java.lang.String value) { // this.goodsName = value; // } // // public java.lang.String getGoodsImgKey() { // return this.goodsImgKey; // } // // public void setGoodsImgKey(java.lang.String value) { // this.goodsImgKey = value; // } // // public java.lang.String getGoodsDesc() { // return this.goodsDesc; // } // // public void setGoodsDesc(java.lang.String value) { // this.goodsDesc = value; // } // // public Integer getStatus() { // return this.status; // } // // public void setStatus(Integer value) { // this.status = value; // } // // } // // Path: src/main/java/persistent/prestige/platform/base/dao/Dao.java // @MybatisScan // public interface Dao<T extends Entity, PK extends Serializable> extends Serializable { // /** // * 根据主键查找 // * @param id // * @return // */ // T find(PK id); // // /** // * // * @param ids // * @return // */ // List<T> findByIds(PK[] ids); // // /** // * 根据查询条件查找 // * @param params // * @return // */ // List<T> query(Map params); // // /** // * 查询总数 // * @return // */ // Long countAll(); // // /** // * 查询总数 // * @return // */ // Long count(Map params); // // /** // * 增加新实体 // * 主键值会自动填充到entity // * @param entity // */ // void create(Object entity); // // /** // * 更新实体 // * @param entity // * @return // */ // int update(Object entity); // // // /** // * 根据ID 删除实体 // * // * @param id // */ // void deleteById(PK id); // // /** // * 此处不想设计成 T entity,主要是考虑在前端需要创建对象实体,设计成Map,灵活性更高 // * @param entity // */ // void delete(Map params); // // /** 树型节点 方法 start */ // T findRoot(); // // List<T> findRoots(Map params); // // /** // * 根据code 获取所有节点(包括子孙节点) // * @param code // * @return // */ // List<T> findAllChilds(String code); // // /** // * 根据父节点获取所有直接子节点 // * @param parentId // * @return // */ // List<T> findChilds(Integer parentId); // /** 树型节点 方法 end */ // // void createExcelBatch(List<Map> datas); // // // }
import org.springframework.stereotype.Repository; import persistent.prestige.modules.eshop.model.Goods; import persistent.prestige.platform.api.annotation.MybatisScan; import persistent.prestige.platform.base.dao.Dao;
/* * Powered By agile * Web Site: http://www.agile.com * Since 2008 - 2016 */ package persistent.prestige.modules.eshop.dao; /** * Goods DAO类 * @author 雅居乐 2016-8-31 20:41:39 * @version 1.0 */ @Repository("goodsDao") @MybatisScan
// Path: src/main/java/persistent/prestige/modules/eshop/model/Goods.java // public class Goods extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "Goods"; // // //columns START // /**商品分类id*/ // private java.lang.Integer goodsClassId; // /**商品名称*/ // private java.lang.String goodsName; // /**商品默认图片*/ // private java.lang.String goodsImgKey; // /**商品描述*/ // private java.lang.String goodsDesc; // /**状态1:启用;0禁用*/ // private Integer status; // //columns END // // // // public java.lang.Integer getGoodsClassId() { // return this.goodsClassId; // } // // public void setGoodsClassId(java.lang.Integer value) { // this.goodsClassId = value; // } // // public java.lang.String getGoodsName() { // return this.goodsName; // } // // public void setGoodsName(java.lang.String value) { // this.goodsName = value; // } // // public java.lang.String getGoodsImgKey() { // return this.goodsImgKey; // } // // public void setGoodsImgKey(java.lang.String value) { // this.goodsImgKey = value; // } // // public java.lang.String getGoodsDesc() { // return this.goodsDesc; // } // // public void setGoodsDesc(java.lang.String value) { // this.goodsDesc = value; // } // // public Integer getStatus() { // return this.status; // } // // public void setStatus(Integer value) { // this.status = value; // } // // } // // Path: src/main/java/persistent/prestige/platform/base/dao/Dao.java // @MybatisScan // public interface Dao<T extends Entity, PK extends Serializable> extends Serializable { // /** // * 根据主键查找 // * @param id // * @return // */ // T find(PK id); // // /** // * // * @param ids // * @return // */ // List<T> findByIds(PK[] ids); // // /** // * 根据查询条件查找 // * @param params // * @return // */ // List<T> query(Map params); // // /** // * 查询总数 // * @return // */ // Long countAll(); // // /** // * 查询总数 // * @return // */ // Long count(Map params); // // /** // * 增加新实体 // * 主键值会自动填充到entity // * @param entity // */ // void create(Object entity); // // /** // * 更新实体 // * @param entity // * @return // */ // int update(Object entity); // // // /** // * 根据ID 删除实体 // * // * @param id // */ // void deleteById(PK id); // // /** // * 此处不想设计成 T entity,主要是考虑在前端需要创建对象实体,设计成Map,灵活性更高 // * @param entity // */ // void delete(Map params); // // /** 树型节点 方法 start */ // T findRoot(); // // List<T> findRoots(Map params); // // /** // * 根据code 获取所有节点(包括子孙节点) // * @param code // * @return // */ // List<T> findAllChilds(String code); // // /** // * 根据父节点获取所有直接子节点 // * @param parentId // * @return // */ // List<T> findChilds(Integer parentId); // /** 树型节点 方法 end */ // // void createExcelBatch(List<Map> datas); // // // } // Path: src/main/java/persistent/prestige/modules/eshop/dao/GoodsDao.java import org.springframework.stereotype.Repository; import persistent.prestige.modules.eshop.model.Goods; import persistent.prestige.platform.api.annotation.MybatisScan; import persistent.prestige.platform.base.dao.Dao; /* * Powered By agile * Web Site: http://www.agile.com * Since 2008 - 2016 */ package persistent.prestige.modules.eshop.dao; /** * Goods DAO类 * @author 雅居乐 2016-8-31 20:41:39 * @version 1.0 */ @Repository("goodsDao") @MybatisScan
public interface GoodsDao extends Dao<Goods,java.lang.Integer>{
dingwpmz/Mycat-Demo
src/main/java/persistent/prestige/modules/eshop/dao/GoodsDao.java
// Path: src/main/java/persistent/prestige/modules/eshop/model/Goods.java // public class Goods extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "Goods"; // // //columns START // /**商品分类id*/ // private java.lang.Integer goodsClassId; // /**商品名称*/ // private java.lang.String goodsName; // /**商品默认图片*/ // private java.lang.String goodsImgKey; // /**商品描述*/ // private java.lang.String goodsDesc; // /**状态1:启用;0禁用*/ // private Integer status; // //columns END // // // // public java.lang.Integer getGoodsClassId() { // return this.goodsClassId; // } // // public void setGoodsClassId(java.lang.Integer value) { // this.goodsClassId = value; // } // // public java.lang.String getGoodsName() { // return this.goodsName; // } // // public void setGoodsName(java.lang.String value) { // this.goodsName = value; // } // // public java.lang.String getGoodsImgKey() { // return this.goodsImgKey; // } // // public void setGoodsImgKey(java.lang.String value) { // this.goodsImgKey = value; // } // // public java.lang.String getGoodsDesc() { // return this.goodsDesc; // } // // public void setGoodsDesc(java.lang.String value) { // this.goodsDesc = value; // } // // public Integer getStatus() { // return this.status; // } // // public void setStatus(Integer value) { // this.status = value; // } // // } // // Path: src/main/java/persistent/prestige/platform/base/dao/Dao.java // @MybatisScan // public interface Dao<T extends Entity, PK extends Serializable> extends Serializable { // /** // * 根据主键查找 // * @param id // * @return // */ // T find(PK id); // // /** // * // * @param ids // * @return // */ // List<T> findByIds(PK[] ids); // // /** // * 根据查询条件查找 // * @param params // * @return // */ // List<T> query(Map params); // // /** // * 查询总数 // * @return // */ // Long countAll(); // // /** // * 查询总数 // * @return // */ // Long count(Map params); // // /** // * 增加新实体 // * 主键值会自动填充到entity // * @param entity // */ // void create(Object entity); // // /** // * 更新实体 // * @param entity // * @return // */ // int update(Object entity); // // // /** // * 根据ID 删除实体 // * // * @param id // */ // void deleteById(PK id); // // /** // * 此处不想设计成 T entity,主要是考虑在前端需要创建对象实体,设计成Map,灵活性更高 // * @param entity // */ // void delete(Map params); // // /** 树型节点 方法 start */ // T findRoot(); // // List<T> findRoots(Map params); // // /** // * 根据code 获取所有节点(包括子孙节点) // * @param code // * @return // */ // List<T> findAllChilds(String code); // // /** // * 根据父节点获取所有直接子节点 // * @param parentId // * @return // */ // List<T> findChilds(Integer parentId); // /** 树型节点 方法 end */ // // void createExcelBatch(List<Map> datas); // // // }
import org.springframework.stereotype.Repository; import persistent.prestige.modules.eshop.model.Goods; import persistent.prestige.platform.api.annotation.MybatisScan; import persistent.prestige.platform.base.dao.Dao;
/* * Powered By agile * Web Site: http://www.agile.com * Since 2008 - 2016 */ package persistent.prestige.modules.eshop.dao; /** * Goods DAO类 * @author 雅居乐 2016-8-31 20:41:39 * @version 1.0 */ @Repository("goodsDao") @MybatisScan
// Path: src/main/java/persistent/prestige/modules/eshop/model/Goods.java // public class Goods extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "Goods"; // // //columns START // /**商品分类id*/ // private java.lang.Integer goodsClassId; // /**商品名称*/ // private java.lang.String goodsName; // /**商品默认图片*/ // private java.lang.String goodsImgKey; // /**商品描述*/ // private java.lang.String goodsDesc; // /**状态1:启用;0禁用*/ // private Integer status; // //columns END // // // // public java.lang.Integer getGoodsClassId() { // return this.goodsClassId; // } // // public void setGoodsClassId(java.lang.Integer value) { // this.goodsClassId = value; // } // // public java.lang.String getGoodsName() { // return this.goodsName; // } // // public void setGoodsName(java.lang.String value) { // this.goodsName = value; // } // // public java.lang.String getGoodsImgKey() { // return this.goodsImgKey; // } // // public void setGoodsImgKey(java.lang.String value) { // this.goodsImgKey = value; // } // // public java.lang.String getGoodsDesc() { // return this.goodsDesc; // } // // public void setGoodsDesc(java.lang.String value) { // this.goodsDesc = value; // } // // public Integer getStatus() { // return this.status; // } // // public void setStatus(Integer value) { // this.status = value; // } // // } // // Path: src/main/java/persistent/prestige/platform/base/dao/Dao.java // @MybatisScan // public interface Dao<T extends Entity, PK extends Serializable> extends Serializable { // /** // * 根据主键查找 // * @param id // * @return // */ // T find(PK id); // // /** // * // * @param ids // * @return // */ // List<T> findByIds(PK[] ids); // // /** // * 根据查询条件查找 // * @param params // * @return // */ // List<T> query(Map params); // // /** // * 查询总数 // * @return // */ // Long countAll(); // // /** // * 查询总数 // * @return // */ // Long count(Map params); // // /** // * 增加新实体 // * 主键值会自动填充到entity // * @param entity // */ // void create(Object entity); // // /** // * 更新实体 // * @param entity // * @return // */ // int update(Object entity); // // // /** // * 根据ID 删除实体 // * // * @param id // */ // void deleteById(PK id); // // /** // * 此处不想设计成 T entity,主要是考虑在前端需要创建对象实体,设计成Map,灵活性更高 // * @param entity // */ // void delete(Map params); // // /** 树型节点 方法 start */ // T findRoot(); // // List<T> findRoots(Map params); // // /** // * 根据code 获取所有节点(包括子孙节点) // * @param code // * @return // */ // List<T> findAllChilds(String code); // // /** // * 根据父节点获取所有直接子节点 // * @param parentId // * @return // */ // List<T> findChilds(Integer parentId); // /** 树型节点 方法 end */ // // void createExcelBatch(List<Map> datas); // // // } // Path: src/main/java/persistent/prestige/modules/eshop/dao/GoodsDao.java import org.springframework.stereotype.Repository; import persistent.prestige.modules.eshop.model.Goods; import persistent.prestige.platform.api.annotation.MybatisScan; import persistent.prestige.platform.base.dao.Dao; /* * Powered By agile * Web Site: http://www.agile.com * Since 2008 - 2016 */ package persistent.prestige.modules.eshop.dao; /** * Goods DAO类 * @author 雅居乐 2016-8-31 20:41:39 * @version 1.0 */ @Repository("goodsDao") @MybatisScan
public interface GoodsDao extends Dao<Goods,java.lang.Integer>{
dingwpmz/Mycat-Demo
src/main/java/persistent/prestige/platform/mybatis/Interceptor/TenantInterceptor.java
// Path: src/main/java/persistent/prestige/modules/common/tenant/TenantContextHolder.java // public class TenantContextHolder { // // private static ThreadLocal<String> tenanThreadLocal = new ThreadLocal<String>(); // // public static final void setTenant(String scheme) { // tenanThreadLocal.set(scheme); // } // // public static final String getTenant() { // String scheme = tenanThreadLocal.get(); // if (scheme == null) { // scheme = ""; // } // return scheme; // } // // public static final void remove() { // tenanThreadLocal.remove(); // } // // } // // Path: src/main/java/persistent/prestige/modules/edu/dao/TeacherUserDao.java // @Repository("teacherUserDao") // @MybatisScan // public interface TeacherUserDao extends Dao<TeacherUser,java.lang.Long>{ // // GlobalUser findGlobalUser(String account); // // // List<TeacherUser> findAllUser(); // // // }
import java.sql.Connection; import java.util.Properties; import org.apache.ibatis.executor.statement.RoutingStatementHandler; import org.apache.ibatis.executor.statement.StatementHandler; import org.apache.ibatis.mapping.BoundSql; import org.apache.ibatis.mapping.MappedStatement; import org.apache.ibatis.plugin.Interceptor; import org.apache.ibatis.plugin.Intercepts; import org.apache.ibatis.plugin.Invocation; import org.apache.ibatis.plugin.Plugin; import org.apache.ibatis.plugin.Signature; import org.apache.kahadb.page.Page; import org.springframework.beans.factory.annotation.Autowired; import persistent.prestige.modules.common.tenant.TenantContextHolder; import persistent.prestige.modules.edu.dao.TeacherUserDao;
package persistent.prestige.platform.mybatis.Interceptor; @Intercepts({ @Signature(type = StatementHandler.class, method = "prepare", args = { Connection.class }) }) public class TenantInterceptor implements Interceptor { @Override public Object intercept(Invocation invocation) throws Throwable {
// Path: src/main/java/persistent/prestige/modules/common/tenant/TenantContextHolder.java // public class TenantContextHolder { // // private static ThreadLocal<String> tenanThreadLocal = new ThreadLocal<String>(); // // public static final void setTenant(String scheme) { // tenanThreadLocal.set(scheme); // } // // public static final String getTenant() { // String scheme = tenanThreadLocal.get(); // if (scheme == null) { // scheme = ""; // } // return scheme; // } // // public static final void remove() { // tenanThreadLocal.remove(); // } // // } // // Path: src/main/java/persistent/prestige/modules/edu/dao/TeacherUserDao.java // @Repository("teacherUserDao") // @MybatisScan // public interface TeacherUserDao extends Dao<TeacherUser,java.lang.Long>{ // // GlobalUser findGlobalUser(String account); // // // List<TeacherUser> findAllUser(); // // // } // Path: src/main/java/persistent/prestige/platform/mybatis/Interceptor/TenantInterceptor.java import java.sql.Connection; import java.util.Properties; import org.apache.ibatis.executor.statement.RoutingStatementHandler; import org.apache.ibatis.executor.statement.StatementHandler; import org.apache.ibatis.mapping.BoundSql; import org.apache.ibatis.mapping.MappedStatement; import org.apache.ibatis.plugin.Interceptor; import org.apache.ibatis.plugin.Intercepts; import org.apache.ibatis.plugin.Invocation; import org.apache.ibatis.plugin.Plugin; import org.apache.ibatis.plugin.Signature; import org.apache.kahadb.page.Page; import org.springframework.beans.factory.annotation.Autowired; import persistent.prestige.modules.common.tenant.TenantContextHolder; import persistent.prestige.modules.edu.dao.TeacherUserDao; package persistent.prestige.platform.mybatis.Interceptor; @Intercepts({ @Signature(type = StatementHandler.class, method = "prepare", args = { Connection.class }) }) public class TenantInterceptor implements Interceptor { @Override public Object intercept(Invocation invocation) throws Throwable {
String tenant = TenantContextHolder.getTenant();
dingwpmz/Mycat-Demo
src/main/java/persistent/prestige/modules/edu/dao/DepartmentDao.java
// Path: src/main/java/persistent/prestige/modules/edu/model/Department.java // public class Department extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "Department"; // // //columns START // /**title*/ // private java.lang.String title; // //columns END // // // // // // public java.lang.String getTitle() { // return this.title; // } // // public void setTitle(java.lang.String value) { // this.title = value; // } // // } // // Path: src/main/java/persistent/prestige/platform/base/dao/Dao.java // @MybatisScan // public interface Dao<T extends Entity, PK extends Serializable> extends Serializable { // /** // * 根据主键查找 // * @param id // * @return // */ // T find(PK id); // // /** // * // * @param ids // * @return // */ // List<T> findByIds(PK[] ids); // // /** // * 根据查询条件查找 // * @param params // * @return // */ // List<T> query(Map params); // // /** // * 查询总数 // * @return // */ // Long countAll(); // // /** // * 查询总数 // * @return // */ // Long count(Map params); // // /** // * 增加新实体 // * 主键值会自动填充到entity // * @param entity // */ // void create(Object entity); // // /** // * 更新实体 // * @param entity // * @return // */ // int update(Object entity); // // // /** // * 根据ID 删除实体 // * // * @param id // */ // void deleteById(PK id); // // /** // * 此处不想设计成 T entity,主要是考虑在前端需要创建对象实体,设计成Map,灵活性更高 // * @param entity // */ // void delete(Map params); // // /** 树型节点 方法 start */ // T findRoot(); // // List<T> findRoots(Map params); // // /** // * 根据code 获取所有节点(包括子孙节点) // * @param code // * @return // */ // List<T> findAllChilds(String code); // // /** // * 根据父节点获取所有直接子节点 // * @param parentId // * @return // */ // List<T> findChilds(Integer parentId); // /** 树型节点 方法 end */ // // void createExcelBatch(List<Map> datas); // // // }
import org.springframework.stereotype.Repository; import persistent.prestige.modules.edu.model.Department; import persistent.prestige.platform.api.annotation.MybatisScan; import persistent.prestige.platform.base.dao.Dao;
/* * Powered By agile * Web Site: http://www.agile.com * Since 2008 - 2016 */ package persistent.prestige.modules.edu.dao; /** * Department DAO类 * @author 雅居乐 2016-9-10 22:21:19 * @version 1.0 */ @Repository("departmentDao") @MybatisScan
// Path: src/main/java/persistent/prestige/modules/edu/model/Department.java // public class Department extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "Department"; // // //columns START // /**title*/ // private java.lang.String title; // //columns END // // // // // // public java.lang.String getTitle() { // return this.title; // } // // public void setTitle(java.lang.String value) { // this.title = value; // } // // } // // Path: src/main/java/persistent/prestige/platform/base/dao/Dao.java // @MybatisScan // public interface Dao<T extends Entity, PK extends Serializable> extends Serializable { // /** // * 根据主键查找 // * @param id // * @return // */ // T find(PK id); // // /** // * // * @param ids // * @return // */ // List<T> findByIds(PK[] ids); // // /** // * 根据查询条件查找 // * @param params // * @return // */ // List<T> query(Map params); // // /** // * 查询总数 // * @return // */ // Long countAll(); // // /** // * 查询总数 // * @return // */ // Long count(Map params); // // /** // * 增加新实体 // * 主键值会自动填充到entity // * @param entity // */ // void create(Object entity); // // /** // * 更新实体 // * @param entity // * @return // */ // int update(Object entity); // // // /** // * 根据ID 删除实体 // * // * @param id // */ // void deleteById(PK id); // // /** // * 此处不想设计成 T entity,主要是考虑在前端需要创建对象实体,设计成Map,灵活性更高 // * @param entity // */ // void delete(Map params); // // /** 树型节点 方法 start */ // T findRoot(); // // List<T> findRoots(Map params); // // /** // * 根据code 获取所有节点(包括子孙节点) // * @param code // * @return // */ // List<T> findAllChilds(String code); // // /** // * 根据父节点获取所有直接子节点 // * @param parentId // * @return // */ // List<T> findChilds(Integer parentId); // /** 树型节点 方法 end */ // // void createExcelBatch(List<Map> datas); // // // } // Path: src/main/java/persistent/prestige/modules/edu/dao/DepartmentDao.java import org.springframework.stereotype.Repository; import persistent.prestige.modules.edu.model.Department; import persistent.prestige.platform.api.annotation.MybatisScan; import persistent.prestige.platform.base.dao.Dao; /* * Powered By agile * Web Site: http://www.agile.com * Since 2008 - 2016 */ package persistent.prestige.modules.edu.dao; /** * Department DAO类 * @author 雅居乐 2016-9-10 22:21:19 * @version 1.0 */ @Repository("departmentDao") @MybatisScan
public interface DepartmentDao extends Dao<Department,java.lang.Integer>{
dingwpmz/Mycat-Demo
src/main/java/persistent/prestige/modules/edu/dao/DepartmentDao.java
// Path: src/main/java/persistent/prestige/modules/edu/model/Department.java // public class Department extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "Department"; // // //columns START // /**title*/ // private java.lang.String title; // //columns END // // // // // // public java.lang.String getTitle() { // return this.title; // } // // public void setTitle(java.lang.String value) { // this.title = value; // } // // } // // Path: src/main/java/persistent/prestige/platform/base/dao/Dao.java // @MybatisScan // public interface Dao<T extends Entity, PK extends Serializable> extends Serializable { // /** // * 根据主键查找 // * @param id // * @return // */ // T find(PK id); // // /** // * // * @param ids // * @return // */ // List<T> findByIds(PK[] ids); // // /** // * 根据查询条件查找 // * @param params // * @return // */ // List<T> query(Map params); // // /** // * 查询总数 // * @return // */ // Long countAll(); // // /** // * 查询总数 // * @return // */ // Long count(Map params); // // /** // * 增加新实体 // * 主键值会自动填充到entity // * @param entity // */ // void create(Object entity); // // /** // * 更新实体 // * @param entity // * @return // */ // int update(Object entity); // // // /** // * 根据ID 删除实体 // * // * @param id // */ // void deleteById(PK id); // // /** // * 此处不想设计成 T entity,主要是考虑在前端需要创建对象实体,设计成Map,灵活性更高 // * @param entity // */ // void delete(Map params); // // /** 树型节点 方法 start */ // T findRoot(); // // List<T> findRoots(Map params); // // /** // * 根据code 获取所有节点(包括子孙节点) // * @param code // * @return // */ // List<T> findAllChilds(String code); // // /** // * 根据父节点获取所有直接子节点 // * @param parentId // * @return // */ // List<T> findChilds(Integer parentId); // /** 树型节点 方法 end */ // // void createExcelBatch(List<Map> datas); // // // }
import org.springframework.stereotype.Repository; import persistent.prestige.modules.edu.model.Department; import persistent.prestige.platform.api.annotation.MybatisScan; import persistent.prestige.platform.base.dao.Dao;
/* * Powered By agile * Web Site: http://www.agile.com * Since 2008 - 2016 */ package persistent.prestige.modules.edu.dao; /** * Department DAO类 * @author 雅居乐 2016-9-10 22:21:19 * @version 1.0 */ @Repository("departmentDao") @MybatisScan
// Path: src/main/java/persistent/prestige/modules/edu/model/Department.java // public class Department extends AuditableModel{ // // //alias // public static final String TABLE_ALIAS = "Department"; // // //columns START // /**title*/ // private java.lang.String title; // //columns END // // // // // // public java.lang.String getTitle() { // return this.title; // } // // public void setTitle(java.lang.String value) { // this.title = value; // } // // } // // Path: src/main/java/persistent/prestige/platform/base/dao/Dao.java // @MybatisScan // public interface Dao<T extends Entity, PK extends Serializable> extends Serializable { // /** // * 根据主键查找 // * @param id // * @return // */ // T find(PK id); // // /** // * // * @param ids // * @return // */ // List<T> findByIds(PK[] ids); // // /** // * 根据查询条件查找 // * @param params // * @return // */ // List<T> query(Map params); // // /** // * 查询总数 // * @return // */ // Long countAll(); // // /** // * 查询总数 // * @return // */ // Long count(Map params); // // /** // * 增加新实体 // * 主键值会自动填充到entity // * @param entity // */ // void create(Object entity); // // /** // * 更新实体 // * @param entity // * @return // */ // int update(Object entity); // // // /** // * 根据ID 删除实体 // * // * @param id // */ // void deleteById(PK id); // // /** // * 此处不想设计成 T entity,主要是考虑在前端需要创建对象实体,设计成Map,灵活性更高 // * @param entity // */ // void delete(Map params); // // /** 树型节点 方法 start */ // T findRoot(); // // List<T> findRoots(Map params); // // /** // * 根据code 获取所有节点(包括子孙节点) // * @param code // * @return // */ // List<T> findAllChilds(String code); // // /** // * 根据父节点获取所有直接子节点 // * @param parentId // * @return // */ // List<T> findChilds(Integer parentId); // /** 树型节点 方法 end */ // // void createExcelBatch(List<Map> datas); // // // } // Path: src/main/java/persistent/prestige/modules/edu/dao/DepartmentDao.java import org.springframework.stereotype.Repository; import persistent.prestige.modules.edu.model.Department; import persistent.prestige.platform.api.annotation.MybatisScan; import persistent.prestige.platform.base.dao.Dao; /* * Powered By agile * Web Site: http://www.agile.com * Since 2008 - 2016 */ package persistent.prestige.modules.edu.dao; /** * Department DAO类 * @author 雅居乐 2016-9-10 22:21:19 * @version 1.0 */ @Repository("departmentDao") @MybatisScan
public interface DepartmentDao extends Dao<Department,java.lang.Integer>{
wmixvideo/nfe
src/main/java/com/fincatto/documentofiscal/nfe400/classes/NFAutorizador400.java
// Path: src/main/java/com/fincatto/documentofiscal/DFAmbiente.java // public enum DFAmbiente { // // PRODUCAO("1", "Produ\u00e7\u00e3o"), // HOMOLOGACAO("2", "Homologa\u00e7\u00e3o"); // // private final String codigo; // private final String descricao; // // DFAmbiente(final String codigo, final String descricao) { // this.codigo = codigo; // this.descricao = descricao; // } // // public String getCodigo() { // return this.codigo; // } // // public String getDescricao() { // return this.descricao; // } // // public static DFAmbiente valueOfCodigo(final String codigo) { // for (final DFAmbiente ambiente : DFAmbiente.values()) { // if (ambiente.getCodigo().equalsIgnoreCase(codigo)) { // return ambiente; // } // } // return null; // } // // @Override // public String toString() { // return this.codigo + " - " + this.descricao; // } // }
import com.fincatto.documentofiscal.DFAmbiente; import com.fincatto.documentofiscal.DFUnidadeFederativa; import com.fincatto.documentofiscal.nfe.NFTipoEmissao; import com.fincatto.documentofiscal.nfe310.parsers.NotaFiscalChaveParser; import java.util.Arrays; import java.util.List;
package com.fincatto.documentofiscal.nfe400.classes; /** * <h1>URLs dos serviços</h1><br> * <a href="http://hom.nfe.fazenda.gov.br/portal/webServices.aspx?tipoConteudo=Wak0FwB7dKs=">NFE * Homologação</a><br> * <a href="http://www.nfe.fazenda.gov.br/portal/webServices.aspx?tipoConteudo=Wak0FwB7dKs=">NFE * Produção</a><br> * <br> * <a href="http://nfce.encat.org/desenvolvedor/webservices-h">NFCE * Homologação</a><br> * <a href="http://nfce.encat.org/desenvolvedor/webservices-p">NFCE Produção</a> */ public enum NFAutorizador400 { AM { @Override
// Path: src/main/java/com/fincatto/documentofiscal/DFAmbiente.java // public enum DFAmbiente { // // PRODUCAO("1", "Produ\u00e7\u00e3o"), // HOMOLOGACAO("2", "Homologa\u00e7\u00e3o"); // // private final String codigo; // private final String descricao; // // DFAmbiente(final String codigo, final String descricao) { // this.codigo = codigo; // this.descricao = descricao; // } // // public String getCodigo() { // return this.codigo; // } // // public String getDescricao() { // return this.descricao; // } // // public static DFAmbiente valueOfCodigo(final String codigo) { // for (final DFAmbiente ambiente : DFAmbiente.values()) { // if (ambiente.getCodigo().equalsIgnoreCase(codigo)) { // return ambiente; // } // } // return null; // } // // @Override // public String toString() { // return this.codigo + " - " + this.descricao; // } // } // Path: src/main/java/com/fincatto/documentofiscal/nfe400/classes/NFAutorizador400.java import com.fincatto.documentofiscal.DFAmbiente; import com.fincatto.documentofiscal.DFUnidadeFederativa; import com.fincatto.documentofiscal.nfe.NFTipoEmissao; import com.fincatto.documentofiscal.nfe310.parsers.NotaFiscalChaveParser; import java.util.Arrays; import java.util.List; package com.fincatto.documentofiscal.nfe400.classes; /** * <h1>URLs dos serviços</h1><br> * <a href="http://hom.nfe.fazenda.gov.br/portal/webServices.aspx?tipoConteudo=Wak0FwB7dKs=">NFE * Homologação</a><br> * <a href="http://www.nfe.fazenda.gov.br/portal/webServices.aspx?tipoConteudo=Wak0FwB7dKs=">NFE * Produção</a><br> * <br> * <a href="http://nfce.encat.org/desenvolvedor/webservices-h">NFCE * Homologação</a><br> * <a href="http://nfce.encat.org/desenvolvedor/webservices-p">NFCE Produção</a> */ public enum NFAutorizador400 { AM { @Override
public String getNfeAutorizacao(final DFAmbiente ambiente) {
wmixvideo/nfe
src/test/java/com/fincatto/documentofiscal/nfe400/classes/nota/NFNotaInfoItemImpostoICMSSN202Test.java
// Path: src/main/java/com/fincatto/documentofiscal/nfe400/classes/NFOrigem.java // public enum NFOrigem { // // NACIONAL("0", "Nacional"), // ESTRANGEIRA_IMPORTACAO_DIRETA("1", "Estrangeira importa\u00e7\u00e3o direta"), // ESTRANGEIRA_ADQUIRIDA_MERCADO_INTERNO("2", "Estrangeira adquirida mercado interno"), // NACIONAL_MERCADORIA_OU_BEM_CONTEUDO_IMPORTACAO_SUPERIOR_40_P("3", "Nacional mercadoria ou bem conte\u00fado importa\u00e7\u00e3o superior 40 P"), // NACIONAL_PRODUCAO_EM_CONFORMIDADE_COM_PROCESSOS_PRODUTIVOS_BASICOS("4", "Nacional produ\u00e7\u00e3o em conformidade com processos produtivos b\u00e1sicos"), // NACIONAL_MERCADORIA_OU_BEM_CONTEUDO_IMPORTACAO_INFERIOR_40_P("5", "Nacional mercadoria ou bem conte\u00fado importa\u00e7\u00e3o inferior 40 P"), // ESTRANGEIRA_IMPORTACAO_DIRETA_SEM_SIMILAR_NACIONAL_CONSTANTE_EM_LISTA_CAMEX("6", "Estrangeira importa\u00e7\u00e3o direta sem similar nacional constante em lista Camex"), // ESTRANGEIRA_ADQUIRIDA_MERCADO_INTERNO_SEM_SIMILAR_NACIONAL_CONSTANTE_EM_LISTA_CAMEX("7", "Estrangeira adquirida mercado interno sem similar nacional constante em lista Camex"), // NACIONAL_MERCADORIA_OU_BEM_COM_CONTEUDO_IMPORTACAO_SUPERIOR_70_P("8", "Nacional mercadoria ou bem conte\u00fado importa\u00e7\u00e3o superior 70 P"); // // private final String codigo; // private final String descricao; // // NFOrigem(final String codigo, final String descricao) { // this.codigo = codigo; // this.descricao = descricao; // } // // public String getCodigo() { // return this.codigo; // } // // public static NFOrigem valueOfCodigo(final String codigo) { // for (final NFOrigem origem : NFOrigem.values()) { // if (origem.getCodigo().equals(codigo)) { // return origem; // } // } // return null; // } // // @Override // public String toString() { // return codigo + " - " + descricao; // } // // public String getDescricao() { // return descricao; // } // // }
import java.math.BigDecimal; import org.junit.Assert; import org.junit.Test; import com.fincatto.documentofiscal.nfe400.classes.NFNotaInfoItemModalidadeBCICMSST; import com.fincatto.documentofiscal.nfe400.classes.NFNotaSituacaoOperacionalSimplesNacional; import com.fincatto.documentofiscal.nfe400.classes.NFOrigem;
package com.fincatto.documentofiscal.nfe400.classes.nota; public class NFNotaInfoItemImpostoICMSSN202Test { @Test(expected = NumberFormatException.class) public void naoDevePermitirPercentualAliquotaImpostoICMSSTComTamanhoInvalido() { new NFNotaInfoItemImpostoICMSSN202().setPercentualAliquotaImpostoICMSST(new BigDecimal("1000")); } @Test(expected = NumberFormatException.class) public void naoDevePermitirPercentualMargemValorAdicionadoICMSSTComTamanhoInvalido() { new NFNotaInfoItemImpostoICMSSN202().setPercentualMargemValorAdicionadoICMSST(new BigDecimal("1000")); } @Test(expected = NumberFormatException.class) public void naoDevePermitirPercentualReducaoBCICMSSTComTamanhoInvalido() { new NFNotaInfoItemImpostoICMSSN202().setPercentualReducaoBCICMSST(new BigDecimal("1000")); } @Test(expected = NumberFormatException.class) public void naoDevePermitirValorBCICMSSTComTamanhoInvalido() { new NFNotaInfoItemImpostoICMSSN202().setValorBCICMSST(new BigDecimal("10000000000000")); } @Test(expected = NumberFormatException.class) public void naoDevePermitirValorICSMSSTComTamanhoInvalido() { new NFNotaInfoItemImpostoICMSSN202().setValorICMSST(new BigDecimal("10000000000000")); } @Test(expected = IllegalStateException.class) public void naoDevePermitirValorZeradoParaPercentualFundoCombatePobreza() { new NFNotaInfoItemImpostoICMSSN202().setPercentualFundoCombatePobrezaST(BigDecimal.ZERO); } @Test(expected = IllegalStateException.class) public void naoDevePermitirPercentualAliquotaImpostoICMSSTNulo() { final NFNotaInfoItemImpostoICMSSN202 icms202 = new NFNotaInfoItemImpostoICMSSN202(); icms202.setModalidadeBCICMSST(NFNotaInfoItemModalidadeBCICMSST.LISTA_POSITIVA);
// Path: src/main/java/com/fincatto/documentofiscal/nfe400/classes/NFOrigem.java // public enum NFOrigem { // // NACIONAL("0", "Nacional"), // ESTRANGEIRA_IMPORTACAO_DIRETA("1", "Estrangeira importa\u00e7\u00e3o direta"), // ESTRANGEIRA_ADQUIRIDA_MERCADO_INTERNO("2", "Estrangeira adquirida mercado interno"), // NACIONAL_MERCADORIA_OU_BEM_CONTEUDO_IMPORTACAO_SUPERIOR_40_P("3", "Nacional mercadoria ou bem conte\u00fado importa\u00e7\u00e3o superior 40 P"), // NACIONAL_PRODUCAO_EM_CONFORMIDADE_COM_PROCESSOS_PRODUTIVOS_BASICOS("4", "Nacional produ\u00e7\u00e3o em conformidade com processos produtivos b\u00e1sicos"), // NACIONAL_MERCADORIA_OU_BEM_CONTEUDO_IMPORTACAO_INFERIOR_40_P("5", "Nacional mercadoria ou bem conte\u00fado importa\u00e7\u00e3o inferior 40 P"), // ESTRANGEIRA_IMPORTACAO_DIRETA_SEM_SIMILAR_NACIONAL_CONSTANTE_EM_LISTA_CAMEX("6", "Estrangeira importa\u00e7\u00e3o direta sem similar nacional constante em lista Camex"), // ESTRANGEIRA_ADQUIRIDA_MERCADO_INTERNO_SEM_SIMILAR_NACIONAL_CONSTANTE_EM_LISTA_CAMEX("7", "Estrangeira adquirida mercado interno sem similar nacional constante em lista Camex"), // NACIONAL_MERCADORIA_OU_BEM_COM_CONTEUDO_IMPORTACAO_SUPERIOR_70_P("8", "Nacional mercadoria ou bem conte\u00fado importa\u00e7\u00e3o superior 70 P"); // // private final String codigo; // private final String descricao; // // NFOrigem(final String codigo, final String descricao) { // this.codigo = codigo; // this.descricao = descricao; // } // // public String getCodigo() { // return this.codigo; // } // // public static NFOrigem valueOfCodigo(final String codigo) { // for (final NFOrigem origem : NFOrigem.values()) { // if (origem.getCodigo().equals(codigo)) { // return origem; // } // } // return null; // } // // @Override // public String toString() { // return codigo + " - " + descricao; // } // // public String getDescricao() { // return descricao; // } // // } // Path: src/test/java/com/fincatto/documentofiscal/nfe400/classes/nota/NFNotaInfoItemImpostoICMSSN202Test.java import java.math.BigDecimal; import org.junit.Assert; import org.junit.Test; import com.fincatto.documentofiscal.nfe400.classes.NFNotaInfoItemModalidadeBCICMSST; import com.fincatto.documentofiscal.nfe400.classes.NFNotaSituacaoOperacionalSimplesNacional; import com.fincatto.documentofiscal.nfe400.classes.NFOrigem; package com.fincatto.documentofiscal.nfe400.classes.nota; public class NFNotaInfoItemImpostoICMSSN202Test { @Test(expected = NumberFormatException.class) public void naoDevePermitirPercentualAliquotaImpostoICMSSTComTamanhoInvalido() { new NFNotaInfoItemImpostoICMSSN202().setPercentualAliquotaImpostoICMSST(new BigDecimal("1000")); } @Test(expected = NumberFormatException.class) public void naoDevePermitirPercentualMargemValorAdicionadoICMSSTComTamanhoInvalido() { new NFNotaInfoItemImpostoICMSSN202().setPercentualMargemValorAdicionadoICMSST(new BigDecimal("1000")); } @Test(expected = NumberFormatException.class) public void naoDevePermitirPercentualReducaoBCICMSSTComTamanhoInvalido() { new NFNotaInfoItemImpostoICMSSN202().setPercentualReducaoBCICMSST(new BigDecimal("1000")); } @Test(expected = NumberFormatException.class) public void naoDevePermitirValorBCICMSSTComTamanhoInvalido() { new NFNotaInfoItemImpostoICMSSN202().setValorBCICMSST(new BigDecimal("10000000000000")); } @Test(expected = NumberFormatException.class) public void naoDevePermitirValorICSMSSTComTamanhoInvalido() { new NFNotaInfoItemImpostoICMSSN202().setValorICMSST(new BigDecimal("10000000000000")); } @Test(expected = IllegalStateException.class) public void naoDevePermitirValorZeradoParaPercentualFundoCombatePobreza() { new NFNotaInfoItemImpostoICMSSN202().setPercentualFundoCombatePobrezaST(BigDecimal.ZERO); } @Test(expected = IllegalStateException.class) public void naoDevePermitirPercentualAliquotaImpostoICMSSTNulo() { final NFNotaInfoItemImpostoICMSSN202 icms202 = new NFNotaInfoItemImpostoICMSSN202(); icms202.setModalidadeBCICMSST(NFNotaInfoItemModalidadeBCICMSST.LISTA_POSITIVA);
icms202.setOrigem(NFOrigem.ESTRANGEIRA_ADQUIRIDA_MERCADO_INTERNO);
wmixvideo/nfe
src/main/java/com/fincatto/documentofiscal/nfe400/classes/nota/NFNotaInfoItemImpostoICMSPartilhado.java
// Path: src/main/java/com/fincatto/documentofiscal/nfe400/classes/NFOrigem.java // public enum NFOrigem { // // NACIONAL("0", "Nacional"), // ESTRANGEIRA_IMPORTACAO_DIRETA("1", "Estrangeira importa\u00e7\u00e3o direta"), // ESTRANGEIRA_ADQUIRIDA_MERCADO_INTERNO("2", "Estrangeira adquirida mercado interno"), // NACIONAL_MERCADORIA_OU_BEM_CONTEUDO_IMPORTACAO_SUPERIOR_40_P("3", "Nacional mercadoria ou bem conte\u00fado importa\u00e7\u00e3o superior 40 P"), // NACIONAL_PRODUCAO_EM_CONFORMIDADE_COM_PROCESSOS_PRODUTIVOS_BASICOS("4", "Nacional produ\u00e7\u00e3o em conformidade com processos produtivos b\u00e1sicos"), // NACIONAL_MERCADORIA_OU_BEM_CONTEUDO_IMPORTACAO_INFERIOR_40_P("5", "Nacional mercadoria ou bem conte\u00fado importa\u00e7\u00e3o inferior 40 P"), // ESTRANGEIRA_IMPORTACAO_DIRETA_SEM_SIMILAR_NACIONAL_CONSTANTE_EM_LISTA_CAMEX("6", "Estrangeira importa\u00e7\u00e3o direta sem similar nacional constante em lista Camex"), // ESTRANGEIRA_ADQUIRIDA_MERCADO_INTERNO_SEM_SIMILAR_NACIONAL_CONSTANTE_EM_LISTA_CAMEX("7", "Estrangeira adquirida mercado interno sem similar nacional constante em lista Camex"), // NACIONAL_MERCADORIA_OU_BEM_COM_CONTEUDO_IMPORTACAO_SUPERIOR_70_P("8", "Nacional mercadoria ou bem conte\u00fado importa\u00e7\u00e3o superior 70 P"); // // private final String codigo; // private final String descricao; // // NFOrigem(final String codigo, final String descricao) { // this.codigo = codigo; // this.descricao = descricao; // } // // public String getCodigo() { // return this.codigo; // } // // public static NFOrigem valueOfCodigo(final String codigo) { // for (final NFOrigem origem : NFOrigem.values()) { // if (origem.getCodigo().equals(codigo)) { // return origem; // } // } // return null; // } // // @Override // public String toString() { // return codigo + " - " + descricao; // } // // public String getDescricao() { // return descricao; // } // // }
import com.fincatto.documentofiscal.DFBase; import com.fincatto.documentofiscal.DFUnidadeFederativa; import com.fincatto.documentofiscal.nfe400.classes.NFNotaInfoImpostoTributacaoICMS; import com.fincatto.documentofiscal.nfe400.classes.NFNotaInfoItemModalidadeBCICMS; import com.fincatto.documentofiscal.nfe400.classes.NFNotaInfoItemModalidadeBCICMSST; import com.fincatto.documentofiscal.nfe400.classes.NFOrigem; import com.fincatto.documentofiscal.validadores.DFBigDecimalValidador; import org.simpleframework.xml.Element; import java.math.BigDecimal;
package com.fincatto.documentofiscal.nfe400.classes.nota; public class NFNotaInfoItemImpostoICMSPartilhado extends DFBase { private static final long serialVersionUID = 3053815337863231705L; @Element(name = "orig")
// Path: src/main/java/com/fincatto/documentofiscal/nfe400/classes/NFOrigem.java // public enum NFOrigem { // // NACIONAL("0", "Nacional"), // ESTRANGEIRA_IMPORTACAO_DIRETA("1", "Estrangeira importa\u00e7\u00e3o direta"), // ESTRANGEIRA_ADQUIRIDA_MERCADO_INTERNO("2", "Estrangeira adquirida mercado interno"), // NACIONAL_MERCADORIA_OU_BEM_CONTEUDO_IMPORTACAO_SUPERIOR_40_P("3", "Nacional mercadoria ou bem conte\u00fado importa\u00e7\u00e3o superior 40 P"), // NACIONAL_PRODUCAO_EM_CONFORMIDADE_COM_PROCESSOS_PRODUTIVOS_BASICOS("4", "Nacional produ\u00e7\u00e3o em conformidade com processos produtivos b\u00e1sicos"), // NACIONAL_MERCADORIA_OU_BEM_CONTEUDO_IMPORTACAO_INFERIOR_40_P("5", "Nacional mercadoria ou bem conte\u00fado importa\u00e7\u00e3o inferior 40 P"), // ESTRANGEIRA_IMPORTACAO_DIRETA_SEM_SIMILAR_NACIONAL_CONSTANTE_EM_LISTA_CAMEX("6", "Estrangeira importa\u00e7\u00e3o direta sem similar nacional constante em lista Camex"), // ESTRANGEIRA_ADQUIRIDA_MERCADO_INTERNO_SEM_SIMILAR_NACIONAL_CONSTANTE_EM_LISTA_CAMEX("7", "Estrangeira adquirida mercado interno sem similar nacional constante em lista Camex"), // NACIONAL_MERCADORIA_OU_BEM_COM_CONTEUDO_IMPORTACAO_SUPERIOR_70_P("8", "Nacional mercadoria ou bem conte\u00fado importa\u00e7\u00e3o superior 70 P"); // // private final String codigo; // private final String descricao; // // NFOrigem(final String codigo, final String descricao) { // this.codigo = codigo; // this.descricao = descricao; // } // // public String getCodigo() { // return this.codigo; // } // // public static NFOrigem valueOfCodigo(final String codigo) { // for (final NFOrigem origem : NFOrigem.values()) { // if (origem.getCodigo().equals(codigo)) { // return origem; // } // } // return null; // } // // @Override // public String toString() { // return codigo + " - " + descricao; // } // // public String getDescricao() { // return descricao; // } // // } // Path: src/main/java/com/fincatto/documentofiscal/nfe400/classes/nota/NFNotaInfoItemImpostoICMSPartilhado.java import com.fincatto.documentofiscal.DFBase; import com.fincatto.documentofiscal.DFUnidadeFederativa; import com.fincatto.documentofiscal.nfe400.classes.NFNotaInfoImpostoTributacaoICMS; import com.fincatto.documentofiscal.nfe400.classes.NFNotaInfoItemModalidadeBCICMS; import com.fincatto.documentofiscal.nfe400.classes.NFNotaInfoItemModalidadeBCICMSST; import com.fincatto.documentofiscal.nfe400.classes.NFOrigem; import com.fincatto.documentofiscal.validadores.DFBigDecimalValidador; import org.simpleframework.xml.Element; import java.math.BigDecimal; package com.fincatto.documentofiscal.nfe400.classes.nota; public class NFNotaInfoItemImpostoICMSPartilhado extends DFBase { private static final long serialVersionUID = 3053815337863231705L; @Element(name = "orig")
private NFOrigem origem;
wmixvideo/nfe
src/main/java/com/fincatto/documentofiscal/nfe400/classes/statusservico/consulta/NFStatusServicoConsultaRetorno.java
// Path: src/main/java/com/fincatto/documentofiscal/DFAmbiente.java // public enum DFAmbiente { // // PRODUCAO("1", "Produ\u00e7\u00e3o"), // HOMOLOGACAO("2", "Homologa\u00e7\u00e3o"); // // private final String codigo; // private final String descricao; // // DFAmbiente(final String codigo, final String descricao) { // this.codigo = codigo; // this.descricao = descricao; // } // // public String getCodigo() { // return this.codigo; // } // // public String getDescricao() { // return this.descricao; // } // // public static DFAmbiente valueOfCodigo(final String codigo) { // for (final DFAmbiente ambiente : DFAmbiente.values()) { // if (ambiente.getCodigo().equalsIgnoreCase(codigo)) { // return ambiente; // } // } // return null; // } // // @Override // public String toString() { // return this.codigo + " - " + this.descricao; // } // }
import com.fincatto.documentofiscal.DFAmbiente; import com.fincatto.documentofiscal.DFBase; import com.fincatto.documentofiscal.DFUnidadeFederativa; import org.simpleframework.xml.Attribute; import org.simpleframework.xml.Element; import org.simpleframework.xml.Namespace; import org.simpleframework.xml.Root; import java.time.ZonedDateTime;
package com.fincatto.documentofiscal.nfe400.classes.statusservico.consulta; @Root(name = "retConsStatServ") @Namespace(reference = "http://www.portalfiscal.inf.br/nfe") public class NFStatusServicoConsultaRetorno extends DFBase { private static final long serialVersionUID = -5022679215397514727L; @Attribute(name = "versao") private String versao; @Element(name = "tpAmb")
// Path: src/main/java/com/fincatto/documentofiscal/DFAmbiente.java // public enum DFAmbiente { // // PRODUCAO("1", "Produ\u00e7\u00e3o"), // HOMOLOGACAO("2", "Homologa\u00e7\u00e3o"); // // private final String codigo; // private final String descricao; // // DFAmbiente(final String codigo, final String descricao) { // this.codigo = codigo; // this.descricao = descricao; // } // // public String getCodigo() { // return this.codigo; // } // // public String getDescricao() { // return this.descricao; // } // // public static DFAmbiente valueOfCodigo(final String codigo) { // for (final DFAmbiente ambiente : DFAmbiente.values()) { // if (ambiente.getCodigo().equalsIgnoreCase(codigo)) { // return ambiente; // } // } // return null; // } // // @Override // public String toString() { // return this.codigo + " - " + this.descricao; // } // } // Path: src/main/java/com/fincatto/documentofiscal/nfe400/classes/statusservico/consulta/NFStatusServicoConsultaRetorno.java import com.fincatto.documentofiscal.DFAmbiente; import com.fincatto.documentofiscal.DFBase; import com.fincatto.documentofiscal.DFUnidadeFederativa; import org.simpleframework.xml.Attribute; import org.simpleframework.xml.Element; import org.simpleframework.xml.Namespace; import org.simpleframework.xml.Root; import java.time.ZonedDateTime; package com.fincatto.documentofiscal.nfe400.classes.statusservico.consulta; @Root(name = "retConsStatServ") @Namespace(reference = "http://www.portalfiscal.inf.br/nfe") public class NFStatusServicoConsultaRetorno extends DFBase { private static final long serialVersionUID = -5022679215397514727L; @Attribute(name = "versao") private String versao; @Element(name = "tpAmb")
private DFAmbiente ambiente;
wmixvideo/nfe
src/test/java/com/fincatto/documentofiscal/nfe400/classes/nota/NFNotaInfoItemImpostoICMSSN102Test.java
// Path: src/main/java/com/fincatto/documentofiscal/nfe400/classes/NFOrigem.java // public enum NFOrigem { // // NACIONAL("0", "Nacional"), // ESTRANGEIRA_IMPORTACAO_DIRETA("1", "Estrangeira importa\u00e7\u00e3o direta"), // ESTRANGEIRA_ADQUIRIDA_MERCADO_INTERNO("2", "Estrangeira adquirida mercado interno"), // NACIONAL_MERCADORIA_OU_BEM_CONTEUDO_IMPORTACAO_SUPERIOR_40_P("3", "Nacional mercadoria ou bem conte\u00fado importa\u00e7\u00e3o superior 40 P"), // NACIONAL_PRODUCAO_EM_CONFORMIDADE_COM_PROCESSOS_PRODUTIVOS_BASICOS("4", "Nacional produ\u00e7\u00e3o em conformidade com processos produtivos b\u00e1sicos"), // NACIONAL_MERCADORIA_OU_BEM_CONTEUDO_IMPORTACAO_INFERIOR_40_P("5", "Nacional mercadoria ou bem conte\u00fado importa\u00e7\u00e3o inferior 40 P"), // ESTRANGEIRA_IMPORTACAO_DIRETA_SEM_SIMILAR_NACIONAL_CONSTANTE_EM_LISTA_CAMEX("6", "Estrangeira importa\u00e7\u00e3o direta sem similar nacional constante em lista Camex"), // ESTRANGEIRA_ADQUIRIDA_MERCADO_INTERNO_SEM_SIMILAR_NACIONAL_CONSTANTE_EM_LISTA_CAMEX("7", "Estrangeira adquirida mercado interno sem similar nacional constante em lista Camex"), // NACIONAL_MERCADORIA_OU_BEM_COM_CONTEUDO_IMPORTACAO_SUPERIOR_70_P("8", "Nacional mercadoria ou bem conte\u00fado importa\u00e7\u00e3o superior 70 P"); // // private final String codigo; // private final String descricao; // // NFOrigem(final String codigo, final String descricao) { // this.codigo = codigo; // this.descricao = descricao; // } // // public String getCodigo() { // return this.codigo; // } // // public static NFOrigem valueOfCodigo(final String codigo) { // for (final NFOrigem origem : NFOrigem.values()) { // if (origem.getCodigo().equals(codigo)) { // return origem; // } // } // return null; // } // // @Override // public String toString() { // return codigo + " - " + descricao; // } // // public String getDescricao() { // return descricao; // } // // }
import org.junit.Assert; import org.junit.Test; import com.fincatto.documentofiscal.nfe400.classes.NFNotaSituacaoOperacionalSimplesNacional; import com.fincatto.documentofiscal.nfe400.classes.NFOrigem;
package com.fincatto.documentofiscal.nfe400.classes.nota; public class NFNotaInfoItemImpostoICMSSN102Test { @Test(expected = IllegalStateException.class) public void naoDevePermitirOrigemNulo() { final NFNotaInfoItemImpostoICMSSN102 icmssn102 = new NFNotaInfoItemImpostoICMSSN102(); icmssn102.setSituacaoOperacaoSN(NFNotaSituacaoOperacionalSimplesNacional.IMUNE); icmssn102.toString(); } @Test(expected = IllegalStateException.class) public void naoDevePermitirSituacaoOperacaoSNNulo() { final NFNotaInfoItemImpostoICMSSN102 icmssn102 = new NFNotaInfoItemImpostoICMSSN102();
// Path: src/main/java/com/fincatto/documentofiscal/nfe400/classes/NFOrigem.java // public enum NFOrigem { // // NACIONAL("0", "Nacional"), // ESTRANGEIRA_IMPORTACAO_DIRETA("1", "Estrangeira importa\u00e7\u00e3o direta"), // ESTRANGEIRA_ADQUIRIDA_MERCADO_INTERNO("2", "Estrangeira adquirida mercado interno"), // NACIONAL_MERCADORIA_OU_BEM_CONTEUDO_IMPORTACAO_SUPERIOR_40_P("3", "Nacional mercadoria ou bem conte\u00fado importa\u00e7\u00e3o superior 40 P"), // NACIONAL_PRODUCAO_EM_CONFORMIDADE_COM_PROCESSOS_PRODUTIVOS_BASICOS("4", "Nacional produ\u00e7\u00e3o em conformidade com processos produtivos b\u00e1sicos"), // NACIONAL_MERCADORIA_OU_BEM_CONTEUDO_IMPORTACAO_INFERIOR_40_P("5", "Nacional mercadoria ou bem conte\u00fado importa\u00e7\u00e3o inferior 40 P"), // ESTRANGEIRA_IMPORTACAO_DIRETA_SEM_SIMILAR_NACIONAL_CONSTANTE_EM_LISTA_CAMEX("6", "Estrangeira importa\u00e7\u00e3o direta sem similar nacional constante em lista Camex"), // ESTRANGEIRA_ADQUIRIDA_MERCADO_INTERNO_SEM_SIMILAR_NACIONAL_CONSTANTE_EM_LISTA_CAMEX("7", "Estrangeira adquirida mercado interno sem similar nacional constante em lista Camex"), // NACIONAL_MERCADORIA_OU_BEM_COM_CONTEUDO_IMPORTACAO_SUPERIOR_70_P("8", "Nacional mercadoria ou bem conte\u00fado importa\u00e7\u00e3o superior 70 P"); // // private final String codigo; // private final String descricao; // // NFOrigem(final String codigo, final String descricao) { // this.codigo = codigo; // this.descricao = descricao; // } // // public String getCodigo() { // return this.codigo; // } // // public static NFOrigem valueOfCodigo(final String codigo) { // for (final NFOrigem origem : NFOrigem.values()) { // if (origem.getCodigo().equals(codigo)) { // return origem; // } // } // return null; // } // // @Override // public String toString() { // return codigo + " - " + descricao; // } // // public String getDescricao() { // return descricao; // } // // } // Path: src/test/java/com/fincatto/documentofiscal/nfe400/classes/nota/NFNotaInfoItemImpostoICMSSN102Test.java import org.junit.Assert; import org.junit.Test; import com.fincatto.documentofiscal.nfe400.classes.NFNotaSituacaoOperacionalSimplesNacional; import com.fincatto.documentofiscal.nfe400.classes.NFOrigem; package com.fincatto.documentofiscal.nfe400.classes.nota; public class NFNotaInfoItemImpostoICMSSN102Test { @Test(expected = IllegalStateException.class) public void naoDevePermitirOrigemNulo() { final NFNotaInfoItemImpostoICMSSN102 icmssn102 = new NFNotaInfoItemImpostoICMSSN102(); icmssn102.setSituacaoOperacaoSN(NFNotaSituacaoOperacionalSimplesNacional.IMUNE); icmssn102.toString(); } @Test(expected = IllegalStateException.class) public void naoDevePermitirSituacaoOperacaoSNNulo() { final NFNotaInfoItemImpostoICMSSN102 icmssn102 = new NFNotaInfoItemImpostoICMSSN102();
icmssn102.setOrigem(NFOrigem.NACIONAL);
wmixvideo/nfe
src/main/java/com/fincatto/documentofiscal/mdfe3/classes/MDFProtocoloInfo.java
// Path: src/main/java/com/fincatto/documentofiscal/DFAmbiente.java // public enum DFAmbiente { // // PRODUCAO("1", "Produ\u00e7\u00e3o"), // HOMOLOGACAO("2", "Homologa\u00e7\u00e3o"); // // private final String codigo; // private final String descricao; // // DFAmbiente(final String codigo, final String descricao) { // this.codigo = codigo; // this.descricao = descricao; // } // // public String getCodigo() { // return this.codigo; // } // // public String getDescricao() { // return this.descricao; // } // // public static DFAmbiente valueOfCodigo(final String codigo) { // for (final DFAmbiente ambiente : DFAmbiente.values()) { // if (ambiente.getCodigo().equalsIgnoreCase(codigo)) { // return ambiente; // } // } // return null; // } // // @Override // public String toString() { // return this.codigo + " - " + this.descricao; // } // }
import com.fincatto.documentofiscal.DFAmbiente; import com.fincatto.documentofiscal.DFBase; import org.simpleframework.xml.Attribute; import org.simpleframework.xml.Element; import java.time.ZonedDateTime;
package com.fincatto.documentofiscal.mdfe3.classes; /** * @Author Eldevan Nery Junior on 26/05/17. */ public class MDFProtocoloInfo extends DFBase { private static final long serialVersionUID = 256148266644230771L; @Attribute(name = "Id", required = false) private String identificador; @Element(name = "tpAmb")
// Path: src/main/java/com/fincatto/documentofiscal/DFAmbiente.java // public enum DFAmbiente { // // PRODUCAO("1", "Produ\u00e7\u00e3o"), // HOMOLOGACAO("2", "Homologa\u00e7\u00e3o"); // // private final String codigo; // private final String descricao; // // DFAmbiente(final String codigo, final String descricao) { // this.codigo = codigo; // this.descricao = descricao; // } // // public String getCodigo() { // return this.codigo; // } // // public String getDescricao() { // return this.descricao; // } // // public static DFAmbiente valueOfCodigo(final String codigo) { // for (final DFAmbiente ambiente : DFAmbiente.values()) { // if (ambiente.getCodigo().equalsIgnoreCase(codigo)) { // return ambiente; // } // } // return null; // } // // @Override // public String toString() { // return this.codigo + " - " + this.descricao; // } // } // Path: src/main/java/com/fincatto/documentofiscal/mdfe3/classes/MDFProtocoloInfo.java import com.fincatto.documentofiscal.DFAmbiente; import com.fincatto.documentofiscal.DFBase; import org.simpleframework.xml.Attribute; import org.simpleframework.xml.Element; import java.time.ZonedDateTime; package com.fincatto.documentofiscal.mdfe3.classes; /** * @Author Eldevan Nery Junior on 26/05/17. */ public class MDFProtocoloInfo extends DFBase { private static final long serialVersionUID = 256148266644230771L; @Attribute(name = "Id", required = false) private String identificador; @Element(name = "tpAmb")
private DFAmbiente ambiente;
wmixvideo/nfe
src/test/java/com/fincatto/documentofiscal/nfe400/classes/NFAutorizador400Test.java
// Path: src/main/java/com/fincatto/documentofiscal/DFAmbiente.java // public enum DFAmbiente { // // PRODUCAO("1", "Produ\u00e7\u00e3o"), // HOMOLOGACAO("2", "Homologa\u00e7\u00e3o"); // // private final String codigo; // private final String descricao; // // DFAmbiente(final String codigo, final String descricao) { // this.codigo = codigo; // this.descricao = descricao; // } // // public String getCodigo() { // return this.codigo; // } // // public String getDescricao() { // return this.descricao; // } // // public static DFAmbiente valueOfCodigo(final String codigo) { // for (final DFAmbiente ambiente : DFAmbiente.values()) { // if (ambiente.getCodigo().equalsIgnoreCase(codigo)) { // return ambiente; // } // } // return null; // } // // @Override // public String toString() { // return this.codigo + " - " + this.descricao; // } // }
import com.fincatto.documentofiscal.DFAmbiente; import com.fincatto.documentofiscal.DFUnidadeFederativa; import com.fincatto.documentofiscal.nfe.NFTipoEmissao; import org.junit.Assert; import org.junit.Test; import java.util.Arrays; import java.util.List;
package com.fincatto.documentofiscal.nfe400.classes; public class NFAutorizador400Test { @Test public void deveBuscarCorretamenteURLsWebServiceAM() { final NFAutorizador400 autorizador = NFAutorizador400.AM;
// Path: src/main/java/com/fincatto/documentofiscal/DFAmbiente.java // public enum DFAmbiente { // // PRODUCAO("1", "Produ\u00e7\u00e3o"), // HOMOLOGACAO("2", "Homologa\u00e7\u00e3o"); // // private final String codigo; // private final String descricao; // // DFAmbiente(final String codigo, final String descricao) { // this.codigo = codigo; // this.descricao = descricao; // } // // public String getCodigo() { // return this.codigo; // } // // public String getDescricao() { // return this.descricao; // } // // public static DFAmbiente valueOfCodigo(final String codigo) { // for (final DFAmbiente ambiente : DFAmbiente.values()) { // if (ambiente.getCodigo().equalsIgnoreCase(codigo)) { // return ambiente; // } // } // return null; // } // // @Override // public String toString() { // return this.codigo + " - " + this.descricao; // } // } // Path: src/test/java/com/fincatto/documentofiscal/nfe400/classes/NFAutorizador400Test.java import com.fincatto.documentofiscal.DFAmbiente; import com.fincatto.documentofiscal.DFUnidadeFederativa; import com.fincatto.documentofiscal.nfe.NFTipoEmissao; import org.junit.Assert; import org.junit.Test; import java.util.Arrays; import java.util.List; package com.fincatto.documentofiscal.nfe400.classes; public class NFAutorizador400Test { @Test public void deveBuscarCorretamenteURLsWebServiceAM() { final NFAutorizador400 autorizador = NFAutorizador400.AM;
Assert.assertNull(autorizador.getConsultaCadastro(DFAmbiente.HOMOLOGACAO));
wmixvideo/nfe
src/main/java/com/fincatto/documentofiscal/nfe310/classes/lote/consulta/NFLoteConsultaRetorno.java
// Path: src/main/java/com/fincatto/documentofiscal/DFAmbiente.java // public enum DFAmbiente { // // PRODUCAO("1", "Produ\u00e7\u00e3o"), // HOMOLOGACAO("2", "Homologa\u00e7\u00e3o"); // // private final String codigo; // private final String descricao; // // DFAmbiente(final String codigo, final String descricao) { // this.codigo = codigo; // this.descricao = descricao; // } // // public String getCodigo() { // return this.codigo; // } // // public String getDescricao() { // return this.descricao; // } // // public static DFAmbiente valueOfCodigo(final String codigo) { // for (final DFAmbiente ambiente : DFAmbiente.values()) { // if (ambiente.getCodigo().equalsIgnoreCase(codigo)) { // return ambiente; // } // } // return null; // } // // @Override // public String toString() { // return this.codigo + " - " + this.descricao; // } // }
import com.fincatto.documentofiscal.DFAmbiente; import com.fincatto.documentofiscal.DFBase; import com.fincatto.documentofiscal.DFUnidadeFederativa; import com.fincatto.documentofiscal.nfe310.classes.NFProtocolo; import org.simpleframework.xml.*; import java.time.ZonedDateTime; import java.util.List;
package com.fincatto.documentofiscal.nfe310.classes.lote.consulta; @Root(name = "retConsReciNFe") @Namespace(reference = "http://www.portalfiscal.inf.br/nfe") public class NFLoteConsultaRetorno extends DFBase { private static final long serialVersionUID = -4164491132370082153L; @Attribute(name = "versao") private String versao; @Element(name = "tpAmb")
// Path: src/main/java/com/fincatto/documentofiscal/DFAmbiente.java // public enum DFAmbiente { // // PRODUCAO("1", "Produ\u00e7\u00e3o"), // HOMOLOGACAO("2", "Homologa\u00e7\u00e3o"); // // private final String codigo; // private final String descricao; // // DFAmbiente(final String codigo, final String descricao) { // this.codigo = codigo; // this.descricao = descricao; // } // // public String getCodigo() { // return this.codigo; // } // // public String getDescricao() { // return this.descricao; // } // // public static DFAmbiente valueOfCodigo(final String codigo) { // for (final DFAmbiente ambiente : DFAmbiente.values()) { // if (ambiente.getCodigo().equalsIgnoreCase(codigo)) { // return ambiente; // } // } // return null; // } // // @Override // public String toString() { // return this.codigo + " - " + this.descricao; // } // } // Path: src/main/java/com/fincatto/documentofiscal/nfe310/classes/lote/consulta/NFLoteConsultaRetorno.java import com.fincatto.documentofiscal.DFAmbiente; import com.fincatto.documentofiscal.DFBase; import com.fincatto.documentofiscal.DFUnidadeFederativa; import com.fincatto.documentofiscal.nfe310.classes.NFProtocolo; import org.simpleframework.xml.*; import java.time.ZonedDateTime; import java.util.List; package com.fincatto.documentofiscal.nfe310.classes.lote.consulta; @Root(name = "retConsReciNFe") @Namespace(reference = "http://www.portalfiscal.inf.br/nfe") public class NFLoteConsultaRetorno extends DFBase { private static final long serialVersionUID = -4164491132370082153L; @Attribute(name = "versao") private String versao; @Element(name = "tpAmb")
private DFAmbiente ambiente;
wmixvideo/nfe
src/main/java/com/fincatto/documentofiscal/nfe310/webservices/WSLoteConsulta.java
// Path: src/main/java/com/fincatto/documentofiscal/nfe310/classes/lote/consulta/NFLoteConsultaRetorno.java // @Root(name = "retConsReciNFe") // @Namespace(reference = "http://www.portalfiscal.inf.br/nfe") // public class NFLoteConsultaRetorno extends DFBase { // private static final long serialVersionUID = -4164491132370082153L; // // @Attribute(name = "versao") // private String versao; // // @Element(name = "tpAmb") // private DFAmbiente ambiente; // // @Element(name = "verAplic") // private String versaoAplicacao; // // @Element(name = "nRec", required = false) // private String numeroRecibo; // // @Element(name = "cStat") // private String status; // // @Element(name = "dhRecbto") // private ZonedDateTime dataHoraRecebimento; // // @Element(name = "xMotivo") // private String motivo; // // @Element(name = "cUF") // private DFUnidadeFederativa uf; // // @Element(name = "cMsg", required = false) // private String codigoMessage; // // @Element(name = "xMsg", required = false) // private String mensagem; // // @ElementList(entry = "protNFe", inline = true, required = false) // protected List<NFProtocolo> protocolos; // // public String getVersao() { // return this.versao; // } // // public void setVersao(final String versao) { // this.versao = versao; // } // // public DFAmbiente getAmbiente() { // return this.ambiente; // } // // public void setAmbiente(final DFAmbiente ambiente) { // this.ambiente = ambiente; // } // // public String getVersaoAplicacao() { // return this.versaoAplicacao; // } // // public void setVersaoAplicacao(final String versaoAplicacao) { // this.versaoAplicacao = versaoAplicacao; // } // // public String getNumeroRecibo() { // return this.numeroRecibo; // } // // public void setNumeroRecibo(final String numeroRecibo) { // this.numeroRecibo = numeroRecibo; // } // // public String getStatus() { // return this.status; // } // // public void setStatus(final String status) { // this.status = status; // } // // public String getMotivo() { // return this.motivo; // } // // public void setMotivo(final String motivo) { // this.motivo = motivo; // } // // public DFUnidadeFederativa getUf() { // return this.uf; // } // // public void setUf(final DFUnidadeFederativa uf) { // this.uf = uf; // } // // public List<NFProtocolo> getProtocolos() { // return this.protocolos; // } // // public void setProtocolos(final List<NFProtocolo> protocolos) { // this.protocolos = protocolos; // } // // public String getCodigoMessage() { // return this.codigoMessage; // } // // public void setCodigoMessage(final String codigoMessage) { // this.codigoMessage = codigoMessage; // } // // public String getMensagem() { // return this.mensagem; // } // // public void setMensagem(final String mensagem) { // this.mensagem = mensagem; // } // // public ZonedDateTime getDataHoraRecebimento() { // return this.dataHoraRecebimento; // } // // public void setDataHoraRecebimento(final ZonedDateTime dataHoraRecebimento) { // this.dataHoraRecebimento = dataHoraRecebimento; // } // }
import com.fincatto.documentofiscal.DFLog; import com.fincatto.documentofiscal.DFModelo; import com.fincatto.documentofiscal.nfe.NFeConfig; import com.fincatto.documentofiscal.nfe310.classes.NFAutorizador31; import com.fincatto.documentofiscal.nfe310.classes.lote.consulta.NFLoteConsulta; import com.fincatto.documentofiscal.nfe310.classes.lote.consulta.NFLoteConsultaRetorno; import com.fincatto.documentofiscal.nfe310.webservices.gerado.NfeRetAutorizacaoStub; import com.fincatto.documentofiscal.nfe310.webservices.gerado.NfeRetAutorizacaoStub.NfeRetAutorizacaoLoteResult; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.util.AXIOMUtil; import java.math.BigDecimal; import java.rmi.RemoteException;
package com.fincatto.documentofiscal.nfe310.webservices; class WSLoteConsulta implements DFLog { private final NFeConfig config; WSLoteConsulta(final NFeConfig config) { this.config = config; }
// Path: src/main/java/com/fincatto/documentofiscal/nfe310/classes/lote/consulta/NFLoteConsultaRetorno.java // @Root(name = "retConsReciNFe") // @Namespace(reference = "http://www.portalfiscal.inf.br/nfe") // public class NFLoteConsultaRetorno extends DFBase { // private static final long serialVersionUID = -4164491132370082153L; // // @Attribute(name = "versao") // private String versao; // // @Element(name = "tpAmb") // private DFAmbiente ambiente; // // @Element(name = "verAplic") // private String versaoAplicacao; // // @Element(name = "nRec", required = false) // private String numeroRecibo; // // @Element(name = "cStat") // private String status; // // @Element(name = "dhRecbto") // private ZonedDateTime dataHoraRecebimento; // // @Element(name = "xMotivo") // private String motivo; // // @Element(name = "cUF") // private DFUnidadeFederativa uf; // // @Element(name = "cMsg", required = false) // private String codigoMessage; // // @Element(name = "xMsg", required = false) // private String mensagem; // // @ElementList(entry = "protNFe", inline = true, required = false) // protected List<NFProtocolo> protocolos; // // public String getVersao() { // return this.versao; // } // // public void setVersao(final String versao) { // this.versao = versao; // } // // public DFAmbiente getAmbiente() { // return this.ambiente; // } // // public void setAmbiente(final DFAmbiente ambiente) { // this.ambiente = ambiente; // } // // public String getVersaoAplicacao() { // return this.versaoAplicacao; // } // // public void setVersaoAplicacao(final String versaoAplicacao) { // this.versaoAplicacao = versaoAplicacao; // } // // public String getNumeroRecibo() { // return this.numeroRecibo; // } // // public void setNumeroRecibo(final String numeroRecibo) { // this.numeroRecibo = numeroRecibo; // } // // public String getStatus() { // return this.status; // } // // public void setStatus(final String status) { // this.status = status; // } // // public String getMotivo() { // return this.motivo; // } // // public void setMotivo(final String motivo) { // this.motivo = motivo; // } // // public DFUnidadeFederativa getUf() { // return this.uf; // } // // public void setUf(final DFUnidadeFederativa uf) { // this.uf = uf; // } // // public List<NFProtocolo> getProtocolos() { // return this.protocolos; // } // // public void setProtocolos(final List<NFProtocolo> protocolos) { // this.protocolos = protocolos; // } // // public String getCodigoMessage() { // return this.codigoMessage; // } // // public void setCodigoMessage(final String codigoMessage) { // this.codigoMessage = codigoMessage; // } // // public String getMensagem() { // return this.mensagem; // } // // public void setMensagem(final String mensagem) { // this.mensagem = mensagem; // } // // public ZonedDateTime getDataHoraRecebimento() { // return this.dataHoraRecebimento; // } // // public void setDataHoraRecebimento(final ZonedDateTime dataHoraRecebimento) { // this.dataHoraRecebimento = dataHoraRecebimento; // } // } // Path: src/main/java/com/fincatto/documentofiscal/nfe310/webservices/WSLoteConsulta.java import com.fincatto.documentofiscal.DFLog; import com.fincatto.documentofiscal.DFModelo; import com.fincatto.documentofiscal.nfe.NFeConfig; import com.fincatto.documentofiscal.nfe310.classes.NFAutorizador31; import com.fincatto.documentofiscal.nfe310.classes.lote.consulta.NFLoteConsulta; import com.fincatto.documentofiscal.nfe310.classes.lote.consulta.NFLoteConsultaRetorno; import com.fincatto.documentofiscal.nfe310.webservices.gerado.NfeRetAutorizacaoStub; import com.fincatto.documentofiscal.nfe310.webservices.gerado.NfeRetAutorizacaoStub.NfeRetAutorizacaoLoteResult; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.util.AXIOMUtil; import java.math.BigDecimal; import java.rmi.RemoteException; package com.fincatto.documentofiscal.nfe310.webservices; class WSLoteConsulta implements DFLog { private final NFeConfig config; WSLoteConsulta(final NFeConfig config) { this.config = config; }
NFLoteConsultaRetorno consultaLote(final String numeroRecibo, final DFModelo modelo) throws Exception {
wmixvideo/nfe
src/main/java/com/fincatto/documentofiscal/nfe310/classes/NFProtocoloInfo.java
// Path: src/main/java/com/fincatto/documentofiscal/DFAmbiente.java // public enum DFAmbiente { // // PRODUCAO("1", "Produ\u00e7\u00e3o"), // HOMOLOGACAO("2", "Homologa\u00e7\u00e3o"); // // private final String codigo; // private final String descricao; // // DFAmbiente(final String codigo, final String descricao) { // this.codigo = codigo; // this.descricao = descricao; // } // // public String getCodigo() { // return this.codigo; // } // // public String getDescricao() { // return this.descricao; // } // // public static DFAmbiente valueOfCodigo(final String codigo) { // for (final DFAmbiente ambiente : DFAmbiente.values()) { // if (ambiente.getCodigo().equalsIgnoreCase(codigo)) { // return ambiente; // } // } // return null; // } // // @Override // public String toString() { // return this.codigo + " - " + this.descricao; // } // }
import com.fincatto.documentofiscal.DFAmbiente; import com.fincatto.documentofiscal.DFBase; import org.simpleframework.xml.Attribute; import org.simpleframework.xml.Element; import java.time.ZonedDateTime;
package com.fincatto.documentofiscal.nfe310.classes; public class NFProtocoloInfo extends DFBase { private static final long serialVersionUID = -7256753142051587115L; @Attribute(name = "Id", required = false) private String identificador; @Element(name = "tpAmb")
// Path: src/main/java/com/fincatto/documentofiscal/DFAmbiente.java // public enum DFAmbiente { // // PRODUCAO("1", "Produ\u00e7\u00e3o"), // HOMOLOGACAO("2", "Homologa\u00e7\u00e3o"); // // private final String codigo; // private final String descricao; // // DFAmbiente(final String codigo, final String descricao) { // this.codigo = codigo; // this.descricao = descricao; // } // // public String getCodigo() { // return this.codigo; // } // // public String getDescricao() { // return this.descricao; // } // // public static DFAmbiente valueOfCodigo(final String codigo) { // for (final DFAmbiente ambiente : DFAmbiente.values()) { // if (ambiente.getCodigo().equalsIgnoreCase(codigo)) { // return ambiente; // } // } // return null; // } // // @Override // public String toString() { // return this.codigo + " - " + this.descricao; // } // } // Path: src/main/java/com/fincatto/documentofiscal/nfe310/classes/NFProtocoloInfo.java import com.fincatto.documentofiscal.DFAmbiente; import com.fincatto.documentofiscal.DFBase; import org.simpleframework.xml.Attribute; import org.simpleframework.xml.Element; import java.time.ZonedDateTime; package com.fincatto.documentofiscal.nfe310.classes; public class NFProtocoloInfo extends DFBase { private static final long serialVersionUID = -7256753142051587115L; @Attribute(name = "Id", required = false) private String identificador; @Element(name = "tpAmb")
private DFAmbiente ambiente;
wmixvideo/nfe
src/main/java/com/fincatto/documentofiscal/nfe310/classes/nota/NFNotaInfoItemImpostoICMS40.java
// Path: src/main/java/com/fincatto/documentofiscal/nfe310/classes/NFNotaInfoImpostoTributacaoICMS.java // public enum NFNotaInfoImpostoTributacaoICMS { // // TRIBUTACAO_INTEGRALMENTE("00", "Tributada integralmente"), // TRIBUTADA_COM_COBRANCA_ICMS_POR_SUBSTITUICAO_TRIBUTARIA("10", "Tributada com cobran\u00e7a de ICMS por ST"), // COM_REDUCAO_BASE_CALCULO("20", "Com redu\u00e7\u00e3o da base de c\u00e1lculo"), // ISENTA_OU_NAO_TRIBUTADA_COM_COBRANCA_ICMS_POR_SUBSTITUICAO_TRIBUTARIA("30", "Isenta ou n\u00e3o tributada com cobran\u00e7a de ICMS por ST"), // ISENTA("40", "Isenta"), // NAO_TRIBUTADO("41", "N\u00e3o tributada"), // SUSPENSAO("50", "Suspens\u00e3o"), // DIFERIMENTO("51", "Diferimento"), // ICMS_COBRADO_ANTERIORMENTE_POR_SUBSTITUICAO_TRIBUTARIA("60", "ICMS cobrado anteriormente por ST"), // COM_REDUCAO_BASE_CALCULO_COBRANCA_ICMS_POR_SUBSTITUICAO_TRIBUTARIA_ICMS_SUBSTITUICAO_TRIBUTARIA("70", "Com redu\u00e7\u00e3o da base de c\u00e1lculo/Cobran\u00e7a ICMS por ST/ICMS ST"), // OUTROS("90", "Outros"); // // private final String codigo; // private final String descricao; // // NFNotaInfoImpostoTributacaoICMS(final String codigo, final String descricao) { // this.codigo = codigo; // this.descricao = descricao; // } // // public String getCodigo() { // return this.codigo; // } // // public String getDescricao() { // return this.descricao; // } // // public static NFNotaInfoImpostoTributacaoICMS valueOfCodigo(final String codigoICMS) { // for (final NFNotaInfoImpostoTributacaoICMS icms : NFNotaInfoImpostoTributacaoICMS.values()) { // if (icms.getCodigo().equals(codigoICMS)) { // return icms; // } // } // return null; // } // // @Override // public String toString() { // return codigo + " - " + descricao; // } // }
import com.fincatto.documentofiscal.DFBase; import com.fincatto.documentofiscal.nfe310.classes.NFNotaInfoImpostoTributacaoICMS; import com.fincatto.documentofiscal.nfe310.classes.NFNotaMotivoDesoneracaoICMS; import com.fincatto.documentofiscal.nfe310.classes.NFOrigem; import com.fincatto.documentofiscal.validadores.DFBigDecimalValidador; import org.simpleframework.xml.Element; import java.math.BigDecimal;
package com.fincatto.documentofiscal.nfe310.classes.nota; public class NFNotaInfoItemImpostoICMS40 extends DFBase { private static final long serialVersionUID = -366528394939416671L; @Element(name = "orig") private NFOrigem origem; @Element(name = "CST")
// Path: src/main/java/com/fincatto/documentofiscal/nfe310/classes/NFNotaInfoImpostoTributacaoICMS.java // public enum NFNotaInfoImpostoTributacaoICMS { // // TRIBUTACAO_INTEGRALMENTE("00", "Tributada integralmente"), // TRIBUTADA_COM_COBRANCA_ICMS_POR_SUBSTITUICAO_TRIBUTARIA("10", "Tributada com cobran\u00e7a de ICMS por ST"), // COM_REDUCAO_BASE_CALCULO("20", "Com redu\u00e7\u00e3o da base de c\u00e1lculo"), // ISENTA_OU_NAO_TRIBUTADA_COM_COBRANCA_ICMS_POR_SUBSTITUICAO_TRIBUTARIA("30", "Isenta ou n\u00e3o tributada com cobran\u00e7a de ICMS por ST"), // ISENTA("40", "Isenta"), // NAO_TRIBUTADO("41", "N\u00e3o tributada"), // SUSPENSAO("50", "Suspens\u00e3o"), // DIFERIMENTO("51", "Diferimento"), // ICMS_COBRADO_ANTERIORMENTE_POR_SUBSTITUICAO_TRIBUTARIA("60", "ICMS cobrado anteriormente por ST"), // COM_REDUCAO_BASE_CALCULO_COBRANCA_ICMS_POR_SUBSTITUICAO_TRIBUTARIA_ICMS_SUBSTITUICAO_TRIBUTARIA("70", "Com redu\u00e7\u00e3o da base de c\u00e1lculo/Cobran\u00e7a ICMS por ST/ICMS ST"), // OUTROS("90", "Outros"); // // private final String codigo; // private final String descricao; // // NFNotaInfoImpostoTributacaoICMS(final String codigo, final String descricao) { // this.codigo = codigo; // this.descricao = descricao; // } // // public String getCodigo() { // return this.codigo; // } // // public String getDescricao() { // return this.descricao; // } // // public static NFNotaInfoImpostoTributacaoICMS valueOfCodigo(final String codigoICMS) { // for (final NFNotaInfoImpostoTributacaoICMS icms : NFNotaInfoImpostoTributacaoICMS.values()) { // if (icms.getCodigo().equals(codigoICMS)) { // return icms; // } // } // return null; // } // // @Override // public String toString() { // return codigo + " - " + descricao; // } // } // Path: src/main/java/com/fincatto/documentofiscal/nfe310/classes/nota/NFNotaInfoItemImpostoICMS40.java import com.fincatto.documentofiscal.DFBase; import com.fincatto.documentofiscal.nfe310.classes.NFNotaInfoImpostoTributacaoICMS; import com.fincatto.documentofiscal.nfe310.classes.NFNotaMotivoDesoneracaoICMS; import com.fincatto.documentofiscal.nfe310.classes.NFOrigem; import com.fincatto.documentofiscal.validadores.DFBigDecimalValidador; import org.simpleframework.xml.Element; import java.math.BigDecimal; package com.fincatto.documentofiscal.nfe310.classes.nota; public class NFNotaInfoItemImpostoICMS40 extends DFBase { private static final long serialVersionUID = -366528394939416671L; @Element(name = "orig") private NFOrigem origem; @Element(name = "CST")
private NFNotaInfoImpostoTributacaoICMS situacaoTributaria;
wmixvideo/nfe
src/test/java/com/fincatto/documentofiscal/nfe310/classes/NFNotaInfoImpostoTributacaoICMSTest.java
// Path: src/main/java/com/fincatto/documentofiscal/nfe310/classes/NFNotaInfoImpostoTributacaoICMS.java // public enum NFNotaInfoImpostoTributacaoICMS { // // TRIBUTACAO_INTEGRALMENTE("00", "Tributada integralmente"), // TRIBUTADA_COM_COBRANCA_ICMS_POR_SUBSTITUICAO_TRIBUTARIA("10", "Tributada com cobran\u00e7a de ICMS por ST"), // COM_REDUCAO_BASE_CALCULO("20", "Com redu\u00e7\u00e3o da base de c\u00e1lculo"), // ISENTA_OU_NAO_TRIBUTADA_COM_COBRANCA_ICMS_POR_SUBSTITUICAO_TRIBUTARIA("30", "Isenta ou n\u00e3o tributada com cobran\u00e7a de ICMS por ST"), // ISENTA("40", "Isenta"), // NAO_TRIBUTADO("41", "N\u00e3o tributada"), // SUSPENSAO("50", "Suspens\u00e3o"), // DIFERIMENTO("51", "Diferimento"), // ICMS_COBRADO_ANTERIORMENTE_POR_SUBSTITUICAO_TRIBUTARIA("60", "ICMS cobrado anteriormente por ST"), // COM_REDUCAO_BASE_CALCULO_COBRANCA_ICMS_POR_SUBSTITUICAO_TRIBUTARIA_ICMS_SUBSTITUICAO_TRIBUTARIA("70", "Com redu\u00e7\u00e3o da base de c\u00e1lculo/Cobran\u00e7a ICMS por ST/ICMS ST"), // OUTROS("90", "Outros"); // // private final String codigo; // private final String descricao; // // NFNotaInfoImpostoTributacaoICMS(final String codigo, final String descricao) { // this.codigo = codigo; // this.descricao = descricao; // } // // public String getCodigo() { // return this.codigo; // } // // public String getDescricao() { // return this.descricao; // } // // public static NFNotaInfoImpostoTributacaoICMS valueOfCodigo(final String codigoICMS) { // for (final NFNotaInfoImpostoTributacaoICMS icms : NFNotaInfoImpostoTributacaoICMS.values()) { // if (icms.getCodigo().equals(codigoICMS)) { // return icms; // } // } // return null; // } // // @Override // public String toString() { // return codigo + " - " + descricao; // } // }
import org.junit.Assert; import org.junit.Test; import com.fincatto.documentofiscal.nfe310.classes.NFNotaInfoImpostoTributacaoICMS;
package com.fincatto.documentofiscal.nfe310.classes; public class NFNotaInfoImpostoTributacaoICMSTest { @Test public void deveRepresentarOCodigoCorretamente() {
// Path: src/main/java/com/fincatto/documentofiscal/nfe310/classes/NFNotaInfoImpostoTributacaoICMS.java // public enum NFNotaInfoImpostoTributacaoICMS { // // TRIBUTACAO_INTEGRALMENTE("00", "Tributada integralmente"), // TRIBUTADA_COM_COBRANCA_ICMS_POR_SUBSTITUICAO_TRIBUTARIA("10", "Tributada com cobran\u00e7a de ICMS por ST"), // COM_REDUCAO_BASE_CALCULO("20", "Com redu\u00e7\u00e3o da base de c\u00e1lculo"), // ISENTA_OU_NAO_TRIBUTADA_COM_COBRANCA_ICMS_POR_SUBSTITUICAO_TRIBUTARIA("30", "Isenta ou n\u00e3o tributada com cobran\u00e7a de ICMS por ST"), // ISENTA("40", "Isenta"), // NAO_TRIBUTADO("41", "N\u00e3o tributada"), // SUSPENSAO("50", "Suspens\u00e3o"), // DIFERIMENTO("51", "Diferimento"), // ICMS_COBRADO_ANTERIORMENTE_POR_SUBSTITUICAO_TRIBUTARIA("60", "ICMS cobrado anteriormente por ST"), // COM_REDUCAO_BASE_CALCULO_COBRANCA_ICMS_POR_SUBSTITUICAO_TRIBUTARIA_ICMS_SUBSTITUICAO_TRIBUTARIA("70", "Com redu\u00e7\u00e3o da base de c\u00e1lculo/Cobran\u00e7a ICMS por ST/ICMS ST"), // OUTROS("90", "Outros"); // // private final String codigo; // private final String descricao; // // NFNotaInfoImpostoTributacaoICMS(final String codigo, final String descricao) { // this.codigo = codigo; // this.descricao = descricao; // } // // public String getCodigo() { // return this.codigo; // } // // public String getDescricao() { // return this.descricao; // } // // public static NFNotaInfoImpostoTributacaoICMS valueOfCodigo(final String codigoICMS) { // for (final NFNotaInfoImpostoTributacaoICMS icms : NFNotaInfoImpostoTributacaoICMS.values()) { // if (icms.getCodigo().equals(codigoICMS)) { // return icms; // } // } // return null; // } // // @Override // public String toString() { // return codigo + " - " + descricao; // } // } // Path: src/test/java/com/fincatto/documentofiscal/nfe310/classes/NFNotaInfoImpostoTributacaoICMSTest.java import org.junit.Assert; import org.junit.Test; import com.fincatto.documentofiscal.nfe310.classes.NFNotaInfoImpostoTributacaoICMS; package com.fincatto.documentofiscal.nfe310.classes; public class NFNotaInfoImpostoTributacaoICMSTest { @Test public void deveRepresentarOCodigoCorretamente() {
Assert.assertEquals("00", NFNotaInfoImpostoTributacaoICMS.TRIBUTACAO_INTEGRALMENTE.getCodigo());
wmixvideo/nfe
src/main/java/com/fincatto/documentofiscal/nfe310/classes/nota/NFNotaInfoItemImpostoICMS20.java
// Path: src/main/java/com/fincatto/documentofiscal/nfe310/classes/NFNotaInfoImpostoTributacaoICMS.java // public enum NFNotaInfoImpostoTributacaoICMS { // // TRIBUTACAO_INTEGRALMENTE("00", "Tributada integralmente"), // TRIBUTADA_COM_COBRANCA_ICMS_POR_SUBSTITUICAO_TRIBUTARIA("10", "Tributada com cobran\u00e7a de ICMS por ST"), // COM_REDUCAO_BASE_CALCULO("20", "Com redu\u00e7\u00e3o da base de c\u00e1lculo"), // ISENTA_OU_NAO_TRIBUTADA_COM_COBRANCA_ICMS_POR_SUBSTITUICAO_TRIBUTARIA("30", "Isenta ou n\u00e3o tributada com cobran\u00e7a de ICMS por ST"), // ISENTA("40", "Isenta"), // NAO_TRIBUTADO("41", "N\u00e3o tributada"), // SUSPENSAO("50", "Suspens\u00e3o"), // DIFERIMENTO("51", "Diferimento"), // ICMS_COBRADO_ANTERIORMENTE_POR_SUBSTITUICAO_TRIBUTARIA("60", "ICMS cobrado anteriormente por ST"), // COM_REDUCAO_BASE_CALCULO_COBRANCA_ICMS_POR_SUBSTITUICAO_TRIBUTARIA_ICMS_SUBSTITUICAO_TRIBUTARIA("70", "Com redu\u00e7\u00e3o da base de c\u00e1lculo/Cobran\u00e7a ICMS por ST/ICMS ST"), // OUTROS("90", "Outros"); // // private final String codigo; // private final String descricao; // // NFNotaInfoImpostoTributacaoICMS(final String codigo, final String descricao) { // this.codigo = codigo; // this.descricao = descricao; // } // // public String getCodigo() { // return this.codigo; // } // // public String getDescricao() { // return this.descricao; // } // // public static NFNotaInfoImpostoTributacaoICMS valueOfCodigo(final String codigoICMS) { // for (final NFNotaInfoImpostoTributacaoICMS icms : NFNotaInfoImpostoTributacaoICMS.values()) { // if (icms.getCodigo().equals(codigoICMS)) { // return icms; // } // } // return null; // } // // @Override // public String toString() { // return codigo + " - " + descricao; // } // }
import com.fincatto.documentofiscal.DFBase; import com.fincatto.documentofiscal.nfe310.classes.NFNotaInfoImpostoTributacaoICMS; import com.fincatto.documentofiscal.nfe310.classes.NFNotaInfoItemModalidadeBCICMS; import com.fincatto.documentofiscal.nfe310.classes.NFNotaMotivoDesoneracaoICMS; import com.fincatto.documentofiscal.nfe310.classes.NFOrigem; import com.fincatto.documentofiscal.validadores.DFBigDecimalValidador; import org.simpleframework.xml.Element; import java.math.BigDecimal;
package com.fincatto.documentofiscal.nfe310.classes.nota; public class NFNotaInfoItemImpostoICMS20 extends DFBase { private static final long serialVersionUID = -7632059708755735047L; @Element(name = "orig") private NFOrigem origem; @Element(name = "CST")
// Path: src/main/java/com/fincatto/documentofiscal/nfe310/classes/NFNotaInfoImpostoTributacaoICMS.java // public enum NFNotaInfoImpostoTributacaoICMS { // // TRIBUTACAO_INTEGRALMENTE("00", "Tributada integralmente"), // TRIBUTADA_COM_COBRANCA_ICMS_POR_SUBSTITUICAO_TRIBUTARIA("10", "Tributada com cobran\u00e7a de ICMS por ST"), // COM_REDUCAO_BASE_CALCULO("20", "Com redu\u00e7\u00e3o da base de c\u00e1lculo"), // ISENTA_OU_NAO_TRIBUTADA_COM_COBRANCA_ICMS_POR_SUBSTITUICAO_TRIBUTARIA("30", "Isenta ou n\u00e3o tributada com cobran\u00e7a de ICMS por ST"), // ISENTA("40", "Isenta"), // NAO_TRIBUTADO("41", "N\u00e3o tributada"), // SUSPENSAO("50", "Suspens\u00e3o"), // DIFERIMENTO("51", "Diferimento"), // ICMS_COBRADO_ANTERIORMENTE_POR_SUBSTITUICAO_TRIBUTARIA("60", "ICMS cobrado anteriormente por ST"), // COM_REDUCAO_BASE_CALCULO_COBRANCA_ICMS_POR_SUBSTITUICAO_TRIBUTARIA_ICMS_SUBSTITUICAO_TRIBUTARIA("70", "Com redu\u00e7\u00e3o da base de c\u00e1lculo/Cobran\u00e7a ICMS por ST/ICMS ST"), // OUTROS("90", "Outros"); // // private final String codigo; // private final String descricao; // // NFNotaInfoImpostoTributacaoICMS(final String codigo, final String descricao) { // this.codigo = codigo; // this.descricao = descricao; // } // // public String getCodigo() { // return this.codigo; // } // // public String getDescricao() { // return this.descricao; // } // // public static NFNotaInfoImpostoTributacaoICMS valueOfCodigo(final String codigoICMS) { // for (final NFNotaInfoImpostoTributacaoICMS icms : NFNotaInfoImpostoTributacaoICMS.values()) { // if (icms.getCodigo().equals(codigoICMS)) { // return icms; // } // } // return null; // } // // @Override // public String toString() { // return codigo + " - " + descricao; // } // } // Path: src/main/java/com/fincatto/documentofiscal/nfe310/classes/nota/NFNotaInfoItemImpostoICMS20.java import com.fincatto.documentofiscal.DFBase; import com.fincatto.documentofiscal.nfe310.classes.NFNotaInfoImpostoTributacaoICMS; import com.fincatto.documentofiscal.nfe310.classes.NFNotaInfoItemModalidadeBCICMS; import com.fincatto.documentofiscal.nfe310.classes.NFNotaMotivoDesoneracaoICMS; import com.fincatto.documentofiscal.nfe310.classes.NFOrigem; import com.fincatto.documentofiscal.validadores.DFBigDecimalValidador; import org.simpleframework.xml.Element; import java.math.BigDecimal; package com.fincatto.documentofiscal.nfe310.classes.nota; public class NFNotaInfoItemImpostoICMS20 extends DFBase { private static final long serialVersionUID = -7632059708755735047L; @Element(name = "orig") private NFOrigem origem; @Element(name = "CST")
private NFNotaInfoImpostoTributacaoICMS situacaoTributaria;
beiyoufx/teemo
teemo/src/main/java/com/teemo/entity/Permission.java
// Path: teemo/src/main/java/com/teemo/core/entity/BaseEntity.java // public abstract class BaseEntity implements Serializable { // }
import com.alibaba.fastjson.annotation.JSONType; import com.teemo.core.entity.BaseEntity; import core.support.repository.EnabledQueryCache; import org.hibernate.annotations.Cache; import org.hibernate.annotations.CacheConcurrencyStrategy; import javax.persistence.*;
/** * Copyright (c) 2016- https://github.com/beiyoufx * * Licensed under the GPL-3.0 */ package com.teemo.entity; /** * @author yongjie.teng * @date 16-11-21 下午5:47 * @email yongjie.teng@foxmail.com * @package com.teemo.entity */ @Entity @Table(name = "permission") @Cache(region = "all", usage = CacheConcurrencyStrategy.READ_WRITE) @EnabledQueryCache @JSONType(orders = {"id", "permissionKey", "permissionValue", "description", "available"})
// Path: teemo/src/main/java/com/teemo/core/entity/BaseEntity.java // public abstract class BaseEntity implements Serializable { // } // Path: teemo/src/main/java/com/teemo/entity/Permission.java import com.alibaba.fastjson.annotation.JSONType; import com.teemo.core.entity.BaseEntity; import core.support.repository.EnabledQueryCache; import org.hibernate.annotations.Cache; import org.hibernate.annotations.CacheConcurrencyStrategy; import javax.persistence.*; /** * Copyright (c) 2016- https://github.com/beiyoufx * * Licensed under the GPL-3.0 */ package com.teemo.entity; /** * @author yongjie.teng * @date 16-11-21 下午5:47 * @email yongjie.teng@foxmail.com * @package com.teemo.entity */ @Entity @Table(name = "permission") @Cache(region = "all", usage = CacheConcurrencyStrategy.READ_WRITE) @EnabledQueryCache @JSONType(orders = {"id", "permissionKey", "permissionValue", "description", "available"})
public class Permission extends BaseEntity {
beiyoufx/teemo
teemo/src/main/java/com/teemo/entity/Role.java
// Path: teemo/src/main/java/com/teemo/core/entity/BaseEntity.java // public abstract class BaseEntity implements Serializable { // }
import com.alibaba.fastjson.annotation.JSONType; import com.teemo.core.entity.BaseEntity; import core.support.repository.EnabledQueryCache; import org.hibernate.annotations.CacheConcurrencyStrategy; import org.hibernate.annotations.Cache; import javax.persistence.*; import java.util.HashSet; import java.util.Set;
/** * Copyright (c) 2016- https://github.com/beiyoufx * * Licensed under the GPL-3.0 */ package com.teemo.entity; /** * @author yongjie.teng * @version 1.0 * @date 16-10-21 * @email yongjie.teng@foxmail.com * @package com.teemo.entity * @project teemo */ @Entity @Table(name = "role") @Cache(region = "all", usage = CacheConcurrencyStrategy.READ_WRITE) @EnabledQueryCache @JSONType(orders = {"id", "roleKey", "roleValue", "description", "available"}, ignores = {"resourcePermissions"})
// Path: teemo/src/main/java/com/teemo/core/entity/BaseEntity.java // public abstract class BaseEntity implements Serializable { // } // Path: teemo/src/main/java/com/teemo/entity/Role.java import com.alibaba.fastjson.annotation.JSONType; import com.teemo.core.entity.BaseEntity; import core.support.repository.EnabledQueryCache; import org.hibernate.annotations.CacheConcurrencyStrategy; import org.hibernate.annotations.Cache; import javax.persistence.*; import java.util.HashSet; import java.util.Set; /** * Copyright (c) 2016- https://github.com/beiyoufx * * Licensed under the GPL-3.0 */ package com.teemo.entity; /** * @author yongjie.teng * @version 1.0 * @date 16-10-21 * @email yongjie.teng@foxmail.com * @package com.teemo.entity * @project teemo */ @Entity @Table(name = "role") @Cache(region = "all", usage = CacheConcurrencyStrategy.READ_WRITE) @EnabledQueryCache @JSONType(orders = {"id", "roleKey", "roleValue", "description", "available"}, ignores = {"resourcePermissions"})
public class Role extends BaseEntity {
beiyoufx/teemo
teemo/src/main/java/com/teemo/entity/UserLastOnline.java
// Path: teemo/src/main/java/com/teemo/core/entity/BaseEntity.java // public abstract class BaseEntity implements Serializable { // }
import com.alibaba.fastjson.annotation.JSONField; import com.teemo.core.entity.BaseEntity; import org.hibernate.annotations.CacheConcurrencyStrategy; import org.hibernate.annotations.Cache; import org.springframework.format.annotation.DateTimeFormat; import javax.persistence.*; import java.util.Date;
/** * Copyright (c) 2016- https://github.com/beiyoufx * * Licensed under the GPL-3.0 */ package com.teemo.entity; /** * 用户的最后在线信息 * @author yongjie.teng * @version 1.0 * @date 16-10-26 * @email yongjie.teng@foxmail.com * @package com.teemo.entity * @project teemo */ @Entity @Table(name = "user_last_online") @Cache(region = "all", usage = CacheConcurrencyStrategy.READ_WRITE)
// Path: teemo/src/main/java/com/teemo/core/entity/BaseEntity.java // public abstract class BaseEntity implements Serializable { // } // Path: teemo/src/main/java/com/teemo/entity/UserLastOnline.java import com.alibaba.fastjson.annotation.JSONField; import com.teemo.core.entity.BaseEntity; import org.hibernate.annotations.CacheConcurrencyStrategy; import org.hibernate.annotations.Cache; import org.springframework.format.annotation.DateTimeFormat; import javax.persistence.*; import java.util.Date; /** * Copyright (c) 2016- https://github.com/beiyoufx * * Licensed under the GPL-3.0 */ package com.teemo.entity; /** * 用户的最后在线信息 * @author yongjie.teng * @version 1.0 * @date 16-10-26 * @email yongjie.teng@foxmail.com * @package com.teemo.entity * @project teemo */ @Entity @Table(name = "user_last_online") @Cache(region = "all", usage = CacheConcurrencyStrategy.READ_WRITE)
public class UserLastOnline extends BaseEntity {
beiyoufx/teemo
teemo/src/main/java/com/teemo/entity/User.java
// Path: teemo/src/main/java/com/teemo/core/entity/BaseEntity.java // public abstract class BaseEntity implements Serializable { // } // // Path: teemo/src/main/java/com/teemo/core/entity/LogicDeletable.java // public interface LogicDeletable { // public Boolean getDeleted(); // public void setDeleted(Boolean deleted); // // /** // * 标记实体为已删除 // */ // public void markDeleted(); // }
import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.annotation.JSONType; import com.teemo.core.entity.BaseEntity; import com.teemo.core.entity.LogicDeletable; import core.support.repository.EnabledQueryCache; import org.hibernate.annotations.Cache; import org.hibernate.annotations.CacheConcurrencyStrategy; import org.hibernate.annotations.DynamicInsert; import javax.persistence.*; import java.util.Date; import java.util.HashSet; import java.util.Set;
/** * Copyright (c) 2016- https://github.com/beiyoufx * * Licensed under the GPL-3.0 */ package com.teemo.entity; /** * 用户信息 * @author yongjie.teng * @version 1.0 * @date 16-10-21 * @email yongjie.teng@foxmail.com * @package com.teemo.entity * @project teemo */ @Entity @Table(name = "user") @DynamicInsert(value = true) @Cache(region = "all", usage = CacheConcurrencyStrategy.READ_WRITE) @EnabledQueryCache @JSONType(orders = {"id", "username", "nickname", "email", "mobilePhone", "status", "departmentKey", "createTime", "modifyTime", "roles"}, ignores = {"password", "salt", "deleted"})
// Path: teemo/src/main/java/com/teemo/core/entity/BaseEntity.java // public abstract class BaseEntity implements Serializable { // } // // Path: teemo/src/main/java/com/teemo/core/entity/LogicDeletable.java // public interface LogicDeletable { // public Boolean getDeleted(); // public void setDeleted(Boolean deleted); // // /** // * 标记实体为已删除 // */ // public void markDeleted(); // } // Path: teemo/src/main/java/com/teemo/entity/User.java import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.annotation.JSONType; import com.teemo.core.entity.BaseEntity; import com.teemo.core.entity.LogicDeletable; import core.support.repository.EnabledQueryCache; import org.hibernate.annotations.Cache; import org.hibernate.annotations.CacheConcurrencyStrategy; import org.hibernate.annotations.DynamicInsert; import javax.persistence.*; import java.util.Date; import java.util.HashSet; import java.util.Set; /** * Copyright (c) 2016- https://github.com/beiyoufx * * Licensed under the GPL-3.0 */ package com.teemo.entity; /** * 用户信息 * @author yongjie.teng * @version 1.0 * @date 16-10-21 * @email yongjie.teng@foxmail.com * @package com.teemo.entity * @project teemo */ @Entity @Table(name = "user") @DynamicInsert(value = true) @Cache(region = "all", usage = CacheConcurrencyStrategy.READ_WRITE) @EnabledQueryCache @JSONType(orders = {"id", "username", "nickname", "email", "mobilePhone", "status", "departmentKey", "createTime", "modifyTime", "roles"}, ignores = {"password", "salt", "deleted"})
public class User extends BaseEntity implements LogicDeletable {
beiyoufx/teemo
teemo/src/main/java/com/teemo/entity/User.java
// Path: teemo/src/main/java/com/teemo/core/entity/BaseEntity.java // public abstract class BaseEntity implements Serializable { // } // // Path: teemo/src/main/java/com/teemo/core/entity/LogicDeletable.java // public interface LogicDeletable { // public Boolean getDeleted(); // public void setDeleted(Boolean deleted); // // /** // * 标记实体为已删除 // */ // public void markDeleted(); // }
import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.annotation.JSONType; import com.teemo.core.entity.BaseEntity; import com.teemo.core.entity.LogicDeletable; import core.support.repository.EnabledQueryCache; import org.hibernate.annotations.Cache; import org.hibernate.annotations.CacheConcurrencyStrategy; import org.hibernate.annotations.DynamicInsert; import javax.persistence.*; import java.util.Date; import java.util.HashSet; import java.util.Set;
/** * Copyright (c) 2016- https://github.com/beiyoufx * * Licensed under the GPL-3.0 */ package com.teemo.entity; /** * 用户信息 * @author yongjie.teng * @version 1.0 * @date 16-10-21 * @email yongjie.teng@foxmail.com * @package com.teemo.entity * @project teemo */ @Entity @Table(name = "user") @DynamicInsert(value = true) @Cache(region = "all", usage = CacheConcurrencyStrategy.READ_WRITE) @EnabledQueryCache @JSONType(orders = {"id", "username", "nickname", "email", "mobilePhone", "status", "departmentKey", "createTime", "modifyTime", "roles"}, ignores = {"password", "salt", "deleted"})
// Path: teemo/src/main/java/com/teemo/core/entity/BaseEntity.java // public abstract class BaseEntity implements Serializable { // } // // Path: teemo/src/main/java/com/teemo/core/entity/LogicDeletable.java // public interface LogicDeletable { // public Boolean getDeleted(); // public void setDeleted(Boolean deleted); // // /** // * 标记实体为已删除 // */ // public void markDeleted(); // } // Path: teemo/src/main/java/com/teemo/entity/User.java import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.annotation.JSONType; import com.teemo.core.entity.BaseEntity; import com.teemo.core.entity.LogicDeletable; import core.support.repository.EnabledQueryCache; import org.hibernate.annotations.Cache; import org.hibernate.annotations.CacheConcurrencyStrategy; import org.hibernate.annotations.DynamicInsert; import javax.persistence.*; import java.util.Date; import java.util.HashSet; import java.util.Set; /** * Copyright (c) 2016- https://github.com/beiyoufx * * Licensed under the GPL-3.0 */ package com.teemo.entity; /** * 用户信息 * @author yongjie.teng * @version 1.0 * @date 16-10-21 * @email yongjie.teng@foxmail.com * @package com.teemo.entity * @project teemo */ @Entity @Table(name = "user") @DynamicInsert(value = true) @Cache(region = "all", usage = CacheConcurrencyStrategy.READ_WRITE) @EnabledQueryCache @JSONType(orders = {"id", "username", "nickname", "email", "mobilePhone", "status", "departmentKey", "createTime", "modifyTime", "roles"}, ignores = {"password", "salt", "deleted"})
public class User extends BaseEntity implements LogicDeletable {
beiyoufx/teemo
teemo/src/main/java/com/teemo/entity/Resource.java
// Path: teemo/src/main/java/com/teemo/core/entity/BaseEntity.java // public abstract class BaseEntity implements Serializable { // }
import com.alibaba.fastjson.annotation.JSONType; import com.teemo.core.entity.BaseEntity; import core.support.repository.EnabledQueryCache; import org.hibernate.annotations.Cache; import org.hibernate.annotations.CacheConcurrencyStrategy; import javax.persistence.*;
/** * Copyright (c) 2016- https://github.com/beiyoufx * * Licensed under the GPL-3.0 */ package com.teemo.entity; /** * @author yongjie.teng * @date 16-11-21 下午5:54 * @email yongjie.teng@foxmail.com * @package com.teemo.entity */ @Entity @Table(name = "resource") @Cache(region = "all", usage = CacheConcurrencyStrategy.READ_WRITE) @EnabledQueryCache @JSONType(orders = {"id", "resourceKey", "resourceValue", "url", "parentId", "parentIds", "type", "menuIcon", "sequence", "available"})
// Path: teemo/src/main/java/com/teemo/core/entity/BaseEntity.java // public abstract class BaseEntity implements Serializable { // } // Path: teemo/src/main/java/com/teemo/entity/Resource.java import com.alibaba.fastjson.annotation.JSONType; import com.teemo.core.entity.BaseEntity; import core.support.repository.EnabledQueryCache; import org.hibernate.annotations.Cache; import org.hibernate.annotations.CacheConcurrencyStrategy; import javax.persistence.*; /** * Copyright (c) 2016- https://github.com/beiyoufx * * Licensed under the GPL-3.0 */ package com.teemo.entity; /** * @author yongjie.teng * @date 16-11-21 下午5:54 * @email yongjie.teng@foxmail.com * @package com.teemo.entity */ @Entity @Table(name = "resource") @Cache(region = "all", usage = CacheConcurrencyStrategy.READ_WRITE) @EnabledQueryCache @JSONType(orders = {"id", "resourceKey", "resourceValue", "url", "parentId", "parentIds", "type", "menuIcon", "sequence", "available"})
public class Resource extends BaseEntity {
beiyoufx/teemo
teemo/src/main/java/core/web/controller/BaseController.java
// Path: teemo/src/main/java/core/support/CustomDateEditor.java // public class CustomDateEditor extends PropertyEditorSupport { // // public static final String DEFAULT_DATE_FORMAT = "yyyy-MM-dd"; // public static final String DEFAULT_DATETIME_FORMAT = "yyyy-MM-dd HH:mm:ss"; // public static final DateFormat[] ACCEPT_DATE_FORMATS = { new SimpleDateFormat(DEFAULT_DATETIME_FORMAT), new SimpleDateFormat(DEFAULT_DATE_FORMAT) }; // // /** // * Parse the Date from the given text, using the specified DateFormat. // */ // // public void setAsText(String text) throws IllegalArgumentException { // if (text == null || text.trim().equals("")) // setValue(null); // for (DateFormat format : ACCEPT_DATE_FORMATS) { // try { // setValue(format.parse(text)); // return; // } catch (ParseException e) { // continue; // } catch (RuntimeException e) { // continue; // } // } // } // // /** // * Format the Date as String, using the specified DateFormat. // */ // // public String getAsText() { // return (String) getValue(); // } // }
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.serializer.SerializerFeature; import core.support.CustomDateEditor; import org.springframework.web.bind.WebDataBinder; import org.springframework.web.bind.annotation.InitBinder; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.Date;
/** * Copyright (c) 2016- https://github.com/beiyoufx * * Licensed under the GPL-3.0 */ package core.web.controller; /** * @author yongjie.teng * @version 1.0 * @date 16-10-27 * @email yongjie.teng@foxmail.com * @package core.web.controller * @project teemo */ public abstract class BaseController { @InitBinder public void initBinder(WebDataBinder binder) {
// Path: teemo/src/main/java/core/support/CustomDateEditor.java // public class CustomDateEditor extends PropertyEditorSupport { // // public static final String DEFAULT_DATE_FORMAT = "yyyy-MM-dd"; // public static final String DEFAULT_DATETIME_FORMAT = "yyyy-MM-dd HH:mm:ss"; // public static final DateFormat[] ACCEPT_DATE_FORMATS = { new SimpleDateFormat(DEFAULT_DATETIME_FORMAT), new SimpleDateFormat(DEFAULT_DATE_FORMAT) }; // // /** // * Parse the Date from the given text, using the specified DateFormat. // */ // // public void setAsText(String text) throws IllegalArgumentException { // if (text == null || text.trim().equals("")) // setValue(null); // for (DateFormat format : ACCEPT_DATE_FORMATS) { // try { // setValue(format.parse(text)); // return; // } catch (ParseException e) { // continue; // } catch (RuntimeException e) { // continue; // } // } // } // // /** // * Format the Date as String, using the specified DateFormat. // */ // // public String getAsText() { // return (String) getValue(); // } // } // Path: teemo/src/main/java/core/web/controller/BaseController.java import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.serializer.SerializerFeature; import core.support.CustomDateEditor; import org.springframework.web.bind.WebDataBinder; import org.springframework.web.bind.annotation.InitBinder; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.Date; /** * Copyright (c) 2016- https://github.com/beiyoufx * * Licensed under the GPL-3.0 */ package core.web.controller; /** * @author yongjie.teng * @version 1.0 * @date 16-10-27 * @email yongjie.teng@foxmail.com * @package core.web.controller * @project teemo */ public abstract class BaseController { @InitBinder public void initBinder(WebDataBinder binder) {
binder.registerCustomEditor(Date.class, new CustomDateEditor());
beiyoufx/teemo
teemo/src/main/java/com/teemo/entity/DynamicProperty.java
// Path: teemo/src/main/java/com/teemo/core/entity/BaseEntity.java // public abstract class BaseEntity implements Serializable { // } // // Path: teemo/src/main/java/com/teemo/core/entity/LogicDeletable.java // public interface LogicDeletable { // public Boolean getDeleted(); // public void setDeleted(Boolean deleted); // // /** // * 标记实体为已删除 // */ // public void markDeleted(); // }
import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.annotation.JSONType; import com.teemo.core.entity.BaseEntity; import com.teemo.core.entity.LogicDeletable; import core.support.repository.EnabledQueryCache; import org.hibernate.annotations.Cache; import org.hibernate.annotations.CacheConcurrencyStrategy; import org.hibernate.annotations.DynamicInsert; import javax.persistence.*; import java.util.Date;
/** * Copyright (c) 2016- https://github.com/beiyoufx * * Licensed under the GPL-3.0 */ package com.teemo.entity; /** * @author yongjie.teng * @date 16-10-31 下午2:57 * @email yongjie.teng@foxmail.com * @package com.teemo.entity */ @Entity @Table(name = "dynamic_property") @DynamicInsert(value = true) @Cache(region = "all", usage = CacheConcurrencyStrategy.READ_WRITE) @EnabledQueryCache @JSONType(orders = {"id", "dynamicPropertyKey", "dynamicPropertyValue", "author", "description", "version", "createTime", "modifyTime"})
// Path: teemo/src/main/java/com/teemo/core/entity/BaseEntity.java // public abstract class BaseEntity implements Serializable { // } // // Path: teemo/src/main/java/com/teemo/core/entity/LogicDeletable.java // public interface LogicDeletable { // public Boolean getDeleted(); // public void setDeleted(Boolean deleted); // // /** // * 标记实体为已删除 // */ // public void markDeleted(); // } // Path: teemo/src/main/java/com/teemo/entity/DynamicProperty.java import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.annotation.JSONType; import com.teemo.core.entity.BaseEntity; import com.teemo.core.entity.LogicDeletable; import core.support.repository.EnabledQueryCache; import org.hibernate.annotations.Cache; import org.hibernate.annotations.CacheConcurrencyStrategy; import org.hibernate.annotations.DynamicInsert; import javax.persistence.*; import java.util.Date; /** * Copyright (c) 2016- https://github.com/beiyoufx * * Licensed under the GPL-3.0 */ package com.teemo.entity; /** * @author yongjie.teng * @date 16-10-31 下午2:57 * @email yongjie.teng@foxmail.com * @package com.teemo.entity */ @Entity @Table(name = "dynamic_property") @DynamicInsert(value = true) @Cache(region = "all", usage = CacheConcurrencyStrategy.READ_WRITE) @EnabledQueryCache @JSONType(orders = {"id", "dynamicPropertyKey", "dynamicPropertyValue", "author", "description", "version", "createTime", "modifyTime"})
public class DynamicProperty extends BaseEntity implements LogicDeletable {
beiyoufx/teemo
teemo/src/main/java/com/teemo/entity/DynamicProperty.java
// Path: teemo/src/main/java/com/teemo/core/entity/BaseEntity.java // public abstract class BaseEntity implements Serializable { // } // // Path: teemo/src/main/java/com/teemo/core/entity/LogicDeletable.java // public interface LogicDeletable { // public Boolean getDeleted(); // public void setDeleted(Boolean deleted); // // /** // * 标记实体为已删除 // */ // public void markDeleted(); // }
import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.annotation.JSONType; import com.teemo.core.entity.BaseEntity; import com.teemo.core.entity.LogicDeletable; import core.support.repository.EnabledQueryCache; import org.hibernate.annotations.Cache; import org.hibernate.annotations.CacheConcurrencyStrategy; import org.hibernate.annotations.DynamicInsert; import javax.persistence.*; import java.util.Date;
/** * Copyright (c) 2016- https://github.com/beiyoufx * * Licensed under the GPL-3.0 */ package com.teemo.entity; /** * @author yongjie.teng * @date 16-10-31 下午2:57 * @email yongjie.teng@foxmail.com * @package com.teemo.entity */ @Entity @Table(name = "dynamic_property") @DynamicInsert(value = true) @Cache(region = "all", usage = CacheConcurrencyStrategy.READ_WRITE) @EnabledQueryCache @JSONType(orders = {"id", "dynamicPropertyKey", "dynamicPropertyValue", "author", "description", "version", "createTime", "modifyTime"})
// Path: teemo/src/main/java/com/teemo/core/entity/BaseEntity.java // public abstract class BaseEntity implements Serializable { // } // // Path: teemo/src/main/java/com/teemo/core/entity/LogicDeletable.java // public interface LogicDeletable { // public Boolean getDeleted(); // public void setDeleted(Boolean deleted); // // /** // * 标记实体为已删除 // */ // public void markDeleted(); // } // Path: teemo/src/main/java/com/teemo/entity/DynamicProperty.java import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.annotation.JSONType; import com.teemo.core.entity.BaseEntity; import com.teemo.core.entity.LogicDeletable; import core.support.repository.EnabledQueryCache; import org.hibernate.annotations.Cache; import org.hibernate.annotations.CacheConcurrencyStrategy; import org.hibernate.annotations.DynamicInsert; import javax.persistence.*; import java.util.Date; /** * Copyright (c) 2016- https://github.com/beiyoufx * * Licensed under the GPL-3.0 */ package com.teemo.entity; /** * @author yongjie.teng * @date 16-10-31 下午2:57 * @email yongjie.teng@foxmail.com * @package com.teemo.entity */ @Entity @Table(name = "dynamic_property") @DynamicInsert(value = true) @Cache(region = "all", usage = CacheConcurrencyStrategy.READ_WRITE) @EnabledQueryCache @JSONType(orders = {"id", "dynamicPropertyKey", "dynamicPropertyValue", "author", "description", "version", "createTime", "modifyTime"})
public class DynamicProperty extends BaseEntity implements LogicDeletable {
beiyoufx/teemo
teemo/src/main/java/com/teemo/entity/Department.java
// Path: teemo/src/main/java/com/teemo/core/entity/BaseEntity.java // public abstract class BaseEntity implements Serializable { // } // // Path: teemo/src/main/java/com/teemo/core/entity/LogicDeletable.java // public interface LogicDeletable { // public Boolean getDeleted(); // public void setDeleted(Boolean deleted); // // /** // * 标记实体为已删除 // */ // public void markDeleted(); // }
import com.alibaba.fastjson.annotation.JSONType; import com.teemo.core.entity.BaseEntity; import com.teemo.core.entity.LogicDeletable; import core.support.repository.EnabledQueryCache; import org.hibernate.annotations.Cache; import org.hibernate.annotations.CacheConcurrencyStrategy; import javax.persistence.*;
/** * Copyright (c) 2016- https://github.com/beiyoufx * * Licensed under the GPL-3.0 */ package com.teemo.entity; /** * @author yongjie.teng * @version 1.0 * @date 16-10-21 * @email yongjie.teng@foxmail.com * @package com.teemo.entity * @project teemo */ @Entity @Table(name = "department") @Cache(region = "all", usage = CacheConcurrencyStrategy.READ_WRITE) @EnabledQueryCache @JSONType(orders = {"id", "departmentKey", "departmentValue", "parentId", "description"})
// Path: teemo/src/main/java/com/teemo/core/entity/BaseEntity.java // public abstract class BaseEntity implements Serializable { // } // // Path: teemo/src/main/java/com/teemo/core/entity/LogicDeletable.java // public interface LogicDeletable { // public Boolean getDeleted(); // public void setDeleted(Boolean deleted); // // /** // * 标记实体为已删除 // */ // public void markDeleted(); // } // Path: teemo/src/main/java/com/teemo/entity/Department.java import com.alibaba.fastjson.annotation.JSONType; import com.teemo.core.entity.BaseEntity; import com.teemo.core.entity.LogicDeletable; import core.support.repository.EnabledQueryCache; import org.hibernate.annotations.Cache; import org.hibernate.annotations.CacheConcurrencyStrategy; import javax.persistence.*; /** * Copyright (c) 2016- https://github.com/beiyoufx * * Licensed under the GPL-3.0 */ package com.teemo.entity; /** * @author yongjie.teng * @version 1.0 * @date 16-10-21 * @email yongjie.teng@foxmail.com * @package com.teemo.entity * @project teemo */ @Entity @Table(name = "department") @Cache(region = "all", usage = CacheConcurrencyStrategy.READ_WRITE) @EnabledQueryCache @JSONType(orders = {"id", "departmentKey", "departmentValue", "parentId", "description"})
public class Department extends BaseEntity implements LogicDeletable {
beiyoufx/teemo
teemo/src/main/java/com/teemo/entity/Department.java
// Path: teemo/src/main/java/com/teemo/core/entity/BaseEntity.java // public abstract class BaseEntity implements Serializable { // } // // Path: teemo/src/main/java/com/teemo/core/entity/LogicDeletable.java // public interface LogicDeletable { // public Boolean getDeleted(); // public void setDeleted(Boolean deleted); // // /** // * 标记实体为已删除 // */ // public void markDeleted(); // }
import com.alibaba.fastjson.annotation.JSONType; import com.teemo.core.entity.BaseEntity; import com.teemo.core.entity.LogicDeletable; import core.support.repository.EnabledQueryCache; import org.hibernate.annotations.Cache; import org.hibernate.annotations.CacheConcurrencyStrategy; import javax.persistence.*;
/** * Copyright (c) 2016- https://github.com/beiyoufx * * Licensed under the GPL-3.0 */ package com.teemo.entity; /** * @author yongjie.teng * @version 1.0 * @date 16-10-21 * @email yongjie.teng@foxmail.com * @package com.teemo.entity * @project teemo */ @Entity @Table(name = "department") @Cache(region = "all", usage = CacheConcurrencyStrategy.READ_WRITE) @EnabledQueryCache @JSONType(orders = {"id", "departmentKey", "departmentValue", "parentId", "description"})
// Path: teemo/src/main/java/com/teemo/core/entity/BaseEntity.java // public abstract class BaseEntity implements Serializable { // } // // Path: teemo/src/main/java/com/teemo/core/entity/LogicDeletable.java // public interface LogicDeletable { // public Boolean getDeleted(); // public void setDeleted(Boolean deleted); // // /** // * 标记实体为已删除 // */ // public void markDeleted(); // } // Path: teemo/src/main/java/com/teemo/entity/Department.java import com.alibaba.fastjson.annotation.JSONType; import com.teemo.core.entity.BaseEntity; import com.teemo.core.entity.LogicDeletable; import core.support.repository.EnabledQueryCache; import org.hibernate.annotations.Cache; import org.hibernate.annotations.CacheConcurrencyStrategy; import javax.persistence.*; /** * Copyright (c) 2016- https://github.com/beiyoufx * * Licensed under the GPL-3.0 */ package com.teemo.entity; /** * @author yongjie.teng * @version 1.0 * @date 16-10-21 * @email yongjie.teng@foxmail.com * @package com.teemo.entity * @project teemo */ @Entity @Table(name = "department") @Cache(region = "all", usage = CacheConcurrencyStrategy.READ_WRITE) @EnabledQueryCache @JSONType(orders = {"id", "departmentKey", "departmentValue", "parentId", "description"})
public class Department extends BaseEntity implements LogicDeletable {
beiyoufx/teemo
teemo/src/main/java/com/teemo/core/util/UserLogUtil.java
// Path: teemo/src/main/java/core/util/IpUtil.java // public class IpUtil { // // /** // * 从Spring上下文中获取Request,然后从Request对象中获取IP // * @return {@link String} // */ // public static String getIp() { // RequestAttributes requestAttributes = null; // // try { // requestAttributes = RequestContextHolder.currentRequestAttributes(); // } catch (Exception e) { // //ignore 如unit test // } // // if (requestAttributes != null && requestAttributes instanceof ServletRequestAttributes) { // return getIpAddr(((ServletRequestAttributes) requestAttributes).getRequest()); // } // // return "unknown"; // } // // /** // * 从Request获取IP // * 如果请求时通过反向代理过来的,需要在从代理字段中获取真实IP // * @param request // * @return {@link String} // */ // public static String getIpAddr(HttpServletRequest request) { // if (request == null) { // return "unknown"; // } // String ip = request.getHeader("x-forwarded-for"); // if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { // ip = request.getHeader("Proxy-Client-IP"); // } // if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { // ip = request.getHeader("X-Forwarded-For"); // } // if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { // ip = request.getHeader("WL-Proxy-Client-IP"); // } // if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { // ip = request.getHeader("X-Real-IP"); // } // // if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { // ip = request.getRemoteAddr(); // } // return ip; // } // }
import org.slf4j.Logger; import org.slf4j.LoggerFactory; import core.util.IpUtil;
/** * Copyright (c) 2016- https://github.com/beiyoufx * * Licensed under the GPL-3.0 */ package com.teemo.core.util; /** * @author yongjie.teng * @date 16-11-2 下午3:27 * @email yongjie.teng@foxmail.com * @package com.teemo.core.util */ public class UserLogUtil { private static final Logger USER_LOGGER = LoggerFactory.getLogger("USER_LOG"); /** * <p>记录格式 [ip][用户名][操作][错误消息]<p/> * 注意操作如下: * loginError 登录失败 * loginSuccess 登录成功 * passwordError 密码错误 * changePassword 修改密码 * changeStatus 修改状态 * * @param username * @param op * @param msg * @param args */ public static void log(String username, String op, String msg, Object... args) { StringBuilder s = new StringBuilder();
// Path: teemo/src/main/java/core/util/IpUtil.java // public class IpUtil { // // /** // * 从Spring上下文中获取Request,然后从Request对象中获取IP // * @return {@link String} // */ // public static String getIp() { // RequestAttributes requestAttributes = null; // // try { // requestAttributes = RequestContextHolder.currentRequestAttributes(); // } catch (Exception e) { // //ignore 如unit test // } // // if (requestAttributes != null && requestAttributes instanceof ServletRequestAttributes) { // return getIpAddr(((ServletRequestAttributes) requestAttributes).getRequest()); // } // // return "unknown"; // } // // /** // * 从Request获取IP // * 如果请求时通过反向代理过来的,需要在从代理字段中获取真实IP // * @param request // * @return {@link String} // */ // public static String getIpAddr(HttpServletRequest request) { // if (request == null) { // return "unknown"; // } // String ip = request.getHeader("x-forwarded-for"); // if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { // ip = request.getHeader("Proxy-Client-IP"); // } // if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { // ip = request.getHeader("X-Forwarded-For"); // } // if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { // ip = request.getHeader("WL-Proxy-Client-IP"); // } // if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { // ip = request.getHeader("X-Real-IP"); // } // // if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { // ip = request.getRemoteAddr(); // } // return ip; // } // } // Path: teemo/src/main/java/com/teemo/core/util/UserLogUtil.java import org.slf4j.Logger; import org.slf4j.LoggerFactory; import core.util.IpUtil; /** * Copyright (c) 2016- https://github.com/beiyoufx * * Licensed under the GPL-3.0 */ package com.teemo.core.util; /** * @author yongjie.teng * @date 16-11-2 下午3:27 * @email yongjie.teng@foxmail.com * @package com.teemo.core.util */ public class UserLogUtil { private static final Logger USER_LOGGER = LoggerFactory.getLogger("USER_LOG"); /** * <p>记录格式 [ip][用户名][操作][错误消息]<p/> * 注意操作如下: * loginError 登录失败 * loginSuccess 登录成功 * passwordError 密码错误 * changePassword 修改密码 * changeStatus 修改状态 * * @param username * @param op * @param msg * @param args */ public static void log(String username, String op, String msg, Object... args) { StringBuilder s = new StringBuilder();
s.append(getBlock(IpUtil.getIp()));
brarcher/loyalty-card-locker
app/src/main/java/protect/card_locker/LoyaltyCardLockerApplication.java
// Path: app/src/main/java/protect/card_locker/preferences/Settings.java // public class Settings // { // private Context context; // private SharedPreferences settings; // // public Settings(Context context) // { // this.context = context; // this.settings = PreferenceManager.getDefaultSharedPreferences(context); // } // // private String getResString(@StringRes int resId) // { // return context.getString(resId); // } // // private int getResInt(@IntegerRes int resId) // { // return context.getResources().getInteger(resId); // } // // private String getString(@StringRes int keyId, String defaultValue) // { // return settings.getString(getResString(keyId), defaultValue); // } // // private int getInt(@StringRes int keyId, @IntegerRes int defaultId) // { // return settings.getInt(getResString(keyId), getResInt(defaultId)); // } // // private boolean getBoolean(@StringRes int keyId, boolean defaultValue) // { // return settings.getBoolean(getResString(keyId), defaultValue); // } // // public int getTheme() // { // String value = getString(R.string.settings_key_theme, getResString(R.string.settings_key_system_theme)); // // if(value.equals(getResString(R.string.settings_key_light_theme))) // { // return AppCompatDelegate.MODE_NIGHT_NO; // } // else if(value.equals(getResString(R.string.settings_key_dark_theme))) // { // return AppCompatDelegate.MODE_NIGHT_YES; // } // // return AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM; // } // // public int getCardTitleListFontSize() // { // return getInt(R.string.settings_key_card_title_list_font_size, R.integer.settings_card_title_list_font_size_sp); // } // // public int getCardNoteListFontSize() // { // return getInt(R.string.settings_key_card_note_list_font_size, R.integer.settings_card_note_list_font_size_sp); // } // // public int getCardTitleFontSize() // { // return getInt(R.string.settings_key_card_title_font_size, R.integer.settings_card_title_font_size_sp); // } // // public int getCardIdFontSize() // { // return getInt(R.string.settings_key_card_id_font_size, R.integer.settings_card_id_font_size_sp); // } // // public int getCardNoteFontSize() // { // return getInt(R.string.settings_key_card_note_font_size, R.integer.settings_card_note_font_size_sp); // } // // public boolean useMaxBrightnessDisplayingBarcode() // { // return getBoolean(R.string.settings_key_display_barcode_max_brightness, true); // } // // public boolean getLockBarcodeScreenOrientation() // { // return getBoolean(R.string.settings_key_lock_barcode_orientation, false); // } // }
import android.app.Application; import androidx.appcompat.app.AppCompatDelegate; import protect.card_locker.preferences.Settings;
package protect.card_locker; public class LoyaltyCardLockerApplication extends Application { public void onCreate() { super.onCreate();
// Path: app/src/main/java/protect/card_locker/preferences/Settings.java // public class Settings // { // private Context context; // private SharedPreferences settings; // // public Settings(Context context) // { // this.context = context; // this.settings = PreferenceManager.getDefaultSharedPreferences(context); // } // // private String getResString(@StringRes int resId) // { // return context.getString(resId); // } // // private int getResInt(@IntegerRes int resId) // { // return context.getResources().getInteger(resId); // } // // private String getString(@StringRes int keyId, String defaultValue) // { // return settings.getString(getResString(keyId), defaultValue); // } // // private int getInt(@StringRes int keyId, @IntegerRes int defaultId) // { // return settings.getInt(getResString(keyId), getResInt(defaultId)); // } // // private boolean getBoolean(@StringRes int keyId, boolean defaultValue) // { // return settings.getBoolean(getResString(keyId), defaultValue); // } // // public int getTheme() // { // String value = getString(R.string.settings_key_theme, getResString(R.string.settings_key_system_theme)); // // if(value.equals(getResString(R.string.settings_key_light_theme))) // { // return AppCompatDelegate.MODE_NIGHT_NO; // } // else if(value.equals(getResString(R.string.settings_key_dark_theme))) // { // return AppCompatDelegate.MODE_NIGHT_YES; // } // // return AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM; // } // // public int getCardTitleListFontSize() // { // return getInt(R.string.settings_key_card_title_list_font_size, R.integer.settings_card_title_list_font_size_sp); // } // // public int getCardNoteListFontSize() // { // return getInt(R.string.settings_key_card_note_list_font_size, R.integer.settings_card_note_list_font_size_sp); // } // // public int getCardTitleFontSize() // { // return getInt(R.string.settings_key_card_title_font_size, R.integer.settings_card_title_font_size_sp); // } // // public int getCardIdFontSize() // { // return getInt(R.string.settings_key_card_id_font_size, R.integer.settings_card_id_font_size_sp); // } // // public int getCardNoteFontSize() // { // return getInt(R.string.settings_key_card_note_font_size, R.integer.settings_card_note_font_size_sp); // } // // public boolean useMaxBrightnessDisplayingBarcode() // { // return getBoolean(R.string.settings_key_display_barcode_max_brightness, true); // } // // public boolean getLockBarcodeScreenOrientation() // { // return getBoolean(R.string.settings_key_lock_barcode_orientation, false); // } // } // Path: app/src/main/java/protect/card_locker/LoyaltyCardLockerApplication.java import android.app.Application; import androidx.appcompat.app.AppCompatDelegate; import protect.card_locker.preferences.Settings; package protect.card_locker; public class LoyaltyCardLockerApplication extends Application { public void onCreate() { super.onCreate();
Settings settings = new Settings(getApplicationContext());
brarcher/loyalty-card-locker
app/src/main/java/protect/card_locker/LoyaltyCardCursorAdapter.java
// Path: app/src/main/java/protect/card_locker/preferences/Settings.java // public class Settings // { // private Context context; // private SharedPreferences settings; // // public Settings(Context context) // { // this.context = context; // this.settings = PreferenceManager.getDefaultSharedPreferences(context); // } // // private String getResString(@StringRes int resId) // { // return context.getString(resId); // } // // private int getResInt(@IntegerRes int resId) // { // return context.getResources().getInteger(resId); // } // // private String getString(@StringRes int keyId, String defaultValue) // { // return settings.getString(getResString(keyId), defaultValue); // } // // private int getInt(@StringRes int keyId, @IntegerRes int defaultId) // { // return settings.getInt(getResString(keyId), getResInt(defaultId)); // } // // private boolean getBoolean(@StringRes int keyId, boolean defaultValue) // { // return settings.getBoolean(getResString(keyId), defaultValue); // } // // public int getTheme() // { // String value = getString(R.string.settings_key_theme, getResString(R.string.settings_key_system_theme)); // // if(value.equals(getResString(R.string.settings_key_light_theme))) // { // return AppCompatDelegate.MODE_NIGHT_NO; // } // else if(value.equals(getResString(R.string.settings_key_dark_theme))) // { // return AppCompatDelegate.MODE_NIGHT_YES; // } // // return AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM; // } // // public int getCardTitleListFontSize() // { // return getInt(R.string.settings_key_card_title_list_font_size, R.integer.settings_card_title_list_font_size_sp); // } // // public int getCardNoteListFontSize() // { // return getInt(R.string.settings_key_card_note_list_font_size, R.integer.settings_card_note_list_font_size_sp); // } // // public int getCardTitleFontSize() // { // return getInt(R.string.settings_key_card_title_font_size, R.integer.settings_card_title_font_size_sp); // } // // public int getCardIdFontSize() // { // return getInt(R.string.settings_key_card_id_font_size, R.integer.settings_card_id_font_size_sp); // } // // public int getCardNoteFontSize() // { // return getInt(R.string.settings_key_card_note_font_size, R.integer.settings_card_note_font_size_sp); // } // // public boolean useMaxBrightnessDisplayingBarcode() // { // return getBoolean(R.string.settings_key_display_barcode_max_brightness, true); // } // // public boolean getLockBarcodeScreenOrientation() // { // return getBoolean(R.string.settings_key_lock_barcode_orientation, false); // } // }
import android.content.Context; import android.database.Cursor; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.CursorAdapter; import android.widget.ImageView; import android.widget.TextView; import protect.card_locker.preferences.Settings;
package protect.card_locker; class LoyaltyCardCursorAdapter extends CursorAdapter {
// Path: app/src/main/java/protect/card_locker/preferences/Settings.java // public class Settings // { // private Context context; // private SharedPreferences settings; // // public Settings(Context context) // { // this.context = context; // this.settings = PreferenceManager.getDefaultSharedPreferences(context); // } // // private String getResString(@StringRes int resId) // { // return context.getString(resId); // } // // private int getResInt(@IntegerRes int resId) // { // return context.getResources().getInteger(resId); // } // // private String getString(@StringRes int keyId, String defaultValue) // { // return settings.getString(getResString(keyId), defaultValue); // } // // private int getInt(@StringRes int keyId, @IntegerRes int defaultId) // { // return settings.getInt(getResString(keyId), getResInt(defaultId)); // } // // private boolean getBoolean(@StringRes int keyId, boolean defaultValue) // { // return settings.getBoolean(getResString(keyId), defaultValue); // } // // public int getTheme() // { // String value = getString(R.string.settings_key_theme, getResString(R.string.settings_key_system_theme)); // // if(value.equals(getResString(R.string.settings_key_light_theme))) // { // return AppCompatDelegate.MODE_NIGHT_NO; // } // else if(value.equals(getResString(R.string.settings_key_dark_theme))) // { // return AppCompatDelegate.MODE_NIGHT_YES; // } // // return AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM; // } // // public int getCardTitleListFontSize() // { // return getInt(R.string.settings_key_card_title_list_font_size, R.integer.settings_card_title_list_font_size_sp); // } // // public int getCardNoteListFontSize() // { // return getInt(R.string.settings_key_card_note_list_font_size, R.integer.settings_card_note_list_font_size_sp); // } // // public int getCardTitleFontSize() // { // return getInt(R.string.settings_key_card_title_font_size, R.integer.settings_card_title_font_size_sp); // } // // public int getCardIdFontSize() // { // return getInt(R.string.settings_key_card_id_font_size, R.integer.settings_card_id_font_size_sp); // } // // public int getCardNoteFontSize() // { // return getInt(R.string.settings_key_card_note_font_size, R.integer.settings_card_note_font_size_sp); // } // // public boolean useMaxBrightnessDisplayingBarcode() // { // return getBoolean(R.string.settings_key_display_barcode_max_brightness, true); // } // // public boolean getLockBarcodeScreenOrientation() // { // return getBoolean(R.string.settings_key_lock_barcode_orientation, false); // } // } // Path: app/src/main/java/protect/card_locker/LoyaltyCardCursorAdapter.java import android.content.Context; import android.database.Cursor; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.CursorAdapter; import android.widget.ImageView; import android.widget.TextView; import protect.card_locker.preferences.Settings; package protect.card_locker; class LoyaltyCardCursorAdapter extends CursorAdapter {
Settings settings;
brarcher/loyalty-card-locker
app/src/main/java/protect/card_locker/MainActivity.java
// Path: app/src/main/java/protect/card_locker/intro/IntroActivity.java // public class IntroActivity extends AppIntro // { // @Override // public void init(Bundle savedInstanceState) // { // addSlide(new IntroSlide1()); // addSlide(new IntroSlide2()); // addSlide(new IntroSlide3()); // addSlide(new IntroSlide4()); // addSlide(new IntroSlide5()); // addSlide(new IntroSlide6()); // } // // @Override // public void onSkipPressed(Fragment fragment) { // finish(); // } // // @Override // public void onDonePressed(Fragment fragment) { // finish(); // } // } // // Path: app/src/main/java/protect/card_locker/preferences/SettingsActivity.java // public class SettingsActivity extends AppCompatActivity // { // @Override // protected void onCreate(Bundle savedInstanceState) // { // super.onCreate(savedInstanceState); // // ActionBar actionBar = getSupportActionBar(); // if(actionBar != null) // { // getSupportActionBar().setDisplayHomeAsUpEnabled(true); // } // // // Display the fragment as the main content. // getFragmentManager().beginTransaction() // .replace(android.R.id.content, new SettingsFragment()) // .commit(); // } // // @Override // public boolean onOptionsItemSelected(MenuItem item) // { // int id = item.getItemId(); // // if(id == android.R.id.home) // { // finish(); // return true; // } // // return super.onOptionsItemSelected(item); // } // // public static class SettingsFragment extends PreferenceFragment // { // @Override // public void onCreate(final Bundle savedInstanceState) // { // super.onCreate(savedInstanceState); // // // Load the preferences from an XML resource // addPreferencesFromResource(R.xml.preferences); // // findPreference(getResources().getString(R.string.settings_key_theme)).setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() // { // @Override // public boolean onPreferenceChange(Preference preference, Object o) // { // if(o.toString().equals(getResources().getString(R.string.settings_key_light_theme))) // { // AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO); // } // else if(o.toString().equals(getResources().getString(R.string.settings_key_dark_theme))) // { // AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); // } // else // { // AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM); // } // // getActivity().recreate(); // return true; // } // }); // } // } // }
import android.app.SearchManager; import android.content.ClipData; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.ClipboardManager; import android.content.SharedPreferences; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.content.res.Configuration; import android.database.Cursor; import android.os.Bundle; import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatDelegate; import androidx.appcompat.widget.SearchView; import androidx.appcompat.widget.Toolbar; import android.util.Log; import android.view.ContextMenu; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.webkit.WebView; import android.widget.AdapterView; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; import com.google.common.collect.ImmutableMap; import java.util.Calendar; import java.util.Map; import protect.card_locker.intro.IntroActivity; import protect.card_locker.preferences.SettingsActivity;
updateLoyaltyCardList(newText); return true; } }); } return super.onCreateOptionsMenu(menu); } @Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == R.id.action_add) { Intent i = new Intent(getApplicationContext(), LoyaltyCardEditActivity.class); startActivityForResult(i, MAIN_REQUEST_CODE); return true; } if(id == R.id.action_import_export) { Intent i = new Intent(getApplicationContext(), ImportExportActivity.class); startActivityForResult(i, MAIN_REQUEST_CODE); return true; } if(id == R.id.action_settings) {
// Path: app/src/main/java/protect/card_locker/intro/IntroActivity.java // public class IntroActivity extends AppIntro // { // @Override // public void init(Bundle savedInstanceState) // { // addSlide(new IntroSlide1()); // addSlide(new IntroSlide2()); // addSlide(new IntroSlide3()); // addSlide(new IntroSlide4()); // addSlide(new IntroSlide5()); // addSlide(new IntroSlide6()); // } // // @Override // public void onSkipPressed(Fragment fragment) { // finish(); // } // // @Override // public void onDonePressed(Fragment fragment) { // finish(); // } // } // // Path: app/src/main/java/protect/card_locker/preferences/SettingsActivity.java // public class SettingsActivity extends AppCompatActivity // { // @Override // protected void onCreate(Bundle savedInstanceState) // { // super.onCreate(savedInstanceState); // // ActionBar actionBar = getSupportActionBar(); // if(actionBar != null) // { // getSupportActionBar().setDisplayHomeAsUpEnabled(true); // } // // // Display the fragment as the main content. // getFragmentManager().beginTransaction() // .replace(android.R.id.content, new SettingsFragment()) // .commit(); // } // // @Override // public boolean onOptionsItemSelected(MenuItem item) // { // int id = item.getItemId(); // // if(id == android.R.id.home) // { // finish(); // return true; // } // // return super.onOptionsItemSelected(item); // } // // public static class SettingsFragment extends PreferenceFragment // { // @Override // public void onCreate(final Bundle savedInstanceState) // { // super.onCreate(savedInstanceState); // // // Load the preferences from an XML resource // addPreferencesFromResource(R.xml.preferences); // // findPreference(getResources().getString(R.string.settings_key_theme)).setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() // { // @Override // public boolean onPreferenceChange(Preference preference, Object o) // { // if(o.toString().equals(getResources().getString(R.string.settings_key_light_theme))) // { // AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO); // } // else if(o.toString().equals(getResources().getString(R.string.settings_key_dark_theme))) // { // AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); // } // else // { // AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM); // } // // getActivity().recreate(); // return true; // } // }); // } // } // } // Path: app/src/main/java/protect/card_locker/MainActivity.java import android.app.SearchManager; import android.content.ClipData; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.ClipboardManager; import android.content.SharedPreferences; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.content.res.Configuration; import android.database.Cursor; import android.os.Bundle; import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatDelegate; import androidx.appcompat.widget.SearchView; import androidx.appcompat.widget.Toolbar; import android.util.Log; import android.view.ContextMenu; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.webkit.WebView; import android.widget.AdapterView; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; import com.google.common.collect.ImmutableMap; import java.util.Calendar; import java.util.Map; import protect.card_locker.intro.IntroActivity; import protect.card_locker.preferences.SettingsActivity; updateLoyaltyCardList(newText); return true; } }); } return super.onCreateOptionsMenu(menu); } @Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == R.id.action_add) { Intent i = new Intent(getApplicationContext(), LoyaltyCardEditActivity.class); startActivityForResult(i, MAIN_REQUEST_CODE); return true; } if(id == R.id.action_import_export) { Intent i = new Intent(getApplicationContext(), ImportExportActivity.class); startActivityForResult(i, MAIN_REQUEST_CODE); return true; } if(id == R.id.action_settings) {
Intent i = new Intent(getApplicationContext(), SettingsActivity.class);
brarcher/loyalty-card-locker
app/src/main/java/protect/card_locker/MainActivity.java
// Path: app/src/main/java/protect/card_locker/intro/IntroActivity.java // public class IntroActivity extends AppIntro // { // @Override // public void init(Bundle savedInstanceState) // { // addSlide(new IntroSlide1()); // addSlide(new IntroSlide2()); // addSlide(new IntroSlide3()); // addSlide(new IntroSlide4()); // addSlide(new IntroSlide5()); // addSlide(new IntroSlide6()); // } // // @Override // public void onSkipPressed(Fragment fragment) { // finish(); // } // // @Override // public void onDonePressed(Fragment fragment) { // finish(); // } // } // // Path: app/src/main/java/protect/card_locker/preferences/SettingsActivity.java // public class SettingsActivity extends AppCompatActivity // { // @Override // protected void onCreate(Bundle savedInstanceState) // { // super.onCreate(savedInstanceState); // // ActionBar actionBar = getSupportActionBar(); // if(actionBar != null) // { // getSupportActionBar().setDisplayHomeAsUpEnabled(true); // } // // // Display the fragment as the main content. // getFragmentManager().beginTransaction() // .replace(android.R.id.content, new SettingsFragment()) // .commit(); // } // // @Override // public boolean onOptionsItemSelected(MenuItem item) // { // int id = item.getItemId(); // // if(id == android.R.id.home) // { // finish(); // return true; // } // // return super.onOptionsItemSelected(item); // } // // public static class SettingsFragment extends PreferenceFragment // { // @Override // public void onCreate(final Bundle savedInstanceState) // { // super.onCreate(savedInstanceState); // // // Load the preferences from an XML resource // addPreferencesFromResource(R.xml.preferences); // // findPreference(getResources().getString(R.string.settings_key_theme)).setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() // { // @Override // public boolean onPreferenceChange(Preference preference, Object o) // { // if(o.toString().equals(getResources().getString(R.string.settings_key_light_theme))) // { // AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO); // } // else if(o.toString().equals(getResources().getString(R.string.settings_key_dark_theme))) // { // AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); // } // else // { // AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM); // } // // getActivity().recreate(); // return true; // } // }); // } // } // }
import android.app.SearchManager; import android.content.ClipData; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.ClipboardManager; import android.content.SharedPreferences; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.content.res.Configuration; import android.database.Cursor; import android.os.Bundle; import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatDelegate; import androidx.appcompat.widget.SearchView; import androidx.appcompat.widget.Toolbar; import android.util.Log; import android.view.ContextMenu; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.webkit.WebView; import android.widget.AdapterView; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; import com.google.common.collect.ImmutableMap; import java.util.Calendar; import java.util.Map; import protect.card_locker.intro.IntroActivity; import protect.card_locker.preferences.SettingsActivity;
"</p><p>" + String.format(getString(R.string.app_revision_fmt), "<a href=\"" + getString(R.string.app_revision_url) + "\">" + getString(R.string.app_revision_url) + "</a>") + "</p><hr/><p>" + String.format(getString(R.string.app_copyright_fmt), year) + "</p><hr/><p>" + getString(R.string.app_license) + "</p><hr/><p>" + String.format(getString(R.string.app_libraries), appName, libs.toString()) + "</p><hr/><p>" + String.format(getString(R.string.app_resources), appName, resources.toString()); wv.loadDataWithBaseURL("file:///android_res/drawable/", html, "text/html", "utf-8", null); new AlertDialog.Builder(this) .setView(wv) .setCancelable(true) .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }) .show(); } private void startIntro() {
// Path: app/src/main/java/protect/card_locker/intro/IntroActivity.java // public class IntroActivity extends AppIntro // { // @Override // public void init(Bundle savedInstanceState) // { // addSlide(new IntroSlide1()); // addSlide(new IntroSlide2()); // addSlide(new IntroSlide3()); // addSlide(new IntroSlide4()); // addSlide(new IntroSlide5()); // addSlide(new IntroSlide6()); // } // // @Override // public void onSkipPressed(Fragment fragment) { // finish(); // } // // @Override // public void onDonePressed(Fragment fragment) { // finish(); // } // } // // Path: app/src/main/java/protect/card_locker/preferences/SettingsActivity.java // public class SettingsActivity extends AppCompatActivity // { // @Override // protected void onCreate(Bundle savedInstanceState) // { // super.onCreate(savedInstanceState); // // ActionBar actionBar = getSupportActionBar(); // if(actionBar != null) // { // getSupportActionBar().setDisplayHomeAsUpEnabled(true); // } // // // Display the fragment as the main content. // getFragmentManager().beginTransaction() // .replace(android.R.id.content, new SettingsFragment()) // .commit(); // } // // @Override // public boolean onOptionsItemSelected(MenuItem item) // { // int id = item.getItemId(); // // if(id == android.R.id.home) // { // finish(); // return true; // } // // return super.onOptionsItemSelected(item); // } // // public static class SettingsFragment extends PreferenceFragment // { // @Override // public void onCreate(final Bundle savedInstanceState) // { // super.onCreate(savedInstanceState); // // // Load the preferences from an XML resource // addPreferencesFromResource(R.xml.preferences); // // findPreference(getResources().getString(R.string.settings_key_theme)).setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() // { // @Override // public boolean onPreferenceChange(Preference preference, Object o) // { // if(o.toString().equals(getResources().getString(R.string.settings_key_light_theme))) // { // AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO); // } // else if(o.toString().equals(getResources().getString(R.string.settings_key_dark_theme))) // { // AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); // } // else // { // AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM); // } // // getActivity().recreate(); // return true; // } // }); // } // } // } // Path: app/src/main/java/protect/card_locker/MainActivity.java import android.app.SearchManager; import android.content.ClipData; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.ClipboardManager; import android.content.SharedPreferences; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.content.res.Configuration; import android.database.Cursor; import android.os.Bundle; import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatDelegate; import androidx.appcompat.widget.SearchView; import androidx.appcompat.widget.Toolbar; import android.util.Log; import android.view.ContextMenu; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.webkit.WebView; import android.widget.AdapterView; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; import com.google.common.collect.ImmutableMap; import java.util.Calendar; import java.util.Map; import protect.card_locker.intro.IntroActivity; import protect.card_locker.preferences.SettingsActivity; "</p><p>" + String.format(getString(R.string.app_revision_fmt), "<a href=\"" + getString(R.string.app_revision_url) + "\">" + getString(R.string.app_revision_url) + "</a>") + "</p><hr/><p>" + String.format(getString(R.string.app_copyright_fmt), year) + "</p><hr/><p>" + getString(R.string.app_license) + "</p><hr/><p>" + String.format(getString(R.string.app_libraries), appName, libs.toString()) + "</p><hr/><p>" + String.format(getString(R.string.app_resources), appName, resources.toString()); wv.loadDataWithBaseURL("file:///android_res/drawable/", html, "text/html", "utf-8", null); new AlertDialog.Builder(this) .setView(wv) .setCancelable(true) .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }) .show(); } private void startIntro() {
Intent intent = new Intent(this, IntroActivity.class);
brarcher/loyalty-card-locker
app/src/test/java/protect/card_locker/ImportURITest.java
// Path: app/src/main/java/protect/card_locker/DBHelper.java // static class LoyaltyCardDbIds // { // public static final String TABLE = "cards"; // public static final String ID = "_id"; // public static final String STORE = "store"; // public static final String NOTE = "note"; // public static final String HEADER_COLOR = "headercolor"; // public static final String HEADER_TEXT_COLOR = "headertextcolor"; // public static final String CARD_ID = "cardid"; // public static final String BARCODE_TYPE = "barcodetype"; // }
import android.app.Activity; import android.graphics.Color; import android.net.Uri; import com.google.zxing.BarcodeFormat; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.robolectric.Robolectric; import org.robolectric.RobolectricTestRunner; import org.robolectric.annotation.Config; import java.io.InvalidObjectException; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static protect.card_locker.DBHelper.LoyaltyCardDbIds;
package protect.card_locker; @RunWith(RobolectricTestRunner.class) @Config(sdk = 23) public class ImportURITest { private ImportURIHelper importURIHelper; private DBHelper db; @Before public void setUp() { Activity activity = Robolectric.setupActivity(MainActivity.class); importURIHelper = new ImportURIHelper(activity); db = new DBHelper(activity); } @Test public void ensureNoDataLoss() throws InvalidObjectException { // Generate card
// Path: app/src/main/java/protect/card_locker/DBHelper.java // static class LoyaltyCardDbIds // { // public static final String TABLE = "cards"; // public static final String ID = "_id"; // public static final String STORE = "store"; // public static final String NOTE = "note"; // public static final String HEADER_COLOR = "headercolor"; // public static final String HEADER_TEXT_COLOR = "headertextcolor"; // public static final String CARD_ID = "cardid"; // public static final String BARCODE_TYPE = "barcodetype"; // } // Path: app/src/test/java/protect/card_locker/ImportURITest.java import android.app.Activity; import android.graphics.Color; import android.net.Uri; import com.google.zxing.BarcodeFormat; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.robolectric.Robolectric; import org.robolectric.RobolectricTestRunner; import org.robolectric.annotation.Config; import java.io.InvalidObjectException; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static protect.card_locker.DBHelper.LoyaltyCardDbIds; package protect.card_locker; @RunWith(RobolectricTestRunner.class) @Config(sdk = 23) public class ImportURITest { private ImportURIHelper importURIHelper; private DBHelper db; @Before public void setUp() { Activity activity = Robolectric.setupActivity(MainActivity.class); importURIHelper = new ImportURIHelper(activity); db = new DBHelper(activity); } @Test public void ensureNoDataLoss() throws InvalidObjectException { // Generate card
db.insertLoyaltyCard("store", "note", BarcodeFormat.UPC_A.toString(), LoyaltyCardDbIds.BARCODE_TYPE, Color.BLACK, Color.WHITE);
brarcher/loyalty-card-locker
app/src/main/java/protect/card_locker/LoyaltyCardViewActivity.java
// Path: app/src/main/java/protect/card_locker/preferences/Settings.java // public class Settings // { // private Context context; // private SharedPreferences settings; // // public Settings(Context context) // { // this.context = context; // this.settings = PreferenceManager.getDefaultSharedPreferences(context); // } // // private String getResString(@StringRes int resId) // { // return context.getString(resId); // } // // private int getResInt(@IntegerRes int resId) // { // return context.getResources().getInteger(resId); // } // // private String getString(@StringRes int keyId, String defaultValue) // { // return settings.getString(getResString(keyId), defaultValue); // } // // private int getInt(@StringRes int keyId, @IntegerRes int defaultId) // { // return settings.getInt(getResString(keyId), getResInt(defaultId)); // } // // private boolean getBoolean(@StringRes int keyId, boolean defaultValue) // { // return settings.getBoolean(getResString(keyId), defaultValue); // } // // public int getTheme() // { // String value = getString(R.string.settings_key_theme, getResString(R.string.settings_key_system_theme)); // // if(value.equals(getResString(R.string.settings_key_light_theme))) // { // return AppCompatDelegate.MODE_NIGHT_NO; // } // else if(value.equals(getResString(R.string.settings_key_dark_theme))) // { // return AppCompatDelegate.MODE_NIGHT_YES; // } // // return AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM; // } // // public int getCardTitleListFontSize() // { // return getInt(R.string.settings_key_card_title_list_font_size, R.integer.settings_card_title_list_font_size_sp); // } // // public int getCardNoteListFontSize() // { // return getInt(R.string.settings_key_card_note_list_font_size, R.integer.settings_card_note_list_font_size_sp); // } // // public int getCardTitleFontSize() // { // return getInt(R.string.settings_key_card_title_font_size, R.integer.settings_card_title_font_size_sp); // } // // public int getCardIdFontSize() // { // return getInt(R.string.settings_key_card_id_font_size, R.integer.settings_card_id_font_size_sp); // } // // public int getCardNoteFontSize() // { // return getInt(R.string.settings_key_card_note_font_size, R.integer.settings_card_note_font_size_sp); // } // // public boolean useMaxBrightnessDisplayingBarcode() // { // return getBoolean(R.string.settings_key_display_barcode_max_brightness, true); // } // // public boolean getLockBarcodeScreenOrientation() // { // return getBoolean(R.string.settings_key_lock_barcode_orientation, false); // } // }
import android.content.Intent; import android.content.pm.ActivityInfo; import android.graphics.Color; import android.graphics.drawable.Drawable; import android.os.Build; import android.os.Bundle; import androidx.constraintlayout.widget.ConstraintLayout; import androidx.core.graphics.ColorUtils; import androidx.core.graphics.drawable.DrawableCompat; import androidx.core.widget.TextViewCompat; import androidx.appcompat.app.ActionBar; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.content.res.AppCompatResources; import androidx.appcompat.widget.Toolbar; import android.util.Log; import android.util.TypedValue; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.view.ViewTreeObserver; import android.view.Window; import android.view.WindowManager; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; import com.google.zxing.BarcodeFormat; import protect.card_locker.preferences.Settings;
package protect.card_locker; public class LoyaltyCardViewActivity extends AppCompatActivity { private static final String TAG = "CardLocker"; private static final double LUMINANCE_MIDPOINT = 0.5; TextView cardIdFieldView; TextView noteView; View noteViewDivider; TextView storeName; ImageView barcodeImage; View collapsingToolbarLayout; int loyaltyCardId; LoyaltyCard loyaltyCard; boolean rotationEnabled; DBHelper db; ImportURIHelper importURIHelper;
// Path: app/src/main/java/protect/card_locker/preferences/Settings.java // public class Settings // { // private Context context; // private SharedPreferences settings; // // public Settings(Context context) // { // this.context = context; // this.settings = PreferenceManager.getDefaultSharedPreferences(context); // } // // private String getResString(@StringRes int resId) // { // return context.getString(resId); // } // // private int getResInt(@IntegerRes int resId) // { // return context.getResources().getInteger(resId); // } // // private String getString(@StringRes int keyId, String defaultValue) // { // return settings.getString(getResString(keyId), defaultValue); // } // // private int getInt(@StringRes int keyId, @IntegerRes int defaultId) // { // return settings.getInt(getResString(keyId), getResInt(defaultId)); // } // // private boolean getBoolean(@StringRes int keyId, boolean defaultValue) // { // return settings.getBoolean(getResString(keyId), defaultValue); // } // // public int getTheme() // { // String value = getString(R.string.settings_key_theme, getResString(R.string.settings_key_system_theme)); // // if(value.equals(getResString(R.string.settings_key_light_theme))) // { // return AppCompatDelegate.MODE_NIGHT_NO; // } // else if(value.equals(getResString(R.string.settings_key_dark_theme))) // { // return AppCompatDelegate.MODE_NIGHT_YES; // } // // return AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM; // } // // public int getCardTitleListFontSize() // { // return getInt(R.string.settings_key_card_title_list_font_size, R.integer.settings_card_title_list_font_size_sp); // } // // public int getCardNoteListFontSize() // { // return getInt(R.string.settings_key_card_note_list_font_size, R.integer.settings_card_note_list_font_size_sp); // } // // public int getCardTitleFontSize() // { // return getInt(R.string.settings_key_card_title_font_size, R.integer.settings_card_title_font_size_sp); // } // // public int getCardIdFontSize() // { // return getInt(R.string.settings_key_card_id_font_size, R.integer.settings_card_id_font_size_sp); // } // // public int getCardNoteFontSize() // { // return getInt(R.string.settings_key_card_note_font_size, R.integer.settings_card_note_font_size_sp); // } // // public boolean useMaxBrightnessDisplayingBarcode() // { // return getBoolean(R.string.settings_key_display_barcode_max_brightness, true); // } // // public boolean getLockBarcodeScreenOrientation() // { // return getBoolean(R.string.settings_key_lock_barcode_orientation, false); // } // } // Path: app/src/main/java/protect/card_locker/LoyaltyCardViewActivity.java import android.content.Intent; import android.content.pm.ActivityInfo; import android.graphics.Color; import android.graphics.drawable.Drawable; import android.os.Build; import android.os.Bundle; import androidx.constraintlayout.widget.ConstraintLayout; import androidx.core.graphics.ColorUtils; import androidx.core.graphics.drawable.DrawableCompat; import androidx.core.widget.TextViewCompat; import androidx.appcompat.app.ActionBar; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.content.res.AppCompatResources; import androidx.appcompat.widget.Toolbar; import android.util.Log; import android.util.TypedValue; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.view.ViewTreeObserver; import android.view.Window; import android.view.WindowManager; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; import com.google.zxing.BarcodeFormat; import protect.card_locker.preferences.Settings; package protect.card_locker; public class LoyaltyCardViewActivity extends AppCompatActivity { private static final String TAG = "CardLocker"; private static final double LUMINANCE_MIDPOINT = 0.5; TextView cardIdFieldView; TextView noteView; View noteViewDivider; TextView storeName; ImageView barcodeImage; View collapsingToolbarLayout; int loyaltyCardId; LoyaltyCard loyaltyCard; boolean rotationEnabled; DBHelper db; ImportURIHelper importURIHelper;
Settings settings;
brarcher/loyalty-card-locker
app/src/test/java/protect/card_locker/LoyaltyCardViewActivityTest.java
// Path: app/src/main/java/protect/card_locker/LoyaltyCardEditActivity.java // protected static final String NO_BARCODE = "_NO_BARCODE_";
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import static org.robolectric.Shadows.shadowOf; import static protect.card_locker.LoyaltyCardEditActivity.NO_BARCODE; import android.app.Activity; import android.content.Intent; import android.content.SharedPreferences; import android.content.pm.ActivityInfo; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.graphics.Color; import android.graphics.drawable.ColorDrawable; import android.net.Uri; import android.os.Bundle; import android.preference.PreferenceManager; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.ImageView; import android.widget.TextView; import androidx.core.widget.TextViewCompat; import com.google.zxing.BarcodeFormat; import com.google.zxing.client.android.Intents; import java.io.IOException; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.robolectric.Robolectric; import org.robolectric.RobolectricTestRunner; import org.robolectric.RuntimeEnvironment; import org.robolectric.android.controller.ActivityController; import org.robolectric.annotation.Config; import org.robolectric.shadows.ShadowActivity; import org.robolectric.shadows.ShadowLog;
{ assertEquals(0, db.getLoyaltyCardCount()); } else { assertEquals(1, db.getLoyaltyCardCount()); } final EditText storeField = activity.findViewById(R.id.storeNameEdit); final EditText noteField = activity.findViewById(R.id.noteEdit); final TextView cardIdField = activity.findViewById(R.id.cardIdView); final TextView barcodeTypeField = activity.findViewById(R.id.barcodeTypeView); storeField.setText(store); noteField.setText(note); cardIdField.setText(cardId); barcodeTypeField.setText(barcodeType); assertEquals(false, activity.isFinishing()); shadowOf(activity).clickMenuItem(R.id.action_save); assertEquals(true, activity.isFinishing()); assertEquals(1, db.getLoyaltyCardCount()); LoyaltyCard card = db.getLoyaltyCard(1); assertEquals(store, card.store); assertEquals(note, card.note); assertEquals(cardId, card.cardId); // The special "No barcode" string shouldn't actually be written to the loyalty card
// Path: app/src/main/java/protect/card_locker/LoyaltyCardEditActivity.java // protected static final String NO_BARCODE = "_NO_BARCODE_"; // Path: app/src/test/java/protect/card_locker/LoyaltyCardViewActivityTest.java import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import static org.robolectric.Shadows.shadowOf; import static protect.card_locker.LoyaltyCardEditActivity.NO_BARCODE; import android.app.Activity; import android.content.Intent; import android.content.SharedPreferences; import android.content.pm.ActivityInfo; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.graphics.Color; import android.graphics.drawable.ColorDrawable; import android.net.Uri; import android.os.Bundle; import android.preference.PreferenceManager; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.ImageView; import android.widget.TextView; import androidx.core.widget.TextViewCompat; import com.google.zxing.BarcodeFormat; import com.google.zxing.client.android.Intents; import java.io.IOException; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.robolectric.Robolectric; import org.robolectric.RobolectricTestRunner; import org.robolectric.RuntimeEnvironment; import org.robolectric.android.controller.ActivityController; import org.robolectric.annotation.Config; import org.robolectric.shadows.ShadowActivity; import org.robolectric.shadows.ShadowLog; { assertEquals(0, db.getLoyaltyCardCount()); } else { assertEquals(1, db.getLoyaltyCardCount()); } final EditText storeField = activity.findViewById(R.id.storeNameEdit); final EditText noteField = activity.findViewById(R.id.noteEdit); final TextView cardIdField = activity.findViewById(R.id.cardIdView); final TextView barcodeTypeField = activity.findViewById(R.id.barcodeTypeView); storeField.setText(store); noteField.setText(note); cardIdField.setText(cardId); barcodeTypeField.setText(barcodeType); assertEquals(false, activity.isFinishing()); shadowOf(activity).clickMenuItem(R.id.action_save); assertEquals(true, activity.isFinishing()); assertEquals(1, db.getLoyaltyCardCount()); LoyaltyCard card = db.getLoyaltyCard(1); assertEquals(store, card.store); assertEquals(note, card.note); assertEquals(cardId, card.cardId); // The special "No barcode" string shouldn't actually be written to the loyalty card
if(barcodeType.equals(NO_BARCODE))
reelyactive/ble-android-sdk
library/src/main/java/com/reelyactive/blesdk/support/ble/BluetoothLeScannerCompat.java
// Path: library/src/main/java/com/reelyactive/blesdk/support/ble/util/Clock.java // public interface Clock { // // /** // * @return current time in milliseconds // */ // public long currentTimeMillis(); // // /** // * @return time since the device was booted, in nanoseconds // */ // public long elapsedRealtimeNanos(); // // } // // Path: library/src/main/java/com/reelyactive/blesdk/support/ble/util/Logger.java // public class Logger { // // public static final String TAG = "BleScanCompatLib"; // // public static void logVerbose(String message) { // if (Log.isLoggable(TAG, Log.VERBOSE)) { // Log.v(TAG, message); // } // } // // public static void logWarning(String message) { // if (Log.isLoggable(TAG, Log.WARN)) { // Log.w(TAG, message); // } // } // // public static void logDebug(String message) { // if (Log.isLoggable(TAG, Log.DEBUG)) { // Log.d(TAG, message); // } // } // // public static void logInfo(String message) { // if (Log.isLoggable(TAG, Log.INFO)) { // Log.i(TAG, message); // } // } // // public static void logError(String message, Exception... e) { // if (Log.isLoggable(TAG, Log.ERROR)) { // if (e == null || e.length == 0) { // Log.e(TAG, message); // } else { // Log.e(TAG, message, e[0]); // } // } // } // }
import java.util.ArrayList; import java.util.Collection; import java.util.List; import android.app.AlarmManager; import android.app.PendingIntent; import android.os.Build; import com.reelyactive.blesdk.support.ble.util.Clock; import com.reelyactive.blesdk.support.ble.util.Logger;
package com.reelyactive.blesdk.support.ble;/* * Copyright 2014 Google Inc. All rights reserved. * * 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 IS MODIFIED COPY OF THE "L" PLATFORM CLASS. BE CAREFUL ABOUT EDITS. // THIS CODE SHOULD FOLLOW ANDROID STYLE. // // Changes: // Change to abstract class // Remove implementations // Define setCustomScanTiming for ULR // Slight updates to javadoc /** * Represents the public entry into the Bluetooth LE compatibility scanner that efficiently captures * advertising packets broadcast from Bluetooth LE devices. * <p/> * API declarations in this class are the same as the new LE scanning API that is being introduced * in Android "L" platform. Declarations contained here will eventually be replaced by the platform * versions. Refer to the <a href="http://go/android-ble">"L" release API design</a> for further * information. * <p/> * The API implemented here is for compatibility when used on * {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR2} and later. * * @see <a href="https://www.bluetooth.org/en-us/specification/adopted-specifications"> Bluetooth * Adopted Specifications</a> * @see <a href="https://www.bluetooth.org/DocMan/handlers/DownloadDoc.ashx?doc_id=282152"> ​Core * Specification Supplement (CSS) v4</a> */ public abstract class BluetoothLeScannerCompat { // Number of cycles before a sighted device is considered lost. /* @VisibleForTesting */ static final int SCAN_LOST_CYCLES = 4; // Constants for Scan Cycle // Low Power: 2.5 minute period with 1.5 seconds active (1% duty cycle) /* @VisibleForTesting */ static final int LOW_POWER_IDLE_MILLIS = 148500; /* @VisibleForTesting */ static final int LOW_POWER_ACTIVE_MILLIS = 1500; // Balanced: 15 second period with 1.5 second active (10% duty cycle) /* @VisibleForTesting */ static final int BALANCED_IDLE_MILLIS = 13500; /* @VisibleForTesting */ static final int BALANCED_ACTIVE_MILLIS = 1500; // Low Latency: 1.67 second period with 1.5 seconds active (90% duty cycle) /* @VisibleForTesting */ static final int LOW_LATENCY_IDLE_MILLIS = 167; /* @VisibleForTesting */ static final int LOW_LATENCY_ACTIVE_MILLIS = 1500; // Alarm Scan variables
// Path: library/src/main/java/com/reelyactive/blesdk/support/ble/util/Clock.java // public interface Clock { // // /** // * @return current time in milliseconds // */ // public long currentTimeMillis(); // // /** // * @return time since the device was booted, in nanoseconds // */ // public long elapsedRealtimeNanos(); // // } // // Path: library/src/main/java/com/reelyactive/blesdk/support/ble/util/Logger.java // public class Logger { // // public static final String TAG = "BleScanCompatLib"; // // public static void logVerbose(String message) { // if (Log.isLoggable(TAG, Log.VERBOSE)) { // Log.v(TAG, message); // } // } // // public static void logWarning(String message) { // if (Log.isLoggable(TAG, Log.WARN)) { // Log.w(TAG, message); // } // } // // public static void logDebug(String message) { // if (Log.isLoggable(TAG, Log.DEBUG)) { // Log.d(TAG, message); // } // } // // public static void logInfo(String message) { // if (Log.isLoggable(TAG, Log.INFO)) { // Log.i(TAG, message); // } // } // // public static void logError(String message, Exception... e) { // if (Log.isLoggable(TAG, Log.ERROR)) { // if (e == null || e.length == 0) { // Log.e(TAG, message); // } else { // Log.e(TAG, message, e[0]); // } // } // } // } // Path: library/src/main/java/com/reelyactive/blesdk/support/ble/BluetoothLeScannerCompat.java import java.util.ArrayList; import java.util.Collection; import java.util.List; import android.app.AlarmManager; import android.app.PendingIntent; import android.os.Build; import com.reelyactive.blesdk.support.ble.util.Clock; import com.reelyactive.blesdk.support.ble.util.Logger; package com.reelyactive.blesdk.support.ble;/* * Copyright 2014 Google Inc. All rights reserved. * * 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 IS MODIFIED COPY OF THE "L" PLATFORM CLASS. BE CAREFUL ABOUT EDITS. // THIS CODE SHOULD FOLLOW ANDROID STYLE. // // Changes: // Change to abstract class // Remove implementations // Define setCustomScanTiming for ULR // Slight updates to javadoc /** * Represents the public entry into the Bluetooth LE compatibility scanner that efficiently captures * advertising packets broadcast from Bluetooth LE devices. * <p/> * API declarations in this class are the same as the new LE scanning API that is being introduced * in Android "L" platform. Declarations contained here will eventually be replaced by the platform * versions. Refer to the <a href="http://go/android-ble">"L" release API design</a> for further * information. * <p/> * The API implemented here is for compatibility when used on * {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR2} and later. * * @see <a href="https://www.bluetooth.org/en-us/specification/adopted-specifications"> Bluetooth * Adopted Specifications</a> * @see <a href="https://www.bluetooth.org/DocMan/handlers/DownloadDoc.ashx?doc_id=282152"> ​Core * Specification Supplement (CSS) v4</a> */ public abstract class BluetoothLeScannerCompat { // Number of cycles before a sighted device is considered lost. /* @VisibleForTesting */ static final int SCAN_LOST_CYCLES = 4; // Constants for Scan Cycle // Low Power: 2.5 minute period with 1.5 seconds active (1% duty cycle) /* @VisibleForTesting */ static final int LOW_POWER_IDLE_MILLIS = 148500; /* @VisibleForTesting */ static final int LOW_POWER_ACTIVE_MILLIS = 1500; // Balanced: 15 second period with 1.5 second active (10% duty cycle) /* @VisibleForTesting */ static final int BALANCED_IDLE_MILLIS = 13500; /* @VisibleForTesting */ static final int BALANCED_ACTIVE_MILLIS = 1500; // Low Latency: 1.67 second period with 1.5 seconds active (90% duty cycle) /* @VisibleForTesting */ static final int LOW_LATENCY_IDLE_MILLIS = 167; /* @VisibleForTesting */ static final int LOW_LATENCY_ACTIVE_MILLIS = 1500; // Alarm Scan variables
private final Clock clock;