iddb.web.viewbean.NoticeViewBean.java Source code

Java tutorial

Introduction

Here is the source code for iddb.web.viewbean.NoticeViewBean.java

Source

/**
 *   Copyright(c) 2010-2011 CodWar Soft
 * 
 *   This file is part of IPDB UrT.
 *
 *   IPDB UrT is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   This software is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this software. If not, see <http://www.gnu.org/licenses/>.
 */
package iddb.web.viewbean;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.TimeZone;

import org.apache.commons.lang.StringUtils;

import iddb.core.model.Penalty;

public class NoticeViewBean extends PenaltyViewBean {

    /**
     * 
     */
    private static final long serialVersionUID = 4441805241968582376L;

    public Integer getType() {
        return Penalty.NOTICE;
    }

    @Override
    public String toString() {
        StringBuilder s = new StringBuilder();
        DateFormat format = new SimpleDateFormat("dd/MM/yyyy");
        format.setTimeZone(TimeZone.getTimeZone("GMT-3"));

        s.append(getReason()).append(". ");
        s.append("Agregado el ").append(format.format(this.getCreated()));
        if (StringUtils.isNotEmpty(this.getAdmin())) {
            s.append(" por ").append(getAdmin());
        }
        return s.toString();
    }

}