ru.curs.celesta.syscursors.UserrolesCursor Maven / Gradle / Ivy
package ru.curs.celesta.syscursors;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.function.Consumer;
import javax.annotation.Generated;
import ru.curs.celesta.CallContext;
import ru.curs.celesta.ICelesta;
import ru.curs.celesta.dbutils.BasicCursor;
import ru.curs.celesta.dbutils.CelestaGenerated;
import ru.curs.celesta.dbutils.Cursor;
import ru.curs.celesta.dbutils.CursorIterator;
import ru.curs.celesta.event.TriggerType;
import ru.curs.celesta.score.ColumnMeta;
import ru.curs.celesta.score.Table;
@Generated(
value = "ru.curs.celesta.plugin.maven.CursorGenerator",
date = "2023-02-12T00:37:44.179"
)
@CelestaGenerated
public class UserrolesCursor extends Cursor implements Iterable {
private static final String GRAIN_NAME = "celesta";
private static final String OBJECT_NAME = "userroles";
public static final String TABLE_NAME = OBJECT_NAME;
public final UserrolesCursor.Columns COLUMNS;
private String userid;
private String roleid;
{
this.COLUMNS = new UserrolesCursor.Columns(callContext().getCelesta());
}
public UserrolesCursor(CallContext context) {
super(context);
}
public UserrolesCursor(CallContext context, ColumnMeta>... columns) {
super(context, columns);
}
@Deprecated
public UserrolesCursor(CallContext context, Set fields) {
super(context, fields);
}
public String getUserid() {
return this.userid;
}
public UserrolesCursor setUserid(String userid) {
this.userid = userid;
return this;
}
public String getRoleid() {
return this.roleid;
}
public UserrolesCursor setRoleid(String roleid) {
this.roleid = roleid;
return this;
}
@Override
protected Object _getFieldValue(String name) {
switch (name) {
case "userid": return this.userid;
case "roleid": return this.roleid;
default: return null;
}
}
@Override
protected void _setFieldValue(String name, Object value) {
switch (name) {
case "userid": {
this.userid = (String) value;
break;
}
case "roleid": {
this.roleid = (String) value;
break;
}
default:;
}
}
@Override
protected Object[] _currentKeyValues() {
return new Object[] {userid, roleid};
}
public boolean tryGet(String userid, String roleid) {
return tryGetByValuesArray(userid, roleid);
}
public void get(String userid, String roleid) {
getByValuesArray(userid, roleid);
}
@Override
protected void _parseResultInternal(ResultSet rs) throws SQLException {
if (this.inRec("userid")) {
this.userid = rs.getString("userid");
if (rs.wasNull()) {
this.userid = null;
}
}
if (this.inRec("roleid")) {
this.roleid = rs.getString("roleid");
if (rs.wasNull()) {
this.roleid = null;
}
}
this.setRecversion(rs.getInt("recversion"));
}
@Override
public void _clearBuffer(boolean withKeys) {
if (withKeys) {
this.userid = null;
this.roleid = null;
}
}
@Override
public Object[] _currentValues() {
return new Object[] {userid, roleid};
}
@Override
protected void _setAutoIncrement(int val) {
}
public static void onPreDelete(ICelesta celesta,
Consumer super UserrolesCursor> cursorConsumer) {
celesta.getTriggerDispatcher().registerTrigger(TriggerType.PRE_DELETE, UserrolesCursor.class, cursorConsumer);
}
public static void onPostDelete(ICelesta celesta,
Consumer super UserrolesCursor> cursorConsumer) {
celesta.getTriggerDispatcher().registerTrigger(TriggerType.POST_DELETE, UserrolesCursor.class, cursorConsumer);
}
public static void onPreInsert(ICelesta celesta,
Consumer super UserrolesCursor> cursorConsumer) {
celesta.getTriggerDispatcher().registerTrigger(TriggerType.PRE_INSERT, UserrolesCursor.class, cursorConsumer);
}
public static void onPostInsert(ICelesta celesta,
Consumer super UserrolesCursor> cursorConsumer) {
celesta.getTriggerDispatcher().registerTrigger(TriggerType.POST_INSERT, UserrolesCursor.class, cursorConsumer);
}
public static void onPreUpdate(ICelesta celesta,
Consumer super UserrolesCursor> cursorConsumer) {
celesta.getTriggerDispatcher().registerTrigger(TriggerType.PRE_UPDATE, UserrolesCursor.class, cursorConsumer);
}
public static void onPostUpdate(ICelesta celesta,
Consumer super UserrolesCursor> cursorConsumer) {
celesta.getTriggerDispatcher().registerTrigger(TriggerType.POST_UPDATE, UserrolesCursor.class, cursorConsumer);
}
@Override
public UserrolesCursor _getBufferCopy(CallContext context, List fields) {
final UserrolesCursor result;
if (Objects.isNull(fields)) {
result = new UserrolesCursor(context);
}
else {
result = new UserrolesCursor(context, new LinkedHashSet<>(fields));
}
result.copyFieldsFrom(this);
return result;
}
@Override
public void copyFieldsFrom(BasicCursor c) {
UserrolesCursor from = (UserrolesCursor)c;
this.userid = from.userid;
this.roleid = from.roleid;
this.setRecversion(from.getRecversion());
}
@Override
public Iterator iterator() {
return new CursorIterator(this);
}
@Override
protected String _grainName() {
return GRAIN_NAME;
}
@Override
protected String _objectName() {
return OBJECT_NAME;
}
@SuppressWarnings("unchecked")
@Generated(
value = "ru.curs.celesta.plugin.maven.CursorGenerator",
date = "2023-02-12T00:37:44.18"
)
@CelestaGenerated
public static final class Columns {
private final Table element;
public Columns(ICelesta celesta) {
this.element = celesta.getScore().getGrains().get(GRAIN_NAME).getElements(Table.class).get(OBJECT_NAME);
}
public ColumnMeta userid() {
return (ColumnMeta) this.element.getColumns().get("userid");
}
public ColumnMeta roleid() {
return (ColumnMeta) this.element.getColumns().get("roleid");
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy