1 18 package org.objectweb.speedo.generation.mivisitor; 19 20 import org.objectweb.speedo.metadata.SpeedoClass; 21 import org.objectweb.speedo.metadata.SpeedoIdentity; 22 import org.objectweb.speedo.metadata.SpeedoExtension; 23 import org.objectweb.speedo.api.SpeedoException; 24 import org.objectweb.speedo.api.SpeedoProperties; 25 26 31 public class DataStoreIdAdder extends AbstractMetaInfoVisitor { 32 public void visitClass(SpeedoClass sc) throws SpeedoException { 33 super.visitClass(sc); 34 if ((sc.identityType == SpeedoIdentity.CONTAINER_ID) 35 && (sc.getExtension(SpeedoProperties.VENDOR_NAME, SpeedoProperties.ID) == null)) { 36 if (sc.getExtension(SpeedoProperties.VENDOR_NAME, SpeedoProperties.SQL_SEQ_NAME) == null) { 38 sc.addExtension(new SpeedoExtension(SpeedoProperties.VENDOR_NAME, 39 SpeedoProperties.ID, SpeedoProperties.ID_LONG, sc)); 40 } else { 41 sc.addExtension(new SpeedoExtension(SpeedoProperties.VENDOR_NAME, 43 SpeedoProperties.ID, SpeedoProperties.ID_SEQUENCE, sc)); 44 } 45 } 46 if ((sc.identityType == SpeedoIdentity.CONTAINER_ID)) { 48 if (sc.getExtension(SpeedoProperties.VENDOR_NAME, SpeedoProperties.ID) == null 50 && sc.getExtension(SpeedoProperties.VENDOR_NAME, SpeedoProperties.SQL_SEQ_NAME) != null){ 51 sc.datastoreSequence = sc.getExtension(SpeedoProperties.VENDOR_NAME, SpeedoProperties.SQL_SEQ_NAME).value; 53 } else if (sc.getExtension(SpeedoProperties.VENDOR_NAME, SpeedoProperties.ID).value.equals(SpeedoProperties.ID_SEQUENCE)){ 54 SpeedoExtension se = sc.getExtension(SpeedoProperties.VENDOR_NAME, SpeedoProperties.SQL_SEQ_NAME); 55 if (se != null) { 56 sc.datastoreSequence = se.value; 57 } else { 58 se = sc.getExtension(SpeedoProperties.VENDOR_NAME, SpeedoProperties.SQL_NAME); 59 if (se == null) { 60 sc.datastoreSequence = sc.name.toUpperCase(); 61 } else { 62 sc.datastoreSequence = se.value; 63 } 64 sc.datastoreSequence += "_SEQ"; 65 } 66 } 67 } 68 } 69 } 70 | Popular Tags |