Example usage for com.liferay.portal.kernel.theme ThemeDisplay getTimeZone

List of usage examples for com.liferay.portal.kernel.theme ThemeDisplay getTimeZone

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.theme ThemeDisplay getTimeZone.

Prototype

public TimeZone getTimeZone() 

Source Link

Usage

From source file:com.liferay.trash.internal.TrashHelperImpl.java

License:Open Source License

@Override
public String getNewName(ThemeDisplay themeDisplay, String className, long classPK, String oldName)
        throws PortalException {

    TrashRenderer trashRenderer = null;//from ww  w . ja  va2s  .c  o m

    if (Validator.isNotNull(className) && (classPK > 0)) {
        TrashHandler trashHandler = TrashHandlerRegistryUtil.getTrashHandler(className);

        trashRenderer = trashHandler.getTrashRenderer(classPK);
    }

    StringBundler sb = new StringBundler(3);

    sb.append(StringPool.OPEN_PARENTHESIS);

    Format format = FastDateFormatFactoryUtil.getDateTime(themeDisplay.getLocale(), themeDisplay.getTimeZone());

    sb.append(StringUtil.replace(format.format(new Date()), new char[] { CharPool.SLASH, CharPool.COLON },
            new char[] { CharPool.PERIOD, CharPool.PERIOD }));

    sb.append(StringPool.CLOSE_PARENTHESIS);

    if (trashRenderer != null) {
        return trashRenderer.getNewName(oldName, sb.toString());
    } else {
        return _getNewName(oldName, sb.toString());
    }
}