001package org.kuali.ole.docstore.document; 002 003import org.apache.commons.net.ntp.TimeStamp; 004import org.kuali.ole.docstore.model.xmlpojo.ingest.RequestDocument; 005import org.kuali.ole.docstore.model.xmlpojo.ingest.ResponseDocument; 006import org.slf4j.Logger; 007import org.slf4j.LoggerFactory; 008 009import java.sql.Timestamp; 010import java.text.DateFormat; 011import java.text.ParseException; 012import java.text.SimpleDateFormat; 013import java.util.Date; 014 015/** 016 * Created with IntelliJ IDEA. 017 * User: mjagan 018 * Date: 6/26/13 019 * Time: 3:15 PM 020 * To change this template use File | Settings | File Templates. 021 */ 022@Deprecated 023public abstract class AbstractDocumentManager implements DocumentManager { 024 025 private static final Logger LOG = LoggerFactory.getLogger(AbstractDocumentManager.class); 026 public Date getDate(String date) { 027 try { 028 if (!"".equals(date) && date != null) { 029 DateFormat df = new SimpleDateFormat("mm/dd/yyyy hh:mm:ss"); 030 Date parseDate = df.parse(date); 031 return parseDate; 032 } 033 } catch (Exception e) { 034 try { 035 if (!"".equals(date) && date != null) { 036 DateFormat df = new SimpleDateFormat("mm/dd/yyyy"); 037 Date parseDate = df.parse(date); 038 return parseDate; 039 } 040 } catch (Exception e1) { 041 LOG.info("Exception : ", e1); 042 } 043 } 044 return null; 045 } 046 047 public void addResourceId(RequestDocument requestDocument, ResponseDocument respDoc) { 048 049 } 050 051 052 public Timestamp getTimeStampFromString(String date) { 053 DateFormat df = new SimpleDateFormat("MM/dd/yyyy"); 054 Timestamp createdDate = null; 055 try { 056 createdDate = new Timestamp(df.parse(date).getTime()); 057 } catch (ParseException e) { 058 LOG.info("Exception : ", e); 059 } 060 return createdDate; 061 } 062}