Java Swing GUI based program for every employee efficiency tracking, task and time management

Java Swing GUI based program for every employee efficiency tracking, task and time management
25/05/2019 Ernestas Konopliovas
In Back-end, Java
Short description

The program is used by groups to manage their tasks. Group members insert their tasks and deadlines and receive effectiveness points by their performance.

Once the program is opened two options can be chosen either registration or log in. If you are a first-time user you could register as a group member or as a leader, but if you register as a leader you will also need to register your group. As a group leader you have more options, because you can create tasks, assign them to yourself or your group members and see the effectiveness of individual group members. If you register or sign in as a group member you can only be assigned tasks and change the state of them. Both leaders and members can add to the system time (time simulation) in the top right corner. If a task does not meet the deadline, the status of it is automatically changed to failed.

Code, we used

Hashing user passwords method:

 public static String hash(String input) throws NoSuchAlgorithmException {
java.security.MessageDigest md = java.security.MessageDigest.getInstance("MD5");
byte[] array = md.digest(input.getBytes());
return byteArrayToHex(array);
}
private static String byteArrayToHex(byte[] a) {
StringBuilder sb = new StringBuilder(a.length * 2);
for(byte b: a)
sb.append(String.format("%02x", b));
return sb.toString();
}

It takes a String and returns it hashed as a String, too.

For time simulation we used such code:

public Calendar calendar= Calendar.getInstance();
public SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm");

public void setTimeString(String date){
try {
calendar.setTime(formatter.parse(date));
}catch (ParseException e){
System.out.println("Date is not declared correctly!");
}
}

public void addTime(String whatToAdd, int amount){
switch (whatToAdd.toLowerCase()){
case "days": calendar.add(Calendar.DATE, amount); break;
case "months": calendar.add(Calendar.MONTH, amount); break;
case "years": calendar.add(Calendar.YEAR, amount); break;
case "hours": calendar.add(Calendar.HOUR, amount); break;
case "minutes": calendar.add(Calendar.MINUTE, amount); break;
}
}

SimpleDateFormat formatter used to format date in the way we used to see it.
void addTime(String whatToAdd, int amount) method is used to add time to simulation. The first argument is string which declares what to add: minutes, hours, days, months or years. The second argument is int which is used to define how many days, hours etc. to add.

Method, used to search for illegal symbols in input fields:

public boolean containsIllegals(String toExamine) {
Pattern pattern = Pattern.compile("[~#@*+%{}<>[]|"_^]");
Matcher matcher = pattern.matcher(toExamine);
return matcher.find();
}

If sent String contains any illegal symbol, method returns true.

Demonstration

Comments (0)

Leave a reply

Your email address will not be published. Required fields are marked *

*