Java tutorial
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.ga.logic.abstractclasses; import com.ga.logic.interfaces.Record; import java.util.Date; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Set; import org.json.simple.JSONObject; /** * * @author gurpreet */ public class RecordAbstract implements Record { protected String currentDate = null; protected String currentDayOfWeek = null; protected String checkInTime = null; protected String checkOutTime = null; protected String breakTime = null; protected String duration = null; protected String underTime = null; protected String overTime = null; private JSONObject record = null; private JSONObject meta = null; private Set argsSet; @Override public String getCurrentDate() { return currentDate; } public void setCurrentDate(String currentDate) { this.currentDate = currentDate; } @Override public String getCurrentDayOfWeek() { return currentDayOfWeek; } @Override public void setCurrentDayOfWeek(String currentDayOfWeek) { this.currentDayOfWeek = currentDayOfWeek; } @Override public String getCheckInTime() { return checkInTime; } @Override public void setCheckInTime(String checkInTime) { this.checkInTime = checkInTime; } @Override public String getCheckOutTime() { return checkOutTime; } @Override public void setCheckOutTime(String checkOutTime) { this.checkOutTime = checkOutTime; } @Override public String getBreakTime() { return breakTime; } @Override public void setBreakTime(String breakTime) { this.breakTime = breakTime; } @Override public JSONObject getMeta() { return meta; } @Override public String getDuration() { return duration; } @Override public void setDuration(String duration) { this.duration = duration; } @Override public String getUnderTime() { return underTime; } @Override public void setUnderTime(String underTime) { this.underTime = underTime; } @Override public String getOverTime() { return overTime; } @Override public void setOverTime(String overTime) { this.overTime = overTime; } @Override public void setMeta(HashMap args) { argsSet = args.entrySet(); Iterator argsIterator = argsSet.iterator(); this.meta = new JSONObject(); while (argsIterator.hasNext()) { Map.Entry argsElement = (Map.Entry) argsIterator.next(); this.meta.put(argsElement.getKey().toString(), argsElement.getValue().toString()); } } @Override public JSONObject getRecord() { return record; } @Override public void setRecord(String currentDate, String dayOfWeek, String checkInTime, String checkOutTime, String breakTime, String duration, String underTime, String overTime, HashMap meta) { this.setCurrentDate(currentDate); this.setCurrentDayOfWeek(dayOfWeek); this.setCheckInTime(checkInTime); this.setCheckOutTime(checkOutTime); this.setBreakTime(breakTime); this.setDuration(duration); this.setUnderTime(underTime); this.setOverTime(overTime); this.setMeta(meta); this.record = new JSONObject(); this.record.put("date", this.getCurrentDate()); this.record.put("day", this.getCurrentDayOfWeek()); this.record.put("check-in", this.getCheckInTime()); this.record.put("check-out", this.getCheckOutTime()); this.record.put("break", this.getBreakTime()); this.record.put("duration", this.getDuration()); this.record.put("under-time", this.getUnderTime()); this.record.put("over-time", this.getOverTime()); this.record.put("meta", this.getMeta()); } @Override public void setCurrentDate(Date currentDate) { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } }