diff --git a/core/README.md b/core/README.md
new file mode 100644
index 0000000..e108028
--- /dev/null
+++ b/core/README.md
@@ -0,0 +1,30 @@
+#关于 USVisaTrack 项目
+--------
+USVisaTrack 是一个基于数据的商品信息平台
+
+
+#关于 USVisaTrack 这个仓库
+--------
+
+
+#JDK 配置
+--------
+JDK 需要使用 1.8 以上的版本。
+
+
+#安装
+--------
+
+
+#SCM
+--------
+https://gitlab.com/ntc/us-visa-track
+
+
+#文档
+--------
+https://www.cwiki.us
+
+#论坛
+--------
+www.ossez.com
\ No newline at end of file
diff --git a/core/pom.xml b/core/pom.xml
new file mode 100644
index 0000000..3782f5a
--- /dev/null
+++ b/core/pom.xml
@@ -0,0 +1,291 @@
+
+
+ 4.0.0
+
+
+ com.usvisatrack
+ usvisatrack-main
+ 0.1.0
+
+
+ usvisatrack-core
+
+ usvisatrack core
+ usvisatrack core code and view files to render HTML.
+
+
+ true
+ 1.250
+ 2.5.6.SEC03
+ 2.4.11
+
+ true
+
+
+
+
+
+
+
+ org.mariadb.jdbc
+ mariadb-java-client
+ 1.5.9
+
+
+ org.hibernate
+ hibernate-c3p0
+ 5.1.2.Final
+
+
+ org.hibernate
+ hibernate-ehcache
+ 5.1.2.Final
+
+
+ org.hibernate
+ hibernate-search-orm
+ 5.5.5.Final
+
+
+
+ org.hibernate
+ hibernate-validator
+ 5.2.4.Final
+
+
+
+ org.apache.solr
+ solr-solrj
+ 5.5.3
+
+
+
+
+
+
+ org.apache.commons
+ commons-lang3
+ 3.4
+
+
+
+ org.apache.commons
+ commons-math3
+ 3.0
+
+
+
+ commons-cli
+ commons-cli
+ 1.2
+
+
+
+ commons-net
+ commons-net
+ 3.3
+
+
+
+ org.apache.commons
+ commons-csv
+ 1.1
+
+
+
+ commons-validator
+ commons-validator
+ 1.4.1
+
+
+
+ org.apache.httpcomponents
+ httpclient
+ 4.5.2
+
+
+
+ commons-fileupload
+ commons-fileupload
+ 1.3.1
+
+
+
+
+
+ org.jdom
+ jdom2
+ 2.0.6
+
+
+
+ gov.nih.imagej
+ imagej
+ 1.47
+
+
+
+ net.sf.barcode4j
+ barcode4j
+ 2.1
+
+
+
+ com.google.zxing
+ javase
+ 3.2.1
+
+
+
+
+
+
+ com.amazonaws
+ aws-java-sdk
+ 1.11.114
+
+
+
+
+ com.paypal.sdk
+ paypal-core
+ 1.7.2
+
+
+ com.paypal.sdk
+ rest-api-sdk
+ 1.13.0
+
+
+
+
+
+ commons-beanutils
+ commons-beanutils
+ 1.8.3
+
+
+
+ com.fasterxml.jackson.core
+ jackson-databind
+ 2.8.7
+
+
+
+ org.springframework
+ spring-context
+ 4.1.2.RELEASE
+
+
+
+ org.springframework
+ spring-orm
+ 4.1.2.RELEASE
+
+
+
+ javax.servlet
+ servlet-api
+ 2.5
+
+
+
+
+ net.sf.ehcache
+ ehcache-core
+ 2.6.9
+
+
+ jaxen
+ jaxen
+ 1.1.6
+
+
+
+
+
+
+
+
+
+
+ org.kohsuke.stapler
+ maven-stapler-plugin
+ ${maven-stapler-plugin.version}
+
+
+ /lib/.*
+
+
+
+
+ maven-project-info-reports-plugin
+ 2.6
+
+ false
+
+
+
+
+
+
+
+ debug
+
+ true
+
+
+
+ release
+
+
+
+
+ org.kohsuke.stapler
+ maven-stapler-plugin
+
+
+
+
+ jelly-taglibdoc
+
+
+
+ /lib/.*
+
+
+
+
+
+
+
+
+
+
+
+ findbugs
+
+
+ true
+
+
+
+
+ cobertura
+
+
+
+
+ maven-surefire-plugin
+
+
+ true
+
+
+
+
+
+
+
diff --git a/core/src/main/java/META-INF/MANIFEST.MF b/core/src/main/java/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..e41bf7b
--- /dev/null
+++ b/core/src/main/java/META-INF/MANIFEST.MF
@@ -0,0 +1,2 @@
+Manifest-Version: 1.0
+Class-Path:
\ No newline at end of file
diff --git a/core/src/main/java/com/usvisatrack/core/cloud/AwsS3.java b/core/src/main/java/com/usvisatrack/core/cloud/AwsS3.java
new file mode 100644
index 0000000..cd55bec
--- /dev/null
+++ b/core/src/main/java/com/usvisatrack/core/cloud/AwsS3.java
@@ -0,0 +1,95 @@
+package com.usvisatrack.core.cloud;
+
+import java.io.Closeable;
+import java.io.File;
+import java.io.IOException;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.amazonaws.AmazonClientException;
+import com.amazonaws.AmazonServiceException;
+import com.amazonaws.auth.BasicAWSCredentials;
+import com.amazonaws.services.s3.AmazonS3;
+import com.amazonaws.services.s3.AmazonS3Client;
+import com.amazonaws.services.s3.model.PutObjectRequest;
+
+/**
+ * BcoDepot Amazon Utils class
+ *
+ * @author YuCheng Hu
+ *
+ */
+/**
+ * Common class to handle the movement of files into the Cloud (in this case Rackspace Cloud Files).
+ *
+ * @author YuCheng Hu
+ *
+ */
+public class AwsS3 implements Closeable {
+
+ private static Logger logger = LoggerFactory.getLogger(AwsS3.class);
+
+ private static AwsS3 instance = null;
+ private static String accessKey = null;
+ private static String secreKey = null;
+
+ /**
+ * Constructor Function
+ */
+ public AwsS3() {
+
+ accessKey = "AKIAI6CDTBEK6PF3QBMA";
+ secreKey = "F15vscDOpQ3Ac0L08eICSGw55ZlM6qbXgEuboB0B";
+
+ }
+
+ public static AwsS3 getInstance() {
+ if (instance == null) {
+ instance = new AwsS3();
+ }
+ return instance;
+ }
+
+ /**
+ * Upload files of given directory to Cloud Files Path
+ *
+ * @param bucketName
+ * @param remotePath
+ * @param file
+ * @throws Exception
+ */
+ public static void UploadObjectSingleOperation(String bucketName, String remotePath, File file) throws Exception {
+
+ BasicAWSCredentials awsCreds = new BasicAWSCredentials(accessKey, secreKey);
+ AmazonS3 s3client = new AmazonS3Client(awsCreds);
+
+ // AmazonS3 s3client = new AmazonS3Client(new ProfileCredentialsProvider());
+ try {
+ System.out.println("Uploading a new object to S3 from a file\n");
+
+ s3client.putObject(new PutObjectRequest(bucketName, remotePath, file));
+
+ } catch (AmazonServiceException ase) {
+ System.out.println("Caught an AmazonServiceException, which " + "means your request made it "
+ + "to Amazon S3, but was rejected with an error response" + " for some reason.");
+ System.out.println("Error Message: " + ase.getMessage());
+ System.out.println("HTTP Status Code: " + ase.getStatusCode());
+ System.out.println("AWS Error Code: " + ase.getErrorCode());
+ System.out.println("Error Type: " + ase.getErrorType());
+ System.out.println("Request ID: " + ase.getRequestId());
+ } catch (AmazonClientException ace) {
+ System.out.println("Caught an AmazonClientException, which " + "means the client encountered "
+ + "an internal error while trying to " + "communicate with S3, " + "such as not being able to access the network.");
+ System.out.println("Error Message: " + ace.getMessage());
+ }
+
+ } // End uploadDirectoryContentsToCloud
+
+ @Override
+ public void close() throws IOException {
+ // TODO Auto-generated method stub
+
+ }
+
+}
diff --git a/core/src/main/java/com/usvisatrack/core/common/DataObject.java b/core/src/main/java/com/usvisatrack/core/common/DataObject.java
new file mode 100644
index 0000000..dc7c54f
--- /dev/null
+++ b/core/src/main/java/com/usvisatrack/core/common/DataObject.java
@@ -0,0 +1,127 @@
+package com.usvisatrack.core.common;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.EntityListeners;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.MappedSuperclass;
+
+import org.hibernate.search.annotations.DateBridge;
+import org.hibernate.search.annotations.DocumentId;
+import org.hibernate.search.annotations.Resolution;
+
+import com.fasterxml.jackson.annotation.JsonAutoDetect;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.usvisatrack.core.dao.model.EntityListener;
+
+/**
+ *
+ * @author YuCheng Hu
+ *
+ */
+@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.NONE, getterVisibility = JsonAutoDetect.Visibility.NONE, setterVisibility = JsonAutoDetect.Visibility.NONE, isGetterVisibility = JsonAutoDetect.Visibility.NONE, creatorVisibility = JsonAutoDetect.Visibility.NONE)
+@EntityListeners({EntityListener.class})
+@MappedSuperclass
+public abstract class DataObject implements Serializable {
+
+ public abstract interface Save {
+
+ }
+
+ public abstract interface Update {
+
+ }
+
+ private static final long serialVersionUID = -67188388306700736L;
+ public static final String ID_PROPERTY_NAME = "id";
+ public static final String CREATE_DATE_PROPERTY_NAME = "createDate";
+ public static final String MODIFY_DATE_PROPERTY_NAME = "modifyDate";
+ private Long id;
+ private Date createDate;
+ private Date modifyDate;
+
+ /**
+ *
+ * @return
+ */
+ @JsonProperty
+ @DocumentId
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ public Long getId() {
+ return this.id;
+ }
+
+ /**
+ *
+ * @param id
+ */
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ /**
+ *
+ * @return
+ */
+ @JsonProperty
+ @DateBridge(resolution = Resolution.SECOND)
+ @Column(nullable = false, updatable = false)
+ public Date getCreateDate() {
+ return this.createDate;
+ }
+
+ /**
+ *
+ * @param createDate
+ */
+ public void setCreateDate(Date createDate) {
+ this.createDate = createDate;
+ }
+
+ /**
+ *
+ * @return
+ */
+ @JsonProperty
+ @DateBridge(resolution = Resolution.SECOND)
+ @Column(nullable = false)
+ public Date getModifyDate() {
+ return this.modifyDate;
+ }
+
+ /**
+ *
+ * @param modifyDate
+ */
+ public void setModifyDate(Date modifyDate) {
+ this.modifyDate = modifyDate;
+ }
+
+ /**
+ *
+ */
+ public boolean equals(Object obj) {
+ if (obj == null)
+ return false;
+ if (this == obj)
+ return true;
+ if (!DataObject.class.isAssignableFrom(obj.getClass()))
+ return false;
+ DataObject localBaseEntity = (DataObject) obj;
+ return getId() != null ? getId().equals(localBaseEntity.getId()) : false;
+ }
+
+ /**
+ *
+ */
+ public int hashCode() {
+ int i = 17;
+ i += (getId() == null ? 0 : getId().hashCode() * 31);
+ return i;
+ }
+}
diff --git a/core/src/main/java/com/usvisatrack/core/common/Factory.java b/core/src/main/java/com/usvisatrack/core/common/Factory.java
new file mode 100644
index 0000000..be1d2ed
--- /dev/null
+++ b/core/src/main/java/com/usvisatrack/core/common/Factory.java
@@ -0,0 +1,497 @@
+package com.usvisatrack.core.common;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectOutputStream;
+import java.util.Date;
+import java.util.List;
+
+import org.hibernate.Criteria;
+import org.hibernate.Query;
+import org.hibernate.ScrollMode;
+import org.hibernate.ScrollableResults;
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.hibernate.Transaction;
+import org.hibernate.boot.MetadataSources;
+import org.hibernate.boot.registry.StandardServiceRegistry;
+import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
+import org.hibernate.criterion.Projections;
+import org.hibernate.criterion.Restrictions;
+import org.hibernate.resource.transaction.spi.TransactionStatus;
+import org.hibernate.search.FullTextSession;
+import org.hibernate.search.Search;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.usvisatrack.core.common.search.InternalSearch;
+import com.usvisatrack.core.dao.model.User;
+
+/**
+ *
+ * @author YuCheng Hu
+ *
+ */
+public class Factory {
+ private static SessionFactory factory = null;
+ private static Logger logger = LoggerFactory.getLogger(Factory.class);
+
+ private static SessionFactory sessionFactory;
+ // private static ServiceRegistry serviceRegistry;
+
+ private static int indexBatchSize = 100;
+ private static boolean noCommit = false; // blocks the commit function from
+ // being called - this is useful
+ // for unit testing.
+ private static boolean autoRollback = false; // executes a rollback instead
+ // of a commit when commit
+ // is called - this is
+ // useful for unit
+ // testing.
+ private static boolean noClose = false; // prevents the connection from
+ // being closed. This is useful for
+ // unit testing.
+
+ /**
+ * Get Hibernate connection Session
+ *
+ * @return
+ */
+ public static Session getSession() {
+ return Factory.getFactory().getCurrentSession();
+ }
+
+ /**
+ * Get session connection Get
+ *
+ * @return
+ */
+ public static SessionFactory getFactory() {
+ if (Factory.factory == null)
+ Factory.factory = Factory.initSession();
+
+ return Factory.factory;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public static SessionFactory initSession() {
+ // Hibernate 4 init Session
+ // return new Configuration().configure().buildSessionFactory();
+ // Configuration configuration = new Configuration();
+ // configuration.configure();
+ // serviceRegistry = new StandardServiceRegistryBuilder().applySettings(configuration.getProperties()).build();
+ // sessionFactory = configuration.buildSessionFactory(serviceRegistry);
+
+ // Hibernate 5 init Session
+ // configures settings from hibernate.cfg.xml
+ final StandardServiceRegistry registry = new StandardServiceRegistryBuilder().configure().build();
+
+ try {
+ sessionFactory = new MetadataSources(registry).buildMetadata().buildSessionFactory();
+ } catch (Exception e) {
+ logger.error("HIBERNATE DB SESSION INIT ERROR", e);
+ // The registry would be destroyed by the SessionFactory, but we had trouble building the SessionFactory
+ // so destroy it manually.
+ StandardServiceRegistryBuilder.destroy(registry);
+ }
+
+ return sessionFactory;
+ }
+
+ /**
+ *
+ */
+ public static void beginTransaction() {
+ // If transaction not exist, create one
+ if (!(Factory.getSession().getTransaction() != null
+ && Factory.getSession().getTransaction().getStatus() == TransactionStatus.ACTIVE)) {
+ Factory.getSession().getTransaction().begin();
+ }
+ }
+
+ public static Transaction getTransaction() {
+ return Factory.getSession().beginTransaction();
+ }
+
+ public static void commitTransaction() {
+ if (isAutoRollback()) {
+ Factory.rollbackTransaction();
+ return;
+ }
+ if (Factory.getSession().getTransaction() != null
+ && Factory.getSession().getTransaction().getStatus() == TransactionStatus.ACTIVE) {
+ if (!noCommit)
+ Factory.getSession().getTransaction().commit();
+ // zhaohc
+ Factory.getSession().close();
+ }
+ }
+
+ public static void commitTransaction(Transaction tx) {
+ if (isAutoRollback()) {
+ tx.rollback();
+ }
+ if (tx != null && tx.getStatus() == TransactionStatus.ACTIVE) {
+ if (!noCommit)
+ tx.commit();
+ }
+ }
+
+ public static void rollbackTransaction() {
+ if (Factory.getSession().getTransaction() != null && Factory.getSession().getTransaction().getStatus() == TransactionStatus.ACTIVE)
+ Factory.getSession().getTransaction().rollback();
+ }
+
+ public static void rollbackTransaction(Transaction tx) {
+ if (tx != null && tx.getStatus() == TransactionStatus.ACTIVE)
+ tx.rollback();
+ }
+
+ /**
+ * Gets an object of type T from Hibernate.
+ *
+ * @param
+ * @param classEntity
+ * @param id
+ * @return
+ */
+ @SuppressWarnings("unchecked")
+ public static T get(Class classEntity, long id) {
+ Object object = Factory.getSession().get(classEntity, id);
+
+ if (object == null)
+ return null;
+
+ return (T) object;
+ }
+
+ /**
+ * Saves the specified object to the database.
+ *
+ * @param
+ * @param object
+ */
+ public static void save(DataObject object) {
+ if (object == null)
+ throw new NullPointerException("Object supplied is null");
+
+ if (object.getId() != null && object.getId() > 0)
+ Factory.getSession().saveOrUpdate(object);
+ else {
+ Factory.getSession().save(object);
+ }
+ }
+
+ public static void saveUsers(User users) {
+ if (users == null)
+ throw new NullPointerException("Object supplied is null");
+ Factory.getSession().save(users);
+ }
+
+ public static void updateUsers(User users) {
+ if (users == null)
+ throw new NullPointerException("Object supplied is null");
+ Factory.getSession().update(users);
+ }
+
+ /**
+ * Deletes the specified object.
+ *
+ * @param
+ * @param object
+ */
+ public static void delete(DataObject object) {
+ try {
+ Factory.beginTransaction();
+ Factory.getSession().delete(object);
+ Factory.commitTransaction();
+
+ } catch (Exception ex) {
+ logger.error("DB Record Delete Error:", ex);
+ Factory.rollbackTransaction();
+ }
+
+ }
+
+ /**
+ * Creates an hibernate criteria object which is used to query against objects.
+ *
+ * @param classArg
+ * @return
+ */
+ public static Criteria createCriteria(Class classArg) {
+
+ Criteria criteria = Factory.getSession().createCriteria(classArg);
+ // Factory.commitTransaction();
+
+ return criteria;
+ }
+
+ /**
+ * Creates an hibernate criteria object with the specified alias.
+ *
+ * @param classArg
+ * @param alias
+ * @return
+ */
+ public static Criteria createCriteria(Class classArg, String alias) {
+ return Factory.getSession().createCriteria(classArg, alias);
+ }
+
+ /**
+ * Serializes an object into a byte array.
+ *
+ * @param object
+ * @return
+ */
+ public static byte[] serialize(Object object) throws IOException {
+ ByteArrayOutputStream stream = new ByteArrayOutputStream();
+
+ try {
+ ObjectOutputStream serializer = new ObjectOutputStream(stream);
+ serializer.writeObject(object);
+ serializer.close();
+ } catch (IOException ex) {
+ Factory.handleException(ex);
+ }
+
+ byte[] result = stream.toByteArray();
+ stream.close();
+ return result;
+ }
+
+ private static void handleException(IOException ex) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /**
+ * Merges the specified instance.
+ *
+ * @param obj
+ */
+ public static void merge(DataObject obj) {
+ Factory.getSession().merge(obj);
+ }
+
+ /**
+ * Refreshes the specified instance.
+ *
+ * @param approval
+ */
+ public static void refresh(DataObject obj) {
+ Factory.getSession().refresh(obj);
+ }
+
+ /**
+ * Saves or updates the object.
+ *
+ * @param obj
+ */
+ public static void saveOrUpdate(DataObject obj) {
+ Factory.getSession().saveOrUpdate(obj);
+ }
+
+ /**
+ * Evicts the specified object from the session.
+ *
+ * @param obj
+ */
+ public static void evict(DataObject obj) {
+ Factory.getSession().evict(obj);
+ }
+
+ /**
+ * Searches all available search sources (this is used for the back page only).
+ *
+ * @param search
+ * @return
+ */
+
+ // public static PagedResults