View Javadoc
1   /***
2    * Copyright (C) 2009 TM-Search Community.
3    *
4    * This file is part of TM-Search Services.
5    *
6    * Foobar is free software: you can redistribute it and/or modify
7    * it under the terms of the GNU General Public License as published by
8    * the Free Software Foundation, either version 3 of the License, or
9    * (at your option) any later version.
10   *
11   * Foobar is distributed in the hope that it will be useful,
12   * but WITHOUT ANY WARRANTY; without even the implied warranty of
13   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   * GNU General Public License for more details.
15   *
16   * You should have received a copy of the GNU General Public License
17   * along with Foobar.  If not, see <http://www.gnu.org/licenses/>.
18   */
19  
20  package eu.europa.tmsearch.services.business;
21  
22  import java.util.Date;
23  
24  import org.apache.log4j.Logger;
25  
26  import eu.europa.tmsearch.services.dao.ApplicantDAO;
27  import eu.europa.tmsearch.services.resources.exceptions.ResourceNotFoundException;
28  import eu.europa.tmsearch.services.schemas.trademark.applicant.ApplicantType;
29  
30  /***
31   * An implementation of Applicant service business logic
32   * 
33   * 
34   * @see ApplicantType
35   */
36  public class ApplicantServiceImpl implements ApplicantService {
37  
38      private ApplicantDAO applicantDAO;
39  
40      private static Logger log = Logger.getLogger(ApplicantServiceImpl.class);
41  
42      /***
43       * Gets an Applicant given an applicant ID
44       * 
45       * @param applicantId
46       *            An applicant ID
47       * @return An applicant
48       * @throws ResourceNotFoundException
49       *             If the applicant ID does not exist
50       * @see ApplicantType
51       */
52      public ApplicantType getApplicant(String applicantId) throws ResourceNotFoundException {
53  
54  	if (log.isDebugEnabled()) {
55  	    log.debug("Retrieving Applicant With ID --> " + applicantId);
56  	}
57  	ApplicantType applicantType = applicantDAO.getApplicant(applicantId);
58  	log.info("Trademark Retrieved");
59  	return applicantType;
60      }
61  
62      @Override
63      public Date getLastModified(String applicantId) throws ResourceNotFoundException {
64  //	String applicationNumber = st13Converter.fromST13ID(tradeMarkID);
65  //	return applicantDAO.getLastModified(applicationNumber);
66  	return applicantDAO.getLastModified(applicantId);
67      }
68  
69      @Override
70      public Date getExpires(String applicantId) throws ResourceNotFoundException {
71  //	String applicationNumber = st13Converter.fromST13ID(tradeMarkID);
72  //	return applicantDAO.getLastModified(applicationNumber);
73  	return applicantDAO.getExpires(applicantId);
74      }
75      
76      public ApplicantDAO getApplicantDAO() {
77  	return applicantDAO;
78      }
79  
80      public void setApplicantDAO(ApplicantDAO applicantDAO) {
81  	this.applicantDAO = applicantDAO;
82      }
83  
84  }