001    /*
002     * Sonar, open source software quality management tool.
003     * Copyright (C) 2008-2011 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     */
020    package org.sonar.jpa.entity;
021    
022    import javax.persistence.Column;
023    import javax.persistence.Entity;
024    import javax.persistence.GeneratedValue;
025    import javax.persistence.Id;
026    import javax.persistence.Table;
027    
028    /**
029     * @since 2.11
030     */
031    @Entity
032    @Table(name = "duplications_index")
033    public class DuplicationBlock {
034    
035      public static final int BLOCK_HASH_SIZE = 50;
036    
037      @Id
038      @Column(name = "id")
039      @GeneratedValue
040      private Integer id;
041    
042      @Column(name = "snapshot_id", updatable = false, nullable = false)
043      private Integer snapshotId;
044    
045      @Column(name = "project_snapshot_id", updatable = false, nullable = false)
046      private Integer projectSnapshotId;
047    
048      @Column(name = "hash", updatable = false, nullable = false, length = BLOCK_HASH_SIZE)
049      private String hash;
050    
051      @Column(name = "index_in_file", updatable = false, nullable = false)
052      private Integer indexInFile;
053    
054      @Column(name = "start_line", updatable = false, nullable = false)
055      private Integer startLine;
056    
057      @Column(name = "end_line", updatable = false, nullable = false)
058      private Integer endLine;
059    
060      public DuplicationBlock() {
061      }
062    
063      public DuplicationBlock(Integer projectSnapshotId, Integer snapshotId, String hash, Integer indexInFile, Integer startLine, Integer endLine) {
064        this.projectSnapshotId = projectSnapshotId;
065        this.snapshotId = snapshotId;
066        this.hash = hash;
067        this.indexInFile = indexInFile;
068        this.startLine = startLine;
069        this.endLine = endLine;
070      }
071    
072      public Integer getId() {
073        return id;
074      }
075    
076      public Integer getSnapshotId() {
077        return snapshotId;
078      }
079    
080      public Integer getProjectSnapshotId() {
081        return projectSnapshotId;
082      }
083    
084      public String getHash() {
085        return hash;
086      }
087    
088      public Integer getIndexInFile() {
089        return indexInFile;
090      }
091    
092      public Integer getStartLine() {
093        return startLine;
094      }
095    
096      public Integer getEndLine() {
097        return endLine;
098      }
099    
100    }