001/*
002 * Sonar, open source software quality management tool.
003 * Copyright (C) 2008-2012 SonarSource
004 * mailto:contact AT sonarsource DOT com
005 *
006 * Sonar is free software; you can redistribute it and/or
007 * modify it under the terms of the GNU Lesser General Public
008 * License as published by the Free Software Foundation; either
009 * version 3 of the License, or (at your option) any later version.
010 *
011 * Sonar is distributed in the hope that it will be useful,
012 * but WITHOUT ANY WARRANTY; without even the implied warranty of
013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014 * Lesser General Public License for more details.
015 *
016 * You should have received a copy of the GNU Lesser General Public
017 * License along with Sonar; if not, write to the Free Software
018 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02
019 */
020package org.sonar.jpa.entity;
021
022import org.apache.commons.lang.builder.ReflectionToStringBuilder;
023import org.apache.commons.lang.builder.ToStringStyle;
024
025import javax.persistence.*;
026import java.util.Date;
027
028@Entity
029@Table(name = "manual_measures")
030public final class ManualMeasure {
031  private static final int MAX_TEXT_SIZE = 4000;
032
033  @Id
034  @Column(name = "id")
035  @GeneratedValue
036  private Long id;
037
038  @Column(name = "value", updatable = true, nullable = true, precision = 30, scale = 20)
039  private Double value = null;
040
041  @Column(name = "text_value", updatable = true, nullable = true, length = MAX_TEXT_SIZE)
042  private String textValue;
043
044  @Column(name = "metric_id", updatable = false, nullable = false)
045  private Integer metricId;
046
047  @Column(name = "resource_id", updatable = true, nullable = true)
048  private Integer resourceId;
049
050  @Column(name = "description", updatable = true, nullable = true, length = MAX_TEXT_SIZE)
051  private String description;
052
053  @Column(name = "created_at", updatable = true, nullable = true)
054  private Date createdAt;
055
056  @Column(name = "updated_at", updatable = true, nullable = true)
057  private Date updatedAt;
058
059  @Column(name = "user_login", updatable = true, nullable = true, length = 40)
060  private String userLogin;
061
062  public Long getId() {
063    return id;
064  }
065
066  public Double getValue() {
067    return value;
068  }
069
070  public String getTextValue() {
071    return textValue;
072  }
073
074  public String getDescription() {
075    return description;
076  }
077
078  public Integer getMetricId() {
079    return metricId;
080  }
081
082  public Integer getResourceId() {
083    return resourceId;
084  }
085
086  public Date getCreatedAt() {
087    return createdAt;
088  }
089
090  public Date getUpdatedAt() {
091    return updatedAt;
092  }
093
094  public String getUserLogin() {
095    return userLogin;
096  }
097
098  @Override
099  public String toString() {
100    return new ReflectionToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).toString();
101  }
102}