org.opencustomer.db.vo.calendar.CalendarVO.java Source code

Java tutorial

Introduction

Here is the source code for org.opencustomer.db.vo.calendar.CalendarVO.java

Source

/*******************************************************************************
 * ***** BEGIN LICENSE BLOCK Version: MPL 1.1
 * 
 * The contents of this file are subject to the Mozilla Public License Version
 * 1.1 (the "License"); you may not use this file except in compliance with the
 * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
 * 
 * Software distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
 * the specific language governing rights and limitations under the License.
 * 
 * The Original Code is the OpenCustomer CRM.
 * 
 * The Initial Developer of the Original Code is Thomas Bader (Bader & Jene
 * Software-Ingenieurbro). Portions created by the Initial Developer are
 * Copyright (C) 2005 the Initial Developer. All Rights Reserved.
 * 
 * Contributor(s): Thomas Bader <thomas.bader@bader-jene.de>
 * 
 * ***** END LICENSE BLOCK *****
 */

package org.opencustomer.db.vo.calendar;

import java.util.Calendar;

import javax.persistence.AttributeOverride;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import org.apache.commons.lang.builder.ToStringBuilder;
import org.hibernate.annotations.Where;
import org.opencustomer.db.vo.system.UserVO;
import org.opencustomer.framework.db.vo.EntityAccess;
import org.opencustomer.framework.db.vo.UndeletableVO;

@Entity
@Table(name = "calendar")
@AttributeOverride(name = "id", column = @Column(name = "calendar_id"))
@Where(clause = "deleted=0")
@org.hibernate.annotations.Entity(selectBeforeUpdate = true)
public class CalendarVO extends UndeletableVO implements EntityAccess {
    private static final long serialVersionUID = 3906647496746023222L;

    public enum DayOfWeek {
        MONDAY(Calendar.MONDAY), TUESDAY(Calendar.TUESDAY), WEDNESDAY(Calendar.WEDNESDAY), THURSDAY(
                Calendar.THURSDAY), FRIDAY(Calendar.FRIDAY), SATURDAY(Calendar.SATURDAY), SUNDAY(Calendar.SUNDAY);

        private DayOfWeek(int day) {
            this.day = day;
        }

        private int day;

        public int getDay() {
            return day;
        }
    }

    private String name;

    private DayOfWeek firstDayOfWeek = DayOfWeek.MONDAY;

    private UserVO user;

    private Integer ownerUser;

    private Integer ownerGroup;

    private Access accessUser;

    private Access accessGroup;

    private Access accessGlobal;

    @OneToOne
    @JoinColumn(name = "user_id")
    public UserVO getUser() {
        return user;
    }

    public void setUser(UserVO user) {
        this.user = user;
    }

    @Column(name = "name")
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Column(name = "first_day_of_week")
    @Enumerated(EnumType.STRING)
    public DayOfWeek getFirstDayOfWeek() {
        return firstDayOfWeek;
    }

    public void setFirstDayOfWeek(DayOfWeek firstDayOfWeek) {
        this.firstDayOfWeek = firstDayOfWeek;
    }

    @Column(name = "owner_user")
    public Integer getOwnerUser() {
        return ownerUser;
    }

    public void setOwnerUser(Integer ownerUser) {
        this.ownerUser = ownerUser;
    }

    @Column(name = "owner_group")
    public Integer getOwnerGroup() {
        return ownerGroup;
    }

    public void setOwnerGroup(Integer ownerGroup) {
        this.ownerGroup = ownerGroup;
    }

    @Column(name = "access_user")
    @Enumerated(EnumType.STRING)
    public Access getAccessUser() {
        return accessUser;
    }

    public void setAccessUser(Access accessUser) {
        this.accessUser = accessUser;
    }

    @Column(name = "access_group")
    @Enumerated(EnumType.STRING)
    public Access getAccessGroup() {
        return accessGroup;
    }

    public void setAccessGroup(Access accessGroup) {
        this.accessGroup = accessGroup;
    }

    @Column(name = "access_global")
    @Enumerated(EnumType.STRING)
    public Access getAccessGlobal() {
        return accessGlobal;
    }

    public void setAccessGlobal(Access accessGlobal) {
        this.accessGlobal = accessGlobal;
    }

    public void toString(ToStringBuilder builder) {
        builder.append("ownerUser", ownerUser);
        builder.append("ownerGroup", ownerGroup);
        builder.append("accessUser", accessUser);
        builder.append("accessGroup", accessGroup);
        builder.append("accessGlobal", accessGlobal);
    }
}