1 /*
2 * Copyright 2013 smartics, Kronseder & Reiner GmbH
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package de.smartics.properties.config.transfer.filesystem;
17
18 import de.smartics.exceptions.code.NumberCodeInfo;
19 import de.smartics.exceptions.i18n.message.MessageParamsDescriptor;
20 import de.smartics.properties.api.config.codes.ConfigurationsCode;
21
22 /**
23 * Codes dealing with property problems.
24 */
25 public enum TransferFileCode implements ConfigurationsCode
26 {
27 // ***************************** Enumeration ******************************
28
29 /**
30 * The target folder cannot be cleaned.
31 */
32 @MessageParamsDescriptor(TransferMessageBean.class)
33 FAILED_TO_CLEAN(0),
34
35 /**
36 * Failed to transfer properties files to the target folder.
37 */
38 @MessageParamsDescriptor(TransferMessageBean.class)
39 FAILED_TO_TRANSFER(1);
40
41 // ******************************** Fields ********************************
42
43 // --- constants ----------------------------------------------------------
44
45 // --- members ------------------------------------------------------------
46
47 /**
48 * The code information.
49 */
50 private final NumberCodeInfo info;
51
52 // ***************************** Constructors *****************************
53
54 /**
55 * Default constructor.
56 *
57 * @param minorNumber the minor part of the error code.
58 */
59 private TransferFileCode(final Integer minorNumber)
60 {
61 final int start = 6000;
62 this.info = new NumberCodeInfo("TransferFile", start, minorNumber);
63 }
64
65 // ******************************** Methods *******************************
66
67 // --- init ---------------------------------------------------------------
68
69 // --- get&set ------------------------------------------------------------
70
71 @Override
72 public String getCode()
73 {
74 return info.getCode();
75 }
76
77 @Override
78 public String getComponentId()
79 {
80 return info.getComponentId();
81 }
82
83 @Override
84 public String getDisplayId()
85 {
86 return info.toString();
87 }
88
89 @Override
90 public Integer getMajorNumber()
91 {
92 return info.getMajorNumber();
93 }
94
95 @Override
96 public Integer getMinorNumber()
97 {
98 return info.getMinorNumber();
99 }
100
101 // --- business -----------------------------------------------------------
102
103 // --- object basics ------------------------------------------------------
104
105 /**
106 * Returns the string representation of the object.
107 *
108 * @return the string representation of the object.
109 */
110 @Override
111 public String toString()
112 {
113 return getDisplayId();
114 }
115 }