This project has retired. For details please refer to its Attic page.
Source code
001package org.apache.archiva.metadata.model.facets;
002
003/*
004 * Licensed to the Apache Software Foundation (ASF) under one
005 * or more contributor license agreements.  See the NOTICE file
006 * distributed with this work for additional information
007 * regarding copyright ownership.  The ASF licenses this file
008 * to you under the Apache License, Version 2.0 (the
009 * "License"); you may not use this file except in compliance
010 * with the License.  You may obtain a copy of the License at
011 *
012 *   http://www.apache.org/licenses/LICENSE-2.0
013 *
014 * Unless required by applicable law or agreed to in writing,
015 * software distributed under the License is distributed on an
016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017 * KIND, either express or implied.  See the License for the
018 * specific language governing permissions and limitations
019 * under the License.
020 */
021
022import org.apache.archiva.metadata.model.MetadataFacet;
023
024import java.util.HashMap;
025import java.util.Map;
026
027public class RepositoryProblemFacet
028    implements MetadataFacet
029{
030    public static final String FACET_ID = "org.apache.archiva.reports";
031
032    private String repositoryId;
033
034    private String namespace;
035
036    private String project;
037
038    private String version;
039
040    private String id;
041
042    private String message;
043
044    private String problem;
045
046    @Override
047    public String getFacetId()
048    {
049        return FACET_ID;
050    }
051
052    @Override
053    public String getName()
054    {
055        return createName( namespace, project, version, id );
056    }
057
058    @Override
059    public Map<String, String> toProperties()
060    {
061        Map<String, String> map = new HashMap<>();
062        map.put( "repositoryId", repositoryId );
063        map.put( "namespace", namespace );
064        map.put( "project", project );
065        map.put( "version", version );
066        if ( id != null )
067        {
068            map.put( "id", id );
069        }
070        map.put( "message", message );
071        map.put( "problem", problem );
072        return map;
073    }
074
075    @Override
076    public void fromProperties( Map<String, String> properties )
077    {
078        repositoryId = properties.get( "repositoryId" );
079        namespace = properties.get( "namespace" );
080        project = properties.get( "project" );
081        version = properties.get( "version" );
082        id = properties.get( "id" );
083        message = properties.get( "message" );
084        problem = properties.get( "problem" );
085    }
086
087    public void setRepositoryId( String repositoryId )
088    {
089        this.repositoryId = repositoryId;
090    }
091
092    public void setNamespace( String namespace )
093    {
094        this.namespace = namespace;
095    }
096
097    public String getRepositoryId()
098    {
099        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}