buildframework/helium/sf/java/jpa/src/com/nokia/helium/jpa/entity/metadata/Component.java
changeset 628 7c4a911dc066
parent 588 c7c26511138f
child 629 541af5ee3ed9
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.jpa.entity.metadata;
       
    19 
       
    20 
       
    21 import javax.persistence.Entity;
       
    22 import javax.persistence.CascadeType;
       
    23 import javax.persistence.GeneratedValue;
       
    24 import javax.persistence.GenerationType;
       
    25 import javax.persistence.Id;
       
    26 import javax.persistence.ManyToOne;
       
    27 import javax.persistence.Column;
       
    28 import javax.persistence.Basic;
       
    29 import javax.persistence.JoinColumn;
       
    30 
       
    31 
       
    32 /**
       
    33  * Entity class to store the component information.
       
    34  */
       
    35 @Entity
       
    36 public class Component {
       
    37 
       
    38     @Id
       
    39     @GeneratedValue(strategy = GenerationType.SEQUENCE)
       
    40     @Column(name = "COMPONENT_ID")
       
    41     private int id;
       
    42 
       
    43     @Basic
       
    44     @Column(nullable = false, length = 500)
       
    45     private String component;
       
    46 
       
    47     @Basic
       
    48     @Column(name = "LOGPATH_ID", insertable = false, updatable = false)
       
    49     private int logPathID;
       
    50 
       
    51     @ManyToOne(cascade = CascadeType.REMOVE)
       
    52     @JoinColumn(name = "LOGPATH_ID", referencedColumnName = "LOGPATH_ID")
       
    53     private LogFile logFile;
       
    54 
       
    55     @ManyToOne
       
    56     private Metadata metadata;
       
    57 
       
    58     /**
       
    59      * Helper function to set the identifier.
       
    60      * @param identifier to set the identifier for the component.
       
    61      */
       
    62     public void setId(int identifier) {
       
    63         id = identifier;
       
    64     }
       
    65 
       
    66     /**
       
    67      * Helper function to set the identifier.
       
    68      * @return the identifier of the component.
       
    69      */
       
    70     public int getId() {
       
    71         return id;
       
    72     }
       
    73 
       
    74     /**
       
    75      * Helper function to set component name.
       
    76      * @param cmp string to be set to.
       
    77      */
       
    78     public void setComponent(String cmp) {
       
    79         component = cmp;
       
    80     }
       
    81 
       
    82     /**
       
    83      * Helper function to set log file associated
       
    84      * with this component.
       
    85      * @param file associated file to this component.
       
    86      */
       
    87     public void setLogFile(LogFile file) {
       
    88         logFile = file;
       
    89     }
       
    90 
       
    91     /**
       
    92      * Helper function to return component string.
       
    93      * @return component name of this component.
       
    94      */
       
    95     public String getComponent() {
       
    96         return component;
       
    97     }
       
    98 
       
    99     /**
       
   100      * Helper function to return log file associated with this component.
       
   101      * @return component name of this component.
       
   102      */
       
   103     public LogFile getLogFile() {
       
   104         return logFile;
       
   105     }
       
   106 
       
   107     /**
       
   108      * Helper function to return logpath id.
       
   109      * @return log path id associated with this component.
       
   110      */
       
   111     public int getLogPathID() {
       
   112         return logPathID;
       
   113     }
       
   114 }