protected void addAlterSchema(DbObjectDifference difference, Map<String, Difference<?>> allDiff, List<SqlOperation> sqlList) { DbObjectDifference characterSetDiff = (DbObjectDifference) allDiff .get(SchemaProperties.CHARACTER_SET.getLabel()); DbObjectDifference collationDiff = (DbObjectDifference) allDiff .get(SchemaProperties.COLLATION.getLabel()); DbObjectDifference characterSemanticsDiff = (DbObjectDifference) allDiff .get(SchemaProperties.CHARACTER_SEMANTICS.getLabel()); addAlterSchema(difference, allDiff, characterSetDiff, collationDiff, characterSemanticsDiff, sqlList); }
@SuppressWarnings("unchecked") default T setIndex(Index value){ if (this instanceof DbObject){ value=SchemaUtils.getIndexFromParent(value, (DbCommonObject<?>)this); } SimpleBeanUtils.setField(this, SchemaProperties.INDEX_NAME.getLabel().replaceAll("Name", ""), value); return (T)this; }
default TableSpace getIndexTableSpace(){ TableSpace obj= SimpleBeanUtils.getField(this, SchemaProperties.INDEX_TABLE_SPACE_NAME.getLabel().replaceAll("Name", "")); if (obj != null && obj.getParent() == null) { setIndexTableSpace(obj); } return obj; }
default Function getJoinFunction(){ Function obj= SimpleBeanUtils.getField(this, SchemaProperties.RESTRICT_FUNCTION_NAME.getLabel().replaceAll("Name", "")); if (obj != null && obj.getParent() == null) { setJoinFunction(obj); } return obj; }
default Role getMemberRole(){ Role obj= SimpleBeanUtils.getField(this, SchemaProperties.MEMBER_ROLE_NAME.getLabel().replaceAll("Name", "")); if (obj != null && obj.getParent() == null) { setMemberRole(obj); } return obj; }
@Override protected void writeXmlOptionalAttributes(StaxWriter stax) throws XMLStreamException { super.writeXmlOptionalAttributes(stax); stax.writeAttribute(SchemaProperties.OBJECT_SCHEMA_NAME.getLabel(), this.getObjectSchemaName()); stax.writeAttribute(SchemaProperties.OBJECT_NAME.getLabel(), this.getObjectName()); stax.writeAttribute(SchemaProperties.DB_LINK_NAME.getLabel(), this.getDbLinkName()); }
default User getOwner(){ User obj= SimpleBeanUtils.getField(this, SchemaProperties.OWNER_NAME.getLabel().replaceAll("Name", "")); if (obj != null && obj.getParent() == null) { setOwner(obj); } return obj; }
protected void writeCatalogNameAttribute(StaxWriter stax) throws XMLStreamException { if (this instanceof HasParent) { HasParent<?> hasParent = (HasParent<?>) this; if (hasParent.getParent() == null) { stax.writeAttribute(SchemaProperties.CATALOG_NAME.getLabel(), this.getCatalogName()); } } else { stax.writeAttribute(SchemaProperties.CATALOG_NAME.getLabel(), this.getCatalogName()); } }
@Override protected void writeXmlOptionalAttributes(StaxWriter stax) throws XMLStreamException { super.writeXmlOptionalAttributes(stax); stax.writeAttribute(SchemaProperties.DATA_TYPE.getLabel(), this.getDataType()); stax.writeAttribute(SchemaProperties.DATA_TYPE_NAME.getLabel(), this.getDataTypeName()); }
@Override protected void writeAttributeXml(StaxWriter stax) throws XMLStreamException { super.writeAttributeXml(stax); stax.writeAttribute(SchemaProperties.COLUMN_NAME.getLabel(), this.getColumnName()); }
@Override protected void writeXmlOptionalAttributes(StaxWriter stax) throws XMLStreamException { stax.writeAttribute(SchemaProperties.TABLE_NAME.getLabel(), this.getTableName()); super.writeXmlOptionalAttributes(stax); }
@SuppressWarnings("unchecked") default T setJoinFunction(Function value){ if (this instanceof DbCommonObject){ OperatorArgument leftArgument= SimpleBeanUtils.getField(this, "leftArgument"); OperatorArgument rightArgument= SimpleBeanUtils.getField(this, "rightArgument"); value=SchemaUtils.getFunctionFromParent(value, leftArgument, rightArgument, (DbCommonObject<?>)this); } SimpleBeanUtils.setField(this, SchemaProperties.RESTRICT_FUNCTION_NAME.getLabel().replaceAll("Name", ""), value); return (T)this; }
/** * XML書き込みでオプション属性を書き込みます * * @param stax * @throws XMLStreamException */ @Override protected void writeXmlOptionalAttributes(StaxWriter stax) throws XMLStreamException { super.writeXmlOptionalAttributes(stax); stax.writeAttribute(SchemaProperties.TABLE_NAME.getLabel(), this.getTableName()); }
@SuppressWarnings("unchecked") default T setFunction(Function value){ if (this instanceof DbCommonObject){ OperatorArgument leftArgument= SimpleBeanUtils.getField(this, "leftArgument"); OperatorArgument rightArgument= SimpleBeanUtils.getField(this, "rightArgument"); value=SchemaUtils.getFunctionFromParent(value, leftArgument, rightArgument, (DbCommonObject<?>)this); } SimpleBeanUtils.setField(this, SchemaProperties.FUNCTION_NAME.getLabel().replaceAll("Name", ""), value); return (T)this; }
@Override protected void writeXmlOptionalAttributes(StaxWriter stax) throws XMLStreamException { super.writeXmlOptionalAttributes(stax); stax.writeAttribute(SchemaProperties.CHECK.getLabel(), this.getCheck()); stax.writeAttribute(SchemaProperties.ON_UPDATE.getLabel(), this.getOnUpdate()); if (!isEmpty(this.getCheck())) { stax.writeAttribute(SchemaProperties.DEFERRABILITY.getLabel(), this.getDeferrability()); } }
@Override protected void writeXmlOptionalAttributes(StaxWriter stax) throws XMLStreamException { super.writeXmlOptionalAttributes(stax); stax.writeAttribute(SchemaProperties.STRATEGY_NUMBER.getLabel(), this.getStrategyNumber()); if (this.getOperator() != null && !eq(this.getSchemaName(), this.getOperator().getSchemaName())) { stax.writeAttribute(SchemaProperties.OPERATOR_SCHEMA_NAME.getLabel(), this.getOperator().getSchemaName()); } stax.writeAttribute(SchemaProperties.OPERATOR_NAME.getLabel(), this.getOperatorName()); }
protected void writeCharacterSet(StaxWriter stax) throws XMLStreamException { String value=SchemaUtils.getParentCharacterSet(this); if (!CommonUtils.eqIgnoreCase(value, this.getCharacterSet())) { stax.writeAttribute(SchemaProperties.CHARACTER_SET.getLabel(), this.getCharacterSet()); } }
protected void writeCharacterSemantics(StaxWriter stax) throws XMLStreamException { CharacterSemantics value=SchemaUtils.getParentCharacterSemantics(this); if (!CommonUtils.eq(value, this.getCharacterSemantics())) { stax.writeAttribute(SchemaProperties.CHARACTER_SEMANTICS.getLabel(), this.getCharacterSemantics()); } }
protected void writeAttributeXml(StaxWriter stax) throws XMLStreamException { stax.writeAttribute(SchemaProperties.SCHEMA_NAME.getLabel(), this.getSchemaName()); stax.writeAttribute(getObjectNameLabel(), this.getObjectName()); if (!isEmpty(this.getSpecificName())) { if (!eq(this.getObjectName(), this.getSpecificName())) { stax.writeAttribute(SchemaProperties.SPECIFIC_NAME.getLabel(), this.getSpecificName()); } } }
@Override public String toStringSimple() { ToStringBuilder builder = new ToStringBuilder(this.getSimpleName()); if (this.getParent()==null){ builder.add(SchemaProperties.CATALOG_NAME, this.getCatalogName()); } builder.add(SchemaProperties.NAME.getLabel(), this.getName()); return builder.toString(); }