Create a gist now

Instantly share code, notes, and snippets.

anonymous / Secret
Created Jan 28, 2013

What would you like to do?
* To change this template, choose Tools | Templates
* and open the template in the editor.
package container;
import entities.Fraht;
import entities.Konosament;
import entities.Reciver;
import entities.Zayavka;
import entities.controllers.CoonteinersJpaController;
import entities.controllers.EnterpotsJpaController;
import entities.controllers.FrahtJpaController;
import entities.controllers.KonosamentJpaController;
import entities.controllers.ReciverJpaController;
import entities.controllers.SenderJpaController;
import entities.controllers.VedomostTmcJpaController;
import entities.controllers.ZayavkaJpaController;
import entities.controllers.exceptions.IllegalOrphanException;
import entities.controllers.exceptions.NonexistentEntityException;
import forms.MainForm;
import java.util.List;
import java.util.Properties;
import java.util.Scanner;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
* @author alex
public class Main {
public static EntityManagerFactory emf = Persistence.createEntityManagerFactory("ContainerPU"); ;
* @param args the command line arguments
static MainForm main = new MainForm();
public static ReciverJpaController getReciverJPAController(){
ReciverJpaController rjc=new ReciverJpaController(emf);
return rjc;
public static SenderJpaController getSenderJPAController(){
SenderJpaController sjc=new SenderJpaController(emf);
return sjc;
public static EnterpotsJpaController getEnterpotsJpaController(){
EnterpotsJpaController ejc = new EnterpotsJpaController(emf);
return ejc;
public static String getProperty(String propname){
Properties prop = new Properties();
try {
//load a properties file
return prop.getProperty(propname);
} catch (IOException ex) {
return "";
public static void main(String[] args) throws IllegalOrphanException, NonexistentEntityException {
EntityManager em = emf.createEntityManager();//testing
main = new MainForm();
public static FrahtJpaController getFrahtController() {
return new FrahtJpaController(emf);
public static CoonteinersJpaController getCoonteinersJpaController() {
return new CoonteinersJpaController(emf);
public static VedomostTmcJpaController getVedomostTmcJpaController() {
return new VedomostTmcJpaController(emf);
public static ZayavkaJpaController getZayavkaController() {
return new ZayavkaJpaController(emf);
public static KonosamentJpaController getKonosamentJpaCpntroller() {
return new KonosamentJpaController(emf);
public static String getEnterpotTempl1(){
String s = "Ваш груз имеет закрытый коносамент kono"
+ ",это значит, что он прибыл в пункт enterpot числа data.\n" +
"Туда его доставил фраxт fraht\n";
return s;
public static String getEnterpotTempl3(){
String s =
"Ваш груз имеет не закрытый коносамент 'kono',"
+ "это значит, что из пункта 'enterpot', он отбыл числа 'data'\n и ещё в пути."
+ "В данный момент его перевозит фрахт 'fraht'" ;
return s;
public static String getEnterpotTempl2(){
String s =
"Ваш груз имеет коносамент 'kono2',это значит, что из пункта 'enterpot1',"
+ " он отбыл числа 'data1'.\n" +
" Таким образом он пробыл в пункте 'enterpot1' daycount дней.\n" +
" Информация о пункте 'enterpot1':\n" +
" Срок хранения : 'srok' дней\n" +
" Штраф за простой в 1 день 'price' у.е \n" +
" Штраф за простой в пункте enterpot1 составил 'shtraf' у.е.";
return s;
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="" xmlns:xsi="" xsi:schemaLocation="">
<persistence-unit name="ContainerPU" transaction-type="RESOURCE_LOCAL">
<property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/expeditor?zeroDateTimeBehavior=convertToNull"/>
<property name="javax.persistence.jdbc.password" value="onelife"/>
<property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver"/>
<property name="javax.persistence.jdbc.user" value="root"/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment