This project has retired. For details please refer to its
Attic page.
MetadataFacetModel xref
1 package org.apache.archiva.metadata.repository.cassandra.model;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import static org.apache.archiva.metadata.repository.cassandra.model.ColumnNames.*;
23
24 import org.apache.archiva.metadata.repository.cassandra.CassandraUtils;
25
26
27
28
29
30
31
32 public class MetadataFacetModel
33 {
34 public static final String[] COLUMNS = new String[] { FACET_ID.toString(), KEY.toString(), VALUE.toString(),
35 REPOSITORY_NAME.toString(), NAMESPACE_ID.toString(), PROJECT_ID.toString(), PROJECT_VERSION.toString() };
36
37 private String facetId;
38
39 private String key;
40
41 private String name;
42
43 private String value;
44
45 private String projectVersion;
46
47 public MetadataFacetModel()
48 {
49
50 }
51
52 public MetadataFacetModel( String facetId, String key, String value, String name, String projectVersion )
53 {
54 this.key = key;
55 this.value = value;
56 this.name = name;
57 this.facetId = facetId;
58 this.projectVersion = projectVersion;
59 }
60
61 public String getFacetId()
62 {
63 return facetId;
64 }
65
66 public void setFacetId( String facetId )
67 {
68 this.facetId = facetId;
69 }
70
71
72 public String getName()
73 {
74 return name;
75 }
76
77 public void setName( String name )
78 {
79 this.name = name;
80 }
81
82 public String getKey()
83 {
84 return key;
85 }
86
87 public void setKey( String key )
88 {
89 this.key = key;
90 }
91
92 public String getValue()
93 {
94 return value;
95 }
96
97 public void setValue( String value )
98 {
99 this.value = value;
100 }
101
102 public String getProjectVersion()
103 {
104 return projectVersion;
105 }
106
107 public void setProjectVersion( String projectVersion )
108 {
109 this.projectVersion = projectVersion;
110 }
111
112 @Override
113 public String toString()
114 {
115 final StringBuilder sb = new StringBuilder( "MetadataFacetModel{" );
116 sb.append( ", key='" ).append( key ).append( '\'' );
117 sb.append( ", value='" ).append( value ).append( '\'' );
118 sb.append( '}' );
119 return sb.toString();
120 }
121
122 public static class KeyBuilder
123 {
124
125 private ArtifactMetadataModel artifactMetadataModel;
126
127 private String key;
128
129 private String name;
130
131 private String facetId;
132
133 private String repositoryId;
134
135 public KeyBuilder()
136 {
137
138 }
139
140 public KeyBuilder withArtifactMetadataModel( ArtifactMetadataModel artifactMetadataModel )
141 {
142 this.artifactMetadataModel = artifactMetadataModel;
143 return this;
144 }
145
146 public KeyBuilder withKey( String key )
147 {
148 this.key = key;
149 return this;
150 }
151
152 public KeyBuilder withName( String name )
153 {
154 this.name = name;
155 return this;
156 }
157
158 public KeyBuilder withFacetId( String facetId )
159 {
160 this.facetId = facetId;
161 return this;
162 }
163
164 public KeyBuilder withRepositoryId( String repositoryId )
165 {
166 this.repositoryId = repositoryId;
167 return this;
168 }
169
170 public String build()
171 {
172
173
174
175 String str = CassandraUtils.generateKey( this.artifactMetadataModel == null
176 ? this.repositoryId
177 : new ArtifactMetadataModel.KeyBuilder().withNamespace(
178 this.artifactMetadataModel.getNamespace() )
179 .withProject( this.artifactMetadataModel.getProject() )
180 .withProjectVersion(
181 this.artifactMetadataModel.getProjectVersion() )
182 .withRepositoryId(
183 this.artifactMetadataModel.getRepositoryId() )
184 .withId( this.artifactMetadataModel.getId() )
185 .build(),
186 this.facetId,
187 this.name,
188 this.key
189 );
190
191 return str;
192 }
193 }
194 }