]> source.dussan.org Git - sonarqube.git/commitdiff
Remove Hibernate model Property
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Wed, 20 May 2015 21:39:43 +0000 (23:39 +0200)
committerSimon Brandhof <simon.brandhof@sonarsource.com>
Wed, 20 May 2015 21:39:43 +0000 (23:39 +0200)
sonar-core/src/main/java/org/sonar/api/database/configuration/Property.java [deleted file]
sonar-core/src/main/java/org/sonar/api/package-info.java [deleted file]
sonar-core/src/main/resources/META-INF/persistence.xml
sonar-core/src/test/java/org/sonar/jpa/entity/PropertyTest.java [deleted file]

diff --git a/sonar-core/src/main/java/org/sonar/api/database/configuration/Property.java b/sonar-core/src/main/java/org/sonar/api/database/configuration/Property.java
deleted file mode 100644 (file)
index 568e97b..0000000
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-package org.sonar.api.database.configuration;
-
-import org.apache.commons.lang.builder.ReflectionToStringBuilder;
-import org.apache.commons.lang.builder.ToStringStyle;
-import org.sonar.api.database.BaseIdentifiable;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Lob;
-import javax.persistence.Table;
-
-/**
- * IMPORTANT : This class can't be moved to org.sonar.jpa.dao for backward-compatibility reasons.
- * This class is still used in some plugins.
- *
- * @since 1.10
- * @deprecated since 5.0 Hibernate is deprecated
- */
-@Deprecated
-@Entity
-@Table(name = "properties")
-public class Property extends BaseIdentifiable {
-
-  @Column(name = "prop_key", updatable = true, nullable = true)
-  private String key;
-
-  @Column(name = "text_value", updatable = true, nullable = true, length = 167772150)
-  @Lob
-  private char[] value;
-
-  @Column(name = "resource_id", updatable = true, nullable = true)
-  private Integer resourceId;
-
-  @Column(name = "user_id", updatable = true, nullable = true)
-  private Integer userId;
-
-  public Property(String key, String value) {
-    this(key, value, null);
-  }
-
-  public Property(String key, String value, Integer resourceId) {
-    this.key = key;
-    if (value != null) {
-      this.value = value.toCharArray();
-
-    } else {
-      this.value = null;
-    }
-    this.resourceId = resourceId;
-  }
-
-  public Property() {
-  }
-
-  public String getKey() {
-    return key;
-  }
-
-  public void setKey(String key) {
-    this.key = key;
-  }
-
-  public String getValue() {
-    if (value != null) {
-      return new String(value);
-    }
-    return null;
-  }
-
-  public void setValue(String value) {
-    if (value != null) {
-      this.value = value.toCharArray();
-    } else {
-      this.value = null;
-    }
-  }
-
-  public Integer getResourceId() {
-    return resourceId;
-  }
-
-  public void setResourceId(Integer resourceId) {
-    this.resourceId = resourceId;
-  }
-
-  public Integer getUserId() {
-    return userId;
-  }
-
-  public Property setUserId(Integer userId) {
-    this.userId = userId;
-    return this;
-  }
-
-  @Override
-  public boolean equals(Object o) {
-    if (this == o) {
-      return true;
-    }
-    if (o == null || getClass() != o.getClass()) {
-      return false;
-    }
-
-    Property property = (Property) o;
-    if (!key.equals(property.key)) {
-      return false;
-    }
-    if (resourceId != null ? !resourceId.equals(property.resourceId) : property.resourceId != null) {
-      return false;
-    }
-    return !(userId != null ? !userId.equals(property.userId) : property.userId != null);
-
-  }
-
-  @Override
-  public int hashCode() {
-    int result = key.hashCode();
-    result = 31 * result + (resourceId != null ? resourceId.hashCode() : 0);
-    result = 31 * result + (userId != null ? userId.hashCode() : 0);
-    return result;
-  }
-
-  @Override
-  public String toString() {
-    return new ReflectionToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).toString();
-  }
-}
diff --git a/sonar-core/src/main/java/org/sonar/api/package-info.java b/sonar-core/src/main/java/org/sonar/api/package-info.java
deleted file mode 100644 (file)
index 8e7e23a..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-
-@ParametersAreNonnullByDefault
-package org.sonar.api;
-
-import javax.annotation.ParametersAreNonnullByDefault;
index 7ec76949f11fd8fc34b02db840fd2a29dda30067..06f3a3131f5d7c48494a9f44b45b5eff15be7c78 100644 (file)
@@ -7,7 +7,6 @@
     <provider>org.hibernate.ejb.HibernatePersistence</provider>
 
     <class>org.sonar.jpa.entity.ManualMeasure</class>
-    <class>org.sonar.api.database.configuration.Property</class>
     <class>org.sonar.api.database.model.User</class>
     <class>org.sonar.api.database.model.Snapshot</class>
     <class>org.sonar.api.database.model.MeasureModel</class>
diff --git a/sonar-core/src/test/java/org/sonar/jpa/entity/PropertyTest.java b/sonar-core/src/test/java/org/sonar/jpa/entity/PropertyTest.java
deleted file mode 100644 (file)
index 3f4635c..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-package org.sonar.jpa.entity;
-
-import org.junit.Test;
-import org.sonar.api.database.configuration.Property;
-
-import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.nullValue;
-import static org.junit.Assert.assertThat;
-
-public class PropertyTest {
-
-  @Test
-  public void encodeBlob() {
-    Property prop = new Property("key1", "value1");
-    assertThat(prop.getValue(), is("value1"));
-
-    prop.setValue(null);
-    assertThat(prop.getValue(), nullValue());
-  }
-}