-
Notifications
You must be signed in to change notification settings - Fork 1.7k
[Ambari-22776] Ambari Blueprint 3.0/3.1 database tables and JPA objects + DDL cleanup #109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
benyoka
merged 9 commits into
apache:branch-feature-AMBARI-14714
from
benyoka:AMBARI-22776-branch-feature-AMBARI-14714
Jan 24, 2018
Merged
Changes from 8 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
67e8ab0
AMBARI-22776 Blueprint 3.0 Database schemas and JPA objects, DDL fixe…
967e67a
AMBARI-22776 Revert accidental commit (benyoka)
527526e
AMBARI-22776 Revert accidental change #2 (benyoka)
6858e67
AMBARI-22776 Fix review findings (benyoka)
bd4c820
AMBARI-22776 Fix review findings #2 (benyoka)
24866fc
AMBARI-22776 remove blueprint -> stack reference, docs (benyoka)
448b750
AMBARI-22776 fix build issues (benyoka)
043dbc4
AMBARI-22776 Add MpackInstanceEntity -> MpackEntity reference (benyoka)
3b16908
Merge remote-tracking branch 'upstream/branch-feature-AMBARI-14714' i…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
149 changes: 149 additions & 0 deletions
149
...erver/src/main/java/org/apache/ambari/server/orm/entities/BlueprintMpackConfigEntity.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,149 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package org.apache.ambari.server.orm.entities; | ||
|
|
||
| import javax.persistence.Basic; | ||
| import javax.persistence.Column; | ||
| import javax.persistence.Entity; | ||
| import javax.persistence.FetchType; | ||
| import javax.persistence.Id; | ||
| import javax.persistence.IdClass; | ||
| import javax.persistence.JoinColumn; | ||
| import javax.persistence.Lob; | ||
| import javax.persistence.ManyToOne; | ||
| import javax.persistence.Table; | ||
|
|
||
| /** | ||
| * Entity to represent an mpack level configuration in the blueprint. | ||
| */ | ||
| @Entity | ||
| @Table(name = "blueprint_mpack_configuration") | ||
| @IdClass(BlueprintMpackConfigEntityPk.class) | ||
| public class BlueprintMpackConfigEntity implements BlueprintConfiguration { | ||
|
|
||
| @Id | ||
| @Column(name = "mpack_ref_id", nullable = false, insertable = false, updatable = false) | ||
| private Long mpackRefId; | ||
|
|
||
| @Id | ||
| @Column(name = "type_name", nullable = false, insertable = true, updatable = false, length = 100) | ||
| private String type; | ||
|
|
||
| @Column(name = "config_data") | ||
| @Basic(fetch = FetchType.LAZY) | ||
| @Lob | ||
| private String configData; | ||
|
|
||
| @Column(name = "config_attributes") | ||
| @Basic(fetch = FetchType.LAZY) | ||
| @Lob | ||
| private String configAttributes; | ||
|
|
||
| @ManyToOne | ||
| @JoinColumn(name = "mpack_ref_id", referencedColumnName = "id", nullable = false) | ||
| private BlueprintMpackInstanceEntity mpackReference; | ||
|
|
||
| /** | ||
| * @return the id of the mpack referency entity this configuration belongs to | ||
| */ | ||
| public Long getMpackRefId() { | ||
| return mpackRefId; | ||
| } | ||
|
|
||
| /** | ||
| * @param mpackRefId the id of the mpack referency entity this configuration belongs to | ||
| */ | ||
| public void setMpackRefId(Long mpackRefId) { | ||
| this.mpackRefId = mpackRefId; | ||
| } | ||
|
|
||
| /** | ||
| * @return the configuration type | ||
| */ | ||
| @Override | ||
| public String getType() { | ||
| return type; | ||
| } | ||
|
|
||
| /** | ||
| * @param typeName the type of the configuration | ||
| */ | ||
| @Override | ||
| public void setType(String typeName) { | ||
| this.type = typeName; | ||
| } | ||
|
|
||
| /** | ||
| * @return the configuration data encoded in json | ||
| */ | ||
| public String getConfigData() { | ||
| return configData; | ||
| } | ||
|
|
||
| /** | ||
| * @param blueprintName the name of the blueprint | ||
| */ | ||
| @Override | ||
| public void setBlueprintName(String blueprintName) { | ||
| throw new UnsupportedOperationException(); | ||
| } | ||
|
|
||
| /** | ||
| * @return the name of the blueprint | ||
| */ | ||
| @Override | ||
| public String getBlueprintName() { | ||
| return getMpackReference().getBlueprint().getBlueprintName(); | ||
| } | ||
|
|
||
| /** | ||
| * @param configData the configuration data encoded in json | ||
| */ | ||
| public void setConfigData(String configData) { | ||
| this.configData = configData; | ||
| } | ||
|
|
||
| /** | ||
| * @return the configuration attributes encoded in json | ||
| */ | ||
| public String getConfigAttributes() { | ||
| return configAttributes; | ||
| } | ||
|
|
||
| /** | ||
| * @param configAttributes the configuration attributes encoded in json | ||
| */ | ||
| public void setConfigAttributes(String configAttributes) { | ||
| this.configAttributes = configAttributes; | ||
| } | ||
|
|
||
| /** | ||
| * @return the mpack referency entity this configuration belongs to | ||
| */ | ||
| public BlueprintMpackInstanceEntity getMpackReference() { | ||
| return mpackReference; | ||
| } | ||
|
|
||
| /** | ||
| * @param mpackReference the mpack referency entity this configuration belongs to | ||
| */ | ||
| public void setMpackReference(BlueprintMpackInstanceEntity mpackReference) { | ||
| this.mpackReference = mpackReference; | ||
| } | ||
| } | ||
51 changes: 51 additions & 0 deletions
51
...ver/src/main/java/org/apache/ambari/server/orm/entities/BlueprintMpackConfigEntityPk.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package org.apache.ambari.server.orm.entities; | ||
|
|
||
| import java.util.Objects; | ||
|
|
||
| import javax.persistence.Column; | ||
| import javax.persistence.Id; | ||
|
|
||
| /** | ||
| * Composite primary key for {@link BlueprintMpackConfigEntity} | ||
| */ | ||
| public class BlueprintMpackConfigEntityPk { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This class needs documentation. |
||
| @Id | ||
| @Column(name = "mpack_ref_id", nullable = false, insertable = true, updatable = false) | ||
| private Long mpackRefId; | ||
|
|
||
| @Id | ||
| @Column(name = "type_name", nullable = false, insertable = true, updatable = false, length = 100) | ||
| private String type; | ||
|
|
||
| @Override | ||
| public boolean equals(Object o) { | ||
| if (this == o) return true; | ||
| if (o == null || getClass() != o.getClass()) return false; | ||
| BlueprintMpackConfigEntityPk that = (BlueprintMpackConfigEntityPk) o; | ||
| return Objects.equals(mpackRefId, that.mpackRefId) && | ||
| Objects.equals(type, that.type); | ||
| } | ||
|
|
||
| @Override | ||
| public int hashCode() { | ||
| return Objects.hash(mpackRefId, type); | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This class needs documentation.