aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-core/src
diff options
context:
space:
mode:
authorStephane Gamard <stephane.gamard@searchbox.com>2014-06-19 15:47:58 +0200
committerStephane Gamard <stephane.gamard@searchbox.com>2014-06-19 16:17:51 +0200
commit49228cea2f058e9a56fc87c49d65ffcc292c54fa (patch)
treee7fb094c859a0d2d5a144f6246e71bd7efd8c973 /sonar-core/src
parent3c54cb73700b05eaf4b6a0083da4570b90f1050d (diff)
downloadsonarqube-49228cea2f058e9a56fc87c49d65ffcc292c54fa.tar.gz
sonarqube-49228cea2f058e9a56fc87c49d65ffcc292c54fa.zip
SONAR-5329 - Consolidated with UUID id
Diffstat (limited to 'sonar-core/src')
-rw-r--r--sonar-core/src/main/java/org/sonar/core/activity/db/ActivityDto.java10
-rw-r--r--sonar-core/src/main/java/org/sonar/core/activity/db/ActivityKey.java96
-rw-r--r--sonar-core/src/main/java/org/sonar/core/activity/db/ActivityMapper.java4
3 files changed, 7 insertions, 103 deletions
diff --git a/sonar-core/src/main/java/org/sonar/core/activity/db/ActivityDto.java b/sonar-core/src/main/java/org/sonar/core/activity/db/ActivityDto.java
index 11da7e4af19..eac3e65d45d 100644
--- a/sonar-core/src/main/java/org/sonar/core/activity/db/ActivityDto.java
+++ b/sonar-core/src/main/java/org/sonar/core/activity/db/ActivityDto.java
@@ -26,11 +26,14 @@ import org.sonar.core.activity.Activity;
import org.sonar.core.activity.ActivityLog;
import org.sonar.core.persistence.Dto;
+import java.util.UUID;
+
/**
* @since 4.4
*/
-public final class ActivityDto extends Dto<ActivityKey> {
+public final class ActivityDto extends Dto<String> {
+ private String key;
private String message;
private Activity.Type type;
private String action;
@@ -39,11 +42,12 @@ public final class ActivityDto extends Dto<ActivityKey> {
private String data;
protected ActivityDto() {
+ this.key = UUID.randomUUID().toString();
}
@Override
- public ActivityKey getKey() {
- return ActivityKey.of(this.getCreatedAt(), type, author);
+ public String getKey() {
+ return key;
}
@Override
diff --git a/sonar-core/src/main/java/org/sonar/core/activity/db/ActivityKey.java b/sonar-core/src/main/java/org/sonar/core/activity/db/ActivityKey.java
deleted file mode 100644
index 7031b1fc88f..00000000000
--- a/sonar-core/src/main/java/org/sonar/core/activity/db/ActivityKey.java
+++ /dev/null
@@ -1,96 +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.core.activity.db;
-
-import com.google.common.base.Preconditions;
-import org.sonar.core.activity.Activity;
-
-import java.io.Serializable;
-import java.util.Date;
-
-/**
- * @since 4.4
- */
-public class ActivityKey implements Serializable {
-
- private Date createdAt;
- private Activity.Type type;
- private String author;
-
- public ActivityKey(Date createdAt, Activity.Type type, String author) {
- this.createdAt = createdAt;
- this.type = type;
- this.author = author;
- }
-
- /**
- * Create a key. Parameters are NOT null.
- */
- public static ActivityKey of(Date createdAt, Activity.Type type, String author) {
- Preconditions.checkArgument(createdAt != null, "Time must be set");
- Preconditions.checkArgument(type != null, "Type must be set");
- Preconditions.checkArgument(author != null, "Author must be set");
- return new ActivityKey(createdAt, type, author);
- }
-
- /**
- * Create a key from a string representation (see {@link #toString()}. An {@link IllegalArgumentException} is raised
- * if the format is not valid.
- */
- public static ActivityKey parse(String s) {
- String[] split = s.split(":");
- Preconditions.checkArgument(split.length == 3, "Invalid log key: " + s);
- return ActivityKey.of(new Date(Long.getLong(split[0])),
- Activity.Type.valueOf(split[1]), split[2]);
- }
-
- public Date getCreatedAt() {
- return createdAt;
- }
-
- public void setCreatedAt(Date createdAt) {
- this.createdAt = createdAt;
- }
-
- public String getAuthor() {
- return author;
- }
-
- public ActivityKey setAuthor(String author) {
- this.author = author;
- return this;
- }
-
- public Activity.Type getType() {
- return type;
- }
-
- public ActivityKey setType(Activity.Type type) {
- this.type = type;
- return this;
- }
-
- @Override
- public String toString() {
- return this.createdAt.getTime() +
- ":" + this.type +
- ":" + this.getAuthor();
- }
-}
diff --git a/sonar-core/src/main/java/org/sonar/core/activity/db/ActivityMapper.java b/sonar-core/src/main/java/org/sonar/core/activity/db/ActivityMapper.java
index dd47fc8129b..0d507e08a83 100644
--- a/sonar-core/src/main/java/org/sonar/core/activity/db/ActivityMapper.java
+++ b/sonar-core/src/main/java/org/sonar/core/activity/db/ActivityMapper.java
@@ -19,8 +19,6 @@
*/
package org.sonar.core.activity.db;
-import org.apache.ibatis.annotations.Param;
-
import java.util.List;
/**
@@ -30,7 +28,5 @@ public interface ActivityMapper {
void insert(ActivityDto rule);
- ActivityDto selectByKey(@Param("key") ActivityKey key);
-
List<ActivityDto> selectAll();
}