1 package org.apache.archiva.metadata.repository.cassandra.model;
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
22 import org.apache.archiva.metadata.model.CiManagement;
23 import org.apache.archiva.metadata.model.Dependency;
24 import org.apache.archiva.metadata.model.IssueManagement;
25 import org.apache.archiva.metadata.model.License;
26 import org.apache.archiva.metadata.model.MailingList;
27 import org.apache.archiva.metadata.model.Organization;
28 import org.apache.archiva.metadata.model.Scm;
29 import org.apache.archiva.metadata.repository.cassandra.CassandraUtils;
31 import javax.persistence.Column;
32 import java.util.ArrayList;
33 import java.util.List;
36 * @author Olivier Lamy
39 public class ProjectVersionMetadataModel
43 @Column(name = "namespaceId") // repositoryName
44 private Namespace namespace;
52 @Column(name = "projectId")
53 private String projectId;
58 @Column(name = "name")
61 @Column(name = "description")
62 private String description;
64 @Column(name = "organization")
65 private Organization organization;
67 @Column(name = "issueManagement")
68 private IssueManagement issueManagement;
73 @Column(name = "ciManagement")
74 private CiManagement ciManagement;
76 // FIXME store those values in a separate table
77 @Column(name = "licenses")
78 private List<License> licenses = new ArrayList<License>();
80 @Column(name = "mailingLists")
81 private List<MailingList> mailingLists = new ArrayList<MailingList>();
83 @Column(name = "dependencies")
84 private List<Dependency> dependencies = new ArrayList<Dependency>();
86 @Column(name = "incomplete")
87 private boolean incomplete;
89 public String getProjectId()
94 public void setProjectId( String projectId )
96 this.projectId = projectId;
99 // FIXME must be renamed getVersion !!!
100 public String getId()
105 public void setId( String id )
110 public String getUrl()
115 public void setUrl( String url )
120 public String getName()
125 public void setName( String name )
130 public String getDescription()
135 public void setDescription( String description )
137 this.description = description;
140 public Organization getOrganization()
145 public void setOrganization( Organization organization )
147 this.organization = organization;
150 public IssueManagement getIssueManagement()
152 return issueManagement;
155 public void setIssueManagement( IssueManagement issueManagement )
157 this.issueManagement = issueManagement;
165 public void setScm( Scm scm )
170 public CiManagement getCiManagement()
175 public void setCiManagement( CiManagement ciManagement )
177 this.ciManagement = ciManagement;
180 public boolean isIncomplete()
185 public void setIncomplete( boolean incomplete )
187 this.incomplete = incomplete;
190 public Namespace getNamespace()
195 public void setNamespace( Namespace namespace )
197 this.namespace = namespace;
200 public List<License> getLicenses()
205 public void setLicenses( List<License> licenses )
207 this.licenses = licenses;
210 public List<MailingList> getMailingLists()
215 public void setMailingLists( List<MailingList> mailingLists )
217 this.mailingLists = mailingLists;
220 public List<Dependency> getDependencies()
225 public void setDependencies( List<Dependency> dependencies )
227 this.dependencies = dependencies;
232 public String toString()
234 final StringBuilder sb = new StringBuilder( "ProjectVersionMetadataModel{" );
235 sb.append( ", namespace=" ).append( namespace );
236 sb.append( ", id='" ).append( id ).append( '\'' );
237 sb.append( ", projectId='" ).append( projectId ).append( '\'' );
238 sb.append( ", url='" ).append( url ).append( '\'' );
239 sb.append( ", name='" ).append( name ).append( '\'' );
240 sb.append( ", description='" ).append( description ).append( '\'' );
241 sb.append( ", organization=" ).append( organization );
242 sb.append( ", issueManagement=" ).append( issueManagement );
243 sb.append( ", scm=" ).append( scm );
244 sb.append( ", ciManagement=" ).append( ciManagement );
245 sb.append( ", incomplete=" ).append( incomplete );
247 return sb.toString();
252 public static class KeyBuilder
255 private String namespace;
257 private String repositoryName;
259 private String projectId;
268 public KeyBuilder withNamespace( Namespace namespace )
270 this.namespace = namespace.getName();
271 this.repositoryName = namespace.getRepository().getName();
275 public KeyBuilder withNamespace( String namespace )
277 this.namespace = namespace;
281 public KeyBuilder withRepository( String repositoryId )
283 this.repositoryName = repositoryId;
287 public KeyBuilder withRepository( Repository repository )
289 this.repositoryName = repository.getName();
293 public KeyBuilder withProjectId( String projectId )
295 this.projectId = projectId;
299 public KeyBuilder withId( String id )
305 public String build()
307 // FIXME add some controls
308 return CassandraUtils.generateKey( this.repositoryName, this.namespace, this.projectId, this.id );