This project has retired. For details please refer to its Attic page.
RepositoryProblemFacet xref
View Javadoc
1   package org.apache.archiva.metadata.model.facets;
2   
3   /*
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
11   *
12   *   http://www.apache.org/licenses/LICENSE-2.0
13   *
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
19   * under the License.
20   */
21  
22  import org.apache.archiva.metadata.model.MetadataFacet;
23  
24  import java.util.HashMap;
25  import java.util.Map;
26  
27  public class RepositoryProblemFacet
28      implements MetadataFacet
29  {
30      public static final String FACET_ID = "org.apache.archiva.reports";
31  
32      private String repositoryId;
33  
34      private String namespace;
35  
36      private String project;
37  
38      private String version;
39  
40      private String id;
41  
42      private String message;
43  
44      private String problem;
45  
46      @Override
47      public String getFacetId()
48      {
49          return FACET_ID;
50      }
51  
52      @Override
53      public String getName()
54      {
55          return createName( namespace, project, version, id );
56      }
57  
58      @Override
59      public Map<String, String> toProperties()
60      {
61          Map<String, String> map = new HashMap<>();
62          map.put( "repositoryId", repositoryId );
63          map.put( "namespace", namespace );
64          map.put( "project", project );
65          map.put( "version", version );
66          if ( id != null )
67          {
68              map.put( "id", id );
69          }
70          map.put( "message", message );
71          map.put( "problem", problem );
72          return map;
73      }
74  
75      @Override
76      public void fromProperties( Map<String, String> properties )
77      {
78          repositoryId = properties.get( "repositoryId" );
79          namespace = properties.get( "namespace" );
80          project = properties.get( "project" );
81          version = properties.get( "version" );
82          id = properties.get( "id" );
83          message = properties.get( "message" );
84          problem = properties.get( "problem" );
85      }
86  
87      public void setRepositoryId( String repositoryId )
88      {
89          this.repositoryId = repositoryId;
90      }
91  
92      public void setNamespace( String namespace )
93      {
94          this.namespace = namespace;
95      }
96  
97      public String getRepositoryId()
98      {
99          return repositoryId;
100     }
101 
102     public String getNamespace()
103     {
104         return namespace;
105     }
106 
107     public void setProject( String project )
108     {
109         this.project = project;
110     }
111 
112     public String getProject()
113     {
114         return project;
115     }
116 
117     public void setVersion( String version )
118     {
119         this.version = version;
120     }
121 
122     public String getVersion()
123     {
124         return version;
125     }
126 
127     public void setId( String id )
128     {
129         this.id = id;
130     }
131 
132     public String getId()
133     {
134         return id;
135     }
136 
137     public void setMessage( String message )
138     {
139         this.message = message;
140     }
141 
142     public String getMessage()
143     {
144         return message;
145     }
146 
147     public void setProblem( String problem )
148     {
149         this.problem = problem;
150     }
151 
152     public String getProblem()
153     {
154         return problem;
155     }
156 
157     public static String createName( String namespace, String project, String projectVersion, String id )
158     {
159         String name = namespace + "/" + project + "/" + projectVersion;
160         if ( id != null )
161         {
162             name = name + "/" + id;
163         }
164         return name;
165     }
166 }