25.02.2015 Views

Introducing Spring Framework

Introducing Spring Framework

Introducing Spring Framework

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 8 ■ Give Advice to Your <strong>Spring</strong> Application<br />

public List findByType(Type documentType) {<br />

List result = new ArrayList();<br />

for(Document doc : listAll()){<br />

if(doc.getType().getName().equals(documentType.getName()))<br />

result.add(doc);<br />

}<br />

return result;<br />

}<br />

public List listAll() {<br />

List result = Arrays.asList(documentDAO.getAll());<br />

return result;<br />

}<br />

}<br />

public List findByLocation(String location) {<br />

throw new UnsupportedOperationException("findByLocation not yet implemented.");<br />

}<br />

You have just added the findByLocation method on the SearchEngine.java class, as shown in Listing 8-2.<br />

Then you removed all the log details from your SearchEngineService.java implementation class. You need to<br />

remove every logging concern. Now, remember your XML file? Let’s review your mydocuments-aop-context.xml file,<br />

as shown in Listing 8-4.<br />

Listing 8-4. mydocuments-aop-context.xml<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

94

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!