class HiLoKeyGeneratorAdd extends AbstractKeyGeneratorAdd {
static HiLoKeyGeneratorAdd INSTANCE = new HiLoKeyGeneratorAdd();
protected Service<KeyGeneratorFactory> getKeyGeneratorFactory(final OperationContext context, final ModelNode model)
throws OperationFailedException {
final HiLoKeyGeneratorFactory factory = new HiLoKeyGeneratorFactory();
ModelNode node;
if ((node = HiLoKeyGeneratorResourceDefinition.BLOCK_SIZE.resolveModelAttribute(context, model)).isDefined()) {
factory.setBlockSize(node.asLong());
}
if ((node = HiLoKeyGeneratorResourceDefinition.CREATE_TABLE.resolveModelAttribute(context, model)).isDefined()) {
factory.setCreateTable(node.asBoolean());
}
if ((node = HiLoKeyGeneratorResourceDefinition.CREATE_TABLE_DDL.resolveModelAttribute(context, model)).isDefined()) {
factory.setCreateTableDdl(node.asString());
}
if ((node = HiLoKeyGeneratorResourceDefinition.DROP_TABLE.resolveModelAttribute(context, model)).isDefined()) {
factory.setDropTable(node.asBoolean());
}
if ((node = HiLoKeyGeneratorResourceDefinition.ID_COLUMN.resolveModelAttribute(context, model)).isDefined()) {
factory.setIdColumnName(node.asString());
}
if ((node = HiLoKeyGeneratorResourceDefinition.SELECT_HI_DDL.resolveModelAttribute(context, model)).isDefined()) {
factory.setSelectHiSql(node.asString());
}
if ((node = HiLoKeyGeneratorResourceDefinition.SEQUENCE_COLUMN.resolveModelAttribute(context, model)).isDefined()) {
factory.setSequenceColumn(node.asString());
}
if ((node = HiLoKeyGeneratorResourceDefinition.SEQUENCE_NAME.resolveModelAttribute(context, model)).isDefined()) {
factory.setSequenceName(node.asString());
}
if ((node = HiLoKeyGeneratorResourceDefinition.TABLE_NAME.resolveModelAttribute(context, model)).isDefined()) {
factory.setTableName(node.asString());
}
return factory;
}