001    package org.apache.archiva.rest.services;
002    /*
003     * Licensed to the Apache Software Foundation (ASF) under one
004     * or more contributor license agreements.  See the NOTICE file
005     * distributed with this work for additional information
006     * regarding copyright ownership.  The ASF licenses this file
007     * to you under the Apache License, Version 2.0 (the
008     * "License"); you may not use this file except in compliance
009     * with the License.  You may obtain a copy of the License at
010     *
011     *   http://www.apache.org/licenses/LICENSE-2.0
012     *
013     * Unless required by applicable law or agreed to in writing,
014     * software distributed under the License is distributed on an
015     * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
016     * KIND, either express or implied.  See the License for the
017     * specific language governing permissions and limitations
018     * under the License.
019     */
020    
021    import org.apache.archiva.rest.api.services.ArchivaRestServiceException;
022    
023    import javax.xml.bind.annotation.XmlRootElement;
024    
025    /**
026     * @author Olivier Lamy
027     * @since 1.4-M2
028     */
029    @XmlRootElement( name = "archivaRestError" )
030    public class ArchivaRestError
031    {
032    
033        private String errorKey;
034    
035        private String errorMessage;
036    
037        /**
038         * can return the field name of bean with issue
039         * can be <code>null</code>
040         *
041         * @since 1.4-M3
042         */
043        private String fieldName;
044    
045        public ArchivaRestError()
046        {
047            // no op
048        }
049    
050        public ArchivaRestError( ArchivaRestServiceException e )
051        {
052            errorKey = e.getErrorKey();
053            errorMessage = e.getMessage();
054            fieldName = e.getFieldName();
055        }
056    
057        public String getErrorKey()
058        {
059            return errorKey;
060        }
061    
062        public void setErrorKey( String errorKey )
063        {
064            this.errorKey = errorKey;
065        }
066    
067        public String getErrorMessage()
068        {
069            return errorMessage;
070        }
071    
072        public void setErrorMessage( String errorMessage )
073        {
074            this.errorMessage = errorMessage;
075        }
076    
077        public String getFieldName()
078        {
079            return fieldName;
080        }
081    
082        public void setFieldName( String fieldName )
083        {
084            this.fieldName = fieldName;
085        }
086    }