buildframework/helium/sf/java/metadata/src/com/nokia/helium/metadata/model/metadata/ComponentTime.java
changeset 628 7c4a911dc066
equal deleted inserted replaced
588:c7c26511138f 628:7c4a911dc066
       
     1 /*
       
     2  * Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
       
     3  * All rights reserved.
       
     4  * This component and the accompanying materials are made available
       
     5  * under the terms of the License "Eclipse Public License v1.0"
       
     6  * which accompanies this distribution, and is available
       
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8  *
       
     9  * Initial Contributors:
       
    10  * Nokia Corporation - initial contribution.
       
    11  *
       
    12  * Contributors:
       
    13  *
       
    14  * Description:  
       
    15  *
       
    16  */
       
    17 
       
    18 package com.nokia.helium.metadata.model.metadata;
       
    19 
       
    20 import javax.persistence.Basic;
       
    21 import javax.persistence.CascadeType;
       
    22 import javax.persistence.Column;
       
    23 import javax.persistence.Entity;
       
    24 import javax.persistence.GeneratedValue;
       
    25 import javax.persistence.GenerationType;
       
    26 import javax.persistence.Id;
       
    27 import javax.persistence.JoinColumn;
       
    28 import javax.persistence.ManyToOne;
       
    29 
       
    30 
       
    31 
       
    32 
       
    33 /**
       
    34  *  Entity component time to store the time taken for each
       
    35  *  component to build.
       
    36  */
       
    37 @SuppressWarnings("PMD.UnusedPrivateField")
       
    38 @Entity
       
    39 public class ComponentTime {
       
    40 
       
    41     @Id
       
    42     @GeneratedValue(strategy = GenerationType.SEQUENCE)
       
    43     @Column(name = "COMPONENTTIME_ID")
       
    44     private int id;
       
    45 
       
    46     @Basic
       
    47     @Column(name = "TIME")
       
    48     private double componentTime;
       
    49 
       
    50     @Basic
       
    51     @Column(name = "COMPONENT_ID", insertable = false, updatable = false)
       
    52     private int componentId;
       
    53 
       
    54 
       
    55     @ManyToOne(cascade = CascadeType.REMOVE)
       
    56     @JoinColumn(name = "COMPONENT_ID", referencedColumnName = "COMPONENT_ID")    
       
    57     private Component component;
       
    58 
       
    59     /**
       
    60      *  Helper function to set the associated component.
       
    61      *  @param cmpt for which the time to be recorded.
       
    62      */
       
    63     public void setComponent(Component cmpt) {
       
    64         component = cmpt;
       
    65     }
       
    66 
       
    67 
       
    68     /**Helper function to return the time taken for this component
       
    69      *  to build.
       
    70      *  @return duration to build this component.
       
    71      */
       
    72     public double getDuration() {
       
    73         return componentTime;
       
    74     }
       
    75 
       
    76     /**
       
    77      *  Helper function to set the duration for this component to build.
       
    78      *  @param duration to build this component.
       
    79      */
       
    80 
       
    81     public void setDuration(double duration) {
       
    82         componentTime = duration;
       
    83     }
       
    84 }