public void initializeIBMPCDescriptor() { MWTableDescriptor descriptor = getIBMPCDescriptor(); MWTable table = tableNamed("INH_COMP"); descriptor.setPrimaryTable(table); descriptor.getCachingPolicy().setCacheType(MWCachingPolicy.CACHE_TYPE_FULL); // inheritance policy descriptor.addInheritancePolicy(); MWRelationalDescriptorInheritancePolicy inheritancePolicy = (MWRelationalDescriptorInheritancePolicy) descriptor.getInheritancePolicy(); inheritancePolicy.setReadSubclassesOnQuery(false); inheritancePolicy.setParentDescriptor(getPCDescriptor()); // //afterload policy descriptor.addAfterLoadingPolicy(); MWClass postLoadClass = descriptor.getMWClass(); ((MWDescriptorAfterLoadingPolicy) descriptor.getAfterLoadingPolicy()) .setPostLoadMethodClass(postLoadClass); ((MWDescriptorAfterLoadingPolicy) descriptor.getAfterLoadingPolicy()) .setPostLoadMethod(methodNamed(postLoadClass, "addToDescriptor")); // direct to field mapping addDirectMapping(descriptor, "isClone", table, "CLONE"); }
public void initializePCDescriptor() { MWTableDescriptor descriptor = getPCDescriptor(); MWTable table = tableNamed("INH_COMP"); descriptor.setPrimaryTable(table); descriptor.getCachingPolicy().setCacheType(MWCachingPolicy.CACHE_TYPE_FULL); // inheritance policy descriptor.addInheritancePolicy(); MWRelationalDescriptorInheritancePolicy inheritancePolicy = (MWRelationalDescriptorInheritancePolicy) descriptor.getInheritancePolicy(); inheritancePolicy.setParentDescriptor(getComputerDescriptor()); // afterload policy descriptor.addAfterLoadingPolicy(); MWClass postLoadClass = descriptor.getMWClass(); ((MWDescriptorAfterLoadingPolicy) descriptor.getAfterLoadingPolicy()) .setPostLoadMethodClass(postLoadClass); ((MWDescriptorAfterLoadingPolicy) descriptor.getAfterLoadingPolicy()) .setPostLoadMethod(methodNamed(postLoadClass, "addToDescriptor")); }
public void initializeComputerDescriptor() { MWTableDescriptor descriptor = getComputerDescriptor(); MWTable table = tableNamed("INH_COMP"); descriptor.setPrimaryTable(table); descriptor.getCachingPolicy().setCacheType(MWCachingPolicy.CACHE_TYPE_FULL); descriptor.getCachingPolicy().setCacheSize(100); // sequencing descriptor.setUsesSequencing(true); descriptor.setSequenceNumberName("SEQ"); descriptor.setSequenceNumberTable(table); descriptor.setSequenceNumberColumn(table.columnNamed("ID")); // afterload policy descriptor.addAfterLoadingPolicy(); MWClass postLoadClass = typeNamed( "org.eclipse.persistence.tools.workbench.test.models.complexinheritance.Computer"); ((MWDescriptorAfterLoadingPolicy) descriptor.getAfterLoadingPolicy()) .setPostLoadMethodClass(postLoadClass); ((MWDescriptorAfterLoadingPolicy) descriptor.getAfterLoadingPolicy()) .setPostLoadMethod(methodNamed(postLoadClass, "addToDescriptor")); // inheritance policy descriptor.addInheritancePolicy(); MWRelationalDescriptorInheritancePolicy inheritancePolicy = (MWRelationalDescriptorInheritancePolicy) descriptor.getInheritancePolicy(); inheritancePolicy.useClassExtractionMethodIndicatorPolicy(); ((MWClassIndicatorExtractionMethodPolicy) inheritancePolicy.getClassIndicatorPolicy()) .setClassExtractionMethod(methodNamed(descriptor.getMWClass(), "getClassFromRow")); // direct to field mapping addDirectMapping(descriptor, "id", table, "ID"); addDirectMapping(descriptor, "manufacturer", table, "MANUFAC"); addDirectMapping(descriptor, "memory", table, "MEMORY"); addDirectMapping(descriptor, "processorMake", table, "MAKE"); addDirectMapping(descriptor, "processorSpeed", table, "SPEED"); }
public void initializeMainframeDescriptor() { MWTableDescriptor descriptor = getMainframeDescriptor(); MWTable table = tableNamed("INH_COMP"); descriptor.setPrimaryTable(table); descriptor.getCachingPolicy().setCacheType(MWCachingPolicy.CACHE_TYPE_FULL); // inheritance policy descriptor.addInheritancePolicy(); MWRelationalDescriptorInheritancePolicy inheritancePolicy = (MWRelationalDescriptorInheritancePolicy) descriptor.getInheritancePolicy(); inheritancePolicy.setReadSubclassesOnQuery(false); inheritancePolicy.setParentDescriptor(getComputerDescriptor()); // afterload policy descriptor.addAfterLoadingPolicy(); MWClass postLoadClass = descriptor.getMWClass(); ((MWDescriptorAfterLoadingPolicy) descriptor.getAfterLoadingPolicy()) .setPostLoadMethodClass(postLoadClass); ((MWDescriptorAfterLoadingPolicy) descriptor.getAfterLoadingPolicy()) .setPostLoadMethod(methodNamed(postLoadClass, "addToDescriptor")); // multi-table info policy descriptor.addMultiTableInfoPolicy(); MWDescriptorMultiTableInfoPolicy multiTablePolicy = (MWDescriptorMultiTableInfoPolicy) descriptor.getMultiTableInfoPolicy(); MWTable inhMfTable = tableNamed("INH_MF"); descriptor.addAssociatedTable(inhMfTable); multiTablePolicy.secondaryTableHolderFor(inhMfTable).setPrimaryKeysHaveSameName(false); multiTablePolicy .secondaryTableHolderFor(inhMfTable) .setReference(inhMfTable.referenceNamed("INH_MF_INH_COMP")); // more needed here for the table associations // direct to field mapping addDirectMapping(descriptor, "numberOfProcessors", inhMfTable, "PROCS"); }