You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by dm...@apache.org on 2016/06/22 18:26:18 UTC
[2/2] ambari git commit: AMBARI-17370. After registering 2.5 HDP repo,
it is hidden on UI (dlysnichenko)
AMBARI-17370. After registering 2.5 HDP repo, it is hidden on UI (dlysnichenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/afb6870d
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/afb6870d
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/afb6870d
Branch: refs/heads/trunk
Commit: afb6870da15b94de133fb6ff1e445d8abc8f98e2
Parents: cb5b1ea
Author: Lisnichenko Dmitro <dl...@hortonworks.com>
Authored: Wed Jun 22 21:25:27 2016 +0300
Committer: Lisnichenko Dmitro <dl...@hortonworks.com>
Committed: Wed Jun 22 21:26:08 2016 +0300
----------------------------------------------------------------------
.../server/orm/entities/RepositoryVersionEntity.java | 11 +++++++++++
1 file changed, 11 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/afb6870d/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/RepositoryVersionEntity.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/RepositoryVersionEntity.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/RepositoryVersionEntity.java
index 5e5a0a8..25aa62b 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/RepositoryVersionEntity.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/RepositoryVersionEntity.java
@@ -42,6 +42,8 @@ import javax.persistence.Table;
import javax.persistence.TableGenerator;
import javax.persistence.Transient;
import javax.persistence.UniqueConstraint;
+import javax.persistence.PreUpdate;
+import javax.persistence.PrePersist;
import org.apache.ambari.server.StaticallyInject;
import org.apache.ambari.server.state.RepositoryType;
@@ -153,6 +155,15 @@ public class RepositoryVersionEntity {
this.operatingSystems = operatingSystems;
}
+ @PreUpdate
+ @PrePersist
+ public void removePrefixFromVersion() {
+ for (String stackPrefix : STACK_PREFIXES) {
+ if (version.startsWith(stackPrefix + "-")) {
+ version = version.substring(stackPrefix.length() + 1);
+ }
+ }
+ }
/**
* Update one-to-many relation without rebuilding the whole entity
* @param entity many-to-one entity