Example usage for com.liferay.portal.util PropsValues MESSAGE_BOARDS_EXPIRE_BAN_INTERVAL

List of usage examples for com.liferay.portal.util PropsValues MESSAGE_BOARDS_EXPIRE_BAN_INTERVAL

Introduction

In this page you can find the example usage for com.liferay.portal.util PropsValues MESSAGE_BOARDS_EXPIRE_BAN_INTERVAL.

Prototype

int MESSAGE_BOARDS_EXPIRE_BAN_INTERVAL

To view the source code for com.liferay.portal.util PropsValues MESSAGE_BOARDS_EXPIRE_BAN_INTERVAL.

Click Source Link

Usage

From source file:com.liferay.message.boards.service.impl.MBBanLocalServiceImpl.java

License:Open Source License

@Override
public void expireBans() {
    if (PropsValues.MESSAGE_BOARDS_EXPIRE_BAN_INTERVAL <= 0) {
        return;/*from  ww  w. j  av a 2 s . co  m*/
    }

    long now = System.currentTimeMillis();

    List<MBBan> bans = mbBanPersistence.findAll();

    for (MBBan ban : bans) {
        Date unbanDate = MBUtil.getUnbanDate(ban, PropsValues.MESSAGE_BOARDS_EXPIRE_BAN_INTERVAL);

        long unbanTime = unbanDate.getTime();

        if (now >= unbanTime) {
            if (_log.isDebugEnabled()) {
                _log.debug(StringBundler.concat("Auto expiring ban ", String.valueOf(ban.getBanId()),
                        " on user ", String.valueOf(ban.getBanUserId())));
            }

            mbBanPersistence.remove(ban);
        }
    }
}

From source file:com.liferay.portlet.messageboards.service.impl.MBBanLocalServiceImpl.java

License:Open Source License

public void expireBans() throws SystemException {
    if (PropsValues.MESSAGE_BOARDS_EXPIRE_BAN_INTERVAL <= 0) {
        return;/*from   w  w  w. j  a va2s .  c  om*/
    }

    long now = System.currentTimeMillis();

    List<MBBan> bans = mbBanPersistence.findAll();

    for (MBBan ban : bans) {
        long unbanDate = MBUtil.getUnbanDate(ban, PropsValues.MESSAGE_BOARDS_EXPIRE_BAN_INTERVAL).getTime();

        if (now >= unbanDate) {
            if (_log.isDebugEnabled()) {
                _log.debug("Auto expiring ban " + ban.getBanId() + " on user " + ban.getBanUserId());
            }

            mbBanPersistence.remove(ban);
        }
    }
}