1 package com.daffodilwoods.daffodildb.server.sql99.ddl.schemadefinition; 2 3 import java.util.*; 4 5 import com.daffodilwoods.daffodildb.server.sql99.common.*; 6 import com.daffodilwoods.daffodildb.server.sql99.ddl.descriptors.*; 7 import com.daffodilwoods.daffodildb.server.sql99.token.*; 8 import com.daffodilwoods.database.resource.*; 9 10 public class SRESERVEDWORD1206543922oldornewvaluesaliaslist { 11 public oldornewvaluesaliaslist _oldornewvaluesaliaslist0; 12 public SRESERVEDWORD1206543922 _SRESERVEDWORD12065439221; 13 14 public TriggerDescriptor triggerDescriptor; 15 16 public void setTriggerDescriptor(_Descriptor triggerDes) throws 17 DException { 18 triggerDescriptor = (TriggerDescriptor) triggerDes; 19 } 20 21 public Object run(Object object) throws DException { 22 if (triggerDescriptor.action_orientation.equalsIgnoreCase(SqlKeywords.STATEMENT)) { 23 throw new DException("DSE8032", null); 24 } 25 26 ArrayList oldNewValuesAliasList = (ArrayList) _oldornewvaluesaliaslist0.run(null); 27 check(oldNewValuesAliasList); 28 return null; 29 } 30 31 private void check(ArrayList oldNewValuesAliasList) throws DException { 32 String triggerEvent = triggerDescriptor.event_manipulation; 33 if (triggerEvent.equalsIgnoreCase(SqlKeywords.INSERT)) { 34 checkForOldAlias(oldNewValuesAliasList); 35 } else if (triggerEvent.equalsIgnoreCase(SqlKeywords.DELETE)) { 36 checkForNewAlias(oldNewValuesAliasList); 37 } 38 checkAliasForOrientationType(oldNewValuesAliasList); 39 setConditionReferences(oldNewValuesAliasList); 40 } 41 42 private void checkForOldAlias(ArrayList oldNewValuesAliasList) throws 43 DException { 44 for (int i = 0, size = oldNewValuesAliasList.size(); i < size; i++) { 45 oldornewvaluesalias temp = (oldornewvaluesalias) oldNewValuesAliasList.get(i); 46 if (temp.getTriggerType() == oldornewvaluesalias.OLDROWTYPE) { 47 throw new DException("DSE776", null); 48 } 49 50 if (temp.getTriggerType() == oldornewvaluesalias.OLDTABLETYPE) { 51 throw new DException("DSE778", null); 52 } 53 } 54 } 55 56 private void checkForNewAlias(ArrayList oldNewValuesAliasList) throws 57 DException { 58 for (int i = 0, size = oldNewValuesAliasList.size(); i < size; i++) { 59 oldornewvaluesalias temp = (oldornewvaluesalias) oldNewValuesAliasList.get(i); 60 if (temp.getTriggerType() == oldornewvaluesalias.NEWROWTYPE) { 61 throw new DException("DSE716", null); 62 } 63 64 if (temp.getTriggerType() == oldornewvaluesalias.NEWTABLETYPE) { 65 throw new DException("DSE718", null); 66 } 67 } 68 } 69 70 private void checkAliasForOrientationType(ArrayList oldNewValuesAliasList) throws 71 DException { 72 String actionOrientation = triggerDescriptor.action_orientation; 73 for (int i = 0, size = oldNewValuesAliasList.size(); i < size; i++) { 74 oldornewvaluesalias temp = (oldornewvaluesalias) oldNewValuesAliasList.get(i); 75 if (temp.getTriggerType() == oldornewvaluesalias.NEWROWTYPE || 76 temp.getTriggerType() == oldornewvaluesalias.OLDROWTYPE) { 77 if (!actionOrientation.equalsIgnoreCase(SqlKeywords.ROW)) { 78 throw new DException("DSE717", null); 79 } 80 } 81 82 if (temp.getTriggerType() == oldornewvaluesalias.NEWTABLETYPE || 83 temp.getTriggerType() == oldornewvaluesalias.OLDTABLETYPE) { 84 if (!actionOrientation.equalsIgnoreCase(SqlKeywords.STATEMENT)) { 85 throw new DException("DSE777", null); 86 } 87 } 88 } 89 } 90 91 92 private void setConditionReferences(ArrayList oldNewValuesAliasList) throws 93 DException { 94 for (int i = 0, size = oldNewValuesAliasList.size(); i < size; i++) { 95 oldornewvaluesalias temp = (oldornewvaluesalias) oldNewValuesAliasList.get(i); 96 if (temp.getTriggerType() == oldornewvaluesalias.NEWROWTYPE || 97 temp.getTriggerType() == oldornewvaluesalias.NEWTABLETYPE) { 98 triggerDescriptor.condition_reference_new_table = (String ) temp.run(null); 99 100 } 101 if (temp.getTriggerType() == oldornewvaluesalias.OLDROWTYPE || 102 temp.getTriggerType() == oldornewvaluesalias.OLDTABLETYPE) { 103 triggerDescriptor.condition_reference_old_table = (String ) temp.run(null); 104 } 105 } 106 if (triggerDescriptor.condition_reference_new_table != null && 107 triggerDescriptor.condition_reference_new_table.equalsIgnoreCase( 108 triggerDescriptor.condition_reference_old_table)) { 109 throw new DException("DSE15", null); 110 } 111 } 112 113 public Object clone() throws CloneNotSupportedException { 114 return this; 115 } 116 117 public String toString() { 118 StringBuffer sb = new StringBuffer (); 119 sb.append(" "); 120 sb.append(_SRESERVEDWORD12065439221); 121 sb.append(" "); 122 sb.append(_oldornewvaluesaliaslist0); 123 return sb.toString(); 124 } 125 } 126 | Popular Tags |