oxProject = new Project();
}
oxProject.setName(projectName + "-" + DBWS_OX_LABEL);
for (DbTable dbTable : dbTables) {
String tableName = dbTable.getName();
RelationalDescriptor desc = buildORDescriptor(tableName, nct);
orProject.addDescriptor(desc);
XMLDescriptor xdesc = buildOXDescriptor(tableName, nct);
oxProject.addDescriptor(xdesc);
for (DbColumn dbColumn : dbTable.getColumns()) {
String columnName = dbColumn.getName();
ElementStyle style = nct.styleForElement(columnName);
if (style == NONE) {
continue;
}
logMessage(FINE, "Building mappings for " + tableName + "." + columnName);
DirectToFieldMapping orFieldMapping = buildORFieldMappingFromColumn(dbColumn, desc, nct);
desc.addMapping(orFieldMapping);
XMLDirectMapping oxFieldMapping = buildOXFieldMappingFromColumn(dbColumn, xdesc, nct);
xdesc.addMapping(oxFieldMapping);
// check for switch from Byte[] to byte[]
if (oxFieldMapping.getAttributeClassificationName() == APBYTE.getName()) {
orFieldMapping.setAttributeClassificationName(APBYTE.getName());
}
}
ReadObjectQuery roq = new ReadObjectQuery();
String generatedJavaClassName = getGeneratedJavaClassName(tableName);
roq.setReferenceClassName(generatedJavaClassName);
Expression expression = null;
Expression builder = new ExpressionBuilder();
Expression subExp1;
Expression subExp2;
Expression subExpression;
List<DatabaseField> primaryKeyFields = desc.getPrimaryKeyFields();
for (int index = 0; index < primaryKeyFields.size(); index++) {
DatabaseField primaryKeyField = primaryKeyFields.get(index);
subExp1 = builder.getField(primaryKeyField);
subExp2 = builder.getParameter(primaryKeyField.getName().toLowerCase());
subExpression = subExp1.equal(subExp2);
if (expression == null) {
expression = subExpression;
}
else {
expression = expression.and(subExpression);
}
roq.addArgument(primaryKeyField.getName().toLowerCase());
}
roq.setSelectionCriteria(expression);
desc.getQueryManager().addQuery(PK_QUERYNAME, roq);
ReadAllQuery raq = new ReadAllQuery();
raq.setReferenceClassName(generatedJavaClassName);
desc.getQueryManager().addQuery(FINDALL_QUERYNAME, raq);
}
for (OperationModel opModel : operations) {
if (opModel.isProcedureOperation()) {
ProcedureOperationModel procOpModel = (ProcedureOperationModel)opModel;
if (procOpModel.getJPubType() != null) {