com.dotmarketing.viewtools
Class WebAPI

java.lang.Object
  extended by com.dotmarketing.viewtools.WebAPI
All Implemented Interfaces:
org.apache.velocity.tools.view.tools.ViewTool

public class WebAPI
extends java.lang.Object
implements org.apache.velocity.tools.view.tools.ViewTool


Constructor Summary
WebAPI()
           
 
Method Summary
 boolean canParseContent(java.lang.String parsePath)
           
 boolean canParseContent(java.lang.String identifier, boolean isWorking)
           
 java.lang.String capitalize(java.lang.String str)
           
 int castToInt(long num)
           
 boolean contentHasLiveVersion(java.lang.String identifier)
           
 java.lang.String dateToHTML(java.util.Date myDate)
           
 java.lang.String dateToHTML(java.util.Date myDate, java.lang.String format)
           
 java.lang.String dateToHTMLDateTimeRange(java.util.Date from, java.util.Date to)
           
 java.lang.String dateToHTMLPrettyDay(int year, int month, int day)
           
 java.lang.String dateToHTMLTimeRange(java.util.Date from, java.util.Date to)
           
 java.lang.String dateToLongPrettyHTMLDate(java.util.Date myDate)
           
 boolean doesUserHasPermissionOverFile(long fileInode, int permission)
          Deprecated. 
 boolean doesUserHasPermissionOverFile(java.lang.String fileInode, int permission)
           
 java.lang.String encodeURL(java.lang.String url)
           
 java.lang.String endMonthDateString()
           
 java.lang.String endWeekDateString()
           
 boolean equalsNumbers(float one, float two)
           
 java.lang.String evaluateVelocity(java.lang.String vtl)
           
 Identifier findIdentifierById(java.lang.String id)
           
static java.lang.String formatDate(java.util.Date date, java.lang.String format)
           
 int getActualYear()
           
 java.lang.String getAssetInode(java.lang.String path)
           
 java.lang.String getAssetInode(java.lang.String path, Host host)
           
 java.lang.String getAssetInode(java.lang.String path, java.lang.String hostId)
           
 java.lang.String getAssetPath(java.lang.String path)
           
 java.lang.String getAssetPath(java.lang.String path, java.lang.String host)
           
 java.lang.Object getCategoriesByNonLoggedUser()
           
 java.lang.String getConfigVar(java.lang.String varName)
           
 java.lang.String getContentIdentifier(java.lang.String parsePath)
           
 java.lang.String getContentInode(java.lang.String parsePath)
           
 java.util.List<Contentlet> getContentletsByCategory(java.lang.String catInode)
           
 java.lang.String getContentPermissions(java.lang.String parsePath)
           
 java.lang.String getCurrentMonth()
           
 Identifier getIdentifierByInode(java.lang.String childInode)
          This method return the identifier object from cache
 java.lang.String getIdentifierByURI(java.lang.String URI)
           
 java.lang.String getIdentifierInode(java.lang.String childInode)
           
 Inode getLiveFileAsset(Identifier id)
           
 Inode getLiveFileAsset(long identifierInode)
          Deprecated. 
 Inode getLiveFileAsset(java.lang.String identifierInode)
           
 com.liferay.portal.model.User getLoggedUser()
           
 java.lang.String getPageFileExtension()
           
 java.util.List getRecentlyPublished()
          This method returns a list of the 10 HTMLPages that have most recently been published by modificatation date desc.
 java.lang.String getShortMonthName(int month)
           
 java.lang.String getShortMonthName(java.lang.String month)
           
 java.lang.String getSubURIByDepth(int depth)
          This method gives to you the sub URI of a complete request URI given the deepness desired.
 java.util.List<Trackback> getTrackbacksByIdentifier(java.lang.String id)
          This method return the list of trackback ping associated to a identifier This method is use in the trackback macro
 com.liferay.portal.model.User getUserByLongLiveCookie()
           
 java.lang.String getUserEmail()
           
 java.lang.String getUserFullName()
           
 java.lang.String htmlEncode(java.lang.String html)
           
 java.lang.String htmlLineBreak(java.lang.String input)
           
 void init(java.lang.Object obj)
           
 boolean isBiggerThan(java.lang.String float1, java.lang.String float2)
           
static void isCreateFormEmpty(java.lang.Object form, javax.servlet.http.HttpServletResponse response)
           
 boolean isImage(java.lang.String text)
           
 java.lang.String isInArray(java.lang.String[] values, java.lang.String[] array)
           
 java.lang.String isInArray(java.lang.String value, java.lang.String array)
           
 java.lang.String isInArray(java.lang.String value, java.lang.String[] array)
           
 boolean isPartner()
           
 boolean isSet(java.lang.String input)
           
static java.lang.String javaScriptify(java.lang.String fixme)
           
 java.lang.String obfuscateCreditCard(java.lang.String ccnum)
           
 int parseInt(int num)
           
 int parseInt(long num)
           
 int parseInt(java.lang.String num)
           
 long parseLong(int num)
           
 long parseLong(long num)
           
 long parseLong(java.lang.String num)
           
 java.lang.String prettyShortenString(java.lang.String text, java.lang.String maxLength)
           
 Host resolveHostName(java.lang.String hostName)
           
static java.lang.String RSSParse(java.lang.String uri)
          Convert a rss feed to a html list
 void setErrorResponseCode(int code)
          This Method set the HttpServletResponse status with the specified error code.
 void setVelocityVar(java.lang.String varName, java.lang.Object value)
           
 java.util.List<java.lang.String> splitString(java.lang.String str, java.lang.String sep)
           
 java.lang.String startMonthDateString()
           
 java.lang.String startWeekDateString()
           
 int stringLength(java.lang.String text)
           
 java.lang.String subString(java.lang.String text, int begin, int end)
           
 java.lang.String toCCFormat(java.lang.String creditCard)
           
 java.lang.String todayDateString()
           
 java.lang.String toMonthFormat(int month)
           
 java.lang.String toPriceFormat(double price)
           
 java.lang.String toPriceFormat(float price)
           
 java.lang.String toString(int i)
           
 java.lang.String toString(java.lang.Integer i)
           
 java.lang.String toString(long num)
           
 java.lang.String trim(java.lang.String input)
           
 java.lang.String trimToUpper(java.lang.String input)
           
 java.lang.String xmlEscape(java.lang.String x)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WebAPI

public WebAPI()
Method Detail

init

public void init(java.lang.Object obj)
Specified by:
init in interface org.apache.velocity.tools.view.tools.ViewTool
Parameters:
obj - the ViewContext that is automatically passed on view tool initialization, either in the request or the application
See Also:
ViewTool, ViewContext

getRecentlyPublished

public java.util.List getRecentlyPublished()
                                    throws com.liferay.portal.PortalException,
                                           com.liferay.portal.SystemException,
                                           DotDataException,
                                           DotSecurityException
This method returns a list of the 10 HTMLPages that have most recently been published by modificatation date desc.

Returns:
a list of HTMLPage objects
Throws:
DotSecurityException
DotDataException
com.liferay.portal.SystemException
com.liferay.portal.PortalException
See Also:
HTMLPage, ViewContext

parseInt

public int parseInt(java.lang.String num)

parseLong

public long parseLong(java.lang.String num)

parseInt

public int parseInt(int num)

parseLong

public long parseLong(long num)

parseInt

public int parseInt(long num)

parseLong

public long parseLong(int num)

castToInt

public int castToInt(long num)

toString

public java.lang.String toString(long num)

toString

public java.lang.String toString(java.lang.Integer i)

toString

public java.lang.String toString(int i)

dateToHTMLPrettyDay

public java.lang.String dateToHTMLPrettyDay(int year,
                                            int month,
                                            int day)

dateToHTML

public java.lang.String dateToHTML(java.util.Date myDate)

dateToHTMLDateTimeRange

public java.lang.String dateToHTMLDateTimeRange(java.util.Date from,
                                                java.util.Date to)

dateToHTMLTimeRange

public java.lang.String dateToHTMLTimeRange(java.util.Date from,
                                            java.util.Date to)

dateToHTML

public java.lang.String dateToHTML(java.util.Date myDate,
                                   java.lang.String format)

trimToUpper

public java.lang.String trimToUpper(java.lang.String input)

trim

public java.lang.String trim(java.lang.String input)

htmlLineBreak

public java.lang.String htmlLineBreak(java.lang.String input)

isSet

public boolean isSet(java.lang.String input)

obfuscateCreditCard

public java.lang.String obfuscateCreditCard(java.lang.String ccnum)

capitalize

public java.lang.String capitalize(java.lang.String str)

splitString

public java.util.List<java.lang.String> splitString(java.lang.String str,
                                                    java.lang.String sep)

encodeURL

public java.lang.String encodeURL(java.lang.String url)

htmlEncode

public java.lang.String htmlEncode(java.lang.String html)

getIdentifierInode

public java.lang.String getIdentifierInode(java.lang.String childInode)
                                    throws DotIdentifierStateException,
                                           DotDataException
Throws:
DotIdentifierStateException
DotDataException

getShortMonthName

public java.lang.String getShortMonthName(int month)

getShortMonthName

public java.lang.String getShortMonthName(java.lang.String month)

getContentletsByCategory

public java.util.List<Contentlet> getContentletsByCategory(java.lang.String catInode)
Parameters:
catInode - Can use either the category inode or the name
Returns:

prettyShortenString

public java.lang.String prettyShortenString(java.lang.String text,
                                            java.lang.String maxLength)

dateToLongPrettyHTMLDate

public java.lang.String dateToLongPrettyHTMLDate(java.util.Date myDate)

canParseContent

public boolean canParseContent(java.lang.String identifier,
                               boolean isWorking)

canParseContent

public boolean canParseContent(java.lang.String parsePath)

evaluateVelocity

public java.lang.String evaluateVelocity(java.lang.String vtl)

getContentIdentifier

public java.lang.String getContentIdentifier(java.lang.String parsePath)

getContentInode

public java.lang.String getContentInode(java.lang.String parsePath)

getContentPermissions

public java.lang.String getContentPermissions(java.lang.String parsePath)

xmlEscape

public java.lang.String xmlEscape(java.lang.String x)

getPageFileExtension

public java.lang.String getPageFileExtension()

stringLength

public int stringLength(java.lang.String text)

subString

public java.lang.String subString(java.lang.String text,
                                  int begin,
                                  int end)

isImage

public boolean isImage(java.lang.String text)

getAssetPath

public java.lang.String getAssetPath(java.lang.String path)

getAssetPath

public java.lang.String getAssetPath(java.lang.String path,
                                     java.lang.String host)

getAssetInode

public java.lang.String getAssetInode(java.lang.String path)

getAssetInode

public java.lang.String getAssetInode(java.lang.String path,
                                      java.lang.String hostId)

getAssetInode

public java.lang.String getAssetInode(java.lang.String path,
                                      Host host)

getSubURIByDepth

public java.lang.String getSubURIByDepth(int depth)
This method gives to you the sub URI of a complete request URI given the deepness desired. E.G. URI = /alumni/relations/aaa/index.dot then getSubURI(2) = /alumni/relations/

Parameters:
deepness -
Returns:

getConfigVar

public java.lang.String getConfigVar(java.lang.String varName)

formatDate

public static java.lang.String formatDate(java.util.Date date,
                                          java.lang.String format)

isCreateFormEmpty

public static void isCreateFormEmpty(java.lang.Object form,
                                     javax.servlet.http.HttpServletResponse response)

toMonthFormat

public java.lang.String toMonthFormat(int month)

isPartner

public boolean isPartner()

equalsNumbers

public boolean equalsNumbers(float one,
                             float two)

toPriceFormat

public java.lang.String toPriceFormat(double price)

toPriceFormat

public java.lang.String toPriceFormat(float price)

getUserFullName

public java.lang.String getUserFullName()

getLoggedUser

public com.liferay.portal.model.User getLoggedUser()

getUserEmail

public java.lang.String getUserEmail()

toCCFormat

public java.lang.String toCCFormat(java.lang.String creditCard)

getLiveFileAsset

public Inode getLiveFileAsset(Identifier id)
                       throws DotStateException,
                              DotDataException,
                              DotSecurityException
Throws:
DotStateException
DotDataException
DotSecurityException

getLiveFileAsset

@Deprecated
public Inode getLiveFileAsset(long identifierInode)
                       throws DotDataException,
                              DotStateException,
                              DotSecurityException
Deprecated. 

Throws:
DotDataException
DotStateException
DotSecurityException

getLiveFileAsset

public Inode getLiveFileAsset(java.lang.String identifierInode)
                       throws DotDataException,
                              DotStateException,
                              DotSecurityException
Throws:
DotDataException
DotStateException
DotSecurityException

javaScriptify

public static java.lang.String javaScriptify(java.lang.String fixme)

getActualYear

public int getActualYear()

isBiggerThan

public boolean isBiggerThan(java.lang.String float1,
                            java.lang.String float2)

getCurrentMonth

public java.lang.String getCurrentMonth()

todayDateString

public java.lang.String todayDateString()

startWeekDateString

public java.lang.String startWeekDateString()

endWeekDateString

public java.lang.String endWeekDateString()

startMonthDateString

public java.lang.String startMonthDateString()

endMonthDateString

public java.lang.String endMonthDateString()

isInArray

public java.lang.String isInArray(java.lang.String value,
                                  java.lang.String array)

isInArray

public java.lang.String isInArray(java.lang.String value,
                                  java.lang.String[] array)

isInArray

public java.lang.String isInArray(java.lang.String[] values,
                                  java.lang.String[] array)

getUserByLongLiveCookie

public com.liferay.portal.model.User getUserByLongLiveCookie()

getCategoriesByNonLoggedUser

public java.lang.Object getCategoriesByNonLoggedUser()

setVelocityVar

public void setVelocityVar(java.lang.String varName,
                           java.lang.Object value)

getIdentifierByURI

public java.lang.String getIdentifierByURI(java.lang.String URI)
                                    throws com.liferay.portal.PortalException,
                                           com.liferay.portal.SystemException,
                                           DotDataException,
                                           DotSecurityException
Throws:
com.liferay.portal.PortalException
com.liferay.portal.SystemException
DotDataException
DotSecurityException

getIdentifierByInode

public Identifier getIdentifierByInode(java.lang.String childInode)
                                throws DotIdentifierStateException,
                                       DotDataException
This method return the identifier object from cache

Parameters:
childInode -
Returns:
Identifier
Throws:
DotDataException
DotIdentifierStateException
Since:
1.5

getTrackbacksByIdentifier

public java.util.List<Trackback> getTrackbacksByIdentifier(java.lang.String id)
This method return the list of trackback ping associated to a identifier This method is use in the trackback macro

Parameters:
id -
Returns:
List
Since:
1.5

setErrorResponseCode

public void setErrorResponseCode(int code)
This Method set the HttpServletResponse status with the specified error code. is the value pass is equals to zero, the status is set with 404 error

Parameters:
code - The HttpServletResponse error code
Since:
1.5

RSSParse

public static java.lang.String RSSParse(java.lang.String uri)
Convert a rss feed to a html list

Parameters:
uri - String with rss feed uri
Returns:
String with the html code

doesUserHasPermissionOverFile

@Deprecated
public boolean doesUserHasPermissionOverFile(long fileInode,
                                                        int permission)
                                      throws DotDataException
Deprecated. 

Throws:
DotDataException

doesUserHasPermissionOverFile

public boolean doesUserHasPermissionOverFile(java.lang.String fileInode,
                                             int permission)
                                      throws DotDataException
Throws:
DotDataException

resolveHostName

public Host resolveHostName(java.lang.String hostName)

findIdentifierById

public Identifier findIdentifierById(java.lang.String id)

contentHasLiveVersion

public boolean contentHasLiveVersion(java.lang.String identifier)
                              throws java.lang.Exception
Throws:
java.lang.Exception


Copyright © 2013 dotCMS Inc. All Rights Reserved.