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.core.workflow; 021 022import com.google.common.collect.ImmutableMap; 023import org.sonar.api.workflow.Review; 024import org.sonar.api.workflow.internal.DefaultReview; 025 026import java.util.Map; 027 028public final class ImmutableReview implements Review { 029 private final Long violationId; 030 private final Long reviewId; 031 private final String ruleRepositoryKey; 032 private final String ruleKey; 033 private final String ruleName; 034 private final Long line; 035 private final boolean switchedOff; 036 private final boolean manual; 037 private final String message; 038 private final String status; 039 private final String resolution; 040 private final String severity; 041 private final Map<String, String> properties; 042 043 /** 044 * Warning : implementation is still mutable. 045 */ 046 public ImmutableReview(DefaultReview review) { 047 this.line = review.getLine(); 048 this.manual = review.isManual(); 049 this.message = review.getMessage(); 050 this.properties = ImmutableMap.copyOf(review.getProperties()); 051 this.resolution = review.getResolution(); 052 this.reviewId = review.getReviewId(); 053 this.ruleKey = review.getRuleKey(); 054 this.ruleRepositoryKey = review.getRuleRepositoryKey(); 055 this.ruleName = review.getRuleName(); 056 this.severity = review.getSeverity(); 057 this.status = review.getStatus(); 058 this.switchedOff = review.isSwitchedOff(); 059 this.violationId = review.getViolationId(); 060 } 061 062 public Long getViolationId() { 063 return violationId; 064 } 065 066 public Long getReviewId() { 067 return reviewId; 068 } 069 070 public String getRuleName() { 071 return ruleName; 072 } 073 074 public String getRuleRepositoryKey() { 075 return ruleRepositoryKey; 076 } 077 078 public String getRuleKey() { 079 return ruleKey; 080 } 081 082 public Long getLine() { 083 return line; 084 } 085 086 public boolean isSwitchedOff() { 087 return switchedOff; 088 } 089 090 public boolean isManual() { 091 return manual; 092 } 093 094 public String getMessage() { 095 return message; 096 } 097 098 public String getStatus() { 099 return status; 100 } 101 102 public String getResolution() { 103 return resolution; 104 } 105 106 public String getSeverity() { 107 return severity; 108 } 109 110 public Map<String, String> getProperties() { 111 return properties; 112 } 113}