Skip to content

Commit

Permalink
Creating an executable jar
Browse files Browse the repository at this point in the history
  • Loading branch information
LuizClaudioSantos committed Jul 13, 2017
1 parent 381159a commit a641a20
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 13 deletions.
49 changes: 39 additions & 10 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<modelVersion>4.0.0</modelVersion>

<groupId>org.iadb.knl.fhl</groupId>
<artifactId>userimport</artifactId>
<version>1.0-SNAPSHOT</version>
<artifactId>user4Lib</artifactId>
<version>1.0</version>

<properties>
<maven.compiler.source>1.8</maven.compiler.source>
Expand Down Expand Up @@ -60,13 +60,42 @@

</dependencies>

<profiles>
<profile>
<id>dev</id>
<properties>
<users-file>/Users/luizfr/Development/ideaprojects/users4lib/src/main/resources/source/ePortal_Telephone_Directory.csv</users-file>
</properties>
</profile>
</profiles>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>
${project.build.directory}/libs
</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>libs/</classpathPrefix>
<mainClass>
users4lib.main.Users4Lib
</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>

</project>
43 changes: 41 additions & 2 deletions src/main/java/users4lib/main/Users4Lib.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import users4lib.model.User;
import users4lib.readers.UsersReader;
import users4lib.writers.AlephWriter;
import users4lib.writers.EZproxyWriter;

import java.io.IOException;
import java.util.List;

/**
* Created by luizfr on 3/23/16.
Expand All @@ -11,11 +17,44 @@ public class Users4Lib {


// TODO add main options here
public static void main(String [] main){
public static void main(String [] args){
ApplicationContext context = new ClassPathXmlApplicationContext("application-context.xml");
UsersReader reader = context.getBean("UsersReader", UsersReader.class);

if (args.length == 1){

UsersReader reader = context.getBean("UsersReaderAleph", UsersReader.class);

reader.setUserSource(args[0]);

List<User> alephUsers = reader.getUsers();

AlephWriter aw = new AlephWriter();
try {
aw.exportAlephUsers(alephUsers,"./aleph_users.xml");
} catch (Exception e) {
e.printStackTrace();
}

reader = context.getBean("UsersReaderEzproxy", UsersReader.class);

reader.setUserSource(args[0]);

EZproxyWriter writer = new EZproxyWriter();
try {
writer.openFile("./ezproxy_users");
List<User> eZproxyUsers = reader.getUsers();

writer.printEzproxyUsers(eZproxyUsers);

} catch (IOException e) {
e.printStackTrace();
}

}else{
System.out.println("You should pass the staff directory as argument!");
}

}


}
2 changes: 1 addition & 1 deletion src/main/java/users4lib/model/UserFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public static AlephUser createAnAlephUser(CSVRecord record){
address.setZ304Telephone(phone==null || phone.equals("")?"+":phone);
address.setZ304Telephone2(fax==null || fax.equals("")?"+":fax);
address.setZ304DateFrom("20090101");
address.setZ304DateTo("20161231");
address.setZ304DateTo("20171231");
address.setZ304AddressType("01");
address.setZ304address3("+");
address.setZ304address4("+");
Expand Down

0 comments on commit a641a20

Please sign in to comment.