@Override
	public Map<String, Object> getAuctionById(String auctionId) {
		Map<String, Object> auctionMap = new HashMap<String, Object>();
		Auction auction = emgr.find(Auction.class, Integer.parseInt(auctionId));
		if (auction != null) {
			String auctionName = auction.getAuctionName();
			String auctionDescription = auction.getAuctionDescription();
			
			Calendar currentCal = Calendar.getInstance();
			Calendar endCal = Calendar.getInstance();
			Time endTime = auction.getEndTime();
			System.out.println("END TIME = " + endTime.toString());
			Calendar endDateCal = new GregorianCalendar();
			endDateCal.setTime(auction.getEndDate());
			
			String[] splitEndTime = endTime.toString().split(":");
			
			endDateCal.set(Calendar.HOUR_OF_DAY, Integer.parseInt(splitEndTime[0]));
			endDateCal.set(Calendar.MINUTE, Integer.parseInt(splitEndTime[1]));
			endDateCal.set(Calendar.SECOND, Integer.parseInt(splitEndTime[2]));
			
			if (currentCal.after(endDateCal)) {
				System.out.println("EXPIRED!!!!!!!!!!!!!!!!!");
				
				// Set the auction as expired.
				Auction expiredAuction = emgr.find(Auction.class, Integer.parseInt(auctionId));
				short expired = 1;
				expiredAuction.setAuctionExpired(expired);
				
				emgr.persist(expiredAuction);
				
				// Obtain the item details
				Item item = emgr.find(Item.class, auction.getItemId());
				String itemName = item.getItemName();
				String itemModel = item.getItemModel();
				String itemDescription = item.getItemDescription();
				
				auctionMap.put("itemName", itemName);
				auctionMap.put("itemModel", itemModel);
				auctionMap.put("itemDescription", itemDescription);
				auctionMap.put("auctionName", auction.getAuctionName());
				auctionMap.put("auctionDescription", auction.getAuctionDescription());
				auctionMap.put("auctionId", Integer.toString(auction.getAuctionId()));
				auctionMap.put("auctionDaysLeft", "-1");
				auctionMap.put("auctionTimeLeft", "-1");
				auctionMap.put("auctionItemId", auction.getItemId());
				auctionMap.put("auctionStartPrice", auction.getStartPrice());
			} else {
				System.out.println("Not yet expired.");
				int daysBetween = Days.daysBetween(new DateTime(currentCal.getTime()), new DateTime(endDateCal.getTime())).getDays();
				
				// Obtain the time difference and compensate for 1 hour (since the calendar starts at 01:00 and not 00:00)
				Date dateDiff = new Date(endDateCal.getTime().getTime() - currentCal.getTime().getTime() - 3600000);
				SimpleDateFormat timeFormat = new SimpleDateFormat("H:mm:ss");
				System.out.println("Duration: " + timeFormat.format(dateDiff));
				
				// Obtain the item details
				Item item = emgr.find(Item.class, auction.getItemId());
				String itemName = item.getItemName();
				String itemModel = item.getItemModel();
				String itemDescription = item.getItemDescription();
				
				auctionMap.put("itemName", itemName);
				auctionMap.put("itemModel", itemModel);
				auctionMap.put("itemDescription", itemDescription);
				auctionMap.put("auctionName", auction.getAuctionName());
				auctionMap.put("auctionDescription", auction.getAuctionDescription());
				auctionMap.put("auctionId", Integer.toString(auction.getAuctionId()));
				auctionMap.put("auctionDaysLeft", Integer.toString(daysBetween));
				auctionMap.put("auctionTimeLeft", timeFormat.format(dateDiff));
				auctionMap.put("auctionItemId", auction.getItemId());
				auctionMap.put("auctionStartPrice", auction.getStartPrice());
			}
		}
		return auctionMap;
	}