1 package org.apache.maven.lifecycle.mapping;
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 java.util.Collections;
23 import java.util.LinkedHashMap;
24 import java.util.Map;
25
26 /**
27 * Lifecycle definition for a packaging (multiple packagings share the same lifecycle id = usually "default").
28 */
29 public class Lifecycle
30 {
31 /**
32 * Field id
33 */
34 private String id;
35
36 /**
37 * Field phases
38 */
39 private Map<String, LifecyclePhase> lifecyclePhases;
40
41 /**
42 * Method getId
43 */
44 public String getId()
45 {
46 return this.id;
47 }
48
49 /**
50 * Method getLifecyclePhases
51 */
52 public Map<String, LifecyclePhase> getLifecyclePhases()
53 {
54 return this.lifecyclePhases;
55 }
56
57 /**
58 * Method setId
59 *
60 * @param id
61 */
62 public void setId( String id )
63 {
64 this.id = id;
65 }
66
67 /**
68 * Method setLifecyclePhases
69 *
70 * @param lifecyclePhases
71 */
72 public void setLifecyclePhases( Map<String, LifecyclePhase> lifecyclePhases )
73 {
74 this.lifecyclePhases = lifecyclePhases;
75 }
76
77 @Deprecated
78 public Map<String, String> getPhases()
79 {
80 Map<String, LifecyclePhase> lphases = getLifecyclePhases();
81 if ( lphases == null )
82 {
83 return null;
84 }
85
86 if ( lphases.isEmpty() )
87 {
88 return Collections.emptyMap();
89 }
90
91 Map<String, String> phases = new LinkedHashMap<>();
92 for ( Map.Entry<String, LifecyclePhase> e: lphases.entrySet() )
93 {
94 phases.put( e.getKey(), e.getValue().toString() );
95 }
96 return phases;
97 }
98
99 @Deprecated
100 public void setPhases( Map<String, String> phases )
101 {
102 Map<String, LifecyclePhase> lphases = new LinkedHashMap<>();
103 for ( Map.Entry<String, String> e: phases.entrySet() )
104 {
105 lphases.put( e.getKey(), new LifecyclePhase( e.getValue() ) );
106 }
107 setLifecyclePhases( lphases );
108 }
109 }