~ubuntu-branches/ubuntu/utopic/gridengine/utopic

« back to all changes in this revision

Viewing changes to source/libs/jgdi/templates/java_event_pkinfo.jsp

  • Committer: Bazaar Package Importer
  • Author(s): Mark Hymers
  • Date: 2008-06-25 22:36:13 UTC
  • Revision ID: james.westby@ubuntu.com-20080625223613-tvd9xlhuoct9kyhm
Tags: upstream-6.2~beta2
ImportĀ upstreamĀ versionĀ 6.2~beta2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<%
 
2
/*___INFO__MARK_BEGIN__*/
 
3
/*************************************************************************
 
4
 *
 
5
 *  The Contents of this file are made available subject to the terms of
 
6
 *  the Sun Industry Standards Source License Version 1.2
 
7
 *
 
8
 *  Sun Microsystems Inc., March, 2001
 
9
 *
 
10
 *
 
11
 *  Sun Industry Standards Source License Version 1.2
 
12
 *  =================================================
 
13
 *  The contents of this file are subject to the Sun Industry Standards
 
14
 *  Source License Version 1.2 (the "License"); You may not use this file
 
15
 *  except in compliance with the License. You may obtain a copy of the
 
16
 *  License at http://gridengine.sunsource.net/Gridengine_SISSL_license.html
 
17
 *
 
18
 *  Software provided under this License is provided on an "AS IS" basis,
 
19
 *  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
 
20
 *  WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
 
21
 *  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
 
22
 *  See the License for the specific provisions governing your rights and
 
23
 *  obligations concerning the Software.
 
24
 *
 
25
 *   The Initial Developer of the Original Code is: Sun Microsystems, Inc.
 
26
 *
 
27
 *   Copyright: 2001 by Sun Microsystems, Inc.
 
28
 *
 
29
 *   All Rights Reserved.
 
30
 *
 
31
 ************************************************************************/
 
32
/*___INFO__MARK_END__*/
 
33
%>
 
34
/*
 
35
 *  Generated from java_event_pkinfo.jsp
 
36
 *  !!! DO NOT EDIT THIS FILE !!!
 
37
 */
 
38
<%
 
39
 
 
40
   class PKField {
 
41
       private String name;
 
42
       private String type;
 
43
       private String key;
 
44
   }
 
45
   
 
46
   java.util.Map<String,PKField> pkMap = new java.util.HashMap<String,PKField>();
 
47
   
 
48
   int pkNumIndex = 1;
 
49
   int pkStrIndex = 1;
 
50
   
 
51
   for(int i = 0; i < cullObj.getPrimaryKeyCount(); i++) {
 
52
      attr = cullObj.getPrimaryKeyAttr(i);
 
53
      
 
54
      PKField field = new PKField();
 
55
      field.name = jh.getAttrName(attr);
 
56
      if( field.name.endsWith("List") ) {          
 
57
         field.name  = field.name.substring(0, field.name.length() - 4 );
 
58
      }
 
59
      field.type = jh.getFullClassName(attr.getType());
 
60
      if(field.type.equals(String.class.getName())) {
 
61
          if(pkStrIndex >= 2) {
 
62
              throw new IllegalStateException("cull type " + cullObj.getName() + " has more then two string primary key fields");
 
63
          }
 
64
          field.key = "strKey" + pkStrIndex;
 
65
          pkStrIndex++;
 
66
      } else {
 
67
          if(pkNumIndex >= 2) {
 
68
              throw new IllegalStateException("cull type " + cullObj.getName() + " has more then two numeric primary key fields");
 
69
          }
 
70
          field.key = "numKey" + pkNumIndex;
 
71
          pkNumIndex++;
 
72
      }
 
73
      pkMap.put(field.name, field);
 
74
   }
 
75
         
 
76
   if(cullObj.getName().equals("JAT_Type")) {
 
77
       PKField taskNumber = (PKField)pkMap.get("taskNumber");
 
78
       taskNumber.key = "numKey2";
 
79
       
 
80
       PKField jobid = new PKField();
 
81
       jobid.name = "jobId";
 
82
       jobid.type = "int";
 
83
       jobid.key = "numKey1";
 
84
       pkMap.put(jobid.name, jobid);
 
85
   }
 
86
   
 
87
   if (cullObj.getName().equals("PET_Type")) {
 
88
       PKField jobid = new PKField();
 
89
       jobid.name = "jobId";
 
90
       jobid.type = "int";
 
91
       jobid.key = "numKey1";
 
92
       pkMap.put(jobid.name, jobid);
 
93
       
 
94
       PKField taskNumber = new PKField();
 
95
       taskNumber.name = "taskNumber";
 
96
       taskNumber.type = "int";
 
97
       taskNumber.key  = "numKey2";
 
98
       pkMap.put(taskNumber.name, taskNumber);
 
99
   }
 
100
 
 
101
   for (PKField field : pkMap.values()) {
 
102
%>   private <%=field.type%> m_<%=field.name%>;
 
103
<%         
 
104
   } 
 
105
%>
 
106
 
 
107
  /**
 
108
   *   Set the primary key info of the <%=name%>.
 
109
   *
 
110
   *   This method is not indented for public usage. It is called from the
 
111
   *   native code to set the primary key info of cull event.
 
112
   * 
 
113
   *   @param numKey1   first numerical key
 
114
   *   @param numKey2   second numerical key
 
115
   *   @param strKey1   fist string key
 
116
   *   @param strKey2   second string key
 
117
   */
 
118
  public void setPKInfo(int numKey1, int numKey2, String strKey1, String strKey2) {
 
119
<%
 
120
    for (PKField field : pkMap.values()) {
 
121
%>
 
122
        m_<%=field.name%> = <%=field.key%>;
 
123
<%
 
124
    }
 
125
%>
 
126
   }
 
127
   
 
128
<%
 
129
    // Accessor for the primary key information
 
130
   for (PKField field : pkMap.values()) {
 
131
       String gsmName = Character.toUpperCase(field.name.charAt(0)) + field.name.substring(1);
 
132
%>     
 
133
   /**
 
134
    *   Get the <%=field.name%> of the <%=name%>
 
135
    *
 
136
    *   @return the <%=field.name%> of the <%=name%>
 
137
    */
 
138
    public <%=field.type%> get<%=gsmName%>() {
 
139
       return m_<%=field.name%>;   
 
140
    }
 
141
<%       
 
142
    }
 
143
%>