no.sesat.search.view.velocity
Class DateFormattingDirective
java.lang.Object
org.apache.velocity.runtime.directive.Directive
no.sesat.search.view.velocity.DateFormattingDirective
- All Implemented Interfaces:
- Cloneable, org.apache.velocity.runtime.directive.DirectiveConstants
public final class DateFormattingDirective
- extends org.apache.velocity.runtime.directive.Directive
A velocity directive to format newsnavigator date.
Newsdate comes from the fastnavigator in four forms:
1. 10-2006 -> Oktober 2006
2. 24-10-2006 -> 24. oktober 2006
3. 2006-10 -> Oktober 2006
4. 2006-10-24 -> 24. oktober 2006
if 'newsdateOnly' navigator, we shuold check if the date is today or yesterday
Note: This directive is meant to be used on navigators. that means that the timeZone for the dates are in "CET"
| Fields inherited from class org.apache.velocity.runtime.directive.Directive |
rsvc |
| Fields inherited from interface org.apache.velocity.runtime.directive.DirectiveConstants |
BLOCK, LINE |
| Methods inherited from class org.apache.velocity.runtime.directive.Directive |
getColumn, getLine, init, setLocation |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DateFormattingDirective
public DateFormattingDirective()
getName
public String getName()
-
- Specified by:
getName in class org.apache.velocity.runtime.directive.Directive
getType
public int getType()
-
- Specified by:
getType in class org.apache.velocity.runtime.directive.Directive
render
public boolean render(org.apache.velocity.context.InternalContextAdapter context,
Writer writer,
org.apache.velocity.runtime.parser.node.Node node)
throws IOException,
org.apache.velocity.exception.ResourceNotFoundException,
org.apache.velocity.exception.ParseErrorException,
org.apache.velocity.exception.MethodInvocationException
-
- Specified by:
render in class org.apache.velocity.runtime.directive.Directive
- Throws:
IOException
org.apache.velocity.exception.ResourceNotFoundException
org.apache.velocity.exception.ParseErrorException
org.apache.velocity.exception.MethodInvocationException
formatDate
protected String formatDate(String input,
String navName)
throws ParseException
- Throws:
ParseException
formatFormOne
protected String formatFormOne(String input)
throws ParseException
- Throws:
ParseException
formatFormTwo
protected String formatFormTwo(String input,
boolean newsDateOnly)
throws ParseException
- Throws:
ParseException
formatFormThree
protected String formatFormThree(String input)
throws ParseException
- Throws:
ParseException
formatFormFour
protected String formatFormFour(String input,
boolean newsDateOnly)
throws ParseException
- Throws:
ParseException
Copyright © 2005-2009 Schibsted ASA. All Rights Reserved.