This project has retired. For details please refer to its
Attic page.
MavenArtifactFacet xref
1 package org.apache.archiva.metadata.model.maven2;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import org.apache.archiva.metadata.model.MetadataFacet;
23 import org.apache.commons.lang.StringUtils;
24
25 import java.util.HashMap;
26 import java.util.Map;
27
28 public class MavenArtifactFacet
29 implements MetadataFacet
30 {
31 private String classifier;
32
33 private String type;
34
35 private String timestamp;
36
37 private int buildNumber;
38
39 public static final String FACET_ID = "org.apache.archiva.metadata.repository.storage.maven2.artifact";
40
41 public String getClassifier()
42 {
43 return classifier;
44 }
45
46 public void setClassifier( String classifier )
47 {
48 this.classifier = classifier;
49 }
50
51 public String getType()
52 {
53 return type;
54 }
55
56 public void setType( String type )
57 {
58 this.type = type;
59 }
60
61 public String getTimestamp()
62 {
63 return timestamp;
64 }
65
66 public void setTimestamp( String timestamp )
67 {
68 this.timestamp = timestamp;
69 }
70
71 public int getBuildNumber()
72 {
73 return buildNumber;
74 }
75
76 public void setBuildNumber( int buildNumber )
77 {
78 this.buildNumber = buildNumber;
79 }
80
81 @Override
82 public String getFacetId()
83 {
84 return FACET_ID;
85 }
86
87 @Override
88 public String getName()
89 {
90
91 return null;
92 }
93
94 @Override
95 public Map<String, String> toProperties()
96 {
97 Map<String, String> properties = new HashMap<>();
98 properties.put( "type", type );
99 if ( classifier != null )
100 {
101 properties.put( "classifier", classifier );
102 }
103 if ( timestamp != null )
104 {
105 properties.put( "timestamp", timestamp );
106 }
107 if ( buildNumber > 0 )
108 {
109 properties.put( "buildNumber", Integer.toString( buildNumber ) );
110 }
111 return properties;
112 }
113
114 @Override
115 public void fromProperties( Map<String, String> properties )
116 {
117 type = properties.get( "type" );
118 classifier = properties.get( "classifier" );
119 timestamp = properties.get( "timestamp" );
120 String buildNumber = properties.get( "buildNumber" );
121 if ( buildNumber != null )
122 {
123 this.buildNumber = Integer.parseInt( buildNumber );
124 }
125 }
126
127 @Override
128 public boolean equals( Object o )
129 {
130 if ( this == o )
131 {
132 return true;
133 }
134 if ( !( o instanceof MavenArtifactFacet ) )
135 {
136 return false;
137 }
138
139 MavenArtifactFacet that = (MavenArtifactFacet) o;
140
141 return StringUtils.equals( that.getClassifier(), this.classifier );
142 }
143
144 }