001 package org.apache.archiva.reports; 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 022 import java.util.HashMap; 023 import java.util.Map; 024 025 import org.apache.archiva.metadata.model.MetadataFacet; 026 027 public 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 public String getFacetId() 047 { 048 return FACET_ID; 049 } 050 051 public String getName() 052 { 053 return createName( namespace, project, version, id ); 054 } 055 056 public Map<String, String> toProperties() 057 { 058 Map<String, String> map = new HashMap<String, String>(); 059 map.put( "repositoryId", repositoryId ); 060 map.put( "namespace", namespace ); 061 map.put( "project", project ); 062 map.put( "version", version ); 063 if ( id != null ) 064 { 065 map.put( "id", id ); 066 } 067 map.put( "message", message ); 068 map.put( "problem", problem ); 069 return map; 070 } 071 072 public void fromProperties( Map<String, String> properties ) 073 { 074 repositoryId = properties.get( "repositoryId" ); 075 namespace = properties.get( "namespace" ); 076 project = properties.get( "project" ); 077 version = properties.get( "version" ); 078 id = properties.get( "id" ); 079 message = properties.get( "message" ); 080 problem = properties.get( "problem" ); 081 } 082 083 public void setRepositoryId( String repositoryId ) 084 { 085 this.repositoryId = repositoryId; 086 } 087 088 public void setNamespace( String namespace ) 089 { 090 this.namespace = namespace; 091 } 092 093 public String getRepositoryId() 094 { 095 return repositoryId; 096 } 097 098 public String getNamespace() 099 { 100 return namespace; 101 } 102 103 public void setProject( String project ) 104 { 105 this.project = project; 106 } 107 108 public String getProject() 109 { 110 return project; 111 } 112 113 public void setVersion( String version ) 114 { 115 this.version = version; 116 } 117 118 public String getVersion() 119 { 120 return version; 121 } 122 123 public void setId( String id ) 124 { 125 this.id = id; 126 } 127 128 public String getId() 129 { 130 return id; 131 } 132 133 public void setMessage( String message ) 134 { 135 this.message = message; 136 } 137 138 public String getMessage() 139 { 140 return message; 141 } 142 143 public void setProblem( String problem ) 144 { 145 this.problem = problem; 146 } 147 148 public String getProblem() 149 { 150 return problem; 151 } 152 153 public static String createName( String namespace, String project, String projectVersion, String id ) 154 { 155 String name = namespace + "/" + project + "/" + projectVersion; 156 if ( id != null ) 157 { 158 name = name + "/" + id; 159 } 160 return name; 161 } 162 }