summaryrefslogtreecommitdiff
path: root/Tools/Java/Source/PcdTools/org/tianocore/pcd/entity/UsageIdentification.java
blob: 0c54525661e9bf4482ca7529e592a1ad1cb4c6a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/** @file
  UsageIdentification class.

  This class an identification for a PCD UsageInstance.
 
Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution.  The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
 
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

**/  

package org.tianocore.pcd.entity;

/**
   The identification for a UsageInstance. 
   It should be extend from ModuleIdentification in future.

**/
public class UsageIdentification {
    ///
    /// The module CName: one key of Identification
    /// 
    public String moduleName;

    /// 
    /// The module Guid String: one key of Identification
    /// 
    public String moduleGuid;

    /// 
    /// The package CName: one key of Identification 
    ///
    public String packageName;

    /// 
    /// The package Guid: one key of Identification
    /// 
    public String packageGuid;

    /// 
    /// Module's Arch: one key of Identification
    /// 
    public String arch;

    /// 
    /// Module's version: one key of Identification
    /// 
    public String version;

    ///
    /// Module's type
    /// 
    public String moduleType;

    /**
      Constructor function for UsageIdentification class.

      @param moduleName     The key of module's name
      @param moduleGuid     The key of module's GUID string
      @param packageName    The key of package's name
      @param packageGuid    The key of package's Guid
      @param arch           The architecture string
      @param version        The version String
      @param moduleType     The module type
    **/
    public UsageIdentification (String moduleName,
                                String moduleGuid,
                                String packageName,
                                String packageGuid,
                                String arch,
                                String version,
                                String moduleType) {
        this.moduleName     = moduleName;
        this.moduleGuid     = moduleGuid;
        this.packageName    = packageName;
        this.packageGuid    = packageGuid;
        this.arch           = arch;
        this.version        = version;
        this.moduleType     = moduleType;
    }

    /**
       Generate the string for UsageIdentification

       @return the string value for UsageIdentification
    **/
    public String toString() {
        //
        // Because currently transition schema not require write moduleGuid, package Name, Packge GUID in
        // <ModuleSA> section, So currently no expect all paramter must be valid.
        // BUGBUG: Because currently we can not get version from MSA, So ignore verison.
        // 
        return(moduleName                                                                + "_" +
               ((moduleGuid  != null) ? moduleGuid.toLowerCase()    : "NullModuleGuid")  + "_" +
               ((packageName != null) ? packageName                 : "NullPackageName") + "_" +
               ((packageGuid != null) ? packageGuid.toLowerCase()   : "NullPackageGuid") + "_" +
               ((arch        != null) ? arch                        : "NullArch")        + "_" +
               "NullVersion");
    }
}