/**
 * Copyright 2014 Telefonica Investigación y Desarrollo, S.A.U <br>
 * This file is part of FI-WARE project.
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
 * the License.
 * </p>
 * <p>
 * You may obtain a copy of the License at:<br>
 * <br>
 * http://www.apache.org/licenses/LICENSE-2.0
 * </p>
 * <p>
 * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
 * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * </p>
 * <p>
 * See the License for the specific language governing permissions and limitations under the License.
 * </p>
 * <p>
 * For those usages not covered by the Apache version 2.0 License please contact with opensource@tid.es
 * </p>
 */

package com.telefonica.euro_iaas.paasmanager.model;

import javax.persistence.Column;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;

/**
 * Defines a message in a task.
 *
 * @author Sergio Arroyo
 */
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public class TaskError {

    @XmlAttribute(required = true)
    @Column(length = 1024)
    private String message;
    @XmlAttribute(required = false)
    @Column(length = 1024)
    private String majorErrorCode;
    @XmlAttribute(required = false)
    private String minorErrorCode;
    @XmlAttribute(required = false)
    private String venodrSpecificErrorCode;

    /**
     */
    public TaskError() {
    }

    /**
     * @param message
     */
    public TaskError(String message) {
        this.message = message;
    }

    /**
     * @return the majorErrorCode
     */
    public String getMajorErrorCode() {
        return majorErrorCode;
    }

    /**
     * @return the message
     */
    public String getMessage() {
        return message;
    }

    /**
     * @return the minorErrorCode
     */
    public String getMinorErrorCode() {
        return minorErrorCode;
    }

    /**
     * @return the venodrSpecificErrorCode
     */
    public String getVenodrSpecificErrorCode() {
        return venodrSpecificErrorCode;
    }

    /**
     * @param majorErrorCode the majorErrorCode to set
     */
    public void setMajorErrorCode(String majorErrorCode) {
        this.majorErrorCode = majorErrorCode;
    }

    /**
     * @param message the message to set
     */
    public void setMessage(String message) {
        this.message = message;
    }

    /**
     * @param minorErrorCode the minorErrorCode to set
     */
    public void setMinorErrorCode(String minorErrorCode) {
        this.minorErrorCode = minorErrorCode;
    }

    /**
     * @param venodrSpecificErrorCode the venodrSpecificErrorCode to set
     */
    public void setVenodrSpecificErrorCode(String venodrSpecificErrorCode) {
        this.venodrSpecificErrorCode = venodrSpecificErrorCode;
    }

    /**
     * Constructs a <code>String</code> with all attributes
     * in name = value format.
     *
     * @return a <code>String</code> representation
     * of this object.
     */
    public String toString() {
        StringBuilder sb = new StringBuilder("[[TaskError]");
        sb.append("[message = ").append(this.message).append("]");
        sb.append("[majorErrorCode = ").append(this.majorErrorCode).append("]");
        sb.append("[minorErrorCode = ").append(this.minorErrorCode).append("]");
        sb.append("[venodrSpecificErrorCode = ").append(this.venodrSpecificErrorCode).append("]");
        sb.append("]");
        return sb.toString();
    }


}

@@ -1195,16 +1195,17 @@
 ask.%0D%0A *
+ 
 %0D%0A * @au
@@ -1806,38 +1806,35 @@
         
-this.m
+setM
 essage
- = 
+(
 message
+)
 ;%0D%0A    %7D
@@ -2416,24 +2416,43 @@
 jorErrorCode
+%0D%0A     *           
  the majorEr
@@ -2548,45 +2548,196 @@
     
-this.majorErrorCode = majorErrorCode;
+if (majorErrorCode.length() %3E= 1024) %7B%0D%0A            this.majorErrorCode = majorErrorCode.substring(0, 1023);%0D%0A        %7D else %7B%0D%0A            this.majorErrorCode = majorErrorCode;%0D%0A        %7D
 %0D%0A  
@@ -2773,16 +2773,35 @@
  message
+%0D%0A     *           
  the mes
@@ -2872,39 +2872,173 @@
  %7B%0D%0A
-        this.message = message;
+%0D%0A        if (message.length() %3E= 1024) %7B%0D%0A            this.message = message.substring(0, 1023);%0D%0A        %7D else %7B%0D%0A%0D%0A            this.message = message;%0D%0A        %7D
 %0D%0A  
@@ -3077,24 +3077,43 @@
 norErrorCode
+%0D%0A     *           
  the minorEr
@@ -3299,16 +3299,35 @@
 rrorCode
+%0D%0A     *           
  the ven
@@ -3584,24 +3584,16 @@
 tributes
-%0D%0A     *
  in name
@@ -3616,16 +3616,17 @@
 %0D%0A     *
+ 
 %0D%0A     *
@@ -3670,24 +3670,16 @@
 entation
-%0D%0A     *
  of this
@@ -4189,13 +4189,11 @@
    %7D%0D%0A%0D%0A
-%0D%0A
 %7D%0D%0A

add truncate of error messages; upgrade javax.persistence v1 to v2