if (colmd.getJdbcType() != null) columnMetaData.setJdbcType(colmd.getJdbcType()); if (colmd.getSqlType() != null) columnMetaData.setSqlType(colmd.getSqlType()); if (colmd.getName() != null) columnMetaData.setName(colmd.getName()); if (colmd.getAllowsNull() != null) columnMetaData.setAllowsNull(Boolean.valueOf(colmd.isAllowsNull())); if (colmd.getLength() != null) columnMetaData.setLength(colmd.getLength()); if (colmd.getScale() != null) columnMetaData.setScale(colmd.getScale()); if (colmd.getAllowsNull() != null && colmd.isAllowsNull()) if (colmd.getUnique())
if (colmd.getName() != null) str.append(" name=\"" + colmd.getName() + "\""); if (colmd.getTarget() != null) str.append(" target=\"" + colmd.getTarget() + "\""); if (colmd.getTargetMember() != null) str.append(" target-field=\"" + colmd.getTargetMember() + "\""); if (colmd.getJdbcTypeName() != null) str.append(" jdbc-type=\"" + colmd.getJdbcTypeName() + "\""); if (colmd.getSqlType() != null) str.append(" sql-type=\"" + colmd.getSqlType() + "\""); if (colmd.isAllowsNull()) str.append(" allows-null=\"" + colmd.isAllowsNull() + "\""); if (colmd.getLength() != null) str.append(" length=\"" + colmd.getLength() + "\""); if (colmd.getScale() != null)
ColumnMetaData colmd = new ColumnMetaData(); colmd.setName(columnName); colmd.setTarget(target); colmd.setTargetMember(targetField); colmd.setJdbcType(jdbcType); colmd.setSqlType(sqlType); colmd.setLength(length); colmd.setScale(scale); colmd.setAllowsNull(allowsNull); colmd.setDefaultValue(defaultValue); colmd.setInsertValue(insertValue); colmd.setInsertable(insertable); colmd.setUpdateable(updateable); colmd.setUnique(unique); if (columnDdl != null) colmd.setColumnDdl(columnDdl); colmd.setAllowsNull(new Boolean(apmd.isPrimaryKey() ? false : colmd.isAllowsNull())); colmd.setAllowsNull(colmd.isAllowsNull());
public boolean isUnlimitedLength() { // TODO Enable the two commented out lines so that we can allow people to have "BLOB(1024)" etc if (columnMetaData.getJdbcType() != null && (columnMetaData.getJdbcType() == JdbcType.BLOB || columnMetaData.getJdbcType() == JdbcType.CLOB)/* && !typeInfo.isAllowsPrecisionSpec()*/) { // Allow for jdbc-type=BLOB/CLOB return true; } else if (columnMetaData.getSqlType() != null && columnMetaData.getSqlType().toLowerCase().indexOf("lob") > 0/* && !typeInfo.isAllowsPrecisionSpec()*/) { // Allow for sql-type=BLOB/CLOB return true; } return false; }
public final void checkString() throws ColumnDefinitionException { if (columnMetaData.getJdbcType() == null) { columnMetaData.setJdbcType(JdbcType.VARCHAR); } if (columnMetaData.getLength() == null) { // Use the default string length columnMetaData.setLength(getStoreManager().getIntProperty(RDBMSPropertyNames.PROPERTY_RDBMS_STRING_DEFAULT_LENGTH)); } }
/** * Convenience method to get the column metadata for annotation values of a @Column. * @param annotationValues The values for the annotation * @return The MetaData for the column */ public static ColumnMetaData getColumnMetaDataForAnnotations(Map<String, Object> annotationValues) { ColumnMetaData colmd = new ColumnMetaData(); colmd.setName((String)annotationValues.get("name")); colmd.setTarget((String)annotationValues.get("target")); colmd.setTargetMember((String)annotationValues.get("targetField")); colmd.setJdbcType((String)annotationValues.get("jdbcType")); colmd.setSqlType((String)annotationValues.get("sqlType")); colmd.setLength((Integer)annotationValues.get("length")); colmd.setScale((Integer)annotationValues.get("scale")); colmd.setAllowsNull((String)annotationValues.get("allowsNull")); colmd.setDefaultValue((String)annotationValues.get("defaultValue")); colmd.setInsertValue((String)annotationValues.get("insertValue")); if (annotationValues.containsKey("position")) { colmd.setPosition((Integer)annotationValues.get("position")); } addExtensionsToMetaData(colmd, (Extension[])annotationValues.get("extensions")); return colmd; }
if (colmd == null) { colmd = new ColumnMetaData(); colmd.setName(fmd.getColumn()); fmd.addColumn(colmd); if (colmd.getName() == null) { colmd.setName(identifier.getIdentifierName()); prop = datastoreContainer.addDatastoreField(javaType, identifier, mapping, colmd); } else { idFactory.newDatastoreFieldIdentifier(colmd.getName(), storeMgr.getNucleusContext().getTypeManager().isDefaultEmbeddedType(fmd.getType()), FieldRole.ROLE_CUSTOM), if (colmd.getDefaultValue() != null) { throw new UnsupportedOperationException("User-defined default not supported.");
} else { for (int i = 0; i < keyTargetPrimaryKeyColumnMetaData.length; i++) { keyMapping.put(keyColumnMetaData[i].getName(), keyTargetPrimaryKeyColumnMetaData[i].getName()); idColumnMapping = new HashMap<>(joinMetaData.length); for (int i = 0; i < joinMetaData.length; i++) { idColumnMapping.put(joinMetaData[i].getName(), joinMetaData[i].getTarget()); targetIdColumnMapping = new HashMap<>(elementMetaData.length); for (int i = 0; i < elementMetaData.length; i++) { targetIdColumnMapping.put(elementMetaData[i].getName(), elementMetaData[i].getTarget()); idColumnMapping = new HashMap<>(primaryKeyColumnMetaData.length); for (int i = 0; i < foreignKeyColumnMetaData.length; i++) { idColumnMapping.put(foreignKeyColumnMetaData[i].getName(), primaryKeyColumnMetaData[i].getName()); targetIdColumnMapping.put(targetColumnMetaData[i].getName(), targetPrimaryKeyColumnMetaData[i].getName());
if (this.columnMetaData.getJdbcType() != null) col.columnMetaData.setJdbcType(this.columnMetaData.getJdbcType()); if (this.columnMetaData.getSqlType() != null) col.columnMetaData.setSqlType(this.columnMetaData.getSqlType()); if (this.columnMetaData.getLength() != null) col.getColumnMetaData().setLength(this.columnMetaData.getLength()); if (this.columnMetaData.getScale() != null) col.getColumnMetaData().setScale(this.getColumnMetaData().getScale());
public String getName() { return getInternal().getName(); }
ColumnMetaData colmd = new ColumnMetaData(); if (cmd.hasExtension(MetaData.EXTENSION_CLASS_MULTITENANCY_COLUMN_NAME)) colmd.setName(cmd.getValueForExtension(MetaData.EXTENSION_CLASS_MULTITENANCY_COLUMN_NAME)); colmd.setJdbcType(cmd.getValueForExtension(MetaData.EXTENSION_CLASS_MULTITENANCY_JDBC_TYPE)); colmd.setLength(cmd.getValueForExtension(MetaData.EXTENSION_CLASS_MULTITENANCY_COLUMN_LENGTH)); String colName = (colmd.getName() != null) ? colmd.getName() : "TENANT_ID"; String typeName = (colmd.getJdbcType() == JdbcType.INTEGER) ? Integer.class.getName() : String.class.getName(); ColumnMetaData colmd = new ColumnMetaData(); if (cmd.hasExtension(MetaData.EXTENSION_CLASS_SOFTDELETE_COLUMN_NAME)) colmd.setName(cmd.getValueForExtension(MetaData.EXTENSION_CLASS_SOFTDELETE_COLUMN_NAME)); String colName = (colmd.getName() != null) ? colmd.getName() : "DELETED"; String typeName = Boolean.class.getName(); // TODO Allow integer?
String discrimColName = (discrimMapping.getDatastoreMapping(0).getColumn().getColumnMetaData()).getName(); if (discrimColName.equalsIgnoreCase(colName)) ColumnMetaData colmd = new ColumnMetaData(); colmd.setName(colName); colmd.setAllowsNull(Boolean.TRUE); // Allow for elements not in any discriminated collection fkDiscrimMapping = storeMgr.getMappingManager().getMapping(String.class); // Only support String discriminators currently fkDiscrimMapping.setTable(this); if (colmd.getName() == null || colmd.getName().length() < 1) identifier = idFactory.newColumnIdentifier(colmd.getName()); if ((colmd.getAllowsNull() == null) || (colmd.getAllowsNull() != null && colmd.isAllowsNull())) ColumnMetaData colmd = new ColumnMetaData(); colmd.setName(colName); colmd.setAllowsNull(Boolean.TRUE); // Allow for elements not in any discriminated collection fkDiscrimMapping = storeMgr.getMappingManager().getMapping(String.class); // Only support String discriminators currently fkDiscrimMapping.setTable(this);
if (omd.getColumnMetaData() != null && omd.getColumnMetaData().length > 0 && omd.getColumnMetaData()[0].getName() != null) colName = omd.getColumnMetaData()[0].getName(); indexColumnName = idFactory.newColumnIdentifier(colName); if (colmd == null || (colmd.getAllowsNull() == null) || (colmd.getAllowsNull() != null && colmd.isAllowsNull()))
for (int i=0;i<noOfUserColumns;i++) str.append(colmds[i].getName()); if (i < noOfUserColumns-1) String targetColumnName = colmds[i].getTarget(); if (targetColumnName == null) String targetFieldName = colmds[i].getTargetMember(); if (targetFieldName != null) throw new NucleusUserException(Localiser.msg("020004", tableA, colmds[i].getName(), targetColumnName, mappingSideB.getTable(), mappingSideB)).setFatal(); if (colmds[i].getTarget() == null) ColumnMetaData colmd = new ColumnMetaData(); if (updateContainer) ColumnMetaData colmd = new ColumnMetaData(); putColumn(sideBidentifier, colmd);
if (colmd.getJdbcType() == JdbcType.VARCHAR && colmd.getLength() == null) colmd.setLength(storeMgr.getIntProperty(RDBMSPropertyNames.PROPERTY_RDBMS_STRING_DEFAULT_LENGTH)); DatastoreIdentifier colIdentifier = idFactory.newIdentifier(IdentifierType.COLUMN, colmd.getName()); Column col = addColumn(null, colIdentifier, null, colmd); SQLTypeInfo sqlTypeInfo = storeMgr.getSQLTypeInfoForJDBCType(dba.getJDBCTypeForName(colmd.getJdbcTypeName())); col.setTypeInfo(sqlTypeInfo); NucleusLogger.DATASTORE_SCHEMA.debug(Localiser.msg("057011", col.toString(), colmd.getJdbcType()));
IdentifierFactory idFactory = storeMgr.getIdentifierFactory(); DatastoreIdentifier identifier = null; if (colmd.getName() == null) { storeMgr.getNucleusContext().getTypeManager().isDefaultEmbeddedType(fmd.getType()), FieldRole.ROLE_OWNER); colmd.setName(identifier.getIdentifierName()); } else { .newDatastoreFieldIdentifier(colmd.getName(), false, FieldRole.ROLE_CUSTOM); if (colmd.getDefaultValue() != null) { throw new UnsupportedOperationException("User-defined default not supported.");
ColumnMetaData colmd = new ColumnMetaData(); colmd.setName(id.getName()); dismd.setColumnMetaData(colmd); if (colmd.getName() == null) colmd.setName(id.getName()); id = idFactory.newColumnIdentifier(colmd.getName());
columnMetaData[j] = new ColumnMetaData(); columnMetaData[j].setName(cols[j].name()); columnMetaData[j].setTarget(cols[j].referencedColumnName()); columnMetaData[j].setAllowsNull(cols[j].nullable()); columnMetaData[j].setInsertable(cols[j].insertable()); columnMetaData[j].setUpdateable(cols[j].updatable()); columnMetaData[j].setUnique(cols[j].unique()); columnMetaData[0] = new ColumnMetaData(); columnMetaData[0].setName((String)annotationValues.get("name")); columnMetaData[0].setTarget((String)annotationValues.get("referencedColumnName")); columnMetaData[0].setAllowsNull(colNullable); columnMetaData[0].setInsertable(colInsertable); columnMetaData[0].setUpdateable(colUpdateable); columnMetaData[0].setUnique(colUnique); columnMetaData[j] = new ColumnMetaData(); columnMetaData[j].setName(cols[j].name()); columnMetaData[j].setTarget(cols[j].referencedColumnName()); columnMetaData[0] = new ColumnMetaData(); columnMetaData[0].setName((String)annotationValues.get("name")); columnMetaData[0].setTarget((String)annotationValues.get("referencedColumnName")); ColumnMetaData colmd = new ColumnMetaData(); colmd.setName(joinColumns.get(j).name()); colmd.setTarget(joinColumns.get(j).referencedColumnName()); colmd.setAllowsNull(joinColumns.get(j).nullable()); joinmd.addColumn(colmd);
ColumnMetaData disColmd = new ColumnMetaData(); disColmd.setAllowsNull(Boolean.TRUE); disColmd.setName(embDismd.getColumnMetaData().getName()); if (colmd != null && colmd.getName() != null) disColmd.setName(colmd.getName());
columnMetaData = new ColumnMetaData(); if (columnMetaData.getAllowsNull() != null && columnMetaData.isAllowsNull()) if (columnMetaData.getUnique())