From bf022d64245664c5bb3919a4ab572861ccfc883b Mon Sep 17 00:00:00 2001 From: averak Date: Sun, 14 Jan 2024 00:01:17 +0900 Subject: [PATCH 01/13] =?UTF-8?q?refs=20#78=20=E3=83=95=E3=83=AC=E3=83=B3?= =?UTF-8?q?=E3=83=89=E6=A9=9F=E8=83=BD=E3=81=AE=E3=83=87=E3=83=BC=E3=82=BF?= =?UTF-8?q?=E3=83=99=E3=83=BC=E3=82=B9=E3=82=B9=E3=82=AD=E3=83=BC=E3=83=9E?= =?UTF-8?q?=E3=82=92=E5=AE=9A=E7=BE=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dao/dto/base/FriendSettingMasterDto.java | 212 ++++++ .../dto/base/FriendSettingMasterExample.java | 612 +++++++++++++++++ .../adapter/dao/dto/base/PlayerFriendDto.java | 213 ++++++ .../dao/dto/base/PlayerFriendExample.java | 622 ++++++++++++++++++ .../dao/dto/base/PlayerFriendRequestDto.java | 213 ++++++ .../dto/base/PlayerFriendRequestExample.java | 622 ++++++++++++++++++ .../base/FriendSettingMasterBaseMapper.java | 181 +++++ .../mapper/base/PlayerFriendBaseMapper.java | 181 +++++ .../base/PlayerFriendRequestBaseMapper.java | 183 ++++++ .../mybatis/plugin/InsertOrUpdatePlugin.kt | 4 +- .../base/FriendSettingMasterBaseMapper.xml | 312 +++++++++ .../dao/base/PlayerFriendBaseMapper.xml | 312 +++++++++ .../base/PlayerFriendRequestBaseMapper.xml | 312 +++++++++ src/main/resources/db/migration/V1_0_0.sql | 35 + 14 files changed, 4013 insertions(+), 1 deletion(-) create mode 100644 app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/FriendSettingMasterDto.java create mode 100644 app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/FriendSettingMasterExample.java create mode 100644 app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/PlayerFriendDto.java create mode 100644 app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/PlayerFriendExample.java create mode 100644 app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/PlayerFriendRequestDto.java create mode 100644 app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/PlayerFriendRequestExample.java create mode 100644 app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base/FriendSettingMasterBaseMapper.java create mode 100644 app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base/PlayerFriendBaseMapper.java create mode 100644 app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base/PlayerFriendRequestBaseMapper.java create mode 100644 src/main/resources/dao/base/FriendSettingMasterBaseMapper.xml create mode 100644 src/main/resources/dao/base/PlayerFriendBaseMapper.xml create mode 100644 src/main/resources/dao/base/PlayerFriendRequestBaseMapper.xml diff --git a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/FriendSettingMasterDto.java b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/FriendSettingMasterDto.java new file mode 100644 index 0000000..1ceb09d --- /dev/null +++ b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/FriendSettingMasterDto.java @@ -0,0 +1,212 @@ +package net.averak.gsync.adapter.dao.dto.base; + +import java.time.LocalDateTime; +import java.util.Objects; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +public class FriendSettingMasterDto extends AbstractDto { + /** + * + * This field was generated by MyBatis Generator. This field corresponds to the + * database column gsync_friend_setting_master.master_version + * + * @mbg.generated + */ + private String masterVersion; + + /** + * + * This field was generated by MyBatis Generator. This field corresponds to the + * database column gsync_friend_setting_master.max_friend_count + * + * @mbg.generated + */ + private Long maxFriendCount; + + /** + * + * This field was generated by MyBatis Generator. This field corresponds to the + * database column gsync_friend_setting_master.max_friend_request_count + * + * @mbg.generated + */ + private Long maxFriendRequestCount; + + /** + * + * This field was generated by MyBatis Generator. This field corresponds to the + * database column gsync_friend_setting_master.created_at + * + * @mbg.generated + */ + private LocalDateTime createdAt; + + /** + * + * This field was generated by MyBatis Generator. This field corresponds to the + * database column gsync_friend_setting_master.updated_at + * + * @mbg.generated + */ + private LocalDateTime updatedAt; + + /** + * This method was generated by MyBatis Generator. This method corresponds to + * the database table gsync_friend_setting_master + * + * @mbg.generated + */ + public FriendSettingMasterDto(@Nonnull String masterVersion, @Nonnull Long maxFriendCount, + @Nonnull Long maxFriendRequestCount, @Nonnull LocalDateTime createdAt, @Nonnull LocalDateTime updatedAt) { + this.masterVersion = masterVersion; + this.maxFriendCount = maxFriendCount; + this.maxFriendRequestCount = maxFriendRequestCount; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + } + + /** + * This method was generated by MyBatis Generator. This method corresponds to + * the database table gsync_friend_setting_master + * + * @mbg.generated + */ + public FriendSettingMasterDto() { + super(); + } + + /** + * This method was generated by MyBatis Generator. This method returns the value + * of the database column gsync_friend_setting_master.master_version + * + * @return the value of gsync_friend_setting_master.master_version + * + * @mbg.generated + */ + @Nonnull + public String getMasterVersion() { + return masterVersion; + } + + /** + * This method was generated by MyBatis Generator. This method sets the value of + * the database column gsync_friend_setting_master.master_version + * + * @param masterVersion + * the value for gsync_friend_setting_master.master_version + * + * @mbg.generated + */ + public void setMasterVersion(@Nonnull String masterVersion) { + this.masterVersion = masterVersion; + } + + /** + * This method was generated by MyBatis Generator. This method returns the value + * of the database column gsync_friend_setting_master.max_friend_count + * + * @return the value of gsync_friend_setting_master.max_friend_count + * + * @mbg.generated + */ + @Nonnull + public Long getMaxFriendCount() { + return maxFriendCount; + } + + /** + * This method was generated by MyBatis Generator. This method sets the value of + * the database column gsync_friend_setting_master.max_friend_count + * + * @param maxFriendCount + * the value for gsync_friend_setting_master.max_friend_count + * + * @mbg.generated + */ + public void setMaxFriendCount(@Nonnull Long maxFriendCount) { + this.maxFriendCount = maxFriendCount; + } + + /** + * This method was generated by MyBatis Generator. This method returns the value + * of the database column gsync_friend_setting_master.max_friend_request_count + * + * @return the value of gsync_friend_setting_master.max_friend_request_count + * + * @mbg.generated + */ + @Nonnull + public Long getMaxFriendRequestCount() { + return maxFriendRequestCount; + } + + /** + * This method was generated by MyBatis Generator. This method sets the value of + * the database column gsync_friend_setting_master.max_friend_request_count + * + * @param maxFriendRequestCount + * the value for gsync_friend_setting_master.max_friend_request_count + * + * @mbg.generated + */ + public void setMaxFriendRequestCount(@Nonnull Long maxFriendRequestCount) { + this.maxFriendRequestCount = maxFriendRequestCount; + } + + /** + * This method was generated by MyBatis Generator. This method returns the value + * of the database column gsync_friend_setting_master.created_at + * + * @return the value of gsync_friend_setting_master.created_at + * + * @mbg.generated + */ + @Nonnull + public LocalDateTime getCreatedAt() { + return createdAt; + } + + /** + * This method was generated by MyBatis Generator. This method sets the value of + * the database column gsync_friend_setting_master.created_at + * + * @param createdAt + * the value for gsync_friend_setting_master.created_at + * + * @mbg.generated + */ + public void setCreatedAt(@Nonnull LocalDateTime createdAt) { + this.createdAt = createdAt; + } + + /** + * This method was generated by MyBatis Generator. This method returns the value + * of the database column gsync_friend_setting_master.updated_at + * + * @return the value of gsync_friend_setting_master.updated_at + * + * @mbg.generated + */ + @Nonnull + public LocalDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * This method was generated by MyBatis Generator. This method sets the value of + * the database column gsync_friend_setting_master.updated_at + * + * @param updatedAt + * the value for gsync_friend_setting_master.updated_at + * + * @mbg.generated + */ + public void setUpdatedAt(@Nonnull LocalDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + public boolean isPrimaryKeyEquals(FriendSettingMasterDto other) { + return Objects.equals(getMasterVersion(), other.getMasterVersion()); + } +} \ No newline at end of file diff --git a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/FriendSettingMasterExample.java b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/FriendSettingMasterExample.java new file mode 100644 index 0000000..ba209d1 --- /dev/null +++ b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/FriendSettingMasterExample.java @@ -0,0 +1,612 @@ +package net.averak.gsync.adapter.dao.dto.base; + +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; + +public class FriendSettingMasterExample { + /** + * This field was generated by MyBatis Generator. This field corresponds to the + * database table gsync_friend_setting_master + * + * @mbg.generated + */ + protected String orderByClause; + + /** + * This field was generated by MyBatis Generator. This field corresponds to the + * database table gsync_friend_setting_master + * + * @mbg.generated + */ + protected boolean distinct; + + /** + * This field was generated by MyBatis Generator. This field corresponds to the + * database table gsync_friend_setting_master + * + * @mbg.generated + */ + protected List oredCriteria; + + /** + * This method was generated by MyBatis Generator. This method corresponds to + * the database table gsync_friend_setting_master + * + * @mbg.generated + */ + public FriendSettingMasterExample() { + oredCriteria = new ArrayList<>(); + } + + /** + * This method was generated by MyBatis Generator. This method corresponds to + * the database table gsync_friend_setting_master + * + * @mbg.generated + */ + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + /** + * This method was generated by MyBatis Generator. This method corresponds to + * the database table gsync_friend_setting_master + * + * @mbg.generated + */ + public String getOrderByClause() { + return orderByClause; + } + + /** + * This method was generated by MyBatis Generator. This method corresponds to + * the database table gsync_friend_setting_master + * + * @mbg.generated + */ + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + /** + * This method was generated by MyBatis Generator. This method corresponds to + * the database table gsync_friend_setting_master + * + * @mbg.generated + */ + public boolean isDistinct() { + return distinct; + } + + /** + * This method was generated by MyBatis Generator. This method corresponds to + * the database table gsync_friend_setting_master + * + * @mbg.generated + */ + public List getOredCriteria() { + return oredCriteria; + } + + /** + * This method was generated by MyBatis Generator. This method corresponds to + * the database table gsync_friend_setting_master + * + * @mbg.generated + */ + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + /** + * This method was generated by MyBatis Generator. This method corresponds to + * the database table gsync_friend_setting_master + * + * @mbg.generated + */ + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + /** + * This method was generated by MyBatis Generator. This method corresponds to + * the database table gsync_friend_setting_master + * + * @mbg.generated + */ + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + /** + * This method was generated by MyBatis Generator. This method corresponds to + * the database table gsync_friend_setting_master + * + * @mbg.generated + */ + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + /** + * This method was generated by MyBatis Generator. This method corresponds to + * the database table gsync_friend_setting_master + * + * @mbg.generated + */ + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + /** + * This class was generated by MyBatis Generator. This class corresponds to the + * database table gsync_friend_setting_master + * + * @mbg.generated + */ + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList<>(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andMasterVersionIsNull() { + addCriterion("`master_version` is null"); + return (Criteria) this; + } + + public Criteria andMasterVersionIsNotNull() { + addCriterion("`master_version` is not null"); + return (Criteria) this; + } + + public Criteria andMasterVersionEqualTo(String value) { + addCriterion("`master_version` =", value, "masterVersion"); + return (Criteria) this; + } + + public Criteria andMasterVersionNotEqualTo(String value) { + addCriterion("`master_version` <>", value, "masterVersion"); + return (Criteria) this; + } + + public Criteria andMasterVersionGreaterThan(String value) { + addCriterion("`master_version` >", value, "masterVersion"); + return (Criteria) this; + } + + public Criteria andMasterVersionGreaterThanOrEqualTo(String value) { + addCriterion("`master_version` >=", value, "masterVersion"); + return (Criteria) this; + } + + public Criteria andMasterVersionLessThan(String value) { + addCriterion("`master_version` <", value, "masterVersion"); + return (Criteria) this; + } + + public Criteria andMasterVersionLessThanOrEqualTo(String value) { + addCriterion("`master_version` <=", value, "masterVersion"); + return (Criteria) this; + } + + public Criteria andMasterVersionLike(String value) { + addCriterion("`master_version` like", value, "masterVersion"); + return (Criteria) this; + } + + public Criteria andMasterVersionNotLike(String value) { + addCriterion("`master_version` not like", value, "masterVersion"); + return (Criteria) this; + } + + public Criteria andMasterVersionIn(List values) { + addCriterion("`master_version` in", values, "masterVersion"); + return (Criteria) this; + } + + public Criteria andMasterVersionNotIn(List values) { + addCriterion("`master_version` not in", values, "masterVersion"); + return (Criteria) this; + } + + public Criteria andMasterVersionBetween(String value1, String value2) { + addCriterion("`master_version` between", value1, value2, "masterVersion"); + return (Criteria) this; + } + + public Criteria andMasterVersionNotBetween(String value1, String value2) { + addCriterion("`master_version` not between", value1, value2, "masterVersion"); + return (Criteria) this; + } + + public Criteria andMaxFriendCountIsNull() { + addCriterion("`max_friend_count` is null"); + return (Criteria) this; + } + + public Criteria andMaxFriendCountIsNotNull() { + addCriterion("`max_friend_count` is not null"); + return (Criteria) this; + } + + public Criteria andMaxFriendCountEqualTo(Long value) { + addCriterion("`max_friend_count` =", value, "maxFriendCount"); + return (Criteria) this; + } + + public Criteria andMaxFriendCountNotEqualTo(Long value) { + addCriterion("`max_friend_count` <>", value, "maxFriendCount"); + return (Criteria) this; + } + + public Criteria andMaxFriendCountGreaterThan(Long value) { + addCriterion("`max_friend_count` >", value, "maxFriendCount"); + return (Criteria) this; + } + + public Criteria andMaxFriendCountGreaterThanOrEqualTo(Long value) { + addCriterion("`max_friend_count` >=", value, "maxFriendCount"); + return (Criteria) this; + } + + public Criteria andMaxFriendCountLessThan(Long value) { + addCriterion("`max_friend_count` <", value, "maxFriendCount"); + return (Criteria) this; + } + + public Criteria andMaxFriendCountLessThanOrEqualTo(Long value) { + addCriterion("`max_friend_count` <=", value, "maxFriendCount"); + return (Criteria) this; + } + + public Criteria andMaxFriendCountIn(List values) { + addCriterion("`max_friend_count` in", values, "maxFriendCount"); + return (Criteria) this; + } + + public Criteria andMaxFriendCountNotIn(List values) { + addCriterion("`max_friend_count` not in", values, "maxFriendCount"); + return (Criteria) this; + } + + public Criteria andMaxFriendCountBetween(Long value1, Long value2) { + addCriterion("`max_friend_count` between", value1, value2, "maxFriendCount"); + return (Criteria) this; + } + + public Criteria andMaxFriendCountNotBetween(Long value1, Long value2) { + addCriterion("`max_friend_count` not between", value1, value2, "maxFriendCount"); + return (Criteria) this; + } + + public Criteria andMaxFriendRequestCountIsNull() { + addCriterion("`max_friend_request_count` is null"); + return (Criteria) this; + } + + public Criteria andMaxFriendRequestCountIsNotNull() { + addCriterion("`max_friend_request_count` is not null"); + return (Criteria) this; + } + + public Criteria andMaxFriendRequestCountEqualTo(Long value) { + addCriterion("`max_friend_request_count` =", value, "maxFriendRequestCount"); + return (Criteria) this; + } + + public Criteria andMaxFriendRequestCountNotEqualTo(Long value) { + addCriterion("`max_friend_request_count` <>", value, "maxFriendRequestCount"); + return (Criteria) this; + } + + public Criteria andMaxFriendRequestCountGreaterThan(Long value) { + addCriterion("`max_friend_request_count` >", value, "maxFriendRequestCount"); + return (Criteria) this; + } + + public Criteria andMaxFriendRequestCountGreaterThanOrEqualTo(Long value) { + addCriterion("`max_friend_request_count` >=", value, "maxFriendRequestCount"); + return (Criteria) this; + } + + public Criteria andMaxFriendRequestCountLessThan(Long value) { + addCriterion("`max_friend_request_count` <", value, "maxFriendRequestCount"); + return (Criteria) this; + } + + public Criteria andMaxFriendRequestCountLessThanOrEqualTo(Long value) { + addCriterion("`max_friend_request_count` <=", value, "maxFriendRequestCount"); + return (Criteria) this; + } + + public Criteria andMaxFriendRequestCountIn(List values) { + addCriterion("`max_friend_request_count` in", values, "maxFriendRequestCount"); + return (Criteria) this; + } + + public Criteria andMaxFriendRequestCountNotIn(List values) { + addCriterion("`max_friend_request_count` not in", values, "maxFriendRequestCount"); + return (Criteria) this; + } + + public Criteria andMaxFriendRequestCountBetween(Long value1, Long value2) { + addCriterion("`max_friend_request_count` between", value1, value2, "maxFriendRequestCount"); + return (Criteria) this; + } + + public Criteria andMaxFriendRequestCountNotBetween(Long value1, Long value2) { + addCriterion("`max_friend_request_count` not between", value1, value2, "maxFriendRequestCount"); + return (Criteria) this; + } + + public Criteria andCreatedAtIsNull() { + addCriterion("`created_at` is null"); + return (Criteria) this; + } + + public Criteria andCreatedAtIsNotNull() { + addCriterion("`created_at` is not null"); + return (Criteria) this; + } + + public Criteria andCreatedAtEqualTo(LocalDateTime value) { + addCriterion("`created_at` =", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtNotEqualTo(LocalDateTime value) { + addCriterion("`created_at` <>", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtGreaterThan(LocalDateTime value) { + addCriterion("`created_at` >", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtGreaterThanOrEqualTo(LocalDateTime value) { + addCriterion("`created_at` >=", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtLessThan(LocalDateTime value) { + addCriterion("`created_at` <", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtLessThanOrEqualTo(LocalDateTime value) { + addCriterion("`created_at` <=", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtIn(List values) { + addCriterion("`created_at` in", values, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtNotIn(List values) { + addCriterion("`created_at` not in", values, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtBetween(LocalDateTime value1, LocalDateTime value2) { + addCriterion("`created_at` between", value1, value2, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtNotBetween(LocalDateTime value1, LocalDateTime value2) { + addCriterion("`created_at` not between", value1, value2, "createdAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtIsNull() { + addCriterion("`updated_at` is null"); + return (Criteria) this; + } + + public Criteria andUpdatedAtIsNotNull() { + addCriterion("`updated_at` is not null"); + return (Criteria) this; + } + + public Criteria andUpdatedAtEqualTo(LocalDateTime value) { + addCriterion("`updated_at` =", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtNotEqualTo(LocalDateTime value) { + addCriterion("`updated_at` <>", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtGreaterThan(LocalDateTime value) { + addCriterion("`updated_at` >", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtGreaterThanOrEqualTo(LocalDateTime value) { + addCriterion("`updated_at` >=", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtLessThan(LocalDateTime value) { + addCriterion("`updated_at` <", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtLessThanOrEqualTo(LocalDateTime value) { + addCriterion("`updated_at` <=", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtIn(List values) { + addCriterion("`updated_at` in", values, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtNotIn(List values) { + addCriterion("`updated_at` not in", values, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtBetween(LocalDateTime value1, LocalDateTime value2) { + addCriterion("`updated_at` between", value1, value2, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtNotBetween(LocalDateTime value1, LocalDateTime value2) { + addCriterion("`updated_at` not between", value1, value2, "updatedAt"); + return (Criteria) this; + } + } + + /** + * This class was generated by MyBatis Generator. This class corresponds to the + * database table gsync_friend_setting_master + * + * @mbg.generated do_not_delete_during_merge + */ + public static class Criteria extends GeneratedCriteria { + protected Criteria() { + super(); + } + } + + /** + * This class was generated by MyBatis Generator. This class corresponds to the + * database table gsync_friend_setting_master + * + * @mbg.generated + */ + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/PlayerFriendDto.java b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/PlayerFriendDto.java new file mode 100644 index 0000000..afb0100 --- /dev/null +++ b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/PlayerFriendDto.java @@ -0,0 +1,213 @@ +package net.averak.gsync.adapter.dao.dto.base; + +import java.time.LocalDateTime; +import java.util.Objects; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +public class PlayerFriendDto extends AbstractDto { + /** + * + * This field was generated by MyBatis Generator. This field corresponds to the + * database column gsync_player_friend.player_id + * + * @mbg.generated + */ + private String playerId; + + /** + * + * This field was generated by MyBatis Generator. This field corresponds to the + * database column gsync_player_friend.friend_player_id + * + * @mbg.generated + */ + private String friendPlayerId; + + /** + * + * This field was generated by MyBatis Generator. This field corresponds to the + * database column gsync_player_friend.become_friend_at + * + * @mbg.generated + */ + private LocalDateTime becomeFriendAt; + + /** + * + * This field was generated by MyBatis Generator. This field corresponds to the + * database column gsync_player_friend.created_at + * + * @mbg.generated + */ + private LocalDateTime createdAt; + + /** + * + * This field was generated by MyBatis Generator. This field corresponds to the + * database column gsync_player_friend.updated_at + * + * @mbg.generated + */ + private LocalDateTime updatedAt; + + /** + * This method was generated by MyBatis Generator. This method corresponds to + * the database table gsync_player_friend + * + * @mbg.generated + */ + public PlayerFriendDto(@Nonnull String playerId, @Nonnull String friendPlayerId, + @Nonnull LocalDateTime becomeFriendAt, @Nonnull LocalDateTime createdAt, @Nonnull LocalDateTime updatedAt) { + this.playerId = playerId; + this.friendPlayerId = friendPlayerId; + this.becomeFriendAt = becomeFriendAt; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + } + + /** + * This method was generated by MyBatis Generator. This method corresponds to + * the database table gsync_player_friend + * + * @mbg.generated + */ + public PlayerFriendDto() { + super(); + } + + /** + * This method was generated by MyBatis Generator. This method returns the value + * of the database column gsync_player_friend.player_id + * + * @return the value of gsync_player_friend.player_id + * + * @mbg.generated + */ + @Nonnull + public String getPlayerId() { + return playerId; + } + + /** + * This method was generated by MyBatis Generator. This method sets the value of + * the database column gsync_player_friend.player_id + * + * @param playerId + * the value for gsync_player_friend.player_id + * + * @mbg.generated + */ + public void setPlayerId(@Nonnull String playerId) { + this.playerId = playerId; + } + + /** + * This method was generated by MyBatis Generator. This method returns the value + * of the database column gsync_player_friend.friend_player_id + * + * @return the value of gsync_player_friend.friend_player_id + * + * @mbg.generated + */ + @Nonnull + public String getFriendPlayerId() { + return friendPlayerId; + } + + /** + * This method was generated by MyBatis Generator. This method sets the value of + * the database column gsync_player_friend.friend_player_id + * + * @param friendPlayerId + * the value for gsync_player_friend.friend_player_id + * + * @mbg.generated + */ + public void setFriendPlayerId(@Nonnull String friendPlayerId) { + this.friendPlayerId = friendPlayerId; + } + + /** + * This method was generated by MyBatis Generator. This method returns the value + * of the database column gsync_player_friend.become_friend_at + * + * @return the value of gsync_player_friend.become_friend_at + * + * @mbg.generated + */ + @Nonnull + public LocalDateTime getBecomeFriendAt() { + return becomeFriendAt; + } + + /** + * This method was generated by MyBatis Generator. This method sets the value of + * the database column gsync_player_friend.become_friend_at + * + * @param becomeFriendAt + * the value for gsync_player_friend.become_friend_at + * + * @mbg.generated + */ + public void setBecomeFriendAt(@Nonnull LocalDateTime becomeFriendAt) { + this.becomeFriendAt = becomeFriendAt; + } + + /** + * This method was generated by MyBatis Generator. This method returns the value + * of the database column gsync_player_friend.created_at + * + * @return the value of gsync_player_friend.created_at + * + * @mbg.generated + */ + @Nonnull + public LocalDateTime getCreatedAt() { + return createdAt; + } + + /** + * This method was generated by MyBatis Generator. This method sets the value of + * the database column gsync_player_friend.created_at + * + * @param createdAt + * the value for gsync_player_friend.created_at + * + * @mbg.generated + */ + public void setCreatedAt(@Nonnull LocalDateTime createdAt) { + this.createdAt = createdAt; + } + + /** + * This method was generated by MyBatis Generator. This method returns the value + * of the database column gsync_player_friend.updated_at + * + * @return the value of gsync_player_friend.updated_at + * + * @mbg.generated + */ + @Nonnull + public LocalDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * This method was generated by MyBatis Generator. This method sets the value of + * the database column gsync_player_friend.updated_at + * + * @param updatedAt + * the value for gsync_player_friend.updated_at + * + * @mbg.generated + */ + public void setUpdatedAt(@Nonnull LocalDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + public boolean isPrimaryKeyEquals(PlayerFriendDto other) { + return Objects.equals(getPlayerId(), other.getPlayerId()) + && Objects.equals(getFriendPlayerId(), other.getFriendPlayerId()); + } +} \ No newline at end of file diff --git a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/PlayerFriendExample.java b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/PlayerFriendExample.java new file mode 100644 index 0000000..a795485 --- /dev/null +++ b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/PlayerFriendExample.java @@ -0,0 +1,622 @@ +package net.averak.gsync.adapter.dao.dto.base; + +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; + +public class PlayerFriendExample { + /** + * This field was generated by MyBatis Generator. This field corresponds to the + * database table gsync_player_friend + * + * @mbg.generated + */ + protected String orderByClause; + + /** + * This field was generated by MyBatis Generator. This field corresponds to the + * database table gsync_player_friend + * + * @mbg.generated + */ + protected boolean distinct; + + /** + * This field was generated by MyBatis Generator. This field corresponds to the + * database table gsync_player_friend + * + * @mbg.generated + */ + protected List oredCriteria; + + /** + * This method was generated by MyBatis Generator. This method corresponds to + * the database table gsync_player_friend + * + * @mbg.generated + */ + public PlayerFriendExample() { + oredCriteria = new ArrayList<>(); + } + + /** + * This method was generated by MyBatis Generator. This method corresponds to + * the database table gsync_player_friend + * + * @mbg.generated + */ + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + /** + * This method was generated by MyBatis Generator. This method corresponds to + * the database table gsync_player_friend + * + * @mbg.generated + */ + public String getOrderByClause() { + return orderByClause; + } + + /** + * This method was generated by MyBatis Generator. This method corresponds to + * the database table gsync_player_friend + * + * @mbg.generated + */ + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + /** + * This method was generated by MyBatis Generator. This method corresponds to + * the database table gsync_player_friend + * + * @mbg.generated + */ + public boolean isDistinct() { + return distinct; + } + + /** + * This method was generated by MyBatis Generator. This method corresponds to + * the database table gsync_player_friend + * + * @mbg.generated + */ + public List getOredCriteria() { + return oredCriteria; + } + + /** + * This method was generated by MyBatis Generator. This method corresponds to + * the database table gsync_player_friend + * + * @mbg.generated + */ + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + /** + * This method was generated by MyBatis Generator. This method corresponds to + * the database table gsync_player_friend + * + * @mbg.generated + */ + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + /** + * This method was generated by MyBatis Generator. This method corresponds to + * the database table gsync_player_friend + * + * @mbg.generated + */ + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + /** + * This method was generated by MyBatis Generator. This method corresponds to + * the database table gsync_player_friend + * + * @mbg.generated + */ + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + /** + * This method was generated by MyBatis Generator. This method corresponds to + * the database table gsync_player_friend + * + * @mbg.generated + */ + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + /** + * This class was generated by MyBatis Generator. This class corresponds to the + * database table gsync_player_friend + * + * @mbg.generated + */ + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList<>(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andPlayerIdIsNull() { + addCriterion("`player_id` is null"); + return (Criteria) this; + } + + public Criteria andPlayerIdIsNotNull() { + addCriterion("`player_id` is not null"); + return (Criteria) this; + } + + public Criteria andPlayerIdEqualTo(String value) { + addCriterion("`player_id` =", value, "playerId"); + return (Criteria) this; + } + + public Criteria andPlayerIdNotEqualTo(String value) { + addCriterion("`player_id` <>", value, "playerId"); + return (Criteria) this; + } + + public Criteria andPlayerIdGreaterThan(String value) { + addCriterion("`player_id` >", value, "playerId"); + return (Criteria) this; + } + + public Criteria andPlayerIdGreaterThanOrEqualTo(String value) { + addCriterion("`player_id` >=", value, "playerId"); + return (Criteria) this; + } + + public Criteria andPlayerIdLessThan(String value) { + addCriterion("`player_id` <", value, "playerId"); + return (Criteria) this; + } + + public Criteria andPlayerIdLessThanOrEqualTo(String value) { + addCriterion("`player_id` <=", value, "playerId"); + return (Criteria) this; + } + + public Criteria andPlayerIdLike(String value) { + addCriterion("`player_id` like", value, "playerId"); + return (Criteria) this; + } + + public Criteria andPlayerIdNotLike(String value) { + addCriterion("`player_id` not like", value, "playerId"); + return (Criteria) this; + } + + public Criteria andPlayerIdIn(List values) { + addCriterion("`player_id` in", values, "playerId"); + return (Criteria) this; + } + + public Criteria andPlayerIdNotIn(List values) { + addCriterion("`player_id` not in", values, "playerId"); + return (Criteria) this; + } + + public Criteria andPlayerIdBetween(String value1, String value2) { + addCriterion("`player_id` between", value1, value2, "playerId"); + return (Criteria) this; + } + + public Criteria andPlayerIdNotBetween(String value1, String value2) { + addCriterion("`player_id` not between", value1, value2, "playerId"); + return (Criteria) this; + } + + public Criteria andFriendPlayerIdIsNull() { + addCriterion("`friend_player_id` is null"); + return (Criteria) this; + } + + public Criteria andFriendPlayerIdIsNotNull() { + addCriterion("`friend_player_id` is not null"); + return (Criteria) this; + } + + public Criteria andFriendPlayerIdEqualTo(String value) { + addCriterion("`friend_player_id` =", value, "friendPlayerId"); + return (Criteria) this; + } + + public Criteria andFriendPlayerIdNotEqualTo(String value) { + addCriterion("`friend_player_id` <>", value, "friendPlayerId"); + return (Criteria) this; + } + + public Criteria andFriendPlayerIdGreaterThan(String value) { + addCriterion("`friend_player_id` >", value, "friendPlayerId"); + return (Criteria) this; + } + + public Criteria andFriendPlayerIdGreaterThanOrEqualTo(String value) { + addCriterion("`friend_player_id` >=", value, "friendPlayerId"); + return (Criteria) this; + } + + public Criteria andFriendPlayerIdLessThan(String value) { + addCriterion("`friend_player_id` <", value, "friendPlayerId"); + return (Criteria) this; + } + + public Criteria andFriendPlayerIdLessThanOrEqualTo(String value) { + addCriterion("`friend_player_id` <=", value, "friendPlayerId"); + return (Criteria) this; + } + + public Criteria andFriendPlayerIdLike(String value) { + addCriterion("`friend_player_id` like", value, "friendPlayerId"); + return (Criteria) this; + } + + public Criteria andFriendPlayerIdNotLike(String value) { + addCriterion("`friend_player_id` not like", value, "friendPlayerId"); + return (Criteria) this; + } + + public Criteria andFriendPlayerIdIn(List values) { + addCriterion("`friend_player_id` in", values, "friendPlayerId"); + return (Criteria) this; + } + + public Criteria andFriendPlayerIdNotIn(List values) { + addCriterion("`friend_player_id` not in", values, "friendPlayerId"); + return (Criteria) this; + } + + public Criteria andFriendPlayerIdBetween(String value1, String value2) { + addCriterion("`friend_player_id` between", value1, value2, "friendPlayerId"); + return (Criteria) this; + } + + public Criteria andFriendPlayerIdNotBetween(String value1, String value2) { + addCriterion("`friend_player_id` not between", value1, value2, "friendPlayerId"); + return (Criteria) this; + } + + public Criteria andBecomeFriendAtIsNull() { + addCriterion("`become_friend_at` is null"); + return (Criteria) this; + } + + public Criteria andBecomeFriendAtIsNotNull() { + addCriterion("`become_friend_at` is not null"); + return (Criteria) this; + } + + public Criteria andBecomeFriendAtEqualTo(LocalDateTime value) { + addCriterion("`become_friend_at` =", value, "becomeFriendAt"); + return (Criteria) this; + } + + public Criteria andBecomeFriendAtNotEqualTo(LocalDateTime value) { + addCriterion("`become_friend_at` <>", value, "becomeFriendAt"); + return (Criteria) this; + } + + public Criteria andBecomeFriendAtGreaterThan(LocalDateTime value) { + addCriterion("`become_friend_at` >", value, "becomeFriendAt"); + return (Criteria) this; + } + + public Criteria andBecomeFriendAtGreaterThanOrEqualTo(LocalDateTime value) { + addCriterion("`become_friend_at` >=", value, "becomeFriendAt"); + return (Criteria) this; + } + + public Criteria andBecomeFriendAtLessThan(LocalDateTime value) { + addCriterion("`become_friend_at` <", value, "becomeFriendAt"); + return (Criteria) this; + } + + public Criteria andBecomeFriendAtLessThanOrEqualTo(LocalDateTime value) { + addCriterion("`become_friend_at` <=", value, "becomeFriendAt"); + return (Criteria) this; + } + + public Criteria andBecomeFriendAtIn(List values) { + addCriterion("`become_friend_at` in", values, "becomeFriendAt"); + return (Criteria) this; + } + + public Criteria andBecomeFriendAtNotIn(List values) { + addCriterion("`become_friend_at` not in", values, "becomeFriendAt"); + return (Criteria) this; + } + + public Criteria andBecomeFriendAtBetween(LocalDateTime value1, LocalDateTime value2) { + addCriterion("`become_friend_at` between", value1, value2, "becomeFriendAt"); + return (Criteria) this; + } + + public Criteria andBecomeFriendAtNotBetween(LocalDateTime value1, LocalDateTime value2) { + addCriterion("`become_friend_at` not between", value1, value2, "becomeFriendAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtIsNull() { + addCriterion("`created_at` is null"); + return (Criteria) this; + } + + public Criteria andCreatedAtIsNotNull() { + addCriterion("`created_at` is not null"); + return (Criteria) this; + } + + public Criteria andCreatedAtEqualTo(LocalDateTime value) { + addCriterion("`created_at` =", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtNotEqualTo(LocalDateTime value) { + addCriterion("`created_at` <>", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtGreaterThan(LocalDateTime value) { + addCriterion("`created_at` >", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtGreaterThanOrEqualTo(LocalDateTime value) { + addCriterion("`created_at` >=", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtLessThan(LocalDateTime value) { + addCriterion("`created_at` <", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtLessThanOrEqualTo(LocalDateTime value) { + addCriterion("`created_at` <=", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtIn(List values) { + addCriterion("`created_at` in", values, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtNotIn(List values) { + addCriterion("`created_at` not in", values, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtBetween(LocalDateTime value1, LocalDateTime value2) { + addCriterion("`created_at` between", value1, value2, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtNotBetween(LocalDateTime value1, LocalDateTime value2) { + addCriterion("`created_at` not between", value1, value2, "createdAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtIsNull() { + addCriterion("`updated_at` is null"); + return (Criteria) this; + } + + public Criteria andUpdatedAtIsNotNull() { + addCriterion("`updated_at` is not null"); + return (Criteria) this; + } + + public Criteria andUpdatedAtEqualTo(LocalDateTime value) { + addCriterion("`updated_at` =", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtNotEqualTo(LocalDateTime value) { + addCriterion("`updated_at` <>", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtGreaterThan(LocalDateTime value) { + addCriterion("`updated_at` >", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtGreaterThanOrEqualTo(LocalDateTime value) { + addCriterion("`updated_at` >=", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtLessThan(LocalDateTime value) { + addCriterion("`updated_at` <", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtLessThanOrEqualTo(LocalDateTime value) { + addCriterion("`updated_at` <=", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtIn(List values) { + addCriterion("`updated_at` in", values, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtNotIn(List values) { + addCriterion("`updated_at` not in", values, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtBetween(LocalDateTime value1, LocalDateTime value2) { + addCriterion("`updated_at` between", value1, value2, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtNotBetween(LocalDateTime value1, LocalDateTime value2) { + addCriterion("`updated_at` not between", value1, value2, "updatedAt"); + return (Criteria) this; + } + } + + /** + * This class was generated by MyBatis Generator. This class corresponds to the + * database table gsync_player_friend + * + * @mbg.generated do_not_delete_during_merge + */ + public static class Criteria extends GeneratedCriteria { + protected Criteria() { + super(); + } + } + + /** + * This class was generated by MyBatis Generator. This class corresponds to the + * database table gsync_player_friend + * + * @mbg.generated + */ + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/PlayerFriendRequestDto.java b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/PlayerFriendRequestDto.java new file mode 100644 index 0000000..dbe4fe7 --- /dev/null +++ b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/PlayerFriendRequestDto.java @@ -0,0 +1,213 @@ +package net.averak.gsync.adapter.dao.dto.base; + +import java.time.LocalDateTime; +import java.util.Objects; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +public class PlayerFriendRequestDto extends AbstractDto { + /** + * + * This field was generated by MyBatis Generator. This field corresponds to the + * database column gsync_player_friend_request.player_id + * + * @mbg.generated + */ + private String playerId; + + /** + * + * This field was generated by MyBatis Generator. This field corresponds to the + * database column gsync_player_friend_request.receiver_player_id + * + * @mbg.generated + */ + private String receiverPlayerId; + + /** + * + * This field was generated by MyBatis Generator. This field corresponds to the + * database column gsync_player_friend_request.sent_at + * + * @mbg.generated + */ + private LocalDateTime sentAt; + + /** + * + * This field was generated by MyBatis Generator. This field corresponds to the + * database column gsync_player_friend_request.created_at + * + * @mbg.generated + */ + private LocalDateTime createdAt; + + /** + * + * This field was generated by MyBatis Generator. This field corresponds to the + * database column gsync_player_friend_request.updated_at + * + * @mbg.generated + */ + private LocalDateTime updatedAt; + + /** + * This method was generated by MyBatis Generator. This method corresponds to + * the database table gsync_player_friend_request + * + * @mbg.generated + */ + public PlayerFriendRequestDto(@Nonnull String playerId, @Nonnull String receiverPlayerId, + @Nonnull LocalDateTime sentAt, @Nonnull LocalDateTime createdAt, @Nonnull LocalDateTime updatedAt) { + this.playerId = playerId; + this.receiverPlayerId = receiverPlayerId; + this.sentAt = sentAt; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + } + + /** + * This method was generated by MyBatis Generator. This method corresponds to + * the database table gsync_player_friend_request + * + * @mbg.generated + */ + public PlayerFriendRequestDto() { + super(); + } + + /** + * This method was generated by MyBatis Generator. This method returns the value + * of the database column gsync_player_friend_request.player_id + * + * @return the value of gsync_player_friend_request.player_id + * + * @mbg.generated + */ + @Nonnull + public String getPlayerId() { + return playerId; + } + + /** + * This method was generated by MyBatis Generator. This method sets the value of + * the database column gsync_player_friend_request.player_id + * + * @param playerId + * the value for gsync_player_friend_request.player_id + * + * @mbg.generated + */ + public void setPlayerId(@Nonnull String playerId) { + this.playerId = playerId; + } + + /** + * This method was generated by MyBatis Generator. This method returns the value + * of the database column gsync_player_friend_request.receiver_player_id + * + * @return the value of gsync_player_friend_request.receiver_player_id + * + * @mbg.generated + */ + @Nonnull + public String getReceiverPlayerId() { + return receiverPlayerId; + } + + /** + * This method was generated by MyBatis Generator. This method sets the value of + * the database column gsync_player_friend_request.receiver_player_id + * + * @param receiverPlayerId + * the value for gsync_player_friend_request.receiver_player_id + * + * @mbg.generated + */ + public void setReceiverPlayerId(@Nonnull String receiverPlayerId) { + this.receiverPlayerId = receiverPlayerId; + } + + /** + * This method was generated by MyBatis Generator. This method returns the value + * of the database column gsync_player_friend_request.sent_at + * + * @return the value of gsync_player_friend_request.sent_at + * + * @mbg.generated + */ + @Nonnull + public LocalDateTime getSentAt() { + return sentAt; + } + + /** + * This method was generated by MyBatis Generator. This method sets the value of + * the database column gsync_player_friend_request.sent_at + * + * @param sentAt + * the value for gsync_player_friend_request.sent_at + * + * @mbg.generated + */ + public void setSentAt(@Nonnull LocalDateTime sentAt) { + this.sentAt = sentAt; + } + + /** + * This method was generated by MyBatis Generator. This method returns the value + * of the database column gsync_player_friend_request.created_at + * + * @return the value of gsync_player_friend_request.created_at + * + * @mbg.generated + */ + @Nonnull + public LocalDateTime getCreatedAt() { + return createdAt; + } + + /** + * This method was generated by MyBatis Generator. This method sets the value of + * the database column gsync_player_friend_request.created_at + * + * @param createdAt + * the value for gsync_player_friend_request.created_at + * + * @mbg.generated + */ + public void setCreatedAt(@Nonnull LocalDateTime createdAt) { + this.createdAt = createdAt; + } + + /** + * This method was generated by MyBatis Generator. This method returns the value + * of the database column gsync_player_friend_request.updated_at + * + * @return the value of gsync_player_friend_request.updated_at + * + * @mbg.generated + */ + @Nonnull + public LocalDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * This method was generated by MyBatis Generator. This method sets the value of + * the database column gsync_player_friend_request.updated_at + * + * @param updatedAt + * the value for gsync_player_friend_request.updated_at + * + * @mbg.generated + */ + public void setUpdatedAt(@Nonnull LocalDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + public boolean isPrimaryKeyEquals(PlayerFriendRequestDto other) { + return Objects.equals(getPlayerId(), other.getPlayerId()) + && Objects.equals(getReceiverPlayerId(), other.getReceiverPlayerId()); + } +} \ No newline at end of file diff --git a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/PlayerFriendRequestExample.java b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/PlayerFriendRequestExample.java new file mode 100644 index 0000000..9352592 --- /dev/null +++ b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/PlayerFriendRequestExample.java @@ -0,0 +1,622 @@ +package net.averak.gsync.adapter.dao.dto.base; + +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; + +public class PlayerFriendRequestExample { + /** + * This field was generated by MyBatis Generator. This field corresponds to the + * database table gsync_player_friend_request + * + * @mbg.generated + */ + protected String orderByClause; + + /** + * This field was generated by MyBatis Generator. This field corresponds to the + * database table gsync_player_friend_request + * + * @mbg.generated + */ + protected boolean distinct; + + /** + * This field was generated by MyBatis Generator. This field corresponds to the + * database table gsync_player_friend_request + * + * @mbg.generated + */ + protected List oredCriteria; + + /** + * This method was generated by MyBatis Generator. This method corresponds to + * the database table gsync_player_friend_request + * + * @mbg.generated + */ + public PlayerFriendRequestExample() { + oredCriteria = new ArrayList<>(); + } + + /** + * This method was generated by MyBatis Generator. This method corresponds to + * the database table gsync_player_friend_request + * + * @mbg.generated + */ + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + /** + * This method was generated by MyBatis Generator. This method corresponds to + * the database table gsync_player_friend_request + * + * @mbg.generated + */ + public String getOrderByClause() { + return orderByClause; + } + + /** + * This method was generated by MyBatis Generator. This method corresponds to + * the database table gsync_player_friend_request + * + * @mbg.generated + */ + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + /** + * This method was generated by MyBatis Generator. This method corresponds to + * the database table gsync_player_friend_request + * + * @mbg.generated + */ + public boolean isDistinct() { + return distinct; + } + + /** + * This method was generated by MyBatis Generator. This method corresponds to + * the database table gsync_player_friend_request + * + * @mbg.generated + */ + public List getOredCriteria() { + return oredCriteria; + } + + /** + * This method was generated by MyBatis Generator. This method corresponds to + * the database table gsync_player_friend_request + * + * @mbg.generated + */ + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + /** + * This method was generated by MyBatis Generator. This method corresponds to + * the database table gsync_player_friend_request + * + * @mbg.generated + */ + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + /** + * This method was generated by MyBatis Generator. This method corresponds to + * the database table gsync_player_friend_request + * + * @mbg.generated + */ + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + /** + * This method was generated by MyBatis Generator. This method corresponds to + * the database table gsync_player_friend_request + * + * @mbg.generated + */ + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + /** + * This method was generated by MyBatis Generator. This method corresponds to + * the database table gsync_player_friend_request + * + * @mbg.generated + */ + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + /** + * This class was generated by MyBatis Generator. This class corresponds to the + * database table gsync_player_friend_request + * + * @mbg.generated + */ + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList<>(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andPlayerIdIsNull() { + addCriterion("`player_id` is null"); + return (Criteria) this; + } + + public Criteria andPlayerIdIsNotNull() { + addCriterion("`player_id` is not null"); + return (Criteria) this; + } + + public Criteria andPlayerIdEqualTo(String value) { + addCriterion("`player_id` =", value, "playerId"); + return (Criteria) this; + } + + public Criteria andPlayerIdNotEqualTo(String value) { + addCriterion("`player_id` <>", value, "playerId"); + return (Criteria) this; + } + + public Criteria andPlayerIdGreaterThan(String value) { + addCriterion("`player_id` >", value, "playerId"); + return (Criteria) this; + } + + public Criteria andPlayerIdGreaterThanOrEqualTo(String value) { + addCriterion("`player_id` >=", value, "playerId"); + return (Criteria) this; + } + + public Criteria andPlayerIdLessThan(String value) { + addCriterion("`player_id` <", value, "playerId"); + return (Criteria) this; + } + + public Criteria andPlayerIdLessThanOrEqualTo(String value) { + addCriterion("`player_id` <=", value, "playerId"); + return (Criteria) this; + } + + public Criteria andPlayerIdLike(String value) { + addCriterion("`player_id` like", value, "playerId"); + return (Criteria) this; + } + + public Criteria andPlayerIdNotLike(String value) { + addCriterion("`player_id` not like", value, "playerId"); + return (Criteria) this; + } + + public Criteria andPlayerIdIn(List values) { + addCriterion("`player_id` in", values, "playerId"); + return (Criteria) this; + } + + public Criteria andPlayerIdNotIn(List values) { + addCriterion("`player_id` not in", values, "playerId"); + return (Criteria) this; + } + + public Criteria andPlayerIdBetween(String value1, String value2) { + addCriterion("`player_id` between", value1, value2, "playerId"); + return (Criteria) this; + } + + public Criteria andPlayerIdNotBetween(String value1, String value2) { + addCriterion("`player_id` not between", value1, value2, "playerId"); + return (Criteria) this; + } + + public Criteria andReceiverPlayerIdIsNull() { + addCriterion("`receiver_player_id` is null"); + return (Criteria) this; + } + + public Criteria andReceiverPlayerIdIsNotNull() { + addCriterion("`receiver_player_id` is not null"); + return (Criteria) this; + } + + public Criteria andReceiverPlayerIdEqualTo(String value) { + addCriterion("`receiver_player_id` =", value, "receiverPlayerId"); + return (Criteria) this; + } + + public Criteria andReceiverPlayerIdNotEqualTo(String value) { + addCriterion("`receiver_player_id` <>", value, "receiverPlayerId"); + return (Criteria) this; + } + + public Criteria andReceiverPlayerIdGreaterThan(String value) { + addCriterion("`receiver_player_id` >", value, "receiverPlayerId"); + return (Criteria) this; + } + + public Criteria andReceiverPlayerIdGreaterThanOrEqualTo(String value) { + addCriterion("`receiver_player_id` >=", value, "receiverPlayerId"); + return (Criteria) this; + } + + public Criteria andReceiverPlayerIdLessThan(String value) { + addCriterion("`receiver_player_id` <", value, "receiverPlayerId"); + return (Criteria) this; + } + + public Criteria andReceiverPlayerIdLessThanOrEqualTo(String value) { + addCriterion("`receiver_player_id` <=", value, "receiverPlayerId"); + return (Criteria) this; + } + + public Criteria andReceiverPlayerIdLike(String value) { + addCriterion("`receiver_player_id` like", value, "receiverPlayerId"); + return (Criteria) this; + } + + public Criteria andReceiverPlayerIdNotLike(String value) { + addCriterion("`receiver_player_id` not like", value, "receiverPlayerId"); + return (Criteria) this; + } + + public Criteria andReceiverPlayerIdIn(List values) { + addCriterion("`receiver_player_id` in", values, "receiverPlayerId"); + return (Criteria) this; + } + + public Criteria andReceiverPlayerIdNotIn(List values) { + addCriterion("`receiver_player_id` not in", values, "receiverPlayerId"); + return (Criteria) this; + } + + public Criteria andReceiverPlayerIdBetween(String value1, String value2) { + addCriterion("`receiver_player_id` between", value1, value2, "receiverPlayerId"); + return (Criteria) this; + } + + public Criteria andReceiverPlayerIdNotBetween(String value1, String value2) { + addCriterion("`receiver_player_id` not between", value1, value2, "receiverPlayerId"); + return (Criteria) this; + } + + public Criteria andSentAtIsNull() { + addCriterion("`sent_at` is null"); + return (Criteria) this; + } + + public Criteria andSentAtIsNotNull() { + addCriterion("`sent_at` is not null"); + return (Criteria) this; + } + + public Criteria andSentAtEqualTo(LocalDateTime value) { + addCriterion("`sent_at` =", value, "sentAt"); + return (Criteria) this; + } + + public Criteria andSentAtNotEqualTo(LocalDateTime value) { + addCriterion("`sent_at` <>", value, "sentAt"); + return (Criteria) this; + } + + public Criteria andSentAtGreaterThan(LocalDateTime value) { + addCriterion("`sent_at` >", value, "sentAt"); + return (Criteria) this; + } + + public Criteria andSentAtGreaterThanOrEqualTo(LocalDateTime value) { + addCriterion("`sent_at` >=", value, "sentAt"); + return (Criteria) this; + } + + public Criteria andSentAtLessThan(LocalDateTime value) { + addCriterion("`sent_at` <", value, "sentAt"); + return (Criteria) this; + } + + public Criteria andSentAtLessThanOrEqualTo(LocalDateTime value) { + addCriterion("`sent_at` <=", value, "sentAt"); + return (Criteria) this; + } + + public Criteria andSentAtIn(List values) { + addCriterion("`sent_at` in", values, "sentAt"); + return (Criteria) this; + } + + public Criteria andSentAtNotIn(List values) { + addCriterion("`sent_at` not in", values, "sentAt"); + return (Criteria) this; + } + + public Criteria andSentAtBetween(LocalDateTime value1, LocalDateTime value2) { + addCriterion("`sent_at` between", value1, value2, "sentAt"); + return (Criteria) this; + } + + public Criteria andSentAtNotBetween(LocalDateTime value1, LocalDateTime value2) { + addCriterion("`sent_at` not between", value1, value2, "sentAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtIsNull() { + addCriterion("`created_at` is null"); + return (Criteria) this; + } + + public Criteria andCreatedAtIsNotNull() { + addCriterion("`created_at` is not null"); + return (Criteria) this; + } + + public Criteria andCreatedAtEqualTo(LocalDateTime value) { + addCriterion("`created_at` =", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtNotEqualTo(LocalDateTime value) { + addCriterion("`created_at` <>", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtGreaterThan(LocalDateTime value) { + addCriterion("`created_at` >", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtGreaterThanOrEqualTo(LocalDateTime value) { + addCriterion("`created_at` >=", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtLessThan(LocalDateTime value) { + addCriterion("`created_at` <", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtLessThanOrEqualTo(LocalDateTime value) { + addCriterion("`created_at` <=", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtIn(List values) { + addCriterion("`created_at` in", values, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtNotIn(List values) { + addCriterion("`created_at` not in", values, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtBetween(LocalDateTime value1, LocalDateTime value2) { + addCriterion("`created_at` between", value1, value2, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtNotBetween(LocalDateTime value1, LocalDateTime value2) { + addCriterion("`created_at` not between", value1, value2, "createdAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtIsNull() { + addCriterion("`updated_at` is null"); + return (Criteria) this; + } + + public Criteria andUpdatedAtIsNotNull() { + addCriterion("`updated_at` is not null"); + return (Criteria) this; + } + + public Criteria andUpdatedAtEqualTo(LocalDateTime value) { + addCriterion("`updated_at` =", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtNotEqualTo(LocalDateTime value) { + addCriterion("`updated_at` <>", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtGreaterThan(LocalDateTime value) { + addCriterion("`updated_at` >", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtGreaterThanOrEqualTo(LocalDateTime value) { + addCriterion("`updated_at` >=", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtLessThan(LocalDateTime value) { + addCriterion("`updated_at` <", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtLessThanOrEqualTo(LocalDateTime value) { + addCriterion("`updated_at` <=", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtIn(List values) { + addCriterion("`updated_at` in", values, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtNotIn(List values) { + addCriterion("`updated_at` not in", values, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtBetween(LocalDateTime value1, LocalDateTime value2) { + addCriterion("`updated_at` between", value1, value2, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtNotBetween(LocalDateTime value1, LocalDateTime value2) { + addCriterion("`updated_at` not between", value1, value2, "updatedAt"); + return (Criteria) this; + } + } + + /** + * This class was generated by MyBatis Generator. This class corresponds to the + * database table gsync_player_friend_request + * + * @mbg.generated do_not_delete_during_merge + */ + public static class Criteria extends GeneratedCriteria { + protected Criteria() { + super(); + } + } + + /** + * This class was generated by MyBatis Generator. This class corresponds to the + * database table gsync_player_friend_request + * + * @mbg.generated + */ + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base/FriendSettingMasterBaseMapper.java b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base/FriendSettingMasterBaseMapper.java new file mode 100644 index 0000000..892318f --- /dev/null +++ b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base/FriendSettingMasterBaseMapper.java @@ -0,0 +1,181 @@ +package net.averak.gsync.adapter.dao.mapper.base; + +import java.util.List; +import net.averak.gsync.adapter.dao.dto.base.FriendSettingMasterDto; +import net.averak.gsync.adapter.dao.dto.base.FriendSettingMasterExample; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.session.RowBounds; + +@Mapper +@SuppressWarnings({"JavadocDeclaration", "DuplicatedCode"}) +public interface FriendSettingMasterBaseMapper { + /** + * This method was generated by MyBatis Generator. This method corresponds to + * the database table gsync_friend_setting_master + * + * @mbg.generated + */ + long countByExample(FriendSettingMasterExample example); + + /** + * This method was generated by MyBatis Generator. This method corresponds to + * the database table gsync_friend_setting_master + * + * @mbg.generated + */ + int deleteByExample(FriendSettingMasterExample example); + + /** + * This method was generated by MyBatis Generator. This method corresponds to + * the database table gsync_friend_setting_master + * + * @mbg.generated + */ + int deleteByPrimaryKey(String masterVersion); + + /** + * This method was generated by MyBatis Generator. This method corresponds to + * the database table gsync_friend_setting_master + * + * @mbg.generated + */ + int insert(FriendSettingMasterDto row); + + /** + * This method was generated by MyBatis Generator. This method corresponds to + * the database table gsync_friend_setting_master + * + * @mbg.generated + */ + int insertSelective(FriendSettingMasterDto row); + + /** + * This method was generated by MyBatis Generator. This method corresponds to + * the database table gsync_friend_setting_master + * + * @mbg.generated + */ + List selectByExampleWithRowbounds(FriendSettingMasterExample example, RowBounds rowBounds); + + /** + * This method was generated by MyBatis Generator. This method corresponds to + * the database table gsync_friend_setting_master + * + * @mbg.generated + */ + List selectByExample(FriendSettingMasterExample example); + + /** + * This method was generated by MyBatis Generator. This method corresponds to + * the database table gsync_friend_setting_master + * + * @mbg.generated + */ + FriendSettingMasterDto selectByPrimaryKey(String masterVersion); + + /** + * This method was generated by MyBatis Generator. This method corresponds to + * the database table gsync_friend_setting_master + * + * @mbg.generated + */ + int updateByExampleSelective(@Param("row") FriendSettingMasterDto row, + @Param("example") FriendSettingMasterExample example); + + /** + * This method was generated by MyBatis Generator. This method corresponds to + * the database table gsync_friend_setting_master + * + * @mbg.generated + */ + int updateByExample(@Param("row") FriendSettingMasterDto row, @Param("example") FriendSettingMasterExample example); + + /** + * This method was generated by MyBatis Generator. This method corresponds to + * the database table gsync_friend_setting_master + * + * @mbg.generated + */ + int updateByPrimaryKeySelective(FriendSettingMasterDto row); + + /** + * This method was generated by MyBatis Generator. This method corresponds to + * the database table gsync_friend_setting_master + * + * @mbg.generated + */ + int updateByPrimaryKey(FriendSettingMasterDto row); + + /** + * 複数レコードを一括で INSERT する + * + * @mbg.generated + */ + void bulkInsert(@Param("dtos") List dtos); + + /** + * PK でレコード検索し、存在する場合は original にセットする + * + * @mbg.generated + */ + default void syncOriginal(FriendSettingMasterDto dto) { + dto.setOriginal(selectByPrimaryKey(dto.getMasterVersion())); + } + + /** + * PK でレコード検索し、存在する場合は original にセットする + * + * @mbg.generated + */ + default void syncOriginal(List dtos) { + if (dtos.isEmpty()) { + return; + } + + final var example = new FriendSettingMasterExample(); + example.createCriteria() + .andMasterVersionIn(dtos.stream().map(FriendSettingMasterDto::getMasterVersion).toList()); + final var originals = selectByExample(example); + originals.forEach(original -> dtos.forEach(dto -> { + if (dto.isPrimaryKeyEquals(original)) { + dto.setOriginal(original); + } + })); + } + + /** + * original が null の場合は INSERT、そうでない場合は UPDATE を実行する + * + * @mbg.generated + */ + default void insertOrUpdate(FriendSettingMasterDto dto) { + if (dto.getOriginal() == null) { + insert(dto); + } else { + dto.setCreatedAt(dto.getOriginal().getCreatedAt()); + updateByPrimaryKey(dto); + } + } + + /** + * original が null の場合は INSERT、そうでない場合は UPDATE を実行する + * + * @mbg.generated + */ + default void insertOrUpdate(List dtos) { + final var inserts = dtos.stream().filter(dto -> dto.getOriginal() == null).toList(); + if (!inserts.isEmpty()) { + bulkInsert(inserts); + } + + final var updates = dtos.stream().filter(dto -> dto.getOriginal() != null).toList(); + updates.parallelStream().forEach(dto -> { + if (dto.getOriginal() == null) { + return; + } + dto.setCreatedAt(dto.getOriginal().getCreatedAt()); + updateByPrimaryKey(dto); + }); + } +} \ No newline at end of file diff --git a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base/PlayerFriendBaseMapper.java b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base/PlayerFriendBaseMapper.java new file mode 100644 index 0000000..13d334b --- /dev/null +++ b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base/PlayerFriendBaseMapper.java @@ -0,0 +1,181 @@ +package net.averak.gsync.adapter.dao.mapper.base; + +import java.util.List; +import net.averak.gsync.adapter.dao.dto.base.PlayerFriendDto; +import net.averak.gsync.adapter.dao.dto.base.PlayerFriendExample; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.session.RowBounds; + +@Mapper +@SuppressWarnings({"JavadocDeclaration", "DuplicatedCode"}) +public interface PlayerFriendBaseMapper { + /** + * This method was generated by MyBatis Generator. This method corresponds to + * the database table gsync_player_friend + * + * @mbg.generated + */ + long countByExample(PlayerFriendExample example); + + /** + * This method was generated by MyBatis Generator. This method corresponds to + * the database table gsync_player_friend + * + * @mbg.generated + */ + int deleteByExample(PlayerFriendExample example); + + /** + * This method was generated by MyBatis Generator. This method corresponds to + * the database table gsync_player_friend + * + * @mbg.generated + */ + int deleteByPrimaryKey(@Param("playerId") String playerId, @Param("friendPlayerId") String friendPlayerId); + + /** + * This method was generated by MyBatis Generator. This method corresponds to + * the database table gsync_player_friend + * + * @mbg.generated + */ + int insert(PlayerFriendDto row); + + /** + * This method was generated by MyBatis Generator. This method corresponds to + * the database table gsync_player_friend + * + * @mbg.generated + */ + int insertSelective(PlayerFriendDto row); + + /** + * This method was generated by MyBatis Generator. This method corresponds to + * the database table gsync_player_friend + * + * @mbg.generated + */ + List selectByExampleWithRowbounds(PlayerFriendExample example, RowBounds rowBounds); + + /** + * This method was generated by MyBatis Generator. This method corresponds to + * the database table gsync_player_friend + * + * @mbg.generated + */ + List selectByExample(PlayerFriendExample example); + + /** + * This method was generated by MyBatis Generator. This method corresponds to + * the database table gsync_player_friend + * + * @mbg.generated + */ + PlayerFriendDto selectByPrimaryKey(@Param("playerId") String playerId, + @Param("friendPlayerId") String friendPlayerId); + + /** + * This method was generated by MyBatis Generator. This method corresponds to + * the database table gsync_player_friend + * + * @mbg.generated + */ + int updateByExampleSelective(@Param("row") PlayerFriendDto row, @Param("example") PlayerFriendExample example); + + /** + * This method was generated by MyBatis Generator. This method corresponds to + * the database table gsync_player_friend + * + * @mbg.generated + */ + int updateByExample(@Param("row") PlayerFriendDto row, @Param("example") PlayerFriendExample example); + + /** + * This method was generated by MyBatis Generator. This method corresponds to + * the database table gsync_player_friend + * + * @mbg.generated + */ + int updateByPrimaryKeySelective(PlayerFriendDto row); + + /** + * This method was generated by MyBatis Generator. This method corresponds to + * the database table gsync_player_friend + * + * @mbg.generated + */ + int updateByPrimaryKey(PlayerFriendDto row); + + /** + * 複数レコードを一括で INSERT する + * + * @mbg.generated + */ + void bulkInsert(@Param("dtos") List dtos); + + /** + * PK でレコード検索し、存在する場合は original にセットする + * + * @mbg.generated + */ + default void syncOriginal(PlayerFriendDto dto) { + dto.setOriginal(selectByPrimaryKey(dto.getPlayerId(), dto.getFriendPlayerId())); + } + + /** + * PK でレコード検索し、存在する場合は original にセットする + * + * @mbg.generated + */ + default void syncOriginal(List dtos) { + if (dtos.isEmpty()) { + return; + } + + final var example = new PlayerFriendExample(); + example.createCriteria().andPlayerIdIn(dtos.stream().map(PlayerFriendDto::getPlayerId).toList()); + example.createCriteria().andFriendPlayerIdIn(dtos.stream().map(PlayerFriendDto::getFriendPlayerId).toList()); + final var originals = selectByExample(example); + originals.forEach(original -> dtos.forEach(dto -> { + if (dto.isPrimaryKeyEquals(original)) { + dto.setOriginal(original); + } + })); + } + + /** + * original が null の場合は INSERT、そうでない場合は UPDATE を実行する + * + * @mbg.generated + */ + default void insertOrUpdate(PlayerFriendDto dto) { + if (dto.getOriginal() == null) { + insert(dto); + } else { + dto.setCreatedAt(dto.getOriginal().getCreatedAt()); + updateByPrimaryKey(dto); + } + } + + /** + * original が null の場合は INSERT、そうでない場合は UPDATE を実行する + * + * @mbg.generated + */ + default void insertOrUpdate(List dtos) { + final var inserts = dtos.stream().filter(dto -> dto.getOriginal() == null).toList(); + if (!inserts.isEmpty()) { + bulkInsert(inserts); + } + + final var updates = dtos.stream().filter(dto -> dto.getOriginal() != null).toList(); + updates.parallelStream().forEach(dto -> { + if (dto.getOriginal() == null) { + return; + } + dto.setCreatedAt(dto.getOriginal().getCreatedAt()); + updateByPrimaryKey(dto); + }); + } +} \ No newline at end of file diff --git a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base/PlayerFriendRequestBaseMapper.java b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base/PlayerFriendRequestBaseMapper.java new file mode 100644 index 0000000..9668914 --- /dev/null +++ b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base/PlayerFriendRequestBaseMapper.java @@ -0,0 +1,183 @@ +package net.averak.gsync.adapter.dao.mapper.base; + +import java.util.List; +import net.averak.gsync.adapter.dao.dto.base.PlayerFriendRequestDto; +import net.averak.gsync.adapter.dao.dto.base.PlayerFriendRequestExample; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.session.RowBounds; + +@Mapper +@SuppressWarnings({"JavadocDeclaration", "DuplicatedCode"}) +public interface PlayerFriendRequestBaseMapper { + /** + * This method was generated by MyBatis Generator. This method corresponds to + * the database table gsync_player_friend_request + * + * @mbg.generated + */ + long countByExample(PlayerFriendRequestExample example); + + /** + * This method was generated by MyBatis Generator. This method corresponds to + * the database table gsync_player_friend_request + * + * @mbg.generated + */ + int deleteByExample(PlayerFriendRequestExample example); + + /** + * This method was generated by MyBatis Generator. This method corresponds to + * the database table gsync_player_friend_request + * + * @mbg.generated + */ + int deleteByPrimaryKey(@Param("playerId") String playerId, @Param("receiverPlayerId") String receiverPlayerId); + + /** + * This method was generated by MyBatis Generator. This method corresponds to + * the database table gsync_player_friend_request + * + * @mbg.generated + */ + int insert(PlayerFriendRequestDto row); + + /** + * This method was generated by MyBatis Generator. This method corresponds to + * the database table gsync_player_friend_request + * + * @mbg.generated + */ + int insertSelective(PlayerFriendRequestDto row); + + /** + * This method was generated by MyBatis Generator. This method corresponds to + * the database table gsync_player_friend_request + * + * @mbg.generated + */ + List selectByExampleWithRowbounds(PlayerFriendRequestExample example, RowBounds rowBounds); + + /** + * This method was generated by MyBatis Generator. This method corresponds to + * the database table gsync_player_friend_request + * + * @mbg.generated + */ + List selectByExample(PlayerFriendRequestExample example); + + /** + * This method was generated by MyBatis Generator. This method corresponds to + * the database table gsync_player_friend_request + * + * @mbg.generated + */ + PlayerFriendRequestDto selectByPrimaryKey(@Param("playerId") String playerId, + @Param("receiverPlayerId") String receiverPlayerId); + + /** + * This method was generated by MyBatis Generator. This method corresponds to + * the database table gsync_player_friend_request + * + * @mbg.generated + */ + int updateByExampleSelective(@Param("row") PlayerFriendRequestDto row, + @Param("example") PlayerFriendRequestExample example); + + /** + * This method was generated by MyBatis Generator. This method corresponds to + * the database table gsync_player_friend_request + * + * @mbg.generated + */ + int updateByExample(@Param("row") PlayerFriendRequestDto row, @Param("example") PlayerFriendRequestExample example); + + /** + * This method was generated by MyBatis Generator. This method corresponds to + * the database table gsync_player_friend_request + * + * @mbg.generated + */ + int updateByPrimaryKeySelective(PlayerFriendRequestDto row); + + /** + * This method was generated by MyBatis Generator. This method corresponds to + * the database table gsync_player_friend_request + * + * @mbg.generated + */ + int updateByPrimaryKey(PlayerFriendRequestDto row); + + /** + * 複数レコードを一括で INSERT する + * + * @mbg.generated + */ + void bulkInsert(@Param("dtos") List dtos); + + /** + * PK でレコード検索し、存在する場合は original にセットする + * + * @mbg.generated + */ + default void syncOriginal(PlayerFriendRequestDto dto) { + dto.setOriginal(selectByPrimaryKey(dto.getPlayerId(), dto.getReceiverPlayerId())); + } + + /** + * PK でレコード検索し、存在する場合は original にセットする + * + * @mbg.generated + */ + default void syncOriginal(List dtos) { + if (dtos.isEmpty()) { + return; + } + + final var example = new PlayerFriendRequestExample(); + example.createCriteria().andPlayerIdIn(dtos.stream().map(PlayerFriendRequestDto::getPlayerId).toList()); + example.createCriteria() + .andReceiverPlayerIdIn(dtos.stream().map(PlayerFriendRequestDto::getReceiverPlayerId).toList()); + final var originals = selectByExample(example); + originals.forEach(original -> dtos.forEach(dto -> { + if (dto.isPrimaryKeyEquals(original)) { + dto.setOriginal(original); + } + })); + } + + /** + * original が null の場合は INSERT、そうでない場合は UPDATE を実行する + * + * @mbg.generated + */ + default void insertOrUpdate(PlayerFriendRequestDto dto) { + if (dto.getOriginal() == null) { + insert(dto); + } else { + dto.setCreatedAt(dto.getOriginal().getCreatedAt()); + updateByPrimaryKey(dto); + } + } + + /** + * original が null の場合は INSERT、そうでない場合は UPDATE を実行する + * + * @mbg.generated + */ + default void insertOrUpdate(List dtos) { + final var inserts = dtos.stream().filter(dto -> dto.getOriginal() == null).toList(); + if (!inserts.isEmpty()) { + bulkInsert(inserts); + } + + final var updates = dtos.stream().filter(dto -> dto.getOriginal() != null).toList(); + updates.parallelStream().forEach(dto -> { + if (dto.getOriginal() == null) { + return; + } + dto.setCreatedAt(dto.getOriginal().getCreatedAt()); + updateByPrimaryKey(dto); + }); + } +} \ No newline at end of file diff --git a/app/infrastructure/src/main/kotlin/net/averak/gsync/infrastructure/mybatis/plugin/InsertOrUpdatePlugin.kt b/app/infrastructure/src/main/kotlin/net/averak/gsync/infrastructure/mybatis/plugin/InsertOrUpdatePlugin.kt index 8fb1a5f..1f75447 100644 --- a/app/infrastructure/src/main/kotlin/net/averak/gsync/infrastructure/mybatis/plugin/InsertOrUpdatePlugin.kt +++ b/app/infrastructure/src/main/kotlin/net/averak/gsync/infrastructure/mybatis/plugin/InsertOrUpdatePlugin.kt @@ -141,7 +141,9 @@ class InsertOrUpdatePlugin : PluginAdapter() { method.bodyLines += " if (dto.getOriginal() == null) {" method.bodyLines += " return;" method.bodyLines += " }" - method.bodyLines += " dto.setCreatedAt(dto.getOriginal().getCreatedAt());" + if (introspectedTable.allColumns.any { it.javaProperty == "createdAt" }) { + method.bodyLines += " dto.setCreatedAt(dto.getOriginal().getCreatedAt());" + } method.bodyLines += " $updateMethodName(dto);" method.bodyLines += "});" diff --git a/src/main/resources/dao/base/FriendSettingMasterBaseMapper.xml b/src/main/resources/dao/base/FriendSettingMasterBaseMapper.xml new file mode 100644 index 0000000..db3c824 --- /dev/null +++ b/src/main/resources/dao/base/FriendSettingMasterBaseMapper.xml @@ -0,0 +1,312 @@ + + + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + `master_version`, `max_friend_count`, `max_friend_request_count`, `created_at`, `updated_at` + + + + + + delete from `gsync_friend_setting_master` + where `master_version` = #{masterVersion,jdbcType=NVARCHAR} + + + + delete from `gsync_friend_setting_master` + + + + + + + insert into `gsync_friend_setting_master` (`master_version`, `max_friend_count`, `max_friend_request_count`, + `created_at`, `updated_at`) + values (#{masterVersion,jdbcType=NVARCHAR}, #{maxFriendCount,jdbcType=BIGINT}, #{maxFriendRequestCount,jdbcType=BIGINT}, + #{createdAt,jdbcType=TIMESTAMP}, #{updatedAt,jdbcType=TIMESTAMP}) + + + + insert into `gsync_friend_setting_master` + + + `master_version`, + + + `max_friend_count`, + + + `max_friend_request_count`, + + + `created_at`, + + + `updated_at`, + + + + + #{masterVersion,jdbcType=NVARCHAR}, + + + #{maxFriendCount,jdbcType=BIGINT}, + + + #{maxFriendRequestCount,jdbcType=BIGINT}, + + + #{createdAt,jdbcType=TIMESTAMP}, + + + #{updatedAt,jdbcType=TIMESTAMP}, + + + + + + + update `gsync_friend_setting_master` + + + `master_version` = #{row.masterVersion,jdbcType=NVARCHAR}, + + + `max_friend_count` = #{row.maxFriendCount,jdbcType=BIGINT}, + + + `max_friend_request_count` = #{row.maxFriendRequestCount,jdbcType=BIGINT}, + + + `created_at` = #{row.createdAt,jdbcType=TIMESTAMP}, + + + `updated_at` = #{row.updatedAt,jdbcType=TIMESTAMP}, + + + + + + + + + update `gsync_friend_setting_master` + set `master_version` = #{row.masterVersion,jdbcType=NVARCHAR}, + `max_friend_count` = #{row.maxFriendCount,jdbcType=BIGINT}, + `max_friend_request_count` = #{row.maxFriendRequestCount,jdbcType=BIGINT}, + `created_at` = #{row.createdAt,jdbcType=TIMESTAMP}, + `updated_at` = #{row.updatedAt,jdbcType=TIMESTAMP} + + + + + + + update `gsync_friend_setting_master` + + + `max_friend_count` = #{maxFriendCount,jdbcType=BIGINT}, + + + `max_friend_request_count` = #{maxFriendRequestCount,jdbcType=BIGINT}, + + + `created_at` = #{createdAt,jdbcType=TIMESTAMP}, + + + `updated_at` = #{updatedAt,jdbcType=TIMESTAMP}, + + + where `master_version` = #{masterVersion,jdbcType=NVARCHAR} + + + + update `gsync_friend_setting_master` + set `max_friend_count` = #{maxFriendCount,jdbcType=BIGINT}, + `max_friend_request_count` = #{maxFriendRequestCount,jdbcType=BIGINT}, + `created_at` = #{createdAt,jdbcType=TIMESTAMP}, + `updated_at` = #{updatedAt,jdbcType=TIMESTAMP} + where `master_version` = #{masterVersion,jdbcType=NVARCHAR} + + + + INSERT INTO `gsync_friend_setting_master` + ( + + master_version, + max_friend_count, + max_friend_request_count, + created_at, + updated_at + ) VALUES + + #{dto.masterVersion, jdbcType=NVARCHAR}, + #{dto.maxFriendCount, jdbcType=BIGINT}, + #{dto.maxFriendRequestCount, jdbcType=BIGINT}, + #{dto.createdAt, jdbcType=TIMESTAMP}, + #{dto.updatedAt, jdbcType=TIMESTAMP} + + + \ No newline at end of file diff --git a/src/main/resources/dao/base/PlayerFriendBaseMapper.xml b/src/main/resources/dao/base/PlayerFriendBaseMapper.xml new file mode 100644 index 0000000..1bd0fed --- /dev/null +++ b/src/main/resources/dao/base/PlayerFriendBaseMapper.xml @@ -0,0 +1,312 @@ + + + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + `player_id`, `friend_player_id`, `become_friend_at`, `created_at`, `updated_at` + + + + + + delete from `gsync_player_friend` + where `player_id` = #{playerId,jdbcType=NVARCHAR} + and `friend_player_id` = #{friendPlayerId,jdbcType=NVARCHAR} + + + + delete from `gsync_player_friend` + + + + + + + insert into `gsync_player_friend` (`player_id`, `friend_player_id`, `become_friend_at`, + `created_at`, `updated_at`) + values (#{playerId,jdbcType=NVARCHAR}, #{friendPlayerId,jdbcType=NVARCHAR}, #{becomeFriendAt,jdbcType=TIMESTAMP}, + #{createdAt,jdbcType=TIMESTAMP}, #{updatedAt,jdbcType=TIMESTAMP}) + + + + insert into `gsync_player_friend` + + + `player_id`, + + + `friend_player_id`, + + + `become_friend_at`, + + + `created_at`, + + + `updated_at`, + + + + + #{playerId,jdbcType=NVARCHAR}, + + + #{friendPlayerId,jdbcType=NVARCHAR}, + + + #{becomeFriendAt,jdbcType=TIMESTAMP}, + + + #{createdAt,jdbcType=TIMESTAMP}, + + + #{updatedAt,jdbcType=TIMESTAMP}, + + + + + + + update `gsync_player_friend` + + + `player_id` = #{row.playerId,jdbcType=NVARCHAR}, + + + `friend_player_id` = #{row.friendPlayerId,jdbcType=NVARCHAR}, + + + `become_friend_at` = #{row.becomeFriendAt,jdbcType=TIMESTAMP}, + + + `created_at` = #{row.createdAt,jdbcType=TIMESTAMP}, + + + `updated_at` = #{row.updatedAt,jdbcType=TIMESTAMP}, + + + + + + + + + update `gsync_player_friend` + set `player_id` = #{row.playerId,jdbcType=NVARCHAR}, + `friend_player_id` = #{row.friendPlayerId,jdbcType=NVARCHAR}, + `become_friend_at` = #{row.becomeFriendAt,jdbcType=TIMESTAMP}, + `created_at` = #{row.createdAt,jdbcType=TIMESTAMP}, + `updated_at` = #{row.updatedAt,jdbcType=TIMESTAMP} + + + + + + + update `gsync_player_friend` + + + `become_friend_at` = #{becomeFriendAt,jdbcType=TIMESTAMP}, + + + `created_at` = #{createdAt,jdbcType=TIMESTAMP}, + + + `updated_at` = #{updatedAt,jdbcType=TIMESTAMP}, + + + where `player_id` = #{playerId,jdbcType=NVARCHAR} + and `friend_player_id` = #{friendPlayerId,jdbcType=NVARCHAR} + + + + update `gsync_player_friend` + set `become_friend_at` = #{becomeFriendAt,jdbcType=TIMESTAMP}, + `created_at` = #{createdAt,jdbcType=TIMESTAMP}, + `updated_at` = #{updatedAt,jdbcType=TIMESTAMP} + where `player_id` = #{playerId,jdbcType=NVARCHAR} + and `friend_player_id` = #{friendPlayerId,jdbcType=NVARCHAR} + + + + INSERT INTO `gsync_player_friend` + ( + + player_id, + friend_player_id, + become_friend_at, + created_at, + updated_at + ) VALUES + + #{dto.playerId, jdbcType=NVARCHAR}, + #{dto.friendPlayerId, jdbcType=NVARCHAR}, + #{dto.becomeFriendAt, jdbcType=TIMESTAMP}, + #{dto.createdAt, jdbcType=TIMESTAMP}, + #{dto.updatedAt, jdbcType=TIMESTAMP} + + + \ No newline at end of file diff --git a/src/main/resources/dao/base/PlayerFriendRequestBaseMapper.xml b/src/main/resources/dao/base/PlayerFriendRequestBaseMapper.xml new file mode 100644 index 0000000..30a9798 --- /dev/null +++ b/src/main/resources/dao/base/PlayerFriendRequestBaseMapper.xml @@ -0,0 +1,312 @@ + + + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + `player_id`, `receiver_player_id`, `sent_at`, `created_at`, `updated_at` + + + + + + delete from `gsync_player_friend_request` + where `player_id` = #{playerId,jdbcType=NVARCHAR} + and `receiver_player_id` = #{receiverPlayerId,jdbcType=NVARCHAR} + + + + delete from `gsync_player_friend_request` + + + + + + + insert into `gsync_player_friend_request` (`player_id`, `receiver_player_id`, `sent_at`, + `created_at`, `updated_at`) + values (#{playerId,jdbcType=NVARCHAR}, #{receiverPlayerId,jdbcType=NVARCHAR}, #{sentAt,jdbcType=TIMESTAMP}, + #{createdAt,jdbcType=TIMESTAMP}, #{updatedAt,jdbcType=TIMESTAMP}) + + + + insert into `gsync_player_friend_request` + + + `player_id`, + + + `receiver_player_id`, + + + `sent_at`, + + + `created_at`, + + + `updated_at`, + + + + + #{playerId,jdbcType=NVARCHAR}, + + + #{receiverPlayerId,jdbcType=NVARCHAR}, + + + #{sentAt,jdbcType=TIMESTAMP}, + + + #{createdAt,jdbcType=TIMESTAMP}, + + + #{updatedAt,jdbcType=TIMESTAMP}, + + + + + + + update `gsync_player_friend_request` + + + `player_id` = #{row.playerId,jdbcType=NVARCHAR}, + + + `receiver_player_id` = #{row.receiverPlayerId,jdbcType=NVARCHAR}, + + + `sent_at` = #{row.sentAt,jdbcType=TIMESTAMP}, + + + `created_at` = #{row.createdAt,jdbcType=TIMESTAMP}, + + + `updated_at` = #{row.updatedAt,jdbcType=TIMESTAMP}, + + + + + + + + + update `gsync_player_friend_request` + set `player_id` = #{row.playerId,jdbcType=NVARCHAR}, + `receiver_player_id` = #{row.receiverPlayerId,jdbcType=NVARCHAR}, + `sent_at` = #{row.sentAt,jdbcType=TIMESTAMP}, + `created_at` = #{row.createdAt,jdbcType=TIMESTAMP}, + `updated_at` = #{row.updatedAt,jdbcType=TIMESTAMP} + + + + + + + update `gsync_player_friend_request` + + + `sent_at` = #{sentAt,jdbcType=TIMESTAMP}, + + + `created_at` = #{createdAt,jdbcType=TIMESTAMP}, + + + `updated_at` = #{updatedAt,jdbcType=TIMESTAMP}, + + + where `player_id` = #{playerId,jdbcType=NVARCHAR} + and `receiver_player_id` = #{receiverPlayerId,jdbcType=NVARCHAR} + + + + update `gsync_player_friend_request` + set `sent_at` = #{sentAt,jdbcType=TIMESTAMP}, + `created_at` = #{createdAt,jdbcType=TIMESTAMP}, + `updated_at` = #{updatedAt,jdbcType=TIMESTAMP} + where `player_id` = #{playerId,jdbcType=NVARCHAR} + and `receiver_player_id` = #{receiverPlayerId,jdbcType=NVARCHAR} + + + + INSERT INTO `gsync_player_friend_request` + ( + + player_id, + receiver_player_id, + sent_at, + created_at, + updated_at + ) VALUES + + #{dto.playerId, jdbcType=NVARCHAR}, + #{dto.receiverPlayerId, jdbcType=NVARCHAR}, + #{dto.sentAt, jdbcType=TIMESTAMP}, + #{dto.createdAt, jdbcType=TIMESTAMP}, + #{dto.updatedAt, jdbcType=TIMESTAMP} + + + \ No newline at end of file diff --git a/src/main/resources/db/migration/V1_0_0.sql b/src/main/resources/db/migration/V1_0_0.sql index 89418da..3edf2b0 100644 --- a/src/main/resources/db/migration/V1_0_0.sql +++ b/src/main/resources/db/migration/V1_0_0.sql @@ -79,6 +79,41 @@ INTERLEAVE IN PARENT gsync_player ON DELETE CASCADE; +CREATE TABLE gsync_player_friend +( + player_id STRING(36) NOT NULL, + friend_player_id STRING(36) NOT NULL, + become_friend_at TIMESTAMP NOT NULL, + created_at TIMESTAMP NOT NULL, + updated_at TIMESTAMP NOT NULL, + CONSTRAINT fk__gsync_player_friend__friend_player_id FOREIGN KEY (friend_player_id) REFERENCES gsync_player (friend_id), +) PRIMARY KEY (player_id, friend_player_id), +INTERLEAVE IN PARENT gsync_player ON +DELETE +CASCADE; + +CREATE TABLE gsync_player_friend_request +( + player_id STRING(36) NOT NULL, + receiver_player_id STRING(36) NOT NULL, + sent_at TIMESTAMP NOT NULL, + created_at TIMESTAMP NOT NULL, + updated_at TIMESTAMP NOT NULL, + CONSTRAINT fk__gsync_player_friend_request__receiver_player_id FOREIGN KEY (receiver_player_id) REFERENCES gsync_player (friend_id), +) PRIMARY KEY (player_id, receiver_player_id), +INTERLEAVE IN PARENT gsync_player ON +DELETE +CASCADE; + +CREATE TABLE gsync_friend_setting_master +( + master_version STRING(36) NOT NULL, + max_friend_count INT64 NOT NULL, + max_friend_request_count INT64 NOT NULL, + created_at TIMESTAMP NOT NULL, + updated_at TIMESTAMP NOT NULL, +) PRIMARY KEY (master_version); + CREATE TABLE gsync_player_storage_entry ( player_id STRING(36) NOT NULL, From cf106aa6b39ed0bc6ddb0afbf30f52c60b9994c5 Mon Sep 17 00:00:00 2001 From: averak Date: Sun, 14 Jan 2024 00:30:19 +0900 Subject: [PATCH 02/13] =?UTF-8?q?refs=20#81=20mbgenerate=E5=AE=9F=E8=A1=8C?= =?UTF-8?q?=E6=99=82=E3=81=AB=E5=BF=85=E8=A6=81=E3=81=AA=E3=83=95=E3=82=A1?= =?UTF-8?q?=E3=82=A4=E3=83=AB=E3=81=AF=E6=AE=8B=E3=81=99=E3=82=88=E3=81=86?= =?UTF-8?q?=E3=81=AB=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../adapter/dao/dto/base/AbstractDto.java | 2 +- .../gsync/adapter/dao/dto/base/EchoDto.java | 1 + .../adapter/dao/dto/base/EchoExample.java | 1 + .../dao/dto/base/FriendSettingMasterDto.java | 1 + .../dto/base/FriendSettingMasterExample.java | 1 + .../dto/base/{TenantDto.java => GameDto.java} | 69 +++++++------- .../{TenantExample.java => GameExample.java} | 95 ++++++++++--------- .../dao/dto/base/MasterVersionDto.java | 1 + .../dao/dto/base/MasterVersionExample.java | 1 + .../adapter/dao/dto/base/OperatorDto.java | 1 + .../adapter/dao/dto/base/OperatorExample.java | 1 + .../gsync/adapter/dao/dto/base/PlayerDto.java | 1 + .../adapter/dao/dto/base/PlayerExample.java | 1 + .../adapter/dao/dto/base/PlayerFriendDto.java | 1 + .../dao/dto/base/PlayerFriendExample.java | 1 + .../dao/dto/base/PlayerFriendRequestDto.java | 1 + .../dto/base/PlayerFriendRequestExample.java | 1 + .../adapter/dao/dto/base/PlayerLoginDto.java | 1 + .../dao/dto/base/PlayerLoginExample.java | 1 + .../dao/dto/base/PlayerProfileDto.java | 1 + .../dao/dto/base/PlayerProfileExample.java | 1 + .../dao/dto/base/PlayerStorageEntryDto.java | 33 +++---- .../dto/base/PlayerStorageEntryExample.java | 57 +++++------ .../dto/base/PlayerStorageRevisionDto.java | 29 +++--- .../base/PlayerStorageRevisionExample.java | 57 +++++------ ...OperatorDto.java => RGameOperatorDto.java} | 80 ++++++++-------- ...Example.java => RGameOperatorExample.java} | 95 ++++++++++--------- .../dto/base/RequiredClientVersionDto.java | 1 + .../base/RequiredClientVersionExample.java | 1 + .../adapter/dao/dto/extend/OperatorILDto.java | 12 +-- .../dao/mapper/base/EchoBaseMapper.java | 2 +- .../base/FriendSettingMasterBaseMapper.java | 2 +- ...antBaseMapper.java => GameBaseMapper.java} | 72 +++++++------- .../mapper/base/MasterVersionBaseMapper.java | 2 +- .../dao/mapper/base/OperatorBaseMapper.java | 2 +- .../dao/mapper/base/PlayerBaseMapper.java | 2 +- .../mapper/base/PlayerFriendBaseMapper.java | 2 +- .../base/PlayerFriendRequestBaseMapper.java | 2 +- .../mapper/base/PlayerLoginBaseMapper.java | 2 +- .../mapper/base/PlayerProfileBaseMapper.java | 2 +- .../base/PlayerStorageEntryBaseMapper.java | 10 +- .../base/PlayerStorageRevisionBaseMapper.java | 10 +- ...pper.java => RGameOperatorBaseMapper.java} | 75 ++++++++------- .../base/RequiredClientVersionBaseMapper.java | 2 +- .../dao/mapper/extend/OperatorMapper.java | 2 +- .../extend/PlayerStorageEntryMapper.java | 4 +- .../extend/PlayerStorageRevisionMapper.java | 14 +-- .../adapter/repository/GameRepository.kt | 44 +++++++++ .../adapter/repository/OperatorRepository.kt | 14 +-- .../repository/PlayerStorageRepository.kt | 26 ++--- .../adapter/repository/TenantRepository.kt | 44 --------- ...ory_UT.groovy => GameRepository_UT.groovy} | 38 ++++---- .../repository/OperatorRepository_UT.groovy | 34 +++---- .../PlayerStorageRepository_UT.groovy | 48 +++++----- .../gsync/domain/model/{Tenant.kt => Game.kt} | 4 +- .../net/averak/gsync/domain/model/Operator.kt | 6 +- .../gsync/domain/model/PlayerStorage.kt | 6 +- .../domain/repository/IGameRepository.kt | 12 +++ .../domain/repository/IOperatorRepository.kt | 2 +- .../repository/IPlayerStorageRepository.kt | 2 +- .../domain/repository/ITenantRepository.kt | 12 --- .../mybatis/plugin/BulkInsertPlugin.kt | 4 +- .../mybatis/plugin/IgnoreTablePlugin.kt | 45 --------- .../mybatis/plugin/InsertOrUpdatePlugin.kt | 4 +- .../mybatis/plugin/ResolveNullPlugin.kt | 15 +-- .../mybatis/plugin/SuppressWarningsPlugin.kt | 20 +++- .../gsync/usecase/PlayerStorageUsecase.kt | 12 +-- .../usecase/PlayerStorageUsecase_UT.groovy | 26 ++--- build.gradle.kts | 12 +++ ...enantBaseMapper.xml => GameBaseMapper.xml} | 78 +++++++-------- .../dao/base/PlayerStorageEntryBaseMapper.xml | 40 ++++---- .../base/PlayerStorageRevisionBaseMapper.xml | 34 +++---- ...Mapper.xml => RGameOperatorBaseMapper.xml} | 78 +++++++-------- .../resources/dao/extend/OperatorMapper.xml | 16 ++-- .../dao/extend/PlayerStorageEntryMapper.xml | 4 +- .../extend/PlayerStorageRevisionMapper.xml | 4 +- src/main/resources/db/migration/V1_0_0.sql | 22 ++--- .../resources/mybatis-generator-config.xml | 1 - .../randomizer/SpannerRandomizers.groovy | 12 +-- 79 files changed, 737 insertions(+), 738 deletions(-) rename app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/{TenantDto.java => GameDto.java} (63%) rename app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/{TenantExample.java => GameExample.java} (84%) rename app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/{RTenantOperatorDto.java => RGameOperatorDto.java} (59%) rename app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/{RTenantOperatorExample.java => RGameOperatorExample.java} (85%) rename app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base/{TenantBaseMapper.java => GameBaseMapper.java} (62%) rename app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base/{RTenantOperatorBaseMapper.java => RGameOperatorBaseMapper.java} (57%) create mode 100644 app/adapter/src/main/kotlin/net/averak/gsync/adapter/repository/GameRepository.kt delete mode 100644 app/adapter/src/main/kotlin/net/averak/gsync/adapter/repository/TenantRepository.kt rename app/adapter/src/test/groovy/net/averak/gsync/adapter/repository/{TenantRepository_UT.groovy => GameRepository_UT.groovy} (53%) rename app/domain/src/main/kotlin/net/averak/gsync/domain/model/{Tenant.kt => Game.kt} (63%) create mode 100644 app/domain/src/main/kotlin/net/averak/gsync/domain/repository/IGameRepository.kt delete mode 100644 app/domain/src/main/kotlin/net/averak/gsync/domain/repository/ITenantRepository.kt delete mode 100644 app/infrastructure/src/main/kotlin/net/averak/gsync/infrastructure/mybatis/plugin/IgnoreTablePlugin.kt rename src/main/resources/dao/base/{TenantBaseMapper.xml => GameBaseMapper.xml} (84%) rename src/main/resources/dao/base/{RTenantOperatorBaseMapper.xml => RGameOperatorBaseMapper.xml} (83%) diff --git a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/AbstractDto.java b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/AbstractDto.java index 4835d7a..85a2914 100644 --- a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/AbstractDto.java +++ b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/AbstractDto.java @@ -2,7 +2,7 @@ import javax.annotation.Nullable; -public class AbstractDto { +public abstract class AbstractDto { @Nullable private T original = null; diff --git a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/EchoDto.java b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/EchoDto.java index 41e569b..cee57fb 100644 --- a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/EchoDto.java +++ b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/EchoDto.java @@ -5,6 +5,7 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; +@SuppressWarnings({"all"}) public class EchoDto extends AbstractDto { /** * diff --git a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/EchoExample.java b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/EchoExample.java index b61bea2..8c1c7b9 100644 --- a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/EchoExample.java +++ b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/EchoExample.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.List; +@SuppressWarnings({"all"}) public class EchoExample { /** * This field was generated by MyBatis Generator. This field corresponds to the diff --git a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/FriendSettingMasterDto.java b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/FriendSettingMasterDto.java index 1ceb09d..ff06018 100644 --- a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/FriendSettingMasterDto.java +++ b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/FriendSettingMasterDto.java @@ -5,6 +5,7 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; +@SuppressWarnings({"all"}) public class FriendSettingMasterDto extends AbstractDto { /** * diff --git a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/FriendSettingMasterExample.java b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/FriendSettingMasterExample.java index ba209d1..731a3a7 100644 --- a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/FriendSettingMasterExample.java +++ b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/FriendSettingMasterExample.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.List; +@SuppressWarnings({"all"}) public class FriendSettingMasterExample { /** * This field was generated by MyBatis Generator. This field corresponds to the diff --git a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/TenantDto.java b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/GameDto.java similarity index 63% rename from app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/TenantDto.java rename to app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/GameDto.java index fe3dbb0..603813b 100644 --- a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/TenantDto.java +++ b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/GameDto.java @@ -5,20 +5,21 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; -public class TenantDto extends AbstractDto { +@SuppressWarnings({"all"}) +public class GameDto extends AbstractDto { /** * * This field was generated by MyBatis Generator. This field corresponds to the - * database column gsync_tenant.tenant_id + * database column gsync_game.game_id * * @mbg.generated */ - private String tenantId; + private String gameId; /** * * This field was generated by MyBatis Generator. This field corresponds to the - * database column gsync_tenant.name + * database column gsync_game.name * * @mbg.generated */ @@ -27,7 +28,7 @@ public class TenantDto extends AbstractDto { /** * * This field was generated by MyBatis Generator. This field corresponds to the - * database column gsync_tenant.created_at + * database column gsync_game.created_at * * @mbg.generated */ @@ -36,7 +37,7 @@ public class TenantDto extends AbstractDto { /** * * This field was generated by MyBatis Generator. This field corresponds to the - * database column gsync_tenant.updated_at + * database column gsync_game.updated_at * * @mbg.generated */ @@ -44,13 +45,13 @@ public class TenantDto extends AbstractDto { /** * This method was generated by MyBatis Generator. This method corresponds to - * the database table gsync_tenant + * the database table gsync_game * * @mbg.generated */ - public TenantDto(@Nonnull String tenantId, @Nonnull String name, @Nonnull LocalDateTime createdAt, + public GameDto(@Nonnull String gameId, @Nonnull String name, @Nonnull LocalDateTime createdAt, @Nonnull LocalDateTime updatedAt) { - this.tenantId = tenantId; + this.gameId = gameId; this.name = name; this.createdAt = createdAt; this.updatedAt = updatedAt; @@ -58,45 +59,45 @@ public TenantDto(@Nonnull String tenantId, @Nonnull String name, @Nonnull LocalD /** * This method was generated by MyBatis Generator. This method corresponds to - * the database table gsync_tenant + * the database table gsync_game * * @mbg.generated */ - public TenantDto() { + public GameDto() { super(); } /** * This method was generated by MyBatis Generator. This method returns the value - * of the database column gsync_tenant.tenant_id + * of the database column gsync_game.game_id * - * @return the value of gsync_tenant.tenant_id + * @return the value of gsync_game.game_id * * @mbg.generated */ @Nonnull - public String getTenantId() { - return tenantId; + public String getGameId() { + return gameId; } /** * This method was generated by MyBatis Generator. This method sets the value of - * the database column gsync_tenant.tenant_id + * the database column gsync_game.game_id * - * @param tenantId - * the value for gsync_tenant.tenant_id + * @param gameId + * the value for gsync_game.game_id * * @mbg.generated */ - public void setTenantId(@Nonnull String tenantId) { - this.tenantId = tenantId; + public void setGameId(@Nonnull String gameId) { + this.gameId = gameId; } /** * This method was generated by MyBatis Generator. This method returns the value - * of the database column gsync_tenant.name + * of the database column gsync_game.name * - * @return the value of gsync_tenant.name + * @return the value of gsync_game.name * * @mbg.generated */ @@ -107,10 +108,10 @@ public String getName() { /** * This method was generated by MyBatis Generator. This method sets the value of - * the database column gsync_tenant.name + * the database column gsync_game.name * * @param name - * the value for gsync_tenant.name + * the value for gsync_game.name * * @mbg.generated */ @@ -120,9 +121,9 @@ public void setName(@Nonnull String name) { /** * This method was generated by MyBatis Generator. This method returns the value - * of the database column gsync_tenant.created_at + * of the database column gsync_game.created_at * - * @return the value of gsync_tenant.created_at + * @return the value of gsync_game.created_at * * @mbg.generated */ @@ -133,10 +134,10 @@ public LocalDateTime getCreatedAt() { /** * This method was generated by MyBatis Generator. This method sets the value of - * the database column gsync_tenant.created_at + * the database column gsync_game.created_at * * @param createdAt - * the value for gsync_tenant.created_at + * the value for gsync_game.created_at * * @mbg.generated */ @@ -146,9 +147,9 @@ public void setCreatedAt(@Nonnull LocalDateTime createdAt) { /** * This method was generated by MyBatis Generator. This method returns the value - * of the database column gsync_tenant.updated_at + * of the database column gsync_game.updated_at * - * @return the value of gsync_tenant.updated_at + * @return the value of gsync_game.updated_at * * @mbg.generated */ @@ -159,10 +160,10 @@ public LocalDateTime getUpdatedAt() { /** * This method was generated by MyBatis Generator. This method sets the value of - * the database column gsync_tenant.updated_at + * the database column gsync_game.updated_at * * @param updatedAt - * the value for gsync_tenant.updated_at + * the value for gsync_game.updated_at * * @mbg.generated */ @@ -170,7 +171,7 @@ public void setUpdatedAt(@Nonnull LocalDateTime updatedAt) { this.updatedAt = updatedAt; } - public boolean isPrimaryKeyEquals(TenantDto other) { - return Objects.equals(getTenantId(), other.getTenantId()); + public boolean isPrimaryKeyEquals(GameDto other) { + return Objects.equals(getGameId(), other.getGameId()); } } \ No newline at end of file diff --git a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/TenantExample.java b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/GameExample.java similarity index 84% rename from app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/TenantExample.java rename to app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/GameExample.java index 7a5e096..0ee0a6a 100644 --- a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/TenantExample.java +++ b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/GameExample.java @@ -4,10 +4,11 @@ import java.util.ArrayList; import java.util.List; -public class TenantExample { +@SuppressWarnings({"all"}) +public class GameExample { /** * This field was generated by MyBatis Generator. This field corresponds to the - * database table gsync_tenant + * database table gsync_game * * @mbg.generated */ @@ -15,7 +16,7 @@ public class TenantExample { /** * This field was generated by MyBatis Generator. This field corresponds to the - * database table gsync_tenant + * database table gsync_game * * @mbg.generated */ @@ -23,7 +24,7 @@ public class TenantExample { /** * This field was generated by MyBatis Generator. This field corresponds to the - * database table gsync_tenant + * database table gsync_game * * @mbg.generated */ @@ -31,17 +32,17 @@ public class TenantExample { /** * This method was generated by MyBatis Generator. This method corresponds to - * the database table gsync_tenant + * the database table gsync_game * * @mbg.generated */ - public TenantExample() { + public GameExample() { oredCriteria = new ArrayList<>(); } /** * This method was generated by MyBatis Generator. This method corresponds to - * the database table gsync_tenant + * the database table gsync_game * * @mbg.generated */ @@ -51,7 +52,7 @@ public void setOrderByClause(String orderByClause) { /** * This method was generated by MyBatis Generator. This method corresponds to - * the database table gsync_tenant + * the database table gsync_game * * @mbg.generated */ @@ -61,7 +62,7 @@ public String getOrderByClause() { /** * This method was generated by MyBatis Generator. This method corresponds to - * the database table gsync_tenant + * the database table gsync_game * * @mbg.generated */ @@ -71,7 +72,7 @@ public void setDistinct(boolean distinct) { /** * This method was generated by MyBatis Generator. This method corresponds to - * the database table gsync_tenant + * the database table gsync_game * * @mbg.generated */ @@ -81,7 +82,7 @@ public boolean isDistinct() { /** * This method was generated by MyBatis Generator. This method corresponds to - * the database table gsync_tenant + * the database table gsync_game * * @mbg.generated */ @@ -91,7 +92,7 @@ public List getOredCriteria() { /** * This method was generated by MyBatis Generator. This method corresponds to - * the database table gsync_tenant + * the database table gsync_game * * @mbg.generated */ @@ -101,7 +102,7 @@ public void or(Criteria criteria) { /** * This method was generated by MyBatis Generator. This method corresponds to - * the database table gsync_tenant + * the database table gsync_game * * @mbg.generated */ @@ -113,7 +114,7 @@ public Criteria or() { /** * This method was generated by MyBatis Generator. This method corresponds to - * the database table gsync_tenant + * the database table gsync_game * * @mbg.generated */ @@ -127,7 +128,7 @@ public Criteria createCriteria() { /** * This method was generated by MyBatis Generator. This method corresponds to - * the database table gsync_tenant + * the database table gsync_game * * @mbg.generated */ @@ -138,7 +139,7 @@ protected Criteria createCriteriaInternal() { /** * This method was generated by MyBatis Generator. This method corresponds to - * the database table gsync_tenant + * the database table gsync_game * * @mbg.generated */ @@ -150,7 +151,7 @@ public void clear() { /** * This class was generated by MyBatis Generator. This class corresponds to the - * database table gsync_tenant + * database table gsync_game * * @mbg.generated */ @@ -195,73 +196,73 @@ protected void addCriterion(String condition, Object value1, Object value2, Stri criteria.add(new Criterion(condition, value1, value2)); } - public Criteria andTenantIdIsNull() { - addCriterion("`tenant_id` is null"); + public Criteria andGameIdIsNull() { + addCriterion("`game_id` is null"); return (Criteria) this; } - public Criteria andTenantIdIsNotNull() { - addCriterion("`tenant_id` is not null"); + public Criteria andGameIdIsNotNull() { + addCriterion("`game_id` is not null"); return (Criteria) this; } - public Criteria andTenantIdEqualTo(String value) { - addCriterion("`tenant_id` =", value, "tenantId"); + public Criteria andGameIdEqualTo(String value) { + addCriterion("`game_id` =", value, "gameId"); return (Criteria) this; } - public Criteria andTenantIdNotEqualTo(String value) { - addCriterion("`tenant_id` <>", value, "tenantId"); + public Criteria andGameIdNotEqualTo(String value) { + addCriterion("`game_id` <>", value, "gameId"); return (Criteria) this; } - public Criteria andTenantIdGreaterThan(String value) { - addCriterion("`tenant_id` >", value, "tenantId"); + public Criteria andGameIdGreaterThan(String value) { + addCriterion("`game_id` >", value, "gameId"); return (Criteria) this; } - public Criteria andTenantIdGreaterThanOrEqualTo(String value) { - addCriterion("`tenant_id` >=", value, "tenantId"); + public Criteria andGameIdGreaterThanOrEqualTo(String value) { + addCriterion("`game_id` >=", value, "gameId"); return (Criteria) this; } - public Criteria andTenantIdLessThan(String value) { - addCriterion("`tenant_id` <", value, "tenantId"); + public Criteria andGameIdLessThan(String value) { + addCriterion("`game_id` <", value, "gameId"); return (Criteria) this; } - public Criteria andTenantIdLessThanOrEqualTo(String value) { - addCriterion("`tenant_id` <=", value, "tenantId"); + public Criteria andGameIdLessThanOrEqualTo(String value) { + addCriterion("`game_id` <=", value, "gameId"); return (Criteria) this; } - public Criteria andTenantIdLike(String value) { - addCriterion("`tenant_id` like", value, "tenantId"); + public Criteria andGameIdLike(String value) { + addCriterion("`game_id` like", value, "gameId"); return (Criteria) this; } - public Criteria andTenantIdNotLike(String value) { - addCriterion("`tenant_id` not like", value, "tenantId"); + public Criteria andGameIdNotLike(String value) { + addCriterion("`game_id` not like", value, "gameId"); return (Criteria) this; } - public Criteria andTenantIdIn(List values) { - addCriterion("`tenant_id` in", values, "tenantId"); + public Criteria andGameIdIn(List values) { + addCriterion("`game_id` in", values, "gameId"); return (Criteria) this; } - public Criteria andTenantIdNotIn(List values) { - addCriterion("`tenant_id` not in", values, "tenantId"); + public Criteria andGameIdNotIn(List values) { + addCriterion("`game_id` not in", values, "gameId"); return (Criteria) this; } - public Criteria andTenantIdBetween(String value1, String value2) { - addCriterion("`tenant_id` between", value1, value2, "tenantId"); + public Criteria andGameIdBetween(String value1, String value2) { + addCriterion("`game_id` between", value1, value2, "gameId"); return (Criteria) this; } - public Criteria andTenantIdNotBetween(String value1, String value2) { - addCriterion("`tenant_id` not between", value1, value2, "tenantId"); + public Criteria andGameIdNotBetween(String value1, String value2) { + addCriterion("`game_id` not between", value1, value2, "gameId"); return (Criteria) this; } @@ -458,7 +459,7 @@ public Criteria andUpdatedAtNotBetween(LocalDateTime value1, LocalDateTime value /** * This class was generated by MyBatis Generator. This class corresponds to the - * database table gsync_tenant + * database table gsync_game * * @mbg.generated do_not_delete_during_merge */ @@ -470,7 +471,7 @@ protected Criteria() { /** * This class was generated by MyBatis Generator. This class corresponds to the - * database table gsync_tenant + * database table gsync_game * * @mbg.generated */ diff --git a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/MasterVersionDto.java b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/MasterVersionDto.java index 8fd9898..282f4c6 100644 --- a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/MasterVersionDto.java +++ b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/MasterVersionDto.java @@ -5,6 +5,7 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; +@SuppressWarnings({"all"}) public class MasterVersionDto extends AbstractDto { /** * diff --git a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/MasterVersionExample.java b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/MasterVersionExample.java index f579a95..0c3c59c 100644 --- a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/MasterVersionExample.java +++ b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/MasterVersionExample.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.List; +@SuppressWarnings({"all"}) public class MasterVersionExample { /** * This field was generated by MyBatis Generator. This field corresponds to the diff --git a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/OperatorDto.java b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/OperatorDto.java index 41482ce..cfbd45a 100644 --- a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/OperatorDto.java +++ b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/OperatorDto.java @@ -5,6 +5,7 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; +@SuppressWarnings({"all"}) public class OperatorDto extends AbstractDto { /** * diff --git a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/OperatorExample.java b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/OperatorExample.java index 175fb3f..bc9edb4 100644 --- a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/OperatorExample.java +++ b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/OperatorExample.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.List; +@SuppressWarnings({"all"}) public class OperatorExample { /** * This field was generated by MyBatis Generator. This field corresponds to the diff --git a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/PlayerDto.java b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/PlayerDto.java index 330a84a..aee8863 100644 --- a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/PlayerDto.java +++ b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/PlayerDto.java @@ -5,6 +5,7 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; +@SuppressWarnings({"all"}) public class PlayerDto extends AbstractDto { /** * diff --git a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/PlayerExample.java b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/PlayerExample.java index 0206707..536f6a7 100644 --- a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/PlayerExample.java +++ b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/PlayerExample.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.List; +@SuppressWarnings({"all"}) public class PlayerExample { /** * This field was generated by MyBatis Generator. This field corresponds to the diff --git a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/PlayerFriendDto.java b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/PlayerFriendDto.java index afb0100..0946fb5 100644 --- a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/PlayerFriendDto.java +++ b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/PlayerFriendDto.java @@ -5,6 +5,7 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; +@SuppressWarnings({"all"}) public class PlayerFriendDto extends AbstractDto { /** * diff --git a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/PlayerFriendExample.java b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/PlayerFriendExample.java index a795485..f8eccaf 100644 --- a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/PlayerFriendExample.java +++ b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/PlayerFriendExample.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.List; +@SuppressWarnings({"all"}) public class PlayerFriendExample { /** * This field was generated by MyBatis Generator. This field corresponds to the diff --git a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/PlayerFriendRequestDto.java b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/PlayerFriendRequestDto.java index dbe4fe7..28b3b71 100644 --- a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/PlayerFriendRequestDto.java +++ b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/PlayerFriendRequestDto.java @@ -5,6 +5,7 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; +@SuppressWarnings({"all"}) public class PlayerFriendRequestDto extends AbstractDto { /** * diff --git a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/PlayerFriendRequestExample.java b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/PlayerFriendRequestExample.java index 9352592..ef599dd 100644 --- a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/PlayerFriendRequestExample.java +++ b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/PlayerFriendRequestExample.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.List; +@SuppressWarnings({"all"}) public class PlayerFriendRequestExample { /** * This field was generated by MyBatis Generator. This field corresponds to the diff --git a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/PlayerLoginDto.java b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/PlayerLoginDto.java index 0fd6a74..d40d12a 100644 --- a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/PlayerLoginDto.java +++ b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/PlayerLoginDto.java @@ -5,6 +5,7 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; +@SuppressWarnings({"all"}) public class PlayerLoginDto extends AbstractDto { /** * diff --git a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/PlayerLoginExample.java b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/PlayerLoginExample.java index d300139..a673561 100644 --- a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/PlayerLoginExample.java +++ b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/PlayerLoginExample.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.List; +@SuppressWarnings({"all"}) public class PlayerLoginExample { /** * This field was generated by MyBatis Generator. This field corresponds to the diff --git a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/PlayerProfileDto.java b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/PlayerProfileDto.java index 3cd0615..9fd2426 100644 --- a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/PlayerProfileDto.java +++ b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/PlayerProfileDto.java @@ -5,6 +5,7 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; +@SuppressWarnings({"all"}) public class PlayerProfileDto extends AbstractDto { /** * diff --git a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/PlayerProfileExample.java b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/PlayerProfileExample.java index 4dd86cb..235f24a 100644 --- a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/PlayerProfileExample.java +++ b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/PlayerProfileExample.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.List; +@SuppressWarnings({"all"}) public class PlayerProfileExample { /** * This field was generated by MyBatis Generator. This field corresponds to the diff --git a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/PlayerStorageEntryDto.java b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/PlayerStorageEntryDto.java index f0f6956..0149ff5 100644 --- a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/PlayerStorageEntryDto.java +++ b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/PlayerStorageEntryDto.java @@ -5,6 +5,7 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; +@SuppressWarnings({"all"}) public class PlayerStorageEntryDto extends AbstractDto { /** * @@ -18,11 +19,11 @@ public class PlayerStorageEntryDto extends AbstractDto { /** * * This field was generated by MyBatis Generator. This field corresponds to the - * database column gsync_player_storage_entry.tenant_id + * database column gsync_player_storage_entry.game_id * * @mbg.generated */ - private String tenantId; + private String gameId; /** * @@ -66,10 +67,10 @@ public class PlayerStorageEntryDto extends AbstractDto { * * @mbg.generated */ - public PlayerStorageEntryDto(@Nonnull String playerId, @Nonnull String tenantId, @Nonnull String key, + public PlayerStorageEntryDto(@Nonnull String playerId, @Nonnull String gameId, @Nonnull String key, @Nonnull LocalDateTime createdAt, @Nonnull LocalDateTime updatedAt) { this.playerId = playerId; - this.tenantId = tenantId; + this.gameId = gameId; this.key = key; this.createdAt = createdAt; this.updatedAt = updatedAt; @@ -81,10 +82,10 @@ public PlayerStorageEntryDto(@Nonnull String playerId, @Nonnull String tenantId, * * @mbg.generated */ - public PlayerStorageEntryDto(@Nonnull String playerId, @Nonnull String tenantId, @Nonnull String key, + public PlayerStorageEntryDto(@Nonnull String playerId, @Nonnull String gameId, @Nonnull String key, @Nonnull LocalDateTime createdAt, @Nonnull LocalDateTime updatedAt, @Nonnull byte[] value) { this.playerId = playerId; - this.tenantId = tenantId; + this.gameId = gameId; this.key = key; this.createdAt = createdAt; this.updatedAt = updatedAt; @@ -129,28 +130,28 @@ public void setPlayerId(@Nonnull String playerId) { /** * This method was generated by MyBatis Generator. This method returns the value - * of the database column gsync_player_storage_entry.tenant_id + * of the database column gsync_player_storage_entry.game_id * - * @return the value of gsync_player_storage_entry.tenant_id + * @return the value of gsync_player_storage_entry.game_id * * @mbg.generated */ @Nonnull - public String getTenantId() { - return tenantId; + public String getGameId() { + return gameId; } /** * This method was generated by MyBatis Generator. This method sets the value of - * the database column gsync_player_storage_entry.tenant_id + * the database column gsync_player_storage_entry.game_id * - * @param tenantId - * the value for gsync_player_storage_entry.tenant_id + * @param gameId + * the value for gsync_player_storage_entry.game_id * * @mbg.generated */ - public void setTenantId(@Nonnull String tenantId) { - this.tenantId = tenantId; + public void setGameId(@Nonnull String gameId) { + this.gameId = gameId; } /** @@ -258,7 +259,7 @@ public void setValue(@Nonnull byte[] value) { } public boolean isPrimaryKeyEquals(PlayerStorageEntryDto other) { - return Objects.equals(getPlayerId(), other.getPlayerId()) && Objects.equals(getTenantId(), other.getTenantId()) + return Objects.equals(getPlayerId(), other.getPlayerId()) && Objects.equals(getGameId(), other.getGameId()) && Objects.equals(getKey(), other.getKey()); } } \ No newline at end of file diff --git a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/PlayerStorageEntryExample.java b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/PlayerStorageEntryExample.java index d6e9ef0..6c57e6b 100644 --- a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/PlayerStorageEntryExample.java +++ b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/PlayerStorageEntryExample.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.List; +@SuppressWarnings({"all"}) public class PlayerStorageEntryExample { /** * This field was generated by MyBatis Generator. This field corresponds to the @@ -265,73 +266,73 @@ public Criteria andPlayerIdNotBetween(String value1, String value2) { return (Criteria) this; } - public Criteria andTenantIdIsNull() { - addCriterion("`tenant_id` is null"); + public Criteria andGameIdIsNull() { + addCriterion("`game_id` is null"); return (Criteria) this; } - public Criteria andTenantIdIsNotNull() { - addCriterion("`tenant_id` is not null"); + public Criteria andGameIdIsNotNull() { + addCriterion("`game_id` is not null"); return (Criteria) this; } - public Criteria andTenantIdEqualTo(String value) { - addCriterion("`tenant_id` =", value, "tenantId"); + public Criteria andGameIdEqualTo(String value) { + addCriterion("`game_id` =", value, "gameId"); return (Criteria) this; } - public Criteria andTenantIdNotEqualTo(String value) { - addCriterion("`tenant_id` <>", value, "tenantId"); + public Criteria andGameIdNotEqualTo(String value) { + addCriterion("`game_id` <>", value, "gameId"); return (Criteria) this; } - public Criteria andTenantIdGreaterThan(String value) { - addCriterion("`tenant_id` >", value, "tenantId"); + public Criteria andGameIdGreaterThan(String value) { + addCriterion("`game_id` >", value, "gameId"); return (Criteria) this; } - public Criteria andTenantIdGreaterThanOrEqualTo(String value) { - addCriterion("`tenant_id` >=", value, "tenantId"); + public Criteria andGameIdGreaterThanOrEqualTo(String value) { + addCriterion("`game_id` >=", value, "gameId"); return (Criteria) this; } - public Criteria andTenantIdLessThan(String value) { - addCriterion("`tenant_id` <", value, "tenantId"); + public Criteria andGameIdLessThan(String value) { + addCriterion("`game_id` <", value, "gameId"); return (Criteria) this; } - public Criteria andTenantIdLessThanOrEqualTo(String value) { - addCriterion("`tenant_id` <=", value, "tenantId"); + public Criteria andGameIdLessThanOrEqualTo(String value) { + addCriterion("`game_id` <=", value, "gameId"); return (Criteria) this; } - public Criteria andTenantIdLike(String value) { - addCriterion("`tenant_id` like", value, "tenantId"); + public Criteria andGameIdLike(String value) { + addCriterion("`game_id` like", value, "gameId"); return (Criteria) this; } - public Criteria andTenantIdNotLike(String value) { - addCriterion("`tenant_id` not like", value, "tenantId"); + public Criteria andGameIdNotLike(String value) { + addCriterion("`game_id` not like", value, "gameId"); return (Criteria) this; } - public Criteria andTenantIdIn(List values) { - addCriterion("`tenant_id` in", values, "tenantId"); + public Criteria andGameIdIn(List values) { + addCriterion("`game_id` in", values, "gameId"); return (Criteria) this; } - public Criteria andTenantIdNotIn(List values) { - addCriterion("`tenant_id` not in", values, "tenantId"); + public Criteria andGameIdNotIn(List values) { + addCriterion("`game_id` not in", values, "gameId"); return (Criteria) this; } - public Criteria andTenantIdBetween(String value1, String value2) { - addCriterion("`tenant_id` between", value1, value2, "tenantId"); + public Criteria andGameIdBetween(String value1, String value2) { + addCriterion("`game_id` between", value1, value2, "gameId"); return (Criteria) this; } - public Criteria andTenantIdNotBetween(String value1, String value2) { - addCriterion("`tenant_id` not between", value1, value2, "tenantId"); + public Criteria andGameIdNotBetween(String value1, String value2) { + addCriterion("`game_id` not between", value1, value2, "gameId"); return (Criteria) this; } diff --git a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/PlayerStorageRevisionDto.java b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/PlayerStorageRevisionDto.java index b1fc4b7..6b28320 100644 --- a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/PlayerStorageRevisionDto.java +++ b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/PlayerStorageRevisionDto.java @@ -5,6 +5,7 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; +@SuppressWarnings({"all"}) public class PlayerStorageRevisionDto extends AbstractDto { /** * @@ -18,11 +19,11 @@ public class PlayerStorageRevisionDto extends AbstractDto", value, "tenantId"); + public Criteria andGameIdNotEqualTo(String value) { + addCriterion("`game_id` <>", value, "gameId"); return (Criteria) this; } - public Criteria andTenantIdGreaterThan(String value) { - addCriterion("`tenant_id` >", value, "tenantId"); + public Criteria andGameIdGreaterThan(String value) { + addCriterion("`game_id` >", value, "gameId"); return (Criteria) this; } - public Criteria andTenantIdGreaterThanOrEqualTo(String value) { - addCriterion("`tenant_id` >=", value, "tenantId"); + public Criteria andGameIdGreaterThanOrEqualTo(String value) { + addCriterion("`game_id` >=", value, "gameId"); return (Criteria) this; } - public Criteria andTenantIdLessThan(String value) { - addCriterion("`tenant_id` <", value, "tenantId"); + public Criteria andGameIdLessThan(String value) { + addCriterion("`game_id` <", value, "gameId"); return (Criteria) this; } - public Criteria andTenantIdLessThanOrEqualTo(String value) { - addCriterion("`tenant_id` <=", value, "tenantId"); + public Criteria andGameIdLessThanOrEqualTo(String value) { + addCriterion("`game_id` <=", value, "gameId"); return (Criteria) this; } - public Criteria andTenantIdLike(String value) { - addCriterion("`tenant_id` like", value, "tenantId"); + public Criteria andGameIdLike(String value) { + addCriterion("`game_id` like", value, "gameId"); return (Criteria) this; } - public Criteria andTenantIdNotLike(String value) { - addCriterion("`tenant_id` not like", value, "tenantId"); + public Criteria andGameIdNotLike(String value) { + addCriterion("`game_id` not like", value, "gameId"); return (Criteria) this; } - public Criteria andTenantIdIn(List values) { - addCriterion("`tenant_id` in", values, "tenantId"); + public Criteria andGameIdIn(List values) { + addCriterion("`game_id` in", values, "gameId"); return (Criteria) this; } - public Criteria andTenantIdNotIn(List values) { - addCriterion("`tenant_id` not in", values, "tenantId"); + public Criteria andGameIdNotIn(List values) { + addCriterion("`game_id` not in", values, "gameId"); return (Criteria) this; } - public Criteria andTenantIdBetween(String value1, String value2) { - addCriterion("`tenant_id` between", value1, value2, "tenantId"); + public Criteria andGameIdBetween(String value1, String value2) { + addCriterion("`game_id` between", value1, value2, "gameId"); return (Criteria) this; } - public Criteria andTenantIdNotBetween(String value1, String value2) { - addCriterion("`tenant_id` not between", value1, value2, "tenantId"); + public Criteria andGameIdNotBetween(String value1, String value2) { + addCriterion("`game_id` not between", value1, value2, "gameId"); return (Criteria) this; } diff --git a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/RTenantOperatorDto.java b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/RGameOperatorDto.java similarity index 59% rename from app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/RTenantOperatorDto.java rename to app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/RGameOperatorDto.java index 1e6c916..561ba5d 100644 --- a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/RTenantOperatorDto.java +++ b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/RGameOperatorDto.java @@ -5,11 +5,12 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; -public class RTenantOperatorDto extends AbstractDto { +@SuppressWarnings({"all"}) +public class RGameOperatorDto extends AbstractDto { /** * * This field was generated by MyBatis Generator. This field corresponds to the - * database column gsync_r_tenant_operator.operator_id + * database column gsync_r_game_operator.operator_id * * @mbg.generated */ @@ -18,16 +19,16 @@ public class RTenantOperatorDto extends AbstractDto { /** * * This field was generated by MyBatis Generator. This field corresponds to the - * database column gsync_r_tenant_operator.tenant_id + * database column gsync_r_game_operator.game_id * * @mbg.generated */ - private String tenantId; + private String gameId; /** * * This field was generated by MyBatis Generator. This field corresponds to the - * database column gsync_r_tenant_operator.is_admin + * database column gsync_r_game_operator.is_admin * * @mbg.generated */ @@ -36,7 +37,7 @@ public class RTenantOperatorDto extends AbstractDto { /** * * This field was generated by MyBatis Generator. This field corresponds to the - * database column gsync_r_tenant_operator.created_at + * database column gsync_r_game_operator.created_at * * @mbg.generated */ @@ -45,7 +46,7 @@ public class RTenantOperatorDto extends AbstractDto { /** * * This field was generated by MyBatis Generator. This field corresponds to the - * database column gsync_r_tenant_operator.updated_at + * database column gsync_r_game_operator.updated_at * * @mbg.generated */ @@ -53,14 +54,14 @@ public class RTenantOperatorDto extends AbstractDto { /** * This method was generated by MyBatis Generator. This method corresponds to - * the database table gsync_r_tenant_operator + * the database table gsync_r_game_operator * * @mbg.generated */ - public RTenantOperatorDto(@Nonnull String operatorId, @Nonnull String tenantId, @Nonnull Boolean isAdmin, + public RGameOperatorDto(@Nonnull String operatorId, @Nonnull String gameId, @Nonnull Boolean isAdmin, @Nonnull LocalDateTime createdAt, @Nonnull LocalDateTime updatedAt) { this.operatorId = operatorId; - this.tenantId = tenantId; + this.gameId = gameId; this.isAdmin = isAdmin; this.createdAt = createdAt; this.updatedAt = updatedAt; @@ -68,19 +69,19 @@ public RTenantOperatorDto(@Nonnull String operatorId, @Nonnull String tenantId, /** * This method was generated by MyBatis Generator. This method corresponds to - * the database table gsync_r_tenant_operator + * the database table gsync_r_game_operator * * @mbg.generated */ - public RTenantOperatorDto() { + public RGameOperatorDto() { super(); } /** * This method was generated by MyBatis Generator. This method returns the value - * of the database column gsync_r_tenant_operator.operator_id + * of the database column gsync_r_game_operator.operator_id * - * @return the value of gsync_r_tenant_operator.operator_id + * @return the value of gsync_r_game_operator.operator_id * * @mbg.generated */ @@ -91,10 +92,10 @@ public String getOperatorId() { /** * This method was generated by MyBatis Generator. This method sets the value of - * the database column gsync_r_tenant_operator.operator_id + * the database column gsync_r_game_operator.operator_id * * @param operatorId - * the value for gsync_r_tenant_operator.operator_id + * the value for gsync_r_game_operator.operator_id * * @mbg.generated */ @@ -104,35 +105,35 @@ public void setOperatorId(@Nonnull String operatorId) { /** * This method was generated by MyBatis Generator. This method returns the value - * of the database column gsync_r_tenant_operator.tenant_id + * of the database column gsync_r_game_operator.game_id * - * @return the value of gsync_r_tenant_operator.tenant_id + * @return the value of gsync_r_game_operator.game_id * * @mbg.generated */ @Nonnull - public String getTenantId() { - return tenantId; + public String getGameId() { + return gameId; } /** * This method was generated by MyBatis Generator. This method sets the value of - * the database column gsync_r_tenant_operator.tenant_id + * the database column gsync_r_game_operator.game_id * - * @param tenantId - * the value for gsync_r_tenant_operator.tenant_id + * @param gameId + * the value for gsync_r_game_operator.game_id * * @mbg.generated */ - public void setTenantId(@Nonnull String tenantId) { - this.tenantId = tenantId; + public void setGameId(@Nonnull String gameId) { + this.gameId = gameId; } /** * This method was generated by MyBatis Generator. This method returns the value - * of the database column gsync_r_tenant_operator.is_admin + * of the database column gsync_r_game_operator.is_admin * - * @return the value of gsync_r_tenant_operator.is_admin + * @return the value of gsync_r_game_operator.is_admin * * @mbg.generated */ @@ -143,10 +144,10 @@ public Boolean getIsAdmin() { /** * This method was generated by MyBatis Generator. This method sets the value of - * the database column gsync_r_tenant_operator.is_admin + * the database column gsync_r_game_operator.is_admin * * @param isAdmin - * the value for gsync_r_tenant_operator.is_admin + * the value for gsync_r_game_operator.is_admin * * @mbg.generated */ @@ -156,9 +157,9 @@ public void setIsAdmin(@Nonnull Boolean isAdmin) { /** * This method was generated by MyBatis Generator. This method returns the value - * of the database column gsync_r_tenant_operator.created_at + * of the database column gsync_r_game_operator.created_at * - * @return the value of gsync_r_tenant_operator.created_at + * @return the value of gsync_r_game_operator.created_at * * @mbg.generated */ @@ -169,10 +170,10 @@ public LocalDateTime getCreatedAt() { /** * This method was generated by MyBatis Generator. This method sets the value of - * the database column gsync_r_tenant_operator.created_at + * the database column gsync_r_game_operator.created_at * * @param createdAt - * the value for gsync_r_tenant_operator.created_at + * the value for gsync_r_game_operator.created_at * * @mbg.generated */ @@ -182,9 +183,9 @@ public void setCreatedAt(@Nonnull LocalDateTime createdAt) { /** * This method was generated by MyBatis Generator. This method returns the value - * of the database column gsync_r_tenant_operator.updated_at + * of the database column gsync_r_game_operator.updated_at * - * @return the value of gsync_r_tenant_operator.updated_at + * @return the value of gsync_r_game_operator.updated_at * * @mbg.generated */ @@ -195,10 +196,10 @@ public LocalDateTime getUpdatedAt() { /** * This method was generated by MyBatis Generator. This method sets the value of - * the database column gsync_r_tenant_operator.updated_at + * the database column gsync_r_game_operator.updated_at * * @param updatedAt - * the value for gsync_r_tenant_operator.updated_at + * the value for gsync_r_game_operator.updated_at * * @mbg.generated */ @@ -206,8 +207,7 @@ public void setUpdatedAt(@Nonnull LocalDateTime updatedAt) { this.updatedAt = updatedAt; } - public boolean isPrimaryKeyEquals(RTenantOperatorDto other) { - return Objects.equals(getOperatorId(), other.getOperatorId()) - && Objects.equals(getTenantId(), other.getTenantId()); + public boolean isPrimaryKeyEquals(RGameOperatorDto other) { + return Objects.equals(getOperatorId(), other.getOperatorId()) && Objects.equals(getGameId(), other.getGameId()); } } \ No newline at end of file diff --git a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/RTenantOperatorExample.java b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/RGameOperatorExample.java similarity index 85% rename from app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/RTenantOperatorExample.java rename to app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/RGameOperatorExample.java index 55fba8a..ba41618 100644 --- a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/RTenantOperatorExample.java +++ b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/RGameOperatorExample.java @@ -4,10 +4,11 @@ import java.util.ArrayList; import java.util.List; -public class RTenantOperatorExample { +@SuppressWarnings({"all"}) +public class RGameOperatorExample { /** * This field was generated by MyBatis Generator. This field corresponds to the - * database table gsync_r_tenant_operator + * database table gsync_r_game_operator * * @mbg.generated */ @@ -15,7 +16,7 @@ public class RTenantOperatorExample { /** * This field was generated by MyBatis Generator. This field corresponds to the - * database table gsync_r_tenant_operator + * database table gsync_r_game_operator * * @mbg.generated */ @@ -23,7 +24,7 @@ public class RTenantOperatorExample { /** * This field was generated by MyBatis Generator. This field corresponds to the - * database table gsync_r_tenant_operator + * database table gsync_r_game_operator * * @mbg.generated */ @@ -31,17 +32,17 @@ public class RTenantOperatorExample { /** * This method was generated by MyBatis Generator. This method corresponds to - * the database table gsync_r_tenant_operator + * the database table gsync_r_game_operator * * @mbg.generated */ - public RTenantOperatorExample() { + public RGameOperatorExample() { oredCriteria = new ArrayList<>(); } /** * This method was generated by MyBatis Generator. This method corresponds to - * the database table gsync_r_tenant_operator + * the database table gsync_r_game_operator * * @mbg.generated */ @@ -51,7 +52,7 @@ public void setOrderByClause(String orderByClause) { /** * This method was generated by MyBatis Generator. This method corresponds to - * the database table gsync_r_tenant_operator + * the database table gsync_r_game_operator * * @mbg.generated */ @@ -61,7 +62,7 @@ public String getOrderByClause() { /** * This method was generated by MyBatis Generator. This method corresponds to - * the database table gsync_r_tenant_operator + * the database table gsync_r_game_operator * * @mbg.generated */ @@ -71,7 +72,7 @@ public void setDistinct(boolean distinct) { /** * This method was generated by MyBatis Generator. This method corresponds to - * the database table gsync_r_tenant_operator + * the database table gsync_r_game_operator * * @mbg.generated */ @@ -81,7 +82,7 @@ public boolean isDistinct() { /** * This method was generated by MyBatis Generator. This method corresponds to - * the database table gsync_r_tenant_operator + * the database table gsync_r_game_operator * * @mbg.generated */ @@ -91,7 +92,7 @@ public List getOredCriteria() { /** * This method was generated by MyBatis Generator. This method corresponds to - * the database table gsync_r_tenant_operator + * the database table gsync_r_game_operator * * @mbg.generated */ @@ -101,7 +102,7 @@ public void or(Criteria criteria) { /** * This method was generated by MyBatis Generator. This method corresponds to - * the database table gsync_r_tenant_operator + * the database table gsync_r_game_operator * * @mbg.generated */ @@ -113,7 +114,7 @@ public Criteria or() { /** * This method was generated by MyBatis Generator. This method corresponds to - * the database table gsync_r_tenant_operator + * the database table gsync_r_game_operator * * @mbg.generated */ @@ -127,7 +128,7 @@ public Criteria createCriteria() { /** * This method was generated by MyBatis Generator. This method corresponds to - * the database table gsync_r_tenant_operator + * the database table gsync_r_game_operator * * @mbg.generated */ @@ -138,7 +139,7 @@ protected Criteria createCriteriaInternal() { /** * This method was generated by MyBatis Generator. This method corresponds to - * the database table gsync_r_tenant_operator + * the database table gsync_r_game_operator * * @mbg.generated */ @@ -150,7 +151,7 @@ public void clear() { /** * This class was generated by MyBatis Generator. This class corresponds to the - * database table gsync_r_tenant_operator + * database table gsync_r_game_operator * * @mbg.generated */ @@ -265,73 +266,73 @@ public Criteria andOperatorIdNotBetween(String value1, String value2) { return (Criteria) this; } - public Criteria andTenantIdIsNull() { - addCriterion("`tenant_id` is null"); + public Criteria andGameIdIsNull() { + addCriterion("`game_id` is null"); return (Criteria) this; } - public Criteria andTenantIdIsNotNull() { - addCriterion("`tenant_id` is not null"); + public Criteria andGameIdIsNotNull() { + addCriterion("`game_id` is not null"); return (Criteria) this; } - public Criteria andTenantIdEqualTo(String value) { - addCriterion("`tenant_id` =", value, "tenantId"); + public Criteria andGameIdEqualTo(String value) { + addCriterion("`game_id` =", value, "gameId"); return (Criteria) this; } - public Criteria andTenantIdNotEqualTo(String value) { - addCriterion("`tenant_id` <>", value, "tenantId"); + public Criteria andGameIdNotEqualTo(String value) { + addCriterion("`game_id` <>", value, "gameId"); return (Criteria) this; } - public Criteria andTenantIdGreaterThan(String value) { - addCriterion("`tenant_id` >", value, "tenantId"); + public Criteria andGameIdGreaterThan(String value) { + addCriterion("`game_id` >", value, "gameId"); return (Criteria) this; } - public Criteria andTenantIdGreaterThanOrEqualTo(String value) { - addCriterion("`tenant_id` >=", value, "tenantId"); + public Criteria andGameIdGreaterThanOrEqualTo(String value) { + addCriterion("`game_id` >=", value, "gameId"); return (Criteria) this; } - public Criteria andTenantIdLessThan(String value) { - addCriterion("`tenant_id` <", value, "tenantId"); + public Criteria andGameIdLessThan(String value) { + addCriterion("`game_id` <", value, "gameId"); return (Criteria) this; } - public Criteria andTenantIdLessThanOrEqualTo(String value) { - addCriterion("`tenant_id` <=", value, "tenantId"); + public Criteria andGameIdLessThanOrEqualTo(String value) { + addCriterion("`game_id` <=", value, "gameId"); return (Criteria) this; } - public Criteria andTenantIdLike(String value) { - addCriterion("`tenant_id` like", value, "tenantId"); + public Criteria andGameIdLike(String value) { + addCriterion("`game_id` like", value, "gameId"); return (Criteria) this; } - public Criteria andTenantIdNotLike(String value) { - addCriterion("`tenant_id` not like", value, "tenantId"); + public Criteria andGameIdNotLike(String value) { + addCriterion("`game_id` not like", value, "gameId"); return (Criteria) this; } - public Criteria andTenantIdIn(List values) { - addCriterion("`tenant_id` in", values, "tenantId"); + public Criteria andGameIdIn(List values) { + addCriterion("`game_id` in", values, "gameId"); return (Criteria) this; } - public Criteria andTenantIdNotIn(List values) { - addCriterion("`tenant_id` not in", values, "tenantId"); + public Criteria andGameIdNotIn(List values) { + addCriterion("`game_id` not in", values, "gameId"); return (Criteria) this; } - public Criteria andTenantIdBetween(String value1, String value2) { - addCriterion("`tenant_id` between", value1, value2, "tenantId"); + public Criteria andGameIdBetween(String value1, String value2) { + addCriterion("`game_id` between", value1, value2, "gameId"); return (Criteria) this; } - public Criteria andTenantIdNotBetween(String value1, String value2) { - addCriterion("`tenant_id` not between", value1, value2, "tenantId"); + public Criteria andGameIdNotBetween(String value1, String value2) { + addCriterion("`game_id` not between", value1, value2, "gameId"); return (Criteria) this; } @@ -518,7 +519,7 @@ public Criteria andUpdatedAtNotBetween(LocalDateTime value1, LocalDateTime value /** * This class was generated by MyBatis Generator. This class corresponds to the - * database table gsync_r_tenant_operator + * database table gsync_r_game_operator * * @mbg.generated do_not_delete_during_merge */ @@ -530,7 +531,7 @@ protected Criteria() { /** * This class was generated by MyBatis Generator. This class corresponds to the - * database table gsync_r_tenant_operator + * database table gsync_r_game_operator * * @mbg.generated */ diff --git a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/RequiredClientVersionDto.java b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/RequiredClientVersionDto.java index 6c238c8..8886e95 100644 --- a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/RequiredClientVersionDto.java +++ b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/RequiredClientVersionDto.java @@ -5,6 +5,7 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; +@SuppressWarnings({"all"}) public class RequiredClientVersionDto extends AbstractDto { /** * diff --git a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/RequiredClientVersionExample.java b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/RequiredClientVersionExample.java index 7ab9ff4..06f2b40 100644 --- a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/RequiredClientVersionExample.java +++ b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/RequiredClientVersionExample.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.List; +@SuppressWarnings({"all"}) public class RequiredClientVersionExample { /** * This field was generated by MyBatis Generator. This field corresponds to the diff --git a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/extend/OperatorILDto.java b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/extend/OperatorILDto.java index 7054397..b7b30bd 100644 --- a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/extend/OperatorILDto.java +++ b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/extend/OperatorILDto.java @@ -8,13 +8,13 @@ import org.jetbrains.annotations.NotNull; import net.averak.gsync.adapter.dao.dto.base.OperatorDto; -import net.averak.gsync.adapter.dao.dto.base.RTenantOperatorDto; +import net.averak.gsync.adapter.dao.dto.base.RGameOperatorDto; @SuppressWarnings({"NotNullFieldNotInitialized", "java:S2637"}) public class OperatorILDto extends OperatorDto { @Nonnull - List rTenantOperators; + List rGameOperators; public OperatorILDto(@NotNull String operatorId, @NotNull String email, @NotNull LocalDateTime createdAt, @NotNull LocalDateTime updatedAt) { @@ -22,11 +22,11 @@ public OperatorILDto(@NotNull String operatorId, @NotNull String email, @NotNull } @Nonnull - public List getRTenantOperators() { - return rTenantOperators; + public List getRGameOperators() { + return rGameOperators; } - public void setRTenantOperators(@Nonnull List rTenantOperators) { - this.rTenantOperators = rTenantOperators; + public void setRGameOperators(@Nonnull List rGameOperators) { + this.rGameOperators = rGameOperators; } } diff --git a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base/EchoBaseMapper.java b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base/EchoBaseMapper.java index 197e58e..a75fff3 100644 --- a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base/EchoBaseMapper.java +++ b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base/EchoBaseMapper.java @@ -8,7 +8,7 @@ import org.apache.ibatis.session.RowBounds; @Mapper -@SuppressWarnings({"JavadocDeclaration", "DuplicatedCode"}) +@SuppressWarnings({"all"}) public interface EchoBaseMapper { /** * This method was generated by MyBatis Generator. This method corresponds to diff --git a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base/FriendSettingMasterBaseMapper.java b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base/FriendSettingMasterBaseMapper.java index 892318f..94a3988 100644 --- a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base/FriendSettingMasterBaseMapper.java +++ b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base/FriendSettingMasterBaseMapper.java @@ -8,7 +8,7 @@ import org.apache.ibatis.session.RowBounds; @Mapper -@SuppressWarnings({"JavadocDeclaration", "DuplicatedCode"}) +@SuppressWarnings({"all"}) public interface FriendSettingMasterBaseMapper { /** * This method was generated by MyBatis Generator. This method corresponds to diff --git a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base/TenantBaseMapper.java b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base/GameBaseMapper.java similarity index 62% rename from app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base/TenantBaseMapper.java rename to app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base/GameBaseMapper.java index 697aa3b..4e17f75 100644 --- a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base/TenantBaseMapper.java +++ b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base/GameBaseMapper.java @@ -1,125 +1,125 @@ package net.averak.gsync.adapter.dao.mapper.base; import java.util.List; -import net.averak.gsync.adapter.dao.dto.base.TenantDto; -import net.averak.gsync.adapter.dao.dto.base.TenantExample; +import net.averak.gsync.adapter.dao.dto.base.GameDto; +import net.averak.gsync.adapter.dao.dto.base.GameExample; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.session.RowBounds; @Mapper -@SuppressWarnings({"JavadocDeclaration", "DuplicatedCode"}) -public interface TenantBaseMapper { +@SuppressWarnings({"all"}) +public interface GameBaseMapper { /** * This method was generated by MyBatis Generator. This method corresponds to - * the database table gsync_tenant + * the database table gsync_game * * @mbg.generated */ - long countByExample(TenantExample example); + long countByExample(GameExample example); /** * This method was generated by MyBatis Generator. This method corresponds to - * the database table gsync_tenant + * the database table gsync_game * * @mbg.generated */ - int deleteByExample(TenantExample example); + int deleteByExample(GameExample example); /** * This method was generated by MyBatis Generator. This method corresponds to - * the database table gsync_tenant + * the database table gsync_game * * @mbg.generated */ - int deleteByPrimaryKey(String tenantId); + int deleteByPrimaryKey(String gameId); /** * This method was generated by MyBatis Generator. This method corresponds to - * the database table gsync_tenant + * the database table gsync_game * * @mbg.generated */ - int insert(TenantDto row); + int insert(GameDto row); /** * This method was generated by MyBatis Generator. This method corresponds to - * the database table gsync_tenant + * the database table gsync_game * * @mbg.generated */ - int insertSelective(TenantDto row); + int insertSelective(GameDto row); /** * This method was generated by MyBatis Generator. This method corresponds to - * the database table gsync_tenant + * the database table gsync_game * * @mbg.generated */ - List selectByExampleWithRowbounds(TenantExample example, RowBounds rowBounds); + List selectByExampleWithRowbounds(GameExample example, RowBounds rowBounds); /** * This method was generated by MyBatis Generator. This method corresponds to - * the database table gsync_tenant + * the database table gsync_game * * @mbg.generated */ - List selectByExample(TenantExample example); + List selectByExample(GameExample example); /** * This method was generated by MyBatis Generator. This method corresponds to - * the database table gsync_tenant + * the database table gsync_game * * @mbg.generated */ - TenantDto selectByPrimaryKey(String tenantId); + GameDto selectByPrimaryKey(String gameId); /** * This method was generated by MyBatis Generator. This method corresponds to - * the database table gsync_tenant + * the database table gsync_game * * @mbg.generated */ - int updateByExampleSelective(@Param("row") TenantDto row, @Param("example") TenantExample example); + int updateByExampleSelective(@Param("row") GameDto row, @Param("example") GameExample example); /** * This method was generated by MyBatis Generator. This method corresponds to - * the database table gsync_tenant + * the database table gsync_game * * @mbg.generated */ - int updateByExample(@Param("row") TenantDto row, @Param("example") TenantExample example); + int updateByExample(@Param("row") GameDto row, @Param("example") GameExample example); /** * This method was generated by MyBatis Generator. This method corresponds to - * the database table gsync_tenant + * the database table gsync_game * * @mbg.generated */ - int updateByPrimaryKeySelective(TenantDto row); + int updateByPrimaryKeySelective(GameDto row); /** * This method was generated by MyBatis Generator. This method corresponds to - * the database table gsync_tenant + * the database table gsync_game * * @mbg.generated */ - int updateByPrimaryKey(TenantDto row); + int updateByPrimaryKey(GameDto row); /** * 複数レコードを一括で INSERT する * * @mbg.generated */ - void bulkInsert(@Param("dtos") List dtos); + void bulkInsert(@Param("dtos") List dtos); /** * PK でレコード検索し、存在する場合は original にセットする * * @mbg.generated */ - default void syncOriginal(TenantDto dto) { - dto.setOriginal(selectByPrimaryKey(dto.getTenantId())); + default void syncOriginal(GameDto dto) { + dto.setOriginal(selectByPrimaryKey(dto.getGameId())); } /** @@ -127,13 +127,13 @@ default void syncOriginal(TenantDto dto) { * * @mbg.generated */ - default void syncOriginal(List dtos) { + default void syncOriginal(List dtos) { if (dtos.isEmpty()) { return; } - final var example = new TenantExample(); - example.createCriteria().andTenantIdIn(dtos.stream().map(TenantDto::getTenantId).toList()); + final var example = new GameExample(); + example.createCriteria().andGameIdIn(dtos.stream().map(GameDto::getGameId).toList()); final var originals = selectByExample(example); originals.forEach(original -> dtos.forEach(dto -> { if (dto.isPrimaryKeyEquals(original)) { @@ -147,7 +147,7 @@ default void syncOriginal(List dtos) { * * @mbg.generated */ - default void insertOrUpdate(TenantDto dto) { + default void insertOrUpdate(GameDto dto) { if (dto.getOriginal() == null) { insert(dto); } else { @@ -161,7 +161,7 @@ default void insertOrUpdate(TenantDto dto) { * * @mbg.generated */ - default void insertOrUpdate(List dtos) { + default void insertOrUpdate(List dtos) { final var inserts = dtos.stream().filter(dto -> dto.getOriginal() == null).toList(); if (!inserts.isEmpty()) { bulkInsert(inserts); diff --git a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base/MasterVersionBaseMapper.java b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base/MasterVersionBaseMapper.java index 7a1e202..11eae1d 100644 --- a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base/MasterVersionBaseMapper.java +++ b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base/MasterVersionBaseMapper.java @@ -8,7 +8,7 @@ import org.apache.ibatis.session.RowBounds; @Mapper -@SuppressWarnings({"JavadocDeclaration", "DuplicatedCode"}) +@SuppressWarnings({"all"}) public interface MasterVersionBaseMapper { /** * This method was generated by MyBatis Generator. This method corresponds to diff --git a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base/OperatorBaseMapper.java b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base/OperatorBaseMapper.java index e1801ea..2f9ff0d 100644 --- a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base/OperatorBaseMapper.java +++ b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base/OperatorBaseMapper.java @@ -8,7 +8,7 @@ import org.apache.ibatis.session.RowBounds; @Mapper -@SuppressWarnings({"JavadocDeclaration", "DuplicatedCode"}) +@SuppressWarnings({"all"}) public interface OperatorBaseMapper { /** * This method was generated by MyBatis Generator. This method corresponds to diff --git a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base/PlayerBaseMapper.java b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base/PlayerBaseMapper.java index 3742ccc..29ed9a7 100644 --- a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base/PlayerBaseMapper.java +++ b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base/PlayerBaseMapper.java @@ -8,7 +8,7 @@ import org.apache.ibatis.session.RowBounds; @Mapper -@SuppressWarnings({"JavadocDeclaration", "DuplicatedCode"}) +@SuppressWarnings({"all"}) public interface PlayerBaseMapper { /** * This method was generated by MyBatis Generator. This method corresponds to diff --git a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base/PlayerFriendBaseMapper.java b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base/PlayerFriendBaseMapper.java index 13d334b..cdfb731 100644 --- a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base/PlayerFriendBaseMapper.java +++ b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base/PlayerFriendBaseMapper.java @@ -8,7 +8,7 @@ import org.apache.ibatis.session.RowBounds; @Mapper -@SuppressWarnings({"JavadocDeclaration", "DuplicatedCode"}) +@SuppressWarnings({"all"}) public interface PlayerFriendBaseMapper { /** * This method was generated by MyBatis Generator. This method corresponds to diff --git a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base/PlayerFriendRequestBaseMapper.java b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base/PlayerFriendRequestBaseMapper.java index 9668914..8facc66 100644 --- a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base/PlayerFriendRequestBaseMapper.java +++ b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base/PlayerFriendRequestBaseMapper.java @@ -8,7 +8,7 @@ import org.apache.ibatis.session.RowBounds; @Mapper -@SuppressWarnings({"JavadocDeclaration", "DuplicatedCode"}) +@SuppressWarnings({"all"}) public interface PlayerFriendRequestBaseMapper { /** * This method was generated by MyBatis Generator. This method corresponds to diff --git a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base/PlayerLoginBaseMapper.java b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base/PlayerLoginBaseMapper.java index 2dd8fbd..97635c6 100644 --- a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base/PlayerLoginBaseMapper.java +++ b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base/PlayerLoginBaseMapper.java @@ -8,7 +8,7 @@ import org.apache.ibatis.session.RowBounds; @Mapper -@SuppressWarnings({"JavadocDeclaration", "DuplicatedCode"}) +@SuppressWarnings({"all"}) public interface PlayerLoginBaseMapper { /** * This method was generated by MyBatis Generator. This method corresponds to diff --git a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base/PlayerProfileBaseMapper.java b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base/PlayerProfileBaseMapper.java index 1b821e4..7d3da62 100644 --- a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base/PlayerProfileBaseMapper.java +++ b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base/PlayerProfileBaseMapper.java @@ -8,7 +8,7 @@ import org.apache.ibatis.session.RowBounds; @Mapper -@SuppressWarnings({"JavadocDeclaration", "DuplicatedCode"}) +@SuppressWarnings({"all"}) public interface PlayerProfileBaseMapper { /** * This method was generated by MyBatis Generator. This method corresponds to diff --git a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base/PlayerStorageEntryBaseMapper.java b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base/PlayerStorageEntryBaseMapper.java index f7704c6..0e86243 100644 --- a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base/PlayerStorageEntryBaseMapper.java +++ b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base/PlayerStorageEntryBaseMapper.java @@ -8,7 +8,7 @@ import org.apache.ibatis.session.RowBounds; @Mapper -@SuppressWarnings({"JavadocDeclaration", "DuplicatedCode"}) +@SuppressWarnings({"all"}) public interface PlayerStorageEntryBaseMapper { /** * This method was generated by MyBatis Generator. This method corresponds to @@ -32,7 +32,7 @@ public interface PlayerStorageEntryBaseMapper { * * @mbg.generated */ - int deleteByPrimaryKey(@Param("playerId") String playerId, @Param("tenantId") String tenantId, + int deleteByPrimaryKey(@Param("playerId") String playerId, @Param("gameId") String gameId, @Param("key") String key); /** @@ -90,7 +90,7 @@ List selectByExampleWithBLOBsWithRowbounds(PlayerStorageE * * @mbg.generated */ - PlayerStorageEntryDto selectByPrimaryKey(@Param("playerId") String playerId, @Param("tenantId") String tenantId, + PlayerStorageEntryDto selectByPrimaryKey(@Param("playerId") String playerId, @Param("gameId") String gameId, @Param("key") String key); /** @@ -156,7 +156,7 @@ int updateByExampleWithBLOBs(@Param("row") PlayerStorageEntryDto row, * @mbg.generated */ default void syncOriginal(PlayerStorageEntryDto dto) { - dto.setOriginal(selectByPrimaryKey(dto.getPlayerId(), dto.getTenantId(), dto.getKey())); + dto.setOriginal(selectByPrimaryKey(dto.getPlayerId(), dto.getGameId(), dto.getKey())); } /** @@ -171,7 +171,7 @@ default void syncOriginal(List dtos) { final var example = new PlayerStorageEntryExample(); example.createCriteria().andPlayerIdIn(dtos.stream().map(PlayerStorageEntryDto::getPlayerId).toList()); - example.createCriteria().andTenantIdIn(dtos.stream().map(PlayerStorageEntryDto::getTenantId).toList()); + example.createCriteria().andGameIdIn(dtos.stream().map(PlayerStorageEntryDto::getGameId).toList()); example.createCriteria().andKeyIn(dtos.stream().map(PlayerStorageEntryDto::getKey).toList()); final var originals = selectByExample(example); originals.forEach(original -> dtos.forEach(dto -> { diff --git a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base/PlayerStorageRevisionBaseMapper.java b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base/PlayerStorageRevisionBaseMapper.java index d0c01ec..ec2cbc9 100644 --- a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base/PlayerStorageRevisionBaseMapper.java +++ b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base/PlayerStorageRevisionBaseMapper.java @@ -8,7 +8,7 @@ import org.apache.ibatis.session.RowBounds; @Mapper -@SuppressWarnings({"JavadocDeclaration", "DuplicatedCode"}) +@SuppressWarnings({"all"}) public interface PlayerStorageRevisionBaseMapper { /** * This method was generated by MyBatis Generator. This method corresponds to @@ -32,7 +32,7 @@ public interface PlayerStorageRevisionBaseMapper { * * @mbg.generated */ - int deleteByPrimaryKey(@Param("playerId") String playerId, @Param("tenantId") String tenantId, + int deleteByPrimaryKey(@Param("playerId") String playerId, @Param("gameId") String gameId, @Param("playerStorageRevisionId") String playerStorageRevisionId); /** @@ -74,7 +74,7 @@ List selectByExampleWithRowbounds(PlayerStorageRevisio * * @mbg.generated */ - PlayerStorageRevisionDto selectByPrimaryKey(@Param("playerId") String playerId, @Param("tenantId") String tenantId, + PlayerStorageRevisionDto selectByPrimaryKey(@Param("playerId") String playerId, @Param("gameId") String gameId, @Param("playerStorageRevisionId") String playerStorageRevisionId); /** @@ -124,7 +124,7 @@ int updateByExample(@Param("row") PlayerStorageRevisionDto row, * @mbg.generated */ default void syncOriginal(PlayerStorageRevisionDto dto) { - dto.setOriginal(selectByPrimaryKey(dto.getPlayerId(), dto.getTenantId(), dto.getPlayerStorageRevisionId())); + dto.setOriginal(selectByPrimaryKey(dto.getPlayerId(), dto.getGameId(), dto.getPlayerStorageRevisionId())); } /** @@ -139,7 +139,7 @@ default void syncOriginal(List dtos) { final var example = new PlayerStorageRevisionExample(); example.createCriteria().andPlayerIdIn(dtos.stream().map(PlayerStorageRevisionDto::getPlayerId).toList()); - example.createCriteria().andTenantIdIn(dtos.stream().map(PlayerStorageRevisionDto::getTenantId).toList()); + example.createCriteria().andGameIdIn(dtos.stream().map(PlayerStorageRevisionDto::getGameId).toList()); example.createCriteria().andPlayerStorageRevisionIdIn( dtos.stream().map(PlayerStorageRevisionDto::getPlayerStorageRevisionId).toList()); final var originals = selectByExample(example); diff --git a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base/RTenantOperatorBaseMapper.java b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base/RGameOperatorBaseMapper.java similarity index 57% rename from app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base/RTenantOperatorBaseMapper.java rename to app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base/RGameOperatorBaseMapper.java index 4f6a74c..30a0521 100644 --- a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base/RTenantOperatorBaseMapper.java +++ b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base/RGameOperatorBaseMapper.java @@ -1,126 +1,125 @@ package net.averak.gsync.adapter.dao.mapper.base; import java.util.List; -import net.averak.gsync.adapter.dao.dto.base.RTenantOperatorDto; -import net.averak.gsync.adapter.dao.dto.base.RTenantOperatorExample; +import net.averak.gsync.adapter.dao.dto.base.RGameOperatorDto; +import net.averak.gsync.adapter.dao.dto.base.RGameOperatorExample; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.session.RowBounds; @Mapper -@SuppressWarnings({"JavadocDeclaration", "DuplicatedCode"}) -public interface RTenantOperatorBaseMapper { +@SuppressWarnings({"all"}) +public interface RGameOperatorBaseMapper { /** * This method was generated by MyBatis Generator. This method corresponds to - * the database table gsync_r_tenant_operator + * the database table gsync_r_game_operator * * @mbg.generated */ - long countByExample(RTenantOperatorExample example); + long countByExample(RGameOperatorExample example); /** * This method was generated by MyBatis Generator. This method corresponds to - * the database table gsync_r_tenant_operator + * the database table gsync_r_game_operator * * @mbg.generated */ - int deleteByExample(RTenantOperatorExample example); + int deleteByExample(RGameOperatorExample example); /** * This method was generated by MyBatis Generator. This method corresponds to - * the database table gsync_r_tenant_operator + * the database table gsync_r_game_operator * * @mbg.generated */ - int deleteByPrimaryKey(@Param("operatorId") String operatorId, @Param("tenantId") String tenantId); + int deleteByPrimaryKey(@Param("operatorId") String operatorId, @Param("gameId") String gameId); /** * This method was generated by MyBatis Generator. This method corresponds to - * the database table gsync_r_tenant_operator + * the database table gsync_r_game_operator * * @mbg.generated */ - int insert(RTenantOperatorDto row); + int insert(RGameOperatorDto row); /** * This method was generated by MyBatis Generator. This method corresponds to - * the database table gsync_r_tenant_operator + * the database table gsync_r_game_operator * * @mbg.generated */ - int insertSelective(RTenantOperatorDto row); + int insertSelective(RGameOperatorDto row); /** * This method was generated by MyBatis Generator. This method corresponds to - * the database table gsync_r_tenant_operator + * the database table gsync_r_game_operator * * @mbg.generated */ - List selectByExampleWithRowbounds(RTenantOperatorExample example, RowBounds rowBounds); + List selectByExampleWithRowbounds(RGameOperatorExample example, RowBounds rowBounds); /** * This method was generated by MyBatis Generator. This method corresponds to - * the database table gsync_r_tenant_operator + * the database table gsync_r_game_operator * * @mbg.generated */ - List selectByExample(RTenantOperatorExample example); + List selectByExample(RGameOperatorExample example); /** * This method was generated by MyBatis Generator. This method corresponds to - * the database table gsync_r_tenant_operator + * the database table gsync_r_game_operator * * @mbg.generated */ - RTenantOperatorDto selectByPrimaryKey(@Param("operatorId") String operatorId, @Param("tenantId") String tenantId); + RGameOperatorDto selectByPrimaryKey(@Param("operatorId") String operatorId, @Param("gameId") String gameId); /** * This method was generated by MyBatis Generator. This method corresponds to - * the database table gsync_r_tenant_operator + * the database table gsync_r_game_operator * * @mbg.generated */ - int updateByExampleSelective(@Param("row") RTenantOperatorDto row, - @Param("example") RTenantOperatorExample example); + int updateByExampleSelective(@Param("row") RGameOperatorDto row, @Param("example") RGameOperatorExample example); /** * This method was generated by MyBatis Generator. This method corresponds to - * the database table gsync_r_tenant_operator + * the database table gsync_r_game_operator * * @mbg.generated */ - int updateByExample(@Param("row") RTenantOperatorDto row, @Param("example") RTenantOperatorExample example); + int updateByExample(@Param("row") RGameOperatorDto row, @Param("example") RGameOperatorExample example); /** * This method was generated by MyBatis Generator. This method corresponds to - * the database table gsync_r_tenant_operator + * the database table gsync_r_game_operator * * @mbg.generated */ - int updateByPrimaryKeySelective(RTenantOperatorDto row); + int updateByPrimaryKeySelective(RGameOperatorDto row); /** * This method was generated by MyBatis Generator. This method corresponds to - * the database table gsync_r_tenant_operator + * the database table gsync_r_game_operator * * @mbg.generated */ - int updateByPrimaryKey(RTenantOperatorDto row); + int updateByPrimaryKey(RGameOperatorDto row); /** * 複数レコードを一括で INSERT する * * @mbg.generated */ - void bulkInsert(@Param("dtos") List dtos); + void bulkInsert(@Param("dtos") List dtos); /** * PK でレコード検索し、存在する場合は original にセットする * * @mbg.generated */ - default void syncOriginal(RTenantOperatorDto dto) { - dto.setOriginal(selectByPrimaryKey(dto.getOperatorId(), dto.getTenantId())); + default void syncOriginal(RGameOperatorDto dto) { + dto.setOriginal(selectByPrimaryKey(dto.getOperatorId(), dto.getGameId())); } /** @@ -128,14 +127,14 @@ default void syncOriginal(RTenantOperatorDto dto) { * * @mbg.generated */ - default void syncOriginal(List dtos) { + default void syncOriginal(List dtos) { if (dtos.isEmpty()) { return; } - final var example = new RTenantOperatorExample(); - example.createCriteria().andOperatorIdIn(dtos.stream().map(RTenantOperatorDto::getOperatorId).toList()); - example.createCriteria().andTenantIdIn(dtos.stream().map(RTenantOperatorDto::getTenantId).toList()); + final var example = new RGameOperatorExample(); + example.createCriteria().andOperatorIdIn(dtos.stream().map(RGameOperatorDto::getOperatorId).toList()); + example.createCriteria().andGameIdIn(dtos.stream().map(RGameOperatorDto::getGameId).toList()); final var originals = selectByExample(example); originals.forEach(original -> dtos.forEach(dto -> { if (dto.isPrimaryKeyEquals(original)) { @@ -149,7 +148,7 @@ default void syncOriginal(List dtos) { * * @mbg.generated */ - default void insertOrUpdate(RTenantOperatorDto dto) { + default void insertOrUpdate(RGameOperatorDto dto) { if (dto.getOriginal() == null) { insert(dto); } else { @@ -163,7 +162,7 @@ default void insertOrUpdate(RTenantOperatorDto dto) { * * @mbg.generated */ - default void insertOrUpdate(List dtos) { + default void insertOrUpdate(List dtos) { final var inserts = dtos.stream().filter(dto -> dto.getOriginal() == null).toList(); if (!inserts.isEmpty()) { bulkInsert(inserts); diff --git a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base/RequiredClientVersionBaseMapper.java b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base/RequiredClientVersionBaseMapper.java index 6dc4de6..d8f5300 100644 --- a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base/RequiredClientVersionBaseMapper.java +++ b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base/RequiredClientVersionBaseMapper.java @@ -8,7 +8,7 @@ import org.apache.ibatis.session.RowBounds; @Mapper -@SuppressWarnings({"JavadocDeclaration", "DuplicatedCode"}) +@SuppressWarnings({"all"}) public interface RequiredClientVersionBaseMapper { /** * This method was generated by MyBatis Generator. This method corresponds to diff --git a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/extend/OperatorMapper.java b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/extend/OperatorMapper.java index 1cf06a4..a8d7eb2 100644 --- a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/extend/OperatorMapper.java +++ b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/extend/OperatorMapper.java @@ -16,5 +16,5 @@ public interface OperatorMapper extends OperatorBaseMapper { OperatorILDto selectByOperatorId(@Param("operatorId") String operatorId); @Nonnull - List selectByTenantId(@Param("tenantId") String tenantId); + List selectByGameId(@Param("gameId") String gameId); } diff --git a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/extend/PlayerStorageEntryMapper.java b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/extend/PlayerStorageEntryMapper.java index 1609a37..d4b1825 100644 --- a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/extend/PlayerStorageEntryMapper.java +++ b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/extend/PlayerStorageEntryMapper.java @@ -14,7 +14,7 @@ public interface PlayerStorageEntryMapper extends PlayerStorageEntryBaseMapper { @Nonnull - List selectByPlayerIdAndTenantId(@Param("playerId") String playerId, - @Param("tenantId") String tenantId, @Param("exactKeyMatch") List exactKeyMatch, + List selectByPlayerIdAndGameId(@Param("playerId") String playerId, + @Param("gameId") String gameId, @Param("exactKeyMatch") List exactKeyMatch, @Param("forwardKeyMatch") List forwardKeyMatch); } diff --git a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/extend/PlayerStorageRevisionMapper.java b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/extend/PlayerStorageRevisionMapper.java index 5c2292e..5821b3a 100644 --- a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/extend/PlayerStorageRevisionMapper.java +++ b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/extend/PlayerStorageRevisionMapper.java @@ -1,18 +1,20 @@ package net.averak.gsync.adapter.dao.mapper.extend; -import net.averak.gsync.adapter.dao.dto.base.PlayerStorageRevisionDto; -import net.averak.gsync.adapter.dao.mapper.base.PlayerStorageRevisionBaseMapper; +import java.util.List; + +import javax.annotation.Nonnull; + import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; -import javax.annotation.Nonnull; -import java.util.List; +import net.averak.gsync.adapter.dao.dto.base.PlayerStorageRevisionDto; +import net.averak.gsync.adapter.dao.mapper.base.PlayerStorageRevisionBaseMapper; @Mapper public interface PlayerStorageRevisionMapper extends PlayerStorageRevisionBaseMapper { @Nonnull - List selectByPlayerIdAndTenantIdOrderByCreatedAt(@Param("playerId") String playerId, - @Param("tenantId") String tenantId, @Param("limit") int limit); + List selectByPlayerIdAndGameIdOrderByCreatedAt(@Param("playerId") String playerId, + @Param("gameId") String gameId, @Param("limit") int limit); } diff --git a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/repository/GameRepository.kt b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/repository/GameRepository.kt new file mode 100644 index 0000000..57e87cd --- /dev/null +++ b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/repository/GameRepository.kt @@ -0,0 +1,44 @@ +package net.averak.gsync.adapter.repository + +import net.averak.gsync.adapter.dao.dto.base.GameDto +import net.averak.gsync.adapter.dao.dto.base.GameExample +import net.averak.gsync.adapter.dao.mapper.base.GameBaseMapper +import net.averak.gsync.core.game_context.GameContext +import net.averak.gsync.domain.model.Game +import net.averak.gsync.domain.repository.IGameRepository +import org.springframework.stereotype.Repository +import java.util.* + +@Repository +open class GameRepository( + private val gameMapper: GameBaseMapper, +) : IGameRepository { + + override fun findByIDs(gctx: GameContext, ids: List): List { + if (ids.isEmpty()) { + return emptyList() + } + + return gameMapper.selectByExample( + GameExample().apply { + createCriteria().andGameIdIn(ids.map { it.toString() }) + }, + ).map { + Game( + id = UUID.fromString(it.gameId), + name = it.name, + ) + } + } + + override fun save(gctx: GameContext, game: Game) { + val dto = GameDto( + game.id.toString(), + game.name, + gctx.currentTime, + gctx.currentTime, + ) + gameMapper.syncOriginal(dto) + gameMapper.insertOrUpdate(dto) + } +} diff --git a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/repository/OperatorRepository.kt b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/repository/OperatorRepository.kt index 17b492d..ac05fa6 100644 --- a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/repository/OperatorRepository.kt +++ b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/repository/OperatorRepository.kt @@ -3,8 +3,8 @@ package net.averak.gsync.adapter.repository import net.averak.gsync.adapter.dao.dto.extend.OperatorILDto import net.averak.gsync.adapter.dao.mapper.extend.OperatorMapper import net.averak.gsync.core.game_context.GameContext +import net.averak.gsync.domain.model.GameOperationAuthority import net.averak.gsync.domain.model.Operator -import net.averak.gsync.domain.model.OperatorAuthority import net.averak.gsync.domain.repository.IOperatorRepository import org.springframework.stereotype.Repository import java.util.* @@ -18,8 +18,8 @@ open class OperatorRepository( return operatorMapper.selectByOperatorId(id.toString())?.let { convertDtoToModel(it) } } - override fun findByTenantID(gctx: GameContext, tenantID: UUID): List { - return operatorMapper.selectByTenantId(tenantID.toString()).map { + override fun findByGameID(gctx: GameContext, gameID: UUID): List { + return operatorMapper.selectByGameId(gameID.toString()).map { convertDtoToModel(it) } } @@ -28,10 +28,10 @@ open class OperatorRepository( return Operator( id = UUID.fromString(dto.operatorId), email = dto.email, - authorities = dto.rTenantOperators.map { rTenantOperator -> - OperatorAuthority( - tenantID = UUID.fromString(rTenantOperator.tenantId), - isAdmin = rTenantOperator.isAdmin, + authorities = dto.rGameOperators.map { rGameOperator -> + GameOperationAuthority( + gameID = UUID.fromString(rGameOperator.gameId), + isAdmin = rGameOperator.isAdmin, ) }, ) diff --git a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/repository/PlayerStorageRepository.kt b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/repository/PlayerStorageRepository.kt index 8dd441d..c309533 100644 --- a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/repository/PlayerStorageRepository.kt +++ b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/repository/PlayerStorageRepository.kt @@ -24,38 +24,38 @@ open class PlayerStorageRepository( override fun get( gctx: GameContext, playerID: UUID, - tenantID: UUID, + gameID: UUID, criteria: IPlayerStorageRepository.PlayerStorageCriteria, ): PlayerStorage { // リビジョンが存在しない場合は初期リビジョンを返却する必要があるので、まず最新のリビジョンを取得する - val revisionDto = playerStorageRevisionMapper.selectByPlayerIdAndTenantIdOrderByCreatedAt( + val revisionDto = playerStorageRevisionMapper.selectByPlayerIdAndGameIdOrderByCreatedAt( playerID.toString(), - tenantID.toString(), + gameID.toString(), 1, ).firstOrNull() if (revisionDto == null) { // Repository の取得系メソッドが RW トランザクションを要求するのは認知コストが高まるので、リビジョンの初期値を INSERT せず固定値のリビジョンを返す - return PlayerStorage.ofFirstRevision(playerID, tenantID) + return PlayerStorage.ofFirstRevision(playerID, gameID) } if (criteria.isEmpty()) { return PlayerStorage( playerID = playerID, - tenantID = tenantID, + gameID = gameID, revision = UUID.fromString(revisionDto.playerStorageRevisionId), entries = mutableListOf(), ) } - val entries = playerStorageEntryMapper.selectByPlayerIdAndTenantId( + val entries = playerStorageEntryMapper.selectByPlayerIdAndGameId( playerID.toString(), - tenantID.toString(), + gameID.toString(), criteria.exactMatch, criteria.forwardMatch, ).map { convertDtoToModel(it) }.toMutableList() return PlayerStorage( playerID = playerID, - tenantID = tenantID, + gameID = gameID, revision = UUID.fromString(revisionDto.playerStorageRevisionId), entries = entries, ) @@ -73,7 +73,7 @@ open class PlayerStorageRepository( } val revisionDto = PlayerStorageRevisionDto( playerStorage.playerID.toString(), - playerStorage.tenantID.toString(), + playerStorage.gameID.toString(), playerStorage.revision.toString(), gctx.idempotencyKey.toString(), gctx.currentTime, @@ -88,7 +88,7 @@ open class PlayerStorageRepository( playerStorageEntryMapper.deleteByExample( PlayerStorageEntryExample().apply { createCriteria().andPlayerIdEqualTo(playerStorage.playerID.toString()) - .andTenantIdEqualTo(playerStorage.tenantID.toString()) + .andGameIdEqualTo(playerStorage.gameID.toString()) .andKeyIn(clearedEntries.map { it.key }) }, ) @@ -96,7 +96,7 @@ open class PlayerStorageRepository( val notClearedEntries = playerStorage.entries.filter { !it.isCleared() } val entryDtos = notClearedEntries.map { - convertModelToDto(it, playerStorage.playerID, playerStorage.tenantID, gctx.currentTime, gctx.currentTime) + convertModelToDto(it, playerStorage.playerID, playerStorage.gameID, gctx.currentTime, gctx.currentTime) } playerStorageEntryMapper.syncOriginal(entryDtos) playerStorageEntryMapper.insertOrUpdate(entryDtos) @@ -112,13 +112,13 @@ open class PlayerStorageRepository( private fun convertModelToDto( playerStorageEntry: PlayerStorageEntry, playerID: UUID, - tenantID: UUID, + gameID: UUID, createdAt: LocalDateTime, updatedAt: LocalDateTime, ): PlayerStorageEntryDto { return PlayerStorageEntryDto( playerID.toString(), - tenantID.toString(), + gameID.toString(), playerStorageEntry.key, createdAt, updatedAt, diff --git a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/repository/TenantRepository.kt b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/repository/TenantRepository.kt deleted file mode 100644 index 74bc317..0000000 --- a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/repository/TenantRepository.kt +++ /dev/null @@ -1,44 +0,0 @@ -package net.averak.gsync.adapter.repository - -import net.averak.gsync.adapter.dao.dto.base.TenantDto -import net.averak.gsync.adapter.dao.dto.base.TenantExample -import net.averak.gsync.adapter.dao.mapper.base.TenantBaseMapper -import net.averak.gsync.core.game_context.GameContext -import net.averak.gsync.domain.model.Tenant -import net.averak.gsync.domain.repository.ITenantRepository -import org.springframework.stereotype.Repository -import java.util.* - -@Repository -open class TenantRepository( - private val tenantMapper: TenantBaseMapper, -) : ITenantRepository { - - override fun findByIDs(gctx: GameContext, ids: List): List { - if (ids.isEmpty()) { - return emptyList() - } - - return tenantMapper.selectByExample( - TenantExample().apply { - createCriteria().andTenantIdIn(ids.map { it.toString() }) - }, - ).map { - Tenant( - id = UUID.fromString(it.tenantId), - name = it.name, - ) - } - } - - override fun save(gctx: GameContext, tenant: Tenant) { - val dto = TenantDto( - tenant.id.toString(), - tenant.name, - gctx.currentTime, - gctx.currentTime, - ) - tenantMapper.syncOriginal(dto) - tenantMapper.insertOrUpdate(dto) - } -} diff --git a/app/adapter/src/test/groovy/net/averak/gsync/adapter/repository/TenantRepository_UT.groovy b/app/adapter/src/test/groovy/net/averak/gsync/adapter/repository/GameRepository_UT.groovy similarity index 53% rename from app/adapter/src/test/groovy/net/averak/gsync/adapter/repository/TenantRepository_UT.groovy rename to app/adapter/src/test/groovy/net/averak/gsync/adapter/repository/GameRepository_UT.groovy index 6a69274..b8d6741 100644 --- a/app/adapter/src/test/groovy/net/averak/gsync/adapter/repository/TenantRepository_UT.groovy +++ b/app/adapter/src/test/groovy/net/averak/gsync/adapter/repository/GameRepository_UT.groovy @@ -1,22 +1,22 @@ package net.averak.gsync.adapter.repository -import net.averak.gsync.adapter.dao.dto.base.TenantDto +import net.averak.gsync.adapter.dao.dto.base.GameDto import net.averak.gsync.core.game_context.GameContext -import net.averak.gsync.domain.model.Tenant +import net.averak.gsync.domain.model.Game import net.averak.gsync.testkit.Faker import net.averak.gsync.testkit.Fixture import org.springframework.beans.factory.annotation.Autowired -class TenantRepository_UT extends AbstractRepository_UT { +class GameRepository_UT extends AbstractRepository_UT { @Autowired - TenantRepository sut + GameRepository sut - def "findByIDs: IDリストからテナントIDリストを取得できる"() { + def "findByIDs: IDリストからゲームリストを取得できる"() { given: Fixture.setup( - Faker.fake(TenantDto, [tenantId: Faker.uuidv5("t1").toString()]), - Faker.fake(TenantDto, [tenantId: Faker.uuidv5("t2").toString()]), + Faker.fake(GameDto, [gameId: Faker.uuidv5("g1").toString()]), + Faker.fake(GameDto, [gameId: Faker.uuidv5("g2").toString()]), ) when: @@ -28,17 +28,17 @@ class TenantRepository_UT extends AbstractRepository_UT { where: ids || expectedIDs [] || [] - [Faker.uuidv5("t1")] || [Faker.uuidv5("t1")] - [Faker.uuidv5("t1"), Faker.uuidv5("t2")] || [Faker.uuidv5("t1"), Faker.uuidv5("t2")] - [Faker.uuidv5("t1"), Faker.uuidv5("t2"), Faker.uuidv5("t3")] || [Faker.uuidv5("t1"), Faker.uuidv5("t2")] + [Faker.uuidv5("g1")] || [Faker.uuidv5("g1")] + [Faker.uuidv5("g1"), Faker.uuidv5("g2")] || [Faker.uuidv5("g1"), Faker.uuidv5("g2")] + [Faker.uuidv5("g1"), Faker.uuidv5("g2"), Faker.uuidv5("g3")] || [Faker.uuidv5("g1"), Faker.uuidv5("g2")] } - def "save: テナントを保存できる"() { + def "save: ゲームを保存できる"() { given: testcase.given() when: - this.sut.save(Faker.fake(GameContext), testcase.when.tenant) + this.sut.save(Faker.fake(GameContext), testcase.when.game) then: testcase.then() @@ -49,16 +49,16 @@ class TenantRepository_UT extends AbstractRepository_UT { name : "レコードが存在する場合、更新される", given: () -> { Fixture.setup( - Faker.fake(TenantDto, [tenantId: Faker.uuidv5("t1").toString()]), + Faker.fake(GameDto, [gameId: Faker.uuidv5("g1").toString()]), ) }, when : [ - tenant: Faker.fake(Tenant, [id: Faker.uuidv5("t1"), name: "updated"]), + game: Faker.fake(Game, [id: Faker.uuidv5("g1"), name: "updated"]), ], then : () -> { - with(sql.rows("SELECT * FROM gsync_tenant")) { + with(sql.rows("SELECT * FROM gsync_game")) { assert it.size() == 1 - assert it[0].tenant_id == Faker.uuidv5("t1").toString() + assert it[0].game_id == Faker.uuidv5("g1").toString() assert it[0].name == "updated" } return true @@ -68,12 +68,12 @@ class TenantRepository_UT extends AbstractRepository_UT { name : "レコードが存在しない場合、作成される", given: () -> { }, when : [ - tenant: Faker.fake(Tenant, [id: Faker.uuidv5("t1"), name: "created"]), + game: Faker.fake(Game, [id: Faker.uuidv5("g1"), name: "created"]), ], then : () -> { - with(sql.rows("SELECT * FROM gsync_tenant")) { + with(sql.rows("SELECT * FROM gsync_game")) { assert it.size() == 1 - assert it[0].tenant_id == Faker.uuidv5("t1").toString() + assert it[0].game_id == Faker.uuidv5("g1").toString() assert it[0].name == "created" } return true diff --git a/app/adapter/src/test/groovy/net/averak/gsync/adapter/repository/OperatorRepository_UT.groovy b/app/adapter/src/test/groovy/net/averak/gsync/adapter/repository/OperatorRepository_UT.groovy index 8a3d5e6..3a3963d 100644 --- a/app/adapter/src/test/groovy/net/averak/gsync/adapter/repository/OperatorRepository_UT.groovy +++ b/app/adapter/src/test/groovy/net/averak/gsync/adapter/repository/OperatorRepository_UT.groovy @@ -1,7 +1,7 @@ package net.averak.gsync.adapter.repository import net.averak.gsync.adapter.dao.dto.base.OperatorDto -import net.averak.gsync.adapter.dao.dto.base.RTenantOperatorDto +import net.averak.gsync.adapter.dao.dto.base.RGameOperatorDto import net.averak.gsync.core.game_context.GameContext import net.averak.gsync.domain.model.Operator import net.averak.gsync.testkit.Faker @@ -19,13 +19,13 @@ class OperatorRepository_UT extends AbstractRepository_UT { operatorId: Faker.uuidv5("o1").toString(), ])) Fixture.setup( - Faker.fake(RTenantOperatorDto, [ + Faker.fake(RGameOperatorDto, [ operatorId: Faker.uuidv5("o1").toString(), - tenantId : Faker.uuidv5("t1").toString(), + gameId : Faker.uuidv5("g1").toString(), ]), - Faker.fake(RTenantOperatorDto, [ + Faker.fake(RGameOperatorDto, [ operatorId: Faker.uuidv5("o1").toString(), - tenantId : Faker.uuidv5("t2").toString(), + gameId : Faker.uuidv5("g2").toString(), ]), ) @@ -45,7 +45,7 @@ class OperatorRepository_UT extends AbstractRepository_UT { then: (Operator v) -> { assert v != null assert v.id == Faker.uuidv5("o1") - assert v.authorities*.tenantID.sort() == [Faker.uuidv5("t1"), Faker.uuidv5("t2")].sort() + assert v.authorities*.gameID.sort() == [Faker.uuidv5("g1"), Faker.uuidv5("g2")].sort() return true }, ], @@ -62,7 +62,7 @@ class OperatorRepository_UT extends AbstractRepository_UT { ] } - def "findByTenantID: テナントIDから取得できる"() { + def "findByGameID: ゲームIDから取得できる"() { given: Fixture.setup( Faker.fake(OperatorDto, [ @@ -73,29 +73,29 @@ class OperatorRepository_UT extends AbstractRepository_UT { ]), ) Fixture.setup( - Faker.fake(RTenantOperatorDto, [ + Faker.fake(RGameOperatorDto, [ operatorId: Faker.uuidv5("o1").toString(), - tenantId : Faker.uuidv5("t1").toString(), + gameId : Faker.uuidv5("g1").toString(), ]), - Faker.fake(RTenantOperatorDto, [ + Faker.fake(RGameOperatorDto, [ operatorId: Faker.uuidv5("o1").toString(), - tenantId : Faker.uuidv5("t2").toString(), + gameId : Faker.uuidv5("g2").toString(), ]), - Faker.fake(RTenantOperatorDto, [ + Faker.fake(RGameOperatorDto, [ operatorId: Faker.uuidv5("o2").toString(), - tenantId : Faker.uuidv5("t1").toString(), + gameId : Faker.uuidv5("g1").toString(), ]), ) when: - final actual = this.sut.findByTenantID(Faker.fake(GameContext), tenantID) + final actual = this.sut.findByGameID(Faker.fake(GameContext), gameID) then: actual*.id.sort() == expectedIDs.sort() where: - tenantID || expectedIDs - Faker.uuidv5("t1") || [Faker.uuidv5("o1"), Faker.uuidv5("o2")] - Faker.uuidv5("t2") || [Faker.uuidv5("o1")] + gameID || expectedIDs + Faker.uuidv5("g1") || [Faker.uuidv5("o1"), Faker.uuidv5("o2")] + Faker.uuidv5("g2") || [Faker.uuidv5("o1")] } } diff --git a/app/adapter/src/test/groovy/net/averak/gsync/adapter/repository/PlayerStorageRepository_UT.groovy b/app/adapter/src/test/groovy/net/averak/gsync/adapter/repository/PlayerStorageRepository_UT.groovy index 3c61b0d..98ece4a 100644 --- a/app/adapter/src/test/groovy/net/averak/gsync/adapter/repository/PlayerStorageRepository_UT.groovy +++ b/app/adapter/src/test/groovy/net/averak/gsync/adapter/repository/PlayerStorageRepository_UT.groovy @@ -34,13 +34,13 @@ class PlayerStorageRepository_UT extends AbstractRepository_UT { Fixture.setup( Faker.fake(PlayerStorageRevisionDto, [ "playerId" : Faker.uuidv5("p1").toString(), - "tenantId" : Faker.uuidv5("t1").toString(), + "gameId" : Faker.uuidv5("g1").toString(), "playerStorageRevisionId": Faker.uuidv5("outdated revision").toString(), "createdAt" : LocalDateTime.of(2000, 1, 1, 0, 0, 0), ]), Faker.fake(PlayerStorageRevisionDto, [ "playerId" : Faker.uuidv5("p1").toString(), - "tenantId" : Faker.uuidv5("t1").toString(), + "gameId" : Faker.uuidv5("g1").toString(), "playerStorageRevisionId": Faker.uuidv5("latest revision").toString(), "createdAt" : LocalDateTime.of(2000, 1, 1, 0, 0, 1), ]), @@ -48,48 +48,48 @@ class PlayerStorageRepository_UT extends AbstractRepository_UT { Fixture.setup( Faker.fake(PlayerStorageEntryDto, [ "playerId": Faker.uuidv5("p1").toString(), - "tenantId": Faker.uuidv5("t1").toString(), + "gameId" : Faker.uuidv5("g1").toString(), "key" : "group1#key1", "value" : "value1".bytes, ]), Faker.fake(PlayerStorageEntryDto, [ "playerId": Faker.uuidv5("p1").toString(), - "tenantId": Faker.uuidv5("t1").toString(), + "gameId" : Faker.uuidv5("g1").toString(), "key" : "group1#key2", "value" : "value2".bytes, ]), Faker.fake(PlayerStorageEntryDto, [ "playerId": Faker.uuidv5("p1").toString(), - "tenantId": Faker.uuidv5("t1").toString(), + "gameId" : Faker.uuidv5("g1").toString(), "key" : "group2#key1", "value" : "value3".bytes, ]), Faker.fake(PlayerStorageEntryDto, [ "playerId": Faker.uuidv5("p1").toString(), - "tenantId": Faker.uuidv5("t1").toString(), + "gameId" : Faker.uuidv5("g1").toString(), "key" : "group2#key2", "value" : "value4".bytes, ]), ) when: - final actual = sut.get(Faker.fake(GameContext), playerID, tenantID, criteria) + final actual = sut.get(Faker.fake(GameContext), playerID, gameID, criteria) then: actual == expected where: - playerID | tenantID | criteria || expected - Faker.uuidv5("p1") | Faker.uuidv5("t1") | new IPlayerStorageRepository.PlayerStorageCriteria(["group1#key1"], []) || new PlayerStorage(Faker.uuidv5("p1"), Faker.uuidv5("t1"), Faker.uuidv5("latest revision"), [new PlayerStorageEntry("group1#key1", "value1".bytes)]) - Faker.uuidv5("p1") | Faker.uuidv5("t1") | new IPlayerStorageRepository.PlayerStorageCriteria(["group1#key1", "group1#key2"], []) || new PlayerStorage(Faker.uuidv5("p1"), Faker.uuidv5("t1"), Faker.uuidv5("latest revision"), [new PlayerStorageEntry("group1#key1", "value1".bytes), new PlayerStorageEntry("group1#key2", "value2".bytes)]) - Faker.uuidv5("p1") | Faker.uuidv5("t1") | new IPlayerStorageRepository.PlayerStorageCriteria([], ["group2"]) || new PlayerStorage(Faker.uuidv5("p1"), Faker.uuidv5("t1"), Faker.uuidv5("latest revision"), [new PlayerStorageEntry("group2#key1", "value3".bytes), new PlayerStorageEntry("group2#key2", "value4".bytes)]) - Faker.uuidv5("p1") | Faker.uuidv5("t1") | new IPlayerStorageRepository.PlayerStorageCriteria(["group1#key1"], ["group2"]) || new PlayerStorage(Faker.uuidv5("p1"), Faker.uuidv5("t1"), Faker.uuidv5("latest revision"), [new PlayerStorageEntry("group1#key1", "value1".bytes), new PlayerStorageEntry("group2#key1", "value3".bytes), new PlayerStorageEntry("group2#key2", "value4".bytes)]) - Faker.uuidv5("p1") | Faker.uuidv5("t1") | new IPlayerStorageRepository.PlayerStorageCriteria(["group3#key1"], []) || new PlayerStorage(Faker.uuidv5("p1"), Faker.uuidv5("t1"), Faker.uuidv5("latest revision"), []) - Faker.uuidv5("p1") | Faker.uuidv5("t1") | new IPlayerStorageRepository.PlayerStorageCriteria([], ["group3"]) || new PlayerStorage(Faker.uuidv5("p1"), Faker.uuidv5("t1"), Faker.uuidv5("latest revision"), []) - Faker.uuidv5("p1") | Faker.uuidv5("t1") | new IPlayerStorageRepository.PlayerStorageCriteria([], []) || new PlayerStorage(Faker.uuidv5("p1"), Faker.uuidv5("t1"), Faker.uuidv5("latest revision"), []) + playerID | gameID | criteria || expected + Faker.uuidv5("p1") | Faker.uuidv5("g1") | new IPlayerStorageRepository.PlayerStorageCriteria(["group1#key1"], []) || new PlayerStorage(Faker.uuidv5("p1"), Faker.uuidv5("g1"), Faker.uuidv5("latest revision"), [new PlayerStorageEntry("group1#key1", "value1".bytes)]) + Faker.uuidv5("p1") | Faker.uuidv5("g1") | new IPlayerStorageRepository.PlayerStorageCriteria(["group1#key1", "group1#key2"], []) || new PlayerStorage(Faker.uuidv5("p1"), Faker.uuidv5("g1"), Faker.uuidv5("latest revision"), [new PlayerStorageEntry("group1#key1", "value1".bytes), new PlayerStorageEntry("group1#key2", "value2".bytes)]) + Faker.uuidv5("p1") | Faker.uuidv5("g1") | new IPlayerStorageRepository.PlayerStorageCriteria([], ["group2"]) || new PlayerStorage(Faker.uuidv5("p1"), Faker.uuidv5("g1"), Faker.uuidv5("latest revision"), [new PlayerStorageEntry("group2#key1", "value3".bytes), new PlayerStorageEntry("group2#key2", "value4".bytes)]) + Faker.uuidv5("p1") | Faker.uuidv5("g1") | new IPlayerStorageRepository.PlayerStorageCriteria(["group1#key1"], ["group2"]) || new PlayerStorage(Faker.uuidv5("p1"), Faker.uuidv5("g1"), Faker.uuidv5("latest revision"), [new PlayerStorageEntry("group1#key1", "value1".bytes), new PlayerStorageEntry("group2#key1", "value3".bytes), new PlayerStorageEntry("group2#key2", "value4".bytes)]) + Faker.uuidv5("p1") | Faker.uuidv5("g1") | new IPlayerStorageRepository.PlayerStorageCriteria(["group3#key1"], []) || new PlayerStorage(Faker.uuidv5("p1"), Faker.uuidv5("g1"), Faker.uuidv5("latest revision"), []) + Faker.uuidv5("p1") | Faker.uuidv5("g1") | new IPlayerStorageRepository.PlayerStorageCriteria([], ["group3"]) || new PlayerStorage(Faker.uuidv5("p1"), Faker.uuidv5("g1"), Faker.uuidv5("latest revision"), []) + Faker.uuidv5("p1") | Faker.uuidv5("g1") | new IPlayerStorageRepository.PlayerStorageCriteria([], []) || new PlayerStorage(Faker.uuidv5("p1"), Faker.uuidv5("g1"), Faker.uuidv5("latest revision"), []) // 以下、リビジョンが存在しないケース - Faker.uuidv5("p2") | Faker.uuidv5("t1") | new IPlayerStorageRepository.PlayerStorageCriteria([], []) || new PlayerStorage(Faker.uuidv5("p2"), Faker.uuidv5("t1"), UUID.fromString("00000000-0000-0000-0000-000000000000"), []) - Faker.uuidv5("p1") | Faker.uuidv5("t2") | new IPlayerStorageRepository.PlayerStorageCriteria([], []) || new PlayerStorage(Faker.uuidv5("p1"), Faker.uuidv5("t2"), UUID.fromString("00000000-0000-0000-0000-000000000000"), []) + Faker.uuidv5("p2") | Faker.uuidv5("g1") | new IPlayerStorageRepository.PlayerStorageCriteria([], []) || new PlayerStorage(Faker.uuidv5("p2"), Faker.uuidv5("g1"), UUID.fromString("00000000-0000-0000-0000-000000000000"), []) + Faker.uuidv5("p1") | Faker.uuidv5("g2") | new IPlayerStorageRepository.PlayerStorageCriteria([], []) || new PlayerStorage(Faker.uuidv5("p1"), Faker.uuidv5("g2"), UUID.fromString("00000000-0000-0000-0000-000000000000"), []) } def "save: プレイヤーストレージを保存できる"() { @@ -102,7 +102,7 @@ class PlayerStorageRepository_UT extends AbstractRepository_UT { Fixture.setup( Faker.fake(PlayerStorageRevisionDto, [ "playerId" : Faker.uuidv5("p1").toString(), - "tenantId" : Faker.uuidv5("t1").toString(), + "gameId" : Faker.uuidv5("g1").toString(), "playerStorageRevisionId": Faker.uuidv5("r1").toString(), "idempotencyKey" : Faker.uuidv5("i1").toString(), "createdAt" : LocalDateTime.of(2000, 1, 1, 0, 0, 0), @@ -112,7 +112,7 @@ class PlayerStorageRepository_UT extends AbstractRepository_UT { Fixture.setup( Faker.fake(PlayerStorageEntryDto, [ "playerId" : Faker.uuidv5("p1").toString(), - "tenantId" : Faker.uuidv5("t1").toString(), + "gameId" : Faker.uuidv5("g1").toString(), "key" : "key1", "value" : "value1".bytes, "createdAt": LocalDateTime.of(2000, 1, 1, 0, 0, 0), @@ -137,7 +137,7 @@ class PlayerStorageRepository_UT extends AbstractRepository_UT { ]), playerStorage: Faker.fake(PlayerStorage, [ playerID: Faker.uuidv5("p1"), - tenantID: Faker.uuidv5("t1"), + gameID : Faker.uuidv5("g1"), revision: Faker.uuidv5("r2"), entries : [ Faker.fake(PlayerStorageEntry, [ @@ -171,7 +171,7 @@ class PlayerStorageRepository_UT extends AbstractRepository_UT { ]), playerStorage: Faker.fake(PlayerStorage, [ playerID: Faker.uuidv5("p1"), - tenantID: Faker.uuidv5("t1"), + gameID : Faker.uuidv5("g1"), revision: Faker.uuidv5("r1"), entries : [ Faker.fake(PlayerStorageEntry, [ @@ -207,7 +207,7 @@ class PlayerStorageRepository_UT extends AbstractRepository_UT { ]), playerStorage: Faker.fake(PlayerStorage, [ playerID: Faker.uuidv5("p1"), - tenantID: Faker.uuidv5("t1"), + gameID : Faker.uuidv5("g1"), revision: Faker.uuidv5("r1"), entries : [ Faker.fake(PlayerStorageEntry, [ @@ -242,7 +242,7 @@ class PlayerStorageRepository_UT extends AbstractRepository_UT { Fixture.setup( Faker.fake(PlayerStorageRevisionDto, [ "playerId" : Faker.uuidv5("p1").toString(), - "tenantId" : Faker.uuidv5("t1").toString(), + "gameId" : Faker.uuidv5("g1").toString(), "playerStorageRevisionId": Faker.uuidv5("r1").toString(), "idempotencyKey" : Faker.uuidv5("i1").toString(), ]), @@ -252,7 +252,7 @@ class PlayerStorageRepository_UT extends AbstractRepository_UT { final gctx = Faker.fake(GameContext, [idempotencyKey: Faker.uuidv5("i1"),]) final playerStorage = Faker.fake(PlayerStorage, [ playerID: Faker.uuidv5("p1"), - tenantID: Faker.uuidv5("t1"), + gameID : Faker.uuidv5("g1"), revision: Faker.uuidv5("r1"), entries : [ Faker.fake(PlayerStorageEntry, [ diff --git a/app/domain/src/main/kotlin/net/averak/gsync/domain/model/Tenant.kt b/app/domain/src/main/kotlin/net/averak/gsync/domain/model/Game.kt similarity index 63% rename from app/domain/src/main/kotlin/net/averak/gsync/domain/model/Tenant.kt rename to app/domain/src/main/kotlin/net/averak/gsync/domain/model/Game.kt index 2504cc3..01f80d9 100644 --- a/app/domain/src/main/kotlin/net/averak/gsync/domain/model/Tenant.kt +++ b/app/domain/src/main/kotlin/net/averak/gsync/domain/model/Game.kt @@ -3,9 +3,9 @@ package net.averak.gsync.domain.model import java.util.* /** - * テナント (=ゲームタイトル) + * ゲーム */ -data class Tenant( +data class Game( val id: UUID, val name: String, ) diff --git a/app/domain/src/main/kotlin/net/averak/gsync/domain/model/Operator.kt b/app/domain/src/main/kotlin/net/averak/gsync/domain/model/Operator.kt index fef5126..90f701b 100644 --- a/app/domain/src/main/kotlin/net/averak/gsync/domain/model/Operator.kt +++ b/app/domain/src/main/kotlin/net/averak/gsync/domain/model/Operator.kt @@ -8,10 +8,10 @@ import java.util.* data class Operator( val id: UUID, val email: String, - val authorities: List, + val authorities: List, ) -data class OperatorAuthority( - val tenantID: UUID, +data class GameOperationAuthority( + val gameID: UUID, val isAdmin: Boolean, ) diff --git a/app/domain/src/main/kotlin/net/averak/gsync/domain/model/PlayerStorage.kt b/app/domain/src/main/kotlin/net/averak/gsync/domain/model/PlayerStorage.kt index 18be878..f9244cf 100644 --- a/app/domain/src/main/kotlin/net/averak/gsync/domain/model/PlayerStorage.kt +++ b/app/domain/src/main/kotlin/net/averak/gsync/domain/model/PlayerStorage.kt @@ -12,7 +12,7 @@ import java.util.* */ data class PlayerStorage( val playerID: UUID, - val tenantID: UUID, + val gameID: UUID, var revision: UUID, /** * [net.averak.gsync.domain.repository.IPlayerStorageRepository.PlayerStorageCriteria] による検索結果が格納されるので、全エントリーが入っているとは限らない @@ -25,10 +25,10 @@ data class PlayerStorage( private val FIRST_REVISION = UUID.fromString("00000000-0000-0000-0000-000000000000") @JvmStatic - fun ofFirstRevision(playerID: UUID, tenantID: UUID): PlayerStorage { + fun ofFirstRevision(playerID: UUID, gameID: UUID): PlayerStorage { return PlayerStorage( playerID = playerID, - tenantID = tenantID, + gameID = gameID, revision = FIRST_REVISION, entries = mutableListOf(), ) diff --git a/app/domain/src/main/kotlin/net/averak/gsync/domain/repository/IGameRepository.kt b/app/domain/src/main/kotlin/net/averak/gsync/domain/repository/IGameRepository.kt new file mode 100644 index 0000000..ba59648 --- /dev/null +++ b/app/domain/src/main/kotlin/net/averak/gsync/domain/repository/IGameRepository.kt @@ -0,0 +1,12 @@ +package net.averak.gsync.domain.repository + +import net.averak.gsync.core.game_context.GameContext +import net.averak.gsync.domain.model.Game +import java.util.* + +interface IGameRepository { + + fun findByIDs(gctx: GameContext, ids: List): List + + fun save(gctx: GameContext, game: Game) +} diff --git a/app/domain/src/main/kotlin/net/averak/gsync/domain/repository/IOperatorRepository.kt b/app/domain/src/main/kotlin/net/averak/gsync/domain/repository/IOperatorRepository.kt index 9b3450f..f2fd9b0 100644 --- a/app/domain/src/main/kotlin/net/averak/gsync/domain/repository/IOperatorRepository.kt +++ b/app/domain/src/main/kotlin/net/averak/gsync/domain/repository/IOperatorRepository.kt @@ -8,5 +8,5 @@ interface IOperatorRepository { fun findByID(gctx: GameContext, id: UUID): Operator? - fun findByTenantID(gctx: GameContext, tenantID: UUID): List + fun findByGameID(gctx: GameContext, gameID: UUID): List } diff --git a/app/domain/src/main/kotlin/net/averak/gsync/domain/repository/IPlayerStorageRepository.kt b/app/domain/src/main/kotlin/net/averak/gsync/domain/repository/IPlayerStorageRepository.kt index de3290a..4a5e4a8 100644 --- a/app/domain/src/main/kotlin/net/averak/gsync/domain/repository/IPlayerStorageRepository.kt +++ b/app/domain/src/main/kotlin/net/averak/gsync/domain/repository/IPlayerStorageRepository.kt @@ -7,7 +7,7 @@ import java.util.* interface IPlayerStorageRepository { - fun get(gctx: GameContext, playerID: UUID, tenantID: UUID, criteria: PlayerStorageCriteria): PlayerStorage + fun get(gctx: GameContext, playerID: UUID, gameID: UUID, criteria: PlayerStorageCriteria): PlayerStorage @Throws(AlreadyDoneException::class) fun save(gctx: GameContext, playerStorage: PlayerStorage) diff --git a/app/domain/src/main/kotlin/net/averak/gsync/domain/repository/ITenantRepository.kt b/app/domain/src/main/kotlin/net/averak/gsync/domain/repository/ITenantRepository.kt deleted file mode 100644 index b7ea428..0000000 --- a/app/domain/src/main/kotlin/net/averak/gsync/domain/repository/ITenantRepository.kt +++ /dev/null @@ -1,12 +0,0 @@ -package net.averak.gsync.domain.repository - -import net.averak.gsync.core.game_context.GameContext -import net.averak.gsync.domain.model.Tenant -import java.util.* - -interface ITenantRepository { - - fun findByIDs(gctx: GameContext, ids: List): List - - fun save(gctx: GameContext, tenant: Tenant) -} diff --git a/app/infrastructure/src/main/kotlin/net/averak/gsync/infrastructure/mybatis/plugin/BulkInsertPlugin.kt b/app/infrastructure/src/main/kotlin/net/averak/gsync/infrastructure/mybatis/plugin/BulkInsertPlugin.kt index 143df5e..7aa73c3 100644 --- a/app/infrastructure/src/main/kotlin/net/averak/gsync/infrastructure/mybatis/plugin/BulkInsertPlugin.kt +++ b/app/infrastructure/src/main/kotlin/net/averak/gsync/infrastructure/mybatis/plugin/BulkInsertPlugin.kt @@ -38,7 +38,7 @@ class BulkInsertPlugin : PluginAdapter() { interfaze.addMethod(method) - return true + return super.clientGenerated(interfaze, introspectedTable) } override fun sqlMapDocumentGenerated(document: Document, introspectedTable: IntrospectedTable): Boolean { @@ -74,6 +74,6 @@ class BulkInsertPlugin : PluginAdapter() { document.rootElement.addElement(element) - return true + return super.sqlMapDocumentGenerated(document, introspectedTable) } } diff --git a/app/infrastructure/src/main/kotlin/net/averak/gsync/infrastructure/mybatis/plugin/IgnoreTablePlugin.kt b/app/infrastructure/src/main/kotlin/net/averak/gsync/infrastructure/mybatis/plugin/IgnoreTablePlugin.kt deleted file mode 100644 index 4085146..0000000 --- a/app/infrastructure/src/main/kotlin/net/averak/gsync/infrastructure/mybatis/plugin/IgnoreTablePlugin.kt +++ /dev/null @@ -1,45 +0,0 @@ -package net.averak.gsync.infrastructure.mybatis.plugin - -import org.mybatis.generator.api.GeneratedXmlFile -import org.mybatis.generator.api.IntrospectedTable -import org.mybatis.generator.api.PluginAdapter -import org.mybatis.generator.api.dom.java.Interface -import org.mybatis.generator.api.dom.java.TopLevelClass - -/** - * MyBatis Generatorで不要なテーブルを無視するプラグイン - */ -class IgnoreTablePlugin : PluginAdapter() { - - private val ignoredTableNames = listOf( - "flyway_schema_history", - "oauth2_authorized_client", - "SPRING_SESSION", - "SPRING_SESSION_ATTRIBUTES", - ) - - override fun validate(warnings: List): Boolean { - return true - } - - private fun checkIsTableToGenerate(introspectedTable: IntrospectedTable): Boolean { - val tableName = introspectedTable.fullyQualifiedTableNameAtRuntime.replace("`", "") - return ignoredTableNames.none { tableName == it } - } - - override fun modelBaseRecordClassGenerated(topLevelClass: TopLevelClass, introspectedTable: IntrospectedTable): Boolean { - return checkIsTableToGenerate(introspectedTable) - } - - override fun modelExampleClassGenerated(topLevelClass: TopLevelClass, introspectedTable: IntrospectedTable): Boolean { - return checkIsTableToGenerate(introspectedTable) - } - - override fun clientGenerated(interfaze: Interface, introspectedTable: IntrospectedTable): Boolean { - return checkIsTableToGenerate(introspectedTable) - } - - override fun sqlMapGenerated(sqlMap: GeneratedXmlFile, introspectedTable: IntrospectedTable): Boolean { - return checkIsTableToGenerate(introspectedTable) - } -} diff --git a/app/infrastructure/src/main/kotlin/net/averak/gsync/infrastructure/mybatis/plugin/InsertOrUpdatePlugin.kt b/app/infrastructure/src/main/kotlin/net/averak/gsync/infrastructure/mybatis/plugin/InsertOrUpdatePlugin.kt index 1f75447..8df301b 100644 --- a/app/infrastructure/src/main/kotlin/net/averak/gsync/infrastructure/mybatis/plugin/InsertOrUpdatePlugin.kt +++ b/app/infrastructure/src/main/kotlin/net/averak/gsync/infrastructure/mybatis/plugin/InsertOrUpdatePlugin.kt @@ -31,7 +31,7 @@ class InsertOrUpdatePlugin : PluginAdapter() { method.bodyLines += "return ${expressions.joinToString(" && ")};" topLevelClass.addMethod(method) - return true + return super.modelBaseRecordClassGenerated(topLevelClass, introspectedTable) } override fun clientGenerated(interfaze: Interface, introspectedTable: IntrospectedTable): Boolean { @@ -41,7 +41,7 @@ class InsertOrUpdatePlugin : PluginAdapter() { addInsertOrUpdateMethod(interfaze, introspectedTable) addInsertOrUpdateMultiMethod(interfaze, introspectedTable) } - return true + return super.clientGenerated(interfaze, introspectedTable) } private fun addSyncOriginalMethod(interfaze: Interface, introspectedTable: IntrospectedTable) { diff --git a/app/infrastructure/src/main/kotlin/net/averak/gsync/infrastructure/mybatis/plugin/ResolveNullPlugin.kt b/app/infrastructure/src/main/kotlin/net/averak/gsync/infrastructure/mybatis/plugin/ResolveNullPlugin.kt index b9b5681..ff0d339 100644 --- a/app/infrastructure/src/main/kotlin/net/averak/gsync/infrastructure/mybatis/plugin/ResolveNullPlugin.kt +++ b/app/infrastructure/src/main/kotlin/net/averak/gsync/infrastructure/mybatis/plugin/ResolveNullPlugin.kt @@ -16,15 +16,7 @@ class ResolveNullPlugin : PluginAdapter() { override fun modelBaseRecordClassGenerated(topLevelClass: TopLevelClass, introspectedTable: IntrospectedTable): Boolean { resolveNullable(topLevelClass, introspectedTable) - return true - } - - override fun modelPrimaryKeyClassGenerated(topLevelClass: TopLevelClass, introspectedTable: IntrospectedTable): Boolean { - return modelBaseRecordClassGenerated(topLevelClass, introspectedTable) - } - - override fun modelRecordWithBLOBsClassGenerated(topLevelClass: TopLevelClass, introspectedTable: IntrospectedTable): Boolean { - return modelBaseRecordClassGenerated(topLevelClass, introspectedTable) + return super.modelBaseRecordClassGenerated(topLevelClass, introspectedTable) } private fun resolveNullable(topLevelClass: TopLevelClass, introspectedTable: IntrospectedTable) { @@ -32,9 +24,8 @@ class ResolveNullPlugin : PluginAdapter() { topLevelClass.addImportedType(FullyQualifiedJavaType("javax.annotation.Nonnull")) val columnNullableMap = HashMap() - for (i in 0.. + columnNullableMap[column.javaProperty] = column.isNullable || column.isAutoIncrement } columnNullableMap.forEach { (columnName, isNullable) -> diff --git a/app/infrastructure/src/main/kotlin/net/averak/gsync/infrastructure/mybatis/plugin/SuppressWarningsPlugin.kt b/app/infrastructure/src/main/kotlin/net/averak/gsync/infrastructure/mybatis/plugin/SuppressWarningsPlugin.kt index 1251bb3..3200d02 100644 --- a/app/infrastructure/src/main/kotlin/net/averak/gsync/infrastructure/mybatis/plugin/SuppressWarningsPlugin.kt +++ b/app/infrastructure/src/main/kotlin/net/averak/gsync/infrastructure/mybatis/plugin/SuppressWarningsPlugin.kt @@ -3,18 +3,32 @@ package net.averak.gsync.infrastructure.mybatis.plugin import org.mybatis.generator.api.IntrospectedTable import org.mybatis.generator.api.PluginAdapter import org.mybatis.generator.api.dom.java.Interface +import org.mybatis.generator.api.dom.java.TopLevelClass /** * 生成されたコードで発生する警告を抑制するプラグイン */ +@SuppressWarnings("kotlin:S4144") class SuppressWarningsPlugin : PluginAdapter() { - override fun validate(warnings: MutableList?): Boolean { + private val suppressWarningStr = "@SuppressWarnings({\"all\"})" + + override fun validate(warnings: MutableList): Boolean { return true } + override fun modelBaseRecordClassGenerated(topLevelClass: TopLevelClass, introspectedTable: IntrospectedTable): Boolean { + topLevelClass.annotations += suppressWarningStr + return super.modelBaseRecordClassGenerated(topLevelClass, introspectedTable) + } + + override fun modelExampleClassGenerated(topLevelClass: TopLevelClass, introspectedTable: IntrospectedTable): Boolean { + topLevelClass.annotations += suppressWarningStr + return super.modelExampleClassGenerated(topLevelClass, introspectedTable) + } + override fun clientGenerated(interfaze: Interface, introspectedTable: IntrospectedTable): Boolean { - interfaze.annotations += "@SuppressWarnings({\"JavadocDeclaration\", \"DuplicatedCode\"})" - return true + interfaze.annotations += suppressWarningStr + return super.clientGenerated(interfaze, introspectedTable) } } diff --git a/app/usecase/src/main/kotlin/net/averak/gsync/usecase/PlayerStorageUsecase.kt b/app/usecase/src/main/kotlin/net/averak/gsync/usecase/PlayerStorageUsecase.kt index 03e068b..1f81b22 100644 --- a/app/usecase/src/main/kotlin/net/averak/gsync/usecase/PlayerStorageUsecase.kt +++ b/app/usecase/src/main/kotlin/net/averak/gsync/usecase/PlayerStorageUsecase.kt @@ -15,20 +15,20 @@ class PlayerStorageUsecase( private val playerStorageRepository: IPlayerStorageRepository, ) { - fun search(gctx: GameContext, playerID: UUID, tenantID: UUID, criteria: IPlayerStorageRepository.PlayerStorageCriteria): PlayerStorage { + fun search(gctx: GameContext, playerID: UUID, gameID: UUID, criteria: IPlayerStorageRepository.PlayerStorageCriteria): PlayerStorage { return transaction.roTx { - return@roTx playerStorageRepository.get(gctx, playerID, tenantID, criteria) + return@roTx playerStorageRepository.get(gctx, playerID, gameID, criteria) } } - fun set(gctx: GameContext, playerID: UUID, tenantID: UUID, entry: PlayerStorageEntry, revision: UUID): SetResult { + fun set(gctx: GameContext, playerID: UUID, gameID: UUID, entry: PlayerStorageEntry, revision: UUID): SetResult { val criteria = IPlayerStorageRepository.PlayerStorageCriteria( listOf(entry.key), listOf(), ) return transaction.rwTx { - val playerStorage = playerStorageRepository.get(gctx, playerID, tenantID, criteria) + val playerStorage = playerStorageRepository.get(gctx, playerID, gameID, criteria) playerStorage.validate(revision) playerStorage.set(entry) try { @@ -43,12 +43,12 @@ class PlayerStorageUsecase( fun clear( gctx: GameContext, playerID: UUID, - tenantID: UUID, + gameID: UUID, revision: UUID, criteria: IPlayerStorageRepository.PlayerStorageCriteria, ): UUID { return transaction.rwTx { - val playerStorage = playerStorageRepository.get(gctx, playerID, tenantID, criteria) + val playerStorage = playerStorageRepository.get(gctx, playerID, gameID, criteria) playerStorage.validate(revision) playerStorage.clearAll() try { diff --git a/app/usecase/src/test/groovy/net/averak/gsync/usecase/PlayerStorageUsecase_UT.groovy b/app/usecase/src/test/groovy/net/averak/gsync/usecase/PlayerStorageUsecase_UT.groovy index 2b13f08..a94bab4 100644 --- a/app/usecase/src/test/groovy/net/averak/gsync/usecase/PlayerStorageUsecase_UT.groovy +++ b/app/usecase/src/test/groovy/net/averak/gsync/usecase/PlayerStorageUsecase_UT.groovy @@ -18,7 +18,7 @@ class PlayerStorageUsecase_search_UT extends AbstractUsecase_UT { UUID playerID = Faker.uuidv4() @Shared - UUID tenantID = Faker.uuidv4() + UUID gameID = Faker.uuidv4() def "正常系: プレイヤーストレージを検索する"() { given: @@ -26,10 +26,10 @@ class PlayerStorageUsecase_search_UT extends AbstractUsecase_UT { final criteria = Faker.fake(IPlayerStorageRepository.PlayerStorageCriteria) final playerStorage = Faker.fake(PlayerStorage) - 1 * playerStorageRepository.get(gctx, playerID, tenantID, criteria) >> playerStorage + 1 * playerStorageRepository.get(gctx, playerID, gameID, criteria) >> playerStorage when: - final result = this.sut.search(gctx, playerID, tenantID, criteria) + final result = this.sut.search(gctx, playerID, gameID, criteria) then: result == playerStorage @@ -45,7 +45,7 @@ class PlayerStorageUsecase_set_UT extends AbstractUsecase_UT { UUID playerID = Faker.uuidv4() @Shared - UUID tenantID = Faker.uuidv4() + UUID gameID = Faker.uuidv4() @Shared UUID revision = Faker.uuidv4() @@ -56,10 +56,10 @@ class PlayerStorageUsecase_set_UT extends AbstractUsecase_UT { final entry = Faker.fake(PlayerStorageEntry) final playerStorage = Faker.fake(PlayerStorage, [revision: revision]) - 1 * playerStorageRepository.get(gctx, playerID, tenantID, _) >> playerStorage + 1 * playerStorageRepository.get(gctx, playerID, gameID, _) >> playerStorage when: - final result = this.sut.set(gctx, playerID, tenantID, entry, revision) + final result = this.sut.set(gctx, playerID, gameID, entry, revision) then: result == new PlayerStorageUsecase.SetResult(entry, playerStorage.revision) @@ -73,10 +73,10 @@ class PlayerStorageUsecase_set_UT extends AbstractUsecase_UT { final playerStorage = Faker.fake(PlayerStorage, [ revision: revision, ]) - 1 * playerStorageRepository.get(gctx, playerID, tenantID, _) >> playerStorage + 1 * playerStorageRepository.get(gctx, playerID, gameID, _) >> playerStorage when: - final result = this.sut.set(gctx, playerID, tenantID, entry, revision) + final result = this.sut.set(gctx, playerID, gameID, entry, revision) then: 1 * playerStorageRepository.save(gctx, playerStorage) >> { throw new AlreadyDoneException() } @@ -93,7 +93,7 @@ class PlayerStorageUsecase_clear_UT extends AbstractUsecase_UT { UUID playerID = Faker.uuidv4() @Shared - UUID tenantID = Faker.uuidv4() + UUID gameID = Faker.uuidv4() @Shared UUID revision = Faker.uuidv4() @@ -107,10 +107,10 @@ class PlayerStorageUsecase_clear_UT extends AbstractUsecase_UT { revision: revision, entries : Faker.fakes(PlayerStorageEntry, 2), ]) - 1 * playerStorageRepository.get(gctx, playerID, tenantID, criteria) >> playerStorage + 1 * playerStorageRepository.get(gctx, playerID, gameID, criteria) >> playerStorage when: - final result = this.sut.clear(gctx, playerID, tenantID, revision, criteria) + final result = this.sut.clear(gctx, playerID, gameID, revision, criteria) then: 1 * playerStorageRepository.save(gctx, playerStorage) @@ -127,10 +127,10 @@ class PlayerStorageUsecase_clear_UT extends AbstractUsecase_UT { final playerStorage = Faker.fake(PlayerStorage, [ revision: revision, ]) - 1 * playerStorageRepository.get(gctx, playerID, tenantID, criteria) >> playerStorage + 1 * playerStorageRepository.get(gctx, playerID, gameID, criteria) >> playerStorage when: - final result = this.sut.clear(gctx, playerID, tenantID, revision, criteria) + final result = this.sut.clear(gctx, playerID, gameID, revision, criteria) then: 1 * playerStorageRepository.save(gctx, playerStorage) >> { throw new AlreadyDoneException() } diff --git a/build.gradle.kts b/build.gradle.kts index d962d61..ef55b2b 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -247,6 +247,18 @@ tasks { mybatisGenerator(libs.google.cloud.spanner.jdbc) } register("mbgenerate", Task::class) { + doFirst { + fileTree("$rootDir/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base") { + include("**/*.java") + exclude("**/AbstractDto.java") + }.files.forEach { it.delete() } + fileTree("$rootDir/app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base") { + include("**/*.java") + }.files.forEach { it.delete() } + fileTree("$rootDir/src/main/resources/dao/base") { + include("**/*.xml") + }.files.forEach { it.delete() } + } doLast { ant.withGroovyBuilder { "taskdef"( diff --git a/src/main/resources/dao/base/TenantBaseMapper.xml b/src/main/resources/dao/base/GameBaseMapper.xml similarity index 84% rename from src/main/resources/dao/base/TenantBaseMapper.xml rename to src/main/resources/dao/base/GameBaseMapper.xml index 2b69594..6f39f99 100644 --- a/src/main/resources/dao/base/TenantBaseMapper.xml +++ b/src/main/resources/dao/base/GameBaseMapper.xml @@ -1,13 +1,13 @@ - - + + - + @@ -84,9 +84,9 @@ WARNING - @mbg.generated This element is automatically generated by MyBatis Generator, do not modify. --> - `tenant_id`, `name`, `created_at`, `updated_at` + `game_id`, `name`, `created_at`, `updated_at` - select - from `gsync_tenant` - where `tenant_id` = #{tenantId,jdbcType=NVARCHAR} + from `gsync_game` + where `game_id` = #{gameId,jdbcType=NVARCHAR} - delete from `gsync_tenant` - where `tenant_id` = #{tenantId,jdbcType=NVARCHAR} + delete from `gsync_game` + where `game_id` = #{gameId,jdbcType=NVARCHAR} - + - delete from `gsync_tenant` + delete from `gsync_game` - + - insert into `gsync_tenant` (`tenant_id`, `name`, `created_at`, + insert into `gsync_game` (`game_id`, `name`, `created_at`, `updated_at`) - values (#{tenantId,jdbcType=NVARCHAR}, #{name,jdbcType=NVARCHAR}, #{createdAt,jdbcType=TIMESTAMP}, + values (#{gameId,jdbcType=NVARCHAR}, #{name,jdbcType=NVARCHAR}, #{createdAt,jdbcType=TIMESTAMP}, #{updatedAt,jdbcType=TIMESTAMP}) - + - insert into `gsync_tenant` + insert into `gsync_game` - - `tenant_id`, + + `game_id`, `name`, @@ -163,8 +163,8 @@ - - #{tenantId,jdbcType=NVARCHAR}, + + #{gameId,jdbcType=NVARCHAR}, #{name,jdbcType=NVARCHAR}, @@ -177,12 +177,12 @@ - - select count(*) from `gsync_tenant` + select count(*) from `gsync_game` @@ -192,10 +192,10 @@ WARNING - @mbg.generated This element is automatically generated by MyBatis Generator, do not modify. --> - update `gsync_tenant` + update `gsync_game` - - `tenant_id` = #{row.tenantId,jdbcType=NVARCHAR}, + + `game_id` = #{row.gameId,jdbcType=NVARCHAR}, `name` = #{row.name,jdbcType=NVARCHAR}, @@ -216,8 +216,8 @@ WARNING - @mbg.generated This element is automatically generated by MyBatis Generator, do not modify. --> - update `gsync_tenant` - set `tenant_id` = #{row.tenantId,jdbcType=NVARCHAR}, + update `gsync_game` + set `game_id` = #{row.gameId,jdbcType=NVARCHAR}, `name` = #{row.name,jdbcType=NVARCHAR}, `created_at` = #{row.createdAt,jdbcType=TIMESTAMP}, `updated_at` = #{row.updatedAt,jdbcType=TIMESTAMP} @@ -225,12 +225,12 @@ - + - update `gsync_tenant` + update `gsync_game` `name` = #{name,jdbcType=NVARCHAR}, @@ -242,20 +242,20 @@ `updated_at` = #{updatedAt,jdbcType=TIMESTAMP}, - where `tenant_id` = #{tenantId,jdbcType=NVARCHAR} + where `game_id` = #{gameId,jdbcType=NVARCHAR} - + - update `gsync_tenant` + update `gsync_game` set `name` = #{name,jdbcType=NVARCHAR}, `created_at` = #{createdAt,jdbcType=TIMESTAMP}, `updated_at` = #{updatedAt,jdbcType=TIMESTAMP} - where `tenant_id` = #{tenantId,jdbcType=NVARCHAR} + where `game_id` = #{gameId,jdbcType=NVARCHAR} - - tenant_id, + game_id, name, created_at, updated_at ) VALUES - #{dto.tenantId, jdbcType=NVARCHAR}, + #{dto.gameId, jdbcType=NVARCHAR}, #{dto.name, jdbcType=NVARCHAR}, #{dto.createdAt, jdbcType=TIMESTAMP}, #{dto.updatedAt, jdbcType=TIMESTAMP} diff --git a/src/main/resources/dao/base/PlayerStorageEntryBaseMapper.xml b/src/main/resources/dao/base/PlayerStorageEntryBaseMapper.xml index 7d0896a..5d00759 100644 --- a/src/main/resources/dao/base/PlayerStorageEntryBaseMapper.xml +++ b/src/main/resources/dao/base/PlayerStorageEntryBaseMapper.xml @@ -8,7 +8,7 @@ --> - + @@ -21,7 +21,7 @@ --> - + @@ -99,7 +99,7 @@ WARNING - @mbg.generated This element is automatically generated by MyBatis Generator, do not modify. --> - `player_id`, `tenant_id`, `key`, `created_at`, `updated_at` + `player_id`, `game_id`, `key`, `created_at`, `updated_at` delete from `gsync_player_storage_entry` where `player_id` = #{playerId,jdbcType=NVARCHAR} - and `tenant_id` = #{tenantId,jdbcType=NVARCHAR} + and `game_id` = #{gameId,jdbcType=NVARCHAR} and `key` = #{key,jdbcType=NVARCHAR} @@ -185,10 +185,10 @@ WARNING - @mbg.generated This element is automatically generated by MyBatis Generator, do not modify. --> - insert into `gsync_player_storage_entry` (`player_id`, `tenant_id`, `key`, + insert into `gsync_player_storage_entry` (`player_id`, `game_id`, `key`, `created_at`, `updated_at`, `value` ) - values (#{playerId,jdbcType=NVARCHAR}, #{tenantId,jdbcType=NVARCHAR}, #{key,jdbcType=NVARCHAR}, + values (#{playerId,jdbcType=NVARCHAR}, #{gameId,jdbcType=NVARCHAR}, #{key,jdbcType=NVARCHAR}, #{createdAt,jdbcType=TIMESTAMP}, #{updatedAt,jdbcType=TIMESTAMP}, #{value,jdbcType=BINARY} ) @@ -202,8 +202,8 @@ `player_id`, - - `tenant_id`, + + `game_id`, `key`, @@ -222,8 +222,8 @@ #{playerId,jdbcType=NVARCHAR}, - - #{tenantId,jdbcType=NVARCHAR}, + + #{gameId,jdbcType=NVARCHAR}, #{key,jdbcType=NVARCHAR}, @@ -259,8 +259,8 @@ `player_id` = #{row.playerId,jdbcType=NVARCHAR}, - - `tenant_id` = #{row.tenantId,jdbcType=NVARCHAR}, + + `game_id` = #{row.gameId,jdbcType=NVARCHAR}, `key` = #{row.key,jdbcType=NVARCHAR}, @@ -286,7 +286,7 @@ --> update `gsync_player_storage_entry` set `player_id` = #{row.playerId,jdbcType=NVARCHAR}, - `tenant_id` = #{row.tenantId,jdbcType=NVARCHAR}, + `game_id` = #{row.gameId,jdbcType=NVARCHAR}, `key` = #{row.key,jdbcType=NVARCHAR}, `created_at` = #{row.createdAt,jdbcType=TIMESTAMP}, `updated_at` = #{row.updatedAt,jdbcType=TIMESTAMP}, @@ -302,7 +302,7 @@ --> update `gsync_player_storage_entry` set `player_id` = #{row.playerId,jdbcType=NVARCHAR}, - `tenant_id` = #{row.tenantId,jdbcType=NVARCHAR}, + `game_id` = #{row.gameId,jdbcType=NVARCHAR}, `key` = #{row.key,jdbcType=NVARCHAR}, `created_at` = #{row.createdAt,jdbcType=TIMESTAMP}, `updated_at` = #{row.updatedAt,jdbcType=TIMESTAMP} @@ -328,7 +328,7 @@ where `player_id` = #{playerId,jdbcType=NVARCHAR} - and `tenant_id` = #{tenantId,jdbcType=NVARCHAR} + and `game_id` = #{gameId,jdbcType=NVARCHAR} and `key` = #{key,jdbcType=NVARCHAR} @@ -341,7 +341,7 @@ `updated_at` = #{updatedAt,jdbcType=TIMESTAMP}, `value` = #{value,jdbcType=BINARY} where `player_id` = #{playerId,jdbcType=NVARCHAR} - and `tenant_id` = #{tenantId,jdbcType=NVARCHAR} + and `game_id` = #{gameId,jdbcType=NVARCHAR} and `key` = #{key,jdbcType=NVARCHAR} @@ -353,7 +353,7 @@ set `created_at` = #{createdAt,jdbcType=TIMESTAMP}, `updated_at` = #{updatedAt,jdbcType=TIMESTAMP} where `player_id` = #{playerId,jdbcType=NVARCHAR} - and `tenant_id` = #{tenantId,jdbcType=NVARCHAR} + and `game_id` = #{gameId,jdbcType=NVARCHAR} and `key` = #{key,jdbcType=NVARCHAR} @@ -116,7 +116,7 @@ from `gsync_player_storage_revision` where `player_id` = #{playerId,jdbcType=NVARCHAR} - and `tenant_id` = #{tenantId,jdbcType=NVARCHAR} + and `game_id` = #{gameId,jdbcType=NVARCHAR} and `player_storage_revision_id` = #{playerStorageRevisionId,jdbcType=NVARCHAR} @@ -126,7 +126,7 @@ --> delete from `gsync_player_storage_revision` where `player_id` = #{playerId,jdbcType=NVARCHAR} - and `tenant_id` = #{tenantId,jdbcType=NVARCHAR} + and `game_id` = #{gameId,jdbcType=NVARCHAR} and `player_storage_revision_id` = #{playerStorageRevisionId,jdbcType=NVARCHAR} @@ -144,10 +144,10 @@ WARNING - @mbg.generated This element is automatically generated by MyBatis Generator, do not modify. --> - insert into `gsync_player_storage_revision` (`player_id`, `tenant_id`, `player_storage_revision_id`, + insert into `gsync_player_storage_revision` (`player_id`, `game_id`, `player_storage_revision_id`, `idempotency_key`, `created_at`, `updated_at` ) - values (#{playerId,jdbcType=NVARCHAR}, #{tenantId,jdbcType=NVARCHAR}, #{playerStorageRevisionId,jdbcType=NVARCHAR}, + values (#{playerId,jdbcType=NVARCHAR}, #{gameId,jdbcType=NVARCHAR}, #{playerStorageRevisionId,jdbcType=NVARCHAR}, #{idempotencyKey,jdbcType=NVARCHAR}, #{createdAt,jdbcType=TIMESTAMP}, #{updatedAt,jdbcType=TIMESTAMP} ) @@ -161,8 +161,8 @@ `player_id`, - - `tenant_id`, + + `game_id`, `player_storage_revision_id`, @@ -181,8 +181,8 @@ #{playerId,jdbcType=NVARCHAR}, - - #{tenantId,jdbcType=NVARCHAR}, + + #{gameId,jdbcType=NVARCHAR}, #{playerStorageRevisionId,jdbcType=NVARCHAR}, @@ -218,8 +218,8 @@ `player_id` = #{row.playerId,jdbcType=NVARCHAR}, - - `tenant_id` = #{row.tenantId,jdbcType=NVARCHAR}, + + `game_id` = #{row.gameId,jdbcType=NVARCHAR}, `player_storage_revision_id` = #{row.playerStorageRevisionId,jdbcType=NVARCHAR}, @@ -245,7 +245,7 @@ --> update `gsync_player_storage_revision` set `player_id` = #{row.playerId,jdbcType=NVARCHAR}, - `tenant_id` = #{row.tenantId,jdbcType=NVARCHAR}, + `game_id` = #{row.gameId,jdbcType=NVARCHAR}, `player_storage_revision_id` = #{row.playerStorageRevisionId,jdbcType=NVARCHAR}, `idempotency_key` = #{row.idempotencyKey,jdbcType=NVARCHAR}, `created_at` = #{row.createdAt,jdbcType=TIMESTAMP}, @@ -272,7 +272,7 @@ where `player_id` = #{playerId,jdbcType=NVARCHAR} - and `tenant_id` = #{tenantId,jdbcType=NVARCHAR} + and `game_id` = #{gameId,jdbcType=NVARCHAR} and `player_storage_revision_id` = #{playerStorageRevisionId,jdbcType=NVARCHAR} @@ -285,7 +285,7 @@ `created_at` = #{createdAt,jdbcType=TIMESTAMP}, `updated_at` = #{updatedAt,jdbcType=TIMESTAMP} where `player_id` = #{playerId,jdbcType=NVARCHAR} - and `tenant_id` = #{tenantId,jdbcType=NVARCHAR} + and `game_id` = #{gameId,jdbcType=NVARCHAR} and `player_storage_revision_id` = #{playerStorageRevisionId,jdbcType=NVARCHAR} + - delete from `gsync_r_tenant_operator` + delete from `gsync_r_game_operator` where `operator_id` = #{operatorId,jdbcType=NVARCHAR} - and `tenant_id` = #{tenantId,jdbcType=NVARCHAR} + and `game_id` = #{gameId,jdbcType=NVARCHAR} - + - delete from `gsync_r_tenant_operator` + delete from `gsync_r_game_operator` - + - insert into `gsync_r_tenant_operator` (`operator_id`, `tenant_id`, `is_admin`, + insert into `gsync_r_game_operator` (`operator_id`, `game_id`, `is_admin`, `created_at`, `updated_at`) - values (#{operatorId,jdbcType=NVARCHAR}, #{tenantId,jdbcType=NVARCHAR}, #{isAdmin,jdbcType=BOOLEAN}, + values (#{operatorId,jdbcType=NVARCHAR}, #{gameId,jdbcType=NVARCHAR}, #{isAdmin,jdbcType=BOOLEAN}, #{createdAt,jdbcType=TIMESTAMP}, #{updatedAt,jdbcType=TIMESTAMP}) - + - insert into `gsync_r_tenant_operator` + insert into `gsync_r_game_operator` `operator_id`, - - `tenant_id`, + + `game_id`, `is_admin`, @@ -172,8 +172,8 @@ #{operatorId,jdbcType=NVARCHAR}, - - #{tenantId,jdbcType=NVARCHAR}, + + #{gameId,jdbcType=NVARCHAR}, #{isAdmin,jdbcType=BOOLEAN}, @@ -186,12 +186,12 @@ - - select count(*) from `gsync_r_tenant_operator` + select count(*) from `gsync_r_game_operator` @@ -201,13 +201,13 @@ WARNING - @mbg.generated This element is automatically generated by MyBatis Generator, do not modify. --> - update `gsync_r_tenant_operator` + update `gsync_r_game_operator` `operator_id` = #{row.operatorId,jdbcType=NVARCHAR}, - - `tenant_id` = #{row.tenantId,jdbcType=NVARCHAR}, + + `game_id` = #{row.gameId,jdbcType=NVARCHAR}, `is_admin` = #{row.isAdmin,jdbcType=BOOLEAN}, @@ -228,9 +228,9 @@ WARNING - @mbg.generated This element is automatically generated by MyBatis Generator, do not modify. --> - update `gsync_r_tenant_operator` + update `gsync_r_game_operator` set `operator_id` = #{row.operatorId,jdbcType=NVARCHAR}, - `tenant_id` = #{row.tenantId,jdbcType=NVARCHAR}, + `game_id` = #{row.gameId,jdbcType=NVARCHAR}, `is_admin` = #{row.isAdmin,jdbcType=BOOLEAN}, `created_at` = #{row.createdAt,jdbcType=TIMESTAMP}, `updated_at` = #{row.updatedAt,jdbcType=TIMESTAMP} @@ -238,12 +238,12 @@ - + - update `gsync_r_tenant_operator` + update `gsync_r_game_operator` `is_admin` = #{isAdmin,jdbcType=BOOLEAN}, @@ -256,21 +256,21 @@ where `operator_id` = #{operatorId,jdbcType=NVARCHAR} - and `tenant_id` = #{tenantId,jdbcType=NVARCHAR} + and `game_id` = #{gameId,jdbcType=NVARCHAR} - + - update `gsync_r_tenant_operator` + update `gsync_r_game_operator` set `is_admin` = #{isAdmin,jdbcType=BOOLEAN}, `created_at` = #{createdAt,jdbcType=TIMESTAMP}, `updated_at` = #{updatedAt,jdbcType=TIMESTAMP} where `operator_id` = #{operatorId,jdbcType=NVARCHAR} - and `tenant_id` = #{tenantId,jdbcType=NVARCHAR} + and `game_id` = #{gameId,jdbcType=NVARCHAR} - operator_id, - tenant_id, + game_id, is_admin, created_at, updated_at ) VALUES #{dto.operatorId, jdbcType=NVARCHAR}, - #{dto.tenantId, jdbcType=NVARCHAR}, + #{dto.gameId, jdbcType=NVARCHAR}, #{dto.isAdmin, jdbcType=BOOLEAN}, #{dto.createdAt, jdbcType=TIMESTAMP}, #{dto.updatedAt, jdbcType=TIMESTAMP} diff --git a/src/main/resources/dao/extend/OperatorMapper.xml b/src/main/resources/dao/extend/OperatorMapper.xml index 8726a30..f9d4804 100644 --- a/src/main/resources/dao/extend/OperatorMapper.xml +++ b/src/main/resources/dao/extend/OperatorMapper.xml @@ -4,8 +4,8 @@ - @@ -14,27 +14,27 @@ SELECT o.*, rto.operator_id AS RTO__operator_id, - rto.tenant_id AS RTO__tenant_id, + rto.game_id AS RTO__game_id, rto.is_admin AS RTO__is_admin, rto.created_at AS RTO__created_at, rto.updated_at AS RTO__updated_at FROM gsync_operator o - LEFT JOIN gsync_r_tenant_operator rto ON o.operator_id = rto.operator_id + LEFT JOIN gsync_r_game_operator rto ON o.operator_id = rto.operator_id WHERE o.operator_id = #{operatorId} - SELECT o.*, rto.operator_id AS RTO__operator_id, - rto.tenant_id AS RTO__tenant_id, + rto.game_id AS RTO__game_id, rto.is_admin AS RTO__is_admin, rto.created_at AS RTO__created_at, rto.updated_at AS RTO__updated_at FROM gsync_operator o - LEFT JOIN gsync_r_tenant_operator rto ON o.operator_id = rto.operator_id - WHERE rto.tenant_id = #{tenantId} + LEFT JOIN gsync_r_game_operator rto ON o.operator_id = rto.operator_id + WHERE rto.game_id = #{gameId} diff --git a/src/main/resources/dao/extend/PlayerStorageEntryMapper.xml b/src/main/resources/dao/extend/PlayerStorageEntryMapper.xml index 6310ba7..bd695ef 100644 --- a/src/main/resources/dao/extend/PlayerStorageEntryMapper.xml +++ b/src/main/resources/dao/extend/PlayerStorageEntryMapper.xml @@ -1,11 +1,11 @@ - SELECT * FROM gsync_player_storage_entry WHERE player_id = #{playerId} - AND tenant_id = #{tenantId} + AND game_id = #{gameId} AND ( diff --git a/src/main/resources/dao/extend/PlayerStorageRevisionMapper.xml b/src/main/resources/dao/extend/PlayerStorageRevisionMapper.xml index e65d3cf..56827d2 100644 --- a/src/main/resources/dao/extend/PlayerStorageRevisionMapper.xml +++ b/src/main/resources/dao/extend/PlayerStorageRevisionMapper.xml @@ -1,11 +1,11 @@ - SELECT * FROM gsync_player_storage_revision WHERE player_id = #{playerId} - AND tenant_id = #{tenantId} + AND game_id = #{gameId} ORDER BY created_at DESC LIMIT #{limit} diff --git a/src/main/resources/db/migration/V1_0_0.sql b/src/main/resources/db/migration/V1_0_0.sql index 3edf2b0..d0e428e 100644 --- a/src/main/resources/db/migration/V1_0_0.sql +++ b/src/main/resources/db/migration/V1_0_0.sql @@ -1,10 +1,10 @@ -CREATE TABLE gsync_tenant +CREATE TABLE gsync_game ( - tenant_id STRING(36) NOT NULL, + game_id STRING(36) NOT NULL, name STRING( MAX) NOT NULL, created_at TIMESTAMP NOT NULL, updated_at TIMESTAMP NOT NULL, -) PRIMARY KEY (tenant_id); +) PRIMARY KEY (game_id); CREATE TABLE gsync_operator ( @@ -14,14 +14,14 @@ CREATE TABLE gsync_operator updated_at TIMESTAMP NOT NULL, ) PRIMARY KEY (operator_id); -CREATE TABLE gsync_r_tenant_operator +CREATE TABLE gsync_r_game_operator ( operator_id STRING(36) NOT NULL, - tenant_id STRING(36) NOT NULL, + game_id STRING(36) NOT NULL, is_admin BOOL NOT NULL, created_at TIMESTAMP NOT NULL, updated_at TIMESTAMP NOT NULL, -) PRIMARY KEY (operator_id, tenant_id), +) PRIMARY KEY (operator_id, game_id), INTERLEAVE IN PARENT gsync_operator ON DELETE CASCADE; @@ -117,12 +117,12 @@ CREATE TABLE gsync_friend_setting_master CREATE TABLE gsync_player_storage_entry ( player_id STRING(36) NOT NULL, - tenant_id STRING(36) NOT NULL, + game_id STRING(36) NOT NULL, key STRING( MAX) NOT NULL, value BYTES( MAX) NOT NULL, created_at TIMESTAMP NOT NULL, updated_at TIMESTAMP NOT NULL, -) PRIMARY KEY (player_id, tenant_id, key), +) PRIMARY KEY (player_id, game_id, key), INTERLEAVE IN PARENT gsync_player ON DELETE CASCADE; @@ -130,16 +130,16 @@ CASCADE; CREATE TABLE gsync_player_storage_revision ( player_id STRING(36) NOT NULL, - tenant_id STRING(36) NOT NULL, + game_id STRING(36) NOT NULL, player_storage_revision_id STRING(36) NOT NULL, idempotency_key STRING(36) NOT NULL, created_at TIMESTAMP NOT NULL, updated_at TIMESTAMP NOT NULL, -) PRIMARY KEY (player_id, tenant_id, player_storage_revision_id), +) PRIMARY KEY (player_id, game_id, player_storage_revision_id), INTERLEAVE IN PARENT gsync_player ON DELETE CASCADE; -CREATE INDEX gsync_player_storage_revision__player_id__tenant_id__created_at ON gsync_player_storage_revision (player_id, tenant_id, created_at DESC); +CREATE INDEX gsync_player_storage_revision__player_id__game_id__created_at ON gsync_player_storage_revision (player_id, game_id, created_at DESC); CREATE UNIQUE INDEX gsync_player_storage_revision__idempotency_key ON gsync_player_storage_revision (idempotency_key); CREATE TABLE gsync_echo diff --git a/src/main/resources/mybatis-generator-config.xml b/src/main/resources/mybatis-generator-config.xml index a2b9ae1..9383c0e 100644 --- a/src/main/resources/mybatis-generator-config.xml +++ b/src/main/resources/mybatis-generator-config.xml @@ -12,7 +12,6 @@ - diff --git a/testkit/src/main/groovy/net/averak/gsync/testkit/randomizer/SpannerRandomizers.groovy b/testkit/src/main/groovy/net/averak/gsync/testkit/randomizer/SpannerRandomizers.groovy index 03b372d..c8ad846 100644 --- a/testkit/src/main/groovy/net/averak/gsync/testkit/randomizer/SpannerRandomizers.groovy +++ b/testkit/src/main/groovy/net/averak/gsync/testkit/randomizer/SpannerRandomizers.groovy @@ -172,14 +172,14 @@ class RequiredClientVersionDtoRandomizer implements IRandomizer { } @Component -class RTenantOperatorDtoRandomizer implements IRandomizer { +class RGameOperatorDtoRandomizer implements IRandomizer { - final Class typeToGenerate = RTenantOperatorDto.class + final Class typeToGenerate = RGameOperatorDto.class @Override Object getRandomValue() { final now = LocalDateTime.now() - return new RTenantOperatorDto( + return new RGameOperatorDto( Faker.uuidv4().toString(), Faker.uuidv4().toString(), Faker.fake(Boolean), @@ -190,14 +190,14 @@ class RTenantOperatorDtoRandomizer implements IRandomizer { } @Component -class TenantDtoRandomizer implements IRandomizer { +class GameDtoRandomizer implements IRandomizer { - final Class typeToGenerate = TenantDto.class + final Class typeToGenerate = GameDto.class @Override Object getRandomValue() { final now = LocalDateTime.now() - return new TenantDto( + return new GameDto( Faker.uuidv4().toString(), Faker.alphanumeric(), now, From 8e9ebb2ae83926530a9532a721d537d3b408f38d Mon Sep 17 00:00:00 2001 From: averak Date: Sun, 14 Jan 2024 04:04:23 +0900 Subject: [PATCH 03/13] =?UTF-8?q?refs=20#80=20=E7=94=9F=E6=88=90=E3=81=95?= =?UTF-8?q?=E3=82=8C=E3=82=8BbulkInsert=E3=82=B9=E3=83=86=E3=83=BC?= =?UTF-8?q?=E3=83=88=E3=83=A1=E3=83=B3=E3=83=88=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mybatis/plugin/BulkInsertPlugin.kt | 29 +++++++++---------- .../resources/dao/base/EchoBaseMapper.xml | 19 ++++-------- .../base/FriendSettingMasterBaseMapper.xml | 19 ++++-------- .../resources/dao/base/GameBaseMapper.xml | 17 ++++------- .../dao/base/MasterVersionBaseMapper.xml | 19 ++++-------- .../resources/dao/base/OperatorBaseMapper.xml | 17 ++++------- .../resources/dao/base/PlayerBaseMapper.xml | 19 ++++-------- .../dao/base/PlayerFriendBaseMapper.xml | 19 ++++-------- .../base/PlayerFriendRequestBaseMapper.xml | 19 ++++-------- .../dao/base/PlayerLoginBaseMapper.xml | 19 ++++-------- .../dao/base/PlayerProfileBaseMapper.xml | 19 ++++-------- .../dao/base/PlayerStorageEntryBaseMapper.xml | 21 ++++---------- .../base/PlayerStorageRevisionBaseMapper.xml | 21 ++++---------- .../dao/base/RGameOperatorBaseMapper.xml | 19 ++++-------- .../base/RequiredClientVersionBaseMapper.xml | 19 ++++-------- 15 files changed, 83 insertions(+), 212 deletions(-) diff --git a/app/infrastructure/src/main/kotlin/net/averak/gsync/infrastructure/mybatis/plugin/BulkInsertPlugin.kt b/app/infrastructure/src/main/kotlin/net/averak/gsync/infrastructure/mybatis/plugin/BulkInsertPlugin.kt index 7aa73c3..afcede4 100644 --- a/app/infrastructure/src/main/kotlin/net/averak/gsync/infrastructure/mybatis/plugin/BulkInsertPlugin.kt +++ b/app/infrastructure/src/main/kotlin/net/averak/gsync/infrastructure/mybatis/plugin/BulkInsertPlugin.kt @@ -44,32 +44,29 @@ class BulkInsertPlugin : PluginAdapter() { override fun sqlMapDocumentGenerated(document: Document, introspectedTable: IntrospectedTable): Boolean { val element = XmlElement("insert") element.addAttribute(Attribute("id", "bulkInsert")) - element.addElement(TextElement("INSERT INTO " + introspectedTable.fullyQualifiedTableNameAtRuntime)) - element.addElement(TextElement("(")) - element.addElement(TextElement("")) + element.addElement(TextElement("INSERT INTO " + introspectedTable.fullyQualifiedTableNameAtRuntime)) + element.addElement( + TextElement( + "(${introspectedTable.allColumns.joinToString(", ") { it.actualColumnName }})", + ), + ) + element.addElement(TextElement("VALUES")) + val forEachElement = XmlElement("foreach") forEachElement.addAttribute(Attribute("collection", "dtos")) forEachElement.addAttribute(Attribute("item", "dto")) forEachElement.addAttribute(Attribute("separator", ",")) - forEachElement.addAttribute(Attribute("open", "(")) - forEachElement.addAttribute(Attribute("close", ")")) - - introspectedTable.allColumns.forEachIndexed { i, column -> - if (i == introspectedTable.allColumns.size - 1) { - element.addElement(TextElement(column.actualColumnName)) - forEachElement.addElement(TextElement("#{dto.${column.javaProperty}, jdbcType=${column.jdbcTypeName}}")) - } else { - element.addElement(TextElement(column.actualColumnName + ",")) - forEachElement.addElement(TextElement("#{dto.${column.javaProperty}, jdbcType=${column.jdbcTypeName}},")) - } - } + forEachElement.addElement( + TextElement( + "(${introspectedTable.allColumns.joinToString(", ") { "#{dto.${it.javaProperty}, jdbcType=${it.jdbcTypeName}}" }})", + ), + ) - element.addElement(TextElement(") VALUES")) element.addElement(forEachElement) document.rootElement.addElement(element) diff --git a/src/main/resources/dao/base/EchoBaseMapper.xml b/src/main/resources/dao/base/EchoBaseMapper.xml index 0083bac..ed97d83 100644 --- a/src/main/resources/dao/base/EchoBaseMapper.xml +++ b/src/main/resources/dao/base/EchoBaseMapper.xml @@ -289,24 +289,15 @@ - INSERT INTO `gsync_echo` - ( - echo_id, - message, - timestamp, - created_at, - updated_at - ) VALUES - - #{dto.echoId, jdbcType=NVARCHAR}, - #{dto.message, jdbcType=NVARCHAR}, - #{dto.timestamp, jdbcType=TIMESTAMP}, - #{dto.createdAt, jdbcType=TIMESTAMP}, - #{dto.updatedAt, jdbcType=TIMESTAMP} + INSERT INTO `gsync_echo` + (echo_id, message, timestamp, created_at, updated_at) + VALUES + + (#{dto.echoId, jdbcType=NVARCHAR}, #{dto.message, jdbcType=NVARCHAR}, #{dto.timestamp, jdbcType=TIMESTAMP}, #{dto.createdAt, jdbcType=TIMESTAMP}, #{dto.updatedAt, jdbcType=TIMESTAMP}) \ No newline at end of file diff --git a/src/main/resources/dao/base/FriendSettingMasterBaseMapper.xml b/src/main/resources/dao/base/FriendSettingMasterBaseMapper.xml index db3c824..512c545 100644 --- a/src/main/resources/dao/base/FriendSettingMasterBaseMapper.xml +++ b/src/main/resources/dao/base/FriendSettingMasterBaseMapper.xml @@ -289,24 +289,15 @@ - INSERT INTO `gsync_friend_setting_master` - ( - master_version, - max_friend_count, - max_friend_request_count, - created_at, - updated_at - ) VALUES - - #{dto.masterVersion, jdbcType=NVARCHAR}, - #{dto.maxFriendCount, jdbcType=BIGINT}, - #{dto.maxFriendRequestCount, jdbcType=BIGINT}, - #{dto.createdAt, jdbcType=TIMESTAMP}, - #{dto.updatedAt, jdbcType=TIMESTAMP} + INSERT INTO `gsync_friend_setting_master` + (master_version, max_friend_count, max_friend_request_count, created_at, updated_at) + VALUES + + (#{dto.masterVersion, jdbcType=NVARCHAR}, #{dto.maxFriendCount, jdbcType=BIGINT}, #{dto.maxFriendRequestCount, jdbcType=BIGINT}, #{dto.createdAt, jdbcType=TIMESTAMP}, #{dto.updatedAt, jdbcType=TIMESTAMP}) \ No newline at end of file diff --git a/src/main/resources/dao/base/GameBaseMapper.xml b/src/main/resources/dao/base/GameBaseMapper.xml index 6f39f99..1c14299 100644 --- a/src/main/resources/dao/base/GameBaseMapper.xml +++ b/src/main/resources/dao/base/GameBaseMapper.xml @@ -274,22 +274,15 @@ - INSERT INTO `gsync_game` - ( - game_id, - name, - created_at, - updated_at - ) VALUES - - #{dto.gameId, jdbcType=NVARCHAR}, - #{dto.name, jdbcType=NVARCHAR}, - #{dto.createdAt, jdbcType=TIMESTAMP}, - #{dto.updatedAt, jdbcType=TIMESTAMP} + INSERT INTO `gsync_game` + (game_id, name, created_at, updated_at) + VALUES + + (#{dto.gameId, jdbcType=NVARCHAR}, #{dto.name, jdbcType=NVARCHAR}, #{dto.createdAt, jdbcType=TIMESTAMP}, #{dto.updatedAt, jdbcType=TIMESTAMP}) \ No newline at end of file diff --git a/src/main/resources/dao/base/MasterVersionBaseMapper.xml b/src/main/resources/dao/base/MasterVersionBaseMapper.xml index e0606c4..6ab5bbf 100644 --- a/src/main/resources/dao/base/MasterVersionBaseMapper.xml +++ b/src/main/resources/dao/base/MasterVersionBaseMapper.xml @@ -289,24 +289,15 @@ - INSERT INTO `gsync_master_version` - ( - version, - is_enabled, - comment, - created_at, - updated_at - ) VALUES - - #{dto.version, jdbcType=NVARCHAR}, - #{dto.isEnabled, jdbcType=BOOLEAN}, - #{dto.comment, jdbcType=NVARCHAR}, - #{dto.createdAt, jdbcType=TIMESTAMP}, - #{dto.updatedAt, jdbcType=TIMESTAMP} + INSERT INTO `gsync_master_version` + (version, is_enabled, comment, created_at, updated_at) + VALUES + + (#{dto.version, jdbcType=NVARCHAR}, #{dto.isEnabled, jdbcType=BOOLEAN}, #{dto.comment, jdbcType=NVARCHAR}, #{dto.createdAt, jdbcType=TIMESTAMP}, #{dto.updatedAt, jdbcType=TIMESTAMP}) \ No newline at end of file diff --git a/src/main/resources/dao/base/OperatorBaseMapper.xml b/src/main/resources/dao/base/OperatorBaseMapper.xml index 1afd113..bc3860e 100644 --- a/src/main/resources/dao/base/OperatorBaseMapper.xml +++ b/src/main/resources/dao/base/OperatorBaseMapper.xml @@ -274,22 +274,15 @@ - INSERT INTO `gsync_operator` - ( - operator_id, - email, - created_at, - updated_at - ) VALUES - - #{dto.operatorId, jdbcType=NVARCHAR}, - #{dto.email, jdbcType=NVARCHAR}, - #{dto.createdAt, jdbcType=TIMESTAMP}, - #{dto.updatedAt, jdbcType=TIMESTAMP} + INSERT INTO `gsync_operator` + (operator_id, email, created_at, updated_at) + VALUES + + (#{dto.operatorId, jdbcType=NVARCHAR}, #{dto.email, jdbcType=NVARCHAR}, #{dto.createdAt, jdbcType=TIMESTAMP}, #{dto.updatedAt, jdbcType=TIMESTAMP}) \ No newline at end of file diff --git a/src/main/resources/dao/base/PlayerBaseMapper.xml b/src/main/resources/dao/base/PlayerBaseMapper.xml index f0ebbad..b3f63d4 100644 --- a/src/main/resources/dao/base/PlayerBaseMapper.xml +++ b/src/main/resources/dao/base/PlayerBaseMapper.xml @@ -289,24 +289,15 @@ - INSERT INTO `gsync_player` - ( - player_id, - friend_id, - is_banned, - created_at, - updated_at - ) VALUES - - #{dto.playerId, jdbcType=NVARCHAR}, - #{dto.friendId, jdbcType=NVARCHAR}, - #{dto.isBanned, jdbcType=BOOLEAN}, - #{dto.createdAt, jdbcType=TIMESTAMP}, - #{dto.updatedAt, jdbcType=TIMESTAMP} + INSERT INTO `gsync_player` + (player_id, friend_id, is_banned, created_at, updated_at) + VALUES + + (#{dto.playerId, jdbcType=NVARCHAR}, #{dto.friendId, jdbcType=NVARCHAR}, #{dto.isBanned, jdbcType=BOOLEAN}, #{dto.createdAt, jdbcType=TIMESTAMP}, #{dto.updatedAt, jdbcType=TIMESTAMP}) \ No newline at end of file diff --git a/src/main/resources/dao/base/PlayerFriendBaseMapper.xml b/src/main/resources/dao/base/PlayerFriendBaseMapper.xml index 1bd0fed..a9c5ecd 100644 --- a/src/main/resources/dao/base/PlayerFriendBaseMapper.xml +++ b/src/main/resources/dao/base/PlayerFriendBaseMapper.xml @@ -289,24 +289,15 @@ - INSERT INTO `gsync_player_friend` - ( - player_id, - friend_player_id, - become_friend_at, - created_at, - updated_at - ) VALUES - - #{dto.playerId, jdbcType=NVARCHAR}, - #{dto.friendPlayerId, jdbcType=NVARCHAR}, - #{dto.becomeFriendAt, jdbcType=TIMESTAMP}, - #{dto.createdAt, jdbcType=TIMESTAMP}, - #{dto.updatedAt, jdbcType=TIMESTAMP} + INSERT INTO `gsync_player_friend` + (player_id, friend_player_id, become_friend_at, created_at, updated_at) + VALUES + + (#{dto.playerId, jdbcType=NVARCHAR}, #{dto.friendPlayerId, jdbcType=NVARCHAR}, #{dto.becomeFriendAt, jdbcType=TIMESTAMP}, #{dto.createdAt, jdbcType=TIMESTAMP}, #{dto.updatedAt, jdbcType=TIMESTAMP}) \ No newline at end of file diff --git a/src/main/resources/dao/base/PlayerFriendRequestBaseMapper.xml b/src/main/resources/dao/base/PlayerFriendRequestBaseMapper.xml index 30a9798..20bb93c 100644 --- a/src/main/resources/dao/base/PlayerFriendRequestBaseMapper.xml +++ b/src/main/resources/dao/base/PlayerFriendRequestBaseMapper.xml @@ -289,24 +289,15 @@ - INSERT INTO `gsync_player_friend_request` - ( - player_id, - receiver_player_id, - sent_at, - created_at, - updated_at - ) VALUES - - #{dto.playerId, jdbcType=NVARCHAR}, - #{dto.receiverPlayerId, jdbcType=NVARCHAR}, - #{dto.sentAt, jdbcType=TIMESTAMP}, - #{dto.createdAt, jdbcType=TIMESTAMP}, - #{dto.updatedAt, jdbcType=TIMESTAMP} + INSERT INTO `gsync_player_friend_request` + (player_id, receiver_player_id, sent_at, created_at, updated_at) + VALUES + + (#{dto.playerId, jdbcType=NVARCHAR}, #{dto.receiverPlayerId, jdbcType=NVARCHAR}, #{dto.sentAt, jdbcType=TIMESTAMP}, #{dto.createdAt, jdbcType=TIMESTAMP}, #{dto.updatedAt, jdbcType=TIMESTAMP}) \ No newline at end of file diff --git a/src/main/resources/dao/base/PlayerLoginBaseMapper.xml b/src/main/resources/dao/base/PlayerLoginBaseMapper.xml index ff241b2..c295210 100644 --- a/src/main/resources/dao/base/PlayerLoginBaseMapper.xml +++ b/src/main/resources/dao/base/PlayerLoginBaseMapper.xml @@ -289,24 +289,15 @@ - INSERT INTO `gsync_player_login` - ( - player_id, - total_login_days, - last_logged_in_at, - created_at, - updated_at - ) VALUES - - #{dto.playerId, jdbcType=NVARCHAR}, - #{dto.totalLoginDays, jdbcType=BIGINT}, - #{dto.lastLoggedInAt, jdbcType=TIMESTAMP}, - #{dto.createdAt, jdbcType=TIMESTAMP}, - #{dto.updatedAt, jdbcType=TIMESTAMP} + INSERT INTO `gsync_player_login` + (player_id, total_login_days, last_logged_in_at, created_at, updated_at) + VALUES + + (#{dto.playerId, jdbcType=NVARCHAR}, #{dto.totalLoginDays, jdbcType=BIGINT}, #{dto.lastLoggedInAt, jdbcType=TIMESTAMP}, #{dto.createdAt, jdbcType=TIMESTAMP}, #{dto.updatedAt, jdbcType=TIMESTAMP}) \ No newline at end of file diff --git a/src/main/resources/dao/base/PlayerProfileBaseMapper.xml b/src/main/resources/dao/base/PlayerProfileBaseMapper.xml index 7d8b97c..a820dc6 100644 --- a/src/main/resources/dao/base/PlayerProfileBaseMapper.xml +++ b/src/main/resources/dao/base/PlayerProfileBaseMapper.xml @@ -289,24 +289,15 @@ - INSERT INTO `gsync_player_profile` - ( - player_id, - nickname, - icon_id, - created_at, - updated_at - ) VALUES - - #{dto.playerId, jdbcType=NVARCHAR}, - #{dto.nickname, jdbcType=NVARCHAR}, - #{dto.iconId, jdbcType=NVARCHAR}, - #{dto.createdAt, jdbcType=TIMESTAMP}, - #{dto.updatedAt, jdbcType=TIMESTAMP} + INSERT INTO `gsync_player_profile` + (player_id, nickname, icon_id, created_at, updated_at) + VALUES + + (#{dto.playerId, jdbcType=NVARCHAR}, #{dto.nickname, jdbcType=NVARCHAR}, #{dto.iconId, jdbcType=NVARCHAR}, #{dto.createdAt, jdbcType=TIMESTAMP}, #{dto.updatedAt, jdbcType=TIMESTAMP}) \ No newline at end of file diff --git a/src/main/resources/dao/base/PlayerStorageEntryBaseMapper.xml b/src/main/resources/dao/base/PlayerStorageEntryBaseMapper.xml index 5d00759..791ae87 100644 --- a/src/main/resources/dao/base/PlayerStorageEntryBaseMapper.xml +++ b/src/main/resources/dao/base/PlayerStorageEntryBaseMapper.xml @@ -395,26 +395,15 @@ - INSERT INTO `gsync_player_storage_entry` - ( - player_id, - game_id, - key, - created_at, - updated_at, - value - ) VALUES - - #{dto.playerId, jdbcType=NVARCHAR}, - #{dto.gameId, jdbcType=NVARCHAR}, - #{dto.key, jdbcType=NVARCHAR}, - #{dto.createdAt, jdbcType=TIMESTAMP}, - #{dto.updatedAt, jdbcType=TIMESTAMP}, - #{dto.value, jdbcType=BINARY} + INSERT INTO `gsync_player_storage_entry` + (player_id, game_id, key, created_at, updated_at, value) + VALUES + + (#{dto.playerId, jdbcType=NVARCHAR}, #{dto.gameId, jdbcType=NVARCHAR}, #{dto.key, jdbcType=NVARCHAR}, #{dto.createdAt, jdbcType=TIMESTAMP}, #{dto.updatedAt, jdbcType=TIMESTAMP}, #{dto.value, jdbcType=BINARY}) \ No newline at end of file diff --git a/src/main/resources/dao/base/PlayerStorageRevisionBaseMapper.xml b/src/main/resources/dao/base/PlayerStorageRevisionBaseMapper.xml index b11ac65..3ce6886 100644 --- a/src/main/resources/dao/base/PlayerStorageRevisionBaseMapper.xml +++ b/src/main/resources/dao/base/PlayerStorageRevisionBaseMapper.xml @@ -307,26 +307,15 @@ - INSERT INTO `gsync_player_storage_revision` - ( - player_id, - game_id, - player_storage_revision_id, - idempotency_key, - created_at, - updated_at - ) VALUES - - #{dto.playerId, jdbcType=NVARCHAR}, - #{dto.gameId, jdbcType=NVARCHAR}, - #{dto.playerStorageRevisionId, jdbcType=NVARCHAR}, - #{dto.idempotencyKey, jdbcType=NVARCHAR}, - #{dto.createdAt, jdbcType=TIMESTAMP}, - #{dto.updatedAt, jdbcType=TIMESTAMP} + INSERT INTO `gsync_player_storage_revision` + (player_id, game_id, player_storage_revision_id, idempotency_key, created_at, updated_at) + VALUES + + (#{dto.playerId, jdbcType=NVARCHAR}, #{dto.gameId, jdbcType=NVARCHAR}, #{dto.playerStorageRevisionId, jdbcType=NVARCHAR}, #{dto.idempotencyKey, jdbcType=NVARCHAR}, #{dto.createdAt, jdbcType=TIMESTAMP}, #{dto.updatedAt, jdbcType=TIMESTAMP}) \ No newline at end of file diff --git a/src/main/resources/dao/base/RGameOperatorBaseMapper.xml b/src/main/resources/dao/base/RGameOperatorBaseMapper.xml index 8038831..70414fa 100644 --- a/src/main/resources/dao/base/RGameOperatorBaseMapper.xml +++ b/src/main/resources/dao/base/RGameOperatorBaseMapper.xml @@ -289,24 +289,15 @@ - INSERT INTO `gsync_r_game_operator` - ( - operator_id, - game_id, - is_admin, - created_at, - updated_at - ) VALUES - - #{dto.operatorId, jdbcType=NVARCHAR}, - #{dto.gameId, jdbcType=NVARCHAR}, - #{dto.isAdmin, jdbcType=BOOLEAN}, - #{dto.createdAt, jdbcType=TIMESTAMP}, - #{dto.updatedAt, jdbcType=TIMESTAMP} + INSERT INTO `gsync_r_game_operator` + (operator_id, game_id, is_admin, created_at, updated_at) + VALUES + + (#{dto.operatorId, jdbcType=NVARCHAR}, #{dto.gameId, jdbcType=NVARCHAR}, #{dto.isAdmin, jdbcType=BOOLEAN}, #{dto.createdAt, jdbcType=TIMESTAMP}, #{dto.updatedAt, jdbcType=TIMESTAMP}) \ No newline at end of file diff --git a/src/main/resources/dao/base/RequiredClientVersionBaseMapper.xml b/src/main/resources/dao/base/RequiredClientVersionBaseMapper.xml index 3625460..1826aeb 100644 --- a/src/main/resources/dao/base/RequiredClientVersionBaseMapper.xml +++ b/src/main/resources/dao/base/RequiredClientVersionBaseMapper.xml @@ -289,24 +289,15 @@ - INSERT INTO `gsync_required_client_version` - ( - master_version, - client_version, - platform, - created_at, - updated_at - ) VALUES - - #{dto.masterVersion, jdbcType=NVARCHAR}, - #{dto.clientVersion, jdbcType=NVARCHAR}, - #{dto.platform, jdbcType=BIGINT}, - #{dto.createdAt, jdbcType=TIMESTAMP}, - #{dto.updatedAt, jdbcType=TIMESTAMP} + INSERT INTO `gsync_required_client_version` + (master_version, client_version, platform, created_at, updated_at) + VALUES + + (#{dto.masterVersion, jdbcType=NVARCHAR}, #{dto.clientVersion, jdbcType=NVARCHAR}, #{dto.platform, jdbcType=BIGINT}, #{dto.createdAt, jdbcType=TIMESTAMP}, #{dto.updatedAt, jdbcType=TIMESTAMP}) \ No newline at end of file From 45e9f94e07956f824082f0dbba3746d3eef3a1c7 Mon Sep 17 00:00:00 2001 From: averak Date: Sun, 14 Jan 2024 03:42:48 +0900 Subject: [PATCH 04/13] =?UTF-8?q?refs=20#80=20=E3=83=95=E3=83=AC=E3=83=B3?= =?UTF-8?q?=E3=83=89=E3=83=AA=E3=82=AF=E3=82=A8=E3=82=B9=E3=83=88=E3=83=86?= =?UTF-8?q?=E3=83=BC=E3=83=96=E3=83=AB=E3=81=AB=E3=82=BB=E3=82=AB=E3=83=B3?= =?UTF-8?q?=E3=83=80=E3=83=AA=E3=82=A4=E3=83=B3=E3=83=87=E3=83=83=E3=82=AF?= =?UTF-8?q?=E3=82=B9=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/db/migration/V1_0_0.sql | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/resources/db/migration/V1_0_0.sql b/src/main/resources/db/migration/V1_0_0.sql index d0e428e..0fe15a1 100644 --- a/src/main/resources/db/migration/V1_0_0.sql +++ b/src/main/resources/db/migration/V1_0_0.sql @@ -34,7 +34,7 @@ CREATE TABLE gsync_master_version created_at TIMESTAMP NOT NULL, updated_at TIMESTAMP NOT NULL, ) PRIMARY KEY (version); -CREATE INDEX gsync_master_version__is_enabled ON gsync_master_version (is_enabled); +CREATE INDEX idx__gsync_master_version__is_enabled ON gsync_master_version (is_enabled); CREATE TABLE gsync_required_client_version ( @@ -53,7 +53,7 @@ CREATE TABLE gsync_player created_at TIMESTAMP NOT NULL, updated_at TIMESTAMP NOT NULL, ) PRIMARY KEY (player_id); -CREATE UNIQUE INDEX gsync_player__friend_id ON gsync_player (friend_id); +CREATE UNIQUE INDEX idx__gsync_player__friend_id ON gsync_player (friend_id); CREATE TABLE gsync_player_profile ( @@ -86,7 +86,7 @@ CREATE TABLE gsync_player_friend become_friend_at TIMESTAMP NOT NULL, created_at TIMESTAMP NOT NULL, updated_at TIMESTAMP NOT NULL, - CONSTRAINT fk__gsync_player_friend__friend_player_id FOREIGN KEY (friend_player_id) REFERENCES gsync_player (friend_id), + CONSTRAINT fk__gsync_player_friend__friend_player_id FOREIGN KEY (friend_player_id) REFERENCES gsync_player (player_id), ) PRIMARY KEY (player_id, friend_player_id), INTERLEAVE IN PARENT gsync_player ON DELETE @@ -99,7 +99,7 @@ CREATE TABLE gsync_player_friend_request sent_at TIMESTAMP NOT NULL, created_at TIMESTAMP NOT NULL, updated_at TIMESTAMP NOT NULL, - CONSTRAINT fk__gsync_player_friend_request__receiver_player_id FOREIGN KEY (receiver_player_id) REFERENCES gsync_player (friend_id), + CONSTRAINT fk__gsync_player_friend_request__receiver_player_id FOREIGN KEY (receiver_player_id) REFERENCES gsync_player (player_id), ) PRIMARY KEY (player_id, receiver_player_id), INTERLEAVE IN PARENT gsync_player ON DELETE @@ -139,8 +139,8 @@ CREATE TABLE gsync_player_storage_revision INTERLEAVE IN PARENT gsync_player ON DELETE CASCADE; -CREATE INDEX gsync_player_storage_revision__player_id__game_id__created_at ON gsync_player_storage_revision (player_id, game_id, created_at DESC); -CREATE UNIQUE INDEX gsync_player_storage_revision__idempotency_key ON gsync_player_storage_revision (idempotency_key); +CREATE INDEX idx__gsync_player_storage_revision__player_id__game_id__created_at ON gsync_player_storage_revision (player_id, game_id, created_at DESC); +CREATE UNIQUE INDEX uq__gsync_player_storage_revision__idempotency_key ON gsync_player_storage_revision (idempotency_key); CREATE TABLE gsync_echo ( From 6fb2c80eb4f44a6fe1e0d323120e3e9dde64ca5f Mon Sep 17 00:00:00 2001 From: averak Date: Sun, 14 Jan 2024 03:11:00 +0900 Subject: [PATCH 05/13] =?UTF-8?q?refs=20#80=20=E3=83=95=E3=83=AC=E3=83=B3?= =?UTF-8?q?=E3=83=89=E6=A9=9F=E8=83=BD=E3=81=AE=E3=83=89=E3=83=A1=E3=82=A4?= =?UTF-8?q?=E3=83=B3=E5=B1=A4=E3=82=92=E5=AE=9F=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../adapter/repository/EchoRepository.kt | 15 +- .../adapter/repository/FriendRepository.kt | 195 ++++++++ .../adapter/repository/GameRepository.kt | 15 +- .../adapter/repository/OperatorRepository.kt | 25 +- .../adapter/repository/PlayerRepository.kt | 48 +- .../repository/PlayerStorageRepository.kt | 66 +-- .../repository/FriendRepository_UT.groovy | 420 ++++++++++++++++++ .../net/averak/gsync/domain/model/Friend.kt | 58 +++ .../domain/repository/IFriendRepository.kt | 26 ++ .../exception/MasterDataNotFoundException.kt | 3 + .../gsync/domain/model/Friend_UT.groovy | 37 ++ .../randomizer/SpannerRandomizers.groovy | 87 +++- 12 files changed, 913 insertions(+), 82 deletions(-) create mode 100644 app/adapter/src/main/kotlin/net/averak/gsync/adapter/repository/FriendRepository.kt create mode 100644 app/adapter/src/test/groovy/net/averak/gsync/adapter/repository/FriendRepository_UT.groovy create mode 100644 app/domain/src/main/kotlin/net/averak/gsync/domain/model/Friend.kt create mode 100644 app/domain/src/main/kotlin/net/averak/gsync/domain/repository/IFriendRepository.kt create mode 100644 app/domain/src/main/kotlin/net/averak/gsync/domain/repository/exception/MasterDataNotFoundException.kt create mode 100644 app/domain/src/test/groovy/net/averak/gsync/domain/model/Friend_UT.groovy diff --git a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/repository/EchoRepository.kt b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/repository/EchoRepository.kt index f678006..2aa7376 100644 --- a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/repository/EchoRepository.kt +++ b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/repository/EchoRepository.kt @@ -27,10 +27,17 @@ open class EchoRepository( override fun findByID(gctx: GameContext, id: UUID): Echo? { return echoMapper.selectByPrimaryKey(id.toString())?.let { - Echo( - id = UUID.fromString(it.echoId), - message = it.message, - timestamp = it.timestamp, + convertDtoToModel(it) + } + } + + companion object { + + fun convertDtoToModel(dto: EchoDto): Echo { + return Echo( + id = UUID.fromString(dto.echoId), + message = dto.message, + timestamp = dto.timestamp, ) } } diff --git a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/repository/FriendRepository.kt b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/repository/FriendRepository.kt new file mode 100644 index 0000000..4f51aaf --- /dev/null +++ b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/repository/FriendRepository.kt @@ -0,0 +1,195 @@ +package net.averak.gsync.adapter.repository + +import net.averak.gsync.adapter.dao.dto.base.* +import net.averak.gsync.adapter.dao.mapper.base.FriendSettingMasterBaseMapper +import net.averak.gsync.adapter.dao.mapper.base.PlayerFriendBaseMapper +import net.averak.gsync.adapter.dao.mapper.base.PlayerFriendRequestBaseMapper +import net.averak.gsync.adapter.dao.mapper.base.PlayerProfileBaseMapper +import net.averak.gsync.core.game_context.GameContext +import net.averak.gsync.domain.model.* +import net.averak.gsync.domain.repository.IFriendRepository +import net.averak.gsync.domain.repository.exception.MasterDataNotFoundException +import org.springframework.stereotype.Repository +import java.util.* + +@Repository +open class FriendRepository( + private val playerFriendMapper: PlayerFriendBaseMapper, + private val playerFriendRequestMapper: PlayerFriendRequestBaseMapper, + private val playerProfileMapper: PlayerProfileBaseMapper, + private val friendSettingMasterMapper: FriendSettingMasterBaseMapper, +) : IFriendRepository { + + override fun getFriends(gctx: GameContext, playerID: UUID): List { + // becomeFriendAt > now だとしても、フレンドと判定して良い + val dtos = playerFriendMapper.selectByExample( + PlayerFriendExample().apply { + createCriteria().andPlayerIdEqualTo(playerID.toString()) + }, + ) + if (dtos.isEmpty()) { + return emptyList() + } + + val profiles = playerProfileMapper.selectByExample( + PlayerProfileExample().apply { + createCriteria().andPlayerIdIn(dtos.map { it.friendPlayerId }) + }, + ) + + return dtos.map { dto -> + val profile = profiles.find { it.playerId == dto.friendPlayerId } + if (profile == null) { + throw RuntimeException("Player profile not found, playerID=${dto.friendPlayerId}.") + } + convertDtoToModel(dto, profile) + } + } + + override fun getFriendStatus(gctx: GameContext, playerID: UUID, vararg friendPlayerIDs: UUID): List { + if (friendPlayerIDs.isEmpty()) { + return emptyList() + } + + val friends = getFriends(gctx, playerID) + val requestDtos = playerFriendRequestMapper.selectByExample( + PlayerFriendRequestExample().apply { + createCriteria() + .andPlayerIdIn(listOf(playerID.toString(), *friendPlayerIDs.map { it.toString() }.toTypedArray())) + }, + ) + + return friendPlayerIDs.map { friendPlayerID -> + return@map when { + friends.any { it.friendPlayerID == friendPlayerID } -> { + FriendStatus.FRIEND + } + + requestDtos.any { it.playerId == playerID.toString() && it.receiverPlayerId == friendPlayerID.toString() } -> { + FriendStatus.SENT_REQUEST + } + + requestDtos.any { it.playerId == friendPlayerID.toString() && it.receiverPlayerId == playerID.toString() } -> { + FriendStatus.RECEIVED_REQUEST + } + + else -> { + FriendStatus.NONE + } + } + } + } + + override fun getSentFriendRequests(gctx: GameContext, playerID: UUID): List { + val dtos = playerFriendRequestMapper.selectByExample( + PlayerFriendRequestExample().apply { + createCriteria().andPlayerIdEqualTo(playerID.toString()) + }, + ) + return dtos.map { convertDtoToModel(it) } + } + + override fun getReceivedFriendRequests(gctx: GameContext, playerID: UUID): List { + val dtos = playerFriendRequestMapper.selectByExample( + PlayerFriendRequestExample().apply { + createCriteria().andReceiverPlayerIdEqualTo(playerID.toString()) + }, + ) + return dtos.map { convertDtoToModel(it) } + } + + override fun saveFriendship(gctx: GameContext, friendship: Friendship) { + val dtos = listOf( + PlayerFriendDto( + friendship.playerIDs.first.toString(), + friendship.playerIDs.second.toString(), + friendship.becomeFriendAt, + gctx.currentTime, + gctx.currentTime, + ), + PlayerFriendDto( + friendship.playerIDs.second.toString(), + friendship.playerIDs.first.toString(), + friendship.becomeFriendAt, + gctx.currentTime, + gctx.currentTime, + ), + ) + playerFriendMapper.syncOriginal(dtos) + playerFriendMapper.insertOrUpdate(dtos) + + // フレンド関係が構築されたら、フレンドリクエストは削除する + playerFriendRequestMapper.deleteByExample( + PlayerFriendRequestExample().apply { + createCriteria() + .andPlayerIdIn( + friendship.playerIDs.toList().map { it.toString() }, + ) + .andReceiverPlayerIdIn( + friendship.playerIDs.toList().map { it.toString() }, + ) + }, + ) + } + + override fun saveFriendRequest(gctx: GameContext, friendRequest: FriendRequest) { + val dto = PlayerFriendRequestDto( + friendRequest.playerID.toString(), + friendRequest.receiverPlayerID.toString(), + friendRequest.sentAt, + gctx.currentTime, + gctx.currentTime, + ) + playerFriendRequestMapper.syncOriginal(dto) + playerFriendRequestMapper.insertOrUpdate(dto) + } + + override fun deleteFriendship(gctx: GameContext, friendship: Friendship) { + val example = PlayerFriendExample().apply { + createCriteria() + .andPlayerIdIn( + friendship.playerIDs.toList().map { it.toString() }, + ) + .andFriendPlayerIdIn( + friendship.playerIDs.toList().map { it.toString() }, + ) + } + playerFriendMapper.deleteByExample(example) + } + + override fun getSetting(gctx: GameContext): FriendSetting { + val dto = friendSettingMasterMapper.selectByPrimaryKey(gctx.masterVersion.toString()) + if (dto == null) { + throw MasterDataNotFoundException(FriendSettingMasterDto::class.java) + } + + return convertDtoToModel(dto) + } + + companion object { + + fun convertDtoToModel(dto: PlayerFriendDto, profileDto: PlayerProfileDto): Friend { + return Friend( + playerID = UUID.fromString(dto.playerId), + friendPlayerID = UUID.fromString(dto.friendPlayerId), + becomeFriendAt = dto.becomeFriendAt, + profile = PlayerRepository.convertDtoToModel(profileDto), + ) + } + + fun convertDtoToModel(dto: PlayerFriendRequestDto): FriendRequest { + return FriendRequest( + playerID = UUID.fromString(dto.playerId), + receiverPlayerID = UUID.fromString(dto.receiverPlayerId), + sentAt = dto.sentAt, + ) + } + + fun convertDtoToModel(dto: FriendSettingMasterDto): FriendSetting { + return FriendSetting( + maxFriendCount = dto.maxFriendCount.toInt(), + maxFriendRequestCount = dto.maxFriendRequestCount.toInt(), + ) + } + } +} diff --git a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/repository/GameRepository.kt b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/repository/GameRepository.kt index 57e87cd..7898974 100644 --- a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/repository/GameRepository.kt +++ b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/repository/GameRepository.kt @@ -24,10 +24,7 @@ open class GameRepository( createCriteria().andGameIdIn(ids.map { it.toString() }) }, ).map { - Game( - id = UUID.fromString(it.gameId), - name = it.name, - ) + convertDtoToModel(it) } } @@ -41,4 +38,14 @@ open class GameRepository( gameMapper.syncOriginal(dto) gameMapper.insertOrUpdate(dto) } + + companion object { + + fun convertDtoToModel(dto: GameDto): Game { + return Game( + id = UUID.fromString(dto.gameId), + name = dto.name, + ) + } + } } diff --git a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/repository/OperatorRepository.kt b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/repository/OperatorRepository.kt index ac05fa6..1ca4b19 100644 --- a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/repository/OperatorRepository.kt +++ b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/repository/OperatorRepository.kt @@ -24,16 +24,19 @@ open class OperatorRepository( } } - private fun convertDtoToModel(dto: OperatorILDto): Operator { - return Operator( - id = UUID.fromString(dto.operatorId), - email = dto.email, - authorities = dto.rGameOperators.map { rGameOperator -> - GameOperationAuthority( - gameID = UUID.fromString(rGameOperator.gameId), - isAdmin = rGameOperator.isAdmin, - ) - }, - ) + companion object { + + fun convertDtoToModel(dto: OperatorILDto): Operator { + return Operator( + id = UUID.fromString(dto.operatorId), + email = dto.email, + authorities = dto.rGameOperators.map { rGameOperator -> + GameOperationAuthority( + gameID = UUID.fromString(rGameOperator.gameId), + isAdmin = rGameOperator.isAdmin, + ) + }, + ) + } } } diff --git a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/repository/PlayerRepository.kt b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/repository/PlayerRepository.kt index 3ee377d..b9e7d0e 100644 --- a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/repository/PlayerRepository.kt +++ b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/repository/PlayerRepository.kt @@ -3,6 +3,7 @@ package net.averak.gsync.adapter.repository import net.averak.gsync.adapter.dao.dto.base.PlayerDto import net.averak.gsync.adapter.dao.dto.base.PlayerLoginDto import net.averak.gsync.adapter.dao.dto.base.PlayerProfileDto +import net.averak.gsync.adapter.dao.dto.extend.PlayerILDto import net.averak.gsync.adapter.dao.mapper.base.PlayerLoginBaseMapper import net.averak.gsync.adapter.dao.mapper.base.PlayerProfileBaseMapper import net.averak.gsync.adapter.dao.mapper.extend.PlayerMapper @@ -26,22 +27,7 @@ open class PlayerRepository( return if (dto == null) { null } else { - val loginDto = dto.playerLogin - Player( - id = UUID.fromString(dto.playerId), - friendID = UUID.fromString(dto.friendId), - isBanned = dto.isBanned, - profile = PlayerProfile( - nickname = dto.playerProfile.nickname, - iconID = dto.playerProfile.iconId, - ), - login = loginDto?.let { - PlayerLogin( - totalLoginDays = loginDto.totalLoginDays.toInt(), - lastLoggedInAt = loginDto.lastLoggedInAt, - ) - }, - ) + convertDtoToModel(dto) } } @@ -69,7 +55,10 @@ open class PlayerRepository( // player.login が null の場合はログイン履歴を削除するのが適切な永続化の振る舞いだが、 // ログイン履歴を削除するようなユースケースはない & プレイヤーには見れない情報であり多少の誤差は許容されるため、削除処理はスキップする (実装が面倒なのもある) - val login = player.login ?: return + val login = player.login + if (login == null) { + return + } val loginDto = PlayerLoginDto( player.id.toString(), login.totalLoginDays.toLong(), @@ -80,4 +69,29 @@ open class PlayerRepository( playerLoginMapper.syncOriginal(loginDto) playerLoginMapper.insertOrUpdate(loginDto) } + + companion object { + + fun convertDtoToModel(dto: PlayerILDto): Player { + return Player( + id = UUID.fromString(dto.playerId), + friendID = UUID.fromString(dto.friendId), + isBanned = dto.isBanned, + profile = convertDtoToModel(dto.playerProfile), + login = dto.playerLogin?.let { + PlayerLogin( + totalLoginDays = it.totalLoginDays.toInt(), + lastLoggedInAt = it.lastLoggedInAt, + ) + }, + ) + } + + fun convertDtoToModel(dto: PlayerProfileDto): PlayerProfile { + return PlayerProfile( + nickname = dto.nickname, + iconID = dto.iconId, + ) + } + } } diff --git a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/repository/PlayerStorageRepository.kt b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/repository/PlayerStorageRepository.kt index c309533..d1b8fb9 100644 --- a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/repository/PlayerStorageRepository.kt +++ b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/repository/PlayerStorageRepository.kt @@ -12,7 +12,6 @@ import net.averak.gsync.domain.model.PlayerStorageEntry import net.averak.gsync.domain.repository.IPlayerStorageRepository import net.averak.gsync.domain.repository.exception.AlreadyDoneException import org.springframework.stereotype.Repository -import java.time.LocalDateTime import java.util.* @Repository @@ -46,18 +45,18 @@ open class PlayerStorageRepository( entries = mutableListOf(), ) } - val entries = playerStorageEntryMapper.selectByPlayerIdAndGameId( + val entryDtos = playerStorageEntryMapper.selectByPlayerIdAndGameId( playerID.toString(), gameID.toString(), criteria.exactMatch, criteria.forwardMatch, - ).map { convertDtoToModel(it) }.toMutableList() + ) - return PlayerStorage( - playerID = playerID, - gameID = gameID, - revision = UUID.fromString(revisionDto.playerStorageRevisionId), - entries = entries, + return convertDtoToModel( + playerID, + gameID, + revisionDto, + entryDtos, ) } @@ -96,33 +95,40 @@ open class PlayerStorageRepository( val notClearedEntries = playerStorage.entries.filter { !it.isCleared() } val entryDtos = notClearedEntries.map { - convertModelToDto(it, playerStorage.playerID, playerStorage.gameID, gctx.currentTime, gctx.currentTime) + PlayerStorageEntryDto( + playerStorage.playerID.toString(), + playerStorage.gameID.toString(), + it.key, + gctx.currentTime, + gctx.currentTime, + it.value, + ) } playerStorageEntryMapper.syncOriginal(entryDtos) playerStorageEntryMapper.insertOrUpdate(entryDtos) } - private fun convertDtoToModel(playerStorageEntryDto: PlayerStorageEntryDto): PlayerStorageEntry { - return PlayerStorageEntry( - key = playerStorageEntryDto.key, - value = playerStorageEntryDto.value, - ) - } + companion object { - private fun convertModelToDto( - playerStorageEntry: PlayerStorageEntry, - playerID: UUID, - gameID: UUID, - createdAt: LocalDateTime, - updatedAt: LocalDateTime, - ): PlayerStorageEntryDto { - return PlayerStorageEntryDto( - playerID.toString(), - gameID.toString(), - playerStorageEntry.key, - createdAt, - updatedAt, - playerStorageEntry.value, - ) + fun convertDtoToModel( + playerID: UUID, + gameID: UUID, + revisionDto: PlayerStorageRevisionDto, + entryDtos: List, + ): PlayerStorage { + return PlayerStorage( + playerID = playerID, + gameID = gameID, + revision = UUID.fromString(revisionDto.playerStorageRevisionId), + entries = entryDtos.map { convertDtoToModel(it) }.toMutableList(), + ) + } + + fun convertDtoToModel(dto: PlayerStorageEntryDto): PlayerStorageEntry { + return PlayerStorageEntry( + key = dto.key, + value = dto.value, + ) + } } } diff --git a/app/adapter/src/test/groovy/net/averak/gsync/adapter/repository/FriendRepository_UT.groovy b/app/adapter/src/test/groovy/net/averak/gsync/adapter/repository/FriendRepository_UT.groovy new file mode 100644 index 0000000..615a0f8 --- /dev/null +++ b/app/adapter/src/test/groovy/net/averak/gsync/adapter/repository/FriendRepository_UT.groovy @@ -0,0 +1,420 @@ +package net.averak.gsync.adapter.repository + +import net.averak.gsync.adapter.dao.dto.base.* +import net.averak.gsync.core.game_context.GameContext +import net.averak.gsync.domain.model.FriendRequest +import net.averak.gsync.domain.model.FriendSetting +import net.averak.gsync.domain.model.FriendStatus +import net.averak.gsync.domain.model.Friendship +import net.averak.gsync.domain.repository.exception.MasterDataNotFoundException +import net.averak.gsync.testkit.Assert +import net.averak.gsync.testkit.Faker +import net.averak.gsync.testkit.Fixture +import org.springframework.beans.factory.annotation.Autowired + +import java.time.LocalDateTime + +class FriendRepository_UT extends AbstractRepository_UT { + + @Autowired + FriendRepository sut + + def "getFriends: フレンドリストを取得"() { + given: + Fixture.setup( + // p1 friends -> [p2, p3] + Faker.fake(PlayerDto, [ + playerId: Faker.uuidv5("p1").toString(), + ]), + // p2 friends -> [p1] + Faker.fake(PlayerDto, [ + playerId: Faker.uuidv5("p2").toString(), + ]), + // p3 friends -> [p1] + Faker.fake(PlayerDto, [ + playerId: Faker.uuidv5("p3").toString(), + ]), + // p4 friends -> [] + Faker.fake(PlayerDto, [ + playerId: Faker.uuidv5("p4").toString(), + ]), + ) + Fixture.setup( + Faker.fake(PlayerFriendDto, [ + playerId : Faker.uuidv5("p1").toString(), + friendPlayerId: Faker.uuidv5("p2").toString(), + ]), + Faker.fake(PlayerFriendDto, [ + playerId : Faker.uuidv5("p1").toString(), + friendPlayerId: Faker.uuidv5("p3").toString(), + ]), + Faker.fake(PlayerFriendDto, [ + playerId : Faker.uuidv5("p2").toString(), + friendPlayerId: Faker.uuidv5("p1").toString(), + ]), + Faker.fake(PlayerFriendDto, [ + playerId : Faker.uuidv5("p3").toString(), + friendPlayerId: Faker.uuidv5("p1").toString(), + ]), + ) + Fixture.setup( + Faker.fake(PlayerProfileDto, [ + playerId: Faker.uuidv5("p1").toString(), + ]), + Faker.fake(PlayerProfileDto, [ + playerId: Faker.uuidv5("p2").toString(), + ]), + Faker.fake(PlayerProfileDto, [ + playerId: Faker.uuidv5("p3").toString(), + ]), + Faker.fake(PlayerProfileDto, [ + playerId: Faker.uuidv5("p4").toString(), + ]), + ) + + when: + final result = sut.getFriends(Faker.fake(GameContext), playerID) + + then: + result*.friendPlayerID == expectedFriendPlayerIDs + + where: + playerID || expectedFriendPlayerIDs + Faker.uuidv5("p1") || [Faker.uuidv5("p2"), Faker.uuidv5("p3")] + Faker.uuidv5("p2") || [Faker.uuidv5("p1")] + Faker.uuidv5("p3") || [Faker.uuidv5("p1")] + Faker.uuidv5("p4") || [] + } + + def "getFriends: プロフィールが存在しない場合はエラーを返す"() { + given: + Fixture.setup( + Faker.fake(PlayerDto, [ + playerId: Faker.uuidv5("p1").toString(), + ]), + Faker.fake(PlayerDto, [ + playerId: Faker.uuidv5("p2").toString(), + ]), + ) + Fixture.setup( + Faker.fake(PlayerFriendDto, [ + playerId : Faker.uuidv5("p1").toString(), + friendPlayerId: Faker.uuidv5("p2").toString(), + ]), + Faker.fake(PlayerFriendDto, [ + playerId : Faker.uuidv5("p2").toString(), + friendPlayerId: Faker.uuidv5("p1").toString(), + ]), + ) + + when: + sut.getFriends(Faker.fake(GameContext), Faker.uuidv5("p1")) + + then: + final ex = thrown(RuntimeException) + ex.message == "Player profile not found, playerID=${Faker.uuidv5("p2")}." + } + + def "getFriendStatus: フレンドステータスを取得"() { + given: + Fixture.setup( + // p1 friends -> [p2] + // p1 sent requests -> [p3] + Faker.fake(PlayerDto, [ + playerId: Faker.uuidv5("p1").toString(), + ]), + // p2 friends -> [p1] + // p2 sent requests -> [] + Faker.fake(PlayerDto, [ + playerId: Faker.uuidv5("p2").toString(), + ]), + // p3 friends -> [] + // p3 sent requests -> [] + Faker.fake(PlayerDto, [ + playerId: Faker.uuidv5("p3").toString(), + ]), + // p4 friends -> [] + // p4 sent requests -> [] + Faker.fake(PlayerDto, [ + playerId: Faker.uuidv5("p4").toString(), + ]), + ) + Fixture.setup( + Faker.fake(PlayerFriendDto, [ + playerId : Faker.uuidv5("p1").toString(), + friendPlayerId: Faker.uuidv5("p2").toString(), + ]), + Faker.fake(PlayerFriendDto, [ + playerId : Faker.uuidv5("p2").toString(), + friendPlayerId: Faker.uuidv5("p1").toString(), + ]), + ) + Fixture.setup( + Faker.fake(PlayerFriendRequestDto, [ + playerId : Faker.uuidv5("p1").toString(), + receiverPlayerId: Faker.uuidv5("p3").toString(), + ]), + ) + Fixture.setup( + Faker.fake(PlayerProfileDto, [ + playerId: Faker.uuidv5("p1").toString(), + ]), + Faker.fake(PlayerProfileDto, [ + playerId: Faker.uuidv5("p2").toString(), + ]), + Faker.fake(PlayerProfileDto, [ + playerId: Faker.uuidv5("p3").toString(), + ]), + Faker.fake(PlayerProfileDto, [ + playerId: Faker.uuidv5("p4").toString(), + ]), + ) + + when: + // noinspection GroovyAssignabilityCheck + final result = sut.getFriendStatus(Faker.fake(GameContext), playerID, *friendPlayerIDs) + + then: + result == expected + + where: + playerID | friendPlayerIDs || expected + Faker.uuidv5("p1") | [Faker.uuidv5("p2"), Faker.uuidv5("p3"), Faker.uuidv5("p4")] || [FriendStatus.FRIEND, FriendStatus.SENT_REQUEST, FriendStatus.NONE] + Faker.uuidv5("p2") | [Faker.uuidv5("p1"), Faker.uuidv5("p3"), Faker.uuidv5("p4")] || [FriendStatus.FRIEND, FriendStatus.NONE, FriendStatus.NONE] + Faker.uuidv5("p3") | [Faker.uuidv5("p1"), Faker.uuidv5("p2"), Faker.uuidv5("p4")] || [FriendStatus.RECEIVED_REQUEST, FriendStatus.NONE, FriendStatus.NONE] + Faker.uuidv5("p4") | [Faker.uuidv5("p1"), Faker.uuidv5("p2"), Faker.uuidv5("p3")] || [FriendStatus.NONE, FriendStatus.NONE, FriendStatus.NONE] + Faker.uuidv5("p1") | [] || [] + Faker.uuidv5("p1") | [Faker.uuidv5("p2")] || [FriendStatus.FRIEND] + } + + def "getSentFriendRequests: 送信したフレンドリクエストリストを取得"() { + given: + Fixture.setup( + // p1 sent requests -> [p2, p3] + Faker.fake(PlayerDto, [ + playerId: Faker.uuidv5("p1").toString(), + ]), + // p2 sent requests -> [p3] + Faker.fake(PlayerDto, [ + playerId: Faker.uuidv5("p2").toString(), + ]), + // p3 sent requests -> [] + Faker.fake(PlayerDto, [ + playerId: Faker.uuidv5("p3").toString(), + ]), + ) + Fixture.setup( + Faker.fake(PlayerFriendRequestDto, [ + playerId : Faker.uuidv5("p1").toString(), + receiverPlayerId: Faker.uuidv5("p2").toString(), + ]), + Faker.fake(PlayerFriendRequestDto, [ + playerId : Faker.uuidv5("p1").toString(), + receiverPlayerId: Faker.uuidv5("p3").toString(), + ]), + Faker.fake(PlayerFriendRequestDto, [ + playerId : Faker.uuidv5("p2").toString(), + receiverPlayerId: Faker.uuidv5("p3").toString(), + ]), + ) + + when: + final result = sut.getSentFriendRequests(Faker.fake(GameContext), playerID) + + then: + result*.receiverPlayerID.sort() == expectedReceiverPlayerIDs.sort() + + where: + playerID || expectedReceiverPlayerIDs + Faker.uuidv5("p1") || [Faker.uuidv5("p2"), Faker.uuidv5("p3")] + Faker.uuidv5("p2") || [Faker.uuidv5("p3")] + Faker.uuidv5("p3") || [] + } + + def "getReceivedFriendRequests: 受け取ったフレンドリクエストリストを取得"() { + given: + Fixture.setup( + // p1 sent requests -> [p2, p3] + Faker.fake(PlayerDto, [ + playerId: Faker.uuidv5("p1").toString(), + ]), + // p2 sent requests -> [p3] + Faker.fake(PlayerDto, [ + playerId: Faker.uuidv5("p2").toString(), + ]), + // p3 sent requests -> [] + Faker.fake(PlayerDto, [ + playerId: Faker.uuidv5("p3").toString(), + ]), + ) + Fixture.setup( + Faker.fake(PlayerFriendRequestDto, [ + playerId : Faker.uuidv5("p1").toString(), + receiverPlayerId: Faker.uuidv5("p2").toString(), + ]), + Faker.fake(PlayerFriendRequestDto, [ + playerId : Faker.uuidv5("p1").toString(), + receiverPlayerId: Faker.uuidv5("p3").toString(), + ]), + Faker.fake(PlayerFriendRequestDto, [ + playerId : Faker.uuidv5("p2").toString(), + receiverPlayerId: Faker.uuidv5("p3").toString(), + ]), + ) + + when: + final result = sut.getReceivedFriendRequests(Faker.fake(GameContext), playerID) + + then: + result*.playerID.sort() == expectedPlayerIDs.sort() + + where: + playerID || expectedPlayerIDs + Faker.uuidv5("p1") || [] + Faker.uuidv5("p2") || [Faker.uuidv5("p1")] + Faker.uuidv5("p3") || [Faker.uuidv5("p1"), Faker.uuidv5("p2")] + } + + def "saveFriendship: フレンド関係を作成"() { + given: + Fixture.setup( + Faker.fake(PlayerDto, [ + playerId: Faker.uuidv5("p1").toString(), + ]), + Faker.fake(PlayerDto, [ + playerId: Faker.uuidv5("p2").toString(), + ]), + Faker.fake(PlayerDto, [ + playerId: Faker.uuidv5("p3").toString(), + ]), + ) + Fixture.setup( + Faker.fake(PlayerFriendRequestDto, [ + playerId : Faker.uuidv5("p1").toString(), + receiverPlayerId: Faker.uuidv5("p2").toString(), + ]), + Faker.fake(PlayerFriendRequestDto, [ + playerId : Faker.uuidv5("p2").toString(), + receiverPlayerId: Faker.uuidv5("p1").toString(), + ]), + Faker.fake(PlayerFriendRequestDto, [ + playerId : Faker.uuidv5("p1").toString(), + receiverPlayerId: Faker.uuidv5("p3").toString(), + ]), + ) + + when: + final friendship = new Friendship(Faker.uuidv5("p1"), Faker.uuidv5("p2"), LocalDateTime.now()) + sut.saveFriendship(Faker.fake(GameContext), friendship) + + then: + with(sql.rows("SELECT * FROM gsync_player_friend")) { + it.size() == 2 + it[0].player_id == Faker.uuidv5("p1").toString() + it[0].friend_player_id == Faker.uuidv5("p2").toString() + it[1].player_id == Faker.uuidv5("p2").toString() + it[1].friend_player_id == Faker.uuidv5("p1").toString() + } + with(sql.rows("SELECT * FROM gsync_player_friend_request")) { + it.size() == 1 + it[0].player_id == Faker.uuidv5("p1").toString() + it[0].receiver_player_id == Faker.uuidv5("p3").toString() + } + } + + def "saveFriendRequest: フレンドリクエストを取得"() { + given: + Fixture.setup( + Faker.fake(PlayerDto, [ + playerId: Faker.uuidv5("p1").toString(), + ]), + Faker.fake(PlayerDto, [ + playerId: Faker.uuidv5("p2").toString(), + ]), + ) + final now = LocalDateTime.now() + + when: + final friendRequest = new FriendRequest(Faker.uuidv5("p1"), Faker.uuidv5("p2"), now) + sut.saveFriendRequest(Faker.fake(GameContext), friendRequest) + + then: + with(sql.rows("SELECT * FROM gsync_player_friend_request")) { + it.size() == 1 + it[0].player_id == Faker.uuidv5("p1").toString() + it[0].receiver_player_id == Faker.uuidv5("p2").toString() + Assert.timestampIs(it[0].sent_at, now) + } + } + + def "deleteFriendship: フレンド関係を削除"() { + given: + Fixture.setup( + Faker.fake(PlayerDto, [ + playerId: Faker.uuidv5("p1").toString(), + ]), + Faker.fake(PlayerDto, [ + playerId: Faker.uuidv5("p2").toString(), + ]), + Faker.fake(PlayerDto, [ + playerId: Faker.uuidv5("p3").toString(), + ]), + ) + Fixture.setup( + // 以下2レコードが削除されるはず + Faker.fake(PlayerFriendDto, [ + playerId : Faker.uuidv5("p1").toString(), + friendPlayerId: Faker.uuidv5("p2").toString(), + ]), + Faker.fake(PlayerFriendDto, [ + playerId : Faker.uuidv5("p2").toString(), + friendPlayerId: Faker.uuidv5("p1").toString(), + ]), + + Faker.fake(PlayerFriendDto, [ + playerId : Faker.uuidv5("p1").toString(), + friendPlayerId: Faker.uuidv5("p3").toString(), + ]), + Faker.fake(PlayerFriendDto, [ + playerId : Faker.uuidv5("p3").toString(), + friendPlayerId: Faker.uuidv5("p1").toString(), + ]), + ) + + when: + final friendship = new Friendship(Faker.uuidv5("p1"), Faker.uuidv5("p2"), LocalDateTime.now()) + sut.deleteFriendship(Faker.fake(GameContext), friendship) + + then: + with(sql.rows("SELECT * FROM gsync_player_friend")) { + it.size() == 2 + it[0].player_id == Faker.uuidv5("p1").toString() + it[0].friend_player_id == Faker.uuidv5("p3").toString() + it[1].player_id == Faker.uuidv5("p3").toString() + it[1].friend_player_id == Faker.uuidv5("p1").toString() + } + } + + def "getSetting: フレンド設定マスタを取得"() { + given: + Fixture.setup( + Faker.fake(FriendSettingMasterDto, [ + masterVersion : Faker.uuidv5("m1").toString(), + maxFriendCount : 100.toLong(), + maxFriendRequestCount: 200.toLong(), + ]), + ) + + when: + final result = sut.getSetting(Faker.fake(GameContext, [masterVersion: Faker.uuidv5("m1")])) + + then: + result == new FriendSetting(100, 200) + + when: + sut.getSetting(Faker.fake(GameContext, [masterVersion: Faker.uuidv5("m2")])) + + then: + thrown(MasterDataNotFoundException) + } +} diff --git a/app/domain/src/main/kotlin/net/averak/gsync/domain/model/Friend.kt b/app/domain/src/main/kotlin/net/averak/gsync/domain/model/Friend.kt new file mode 100644 index 0000000..4cd7055 --- /dev/null +++ b/app/domain/src/main/kotlin/net/averak/gsync/domain/model/Friend.kt @@ -0,0 +1,58 @@ +package net.averak.gsync.domain.model + +import java.time.LocalDateTime +import java.util.* + +data class Friend( + val playerID: UUID, + val friendPlayerID: UUID, + val becomeFriendAt: LocalDateTime, + val profile: PlayerProfile, +) + +data class FriendRequest( + val playerID: UUID, + val receiverPlayerID: UUID, + val sentAt: LocalDateTime, +) { + + fun approved(now: LocalDateTime): Friendship { + return Friendship(playerID, receiverPlayerID, now) + } +} + +/** + * 相互にフレンドである関係を表す。 + * follower-followee のような一方向の関係は許されず、「Aから見てBはフレンド」ならば「Bから見てAはフレンド」が必ず成り立つ。 + */ +data class Friendship( + val playerIDs: Pair, + val becomeFriendAt: LocalDateTime, +) { + + constructor(player1ID: UUID, player2ID: UUID, becomeFriendAt: LocalDateTime) : this( + playerIDs = Pair(player1ID, player2ID), + becomeFriendAt, + ) + + init { + require(playerIDs.first != playerIDs.second) { + "playerIDs must be different." + } + } +} + +enum class FriendStatus { + NONE, + FRIEND, + SENT_REQUEST, + RECEIVED_REQUEST, +} + +data class FriendSetting( + val maxFriendCount: Int, + /** + * 未承認のフレンドリクエストの最大数 + */ + val maxFriendRequestCount: Int, +) diff --git a/app/domain/src/main/kotlin/net/averak/gsync/domain/repository/IFriendRepository.kt b/app/domain/src/main/kotlin/net/averak/gsync/domain/repository/IFriendRepository.kt new file mode 100644 index 0000000..6bd2c09 --- /dev/null +++ b/app/domain/src/main/kotlin/net/averak/gsync/domain/repository/IFriendRepository.kt @@ -0,0 +1,26 @@ +package net.averak.gsync.domain.repository + +import net.averak.gsync.core.game_context.GameContext +import net.averak.gsync.domain.model.* +import net.averak.gsync.domain.repository.exception.MasterDataNotFoundException +import java.util.* + +interface IFriendRepository { + + fun getFriends(gctx: GameContext, playerID: UUID): List + + fun getFriendStatus(gctx: GameContext, playerID: UUID, vararg friendPlayerIDs: UUID): List + + fun getSentFriendRequests(gctx: GameContext, playerID: UUID): List + + fun getReceivedFriendRequests(gctx: GameContext, playerID: UUID): List + + fun saveFriendship(gctx: GameContext, friendship: Friendship) + + fun saveFriendRequest(gctx: GameContext, friendRequest: FriendRequest) + + fun deleteFriendship(gctx: GameContext, friendship: Friendship) + + @Throws(MasterDataNotFoundException::class) + fun getSetting(gctx: GameContext): FriendSetting +} diff --git a/app/domain/src/main/kotlin/net/averak/gsync/domain/repository/exception/MasterDataNotFoundException.kt b/app/domain/src/main/kotlin/net/averak/gsync/domain/repository/exception/MasterDataNotFoundException.kt new file mode 100644 index 0000000..15f2676 --- /dev/null +++ b/app/domain/src/main/kotlin/net/averak/gsync/domain/repository/exception/MasterDataNotFoundException.kt @@ -0,0 +1,3 @@ +package net.averak.gsync.domain.repository.exception + +class MasterDataNotFoundException(type: Class<*>) : RuntimeException("Master data not found, type=${type.simpleName}.") diff --git a/app/domain/src/test/groovy/net/averak/gsync/domain/model/Friend_UT.groovy b/app/domain/src/test/groovy/net/averak/gsync/domain/model/Friend_UT.groovy new file mode 100644 index 0000000..65456b3 --- /dev/null +++ b/app/domain/src/test/groovy/net/averak/gsync/domain/model/Friend_UT.groovy @@ -0,0 +1,37 @@ +package net.averak.gsync.domain.model + +import kotlin.Pair +import net.averak.gsync.testkit.AbstractSpec +import net.averak.gsync.testkit.Faker + +import java.time.LocalDateTime + +class FriendRequest_UT extends AbstractSpec { + + def "approved: リクエストを承認する"() { + given: + final now = LocalDateTime.now() + def friendRequest = Faker.fake(FriendRequest) + + when: + final result = friendRequest.approved(now) + + then: + result.playerIDs == new Pair(friendRequest.playerID, friendRequest.receiverPlayerID) + result.becomeFriendAt == now + } +} + +class Friendship_UT extends AbstractSpec { + + def "constructor: 同じプレイヤーIDの関係は作成不可"() { + when: + final now = LocalDateTime.now() + // noinspection GroovyResultOfObjectAllocationIgnored + new Friendship(Faker.uuidv5("p1"), Faker.uuidv5("p1"), now) + + then: + final ex = thrown(IllegalArgumentException) + ex.message == "playerIDs must be different." + } +} diff --git a/testkit/src/main/groovy/net/averak/gsync/testkit/randomizer/SpannerRandomizers.groovy b/testkit/src/main/groovy/net/averak/gsync/testkit/randomizer/SpannerRandomizers.groovy index c8ad846..4cae915 100644 --- a/testkit/src/main/groovy/net/averak/gsync/testkit/randomizer/SpannerRandomizers.groovy +++ b/testkit/src/main/groovy/net/averak/gsync/testkit/randomizer/SpannerRandomizers.groovy @@ -26,6 +26,41 @@ class EchoDtoRandomizer implements IRandomizer { } } +@Component +class FriendSettingMasterDtoRandomizer implements IRandomizer { + + final Class typeToGenerate = FriendSettingMasterDto.class + + @Override + Object getRandomValue() { + final now = LocalDateTime.now() + return new FriendSettingMasterDto( + Faker.uuidv4().toString(), + Faker.integer(1, 100), + Faker.integer(1, 100), + now, + now, + ) + } +} + +@Component +class GameDtoRandomizer implements IRandomizer { + + final Class typeToGenerate = GameDto.class + + @Override + Object getRandomValue() { + final now = LocalDateTime.now() + return new GameDto( + Faker.uuidv4().toString(), + Faker.alphanumeric(), + now, + now, + ) + } +} + @Component class MasterVersionDtoRandomizer implements IRandomizer { @@ -79,6 +114,42 @@ class PlayerDtoRandomizer implements IRandomizer { } } +@Component +class PlayerFriendDtoRandomizer implements IRandomizer { + + final Class typeToGenerate = PlayerFriendDto.class + + @Override + Object getRandomValue() { + final now = LocalDateTime.now() + return new PlayerFriendDto( + Faker.uuidv4().toString(), + Faker.uuidv4().toString(), + Faker.fake(LocalDateTime), + now, + now, + ) + } +} + +@Component +class PlayerFriendRequestDtoRandomizer implements IRandomizer { + + final Class typeToGenerate = PlayerFriendRequestDto.class + + @Override + Object getRandomValue() { + final now = LocalDateTime.now() + return new PlayerFriendRequestDto( + Faker.uuidv4().toString(), + Faker.uuidv4().toString(), + Faker.fake(LocalDateTime), + now, + now, + ) + } +} + @Component class PlayerLoginDtoRandomizer implements IRandomizer { @@ -189,19 +260,3 @@ class RGameOperatorDtoRandomizer implements IRandomizer { } } -@Component -class GameDtoRandomizer implements IRandomizer { - - final Class typeToGenerate = GameDto.class - - @Override - Object getRandomValue() { - final now = LocalDateTime.now() - return new GameDto( - Faker.uuidv4().toString(), - Faker.alphanumeric(), - now, - now, - ) - } -} From c154fa65e91b2703909a5778175b26d647f2911c Mon Sep 17 00:00:00 2001 From: averak Date: Sun, 14 Jan 2024 21:41:44 +0900 Subject: [PATCH 06/13] =?UTF-8?q?refs=20#11=20clang-format=E3=82=92?= =?UTF-8?q?=E5=B0=8E=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .clang-format | 5 +++++ Makefile | 2 ++ 2 files changed, 7 insertions(+) create mode 100644 .clang-format diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..0991993 --- /dev/null +++ b/.clang-format @@ -0,0 +1,5 @@ +Language: Proto +BasedOnStyle: Google +AlignConsecutiveAssignments: true +AlignConsecutiveDeclarations: true +ColumnLimit: 0 diff --git a/Makefile b/Makefile index 4b17376..3b4bbef 100644 --- a/Makefile +++ b/Makefile @@ -16,6 +16,8 @@ format: .PHONY: codegen codegen: + rm -r app/adapter/build/protoGen + ./gradlew generateProto ./gradlew mbGenerate ./gradlew spotlessApply From 95573561a36f72e066db48b78b70bf253c2e4b89 Mon Sep 17 00:00:00 2001 From: averak Date: Thu, 11 Jan 2024 04:14:54 +0900 Subject: [PATCH 07/13] =?UTF-8?q?refs=20#11=20gRPC=E3=81=AE=E4=BE=9D?= =?UTF-8?q?=E5=AD=98=E9=96=A2=E4=BF=82=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/proto/player_api/echo.proto | 18 ++++++++++++++++++ build.gradle.kts | 9 +++++++++ gradle/libs.versions.toml | 1 + src/main/resources/application.yaml | 3 +++ 4 files changed, 31 insertions(+) create mode 100644 app/adapter/src/main/proto/player_api/echo.proto diff --git a/app/adapter/src/main/proto/player_api/echo.proto b/app/adapter/src/main/proto/player_api/echo.proto new file mode 100644 index 0000000..1556cbb --- /dev/null +++ b/app/adapter/src/main/proto/player_api/echo.proto @@ -0,0 +1,18 @@ +syntax = "proto3"; +package net.averak.gsync.player_api; + +import "google/protobuf/timestamp.proto"; + +option java_multiple_files = true; +option java_package = "net.averak.gsync.adapter.handler.grpc.player_api.generated"; + +service Echo { rpc EchoV1(EchoEchoV1.Request) returns (EchoEchoV1.Response); } + +message EchoEchoV1 { + message Request { string message = 1; } + + message Response { + string message = 1; + google.protobuf.Timestamp timestamp = 2; + } +} diff --git a/build.gradle.kts b/build.gradle.kts index ef55b2b..9db42bc 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -10,6 +10,7 @@ plugins { alias(libs.plugins.gradle.git.properties) alias(libs.plugins.spotless) alias(libs.plugins.sonarqube) + alias(libs.plugins.lognet.grpc.spring.boot) groovy jacoco @@ -135,6 +136,10 @@ subprojects { } project(":adapter") { + apply { + plugin(rootProject.libs.plugins.lognet.grpc.spring.boot.get().pluginId) + } + dependencies { implementation(project(":core")) implementation(project(":domain")) @@ -276,4 +281,8 @@ tasks { } } } + + compileKotlin { + dependsOn(":generateProto") + } } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 1a41cbe..f37a350 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -37,6 +37,7 @@ spring-boot-starter-webflux = { module = "org.springframework.boot:spring-boot-s [plugins] flyway = { id = "org.flywaydb.flyway", version.ref = "flyway" } gradle-git-properties = "com.gorylenko.gradle-git-properties:2.4.1" +lognet-grpc-spring-boot = "io.github.lognet.grpc-spring-boot:5.1.5" sonarqube = "org.sonarqube:4.4.1.3373" spotless = "com.diffplug.spotless:6.23.3" springboot = { id = "org.springframework.boot", version.ref = "spring-boot" } diff --git a/src/main/resources/application.yaml b/src/main/resources/application.yaml index 9c89a91..a8d8be4 100644 --- a/src/main/resources/application.yaml +++ b/src/main/resources/application.yaml @@ -41,6 +41,9 @@ server: charset: UTF-8 force: true +grpc: + port: 6565 + mybatis: configuration: map-underscore-to-camel-case: true From 5f3843cef0863d335935cb7190ac308d2abd5459 Mon Sep 17 00:00:00 2001 From: averak Date: Thu, 11 Jan 2024 05:03:20 +0900 Subject: [PATCH 08/13] =?UTF-8?q?refs=20#11=20gRPC=E3=81=AE=E3=83=8F?= =?UTF-8?q?=E3=83=B3=E3=83=89=E3=83=A9=E3=83=BC=E5=B1=A4=E3=82=92=E5=AE=9F?= =?UTF-8?q?=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../GlobalRestControllerAdvice.kt | 2 +- .../HealthCheckController.kt | 5 +- .../{rest => admin_api}/HttpRequestScope.kt | 2 +- .../config/WebMvcConfig.kt | 6 +- .../interceptor/AccessLogInterceptor.kt | 4 +- .../interceptor/ClientVersionInterceptor.kt | 4 +- .../interceptor/GameContextInterceptor.kt | 4 +- .../interceptor/IRequestInterceptor.kt | 2 +- .../interceptor/InterceptorPriority.kt | 2 +- .../adapter/handler/player_api/EchoHandler.kt | 31 +++++++ .../player_api/PlayerStorageHandler.kt | 80 +++++++++++++++++++ .../gsync/adapter/pbconv/EchoConverter.kt | 16 ++++ .../adapter/pbconv/LocalDateTimeConverter.kt | 18 +++++ .../adapter/pbconv/PlayerStorageConverter.kt | 70 ++++++++++++++++ .../src/main/proto/player_api/echo.proto | 14 ++-- .../proto/player_api/player_storage.proto | 44 ++++++++++ .../main/proto/resource/player_storage.proto | 23 ++++++ .../GlobalRestControllerAdvice_IT.groovy | 4 +- .../HealthCheckController_IT.groovy | 5 +- .../ClientVersionInterceptor_UT.groovy | 4 +- .../GameContextInterceptor_UT.groovy | 2 +- .../gsync/domain/model/PlayerStorage.kt | 2 +- build.gradle.kts | 14 +++- src/main/resources/application.yaml | 1 + .../gsync/testkit/api/grpc/GrpcTester.kt | 6 ++ .../gsync/testkit/api/rest/RequestBuilder.kt | 6 +- .../averak/gsync/testkit/api/rest/Response.kt | 2 +- 27 files changed, 335 insertions(+), 38 deletions(-) rename app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/{rest => admin_api}/GlobalRestControllerAdvice.kt (98%) rename app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/{rest => admin_api}/HealthCheckController.kt (86%) rename app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/{rest => admin_api}/HttpRequestScope.kt (98%) rename app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/{rest => admin_api}/config/WebMvcConfig.kt (77%) rename app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/{rest => admin_api}/interceptor/AccessLogInterceptor.kt (93%) rename app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/{rest => admin_api}/interceptor/ClientVersionInterceptor.kt (96%) rename app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/{rest => admin_api}/interceptor/GameContextInterceptor.kt (95%) rename app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/{rest => admin_api}/interceptor/IRequestInterceptor.kt (90%) rename app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/{rest => admin_api}/interceptor/InterceptorPriority.kt (65%) create mode 100644 app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/EchoHandler.kt create mode 100644 app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/PlayerStorageHandler.kt create mode 100644 app/adapter/src/main/kotlin/net/averak/gsync/adapter/pbconv/EchoConverter.kt create mode 100644 app/adapter/src/main/kotlin/net/averak/gsync/adapter/pbconv/LocalDateTimeConverter.kt create mode 100644 app/adapter/src/main/kotlin/net/averak/gsync/adapter/pbconv/PlayerStorageConverter.kt create mode 100644 app/adapter/src/main/proto/player_api/player_storage.proto create mode 100644 app/adapter/src/main/proto/resource/player_storage.proto rename app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/{rest => admin_api}/GlobalRestControllerAdvice_IT.groovy (87%) rename app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/{rest => admin_api}/HealthCheckController_IT.groovy (87%) rename app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/{rest => admin_api}/interceptor/ClientVersionInterceptor_UT.groovy (97%) rename app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/{rest => admin_api}/interceptor/GameContextInterceptor_UT.groovy (98%) create mode 100644 testkit/src/main/kotlin/net/averak/gsync/testkit/api/grpc/GrpcTester.kt diff --git a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/rest/GlobalRestControllerAdvice.kt b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/admin_api/GlobalRestControllerAdvice.kt similarity index 98% rename from app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/rest/GlobalRestControllerAdvice.kt rename to app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/admin_api/GlobalRestControllerAdvice.kt index 094abe3..1ee09f9 100644 --- a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/rest/GlobalRestControllerAdvice.kt +++ b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/admin_api/GlobalRestControllerAdvice.kt @@ -1,4 +1,4 @@ -package net.averak.gsync.adapter.handler.rest +package net.averak.gsync.adapter.handler.admin_api import net.averak.gsync.core.exception.ErrorCode import net.averak.gsync.core.exception.GsyncException diff --git a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/rest/HealthCheckController.kt b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/admin_api/HealthCheckController.kt similarity index 86% rename from app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/rest/HealthCheckController.kt rename to app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/admin_api/HealthCheckController.kt index df6a644..49b03b8 100644 --- a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/rest/HealthCheckController.kt +++ b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/admin_api/HealthCheckController.kt @@ -1,4 +1,4 @@ -package net.averak.gsync.adapter.handler.rest +package net.averak.gsync.adapter.handler.admin_api import net.averak.gsync.usecase.EchoUsecase import org.springframework.http.HttpStatus @@ -23,11 +23,10 @@ class HealthCheckController( val gctx = requestScope.getGameContext() val result = echoUsecase.echo(gctx, "Health Check") - return ResponseEntity.ok(Response(result.message, result.timestamp)) + return ResponseEntity.ok(Response(result.timestamp)) } data class Response( - val message: String, val timestamp: LocalDateTime, ) } diff --git a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/rest/HttpRequestScope.kt b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/admin_api/HttpRequestScope.kt similarity index 98% rename from app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/rest/HttpRequestScope.kt rename to app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/admin_api/HttpRequestScope.kt index 4267b37..9962b95 100644 --- a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/rest/HttpRequestScope.kt +++ b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/admin_api/HttpRequestScope.kt @@ -1,4 +1,4 @@ -package net.averak.gsync.adapter.handler.rest +package net.averak.gsync.adapter.handler.admin_api import jakarta.servlet.http.HttpServletRequest import net.averak.gsync.core.config.Config diff --git a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/rest/config/WebMvcConfig.kt b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/admin_api/config/WebMvcConfig.kt similarity index 77% rename from app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/rest/config/WebMvcConfig.kt rename to app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/admin_api/config/WebMvcConfig.kt index 885a8a6..2d783ff 100644 --- a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/rest/config/WebMvcConfig.kt +++ b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/admin_api/config/WebMvcConfig.kt @@ -1,7 +1,7 @@ -package net.averak.gsync.adapter.handler.rest.config +package net.averak.gsync.adapter.handler.admin_api.config -import net.averak.gsync.adapter.handler.rest.interceptor.IRequestInterceptor -import net.averak.gsync.adapter.handler.rest.interceptor.InterceptorPriority +import net.averak.gsync.adapter.handler.admin_api.interceptor.IRequestInterceptor +import net.averak.gsync.adapter.handler.admin_api.interceptor.InterceptorPriority import org.springframework.context.annotation.Configuration import org.springframework.web.servlet.config.annotation.InterceptorRegistry import org.springframework.web.servlet.config.annotation.WebMvcConfigurer diff --git a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/rest/interceptor/AccessLogInterceptor.kt b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/admin_api/interceptor/AccessLogInterceptor.kt similarity index 93% rename from app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/rest/interceptor/AccessLogInterceptor.kt rename to app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/admin_api/interceptor/AccessLogInterceptor.kt index daf411b..77d2f98 100644 --- a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/rest/interceptor/AccessLogInterceptor.kt +++ b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/admin_api/interceptor/AccessLogInterceptor.kt @@ -1,8 +1,8 @@ -package net.averak.gsync.adapter.handler.rest.interceptor +package net.averak.gsync.adapter.handler.admin_api.interceptor import jakarta.servlet.http.HttpServletRequest import jakarta.servlet.http.HttpServletResponse -import net.averak.gsync.adapter.handler.rest.HttpRequestScope +import net.averak.gsync.adapter.handler.admin_api.HttpRequestScope import net.averak.gsync.core.logger.Logger import org.springframework.http.HttpStatusCode import org.springframework.stereotype.Component diff --git a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/rest/interceptor/ClientVersionInterceptor.kt b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/admin_api/interceptor/ClientVersionInterceptor.kt similarity index 96% rename from app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/rest/interceptor/ClientVersionInterceptor.kt rename to app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/admin_api/interceptor/ClientVersionInterceptor.kt index 5140811..4214f2a 100644 --- a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/rest/interceptor/ClientVersionInterceptor.kt +++ b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/admin_api/interceptor/ClientVersionInterceptor.kt @@ -1,11 +1,11 @@ -package net.averak.gsync.adapter.handler.rest.interceptor +package net.averak.gsync.adapter.handler.admin_api.interceptor import com.google.common.annotations.VisibleForTesting import jakarta.servlet.http.HttpServletRequest import jakarta.servlet.http.HttpServletResponse import net.averak.gsync.adapter.dao.dto.base.RequiredClientVersionExample import net.averak.gsync.adapter.dao.mapper.base.RequiredClientVersionBaseMapper -import net.averak.gsync.adapter.handler.rest.HttpRequestScope +import net.averak.gsync.adapter.handler.admin_api.HttpRequestScope import net.averak.gsync.core.exception.ErrorCode import net.averak.gsync.core.exception.GsyncException import net.averak.gsync.domain.model.Platform diff --git a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/rest/interceptor/GameContextInterceptor.kt b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/admin_api/interceptor/GameContextInterceptor.kt similarity index 95% rename from app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/rest/interceptor/GameContextInterceptor.kt rename to app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/admin_api/interceptor/GameContextInterceptor.kt index b89248c..b1ef20b 100644 --- a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/rest/interceptor/GameContextInterceptor.kt +++ b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/admin_api/interceptor/GameContextInterceptor.kt @@ -1,11 +1,11 @@ -package net.averak.gsync.adapter.handler.rest.interceptor +package net.averak.gsync.adapter.handler.admin_api.interceptor import com.google.common.annotations.VisibleForTesting import jakarta.servlet.http.HttpServletRequest import jakarta.servlet.http.HttpServletResponse import net.averak.gsync.adapter.dao.dto.base.MasterVersionExample import net.averak.gsync.adapter.dao.mapper.base.MasterVersionBaseMapper -import net.averak.gsync.adapter.handler.rest.HttpRequestScope +import net.averak.gsync.adapter.handler.admin_api.HttpRequestScope import net.averak.gsync.core.daterange.Dateline import net.averak.gsync.core.exception.ErrorCode import net.averak.gsync.core.exception.GsyncException diff --git a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/rest/interceptor/IRequestInterceptor.kt b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/admin_api/interceptor/IRequestInterceptor.kt similarity index 90% rename from app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/rest/interceptor/IRequestInterceptor.kt rename to app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/admin_api/interceptor/IRequestInterceptor.kt index a7ae941..2ecfd47 100644 --- a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/rest/interceptor/IRequestInterceptor.kt +++ b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/admin_api/interceptor/IRequestInterceptor.kt @@ -1,4 +1,4 @@ -package net.averak.gsync.adapter.handler.rest.interceptor +package net.averak.gsync.adapter.handler.admin_api.interceptor import jakarta.servlet.http.HttpServletRequest import jakarta.servlet.http.HttpServletResponse diff --git a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/rest/interceptor/InterceptorPriority.kt b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/admin_api/interceptor/InterceptorPriority.kt similarity index 65% rename from app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/rest/interceptor/InterceptorPriority.kt rename to app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/admin_api/interceptor/InterceptorPriority.kt index bff9dd6..03f74d1 100644 --- a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/rest/interceptor/InterceptorPriority.kt +++ b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/admin_api/interceptor/InterceptorPriority.kt @@ -1,4 +1,4 @@ -package net.averak.gsync.adapter.handler.rest.interceptor +package net.averak.gsync.adapter.handler.admin_api.interceptor /** * インターセプターの実行優先度 diff --git a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/EchoHandler.kt b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/EchoHandler.kt new file mode 100644 index 0000000..9965551 --- /dev/null +++ b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/EchoHandler.kt @@ -0,0 +1,31 @@ +package net.averak.gsync.adapter.handler.player_api + +import io.grpc.stub.StreamObserver +import net.averak.gsync.adapter.pbconv.EchoConverter +import net.averak.gsync.core.daterange.Dateline +import net.averak.gsync.core.game_context.GameContext +import net.averak.gsync.schema.protobuf.player_api.EchoEchoV1 +import net.averak.gsync.schema.protobuf.player_api.EchoGrpc +import net.averak.gsync.usecase.EchoUsecase +import org.lognet.springboot.grpc.GRpcService +import java.time.LocalDateTime +import java.util.* + +@GRpcService +class EchoHandler( + private val echoUsecase: EchoUsecase, +) : EchoGrpc.EchoImplBase() { + + override fun echoV1(request: EchoEchoV1.Request, responseObserver: StreamObserver) { + val gctx = GameContext( + masterVersion = UUID.randomUUID(), + idempotencyKey = UUID.randomUUID(), + dateline = Dateline.DEFAULT, + currentTime = LocalDateTime.now(), + ) + val result = echoUsecase.echo(gctx, request.message) + + responseObserver.onNext(EchoConverter.toPb(result)) + responseObserver.onCompleted() + } +} diff --git a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/PlayerStorageHandler.kt b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/PlayerStorageHandler.kt new file mode 100644 index 0000000..a5bd35c --- /dev/null +++ b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/PlayerStorageHandler.kt @@ -0,0 +1,80 @@ +package net.averak.gsync.adapter.handler.player_api + +import io.grpc.stub.StreamObserver +import net.averak.gsync.adapter.pbconv.PlayerStorageConverter +import net.averak.gsync.core.daterange.Dateline +import net.averak.gsync.core.game_context.GameContext +import net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1 +import net.averak.gsync.schema.protobuf.player_api.PlayerStorageGrpc +import net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1 +import net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1 +import net.averak.gsync.usecase.PlayerStorageUsecase +import org.lognet.springboot.grpc.GRpcService +import java.time.LocalDateTime +import java.util.* + +@GRpcService +class PlayerStorageHandler( + private val playerStorageUsecase: PlayerStorageUsecase, +) : PlayerStorageGrpc.PlayerStorageImplBase() { + + override fun searchV1(request: PlayerStorageSearchV1.Request, responseObserver: StreamObserver) { + val gctx = GameContext( + masterVersion = UUID.randomUUID(), + idempotencyKey = UUID.randomUUID(), + dateline = Dateline.DEFAULT, + currentTime = LocalDateTime.now(), + ) + val result = playerStorageUsecase.search( + gctx, + UUID.randomUUID(), + UUID.randomUUID(), + PlayerStorageConverter.fromPb(request.criteria), + ) + + responseObserver.onNext(PlayerStorageConverter.toPb(result)) + responseObserver.onCompleted() + } + + override fun setV1(request: PlayerStorageSetV1.Request, responseObserver: StreamObserver) { + val gctx = GameContext( + masterVersion = UUID.randomUUID(), + idempotencyKey = UUID.randomUUID(), + dateline = Dateline.DEFAULT, + currentTime = LocalDateTime.now(), + ) + val result = playerStorageUsecase.set( + gctx, + UUID.randomUUID(), + UUID.randomUUID(), + PlayerStorageConverter.fromPb(request.entry), + UUID.fromString(request.previousRevision), + ) + + responseObserver.onNext(PlayerStorageConverter.toPb(result)) + responseObserver.onCompleted() + } + + override fun clearV1(request: PlayerStorageClearV1.Request, responseObserver: StreamObserver) { + val gctx = GameContext( + masterVersion = UUID.randomUUID(), + idempotencyKey = UUID.randomUUID(), + dateline = Dateline.DEFAULT, + currentTime = LocalDateTime.now(), + ) + val result = playerStorageUsecase.clear( + gctx, + UUID.randomUUID(), + UUID.randomUUID(), + UUID.fromString(request.previousRevision), + PlayerStorageConverter.fromPb(request.criteria), + ) + + responseObserver.onNext( + PlayerStorageClearV1.Response.newBuilder() + .setNextRevision(result.toString()) + .build(), + ) + super.clearV1(request, responseObserver) + } +} diff --git a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/pbconv/EchoConverter.kt b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/pbconv/EchoConverter.kt new file mode 100644 index 0000000..7086003 --- /dev/null +++ b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/pbconv/EchoConverter.kt @@ -0,0 +1,16 @@ +package net.averak.gsync.adapter.pbconv + +import net.averak.gsync.domain.model.Echo +import net.averak.gsync.schema.protobuf.player_api.EchoEchoV1 + +class EchoConverter { + + companion object { + + fun toPb(echo: Echo): EchoEchoV1.Response { + return EchoEchoV1.Response.newBuilder() + .setTimestamp(LocalDateTimeConverter.toPb(echo.timestamp)) + .setMessage(echo.message).build() + } + } +} diff --git a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/pbconv/LocalDateTimeConverter.kt b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/pbconv/LocalDateTimeConverter.kt new file mode 100644 index 0000000..1faffb2 --- /dev/null +++ b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/pbconv/LocalDateTimeConverter.kt @@ -0,0 +1,18 @@ +package net.averak.gsync.adapter.pbconv + +import com.google.protobuf.Timestamp +import java.time.LocalDateTime +import java.time.ZoneOffset + +class LocalDateTimeConverter { + + companion object { + + fun toPb(localDateTime: LocalDateTime): Timestamp { + return Timestamp.newBuilder() + .setSeconds(localDateTime.atZone(ZoneOffset.systemDefault()).toEpochSecond()) + .setNanos(localDateTime.nano) + .build() + } + } +} diff --git a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/pbconv/PlayerStorageConverter.kt b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/pbconv/PlayerStorageConverter.kt new file mode 100644 index 0000000..612ed84 --- /dev/null +++ b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/pbconv/PlayerStorageConverter.kt @@ -0,0 +1,70 @@ +package net.averak.gsync.adapter.pbconv + +import com.google.protobuf.ByteString +import net.averak.gsync.domain.model.PlayerStorage +import net.averak.gsync.domain.model.PlayerStorageEntry +import net.averak.gsync.domain.repository.IPlayerStorageRepository +import net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1 +import net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1 +import net.averak.gsync.schema.protobuf.resource.player_storage.Criteria +import net.averak.gsync.schema.protobuf.resource.player_storage.Entry +import net.averak.gsync.usecase.PlayerStorageUsecase + +class PlayerStorageConverter { + + companion object { + + fun fromPb(criteria: Criteria): IPlayerStorageRepository.PlayerStorageCriteria { + when (criteria.matchingPattern) { + Criteria.MatchingType.EXACT_MATCH -> { + return IPlayerStorageRepository.PlayerStorageCriteria( + exactMatch = listOf(criteria.pattern), + forwardMatch = listOf(), + ) + } + + Criteria.MatchingType.FORWARD_MATCH -> { + return IPlayerStorageRepository.PlayerStorageCriteria( + exactMatch = listOf(), + forwardMatch = listOf(criteria.pattern), + ) + } + + Criteria.MatchingType.UNRECOGNIZED -> { + throw IllegalArgumentException("MatchingType is not set") + } + + null -> { + throw IllegalArgumentException("MatchingType is not set") + } + } + } + + fun fromPb(entry: Entry): PlayerStorageEntry { + return PlayerStorageEntry( + key = entry.key, + value = entry.value.toByteArray(), + ) + } + + private fun toPb(entry: PlayerStorageEntry): Entry { + return Entry.newBuilder() + .setKey(entry.key) + .setValue(ByteString.copyFrom(entry.value)) + .build() + } + + fun toPb(result: PlayerStorageUsecase.SetResult): PlayerStorageSetV1.Response { + return PlayerStorageSetV1.Response.newBuilder() + .setEntry(toPb(result.entry)) + .setNextRevision(result.revision.toString()) + .build() + } + + fun toPb(playerStorage: PlayerStorage): PlayerStorageSearchV1.Response { + return PlayerStorageSearchV1.Response.newBuilder() + .addAllEntries(playerStorage.entries.map { toPb(it) }) + .build() + } + } +} diff --git a/app/adapter/src/main/proto/player_api/echo.proto b/app/adapter/src/main/proto/player_api/echo.proto index 1556cbb..8ed9bea 100644 --- a/app/adapter/src/main/proto/player_api/echo.proto +++ b/app/adapter/src/main/proto/player_api/echo.proto @@ -1,18 +1,22 @@ syntax = "proto3"; -package net.averak.gsync.player_api; +package gsync.player_api; import "google/protobuf/timestamp.proto"; option java_multiple_files = true; -option java_package = "net.averak.gsync.adapter.handler.grpc.player_api.generated"; +option java_package = "net.averak.gsync.schema.protobuf.player_api"; -service Echo { rpc EchoV1(EchoEchoV1.Request) returns (EchoEchoV1.Response); } +service Echo { + rpc EchoV1(EchoEchoV1.Request) returns (EchoEchoV1.Response); +} message EchoEchoV1 { - message Request { string message = 1; } + message Request { + string message = 1; + } message Response { - string message = 1; + string message = 1; google.protobuf.Timestamp timestamp = 2; } } diff --git a/app/adapter/src/main/proto/player_api/player_storage.proto b/app/adapter/src/main/proto/player_api/player_storage.proto new file mode 100644 index 0000000..38259b0 --- /dev/null +++ b/app/adapter/src/main/proto/player_api/player_storage.proto @@ -0,0 +1,44 @@ +syntax = "proto3"; +package gsync.player_api; + +import "google/protobuf/timestamp.proto"; +import "resource/player_storage.proto"; + +option java_multiple_files = true; +option java_package = "net.averak.gsync.schema.protobuf.player_api"; + +service PlayerStorage { + rpc SearchV1(PlayerStorageSearchV1.Request) returns (PlayerStorageSearchV1.Response); + rpc SetV1(PlayerStorageSetV1.Request) returns (PlayerStorageSetV1.Response); + rpc ClearV1(PlayerStorageClearV1.Request) returns (PlayerStorageClearV1.Response); +} + +message PlayerStorageSearchV1 { + message Request { + resource.player_storage.Criteria criteria = 1; + } + message Response { + repeated resource.player_storage.Entry entries = 1; + } +} + +message PlayerStorageSetV1 { + message Request { + resource.player_storage.Entry entry = 1; + string previous_revision = 2; + } + message Response { + resource.player_storage.Entry entry = 1; + string next_revision = 2; + } +} + +message PlayerStorageClearV1 { + message Request { + resource.player_storage.Criteria criteria = 1; + string previous_revision = 2; + } + message Response { + string next_revision = 1; + } +} diff --git a/app/adapter/src/main/proto/resource/player_storage.proto b/app/adapter/src/main/proto/resource/player_storage.proto new file mode 100644 index 0000000..d791669 --- /dev/null +++ b/app/adapter/src/main/proto/resource/player_storage.proto @@ -0,0 +1,23 @@ +syntax = "proto3"; +package gsync.resource.player_storage; + +import "google/protobuf/timestamp.proto"; + +option java_multiple_files = true; +option java_package = "net.averak.gsync.schema.protobuf.resource.player_storage"; + +message Entry { + string key = 1; + // 最大 100 KiB まで格納できる + bytes value = 2; +} + +message Criteria { + enum MatchingType { + EXACT_MATCH = 0; + FORWARD_MATCH = 1; + } + + string pattern = 1; + MatchingType matching_pattern = 2; +} diff --git a/app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/rest/GlobalRestControllerAdvice_IT.groovy b/app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/admin_api/GlobalRestControllerAdvice_IT.groovy similarity index 87% rename from app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/rest/GlobalRestControllerAdvice_IT.groovy rename to app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/admin_api/GlobalRestControllerAdvice_IT.groovy index a6d3f69..bdffa0a 100644 --- a/app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/rest/GlobalRestControllerAdvice_IT.groovy +++ b/app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/admin_api/GlobalRestControllerAdvice_IT.groovy @@ -1,4 +1,4 @@ -package net.averak.gsync.adapter.handler.rest +package net.averak.gsync.adapter.handler.admin_api import net.averak.gsync.testkit.AbstractDatabaseSpec import net.averak.gsync.testkit.Faker @@ -13,7 +13,7 @@ class GlobalRestControllerAdvice_IT extends AbstractDatabaseSpec { when: final response = this.restTester.get(path) .spoofingMasterVersion(Faker.uuidv5("active")) - .execute() + .invoke() then: response.status == HttpStatus.NOT_FOUND diff --git a/app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/rest/HealthCheckController_IT.groovy b/app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/admin_api/HealthCheckController_IT.groovy similarity index 87% rename from app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/rest/HealthCheckController_IT.groovy rename to app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/admin_api/HealthCheckController_IT.groovy index 3640c0d..99b73b2 100644 --- a/app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/rest/HealthCheckController_IT.groovy +++ b/app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/admin_api/HealthCheckController_IT.groovy @@ -1,4 +1,4 @@ -package net.averak.gsync.adapter.handler.rest +package net.averak.gsync.adapter.handler.admin_api import net.averak.gsync.testkit.AbstractDatabaseSpec import net.averak.gsync.testkit.Assert @@ -21,11 +21,10 @@ class HealthCheckController_IT extends AbstractDatabaseSpec { final response = this.restTester.get(HEALTH_CHECK_PATH) .spoofingMasterVersion(Faker.uuidv5("active")) .spoofingCurrentTime(now) - .execute(HealthCheckController.Response) + .invoke(HealthCheckController.Response) then: response.status == HttpStatus.OK - response.body.message == "Health Check" Assert.timestampIs(response.body.timestamp, now) then: diff --git a/app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/rest/interceptor/ClientVersionInterceptor_UT.groovy b/app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/admin_api/interceptor/ClientVersionInterceptor_UT.groovy similarity index 97% rename from app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/rest/interceptor/ClientVersionInterceptor_UT.groovy rename to app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/admin_api/interceptor/ClientVersionInterceptor_UT.groovy index 901f745..c728dd4 100644 --- a/app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/rest/interceptor/ClientVersionInterceptor_UT.groovy +++ b/app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/admin_api/interceptor/ClientVersionInterceptor_UT.groovy @@ -1,4 +1,4 @@ -package net.averak.gsync.adapter.handler.rest.interceptor +package net.averak.gsync.adapter.handler.admin_api.interceptor import net.averak.gsync.adapter.dao.dto.base.RequiredClientVersionDto import net.averak.gsync.core.exception.ErrorCode @@ -27,7 +27,7 @@ class ClientVersionInterceptor_UT extends AbstractDatabaseSpec { .spoofingMasterVersion(Faker.uuidv5("active")) .clientVersion("v1.0.0") .platform(Platform.IOS) - .execute() + .invoke() then: response.status == HttpStatus.BAD_REQUEST diff --git a/app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/rest/interceptor/GameContextInterceptor_UT.groovy b/app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/admin_api/interceptor/GameContextInterceptor_UT.groovy similarity index 98% rename from app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/rest/interceptor/GameContextInterceptor_UT.groovy rename to app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/admin_api/interceptor/GameContextInterceptor_UT.groovy index 9a20e2d..cd483c7 100644 --- a/app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/rest/interceptor/GameContextInterceptor_UT.groovy +++ b/app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/admin_api/interceptor/GameContextInterceptor_UT.groovy @@ -1,4 +1,4 @@ -package net.averak.gsync.adapter.handler.rest.interceptor +package net.averak.gsync.adapter.handler.admin_api.interceptor import net.averak.gsync.adapter.dao.dto.base.MasterVersionDto import net.averak.gsync.core.exception.ErrorCode diff --git a/app/domain/src/main/kotlin/net/averak/gsync/domain/model/PlayerStorage.kt b/app/domain/src/main/kotlin/net/averak/gsync/domain/model/PlayerStorage.kt index f9244cf..4f172fa 100644 --- a/app/domain/src/main/kotlin/net/averak/gsync/domain/model/PlayerStorage.kt +++ b/app/domain/src/main/kotlin/net/averak/gsync/domain/model/PlayerStorage.kt @@ -5,7 +5,7 @@ import net.averak.gsync.core.exception.GsyncException import java.util.* /** - * プレイヤーデータを格納する汎用的な Key-Value 形式のストレージ + * 任意のプレイヤーデータを格納できる Key-Value ストア * * サーバはストレージの中身について一切感知しないため、クライアントで独自にチート対策を行う必要がある。 * サーバ開発コストを抑えたい場合、もしくは複数端末で同じプレイヤーデータを共有する必要がある場合に利用すること。 diff --git a/build.gradle.kts b/build.gradle.kts index 9db42bc..baf8f27 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -150,6 +150,12 @@ project(":adapter") { implementation(rootProject.libs.spring.boot.starter.data.jpa) implementation(rootProject.libs.mybatis.spring.boot.starter) } + + tasks { + compileKotlin { + dependsOn(":adapter:generateProto") + } + } } project(":core") { @@ -227,6 +233,10 @@ dependencies { implementation(libs.flyway.spanner) } +grpcSpringBoot { + grpcVersion = "1.61.0" +} + flyway { url = "jdbc:cloudspanner://localhost:9010/projects/gsync-sandbox/instances/sandbox/databases/sandbox?autoConfigEmulator=true" cleanDisabled = false @@ -281,8 +291,4 @@ tasks { } } } - - compileKotlin { - dependsOn(":generateProto") - } } diff --git a/src/main/resources/application.yaml b/src/main/resources/application.yaml index a8d8be4..3148c40 100644 --- a/src/main/resources/application.yaml +++ b/src/main/resources/application.yaml @@ -43,6 +43,7 @@ server: grpc: port: 6565 + enable-reflection: ${gsync.debug:false} mybatis: configuration: diff --git a/testkit/src/main/kotlin/net/averak/gsync/testkit/api/grpc/GrpcTester.kt b/testkit/src/main/kotlin/net/averak/gsync/testkit/api/grpc/GrpcTester.kt new file mode 100644 index 0000000..b62d771 --- /dev/null +++ b/testkit/src/main/kotlin/net/averak/gsync/testkit/api/grpc/GrpcTester.kt @@ -0,0 +1,6 @@ +package net.averak.gsync.testkit.api.grpc + +import org.springframework.stereotype.Component + +@Component +class GrpcTester diff --git a/testkit/src/main/kotlin/net/averak/gsync/testkit/api/rest/RequestBuilder.kt b/testkit/src/main/kotlin/net/averak/gsync/testkit/api/rest/RequestBuilder.kt index f41f298..89d4f65 100644 --- a/testkit/src/main/kotlin/net/averak/gsync/testkit/api/rest/RequestBuilder.kt +++ b/testkit/src/main/kotlin/net/averak/gsync/testkit/api/rest/RequestBuilder.kt @@ -1,7 +1,7 @@ package net.averak.gsync.testkit.api.rest -import net.averak.gsync.adapter.handler.rest.GlobalRestControllerAdvice -import net.averak.gsync.adapter.handler.rest.HttpRequestScope +import net.averak.gsync.adapter.handler.admin_api.GlobalRestControllerAdvice +import net.averak.gsync.adapter.handler.admin_api.HttpRequestScope import net.averak.gsync.domain.model.Platform import net.averak.gsync.infrastructure.json.JsonUtils import org.springframework.http.HttpStatus @@ -15,7 +15,7 @@ data class RequestBuilder( private val builder: MockHttpServletRequestBuilder, ) { - fun execute(responseType: Class? = null): Response { + fun invoke(responseType: Class? = null): Response { val result = mockMvc.perform(builder).andReturn() val status = HttpStatus.valueOf(result.response.status) diff --git a/testkit/src/main/kotlin/net/averak/gsync/testkit/api/rest/Response.kt b/testkit/src/main/kotlin/net/averak/gsync/testkit/api/rest/Response.kt index 8073572..547e0a8 100644 --- a/testkit/src/main/kotlin/net/averak/gsync/testkit/api/rest/Response.kt +++ b/testkit/src/main/kotlin/net/averak/gsync/testkit/api/rest/Response.kt @@ -1,6 +1,6 @@ package net.averak.gsync.testkit.api.rest -import net.averak.gsync.adapter.handler.rest.GlobalRestControllerAdvice +import net.averak.gsync.adapter.handler.admin_api.GlobalRestControllerAdvice import org.springframework.http.HttpStatus data class Response( From e052a0a7548cf7a3c878981be0ff0d2c5ba48d48 Mon Sep 17 00:00:00 2001 From: averak Date: Mon, 15 Jan 2024 00:42:11 +0900 Subject: [PATCH 09/13] =?UTF-8?q?refs=20#11=20grpc-spring-boot-starter?= =?UTF-8?q?=E3=81=B8=E3=81=AE=E4=BE=9D=E5=AD=98=E3=82=92=E8=A7=A3=E6=B6=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitattributes | 7 +- .github/workflows/ci.yml | 1 - Makefile | 18 +- .../adapter/handler/player_api/EchoHandler.kt | 7 +- .../player_api/PlayerStorageHandler.kt | 4 +- .../player_api/config/GrpcServerConfig.kt | 27 + .../gsync/adapter/pbconv/EchoConverter.kt | 1 + .../adapter/pbconv/PlayerStorageConverter.kt | 7 +- .../handler/player_api/EchoHandler_IT.groovy | 29 + .../player_api/PlayerStorageHandler_IT.groovy | 75 + .../repository/AbstractRepository_UT.groovy | 6 - .../repository/EchoRepository_UT.groovy | 3 +- .../repository/FriendRepository_UT.groovy | 3 +- .../repository/GameRepository_UT.groovy | 3 +- .../repository/OperatorRepository_UT.groovy | 3 +- .../repository/PlayerRepository_UT.groovy | 3 +- .../PlayerStorageRepository_UT.groovy | 3 +- .../net/averak/gsync/core/config/Config.kt | 11 + .../redis/RedisClient_UT.groovy | 2 + build.gradle.kts | 30 +- gradle/libs.versions.toml | 8 +- .../protobuf/player_api/EchoEchoV1.java | 1634 +++++++++++++++ .../player_api/EchoEchoV1OrBuilder.java | 11 + .../schema/protobuf/player_api/EchoGrpc.java | 274 +++ .../protobuf/player_api/EchoOuterClass.java | 54 + .../player_api/PlayerStorageClearV1.java | 1652 +++++++++++++++ .../PlayerStorageClearV1OrBuilder.java | 11 + .../player_api/PlayerStorageGrpc.java | 411 ++++ .../player_api/PlayerStorageOuterClass.java | 107 + .../player_api/PlayerStorageSearchV1.java | 1708 +++++++++++++++ .../PlayerStorageSearchV1OrBuilder.java | 11 + .../player_api/PlayerStorageSetV1.java | 1860 +++++++++++++++++ .../PlayerStorageSetV1OrBuilder.java | 11 + .../resource/player_storage/Criteria.java | 732 +++++++ .../player_storage/CriteriaOrBuilder.java | 37 + .../resource/player_storage/Entry.java | 605 ++++++ .../player_storage/EntryOrBuilder.java | 35 + .../player_storage/PlayerStorage.java | 46 + .../protobuf}/player_api/echo.proto | 0 .../protobuf}/player_api/player_storage.proto | 1 - .../protobuf}/resource/player_storage.proto | 2 - settings.gradle | 1 + src/main/resources/application.yaml | 8 +- src/test/resources/application-test.yaml | 4 +- .../gsync/testkit/AbstractDatabaseSpec.groovy | 14 +- .../averak/gsync/testkit/AbstractSpec.groovy | 4 + .../gsync/testkit/api/grpc/GrpcTester.kt | 24 +- 47 files changed, 9452 insertions(+), 56 deletions(-) create mode 100644 app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/config/GrpcServerConfig.kt create mode 100644 app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/player_api/EchoHandler_IT.groovy create mode 100644 app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/player_api/PlayerStorageHandler_IT.groovy delete mode 100644 app/adapter/src/test/groovy/net/averak/gsync/adapter/repository/AbstractRepository_UT.groovy create mode 100644 protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/EchoEchoV1.java create mode 100644 protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/EchoEchoV1OrBuilder.java create mode 100644 protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/EchoGrpc.java create mode 100644 protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/EchoOuterClass.java create mode 100644 protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/PlayerStorageClearV1.java create mode 100644 protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/PlayerStorageClearV1OrBuilder.java create mode 100644 protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/PlayerStorageGrpc.java create mode 100644 protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/PlayerStorageOuterClass.java create mode 100644 protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/PlayerStorageSearchV1.java create mode 100644 protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/PlayerStorageSearchV1OrBuilder.java create mode 100644 protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/PlayerStorageSetV1.java create mode 100644 protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/PlayerStorageSetV1OrBuilder.java create mode 100644 protobuf/src/main/java/net/averak/gsync/schema/protobuf/resource/player_storage/Criteria.java create mode 100644 protobuf/src/main/java/net/averak/gsync/schema/protobuf/resource/player_storage/CriteriaOrBuilder.java create mode 100644 protobuf/src/main/java/net/averak/gsync/schema/protobuf/resource/player_storage/Entry.java create mode 100644 protobuf/src/main/java/net/averak/gsync/schema/protobuf/resource/player_storage/EntryOrBuilder.java create mode 100644 protobuf/src/main/java/net/averak/gsync/schema/protobuf/resource/player_storage/PlayerStorage.java rename {app/adapter/src/main/proto => schema/protobuf}/player_api/echo.proto (100%) rename {app/adapter/src/main/proto => schema/protobuf}/player_api/player_storage.proto (96%) rename {app/adapter/src/main/proto => schema/protobuf}/resource/player_storage.proto (91%) diff --git a/.gitattributes b/.gitattributes index b9f96a4..afa81c9 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,3 +1,4 @@ -app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/*.java linguist-generated=true -app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base/*.java linguist-generated=true -src/main/resources/dao/base/*.xml linguist-generated=true +app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base linguist-generated=true +app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base linguist-generated=true +src/main/resources/dao/base linguist-generated=true +protobuf linguist-generated=true diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4bb22df..bf4516e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,7 +23,6 @@ jobs: distribution: corretto java-version: 17 cache: gradle - - uses: google-github-actions/setup-gcloud@v1 - name: cache sonar packages uses: actions/cache@v3 diff --git a/Makefile b/Makefile index 3b4bbef..50427ee 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,6 @@ +PROTOC_GEN_JAVA_VERSION=1.61.0 +PROTOC_GEN_JAVA_PATH=tmp/bin/protoc-gen-grpc-java.exe + .PHONY: build build: ./gradlew bootJar @@ -14,10 +17,21 @@ lint: format: ./gradlew spotlessApply +.PHONY: install-protoc-gen-plugin +install-protoc-gen-plugin: + mkdir -p tmp/bin + wget https://repo1.maven.org/maven2/io/grpc/protoc-gen-grpc-java/${PROTOC_GEN_JAVA_VERSION}/protoc-gen-grpc-java-${PROTOC_GEN_JAVA_VERSION}-osx-x86_64.exe -O ${PROTOC_GEN_JAVA_PATH} + chmod +x ${PROTOC_GEN_JAVA_PATH} + .PHONY: codegen codegen: - rm -r app/adapter/build/protoGen - ./gradlew generateProto + rm -rf protobuf + mkdir -p protobuf/src/main/java + find ./schema/protobuf -name "*.proto" | xargs -I {} protoc \ + -I=schema/protobuf \ + --plugin=protoc-gen-grpc-java=${PROTOC_GEN_JAVA_PATH} \ + --java_out=protobuf/src/main/java \ + --grpc-java_out=protobuf/src/main/java {} ./gradlew mbGenerate ./gradlew spotlessApply diff --git a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/EchoHandler.kt b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/EchoHandler.kt index 9965551..31f6e0f 100644 --- a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/EchoHandler.kt +++ b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/EchoHandler.kt @@ -1,22 +1,21 @@ package net.averak.gsync.adapter.handler.player_api -import io.grpc.stub.StreamObserver import net.averak.gsync.adapter.pbconv.EchoConverter import net.averak.gsync.core.daterange.Dateline import net.averak.gsync.core.game_context.GameContext import net.averak.gsync.schema.protobuf.player_api.EchoEchoV1 import net.averak.gsync.schema.protobuf.player_api.EchoGrpc import net.averak.gsync.usecase.EchoUsecase -import org.lognet.springboot.grpc.GRpcService +import org.springframework.stereotype.Service import java.time.LocalDateTime import java.util.* -@GRpcService +@Service class EchoHandler( private val echoUsecase: EchoUsecase, ) : EchoGrpc.EchoImplBase() { - override fun echoV1(request: EchoEchoV1.Request, responseObserver: StreamObserver) { + override fun echoV1(request: EchoEchoV1.Request, responseObserver: io.grpc.stub.StreamObserver) { val gctx = GameContext( masterVersion = UUID.randomUUID(), idempotencyKey = UUID.randomUUID(), diff --git a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/PlayerStorageHandler.kt b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/PlayerStorageHandler.kt index a5bd35c..e7f5b55 100644 --- a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/PlayerStorageHandler.kt +++ b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/PlayerStorageHandler.kt @@ -9,11 +9,11 @@ import net.averak.gsync.schema.protobuf.player_api.PlayerStorageGrpc import net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1 import net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1 import net.averak.gsync.usecase.PlayerStorageUsecase -import org.lognet.springboot.grpc.GRpcService +import org.springframework.stereotype.Service import java.time.LocalDateTime import java.util.* -@GRpcService +@Service class PlayerStorageHandler( private val playerStorageUsecase: PlayerStorageUsecase, ) : PlayerStorageGrpc.PlayerStorageImplBase() { diff --git a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/config/GrpcServerConfig.kt b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/config/GrpcServerConfig.kt new file mode 100644 index 0000000..62afada --- /dev/null +++ b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/config/GrpcServerConfig.kt @@ -0,0 +1,27 @@ +package net.averak.gsync.adapter.handler.player_api.config + +import io.grpc.BindableService +import io.grpc.ServerBuilder +import io.grpc.protobuf.services.ProtoReflectionService +import jakarta.annotation.PostConstruct +import net.averak.gsync.core.config.Config +import org.springframework.context.annotation.Configuration + +@Configuration +open class GrpcServerConfig( + private val config: Config, + private val handlers: List, +) { + + @PostConstruct + fun start() { + val serverBuilder = ServerBuilder.forPort(config.grpc.port) + if (config.grpc.enableReflection) { + serverBuilder.addService(ProtoReflectionService.newInstance()) + } + handlers.forEach { + serverBuilder.addService(it) + } + serverBuilder.build().start() + } +} diff --git a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/pbconv/EchoConverter.kt b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/pbconv/EchoConverter.kt index 7086003..6a3589c 100644 --- a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/pbconv/EchoConverter.kt +++ b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/pbconv/EchoConverter.kt @@ -7,6 +7,7 @@ class EchoConverter { companion object { + @JvmStatic fun toPb(echo: Echo): EchoEchoV1.Response { return EchoEchoV1.Response.newBuilder() .setTimestamp(LocalDateTimeConverter.toPb(echo.timestamp)) diff --git a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/pbconv/PlayerStorageConverter.kt b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/pbconv/PlayerStorageConverter.kt index 612ed84..55faafa 100644 --- a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/pbconv/PlayerStorageConverter.kt +++ b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/pbconv/PlayerStorageConverter.kt @@ -14,6 +14,7 @@ class PlayerStorageConverter { companion object { + @JvmStatic fun fromPb(criteria: Criteria): IPlayerStorageRepository.PlayerStorageCriteria { when (criteria.matchingPattern) { Criteria.MatchingType.EXACT_MATCH -> { @@ -40,6 +41,7 @@ class PlayerStorageConverter { } } + @JvmStatic fun fromPb(entry: Entry): PlayerStorageEntry { return PlayerStorageEntry( key = entry.key, @@ -47,13 +49,15 @@ class PlayerStorageConverter { ) } - private fun toPb(entry: PlayerStorageEntry): Entry { + @JvmStatic + fun toPb(entry: PlayerStorageEntry): Entry { return Entry.newBuilder() .setKey(entry.key) .setValue(ByteString.copyFrom(entry.value)) .build() } + @JvmStatic fun toPb(result: PlayerStorageUsecase.SetResult): PlayerStorageSetV1.Response { return PlayerStorageSetV1.Response.newBuilder() .setEntry(toPb(result.entry)) @@ -61,6 +65,7 @@ class PlayerStorageConverter { .build() } + @JvmStatic fun toPb(playerStorage: PlayerStorage): PlayerStorageSearchV1.Response { return PlayerStorageSearchV1.Response.newBuilder() .addAllEntries(playerStorage.entries.map { toPb(it) }) diff --git a/app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/player_api/EchoHandler_IT.groovy b/app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/player_api/EchoHandler_IT.groovy new file mode 100644 index 0000000..722bc89 --- /dev/null +++ b/app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/player_api/EchoHandler_IT.groovy @@ -0,0 +1,29 @@ +package net.averak.gsync.adapter.handler.player_api + +import net.averak.gsync.schema.protobuf.player_api.EchoEchoV1 +import net.averak.gsync.testkit.AbstractDatabaseSpec +import net.averak.gsync.testkit.Assert +import net.averak.gsync.testkit.Faker + +import java.time.LocalDateTime + +class EchoHandler_EchoV1_IT extends AbstractDatabaseSpec { + + def "正常系"() { + given: + final now = LocalDateTime.now() + final message = Faker.alphanumeric() + + when: + final request = EchoEchoV1.Request.newBuilder().setMessage(message).build() + final response = grpcTester.echo.echoV1(request) + + then: + response.message == message + with(sql.rows("SELECT * FROM gsync_echo")) { + it.size() == 1 + it[0].message == message + Assert.timestampIs(it[0].timestamp, now) + } + } +} diff --git a/app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/player_api/PlayerStorageHandler_IT.groovy b/app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/player_api/PlayerStorageHandler_IT.groovy new file mode 100644 index 0000000..faee2c2 --- /dev/null +++ b/app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/player_api/PlayerStorageHandler_IT.groovy @@ -0,0 +1,75 @@ +//package net.averak.gsync.adapter.handler.player_api +// +//import net.averak.gsync.adapter.dao.dto.base.PlayerDto +//import net.averak.gsync.adapter.pbconv.PlayerStorageConverter +//import net.averak.gsync.domain.model.PlayerStorageEntry +//import net.averak.gsync.schema.protobuf.player_api.EchoEchoV1 +//import net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1 +//import net.averak.gsync.testkit.AbstractDatabaseSpec +//import net.averak.gsync.testkit.Assert +//import net.averak.gsync.testkit.Faker +//import net.averak.gsync.testkit.Fixture +// +//import java.time.LocalDateTime +// +//class PlayerStorageHandler_SearchV1_IT extends AbstractDatabaseSpec { +// +// def "正常系: パターンにマッチしたエントリを取得できる"() { +// given: +// final now = LocalDateTime.now() +// final message = Faker.alphanumeric() +// +// when: +// final request = EchoEchoV1.Request.newBuilder().setMessage(message).build() +// final response = grpcTester.echo.echoV1(request) +// +// then: +// response.message == message +// with(sql.rows("SELECT * FROM gsync_echo")) { +// it.size() == 1 +// it[0].message == message +// Assert.timestampIs(it[0].timestamp, now) +// } +// } +//} +// +//class PlayerStorageHandler_SetV1_IT extends AbstractDatabaseSpec { +// +// def "正常系: パターンにマッチしたエントリを作成できる"() { +// given: +// Fixture.setup( +// Faker.fake(PlayerDto, [ +// "playerId": Faker.uuidv5("p1").toString(), +// ]), +// ) +// +// when: +// final entry = Faker.fake(PlayerStorageEntry) +// final request = PlayerStorageSetV1.Request.newBuilder() +// .setEntry(PlayerStorageConverter.toPb(entry)) +// .setPreviousRevision("00000000-0000-0000-0000-000000000000") +// .build() +// final response = grpcTester.playerStorage.setV1(request) +// +// then: +// response.entry.key == entry.key +// response.entry.value.toByteArray() == entry.value +// +// with(sql.rows("SELECT * FROM gsync_player_storage_revision")) { +// it.size() == 1 +// it[0].player_storage_revision_id == response.nextRevision +// } +// with(sql.rows("SELECT * FROM gsync_player_storage_entry")) { +// it.size() == 1 +// it[0].key == entry.key +// it[0].value == entry.value +// } +// } +//} +// +//class PlayerStorageHandler_ClearV1_IT extends AbstractDatabaseSpec { +// +// def "正常系: パターンにマッチしたエントリを削除できる"() {} +// +//} +// diff --git a/app/adapter/src/test/groovy/net/averak/gsync/adapter/repository/AbstractRepository_UT.groovy b/app/adapter/src/test/groovy/net/averak/gsync/adapter/repository/AbstractRepository_UT.groovy deleted file mode 100644 index 7147220..0000000 --- a/app/adapter/src/test/groovy/net/averak/gsync/adapter/repository/AbstractRepository_UT.groovy +++ /dev/null @@ -1,6 +0,0 @@ -package net.averak.gsync.adapter.repository - -import net.averak.gsync.testkit.AbstractDatabaseSpec - -abstract class AbstractRepository_UT extends AbstractDatabaseSpec { -} diff --git a/app/adapter/src/test/groovy/net/averak/gsync/adapter/repository/EchoRepository_UT.groovy b/app/adapter/src/test/groovy/net/averak/gsync/adapter/repository/EchoRepository_UT.groovy index 83e2c09..981f2ce 100644 --- a/app/adapter/src/test/groovy/net/averak/gsync/adapter/repository/EchoRepository_UT.groovy +++ b/app/adapter/src/test/groovy/net/averak/gsync/adapter/repository/EchoRepository_UT.groovy @@ -3,6 +3,7 @@ package net.averak.gsync.adapter.repository import net.averak.gsync.adapter.dao.dto.base.EchoDto import net.averak.gsync.core.game_context.GameContext import net.averak.gsync.domain.model.Echo +import net.averak.gsync.testkit.AbstractDatabaseSpec import net.averak.gsync.testkit.Assert import net.averak.gsync.testkit.Faker import net.averak.gsync.testkit.Fixture @@ -11,7 +12,7 @@ import spock.lang.Shared import java.time.LocalDateTime -class EchoRepository_UT extends AbstractRepository_UT { +class EchoRepository_UT extends AbstractDatabaseSpec { @Autowired EchoRepository sut diff --git a/app/adapter/src/test/groovy/net/averak/gsync/adapter/repository/FriendRepository_UT.groovy b/app/adapter/src/test/groovy/net/averak/gsync/adapter/repository/FriendRepository_UT.groovy index 615a0f8..0df5fb8 100644 --- a/app/adapter/src/test/groovy/net/averak/gsync/adapter/repository/FriendRepository_UT.groovy +++ b/app/adapter/src/test/groovy/net/averak/gsync/adapter/repository/FriendRepository_UT.groovy @@ -7,6 +7,7 @@ import net.averak.gsync.domain.model.FriendSetting import net.averak.gsync.domain.model.FriendStatus import net.averak.gsync.domain.model.Friendship import net.averak.gsync.domain.repository.exception.MasterDataNotFoundException +import net.averak.gsync.testkit.AbstractDatabaseSpec import net.averak.gsync.testkit.Assert import net.averak.gsync.testkit.Faker import net.averak.gsync.testkit.Fixture @@ -14,7 +15,7 @@ import org.springframework.beans.factory.annotation.Autowired import java.time.LocalDateTime -class FriendRepository_UT extends AbstractRepository_UT { +class FriendRepository_UT extends AbstractDatabaseSpec { @Autowired FriendRepository sut diff --git a/app/adapter/src/test/groovy/net/averak/gsync/adapter/repository/GameRepository_UT.groovy b/app/adapter/src/test/groovy/net/averak/gsync/adapter/repository/GameRepository_UT.groovy index b8d6741..f42c376 100644 --- a/app/adapter/src/test/groovy/net/averak/gsync/adapter/repository/GameRepository_UT.groovy +++ b/app/adapter/src/test/groovy/net/averak/gsync/adapter/repository/GameRepository_UT.groovy @@ -3,11 +3,12 @@ package net.averak.gsync.adapter.repository import net.averak.gsync.adapter.dao.dto.base.GameDto import net.averak.gsync.core.game_context.GameContext import net.averak.gsync.domain.model.Game +import net.averak.gsync.testkit.AbstractDatabaseSpec import net.averak.gsync.testkit.Faker import net.averak.gsync.testkit.Fixture import org.springframework.beans.factory.annotation.Autowired -class GameRepository_UT extends AbstractRepository_UT { +class GameRepository_UT extends AbstractDatabaseSpec { @Autowired GameRepository sut diff --git a/app/adapter/src/test/groovy/net/averak/gsync/adapter/repository/OperatorRepository_UT.groovy b/app/adapter/src/test/groovy/net/averak/gsync/adapter/repository/OperatorRepository_UT.groovy index 3a3963d..8baadab 100644 --- a/app/adapter/src/test/groovy/net/averak/gsync/adapter/repository/OperatorRepository_UT.groovy +++ b/app/adapter/src/test/groovy/net/averak/gsync/adapter/repository/OperatorRepository_UT.groovy @@ -4,11 +4,12 @@ import net.averak.gsync.adapter.dao.dto.base.OperatorDto import net.averak.gsync.adapter.dao.dto.base.RGameOperatorDto import net.averak.gsync.core.game_context.GameContext import net.averak.gsync.domain.model.Operator +import net.averak.gsync.testkit.AbstractDatabaseSpec import net.averak.gsync.testkit.Faker import net.averak.gsync.testkit.Fixture import org.springframework.beans.factory.annotation.Autowired -class OperatorRepository_UT extends AbstractRepository_UT { +class OperatorRepository_UT extends AbstractDatabaseSpec { @Autowired OperatorRepository sut diff --git a/app/adapter/src/test/groovy/net/averak/gsync/adapter/repository/PlayerRepository_UT.groovy b/app/adapter/src/test/groovy/net/averak/gsync/adapter/repository/PlayerRepository_UT.groovy index f93b009..caebbe8 100644 --- a/app/adapter/src/test/groovy/net/averak/gsync/adapter/repository/PlayerRepository_UT.groovy +++ b/app/adapter/src/test/groovy/net/averak/gsync/adapter/repository/PlayerRepository_UT.groovy @@ -7,6 +7,7 @@ import net.averak.gsync.core.game_context.GameContext import net.averak.gsync.domain.model.Player import net.averak.gsync.domain.model.PlayerLogin import net.averak.gsync.domain.model.PlayerProfile +import net.averak.gsync.testkit.AbstractDatabaseSpec import net.averak.gsync.testkit.Assert import net.averak.gsync.testkit.Faker import net.averak.gsync.testkit.Fixture @@ -15,7 +16,7 @@ import spock.lang.Shared import java.time.LocalDateTime -class PlayerRepository_UT extends AbstractRepository_UT { +class PlayerRepository_UT extends AbstractDatabaseSpec { @Autowired PlayerRepository sut diff --git a/app/adapter/src/test/groovy/net/averak/gsync/adapter/repository/PlayerStorageRepository_UT.groovy b/app/adapter/src/test/groovy/net/averak/gsync/adapter/repository/PlayerStorageRepository_UT.groovy index 98ece4a..20aad1c 100644 --- a/app/adapter/src/test/groovy/net/averak/gsync/adapter/repository/PlayerStorageRepository_UT.groovy +++ b/app/adapter/src/test/groovy/net/averak/gsync/adapter/repository/PlayerStorageRepository_UT.groovy @@ -8,6 +8,7 @@ import net.averak.gsync.domain.model.PlayerStorage import net.averak.gsync.domain.model.PlayerStorageEntry import net.averak.gsync.domain.repository.IPlayerStorageRepository import net.averak.gsync.domain.repository.exception.AlreadyDoneException +import net.averak.gsync.testkit.AbstractDatabaseSpec import net.averak.gsync.testkit.Assert import net.averak.gsync.testkit.Faker import net.averak.gsync.testkit.Fixture @@ -16,7 +17,7 @@ import spock.lang.Shared import java.time.LocalDateTime -class PlayerStorageRepository_UT extends AbstractRepository_UT { +class PlayerStorageRepository_UT extends AbstractDatabaseSpec { @Autowired PlayerStorageRepository sut diff --git a/app/core/src/main/kotlin/net/averak/gsync/core/config/Config.kt b/app/core/src/main/kotlin/net/averak/gsync/core/config/Config.kt index 0d063a2..f505085 100644 --- a/app/core/src/main/kotlin/net/averak/gsync/core/config/Config.kt +++ b/app/core/src/main/kotlin/net/averak/gsync/core/config/Config.kt @@ -11,4 +11,15 @@ open class Config { var version: String = "" var debug: Boolean = false + + lateinit var grpc: Grpc + + @Configuration + @ConfigurationProperties("gsync.grpc") + open class Grpc { + + var port: Int = 0 + + var enableReflection = false + } } diff --git a/app/infrastructure/src/test/groovy/net/averak/gsync/infrastructure/redis/RedisClient_UT.groovy b/app/infrastructure/src/test/groovy/net/averak/gsync/infrastructure/redis/RedisClient_UT.groovy index 523288f..b29f44b 100644 --- a/app/infrastructure/src/test/groovy/net/averak/gsync/infrastructure/redis/RedisClient_UT.groovy +++ b/app/infrastructure/src/test/groovy/net/averak/gsync/infrastructure/redis/RedisClient_UT.groovy @@ -2,7 +2,9 @@ package net.averak.gsync.infrastructure.redis import net.averak.gsync.testkit.AbstractDatabaseSpec import org.springframework.beans.factory.annotation.Autowired +import org.springframework.transaction.annotation.Transactional +@Transactional class RedisClient_UT extends AbstractDatabaseSpec { @Autowired diff --git a/build.gradle.kts b/build.gradle.kts index baf8f27..fc144ac 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -10,7 +10,6 @@ plugins { alias(libs.plugins.gradle.git.properties) alias(libs.plugins.spotless) alias(libs.plugins.sonarqube) - alias(libs.plugins.lognet.grpc.spring.boot) groovy jacoco @@ -91,7 +90,7 @@ allprojects { property("sonar.projectKey", "averak_gsync") property("sonar.organization", "averak") property("sonar.host.url", "https://sonarcloud.io") - property("sonar.exclusions", "testkit/**,**/dto/**,**/mapper/base/**") + property("sonar.exclusions", "protobuf/**,testkit/**,**/dto/**,**/mapper/base/**") } } @@ -136,26 +135,17 @@ subprojects { } project(":adapter") { - apply { - plugin(rootProject.libs.plugins.lognet.grpc.spring.boot.get().pluginId) - } - dependencies { implementation(project(":core")) implementation(project(":domain")) implementation(project(":infrastructure")) implementation(project(":usecase")) + implementation(project(":protobuf")) implementation(rootProject.libs.spring.boot.starter.web) implementation(rootProject.libs.spring.boot.starter.webflux) implementation(rootProject.libs.spring.boot.starter.data.jpa) implementation(rootProject.libs.mybatis.spring.boot.starter) } - - tasks { - compileKotlin { - dependsOn(":adapter:generateProto") - } - } } project(":core") { @@ -199,6 +189,7 @@ project(":testkit") { implementation(project(":domain")) implementation(project(":infrastructure")) implementation(project(":usecase")) + implementation(project(":protobuf")) implementation(rootProject.libs.spring.boot.starter.test) implementation(rootProject.libs.spring.boot.starter.web) implementation(rootProject.libs.spring.boot.starter.webflux) @@ -220,6 +211,17 @@ project(":testkit") { } } +project(":protobuf") { + dependencies { + compileOnly(rootProject.libs.javax.annotation.api) + api(rootProject.libs.io.grpc.netty) + api(rootProject.libs.io.grpc.netty.shaded) + api(rootProject.libs.io.grpc.protobuf) + api(rootProject.libs.io.grpc.services) + api(rootProject.libs.io.grpc.stub) + } +} + dependencies { implementation(project(":adapter")) implementation(project(":core")) @@ -233,10 +235,6 @@ dependencies { implementation(libs.flyway.spanner) } -grpcSpringBoot { - grpcVersion = "1.61.0" -} - flyway { url = "jdbc:cloudspanner://localhost:9010/projects/gsync-sandbox/instances/sandbox/databases/sandbox?autoConfigEmulator=true" cleanDisabled = false diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index f37a350..6e1362c 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -3,6 +3,7 @@ easy-random = "6.2.1" flyway = "10.4.1" groovy = "4.0.7" mybatis-generator = "1.4.2" +grpc = "1.61.0" spock = "2.4-M1-groovy-4.0" spring-boot = "3.2.1" @@ -17,8 +18,14 @@ google-cloud-spanner-spring = "com.google.cloud:spring-cloud-gcp-starter-data-sp groovy = { module = "org.apache.groovy:groovy", version.ref = "groovy" } groovy-sql = { module = "org.apache.groovy:groovy-sql", version.ref = "groovy" } guava = "com.google.guava:guava:33.0.0-jre" +io-grpc-netty = { module = "io.grpc:grpc-netty", version.ref = "grpc" } +io-grpc-netty-shaded = { module = "io.grpc:grpc-netty-shaded", version.ref = "grpc" } +io-grpc-protobuf = { module = "io.grpc:grpc-protobuf", version.ref = "grpc" } +io-grpc-services = { module = "io.grpc:grpc-services", version.ref = "grpc" } +io-grpc-stub = { module = "io.grpc:grpc-stub", version.ref = "grpc" } jackson-datatype-jsr310 = "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.16.1" jackson-module-kotlin = "com.fasterxml.jackson.module:jackson-module-kotlin:2.16.1" +javax-annotation-api = "javax.annotation:javax.annotation-api:1.3.2" logback-classic = "ch.qos.logback:logback-classic:1.4.14" logstash-logback-encoder = "net.logstash.logback:logstash-logback-encoder:7.4" mybatis-generator-core = { module = "org.mybatis.generator:mybatis-generator-core", version.ref = "mybatis-generator" } @@ -37,7 +44,6 @@ spring-boot-starter-webflux = { module = "org.springframework.boot:spring-boot-s [plugins] flyway = { id = "org.flywaydb.flyway", version.ref = "flyway" } gradle-git-properties = "com.gorylenko.gradle-git-properties:2.4.1" -lognet-grpc-spring-boot = "io.github.lognet.grpc-spring-boot:5.1.5" sonarqube = "org.sonarqube:4.4.1.3373" spotless = "com.diffplug.spotless:6.23.3" springboot = { id = "org.springframework.boot", version.ref = "spring-boot" } diff --git a/protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/EchoEchoV1.java b/protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/EchoEchoV1.java new file mode 100644 index 0000000..f0435fc --- /dev/null +++ b/protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/EchoEchoV1.java @@ -0,0 +1,1634 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: player_api/echo.proto + +// Protobuf Java Version: 3.25.1 +package net.averak.gsync.schema.protobuf.player_api; + +/** + * Protobuf type {@code gsync.player_api.EchoEchoV1} + */ +public final class EchoEchoV1 extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:gsync.player_api.EchoEchoV1) + EchoEchoV1OrBuilder { + private static final long serialVersionUID = 0L; + // Use EchoEchoV1.newBuilder() to construct. + private EchoEchoV1(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private EchoEchoV1() { + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new EchoEchoV1(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return net.averak.gsync.schema.protobuf.player_api.EchoOuterClass.internal_static_gsync_player_api_EchoEchoV1_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { + return net.averak.gsync.schema.protobuf.player_api.EchoOuterClass.internal_static_gsync_player_api_EchoEchoV1_fieldAccessorTable + .ensureFieldAccessorsInitialized(net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.class, + net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Builder.class); + } + + public interface RequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:gsync.player_api.EchoEchoV1.Request) + com.google.protobuf.MessageOrBuilder { + + /** + * string message = 1; + * + * @return The message. + */ + java.lang.String getMessage(); + /** + * string message = 1; + * + * @return The bytes for message. + */ + com.google.protobuf.ByteString getMessageBytes(); + } + /** + * Protobuf type {@code gsync.player_api.EchoEchoV1.Request} + */ + public static final class Request extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:gsync.player_api.EchoEchoV1.Request) + RequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use Request.newBuilder() to construct. + private Request(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private Request() { + message_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new Request(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return net.averak.gsync.schema.protobuf.player_api.EchoOuterClass.internal_static_gsync_player_api_EchoEchoV1_Request_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { + return net.averak.gsync.schema.protobuf.player_api.EchoOuterClass.internal_static_gsync_player_api_EchoEchoV1_Request_fieldAccessorTable + .ensureFieldAccessorsInitialized( + net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Request.class, + net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Request.Builder.class); + } + + public static final int MESSAGE_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private volatile java.lang.Object message_ = ""; + /** + * string message = 1; + * + * @return The message. + */ + @java.lang.Override + public java.lang.String getMessage() { + java.lang.Object ref = message_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + message_ = s; + return s; + } + } + /** + * string message = 1; + * + * @return The bytes for message. + */ + @java.lang.Override + public com.google.protobuf.ByteString getMessageBytes() { + java.lang.Object ref = message_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + message_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) + return true; + if (isInitialized == 0) + return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(message_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, message_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) + return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(message_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, message_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Request)) { + return super.equals(obj); + } + net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Request other = (net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Request) obj; + + if (!getMessage().equals(other.getMessage())) + return false; + if (!getUnknownFields().equals(other.getUnknownFields())) + return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + MESSAGE_FIELD_NUMBER; + hash = (53 * hash) + getMessage().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Request parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Request parseFrom(java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Request parseFrom( + com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Request parseFrom( + com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Request parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Request parseFrom(byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Request parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + public static net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Request parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input, extensionRegistry); + } + + public static net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Request parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Request parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input, + extensionRegistry); + } + public static net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Request parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + public static net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Request parseFrom( + com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Request prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code gsync.player_api.EchoEchoV1.Request} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:gsync.player_api.EchoEchoV1.Request) + net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.RequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return net.averak.gsync.schema.protobuf.player_api.EchoOuterClass.internal_static_gsync_player_api_EchoEchoV1_Request_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { + return net.averak.gsync.schema.protobuf.player_api.EchoOuterClass.internal_static_gsync_player_api_EchoEchoV1_Request_fieldAccessorTable + .ensureFieldAccessorsInitialized( + net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Request.class, + net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Request.Builder.class); + } + + // Construct using + // net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Request.newBuilder() + private Builder() { + + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + message_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return net.averak.gsync.schema.protobuf.player_api.EchoOuterClass.internal_static_gsync_player_api_EchoEchoV1_Request_descriptor; + } + + @java.lang.Override + public net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Request getDefaultInstanceForType() { + return net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Request.getDefaultInstance(); + } + + @java.lang.Override + public net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Request build() { + net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Request result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Request buildPartial() { + net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Request result = new net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Request( + this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0(net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Request result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.message_ = message_; + } + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + @java.lang.Override + public Builder setField(com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, int index, + java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Request) { + return mergeFrom((net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Request) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Request other) { + if (other == net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Request.getDefaultInstance()) + return this; + if (!other.getMessage().isEmpty()) { + message_ = other.message_; + bitField0_ |= 0x00000001; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0 : + done = true; + break; + case 10 : { + message_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + default : { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private java.lang.Object message_ = ""; + /** + * string message = 1; + * + * @return The message. + */ + public java.lang.String getMessage() { + java.lang.Object ref = message_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + message_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string message = 1; + * + * @return The bytes for message. + */ + public com.google.protobuf.ByteString getMessageBytes() { + java.lang.Object ref = message_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = com.google.protobuf.ByteString + .copyFromUtf8((java.lang.String) ref); + message_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string message = 1; + * + * @param value + * The message to set. + * @return This builder for chaining. + */ + public Builder setMessage(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + message_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * string message = 1; + * + * @return This builder for chaining. + */ + public Builder clearMessage() { + message_ = getDefaultInstance().getMessage(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * string message = 1; + * + * @param value + * The bytes for message to set. + * @return This builder for chaining. + */ + public Builder setMessageBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + message_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:gsync.player_api.EchoEchoV1.Request) + } + + // @@protoc_insertion_point(class_scope:gsync.player_api.EchoEchoV1.Request) + private static final net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Request DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Request(); + } + + public static net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Request getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Request parsePartialFrom(com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Request getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + public interface ResponseOrBuilder + extends + // @@protoc_insertion_point(interface_extends:gsync.player_api.EchoEchoV1.Response) + com.google.protobuf.MessageOrBuilder { + + /** + * string message = 1; + * + * @return The message. + */ + java.lang.String getMessage(); + /** + * string message = 1; + * + * @return The bytes for message. + */ + com.google.protobuf.ByteString getMessageBytes(); + + /** + * .google.protobuf.Timestamp timestamp = 2; + * + * @return Whether the timestamp field is set. + */ + boolean hasTimestamp(); + /** + * .google.protobuf.Timestamp timestamp = 2; + * + * @return The timestamp. + */ + com.google.protobuf.Timestamp getTimestamp(); + /** + * .google.protobuf.Timestamp timestamp = 2; + */ + com.google.protobuf.TimestampOrBuilder getTimestampOrBuilder(); + } + /** + * Protobuf type {@code gsync.player_api.EchoEchoV1.Response} + */ + public static final class Response extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:gsync.player_api.EchoEchoV1.Response) + ResponseOrBuilder { + private static final long serialVersionUID = 0L; + // Use Response.newBuilder() to construct. + private Response(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private Response() { + message_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new Response(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return net.averak.gsync.schema.protobuf.player_api.EchoOuterClass.internal_static_gsync_player_api_EchoEchoV1_Response_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { + return net.averak.gsync.schema.protobuf.player_api.EchoOuterClass.internal_static_gsync_player_api_EchoEchoV1_Response_fieldAccessorTable + .ensureFieldAccessorsInitialized( + net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Response.class, + net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Response.Builder.class); + } + + private int bitField0_; + public static final int MESSAGE_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private volatile java.lang.Object message_ = ""; + /** + * string message = 1; + * + * @return The message. + */ + @java.lang.Override + public java.lang.String getMessage() { + java.lang.Object ref = message_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + message_ = s; + return s; + } + } + /** + * string message = 1; + * + * @return The bytes for message. + */ + @java.lang.Override + public com.google.protobuf.ByteString getMessageBytes() { + java.lang.Object ref = message_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + message_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int TIMESTAMP_FIELD_NUMBER = 2; + private com.google.protobuf.Timestamp timestamp_; + /** + * .google.protobuf.Timestamp timestamp = 2; + * + * @return Whether the timestamp field is set. + */ + @java.lang.Override + public boolean hasTimestamp() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * .google.protobuf.Timestamp timestamp = 2; + * + * @return The timestamp. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getTimestamp() { + return timestamp_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : timestamp_; + } + /** + * .google.protobuf.Timestamp timestamp = 2; + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getTimestampOrBuilder() { + return timestamp_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : timestamp_; + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) + return true; + if (isInitialized == 0) + return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(message_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, message_); + } + if (((bitField0_ & 0x00000001) != 0)) { + output.writeMessage(2, getTimestamp()); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) + return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(message_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, message_); + } + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getTimestamp()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Response)) { + return super.equals(obj); + } + net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Response other = (net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Response) obj; + + if (!getMessage().equals(other.getMessage())) + return false; + if (hasTimestamp() != other.hasTimestamp()) + return false; + if (hasTimestamp()) { + if (!getTimestamp().equals(other.getTimestamp())) + return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) + return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + MESSAGE_FIELD_NUMBER; + hash = (53 * hash) + getMessage().hashCode(); + if (hasTimestamp()) { + hash = (37 * hash) + TIMESTAMP_FIELD_NUMBER; + hash = (53 * hash) + getTimestamp().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Response parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Response parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Response parseFrom( + com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Response parseFrom( + com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Response parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Response parseFrom(byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Response parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + public static net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Response parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input, extensionRegistry); + } + + public static net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Response parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Response parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input, + extensionRegistry); + } + public static net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Response parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + public static net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Response parseFrom( + com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Response prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code gsync.player_api.EchoEchoV1.Response} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:gsync.player_api.EchoEchoV1.Response) + net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.ResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return net.averak.gsync.schema.protobuf.player_api.EchoOuterClass.internal_static_gsync_player_api_EchoEchoV1_Response_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { + return net.averak.gsync.schema.protobuf.player_api.EchoOuterClass.internal_static_gsync_player_api_EchoEchoV1_Response_fieldAccessorTable + .ensureFieldAccessorsInitialized( + net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Response.class, + net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Response.Builder.class); + } + + // Construct using + // net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Response.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getTimestampFieldBuilder(); + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + message_ = ""; + timestamp_ = null; + if (timestampBuilder_ != null) { + timestampBuilder_.dispose(); + timestampBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return net.averak.gsync.schema.protobuf.player_api.EchoOuterClass.internal_static_gsync_player_api_EchoEchoV1_Response_descriptor; + } + + @java.lang.Override + public net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Response getDefaultInstanceForType() { + return net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Response.getDefaultInstance(); + } + + @java.lang.Override + public net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Response build() { + net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Response result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Response buildPartial() { + net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Response result = new net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Response( + this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0(net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Response result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.message_ = message_; + } + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000002) != 0)) { + result.timestamp_ = timestampBuilder_ == null ? timestamp_ : timestampBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + result.bitField0_ |= to_bitField0_; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + @java.lang.Override + public Builder setField(com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, int index, + java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Response) { + return mergeFrom((net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Response) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Response other) { + if (other == net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Response.getDefaultInstance()) + return this; + if (!other.getMessage().isEmpty()) { + message_ = other.message_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (other.hasTimestamp()) { + mergeTimestamp(other.getTimestamp()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0 : + done = true; + break; + case 10 : { + message_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18 : { + input.readMessage(getTimestampFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000002; + break; + } // case 18 + default : { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private java.lang.Object message_ = ""; + /** + * string message = 1; + * + * @return The message. + */ + public java.lang.String getMessage() { + java.lang.Object ref = message_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + message_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string message = 1; + * + * @return The bytes for message. + */ + public com.google.protobuf.ByteString getMessageBytes() { + java.lang.Object ref = message_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = com.google.protobuf.ByteString + .copyFromUtf8((java.lang.String) ref); + message_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string message = 1; + * + * @param value + * The message to set. + * @return This builder for chaining. + */ + public Builder setMessage(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + message_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * string message = 1; + * + * @return This builder for chaining. + */ + public Builder clearMessage() { + message_ = getDefaultInstance().getMessage(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * string message = 1; + * + * @param value + * The bytes for message to set. + * @return This builder for chaining. + */ + public Builder setMessageBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + message_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private com.google.protobuf.Timestamp timestamp_; + private com.google.protobuf.SingleFieldBuilderV3 timestampBuilder_; + /** + * .google.protobuf.Timestamp timestamp = 2; + * + * @return Whether the timestamp field is set. + */ + public boolean hasTimestamp() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + * .google.protobuf.Timestamp timestamp = 2; + * + * @return The timestamp. + */ + public com.google.protobuf.Timestamp getTimestamp() { + if (timestampBuilder_ == null) { + return timestamp_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : timestamp_; + } else { + return timestampBuilder_.getMessage(); + } + } + /** + * .google.protobuf.Timestamp timestamp = 2; + */ + public Builder setTimestamp(com.google.protobuf.Timestamp value) { + if (timestampBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + timestamp_ = value; + } else { + timestampBuilder_.setMessage(value); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * .google.protobuf.Timestamp timestamp = 2; + */ + public Builder setTimestamp(com.google.protobuf.Timestamp.Builder builderForValue) { + if (timestampBuilder_ == null) { + timestamp_ = builderForValue.build(); + } else { + timestampBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * .google.protobuf.Timestamp timestamp = 2; + */ + public Builder mergeTimestamp(com.google.protobuf.Timestamp value) { + if (timestampBuilder_ == null) { + if (((bitField0_ & 0x00000002) != 0) && timestamp_ != null + && timestamp_ != com.google.protobuf.Timestamp.getDefaultInstance()) { + getTimestampBuilder().mergeFrom(value); + } else { + timestamp_ = value; + } + } else { + timestampBuilder_.mergeFrom(value); + } + if (timestamp_ != null) { + bitField0_ |= 0x00000002; + onChanged(); + } + return this; + } + /** + * .google.protobuf.Timestamp timestamp = 2; + */ + public Builder clearTimestamp() { + bitField0_ = (bitField0_ & ~0x00000002); + timestamp_ = null; + if (timestampBuilder_ != null) { + timestampBuilder_.dispose(); + timestampBuilder_ = null; + } + onChanged(); + return this; + } + /** + * .google.protobuf.Timestamp timestamp = 2; + */ + public com.google.protobuf.Timestamp.Builder getTimestampBuilder() { + bitField0_ |= 0x00000002; + onChanged(); + return getTimestampFieldBuilder().getBuilder(); + } + /** + * .google.protobuf.Timestamp timestamp = 2; + */ + public com.google.protobuf.TimestampOrBuilder getTimestampOrBuilder() { + if (timestampBuilder_ != null) { + return timestampBuilder_.getMessageOrBuilder(); + } else { + return timestamp_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : timestamp_; + } + } + /** + * .google.protobuf.Timestamp timestamp = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3 getTimestampFieldBuilder() { + if (timestampBuilder_ == null) { + timestampBuilder_ = new com.google.protobuf.SingleFieldBuilderV3( + getTimestamp(), getParentForChildren(), isClean()); + timestamp_ = null; + } + return timestampBuilder_; + } + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:gsync.player_api.EchoEchoV1.Response) + } + + // @@protoc_insertion_point(class_scope:gsync.player_api.EchoEchoV1.Response) + private static final net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Response DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Response(); + } + + public static net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Response getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Response parsePartialFrom(com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Response getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) + return true; + if (isInitialized == 0) + return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) + return size; + + size = 0; + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof net.averak.gsync.schema.protobuf.player_api.EchoEchoV1)) { + return super.equals(obj); + } + net.averak.gsync.schema.protobuf.player_api.EchoEchoV1 other = (net.averak.gsync.schema.protobuf.player_api.EchoEchoV1) obj; + + if (!getUnknownFields().equals(other.getUnknownFields())) + return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static net.averak.gsync.schema.protobuf.player_api.EchoEchoV1 parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static net.averak.gsync.schema.protobuf.player_api.EchoEchoV1 parseFrom(java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static net.averak.gsync.schema.protobuf.player_api.EchoEchoV1 parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static net.averak.gsync.schema.protobuf.player_api.EchoEchoV1 parseFrom(com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static net.averak.gsync.schema.protobuf.player_api.EchoEchoV1 parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static net.averak.gsync.schema.protobuf.player_api.EchoEchoV1 parseFrom(byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static net.averak.gsync.schema.protobuf.player_api.EchoEchoV1 parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + public static net.averak.gsync.schema.protobuf.player_api.EchoEchoV1 parseFrom(java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input, extensionRegistry); + } + + public static net.averak.gsync.schema.protobuf.player_api.EchoEchoV1 parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static net.averak.gsync.schema.protobuf.player_api.EchoEchoV1 parseDelimitedFrom(java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static net.averak.gsync.schema.protobuf.player_api.EchoEchoV1 parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + public static net.averak.gsync.schema.protobuf.player_api.EchoEchoV1 parseFrom( + com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(net.averak.gsync.schema.protobuf.player_api.EchoEchoV1 prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code gsync.player_api.EchoEchoV1} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:gsync.player_api.EchoEchoV1) + net.averak.gsync.schema.protobuf.player_api.EchoEchoV1OrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return net.averak.gsync.schema.protobuf.player_api.EchoOuterClass.internal_static_gsync_player_api_EchoEchoV1_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { + return net.averak.gsync.schema.protobuf.player_api.EchoOuterClass.internal_static_gsync_player_api_EchoEchoV1_fieldAccessorTable + .ensureFieldAccessorsInitialized(net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.class, + net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Builder.class); + } + + // Construct using + // net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.newBuilder() + private Builder() { + + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return net.averak.gsync.schema.protobuf.player_api.EchoOuterClass.internal_static_gsync_player_api_EchoEchoV1_descriptor; + } + + @java.lang.Override + public net.averak.gsync.schema.protobuf.player_api.EchoEchoV1 getDefaultInstanceForType() { + return net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.getDefaultInstance(); + } + + @java.lang.Override + public net.averak.gsync.schema.protobuf.player_api.EchoEchoV1 build() { + net.averak.gsync.schema.protobuf.player_api.EchoEchoV1 result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public net.averak.gsync.schema.protobuf.player_api.EchoEchoV1 buildPartial() { + net.averak.gsync.schema.protobuf.player_api.EchoEchoV1 result = new net.averak.gsync.schema.protobuf.player_api.EchoEchoV1( + this); + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + @java.lang.Override + public Builder setField(com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, int index, + java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof net.averak.gsync.schema.protobuf.player_api.EchoEchoV1) { + return mergeFrom((net.averak.gsync.schema.protobuf.player_api.EchoEchoV1) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(net.averak.gsync.schema.protobuf.player_api.EchoEchoV1 other) { + if (other == net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.getDefaultInstance()) + return this; + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0 : + done = true; + break; + default : { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:gsync.player_api.EchoEchoV1) + } + + // @@protoc_insertion_point(class_scope:gsync.player_api.EchoEchoV1) + private static final net.averak.gsync.schema.protobuf.player_api.EchoEchoV1 DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new net.averak.gsync.schema.protobuf.player_api.EchoEchoV1(); + } + + public static net.averak.gsync.schema.protobuf.player_api.EchoEchoV1 getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public EchoEchoV1 parsePartialFrom(com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public net.averak.gsync.schema.protobuf.player_api.EchoEchoV1 getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} diff --git a/protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/EchoEchoV1OrBuilder.java b/protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/EchoEchoV1OrBuilder.java new file mode 100644 index 0000000..784431b --- /dev/null +++ b/protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/EchoEchoV1OrBuilder.java @@ -0,0 +1,11 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: player_api/echo.proto + +// Protobuf Java Version: 3.25.1 +package net.averak.gsync.schema.protobuf.player_api; + +public interface EchoEchoV1OrBuilder + extends + // @@protoc_insertion_point(interface_extends:gsync.player_api.EchoEchoV1) + com.google.protobuf.MessageOrBuilder { +} diff --git a/protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/EchoGrpc.java b/protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/EchoGrpc.java new file mode 100644 index 0000000..b2acf10 --- /dev/null +++ b/protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/EchoGrpc.java @@ -0,0 +1,274 @@ +package net.averak.gsync.schema.protobuf.player_api; + +import static io.grpc.MethodDescriptor.generateFullMethodName; + +/** + */ +@javax.annotation.Generated(value = "by gRPC proto compiler (version 1.61.0)", comments = "Source: player_api/echo.proto") +@io.grpc.stub.annotations.GrpcGenerated +public final class EchoGrpc { + + private EchoGrpc() { + } + + public static final java.lang.String SERVICE_NAME = "gsync.player_api.Echo"; + + // Static method descriptors that strictly reflect the proto. + private static volatile io.grpc.MethodDescriptor getEchoV1Method; + + @io.grpc.stub.annotations.RpcMethod(fullMethodName = SERVICE_NAME + '/' + + "EchoV1", requestType = net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Request.class, responseType = net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Response.class, methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor getEchoV1Method() { + io.grpc.MethodDescriptor getEchoV1Method; + if ((getEchoV1Method = EchoGrpc.getEchoV1Method) == null) { + synchronized (EchoGrpc.class) { + if ((getEchoV1Method = EchoGrpc.getEchoV1Method) == null) { + EchoGrpc.getEchoV1Method = getEchoV1Method = io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "EchoV1")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils + .marshaller(net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Request + .getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils + .marshaller(net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Response + .getDefaultInstance())) + .setSchemaDescriptor(new EchoMethodDescriptorSupplier("EchoV1")).build(); + } + } + } + return getEchoV1Method; + } + + /** + * Creates a new async stub that supports all call types for the service + */ + public static EchoStub newStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public EchoStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new EchoStub(channel, callOptions); + } + }; + return EchoStub.newStub(factory, channel); + } + + /** + * Creates a new blocking-style stub that supports unary and streaming output + * calls on the service + */ + public static EchoBlockingStub newBlockingStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public EchoBlockingStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new EchoBlockingStub(channel, callOptions); + } + }; + return EchoBlockingStub.newStub(factory, channel); + } + + /** + * Creates a new ListenableFuture-style stub that supports unary calls on the + * service + */ + public static EchoFutureStub newFutureStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public EchoFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new EchoFutureStub(channel, callOptions); + } + }; + return EchoFutureStub.newStub(factory, channel); + } + + /** + */ + public interface AsyncService { + + /** + */ + default void echoV1(net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Request request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getEchoV1Method(), responseObserver); + } + } + + /** + * Base class for the server implementation of the service Echo. + */ + public static abstract class EchoImplBase implements io.grpc.BindableService, AsyncService { + + @java.lang.Override + public final io.grpc.ServerServiceDefinition bindService() { + return EchoGrpc.bindService(this); + } + } + + /** + * A stub to allow clients to do asynchronous rpc calls to service Echo. + */ + public static final class EchoStub extends io.grpc.stub.AbstractAsyncStub { + private EchoStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected EchoStub build(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new EchoStub(channel, callOptions); + } + + /** + */ + public void echoV1(net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Request request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall(getChannel().newCall(getEchoV1Method(), getCallOptions()), request, + responseObserver); + } + } + + /** + * A stub to allow clients to do synchronous rpc calls to service Echo. + */ + public static final class EchoBlockingStub extends io.grpc.stub.AbstractBlockingStub { + private EchoBlockingStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected EchoBlockingStub build(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new EchoBlockingStub(channel, callOptions); + } + + /** + */ + public net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Response echoV1( + net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Request request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall(getChannel(), getEchoV1Method(), getCallOptions(), + request); + } + } + + /** + * A stub to allow clients to do ListenableFuture-style rpc calls to service + * Echo. + */ + public static final class EchoFutureStub extends io.grpc.stub.AbstractFutureStub { + private EchoFutureStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected EchoFutureStub build(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new EchoFutureStub(channel, callOptions); + } + + /** + */ + public com.google.common.util.concurrent.ListenableFuture echoV1( + net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Request request) { + return io.grpc.stub.ClientCalls.futureUnaryCall(getChannel().newCall(getEchoV1Method(), getCallOptions()), + request); + } + } + + private static final int METHODID_ECHO_V1 = 0; + + private static final class MethodHandlers + implements + io.grpc.stub.ServerCalls.UnaryMethod, + io.grpc.stub.ServerCalls.ServerStreamingMethod, + io.grpc.stub.ServerCalls.ClientStreamingMethod, + io.grpc.stub.ServerCalls.BidiStreamingMethod { + private final AsyncService serviceImpl; + private final int methodId; + + MethodHandlers(AsyncService serviceImpl, int methodId) { + this.serviceImpl = serviceImpl; + this.methodId = methodId; + } + + @java.lang.Override + @java.lang.SuppressWarnings("unchecked") + public void invoke(Req request, io.grpc.stub.StreamObserver responseObserver) { + switch (methodId) { + case METHODID_ECHO_V1 : + serviceImpl.echoV1((net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Request) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + default : + throw new AssertionError(); + } + } + + @java.lang.Override + @java.lang.SuppressWarnings("unchecked") + public io.grpc.stub.StreamObserver invoke(io.grpc.stub.StreamObserver responseObserver) { + switch (methodId) { + default : + throw new AssertionError(); + } + } + } + + public static final io.grpc.ServerServiceDefinition bindService(AsyncService service) { + return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) + .addMethod(getEchoV1Method(), io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers( + service, METHODID_ECHO_V1))) + .build(); + } + + private static abstract class EchoBaseDescriptorSupplier + implements + io.grpc.protobuf.ProtoFileDescriptorSupplier, + io.grpc.protobuf.ProtoServiceDescriptorSupplier { + EchoBaseDescriptorSupplier() { + } + + @java.lang.Override + public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() { + return net.averak.gsync.schema.protobuf.player_api.EchoOuterClass.getDescriptor(); + } + + @java.lang.Override + public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() { + return getFileDescriptor().findServiceByName("Echo"); + } + } + + private static final class EchoFileDescriptorSupplier extends EchoBaseDescriptorSupplier { + EchoFileDescriptorSupplier() { + } + } + + private static final class EchoMethodDescriptorSupplier extends EchoBaseDescriptorSupplier + implements + io.grpc.protobuf.ProtoMethodDescriptorSupplier { + private final java.lang.String methodName; + + EchoMethodDescriptorSupplier(java.lang.String methodName) { + this.methodName = methodName; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() { + return getServiceDescriptor().findMethodByName(methodName); + } + } + + private static volatile io.grpc.ServiceDescriptor serviceDescriptor; + + public static io.grpc.ServiceDescriptor getServiceDescriptor() { + io.grpc.ServiceDescriptor result = serviceDescriptor; + if (result == null) { + synchronized (EchoGrpc.class) { + result = serviceDescriptor; + if (result == null) { + serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME) + .setSchemaDescriptor(new EchoFileDescriptorSupplier()).addMethod(getEchoV1Method()).build(); + } + } + } + return result; + } +} diff --git a/protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/EchoOuterClass.java b/protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/EchoOuterClass.java new file mode 100644 index 0000000..5fc3c89 --- /dev/null +++ b/protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/EchoOuterClass.java @@ -0,0 +1,54 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: player_api/echo.proto + +// Protobuf Java Version: 3.25.1 +package net.averak.gsync.schema.protobuf.player_api; + +public final class EchoOuterClass { + private EchoOuterClass() { + } + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistryLite registry) { + } + + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions((com.google.protobuf.ExtensionRegistryLite) registry); + } + static final com.google.protobuf.Descriptors.Descriptor internal_static_gsync_player_api_EchoEchoV1_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_gsync_player_api_EchoEchoV1_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor internal_static_gsync_player_api_EchoEchoV1_Request_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_gsync_player_api_EchoEchoV1_Request_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor internal_static_gsync_player_api_EchoEchoV1_Response_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_gsync_player_api_EchoEchoV1_Response_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + return descriptor; + } + private static com.google.protobuf.Descriptors.FileDescriptor descriptor; + static { + java.lang.String[] descriptorData = {"\n\025player_api/echo.proto\022\020gsync.player_ap" + + "i\032\037google/protobuf/timestamp.proto\"t\n\nEc" + + "hoEchoV1\032\032\n\007Request\022\017\n\007message\030\001 \001(\t\032J\n\010" + + "Response\022\017\n\007message\030\001 \001(\t\022-\n\ttimestamp\030\002" + + " \001(\0132\032.google.protobuf.Timestamp2]\n\004Echo" + + "\022U\n\006EchoV1\022$.gsync.player_api.EchoEchoV1" + ".Request\032%.gsync.player_api.EchoEchoV1.R" + + "esponseB/\n+net.averak.gsync.schema.proto" + "buf.player_apiP\001b\006proto3"}; + descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom(descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[]{ + com.google.protobuf.TimestampProto.getDescriptor(),}); + internal_static_gsync_player_api_EchoEchoV1_descriptor = getDescriptor().getMessageTypes().get(0); + internal_static_gsync_player_api_EchoEchoV1_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_gsync_player_api_EchoEchoV1_descriptor, new java.lang.String[]{}); + internal_static_gsync_player_api_EchoEchoV1_Request_descriptor = internal_static_gsync_player_api_EchoEchoV1_descriptor + .getNestedTypes().get(0); + internal_static_gsync_player_api_EchoEchoV1_Request_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_gsync_player_api_EchoEchoV1_Request_descriptor, new java.lang.String[]{"Message",}); + internal_static_gsync_player_api_EchoEchoV1_Response_descriptor = internal_static_gsync_player_api_EchoEchoV1_descriptor + .getNestedTypes().get(1); + internal_static_gsync_player_api_EchoEchoV1_Response_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_gsync_player_api_EchoEchoV1_Response_descriptor, + new java.lang.String[]{"Message", "Timestamp",}); + com.google.protobuf.TimestampProto.getDescriptor(); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/PlayerStorageClearV1.java b/protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/PlayerStorageClearV1.java new file mode 100644 index 0000000..5d81d98 --- /dev/null +++ b/protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/PlayerStorageClearV1.java @@ -0,0 +1,1652 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: player_api/player_storage.proto + +// Protobuf Java Version: 3.25.1 +package net.averak.gsync.schema.protobuf.player_api; + +/** + * Protobuf type {@code gsync.player_api.PlayerStorageClearV1} + */ +public final class PlayerStorageClearV1 extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:gsync.player_api.PlayerStorageClearV1) + PlayerStorageClearV1OrBuilder { + private static final long serialVersionUID = 0L; + // Use PlayerStorageClearV1.newBuilder() to construct. + private PlayerStorageClearV1(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private PlayerStorageClearV1() { + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new PlayerStorageClearV1(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return net.averak.gsync.schema.protobuf.player_api.PlayerStorageOuterClass.internal_static_gsync_player_api_PlayerStorageClearV1_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { + return net.averak.gsync.schema.protobuf.player_api.PlayerStorageOuterClass.internal_static_gsync_player_api_PlayerStorageClearV1_fieldAccessorTable + .ensureFieldAccessorsInitialized(net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.class, + net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Builder.class); + } + + public interface RequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:gsync.player_api.PlayerStorageClearV1.Request) + com.google.protobuf.MessageOrBuilder { + + /** + * .gsync.resource.player_storage.Criteria criteria = 1; + * + * @return Whether the criteria field is set. + */ + boolean hasCriteria(); + /** + * .gsync.resource.player_storage.Criteria criteria = 1; + * + * @return The criteria. + */ + net.averak.gsync.schema.protobuf.resource.player_storage.Criteria getCriteria(); + /** + * .gsync.resource.player_storage.Criteria criteria = 1; + */ + net.averak.gsync.schema.protobuf.resource.player_storage.CriteriaOrBuilder getCriteriaOrBuilder(); + + /** + * string previous_revision = 2; + * + * @return The previousRevision. + */ + java.lang.String getPreviousRevision(); + /** + * string previous_revision = 2; + * + * @return The bytes for previousRevision. + */ + com.google.protobuf.ByteString getPreviousRevisionBytes(); + } + /** + * Protobuf type {@code gsync.player_api.PlayerStorageClearV1.Request} + */ + public static final class Request extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:gsync.player_api.PlayerStorageClearV1.Request) + RequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use Request.newBuilder() to construct. + private Request(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private Request() { + previousRevision_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new Request(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return net.averak.gsync.schema.protobuf.player_api.PlayerStorageOuterClass.internal_static_gsync_player_api_PlayerStorageClearV1_Request_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { + return net.averak.gsync.schema.protobuf.player_api.PlayerStorageOuterClass.internal_static_gsync_player_api_PlayerStorageClearV1_Request_fieldAccessorTable + .ensureFieldAccessorsInitialized( + net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Request.class, + net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Request.Builder.class); + } + + private int bitField0_; + public static final int CRITERIA_FIELD_NUMBER = 1; + private net.averak.gsync.schema.protobuf.resource.player_storage.Criteria criteria_; + /** + * .gsync.resource.player_storage.Criteria criteria = 1; + * + * @return Whether the criteria field is set. + */ + @java.lang.Override + public boolean hasCriteria() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * .gsync.resource.player_storage.Criteria criteria = 1; + * + * @return The criteria. + */ + @java.lang.Override + public net.averak.gsync.schema.protobuf.resource.player_storage.Criteria getCriteria() { + return criteria_ == null + ? net.averak.gsync.schema.protobuf.resource.player_storage.Criteria.getDefaultInstance() + : criteria_; + } + /** + * .gsync.resource.player_storage.Criteria criteria = 1; + */ + @java.lang.Override + public net.averak.gsync.schema.protobuf.resource.player_storage.CriteriaOrBuilder getCriteriaOrBuilder() { + return criteria_ == null + ? net.averak.gsync.schema.protobuf.resource.player_storage.Criteria.getDefaultInstance() + : criteria_; + } + + public static final int PREVIOUS_REVISION_FIELD_NUMBER = 2; + @SuppressWarnings("serial") + private volatile java.lang.Object previousRevision_ = ""; + /** + * string previous_revision = 2; + * + * @return The previousRevision. + */ + @java.lang.Override + public java.lang.String getPreviousRevision() { + java.lang.Object ref = previousRevision_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + previousRevision_ = s; + return s; + } + } + /** + * string previous_revision = 2; + * + * @return The bytes for previousRevision. + */ + @java.lang.Override + public com.google.protobuf.ByteString getPreviousRevisionBytes() { + java.lang.Object ref = previousRevision_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + previousRevision_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) + return true; + if (isInitialized == 0) + return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (((bitField0_ & 0x00000001) != 0)) { + output.writeMessage(1, getCriteria()); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(previousRevision_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, previousRevision_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) + return size; + + size = 0; + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getCriteria()); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(previousRevision_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, previousRevision_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Request)) { + return super.equals(obj); + } + net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Request other = (net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Request) obj; + + if (hasCriteria() != other.hasCriteria()) + return false; + if (hasCriteria()) { + if (!getCriteria().equals(other.getCriteria())) + return false; + } + if (!getPreviousRevision().equals(other.getPreviousRevision())) + return false; + if (!getUnknownFields().equals(other.getUnknownFields())) + return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasCriteria()) { + hash = (37 * hash) + CRITERIA_FIELD_NUMBER; + hash = (53 * hash) + getCriteria().hashCode(); + } + hash = (37 * hash) + PREVIOUS_REVISION_FIELD_NUMBER; + hash = (53 * hash) + getPreviousRevision().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Request parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Request parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Request parseFrom( + com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Request parseFrom( + com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Request parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Request parseFrom(byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Request parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Request parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input, extensionRegistry); + } + + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Request parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Request parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input, + extensionRegistry); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Request parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Request parseFrom( + com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder( + net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Request prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code gsync.player_api.PlayerStorageClearV1.Request} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:gsync.player_api.PlayerStorageClearV1.Request) + net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.RequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return net.averak.gsync.schema.protobuf.player_api.PlayerStorageOuterClass.internal_static_gsync_player_api_PlayerStorageClearV1_Request_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { + return net.averak.gsync.schema.protobuf.player_api.PlayerStorageOuterClass.internal_static_gsync_player_api_PlayerStorageClearV1_Request_fieldAccessorTable + .ensureFieldAccessorsInitialized( + net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Request.class, + net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Request.Builder.class); + } + + // Construct using + // net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Request.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getCriteriaFieldBuilder(); + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + criteria_ = null; + if (criteriaBuilder_ != null) { + criteriaBuilder_.dispose(); + criteriaBuilder_ = null; + } + previousRevision_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return net.averak.gsync.schema.protobuf.player_api.PlayerStorageOuterClass.internal_static_gsync_player_api_PlayerStorageClearV1_Request_descriptor; + } + + @java.lang.Override + public net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Request getDefaultInstanceForType() { + return net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Request.getDefaultInstance(); + } + + @java.lang.Override + public net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Request build() { + net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Request result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Request buildPartial() { + net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Request result = new net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Request( + this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0( + net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Request result) { + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.criteria_ = criteriaBuilder_ == null ? criteria_ : criteriaBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.previousRevision_ = previousRevision_; + } + result.bitField0_ |= to_bitField0_; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + @java.lang.Override + public Builder setField(com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, int index, + java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Request) { + return mergeFrom((net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Request) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Request other) { + if (other == net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Request + .getDefaultInstance()) + return this; + if (other.hasCriteria()) { + mergeCriteria(other.getCriteria()); + } + if (!other.getPreviousRevision().isEmpty()) { + previousRevision_ = other.previousRevision_; + bitField0_ |= 0x00000002; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0 : + done = true; + break; + case 10 : { + input.readMessage(getCriteriaFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18 : { + previousRevision_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + default : { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private net.averak.gsync.schema.protobuf.resource.player_storage.Criteria criteria_; + private com.google.protobuf.SingleFieldBuilderV3 criteriaBuilder_; + /** + * .gsync.resource.player_storage.Criteria criteria = 1; + * + * @return Whether the criteria field is set. + */ + public boolean hasCriteria() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * .gsync.resource.player_storage.Criteria criteria = 1; + * + * @return The criteria. + */ + public net.averak.gsync.schema.protobuf.resource.player_storage.Criteria getCriteria() { + if (criteriaBuilder_ == null) { + return criteria_ == null + ? net.averak.gsync.schema.protobuf.resource.player_storage.Criteria.getDefaultInstance() + : criteria_; + } else { + return criteriaBuilder_.getMessage(); + } + } + /** + * .gsync.resource.player_storage.Criteria criteria = 1; + */ + public Builder setCriteria(net.averak.gsync.schema.protobuf.resource.player_storage.Criteria value) { + if (criteriaBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + criteria_ = value; + } else { + criteriaBuilder_.setMessage(value); + } + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * .gsync.resource.player_storage.Criteria criteria = 1; + */ + public Builder setCriteria( + net.averak.gsync.schema.protobuf.resource.player_storage.Criteria.Builder builderForValue) { + if (criteriaBuilder_ == null) { + criteria_ = builderForValue.build(); + } else { + criteriaBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * .gsync.resource.player_storage.Criteria criteria = 1; + */ + public Builder mergeCriteria(net.averak.gsync.schema.protobuf.resource.player_storage.Criteria value) { + if (criteriaBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0) && criteria_ != null + && criteria_ != net.averak.gsync.schema.protobuf.resource.player_storage.Criteria + .getDefaultInstance()) { + getCriteriaBuilder().mergeFrom(value); + } else { + criteria_ = value; + } + } else { + criteriaBuilder_.mergeFrom(value); + } + if (criteria_ != null) { + bitField0_ |= 0x00000001; + onChanged(); + } + return this; + } + /** + * .gsync.resource.player_storage.Criteria criteria = 1; + */ + public Builder clearCriteria() { + bitField0_ = (bitField0_ & ~0x00000001); + criteria_ = null; + if (criteriaBuilder_ != null) { + criteriaBuilder_.dispose(); + criteriaBuilder_ = null; + } + onChanged(); + return this; + } + /** + * .gsync.resource.player_storage.Criteria criteria = 1; + */ + public net.averak.gsync.schema.protobuf.resource.player_storage.Criteria.Builder getCriteriaBuilder() { + bitField0_ |= 0x00000001; + onChanged(); + return getCriteriaFieldBuilder().getBuilder(); + } + /** + * .gsync.resource.player_storage.Criteria criteria = 1; + */ + public net.averak.gsync.schema.protobuf.resource.player_storage.CriteriaOrBuilder getCriteriaOrBuilder() { + if (criteriaBuilder_ != null) { + return criteriaBuilder_.getMessageOrBuilder(); + } else { + return criteria_ == null + ? net.averak.gsync.schema.protobuf.resource.player_storage.Criteria.getDefaultInstance() + : criteria_; + } + } + /** + * .gsync.resource.player_storage.Criteria criteria = 1; + */ + private com.google.protobuf.SingleFieldBuilderV3 getCriteriaFieldBuilder() { + if (criteriaBuilder_ == null) { + criteriaBuilder_ = new com.google.protobuf.SingleFieldBuilderV3( + getCriteria(), getParentForChildren(), isClean()); + criteria_ = null; + } + return criteriaBuilder_; + } + + private java.lang.Object previousRevision_ = ""; + /** + * string previous_revision = 2; + * + * @return The previousRevision. + */ + public java.lang.String getPreviousRevision() { + java.lang.Object ref = previousRevision_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + previousRevision_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string previous_revision = 2; + * + * @return The bytes for previousRevision. + */ + public com.google.protobuf.ByteString getPreviousRevisionBytes() { + java.lang.Object ref = previousRevision_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = com.google.protobuf.ByteString + .copyFromUtf8((java.lang.String) ref); + previousRevision_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string previous_revision = 2; + * + * @param value + * The previousRevision to set. + * @return This builder for chaining. + */ + public Builder setPreviousRevision(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + previousRevision_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * string previous_revision = 2; + * + * @return This builder for chaining. + */ + public Builder clearPreviousRevision() { + previousRevision_ = getDefaultInstance().getPreviousRevision(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + * string previous_revision = 2; + * + * @param value + * The bytes for previousRevision to set. + * @return This builder for chaining. + */ + public Builder setPreviousRevisionBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + previousRevision_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:gsync.player_api.PlayerStorageClearV1.Request) + } + + // @@protoc_insertion_point(class_scope:gsync.player_api.PlayerStorageClearV1.Request) + private static final net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Request DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Request(); + } + + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Request getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Request parsePartialFrom(com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Request getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + public interface ResponseOrBuilder + extends + // @@protoc_insertion_point(interface_extends:gsync.player_api.PlayerStorageClearV1.Response) + com.google.protobuf.MessageOrBuilder { + + /** + * string next_revision = 1; + * + * @return The nextRevision. + */ + java.lang.String getNextRevision(); + /** + * string next_revision = 1; + * + * @return The bytes for nextRevision. + */ + com.google.protobuf.ByteString getNextRevisionBytes(); + } + /** + * Protobuf type {@code gsync.player_api.PlayerStorageClearV1.Response} + */ + public static final class Response extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:gsync.player_api.PlayerStorageClearV1.Response) + ResponseOrBuilder { + private static final long serialVersionUID = 0L; + // Use Response.newBuilder() to construct. + private Response(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private Response() { + nextRevision_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new Response(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return net.averak.gsync.schema.protobuf.player_api.PlayerStorageOuterClass.internal_static_gsync_player_api_PlayerStorageClearV1_Response_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { + return net.averak.gsync.schema.protobuf.player_api.PlayerStorageOuterClass.internal_static_gsync_player_api_PlayerStorageClearV1_Response_fieldAccessorTable + .ensureFieldAccessorsInitialized( + net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Response.class, + net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Response.Builder.class); + } + + public static final int NEXT_REVISION_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private volatile java.lang.Object nextRevision_ = ""; + /** + * string next_revision = 1; + * + * @return The nextRevision. + */ + @java.lang.Override + public java.lang.String getNextRevision() { + java.lang.Object ref = nextRevision_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + nextRevision_ = s; + return s; + } + } + /** + * string next_revision = 1; + * + * @return The bytes for nextRevision. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNextRevisionBytes() { + java.lang.Object ref = nextRevision_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + nextRevision_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) + return true; + if (isInitialized == 0) + return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(nextRevision_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, nextRevision_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) + return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(nextRevision_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, nextRevision_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Response)) { + return super.equals(obj); + } + net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Response other = (net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Response) obj; + + if (!getNextRevision().equals(other.getNextRevision())) + return false; + if (!getUnknownFields().equals(other.getUnknownFields())) + return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NEXT_REVISION_FIELD_NUMBER; + hash = (53 * hash) + getNextRevision().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Response parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Response parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Response parseFrom( + com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Response parseFrom( + com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Response parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Response parseFrom(byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Response parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Response parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input, extensionRegistry); + } + + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Response parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Response parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input, + extensionRegistry); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Response parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Response parseFrom( + com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder( + net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Response prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code gsync.player_api.PlayerStorageClearV1.Response} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:gsync.player_api.PlayerStorageClearV1.Response) + net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.ResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return net.averak.gsync.schema.protobuf.player_api.PlayerStorageOuterClass.internal_static_gsync_player_api_PlayerStorageClearV1_Response_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { + return net.averak.gsync.schema.protobuf.player_api.PlayerStorageOuterClass.internal_static_gsync_player_api_PlayerStorageClearV1_Response_fieldAccessorTable + .ensureFieldAccessorsInitialized( + net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Response.class, + net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Response.Builder.class); + } + + // Construct using + // net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Response.newBuilder() + private Builder() { + + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + nextRevision_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return net.averak.gsync.schema.protobuf.player_api.PlayerStorageOuterClass.internal_static_gsync_player_api_PlayerStorageClearV1_Response_descriptor; + } + + @java.lang.Override + public net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Response getDefaultInstanceForType() { + return net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Response.getDefaultInstance(); + } + + @java.lang.Override + public net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Response build() { + net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Response result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Response buildPartial() { + net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Response result = new net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Response( + this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0( + net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Response result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.nextRevision_ = nextRevision_; + } + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + @java.lang.Override + public Builder setField(com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, int index, + java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Response) { + return mergeFrom((net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Response) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Response other) { + if (other == net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Response + .getDefaultInstance()) + return this; + if (!other.getNextRevision().isEmpty()) { + nextRevision_ = other.nextRevision_; + bitField0_ |= 0x00000001; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0 : + done = true; + break; + case 10 : { + nextRevision_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + default : { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private java.lang.Object nextRevision_ = ""; + /** + * string next_revision = 1; + * + * @return The nextRevision. + */ + public java.lang.String getNextRevision() { + java.lang.Object ref = nextRevision_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + nextRevision_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string next_revision = 1; + * + * @return The bytes for nextRevision. + */ + public com.google.protobuf.ByteString getNextRevisionBytes() { + java.lang.Object ref = nextRevision_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = com.google.protobuf.ByteString + .copyFromUtf8((java.lang.String) ref); + nextRevision_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string next_revision = 1; + * + * @param value + * The nextRevision to set. + * @return This builder for chaining. + */ + public Builder setNextRevision(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + nextRevision_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * string next_revision = 1; + * + * @return This builder for chaining. + */ + public Builder clearNextRevision() { + nextRevision_ = getDefaultInstance().getNextRevision(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * string next_revision = 1; + * + * @param value + * The bytes for nextRevision to set. + * @return This builder for chaining. + */ + public Builder setNextRevisionBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + nextRevision_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:gsync.player_api.PlayerStorageClearV1.Response) + } + + // @@protoc_insertion_point(class_scope:gsync.player_api.PlayerStorageClearV1.Response) + private static final net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Response DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Response(); + } + + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Response getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Response parsePartialFrom(com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Response getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) + return true; + if (isInitialized == 0) + return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) + return size; + + size = 0; + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1)) { + return super.equals(obj); + } + net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1 other = (net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1) obj; + + if (!getUnknownFields().equals(other.getUnknownFields())) + return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1 parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1 parseFrom(java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1 parseFrom( + com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1 parseFrom( + com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1 parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1 parseFrom(byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1 parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1 parseFrom(java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input, extensionRegistry); + } + + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1 parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1 parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1 parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1 parseFrom( + com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1 prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code gsync.player_api.PlayerStorageClearV1} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:gsync.player_api.PlayerStorageClearV1) + net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1OrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return net.averak.gsync.schema.protobuf.player_api.PlayerStorageOuterClass.internal_static_gsync_player_api_PlayerStorageClearV1_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { + return net.averak.gsync.schema.protobuf.player_api.PlayerStorageOuterClass.internal_static_gsync_player_api_PlayerStorageClearV1_fieldAccessorTable + .ensureFieldAccessorsInitialized( + net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.class, + net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Builder.class); + } + + // Construct using + // net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.newBuilder() + private Builder() { + + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return net.averak.gsync.schema.protobuf.player_api.PlayerStorageOuterClass.internal_static_gsync_player_api_PlayerStorageClearV1_descriptor; + } + + @java.lang.Override + public net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1 getDefaultInstanceForType() { + return net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.getDefaultInstance(); + } + + @java.lang.Override + public net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1 build() { + net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1 result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1 buildPartial() { + net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1 result = new net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1( + this); + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + @java.lang.Override + public Builder setField(com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, int index, + java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1) { + return mergeFrom((net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1 other) { + if (other == net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.getDefaultInstance()) + return this; + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0 : + done = true; + break; + default : { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:gsync.player_api.PlayerStorageClearV1) + } + + // @@protoc_insertion_point(class_scope:gsync.player_api.PlayerStorageClearV1) + private static final net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1 DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1(); + } + + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1 getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public PlayerStorageClearV1 parsePartialFrom(com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1 getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} diff --git a/protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/PlayerStorageClearV1OrBuilder.java b/protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/PlayerStorageClearV1OrBuilder.java new file mode 100644 index 0000000..cd2fcc2 --- /dev/null +++ b/protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/PlayerStorageClearV1OrBuilder.java @@ -0,0 +1,11 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: player_api/player_storage.proto + +// Protobuf Java Version: 3.25.1 +package net.averak.gsync.schema.protobuf.player_api; + +public interface PlayerStorageClearV1OrBuilder + extends + // @@protoc_insertion_point(interface_extends:gsync.player_api.PlayerStorageClearV1) + com.google.protobuf.MessageOrBuilder { +} diff --git a/protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/PlayerStorageGrpc.java b/protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/PlayerStorageGrpc.java new file mode 100644 index 0000000..39cc33a --- /dev/null +++ b/protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/PlayerStorageGrpc.java @@ -0,0 +1,411 @@ +package net.averak.gsync.schema.protobuf.player_api; + +import static io.grpc.MethodDescriptor.generateFullMethodName; + +/** + */ +@javax.annotation.Generated(value = "by gRPC proto compiler (version 1.61.0)", comments = "Source: player_api/player_storage.proto") +@io.grpc.stub.annotations.GrpcGenerated +public final class PlayerStorageGrpc { + + private PlayerStorageGrpc() { + } + + public static final java.lang.String SERVICE_NAME = "gsync.player_api.PlayerStorage"; + + // Static method descriptors that strictly reflect the proto. + private static volatile io.grpc.MethodDescriptor getSearchV1Method; + + @io.grpc.stub.annotations.RpcMethod(fullMethodName = SERVICE_NAME + '/' + + "SearchV1", requestType = net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Request.class, responseType = net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Response.class, methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor getSearchV1Method() { + io.grpc.MethodDescriptor getSearchV1Method; + if ((getSearchV1Method = PlayerStorageGrpc.getSearchV1Method) == null) { + synchronized (PlayerStorageGrpc.class) { + if ((getSearchV1Method = PlayerStorageGrpc.getSearchV1Method) == null) { + PlayerStorageGrpc.getSearchV1Method = getSearchV1Method = io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "SearchV1")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Request + .getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Response + .getDefaultInstance())) + .setSchemaDescriptor(new PlayerStorageMethodDescriptorSupplier("SearchV1")).build(); + } + } + } + return getSearchV1Method; + } + + private static volatile io.grpc.MethodDescriptor getSetV1Method; + + @io.grpc.stub.annotations.RpcMethod(fullMethodName = SERVICE_NAME + '/' + + "SetV1", requestType = net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Request.class, responseType = net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Response.class, methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor getSetV1Method() { + io.grpc.MethodDescriptor getSetV1Method; + if ((getSetV1Method = PlayerStorageGrpc.getSetV1Method) == null) { + synchronized (PlayerStorageGrpc.class) { + if ((getSetV1Method = PlayerStorageGrpc.getSetV1Method) == null) { + PlayerStorageGrpc.getSetV1Method = getSetV1Method = io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "SetV1")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils + .marshaller(net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Request + .getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils + .marshaller(net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Response + .getDefaultInstance())) + .setSchemaDescriptor(new PlayerStorageMethodDescriptorSupplier("SetV1")).build(); + } + } + } + return getSetV1Method; + } + + private static volatile io.grpc.MethodDescriptor getClearV1Method; + + @io.grpc.stub.annotations.RpcMethod(fullMethodName = SERVICE_NAME + '/' + + "ClearV1", requestType = net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Request.class, responseType = net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Response.class, methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor getClearV1Method() { + io.grpc.MethodDescriptor getClearV1Method; + if ((getClearV1Method = PlayerStorageGrpc.getClearV1Method) == null) { + synchronized (PlayerStorageGrpc.class) { + if ((getClearV1Method = PlayerStorageGrpc.getClearV1Method) == null) { + PlayerStorageGrpc.getClearV1Method = getClearV1Method = io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "ClearV1")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils + .marshaller(net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Request + .getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Response + .getDefaultInstance())) + .setSchemaDescriptor(new PlayerStorageMethodDescriptorSupplier("ClearV1")).build(); + } + } + } + return getClearV1Method; + } + + /** + * Creates a new async stub that supports all call types for the service + */ + public static PlayerStorageStub newStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public PlayerStorageStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new PlayerStorageStub(channel, callOptions); + } + }; + return PlayerStorageStub.newStub(factory, channel); + } + + /** + * Creates a new blocking-style stub that supports unary and streaming output + * calls on the service + */ + public static PlayerStorageBlockingStub newBlockingStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public PlayerStorageBlockingStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new PlayerStorageBlockingStub(channel, callOptions); + } + }; + return PlayerStorageBlockingStub.newStub(factory, channel); + } + + /** + * Creates a new ListenableFuture-style stub that supports unary calls on the + * service + */ + public static PlayerStorageFutureStub newFutureStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public PlayerStorageFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new PlayerStorageFutureStub(channel, callOptions); + } + }; + return PlayerStorageFutureStub.newStub(factory, channel); + } + + /** + */ + public interface AsyncService { + + /** + */ + default void searchV1(net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Request request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getSearchV1Method(), responseObserver); + } + + /** + */ + default void setV1(net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Request request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getSetV1Method(), responseObserver); + } + + /** + */ + default void clearV1(net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Request request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getClearV1Method(), responseObserver); + } + } + + /** + * Base class for the server implementation of the service PlayerStorage. + */ + public static abstract class PlayerStorageImplBase implements io.grpc.BindableService, AsyncService { + + @java.lang.Override + public final io.grpc.ServerServiceDefinition bindService() { + return PlayerStorageGrpc.bindService(this); + } + } + + /** + * A stub to allow clients to do asynchronous rpc calls to service + * PlayerStorage. + */ + public static final class PlayerStorageStub extends io.grpc.stub.AbstractAsyncStub { + private PlayerStorageStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected PlayerStorageStub build(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new PlayerStorageStub(channel, callOptions); + } + + /** + */ + public void searchV1(net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Request request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall(getChannel().newCall(getSearchV1Method(), getCallOptions()), + request, responseObserver); + } + + /** + */ + public void setV1(net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Request request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall(getChannel().newCall(getSetV1Method(), getCallOptions()), request, + responseObserver); + } + + /** + */ + public void clearV1(net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Request request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall(getChannel().newCall(getClearV1Method(), getCallOptions()), request, + responseObserver); + } + } + + /** + * A stub to allow clients to do synchronous rpc calls to service PlayerStorage. + */ + public static final class PlayerStorageBlockingStub + extends + io.grpc.stub.AbstractBlockingStub { + private PlayerStorageBlockingStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected PlayerStorageBlockingStub build(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new PlayerStorageBlockingStub(channel, callOptions); + } + + /** + */ + public net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Response searchV1( + net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Request request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall(getChannel(), getSearchV1Method(), getCallOptions(), + request); + } + + /** + */ + public net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Response setV1( + net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Request request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall(getChannel(), getSetV1Method(), getCallOptions(), + request); + } + + /** + */ + public net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Response clearV1( + net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Request request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall(getChannel(), getClearV1Method(), getCallOptions(), + request); + } + } + + /** + * A stub to allow clients to do ListenableFuture-style rpc calls to service + * PlayerStorage. + */ + public static final class PlayerStorageFutureStub extends io.grpc.stub.AbstractFutureStub { + private PlayerStorageFutureStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected PlayerStorageFutureStub build(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new PlayerStorageFutureStub(channel, callOptions); + } + + /** + */ + public com.google.common.util.concurrent.ListenableFuture searchV1( + net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Request request) { + return io.grpc.stub.ClientCalls.futureUnaryCall(getChannel().newCall(getSearchV1Method(), getCallOptions()), + request); + } + + /** + */ + public com.google.common.util.concurrent.ListenableFuture setV1( + net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Request request) { + return io.grpc.stub.ClientCalls.futureUnaryCall(getChannel().newCall(getSetV1Method(), getCallOptions()), + request); + } + + /** + */ + public com.google.common.util.concurrent.ListenableFuture clearV1( + net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Request request) { + return io.grpc.stub.ClientCalls.futureUnaryCall(getChannel().newCall(getClearV1Method(), getCallOptions()), + request); + } + } + + private static final int METHODID_SEARCH_V1 = 0; + private static final int METHODID_SET_V1 = 1; + private static final int METHODID_CLEAR_V1 = 2; + + private static final class MethodHandlers + implements + io.grpc.stub.ServerCalls.UnaryMethod, + io.grpc.stub.ServerCalls.ServerStreamingMethod, + io.grpc.stub.ServerCalls.ClientStreamingMethod, + io.grpc.stub.ServerCalls.BidiStreamingMethod { + private final AsyncService serviceImpl; + private final int methodId; + + MethodHandlers(AsyncService serviceImpl, int methodId) { + this.serviceImpl = serviceImpl; + this.methodId = methodId; + } + + @java.lang.Override + @java.lang.SuppressWarnings("unchecked") + public void invoke(Req request, io.grpc.stub.StreamObserver responseObserver) { + switch (methodId) { + case METHODID_SEARCH_V1 : + serviceImpl.searchV1( + (net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Request) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_SET_V1 : + serviceImpl.setV1((net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Request) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_CLEAR_V1 : + serviceImpl.clearV1( + (net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Request) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + default : + throw new AssertionError(); + } + } + + @java.lang.Override + @java.lang.SuppressWarnings("unchecked") + public io.grpc.stub.StreamObserver invoke(io.grpc.stub.StreamObserver responseObserver) { + switch (methodId) { + default : + throw new AssertionError(); + } + } + } + + public static final io.grpc.ServerServiceDefinition bindService(AsyncService service) { + return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) + .addMethod(getSearchV1Method(), io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers( + service, METHODID_SEARCH_V1))) + .addMethod(getSetV1Method(), io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers( + service, METHODID_SET_V1))) + .addMethod(getClearV1Method(), io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers( + service, METHODID_CLEAR_V1))) + .build(); + } + + private static abstract class PlayerStorageBaseDescriptorSupplier + implements + io.grpc.protobuf.ProtoFileDescriptorSupplier, + io.grpc.protobuf.ProtoServiceDescriptorSupplier { + PlayerStorageBaseDescriptorSupplier() { + } + + @java.lang.Override + public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() { + return net.averak.gsync.schema.protobuf.player_api.PlayerStorageOuterClass.getDescriptor(); + } + + @java.lang.Override + public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() { + return getFileDescriptor().findServiceByName("PlayerStorage"); + } + } + + private static final class PlayerStorageFileDescriptorSupplier extends PlayerStorageBaseDescriptorSupplier { + PlayerStorageFileDescriptorSupplier() { + } + } + + private static final class PlayerStorageMethodDescriptorSupplier extends PlayerStorageBaseDescriptorSupplier + implements + io.grpc.protobuf.ProtoMethodDescriptorSupplier { + private final java.lang.String methodName; + + PlayerStorageMethodDescriptorSupplier(java.lang.String methodName) { + this.methodName = methodName; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() { + return getServiceDescriptor().findMethodByName(methodName); + } + } + + private static volatile io.grpc.ServiceDescriptor serviceDescriptor; + + public static io.grpc.ServiceDescriptor getServiceDescriptor() { + io.grpc.ServiceDescriptor result = serviceDescriptor; + if (result == null) { + synchronized (PlayerStorageGrpc.class) { + result = serviceDescriptor; + if (result == null) { + serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME) + .setSchemaDescriptor(new PlayerStorageFileDescriptorSupplier()) + .addMethod(getSearchV1Method()).addMethod(getSetV1Method()).addMethod(getClearV1Method()) + .build(); + } + } + } + return result; + } +} diff --git a/protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/PlayerStorageOuterClass.java b/protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/PlayerStorageOuterClass.java new file mode 100644 index 0000000..75ea527 --- /dev/null +++ b/protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/PlayerStorageOuterClass.java @@ -0,0 +1,107 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: player_api/player_storage.proto + +// Protobuf Java Version: 3.25.1 +package net.averak.gsync.schema.protobuf.player_api; + +public final class PlayerStorageOuterClass { + private PlayerStorageOuterClass() { + } + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistryLite registry) { + } + + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions((com.google.protobuf.ExtensionRegistryLite) registry); + } + static final com.google.protobuf.Descriptors.Descriptor internal_static_gsync_player_api_PlayerStorageSearchV1_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_gsync_player_api_PlayerStorageSearchV1_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor internal_static_gsync_player_api_PlayerStorageSearchV1_Request_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_gsync_player_api_PlayerStorageSearchV1_Request_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor internal_static_gsync_player_api_PlayerStorageSearchV1_Response_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_gsync_player_api_PlayerStorageSearchV1_Response_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor internal_static_gsync_player_api_PlayerStorageSetV1_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_gsync_player_api_PlayerStorageSetV1_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor internal_static_gsync_player_api_PlayerStorageSetV1_Request_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_gsync_player_api_PlayerStorageSetV1_Request_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor internal_static_gsync_player_api_PlayerStorageSetV1_Response_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_gsync_player_api_PlayerStorageSetV1_Response_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor internal_static_gsync_player_api_PlayerStorageClearV1_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_gsync_player_api_PlayerStorageClearV1_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor internal_static_gsync_player_api_PlayerStorageClearV1_Request_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_gsync_player_api_PlayerStorageClearV1_Request_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor internal_static_gsync_player_api_PlayerStorageClearV1_Response_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_gsync_player_api_PlayerStorageClearV1_Response_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + return descriptor; + } + private static com.google.protobuf.Descriptors.FileDescriptor descriptor; + static { + java.lang.String[] descriptorData = {"\n\037player_api/player_storage.proto\022\020gsync" + + ".player_api\032\035resource/player_storage.pro" + + "to\"\240\001\n\025PlayerStorageSearchV1\032D\n\007Request\022" + + "9\n\010criteria\030\001 \001(\0132\'.gsync.resource.playe" + + "r_storage.Criteria\032A\n\010Response\0225\n\007entrie" + + "s\030\001 \003(\0132$.gsync.resource.player_storage." + + "Entry\"\307\001\n\022PlayerStorageSetV1\032Y\n\007Request\022" + + "3\n\005entry\030\001 \001(\0132$.gsync.resource.player_s" + + "torage.Entry\022\031\n\021previous_revision\030\002 \001(\t\032" + + "V\n\010Response\0223\n\005entry\030\001 \001(\0132$.gsync.resou" + + "rce.player_storage.Entry\022\025\n\rnext_revisio" + + "n\030\002 \001(\t\"\232\001\n\024PlayerStorageClearV1\032_\n\007Requ" + + "est\0229\n\010criteria\030\001 \001(\0132\'.gsync.resource.p" + + "layer_storage.Criteria\022\031\n\021previous_revis" + + "ion\030\002 \001(\t\032!\n\010Response\022\025\n\rnext_revision\030\001" + + " \001(\t2\320\002\n\rPlayerStorage\022m\n\010SearchV1\022/.gsy" + + "nc.player_api.PlayerStorageSearchV1.Requ" + "est\0320.gsync.player_api.PlayerStorageSear" + + "chV1.Response\022d\n\005SetV1\022,.gsync.player_ap" + "i.PlayerStorageSetV1.Request\032-.gsync.pla" + + "yer_api.PlayerStorageSetV1.Response\022j\n\007C" + "learV1\022..gsync.player_api.PlayerStorageC" + + "learV1.Request\032/.gsync.player_api.Player" + "StorageClearV1.ResponseB/\n+net.averak.gs" + + "ync.schema.protobuf.player_apiP\001b\006proto3"}; + descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom(descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[]{ + net.averak.gsync.schema.protobuf.resource.player_storage.PlayerStorage.getDescriptor(),}); + internal_static_gsync_player_api_PlayerStorageSearchV1_descriptor = getDescriptor().getMessageTypes().get(0); + internal_static_gsync_player_api_PlayerStorageSearchV1_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_gsync_player_api_PlayerStorageSearchV1_descriptor, new java.lang.String[]{}); + internal_static_gsync_player_api_PlayerStorageSearchV1_Request_descriptor = internal_static_gsync_player_api_PlayerStorageSearchV1_descriptor + .getNestedTypes().get(0); + internal_static_gsync_player_api_PlayerStorageSearchV1_Request_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_gsync_player_api_PlayerStorageSearchV1_Request_descriptor, + new java.lang.String[]{"Criteria",}); + internal_static_gsync_player_api_PlayerStorageSearchV1_Response_descriptor = internal_static_gsync_player_api_PlayerStorageSearchV1_descriptor + .getNestedTypes().get(1); + internal_static_gsync_player_api_PlayerStorageSearchV1_Response_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_gsync_player_api_PlayerStorageSearchV1_Response_descriptor, + new java.lang.String[]{"Entries",}); + internal_static_gsync_player_api_PlayerStorageSetV1_descriptor = getDescriptor().getMessageTypes().get(1); + internal_static_gsync_player_api_PlayerStorageSetV1_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_gsync_player_api_PlayerStorageSetV1_descriptor, new java.lang.String[]{}); + internal_static_gsync_player_api_PlayerStorageSetV1_Request_descriptor = internal_static_gsync_player_api_PlayerStorageSetV1_descriptor + .getNestedTypes().get(0); + internal_static_gsync_player_api_PlayerStorageSetV1_Request_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_gsync_player_api_PlayerStorageSetV1_Request_descriptor, + new java.lang.String[]{"Entry", "PreviousRevision",}); + internal_static_gsync_player_api_PlayerStorageSetV1_Response_descriptor = internal_static_gsync_player_api_PlayerStorageSetV1_descriptor + .getNestedTypes().get(1); + internal_static_gsync_player_api_PlayerStorageSetV1_Response_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_gsync_player_api_PlayerStorageSetV1_Response_descriptor, + new java.lang.String[]{"Entry", "NextRevision",}); + internal_static_gsync_player_api_PlayerStorageClearV1_descriptor = getDescriptor().getMessageTypes().get(2); + internal_static_gsync_player_api_PlayerStorageClearV1_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_gsync_player_api_PlayerStorageClearV1_descriptor, new java.lang.String[]{}); + internal_static_gsync_player_api_PlayerStorageClearV1_Request_descriptor = internal_static_gsync_player_api_PlayerStorageClearV1_descriptor + .getNestedTypes().get(0); + internal_static_gsync_player_api_PlayerStorageClearV1_Request_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_gsync_player_api_PlayerStorageClearV1_Request_descriptor, + new java.lang.String[]{"Criteria", "PreviousRevision",}); + internal_static_gsync_player_api_PlayerStorageClearV1_Response_descriptor = internal_static_gsync_player_api_PlayerStorageClearV1_descriptor + .getNestedTypes().get(1); + internal_static_gsync_player_api_PlayerStorageClearV1_Response_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_gsync_player_api_PlayerStorageClearV1_Response_descriptor, + new java.lang.String[]{"NextRevision",}); + net.averak.gsync.schema.protobuf.resource.player_storage.PlayerStorage.getDescriptor(); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/PlayerStorageSearchV1.java b/protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/PlayerStorageSearchV1.java new file mode 100644 index 0000000..59f8e44 --- /dev/null +++ b/protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/PlayerStorageSearchV1.java @@ -0,0 +1,1708 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: player_api/player_storage.proto + +// Protobuf Java Version: 3.25.1 +package net.averak.gsync.schema.protobuf.player_api; + +/** + * Protobuf type {@code gsync.player_api.PlayerStorageSearchV1} + */ +public final class PlayerStorageSearchV1 extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:gsync.player_api.PlayerStorageSearchV1) + PlayerStorageSearchV1OrBuilder { + private static final long serialVersionUID = 0L; + // Use PlayerStorageSearchV1.newBuilder() to construct. + private PlayerStorageSearchV1(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private PlayerStorageSearchV1() { + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new PlayerStorageSearchV1(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return net.averak.gsync.schema.protobuf.player_api.PlayerStorageOuterClass.internal_static_gsync_player_api_PlayerStorageSearchV1_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { + return net.averak.gsync.schema.protobuf.player_api.PlayerStorageOuterClass.internal_static_gsync_player_api_PlayerStorageSearchV1_fieldAccessorTable + .ensureFieldAccessorsInitialized( + net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.class, + net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Builder.class); + } + + public interface RequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:gsync.player_api.PlayerStorageSearchV1.Request) + com.google.protobuf.MessageOrBuilder { + + /** + * .gsync.resource.player_storage.Criteria criteria = 1; + * + * @return Whether the criteria field is set. + */ + boolean hasCriteria(); + /** + * .gsync.resource.player_storage.Criteria criteria = 1; + * + * @return The criteria. + */ + net.averak.gsync.schema.protobuf.resource.player_storage.Criteria getCriteria(); + /** + * .gsync.resource.player_storage.Criteria criteria = 1; + */ + net.averak.gsync.schema.protobuf.resource.player_storage.CriteriaOrBuilder getCriteriaOrBuilder(); + } + /** + * Protobuf type {@code gsync.player_api.PlayerStorageSearchV1.Request} + */ + public static final class Request extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:gsync.player_api.PlayerStorageSearchV1.Request) + RequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use Request.newBuilder() to construct. + private Request(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private Request() { + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new Request(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return net.averak.gsync.schema.protobuf.player_api.PlayerStorageOuterClass.internal_static_gsync_player_api_PlayerStorageSearchV1_Request_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { + return net.averak.gsync.schema.protobuf.player_api.PlayerStorageOuterClass.internal_static_gsync_player_api_PlayerStorageSearchV1_Request_fieldAccessorTable + .ensureFieldAccessorsInitialized( + net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Request.class, + net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Request.Builder.class); + } + + private int bitField0_; + public static final int CRITERIA_FIELD_NUMBER = 1; + private net.averak.gsync.schema.protobuf.resource.player_storage.Criteria criteria_; + /** + * .gsync.resource.player_storage.Criteria criteria = 1; + * + * @return Whether the criteria field is set. + */ + @java.lang.Override + public boolean hasCriteria() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * .gsync.resource.player_storage.Criteria criteria = 1; + * + * @return The criteria. + */ + @java.lang.Override + public net.averak.gsync.schema.protobuf.resource.player_storage.Criteria getCriteria() { + return criteria_ == null + ? net.averak.gsync.schema.protobuf.resource.player_storage.Criteria.getDefaultInstance() + : criteria_; + } + /** + * .gsync.resource.player_storage.Criteria criteria = 1; + */ + @java.lang.Override + public net.averak.gsync.schema.protobuf.resource.player_storage.CriteriaOrBuilder getCriteriaOrBuilder() { + return criteria_ == null + ? net.averak.gsync.schema.protobuf.resource.player_storage.Criteria.getDefaultInstance() + : criteria_; + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) + return true; + if (isInitialized == 0) + return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (((bitField0_ & 0x00000001) != 0)) { + output.writeMessage(1, getCriteria()); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) + return size; + + size = 0; + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getCriteria()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Request)) { + return super.equals(obj); + } + net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Request other = (net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Request) obj; + + if (hasCriteria() != other.hasCriteria()) + return false; + if (hasCriteria()) { + if (!getCriteria().equals(other.getCriteria())) + return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) + return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasCriteria()) { + hash = (37 * hash) + CRITERIA_FIELD_NUMBER; + hash = (53 * hash) + getCriteria().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Request parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Request parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Request parseFrom( + com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Request parseFrom( + com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Request parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Request parseFrom(byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Request parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Request parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input, extensionRegistry); + } + + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Request parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Request parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input, + extensionRegistry); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Request parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Request parseFrom( + com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder( + net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Request prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code gsync.player_api.PlayerStorageSearchV1.Request} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:gsync.player_api.PlayerStorageSearchV1.Request) + net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.RequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return net.averak.gsync.schema.protobuf.player_api.PlayerStorageOuterClass.internal_static_gsync_player_api_PlayerStorageSearchV1_Request_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { + return net.averak.gsync.schema.protobuf.player_api.PlayerStorageOuterClass.internal_static_gsync_player_api_PlayerStorageSearchV1_Request_fieldAccessorTable + .ensureFieldAccessorsInitialized( + net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Request.class, + net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Request.Builder.class); + } + + // Construct using + // net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Request.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getCriteriaFieldBuilder(); + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + criteria_ = null; + if (criteriaBuilder_ != null) { + criteriaBuilder_.dispose(); + criteriaBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return net.averak.gsync.schema.protobuf.player_api.PlayerStorageOuterClass.internal_static_gsync_player_api_PlayerStorageSearchV1_Request_descriptor; + } + + @java.lang.Override + public net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Request getDefaultInstanceForType() { + return net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Request.getDefaultInstance(); + } + + @java.lang.Override + public net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Request build() { + net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Request result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Request buildPartial() { + net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Request result = new net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Request( + this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0( + net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Request result) { + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.criteria_ = criteriaBuilder_ == null ? criteria_ : criteriaBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + result.bitField0_ |= to_bitField0_; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + @java.lang.Override + public Builder setField(com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, int index, + java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Request) { + return mergeFrom((net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Request) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Request other) { + if (other == net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Request + .getDefaultInstance()) + return this; + if (other.hasCriteria()) { + mergeCriteria(other.getCriteria()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0 : + done = true; + break; + case 10 : { + input.readMessage(getCriteriaFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000001; + break; + } // case 10 + default : { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private net.averak.gsync.schema.protobuf.resource.player_storage.Criteria criteria_; + private com.google.protobuf.SingleFieldBuilderV3 criteriaBuilder_; + /** + * .gsync.resource.player_storage.Criteria criteria = 1; + * + * @return Whether the criteria field is set. + */ + public boolean hasCriteria() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * .gsync.resource.player_storage.Criteria criteria = 1; + * + * @return The criteria. + */ + public net.averak.gsync.schema.protobuf.resource.player_storage.Criteria getCriteria() { + if (criteriaBuilder_ == null) { + return criteria_ == null + ? net.averak.gsync.schema.protobuf.resource.player_storage.Criteria.getDefaultInstance() + : criteria_; + } else { + return criteriaBuilder_.getMessage(); + } + } + /** + * .gsync.resource.player_storage.Criteria criteria = 1; + */ + public Builder setCriteria(net.averak.gsync.schema.protobuf.resource.player_storage.Criteria value) { + if (criteriaBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + criteria_ = value; + } else { + criteriaBuilder_.setMessage(value); + } + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * .gsync.resource.player_storage.Criteria criteria = 1; + */ + public Builder setCriteria( + net.averak.gsync.schema.protobuf.resource.player_storage.Criteria.Builder builderForValue) { + if (criteriaBuilder_ == null) { + criteria_ = builderForValue.build(); + } else { + criteriaBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * .gsync.resource.player_storage.Criteria criteria = 1; + */ + public Builder mergeCriteria(net.averak.gsync.schema.protobuf.resource.player_storage.Criteria value) { + if (criteriaBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0) && criteria_ != null + && criteria_ != net.averak.gsync.schema.protobuf.resource.player_storage.Criteria + .getDefaultInstance()) { + getCriteriaBuilder().mergeFrom(value); + } else { + criteria_ = value; + } + } else { + criteriaBuilder_.mergeFrom(value); + } + if (criteria_ != null) { + bitField0_ |= 0x00000001; + onChanged(); + } + return this; + } + /** + * .gsync.resource.player_storage.Criteria criteria = 1; + */ + public Builder clearCriteria() { + bitField0_ = (bitField0_ & ~0x00000001); + criteria_ = null; + if (criteriaBuilder_ != null) { + criteriaBuilder_.dispose(); + criteriaBuilder_ = null; + } + onChanged(); + return this; + } + /** + * .gsync.resource.player_storage.Criteria criteria = 1; + */ + public net.averak.gsync.schema.protobuf.resource.player_storage.Criteria.Builder getCriteriaBuilder() { + bitField0_ |= 0x00000001; + onChanged(); + return getCriteriaFieldBuilder().getBuilder(); + } + /** + * .gsync.resource.player_storage.Criteria criteria = 1; + */ + public net.averak.gsync.schema.protobuf.resource.player_storage.CriteriaOrBuilder getCriteriaOrBuilder() { + if (criteriaBuilder_ != null) { + return criteriaBuilder_.getMessageOrBuilder(); + } else { + return criteria_ == null + ? net.averak.gsync.schema.protobuf.resource.player_storage.Criteria.getDefaultInstance() + : criteria_; + } + } + /** + * .gsync.resource.player_storage.Criteria criteria = 1; + */ + private com.google.protobuf.SingleFieldBuilderV3 getCriteriaFieldBuilder() { + if (criteriaBuilder_ == null) { + criteriaBuilder_ = new com.google.protobuf.SingleFieldBuilderV3( + getCriteria(), getParentForChildren(), isClean()); + criteria_ = null; + } + return criteriaBuilder_; + } + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:gsync.player_api.PlayerStorageSearchV1.Request) + } + + // @@protoc_insertion_point(class_scope:gsync.player_api.PlayerStorageSearchV1.Request) + private static final net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Request DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Request(); + } + + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Request getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Request parsePartialFrom(com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Request getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + public interface ResponseOrBuilder + extends + // @@protoc_insertion_point(interface_extends:gsync.player_api.PlayerStorageSearchV1.Response) + com.google.protobuf.MessageOrBuilder { + + /** + * repeated .gsync.resource.player_storage.Entry entries = 1; + */ + java.util.List getEntriesList(); + /** + * repeated .gsync.resource.player_storage.Entry entries = 1; + */ + net.averak.gsync.schema.protobuf.resource.player_storage.Entry getEntries(int index); + /** + * repeated .gsync.resource.player_storage.Entry entries = 1; + */ + int getEntriesCount(); + /** + * repeated .gsync.resource.player_storage.Entry entries = 1; + */ + java.util.List getEntriesOrBuilderList(); + /** + * repeated .gsync.resource.player_storage.Entry entries = 1; + */ + net.averak.gsync.schema.protobuf.resource.player_storage.EntryOrBuilder getEntriesOrBuilder(int index); + } + /** + * Protobuf type {@code gsync.player_api.PlayerStorageSearchV1.Response} + */ + public static final class Response extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:gsync.player_api.PlayerStorageSearchV1.Response) + ResponseOrBuilder { + private static final long serialVersionUID = 0L; + // Use Response.newBuilder() to construct. + private Response(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private Response() { + entries_ = java.util.Collections.emptyList(); + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new Response(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return net.averak.gsync.schema.protobuf.player_api.PlayerStorageOuterClass.internal_static_gsync_player_api_PlayerStorageSearchV1_Response_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { + return net.averak.gsync.schema.protobuf.player_api.PlayerStorageOuterClass.internal_static_gsync_player_api_PlayerStorageSearchV1_Response_fieldAccessorTable + .ensureFieldAccessorsInitialized( + net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Response.class, + net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Response.Builder.class); + } + + public static final int ENTRIES_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private java.util.List entries_; + /** + * repeated .gsync.resource.player_storage.Entry entries = 1; + */ + @java.lang.Override + public java.util.List getEntriesList() { + return entries_; + } + /** + * repeated .gsync.resource.player_storage.Entry entries = 1; + */ + @java.lang.Override + public java.util.List getEntriesOrBuilderList() { + return entries_; + } + /** + * repeated .gsync.resource.player_storage.Entry entries = 1; + */ + @java.lang.Override + public int getEntriesCount() { + return entries_.size(); + } + /** + * repeated .gsync.resource.player_storage.Entry entries = 1; + */ + @java.lang.Override + public net.averak.gsync.schema.protobuf.resource.player_storage.Entry getEntries(int index) { + return entries_.get(index); + } + /** + * repeated .gsync.resource.player_storage.Entry entries = 1; + */ + @java.lang.Override + public net.averak.gsync.schema.protobuf.resource.player_storage.EntryOrBuilder getEntriesOrBuilder(int index) { + return entries_.get(index); + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) + return true; + if (isInitialized == 0) + return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + for (int i = 0; i < entries_.size(); i++) { + output.writeMessage(1, entries_.get(i)); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) + return size; + + size = 0; + for (int i = 0; i < entries_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, entries_.get(i)); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Response)) { + return super.equals(obj); + } + net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Response other = (net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Response) obj; + + if (!getEntriesList().equals(other.getEntriesList())) + return false; + if (!getUnknownFields().equals(other.getUnknownFields())) + return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getEntriesCount() > 0) { + hash = (37 * hash) + ENTRIES_FIELD_NUMBER; + hash = (53 * hash) + getEntriesList().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Response parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Response parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Response parseFrom( + com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Response parseFrom( + com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Response parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Response parseFrom(byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Response parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Response parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input, extensionRegistry); + } + + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Response parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Response parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input, + extensionRegistry); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Response parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Response parseFrom( + com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder( + net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Response prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code gsync.player_api.PlayerStorageSearchV1.Response} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:gsync.player_api.PlayerStorageSearchV1.Response) + net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.ResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return net.averak.gsync.schema.protobuf.player_api.PlayerStorageOuterClass.internal_static_gsync_player_api_PlayerStorageSearchV1_Response_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { + return net.averak.gsync.schema.protobuf.player_api.PlayerStorageOuterClass.internal_static_gsync_player_api_PlayerStorageSearchV1_Response_fieldAccessorTable + .ensureFieldAccessorsInitialized( + net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Response.class, + net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Response.Builder.class); + } + + // Construct using + // net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Response.newBuilder() + private Builder() { + + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + if (entriesBuilder_ == null) { + entries_ = java.util.Collections.emptyList(); + } else { + entries_ = null; + entriesBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000001); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return net.averak.gsync.schema.protobuf.player_api.PlayerStorageOuterClass.internal_static_gsync_player_api_PlayerStorageSearchV1_Response_descriptor; + } + + @java.lang.Override + public net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Response getDefaultInstanceForType() { + return net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Response.getDefaultInstance(); + } + + @java.lang.Override + public net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Response build() { + net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Response result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Response buildPartial() { + net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Response result = new net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Response( + this); + buildPartialRepeatedFields(result); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartialRepeatedFields( + net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Response result) { + if (entriesBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + entries_ = java.util.Collections.unmodifiableList(entries_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.entries_ = entries_; + } else { + result.entries_ = entriesBuilder_.build(); + } + } + + private void buildPartial0( + net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Response result) { + int from_bitField0_ = bitField0_; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + @java.lang.Override + public Builder setField(com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, int index, + java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Response) { + return mergeFrom( + (net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Response) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Response other) { + if (other == net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Response + .getDefaultInstance()) + return this; + if (entriesBuilder_ == null) { + if (!other.entries_.isEmpty()) { + if (entries_.isEmpty()) { + entries_ = other.entries_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureEntriesIsMutable(); + entries_.addAll(other.entries_); + } + onChanged(); + } + } else { + if (!other.entries_.isEmpty()) { + if (entriesBuilder_.isEmpty()) { + entriesBuilder_.dispose(); + entriesBuilder_ = null; + entries_ = other.entries_; + bitField0_ = (bitField0_ & ~0x00000001); + entriesBuilder_ = com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getEntriesFieldBuilder() + : null; + } else { + entriesBuilder_.addAllMessages(other.entries_); + } + } + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0 : + done = true; + break; + case 10 : { + net.averak.gsync.schema.protobuf.resource.player_storage.Entry m = input.readMessage( + net.averak.gsync.schema.protobuf.resource.player_storage.Entry.parser(), + extensionRegistry); + if (entriesBuilder_ == null) { + ensureEntriesIsMutable(); + entries_.add(m); + } else { + entriesBuilder_.addMessage(m); + } + break; + } // case 10 + default : { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private java.util.List entries_ = java.util.Collections + .emptyList(); + private void ensureEntriesIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + entries_ = new java.util.ArrayList( + entries_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3 entriesBuilder_; + + /** + * repeated .gsync.resource.player_storage.Entry entries = 1; + */ + public java.util.List getEntriesList() { + if (entriesBuilder_ == null) { + return java.util.Collections.unmodifiableList(entries_); + } else { + return entriesBuilder_.getMessageList(); + } + } + /** + * repeated .gsync.resource.player_storage.Entry entries = 1; + */ + public int getEntriesCount() { + if (entriesBuilder_ == null) { + return entries_.size(); + } else { + return entriesBuilder_.getCount(); + } + } + /** + * repeated .gsync.resource.player_storage.Entry entries = 1; + */ + public net.averak.gsync.schema.protobuf.resource.player_storage.Entry getEntries(int index) { + if (entriesBuilder_ == null) { + return entries_.get(index); + } else { + return entriesBuilder_.getMessage(index); + } + } + /** + * repeated .gsync.resource.player_storage.Entry entries = 1; + */ + public Builder setEntries(int index, net.averak.gsync.schema.protobuf.resource.player_storage.Entry value) { + if (entriesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureEntriesIsMutable(); + entries_.set(index, value); + onChanged(); + } else { + entriesBuilder_.setMessage(index, value); + } + return this; + } + /** + * repeated .gsync.resource.player_storage.Entry entries = 1; + */ + public Builder setEntries(int index, + net.averak.gsync.schema.protobuf.resource.player_storage.Entry.Builder builderForValue) { + if (entriesBuilder_ == null) { + ensureEntriesIsMutable(); + entries_.set(index, builderForValue.build()); + onChanged(); + } else { + entriesBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * repeated .gsync.resource.player_storage.Entry entries = 1; + */ + public Builder addEntries(net.averak.gsync.schema.protobuf.resource.player_storage.Entry value) { + if (entriesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureEntriesIsMutable(); + entries_.add(value); + onChanged(); + } else { + entriesBuilder_.addMessage(value); + } + return this; + } + /** + * repeated .gsync.resource.player_storage.Entry entries = 1; + */ + public Builder addEntries(int index, net.averak.gsync.schema.protobuf.resource.player_storage.Entry value) { + if (entriesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureEntriesIsMutable(); + entries_.add(index, value); + onChanged(); + } else { + entriesBuilder_.addMessage(index, value); + } + return this; + } + /** + * repeated .gsync.resource.player_storage.Entry entries = 1; + */ + public Builder addEntries( + net.averak.gsync.schema.protobuf.resource.player_storage.Entry.Builder builderForValue) { + if (entriesBuilder_ == null) { + ensureEntriesIsMutable(); + entries_.add(builderForValue.build()); + onChanged(); + } else { + entriesBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * repeated .gsync.resource.player_storage.Entry entries = 1; + */ + public Builder addEntries(int index, + net.averak.gsync.schema.protobuf.resource.player_storage.Entry.Builder builderForValue) { + if (entriesBuilder_ == null) { + ensureEntriesIsMutable(); + entries_.add(index, builderForValue.build()); + onChanged(); + } else { + entriesBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * repeated .gsync.resource.player_storage.Entry entries = 1; + */ + public Builder addAllEntries( + java.lang.Iterable values) { + if (entriesBuilder_ == null) { + ensureEntriesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, entries_); + onChanged(); + } else { + entriesBuilder_.addAllMessages(values); + } + return this; + } + /** + * repeated .gsync.resource.player_storage.Entry entries = 1; + */ + public Builder clearEntries() { + if (entriesBuilder_ == null) { + entries_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + entriesBuilder_.clear(); + } + return this; + } + /** + * repeated .gsync.resource.player_storage.Entry entries = 1; + */ + public Builder removeEntries(int index) { + if (entriesBuilder_ == null) { + ensureEntriesIsMutable(); + entries_.remove(index); + onChanged(); + } else { + entriesBuilder_.remove(index); + } + return this; + } + /** + * repeated .gsync.resource.player_storage.Entry entries = 1; + */ + public net.averak.gsync.schema.protobuf.resource.player_storage.Entry.Builder getEntriesBuilder(int index) { + return getEntriesFieldBuilder().getBuilder(index); + } + /** + * repeated .gsync.resource.player_storage.Entry entries = 1; + */ + public net.averak.gsync.schema.protobuf.resource.player_storage.EntryOrBuilder getEntriesOrBuilder( + int index) { + if (entriesBuilder_ == null) { + return entries_.get(index); + } else { + return entriesBuilder_.getMessageOrBuilder(index); + } + } + /** + * repeated .gsync.resource.player_storage.Entry entries = 1; + */ + public java.util.List getEntriesOrBuilderList() { + if (entriesBuilder_ != null) { + return entriesBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(entries_); + } + } + /** + * repeated .gsync.resource.player_storage.Entry entries = 1; + */ + public net.averak.gsync.schema.protobuf.resource.player_storage.Entry.Builder addEntriesBuilder() { + return getEntriesFieldBuilder().addBuilder( + net.averak.gsync.schema.protobuf.resource.player_storage.Entry.getDefaultInstance()); + } + /** + * repeated .gsync.resource.player_storage.Entry entries = 1; + */ + public net.averak.gsync.schema.protobuf.resource.player_storage.Entry.Builder addEntriesBuilder(int index) { + return getEntriesFieldBuilder().addBuilder(index, + net.averak.gsync.schema.protobuf.resource.player_storage.Entry.getDefaultInstance()); + } + /** + * repeated .gsync.resource.player_storage.Entry entries = 1; + */ + public java.util.List getEntriesBuilderList() { + return getEntriesFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilderV3 getEntriesFieldBuilder() { + if (entriesBuilder_ == null) { + entriesBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3( + entries_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); + entries_ = null; + } + return entriesBuilder_; + } + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:gsync.player_api.PlayerStorageSearchV1.Response) + } + + // @@protoc_insertion_point(class_scope:gsync.player_api.PlayerStorageSearchV1.Response) + private static final net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Response DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Response(); + } + + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Response getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Response parsePartialFrom(com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Response getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) + return true; + if (isInitialized == 0) + return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) + return size; + + size = 0; + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1)) { + return super.equals(obj); + } + net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1 other = (net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1) obj; + + if (!getUnknownFields().equals(other.getUnknownFields())) + return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1 parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1 parseFrom(java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1 parseFrom( + com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1 parseFrom( + com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1 parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1 parseFrom(byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1 parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1 parseFrom(java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input, extensionRegistry); + } + + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1 parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1 parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1 parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1 parseFrom( + com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1 prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code gsync.player_api.PlayerStorageSearchV1} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:gsync.player_api.PlayerStorageSearchV1) + net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1OrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return net.averak.gsync.schema.protobuf.player_api.PlayerStorageOuterClass.internal_static_gsync_player_api_PlayerStorageSearchV1_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { + return net.averak.gsync.schema.protobuf.player_api.PlayerStorageOuterClass.internal_static_gsync_player_api_PlayerStorageSearchV1_fieldAccessorTable + .ensureFieldAccessorsInitialized( + net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.class, + net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Builder.class); + } + + // Construct using + // net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.newBuilder() + private Builder() { + + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return net.averak.gsync.schema.protobuf.player_api.PlayerStorageOuterClass.internal_static_gsync_player_api_PlayerStorageSearchV1_descriptor; + } + + @java.lang.Override + public net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1 getDefaultInstanceForType() { + return net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.getDefaultInstance(); + } + + @java.lang.Override + public net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1 build() { + net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1 result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1 buildPartial() { + net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1 result = new net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1( + this); + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + @java.lang.Override + public Builder setField(com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, int index, + java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1) { + return mergeFrom((net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1 other) { + if (other == net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.getDefaultInstance()) + return this; + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0 : + done = true; + break; + default : { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:gsync.player_api.PlayerStorageSearchV1) + } + + // @@protoc_insertion_point(class_scope:gsync.player_api.PlayerStorageSearchV1) + private static final net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1 DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1(); + } + + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1 getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public PlayerStorageSearchV1 parsePartialFrom(com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1 getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} diff --git a/protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/PlayerStorageSearchV1OrBuilder.java b/protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/PlayerStorageSearchV1OrBuilder.java new file mode 100644 index 0000000..d108240 --- /dev/null +++ b/protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/PlayerStorageSearchV1OrBuilder.java @@ -0,0 +1,11 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: player_api/player_storage.proto + +// Protobuf Java Version: 3.25.1 +package net.averak.gsync.schema.protobuf.player_api; + +public interface PlayerStorageSearchV1OrBuilder + extends + // @@protoc_insertion_point(interface_extends:gsync.player_api.PlayerStorageSearchV1) + com.google.protobuf.MessageOrBuilder { +} diff --git a/protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/PlayerStorageSetV1.java b/protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/PlayerStorageSetV1.java new file mode 100644 index 0000000..aacb21e --- /dev/null +++ b/protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/PlayerStorageSetV1.java @@ -0,0 +1,1860 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: player_api/player_storage.proto + +// Protobuf Java Version: 3.25.1 +package net.averak.gsync.schema.protobuf.player_api; + +/** + * Protobuf type {@code gsync.player_api.PlayerStorageSetV1} + */ +public final class PlayerStorageSetV1 extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:gsync.player_api.PlayerStorageSetV1) + PlayerStorageSetV1OrBuilder { + private static final long serialVersionUID = 0L; + // Use PlayerStorageSetV1.newBuilder() to construct. + private PlayerStorageSetV1(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private PlayerStorageSetV1() { + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new PlayerStorageSetV1(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return net.averak.gsync.schema.protobuf.player_api.PlayerStorageOuterClass.internal_static_gsync_player_api_PlayerStorageSetV1_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { + return net.averak.gsync.schema.protobuf.player_api.PlayerStorageOuterClass.internal_static_gsync_player_api_PlayerStorageSetV1_fieldAccessorTable + .ensureFieldAccessorsInitialized(net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.class, + net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Builder.class); + } + + public interface RequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:gsync.player_api.PlayerStorageSetV1.Request) + com.google.protobuf.MessageOrBuilder { + + /** + * .gsync.resource.player_storage.Entry entry = 1; + * + * @return Whether the entry field is set. + */ + boolean hasEntry(); + /** + * .gsync.resource.player_storage.Entry entry = 1; + * + * @return The entry. + */ + net.averak.gsync.schema.protobuf.resource.player_storage.Entry getEntry(); + /** + * .gsync.resource.player_storage.Entry entry = 1; + */ + net.averak.gsync.schema.protobuf.resource.player_storage.EntryOrBuilder getEntryOrBuilder(); + + /** + * string previous_revision = 2; + * + * @return The previousRevision. + */ + java.lang.String getPreviousRevision(); + /** + * string previous_revision = 2; + * + * @return The bytes for previousRevision. + */ + com.google.protobuf.ByteString getPreviousRevisionBytes(); + } + /** + * Protobuf type {@code gsync.player_api.PlayerStorageSetV1.Request} + */ + public static final class Request extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:gsync.player_api.PlayerStorageSetV1.Request) + RequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use Request.newBuilder() to construct. + private Request(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private Request() { + previousRevision_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new Request(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return net.averak.gsync.schema.protobuf.player_api.PlayerStorageOuterClass.internal_static_gsync_player_api_PlayerStorageSetV1_Request_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { + return net.averak.gsync.schema.protobuf.player_api.PlayerStorageOuterClass.internal_static_gsync_player_api_PlayerStorageSetV1_Request_fieldAccessorTable + .ensureFieldAccessorsInitialized( + net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Request.class, + net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Request.Builder.class); + } + + private int bitField0_; + public static final int ENTRY_FIELD_NUMBER = 1; + private net.averak.gsync.schema.protobuf.resource.player_storage.Entry entry_; + /** + * .gsync.resource.player_storage.Entry entry = 1; + * + * @return Whether the entry field is set. + */ + @java.lang.Override + public boolean hasEntry() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * .gsync.resource.player_storage.Entry entry = 1; + * + * @return The entry. + */ + @java.lang.Override + public net.averak.gsync.schema.protobuf.resource.player_storage.Entry getEntry() { + return entry_ == null + ? net.averak.gsync.schema.protobuf.resource.player_storage.Entry.getDefaultInstance() + : entry_; + } + /** + * .gsync.resource.player_storage.Entry entry = 1; + */ + @java.lang.Override + public net.averak.gsync.schema.protobuf.resource.player_storage.EntryOrBuilder getEntryOrBuilder() { + return entry_ == null + ? net.averak.gsync.schema.protobuf.resource.player_storage.Entry.getDefaultInstance() + : entry_; + } + + public static final int PREVIOUS_REVISION_FIELD_NUMBER = 2; + @SuppressWarnings("serial") + private volatile java.lang.Object previousRevision_ = ""; + /** + * string previous_revision = 2; + * + * @return The previousRevision. + */ + @java.lang.Override + public java.lang.String getPreviousRevision() { + java.lang.Object ref = previousRevision_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + previousRevision_ = s; + return s; + } + } + /** + * string previous_revision = 2; + * + * @return The bytes for previousRevision. + */ + @java.lang.Override + public com.google.protobuf.ByteString getPreviousRevisionBytes() { + java.lang.Object ref = previousRevision_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + previousRevision_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) + return true; + if (isInitialized == 0) + return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (((bitField0_ & 0x00000001) != 0)) { + output.writeMessage(1, getEntry()); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(previousRevision_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, previousRevision_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) + return size; + + size = 0; + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getEntry()); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(previousRevision_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, previousRevision_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Request)) { + return super.equals(obj); + } + net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Request other = (net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Request) obj; + + if (hasEntry() != other.hasEntry()) + return false; + if (hasEntry()) { + if (!getEntry().equals(other.getEntry())) + return false; + } + if (!getPreviousRevision().equals(other.getPreviousRevision())) + return false; + if (!getUnknownFields().equals(other.getUnknownFields())) + return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasEntry()) { + hash = (37 * hash) + ENTRY_FIELD_NUMBER; + hash = (53 * hash) + getEntry().hashCode(); + } + hash = (37 * hash) + PREVIOUS_REVISION_FIELD_NUMBER; + hash = (53 * hash) + getPreviousRevision().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Request parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Request parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Request parseFrom( + com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Request parseFrom( + com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Request parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Request parseFrom(byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Request parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Request parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input, extensionRegistry); + } + + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Request parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Request parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input, + extensionRegistry); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Request parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Request parseFrom( + com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder( + net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Request prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code gsync.player_api.PlayerStorageSetV1.Request} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:gsync.player_api.PlayerStorageSetV1.Request) + net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.RequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return net.averak.gsync.schema.protobuf.player_api.PlayerStorageOuterClass.internal_static_gsync_player_api_PlayerStorageSetV1_Request_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { + return net.averak.gsync.schema.protobuf.player_api.PlayerStorageOuterClass.internal_static_gsync_player_api_PlayerStorageSetV1_Request_fieldAccessorTable + .ensureFieldAccessorsInitialized( + net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Request.class, + net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Request.Builder.class); + } + + // Construct using + // net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Request.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getEntryFieldBuilder(); + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + entry_ = null; + if (entryBuilder_ != null) { + entryBuilder_.dispose(); + entryBuilder_ = null; + } + previousRevision_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return net.averak.gsync.schema.protobuf.player_api.PlayerStorageOuterClass.internal_static_gsync_player_api_PlayerStorageSetV1_Request_descriptor; + } + + @java.lang.Override + public net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Request getDefaultInstanceForType() { + return net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Request.getDefaultInstance(); + } + + @java.lang.Override + public net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Request build() { + net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Request result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Request buildPartial() { + net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Request result = new net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Request( + this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0(net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Request result) { + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.entry_ = entryBuilder_ == null ? entry_ : entryBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.previousRevision_ = previousRevision_; + } + result.bitField0_ |= to_bitField0_; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + @java.lang.Override + public Builder setField(com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, int index, + java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Request) { + return mergeFrom((net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Request) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Request other) { + if (other == net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Request + .getDefaultInstance()) + return this; + if (other.hasEntry()) { + mergeEntry(other.getEntry()); + } + if (!other.getPreviousRevision().isEmpty()) { + previousRevision_ = other.previousRevision_; + bitField0_ |= 0x00000002; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0 : + done = true; + break; + case 10 : { + input.readMessage(getEntryFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18 : { + previousRevision_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + default : { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private net.averak.gsync.schema.protobuf.resource.player_storage.Entry entry_; + private com.google.protobuf.SingleFieldBuilderV3 entryBuilder_; + /** + * .gsync.resource.player_storage.Entry entry = 1; + * + * @return Whether the entry field is set. + */ + public boolean hasEntry() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * .gsync.resource.player_storage.Entry entry = 1; + * + * @return The entry. + */ + public net.averak.gsync.schema.protobuf.resource.player_storage.Entry getEntry() { + if (entryBuilder_ == null) { + return entry_ == null + ? net.averak.gsync.schema.protobuf.resource.player_storage.Entry.getDefaultInstance() + : entry_; + } else { + return entryBuilder_.getMessage(); + } + } + /** + * .gsync.resource.player_storage.Entry entry = 1; + */ + public Builder setEntry(net.averak.gsync.schema.protobuf.resource.player_storage.Entry value) { + if (entryBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + entry_ = value; + } else { + entryBuilder_.setMessage(value); + } + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * .gsync.resource.player_storage.Entry entry = 1; + */ + public Builder setEntry( + net.averak.gsync.schema.protobuf.resource.player_storage.Entry.Builder builderForValue) { + if (entryBuilder_ == null) { + entry_ = builderForValue.build(); + } else { + entryBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * .gsync.resource.player_storage.Entry entry = 1; + */ + public Builder mergeEntry(net.averak.gsync.schema.protobuf.resource.player_storage.Entry value) { + if (entryBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0) && entry_ != null + && entry_ != net.averak.gsync.schema.protobuf.resource.player_storage.Entry + .getDefaultInstance()) { + getEntryBuilder().mergeFrom(value); + } else { + entry_ = value; + } + } else { + entryBuilder_.mergeFrom(value); + } + if (entry_ != null) { + bitField0_ |= 0x00000001; + onChanged(); + } + return this; + } + /** + * .gsync.resource.player_storage.Entry entry = 1; + */ + public Builder clearEntry() { + bitField0_ = (bitField0_ & ~0x00000001); + entry_ = null; + if (entryBuilder_ != null) { + entryBuilder_.dispose(); + entryBuilder_ = null; + } + onChanged(); + return this; + } + /** + * .gsync.resource.player_storage.Entry entry = 1; + */ + public net.averak.gsync.schema.protobuf.resource.player_storage.Entry.Builder getEntryBuilder() { + bitField0_ |= 0x00000001; + onChanged(); + return getEntryFieldBuilder().getBuilder(); + } + /** + * .gsync.resource.player_storage.Entry entry = 1; + */ + public net.averak.gsync.schema.protobuf.resource.player_storage.EntryOrBuilder getEntryOrBuilder() { + if (entryBuilder_ != null) { + return entryBuilder_.getMessageOrBuilder(); + } else { + return entry_ == null + ? net.averak.gsync.schema.protobuf.resource.player_storage.Entry.getDefaultInstance() + : entry_; + } + } + /** + * .gsync.resource.player_storage.Entry entry = 1; + */ + private com.google.protobuf.SingleFieldBuilderV3 getEntryFieldBuilder() { + if (entryBuilder_ == null) { + entryBuilder_ = new com.google.protobuf.SingleFieldBuilderV3( + getEntry(), getParentForChildren(), isClean()); + entry_ = null; + } + return entryBuilder_; + } + + private java.lang.Object previousRevision_ = ""; + /** + * string previous_revision = 2; + * + * @return The previousRevision. + */ + public java.lang.String getPreviousRevision() { + java.lang.Object ref = previousRevision_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + previousRevision_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string previous_revision = 2; + * + * @return The bytes for previousRevision. + */ + public com.google.protobuf.ByteString getPreviousRevisionBytes() { + java.lang.Object ref = previousRevision_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = com.google.protobuf.ByteString + .copyFromUtf8((java.lang.String) ref); + previousRevision_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string previous_revision = 2; + * + * @param value + * The previousRevision to set. + * @return This builder for chaining. + */ + public Builder setPreviousRevision(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + previousRevision_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * string previous_revision = 2; + * + * @return This builder for chaining. + */ + public Builder clearPreviousRevision() { + previousRevision_ = getDefaultInstance().getPreviousRevision(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + * string previous_revision = 2; + * + * @param value + * The bytes for previousRevision to set. + * @return This builder for chaining. + */ + public Builder setPreviousRevisionBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + previousRevision_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:gsync.player_api.PlayerStorageSetV1.Request) + } + + // @@protoc_insertion_point(class_scope:gsync.player_api.PlayerStorageSetV1.Request) + private static final net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Request DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Request(); + } + + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Request getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Request parsePartialFrom(com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Request getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + public interface ResponseOrBuilder + extends + // @@protoc_insertion_point(interface_extends:gsync.player_api.PlayerStorageSetV1.Response) + com.google.protobuf.MessageOrBuilder { + + /** + * .gsync.resource.player_storage.Entry entry = 1; + * + * @return Whether the entry field is set. + */ + boolean hasEntry(); + /** + * .gsync.resource.player_storage.Entry entry = 1; + * + * @return The entry. + */ + net.averak.gsync.schema.protobuf.resource.player_storage.Entry getEntry(); + /** + * .gsync.resource.player_storage.Entry entry = 1; + */ + net.averak.gsync.schema.protobuf.resource.player_storage.EntryOrBuilder getEntryOrBuilder(); + + /** + * string next_revision = 2; + * + * @return The nextRevision. + */ + java.lang.String getNextRevision(); + /** + * string next_revision = 2; + * + * @return The bytes for nextRevision. + */ + com.google.protobuf.ByteString getNextRevisionBytes(); + } + /** + * Protobuf type {@code gsync.player_api.PlayerStorageSetV1.Response} + */ + public static final class Response extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:gsync.player_api.PlayerStorageSetV1.Response) + ResponseOrBuilder { + private static final long serialVersionUID = 0L; + // Use Response.newBuilder() to construct. + private Response(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private Response() { + nextRevision_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new Response(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return net.averak.gsync.schema.protobuf.player_api.PlayerStorageOuterClass.internal_static_gsync_player_api_PlayerStorageSetV1_Response_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { + return net.averak.gsync.schema.protobuf.player_api.PlayerStorageOuterClass.internal_static_gsync_player_api_PlayerStorageSetV1_Response_fieldAccessorTable + .ensureFieldAccessorsInitialized( + net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Response.class, + net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Response.Builder.class); + } + + private int bitField0_; + public static final int ENTRY_FIELD_NUMBER = 1; + private net.averak.gsync.schema.protobuf.resource.player_storage.Entry entry_; + /** + * .gsync.resource.player_storage.Entry entry = 1; + * + * @return Whether the entry field is set. + */ + @java.lang.Override + public boolean hasEntry() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * .gsync.resource.player_storage.Entry entry = 1; + * + * @return The entry. + */ + @java.lang.Override + public net.averak.gsync.schema.protobuf.resource.player_storage.Entry getEntry() { + return entry_ == null + ? net.averak.gsync.schema.protobuf.resource.player_storage.Entry.getDefaultInstance() + : entry_; + } + /** + * .gsync.resource.player_storage.Entry entry = 1; + */ + @java.lang.Override + public net.averak.gsync.schema.protobuf.resource.player_storage.EntryOrBuilder getEntryOrBuilder() { + return entry_ == null + ? net.averak.gsync.schema.protobuf.resource.player_storage.Entry.getDefaultInstance() + : entry_; + } + + public static final int NEXT_REVISION_FIELD_NUMBER = 2; + @SuppressWarnings("serial") + private volatile java.lang.Object nextRevision_ = ""; + /** + * string next_revision = 2; + * + * @return The nextRevision. + */ + @java.lang.Override + public java.lang.String getNextRevision() { + java.lang.Object ref = nextRevision_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + nextRevision_ = s; + return s; + } + } + /** + * string next_revision = 2; + * + * @return The bytes for nextRevision. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNextRevisionBytes() { + java.lang.Object ref = nextRevision_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + nextRevision_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) + return true; + if (isInitialized == 0) + return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (((bitField0_ & 0x00000001) != 0)) { + output.writeMessage(1, getEntry()); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(nextRevision_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, nextRevision_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) + return size; + + size = 0; + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getEntry()); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(nextRevision_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, nextRevision_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Response)) { + return super.equals(obj); + } + net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Response other = (net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Response) obj; + + if (hasEntry() != other.hasEntry()) + return false; + if (hasEntry()) { + if (!getEntry().equals(other.getEntry())) + return false; + } + if (!getNextRevision().equals(other.getNextRevision())) + return false; + if (!getUnknownFields().equals(other.getUnknownFields())) + return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasEntry()) { + hash = (37 * hash) + ENTRY_FIELD_NUMBER; + hash = (53 * hash) + getEntry().hashCode(); + } + hash = (37 * hash) + NEXT_REVISION_FIELD_NUMBER; + hash = (53 * hash) + getNextRevision().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Response parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Response parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Response parseFrom( + com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Response parseFrom( + com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Response parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Response parseFrom(byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Response parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Response parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input, extensionRegistry); + } + + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Response parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Response parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input, + extensionRegistry); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Response parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Response parseFrom( + com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder( + net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Response prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code gsync.player_api.PlayerStorageSetV1.Response} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:gsync.player_api.PlayerStorageSetV1.Response) + net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.ResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return net.averak.gsync.schema.protobuf.player_api.PlayerStorageOuterClass.internal_static_gsync_player_api_PlayerStorageSetV1_Response_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { + return net.averak.gsync.schema.protobuf.player_api.PlayerStorageOuterClass.internal_static_gsync_player_api_PlayerStorageSetV1_Response_fieldAccessorTable + .ensureFieldAccessorsInitialized( + net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Response.class, + net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Response.Builder.class); + } + + // Construct using + // net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Response.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getEntryFieldBuilder(); + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + entry_ = null; + if (entryBuilder_ != null) { + entryBuilder_.dispose(); + entryBuilder_ = null; + } + nextRevision_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return net.averak.gsync.schema.protobuf.player_api.PlayerStorageOuterClass.internal_static_gsync_player_api_PlayerStorageSetV1_Response_descriptor; + } + + @java.lang.Override + public net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Response getDefaultInstanceForType() { + return net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Response.getDefaultInstance(); + } + + @java.lang.Override + public net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Response build() { + net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Response result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Response buildPartial() { + net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Response result = new net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Response( + this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0(net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Response result) { + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.entry_ = entryBuilder_ == null ? entry_ : entryBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.nextRevision_ = nextRevision_; + } + result.bitField0_ |= to_bitField0_; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + @java.lang.Override + public Builder setField(com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, int index, + java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Response) { + return mergeFrom((net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Response) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Response other) { + if (other == net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Response + .getDefaultInstance()) + return this; + if (other.hasEntry()) { + mergeEntry(other.getEntry()); + } + if (!other.getNextRevision().isEmpty()) { + nextRevision_ = other.nextRevision_; + bitField0_ |= 0x00000002; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0 : + done = true; + break; + case 10 : { + input.readMessage(getEntryFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18 : { + nextRevision_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + default : { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private net.averak.gsync.schema.protobuf.resource.player_storage.Entry entry_; + private com.google.protobuf.SingleFieldBuilderV3 entryBuilder_; + /** + * .gsync.resource.player_storage.Entry entry = 1; + * + * @return Whether the entry field is set. + */ + public boolean hasEntry() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * .gsync.resource.player_storage.Entry entry = 1; + * + * @return The entry. + */ + public net.averak.gsync.schema.protobuf.resource.player_storage.Entry getEntry() { + if (entryBuilder_ == null) { + return entry_ == null + ? net.averak.gsync.schema.protobuf.resource.player_storage.Entry.getDefaultInstance() + : entry_; + } else { + return entryBuilder_.getMessage(); + } + } + /** + * .gsync.resource.player_storage.Entry entry = 1; + */ + public Builder setEntry(net.averak.gsync.schema.protobuf.resource.player_storage.Entry value) { + if (entryBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + entry_ = value; + } else { + entryBuilder_.setMessage(value); + } + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * .gsync.resource.player_storage.Entry entry = 1; + */ + public Builder setEntry( + net.averak.gsync.schema.protobuf.resource.player_storage.Entry.Builder builderForValue) { + if (entryBuilder_ == null) { + entry_ = builderForValue.build(); + } else { + entryBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * .gsync.resource.player_storage.Entry entry = 1; + */ + public Builder mergeEntry(net.averak.gsync.schema.protobuf.resource.player_storage.Entry value) { + if (entryBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0) && entry_ != null + && entry_ != net.averak.gsync.schema.protobuf.resource.player_storage.Entry + .getDefaultInstance()) { + getEntryBuilder().mergeFrom(value); + } else { + entry_ = value; + } + } else { + entryBuilder_.mergeFrom(value); + } + if (entry_ != null) { + bitField0_ |= 0x00000001; + onChanged(); + } + return this; + } + /** + * .gsync.resource.player_storage.Entry entry = 1; + */ + public Builder clearEntry() { + bitField0_ = (bitField0_ & ~0x00000001); + entry_ = null; + if (entryBuilder_ != null) { + entryBuilder_.dispose(); + entryBuilder_ = null; + } + onChanged(); + return this; + } + /** + * .gsync.resource.player_storage.Entry entry = 1; + */ + public net.averak.gsync.schema.protobuf.resource.player_storage.Entry.Builder getEntryBuilder() { + bitField0_ |= 0x00000001; + onChanged(); + return getEntryFieldBuilder().getBuilder(); + } + /** + * .gsync.resource.player_storage.Entry entry = 1; + */ + public net.averak.gsync.schema.protobuf.resource.player_storage.EntryOrBuilder getEntryOrBuilder() { + if (entryBuilder_ != null) { + return entryBuilder_.getMessageOrBuilder(); + } else { + return entry_ == null + ? net.averak.gsync.schema.protobuf.resource.player_storage.Entry.getDefaultInstance() + : entry_; + } + } + /** + * .gsync.resource.player_storage.Entry entry = 1; + */ + private com.google.protobuf.SingleFieldBuilderV3 getEntryFieldBuilder() { + if (entryBuilder_ == null) { + entryBuilder_ = new com.google.protobuf.SingleFieldBuilderV3( + getEntry(), getParentForChildren(), isClean()); + entry_ = null; + } + return entryBuilder_; + } + + private java.lang.Object nextRevision_ = ""; + /** + * string next_revision = 2; + * + * @return The nextRevision. + */ + public java.lang.String getNextRevision() { + java.lang.Object ref = nextRevision_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + nextRevision_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string next_revision = 2; + * + * @return The bytes for nextRevision. + */ + public com.google.protobuf.ByteString getNextRevisionBytes() { + java.lang.Object ref = nextRevision_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = com.google.protobuf.ByteString + .copyFromUtf8((java.lang.String) ref); + nextRevision_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string next_revision = 2; + * + * @param value + * The nextRevision to set. + * @return This builder for chaining. + */ + public Builder setNextRevision(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + nextRevision_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * string next_revision = 2; + * + * @return This builder for chaining. + */ + public Builder clearNextRevision() { + nextRevision_ = getDefaultInstance().getNextRevision(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + * string next_revision = 2; + * + * @param value + * The bytes for nextRevision to set. + * @return This builder for chaining. + */ + public Builder setNextRevisionBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + nextRevision_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:gsync.player_api.PlayerStorageSetV1.Response) + } + + // @@protoc_insertion_point(class_scope:gsync.player_api.PlayerStorageSetV1.Response) + private static final net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Response DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Response(); + } + + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Response getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Response parsePartialFrom(com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Response getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) + return true; + if (isInitialized == 0) + return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) + return size; + + size = 0; + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1)) { + return super.equals(obj); + } + net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1 other = (net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1) obj; + + if (!getUnknownFields().equals(other.getUnknownFields())) + return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1 parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1 parseFrom(java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1 parseFrom( + com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1 parseFrom( + com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1 parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1 parseFrom(byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1 parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1 parseFrom(java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input, extensionRegistry); + } + + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1 parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1 parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1 parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1 parseFrom( + com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1 prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code gsync.player_api.PlayerStorageSetV1} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:gsync.player_api.PlayerStorageSetV1) + net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1OrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return net.averak.gsync.schema.protobuf.player_api.PlayerStorageOuterClass.internal_static_gsync_player_api_PlayerStorageSetV1_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { + return net.averak.gsync.schema.protobuf.player_api.PlayerStorageOuterClass.internal_static_gsync_player_api_PlayerStorageSetV1_fieldAccessorTable + .ensureFieldAccessorsInitialized( + net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.class, + net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Builder.class); + } + + // Construct using + // net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.newBuilder() + private Builder() { + + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return net.averak.gsync.schema.protobuf.player_api.PlayerStorageOuterClass.internal_static_gsync_player_api_PlayerStorageSetV1_descriptor; + } + + @java.lang.Override + public net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1 getDefaultInstanceForType() { + return net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.getDefaultInstance(); + } + + @java.lang.Override + public net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1 build() { + net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1 result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1 buildPartial() { + net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1 result = new net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1( + this); + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + @java.lang.Override + public Builder setField(com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, int index, + java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1) { + return mergeFrom((net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1 other) { + if (other == net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.getDefaultInstance()) + return this; + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0 : + done = true; + break; + default : { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:gsync.player_api.PlayerStorageSetV1) + } + + // @@protoc_insertion_point(class_scope:gsync.player_api.PlayerStorageSetV1) + private static final net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1 DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1(); + } + + public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1 getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public PlayerStorageSetV1 parsePartialFrom(com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1 getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} diff --git a/protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/PlayerStorageSetV1OrBuilder.java b/protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/PlayerStorageSetV1OrBuilder.java new file mode 100644 index 0000000..930fa84 --- /dev/null +++ b/protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/PlayerStorageSetV1OrBuilder.java @@ -0,0 +1,11 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: player_api/player_storage.proto + +// Protobuf Java Version: 3.25.1 +package net.averak.gsync.schema.protobuf.player_api; + +public interface PlayerStorageSetV1OrBuilder + extends + // @@protoc_insertion_point(interface_extends:gsync.player_api.PlayerStorageSetV1) + com.google.protobuf.MessageOrBuilder { +} diff --git a/protobuf/src/main/java/net/averak/gsync/schema/protobuf/resource/player_storage/Criteria.java b/protobuf/src/main/java/net/averak/gsync/schema/protobuf/resource/player_storage/Criteria.java new file mode 100644 index 0000000..07e4bc4 --- /dev/null +++ b/protobuf/src/main/java/net/averak/gsync/schema/protobuf/resource/player_storage/Criteria.java @@ -0,0 +1,732 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: resource/player_storage.proto + +// Protobuf Java Version: 3.25.1 +package net.averak.gsync.schema.protobuf.resource.player_storage; + +/** + * Protobuf type {@code gsync.resource.player_storage.Criteria} + */ +public final class Criteria extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:gsync.resource.player_storage.Criteria) + CriteriaOrBuilder { + private static final long serialVersionUID = 0L; + // Use Criteria.newBuilder() to construct. + private Criteria(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private Criteria() { + pattern_ = ""; + matchingPattern_ = 0; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new Criteria(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return net.averak.gsync.schema.protobuf.resource.player_storage.PlayerStorage.internal_static_gsync_resource_player_storage_Criteria_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { + return net.averak.gsync.schema.protobuf.resource.player_storage.PlayerStorage.internal_static_gsync_resource_player_storage_Criteria_fieldAccessorTable + .ensureFieldAccessorsInitialized( + net.averak.gsync.schema.protobuf.resource.player_storage.Criteria.class, + net.averak.gsync.schema.protobuf.resource.player_storage.Criteria.Builder.class); + } + + /** + * Protobuf enum {@code gsync.resource.player_storage.Criteria.MatchingType} + */ + public enum MatchingType implements com.google.protobuf.ProtocolMessageEnum { + /** + * EXACT_MATCH = 0; + */ + EXACT_MATCH(0), + /** + * FORWARD_MATCH = 1; + */ + FORWARD_MATCH(1), UNRECOGNIZED(-1),; + + /** + * EXACT_MATCH = 0; + */ + public static final int EXACT_MATCH_VALUE = 0; + /** + * FORWARD_MATCH = 1; + */ + public static final int FORWARD_MATCH_VALUE = 1; + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException("Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value + * The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static MatchingType valueOf(int value) { + return forNumber(value); + } + + /** + * @param value + * The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static MatchingType forNumber(int value) { + switch (value) { + case 0 : + return EXACT_MATCH; + case 1 : + return FORWARD_MATCH; + default : + return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap internalGetValueMap() { + return internalValueMap; + } + private static final com.google.protobuf.Internal.EnumLiteMap internalValueMap = new com.google.protobuf.Internal.EnumLiteMap() { + public MatchingType findValueByNumber(int number) { + return MatchingType.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalStateException("Can't get the descriptor of an unrecognized enum value."); + } + return getDescriptor().getValues().get(ordinal()); + } + public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { + return getDescriptor(); + } + public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { + return net.averak.gsync.schema.protobuf.resource.player_storage.Criteria.getDescriptor().getEnumTypes() + .get(0); + } + + private static final MatchingType[] VALUES = values(); + + public static MatchingType valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } + + private final int value; + + private MatchingType(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:gsync.resource.player_storage.Criteria.MatchingType) + } + + public static final int PATTERN_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private volatile java.lang.Object pattern_ = ""; + /** + * string pattern = 1; + * + * @return The pattern. + */ + @java.lang.Override + public java.lang.String getPattern() { + java.lang.Object ref = pattern_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + pattern_ = s; + return s; + } + } + /** + * string pattern = 1; + * + * @return The bytes for pattern. + */ + @java.lang.Override + public com.google.protobuf.ByteString getPatternBytes() { + java.lang.Object ref = pattern_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + pattern_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int MATCHING_PATTERN_FIELD_NUMBER = 2; + private int matchingPattern_ = 0; + /** + * .gsync.resource.player_storage.Criteria.MatchingType matching_pattern = 2; + * + * @return The enum numeric value on the wire for matchingPattern. + */ + @java.lang.Override + public int getMatchingPatternValue() { + return matchingPattern_; + } + /** + * .gsync.resource.player_storage.Criteria.MatchingType matching_pattern = 2; + * + * @return The matchingPattern. + */ + @java.lang.Override + public net.averak.gsync.schema.protobuf.resource.player_storage.Criteria.MatchingType getMatchingPattern() { + net.averak.gsync.schema.protobuf.resource.player_storage.Criteria.MatchingType result = net.averak.gsync.schema.protobuf.resource.player_storage.Criteria.MatchingType + .forNumber(matchingPattern_); + return result == null + ? net.averak.gsync.schema.protobuf.resource.player_storage.Criteria.MatchingType.UNRECOGNIZED + : result; + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) + return true; + if (isInitialized == 0) + return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(pattern_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, pattern_); + } + if (matchingPattern_ != net.averak.gsync.schema.protobuf.resource.player_storage.Criteria.MatchingType.EXACT_MATCH + .getNumber()) { + output.writeEnum(2, matchingPattern_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) + return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(pattern_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, pattern_); + } + if (matchingPattern_ != net.averak.gsync.schema.protobuf.resource.player_storage.Criteria.MatchingType.EXACT_MATCH + .getNumber()) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(2, matchingPattern_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof net.averak.gsync.schema.protobuf.resource.player_storage.Criteria)) { + return super.equals(obj); + } + net.averak.gsync.schema.protobuf.resource.player_storage.Criteria other = (net.averak.gsync.schema.protobuf.resource.player_storage.Criteria) obj; + + if (!getPattern().equals(other.getPattern())) + return false; + if (matchingPattern_ != other.matchingPattern_) + return false; + if (!getUnknownFields().equals(other.getUnknownFields())) + return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PATTERN_FIELD_NUMBER; + hash = (53 * hash) + getPattern().hashCode(); + hash = (37 * hash) + MATCHING_PATTERN_FIELD_NUMBER; + hash = (53 * hash) + matchingPattern_; + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static net.averak.gsync.schema.protobuf.resource.player_storage.Criteria parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static net.averak.gsync.schema.protobuf.resource.player_storage.Criteria parseFrom(java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static net.averak.gsync.schema.protobuf.resource.player_storage.Criteria parseFrom( + com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static net.averak.gsync.schema.protobuf.resource.player_storage.Criteria parseFrom( + com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static net.averak.gsync.schema.protobuf.resource.player_storage.Criteria parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static net.averak.gsync.schema.protobuf.resource.player_storage.Criteria parseFrom(byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static net.averak.gsync.schema.protobuf.resource.player_storage.Criteria parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + public static net.averak.gsync.schema.protobuf.resource.player_storage.Criteria parseFrom(java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input, extensionRegistry); + } + + public static net.averak.gsync.schema.protobuf.resource.player_storage.Criteria parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static net.averak.gsync.schema.protobuf.resource.player_storage.Criteria parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static net.averak.gsync.schema.protobuf.resource.player_storage.Criteria parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + public static net.averak.gsync.schema.protobuf.resource.player_storage.Criteria parseFrom( + com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(net.averak.gsync.schema.protobuf.resource.player_storage.Criteria prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code gsync.resource.player_storage.Criteria} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:gsync.resource.player_storage.Criteria) + net.averak.gsync.schema.protobuf.resource.player_storage.CriteriaOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return net.averak.gsync.schema.protobuf.resource.player_storage.PlayerStorage.internal_static_gsync_resource_player_storage_Criteria_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { + return net.averak.gsync.schema.protobuf.resource.player_storage.PlayerStorage.internal_static_gsync_resource_player_storage_Criteria_fieldAccessorTable + .ensureFieldAccessorsInitialized( + net.averak.gsync.schema.protobuf.resource.player_storage.Criteria.class, + net.averak.gsync.schema.protobuf.resource.player_storage.Criteria.Builder.class); + } + + // Construct using + // net.averak.gsync.schema.protobuf.resource.player_storage.Criteria.newBuilder() + private Builder() { + + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + pattern_ = ""; + matchingPattern_ = 0; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return net.averak.gsync.schema.protobuf.resource.player_storage.PlayerStorage.internal_static_gsync_resource_player_storage_Criteria_descriptor; + } + + @java.lang.Override + public net.averak.gsync.schema.protobuf.resource.player_storage.Criteria getDefaultInstanceForType() { + return net.averak.gsync.schema.protobuf.resource.player_storage.Criteria.getDefaultInstance(); + } + + @java.lang.Override + public net.averak.gsync.schema.protobuf.resource.player_storage.Criteria build() { + net.averak.gsync.schema.protobuf.resource.player_storage.Criteria result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public net.averak.gsync.schema.protobuf.resource.player_storage.Criteria buildPartial() { + net.averak.gsync.schema.protobuf.resource.player_storage.Criteria result = new net.averak.gsync.schema.protobuf.resource.player_storage.Criteria( + this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0(net.averak.gsync.schema.protobuf.resource.player_storage.Criteria result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.pattern_ = pattern_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.matchingPattern_ = matchingPattern_; + } + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + @java.lang.Override + public Builder setField(com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, int index, + java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof net.averak.gsync.schema.protobuf.resource.player_storage.Criteria) { + return mergeFrom((net.averak.gsync.schema.protobuf.resource.player_storage.Criteria) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(net.averak.gsync.schema.protobuf.resource.player_storage.Criteria other) { + if (other == net.averak.gsync.schema.protobuf.resource.player_storage.Criteria.getDefaultInstance()) + return this; + if (!other.getPattern().isEmpty()) { + pattern_ = other.pattern_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (other.matchingPattern_ != 0) { + setMatchingPatternValue(other.getMatchingPatternValue()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0 : + done = true; + break; + case 10 : { + pattern_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 16 : { + matchingPattern_ = input.readEnum(); + bitField0_ |= 0x00000002; + break; + } // case 16 + default : { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private java.lang.Object pattern_ = ""; + /** + * string pattern = 1; + * + * @return The pattern. + */ + public java.lang.String getPattern() { + java.lang.Object ref = pattern_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + pattern_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string pattern = 1; + * + * @return The bytes for pattern. + */ + public com.google.protobuf.ByteString getPatternBytes() { + java.lang.Object ref = pattern_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + pattern_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string pattern = 1; + * + * @param value + * The pattern to set. + * @return This builder for chaining. + */ + public Builder setPattern(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + pattern_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * string pattern = 1; + * + * @return This builder for chaining. + */ + public Builder clearPattern() { + pattern_ = getDefaultInstance().getPattern(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * string pattern = 1; + * + * @param value + * The bytes for pattern to set. + * @return This builder for chaining. + */ + public Builder setPatternBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + pattern_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private int matchingPattern_ = 0; + /** + * .gsync.resource.player_storage.Criteria.MatchingType matching_pattern = 2; + * + * @return The enum numeric value on the wire for matchingPattern. + */ + @java.lang.Override + public int getMatchingPatternValue() { + return matchingPattern_; + } + /** + * .gsync.resource.player_storage.Criteria.MatchingType matching_pattern = 2; + * + * @param value + * The enum numeric value on the wire for matchingPattern to set. + * @return This builder for chaining. + */ + public Builder setMatchingPatternValue(int value) { + matchingPattern_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * .gsync.resource.player_storage.Criteria.MatchingType matching_pattern = 2; + * + * @return The matchingPattern. + */ + @java.lang.Override + public net.averak.gsync.schema.protobuf.resource.player_storage.Criteria.MatchingType getMatchingPattern() { + net.averak.gsync.schema.protobuf.resource.player_storage.Criteria.MatchingType result = net.averak.gsync.schema.protobuf.resource.player_storage.Criteria.MatchingType + .forNumber(matchingPattern_); + return result == null + ? net.averak.gsync.schema.protobuf.resource.player_storage.Criteria.MatchingType.UNRECOGNIZED + : result; + } + /** + * .gsync.resource.player_storage.Criteria.MatchingType matching_pattern = 2; + * + * @param value + * The matchingPattern to set. + * @return This builder for chaining. + */ + public Builder setMatchingPattern( + net.averak.gsync.schema.protobuf.resource.player_storage.Criteria.MatchingType value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + matchingPattern_ = value.getNumber(); + onChanged(); + return this; + } + /** + * .gsync.resource.player_storage.Criteria.MatchingType matching_pattern = 2; + * + * @return This builder for chaining. + */ + public Builder clearMatchingPattern() { + bitField0_ = (bitField0_ & ~0x00000002); + matchingPattern_ = 0; + onChanged(); + return this; + } + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:gsync.resource.player_storage.Criteria) + } + + // @@protoc_insertion_point(class_scope:gsync.resource.player_storage.Criteria) + private static final net.averak.gsync.schema.protobuf.resource.player_storage.Criteria DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new net.averak.gsync.schema.protobuf.resource.player_storage.Criteria(); + } + + public static net.averak.gsync.schema.protobuf.resource.player_storage.Criteria getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Criteria parsePartialFrom(com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public net.averak.gsync.schema.protobuf.resource.player_storage.Criteria getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} diff --git a/protobuf/src/main/java/net/averak/gsync/schema/protobuf/resource/player_storage/CriteriaOrBuilder.java b/protobuf/src/main/java/net/averak/gsync/schema/protobuf/resource/player_storage/CriteriaOrBuilder.java new file mode 100644 index 0000000..b87e3ea --- /dev/null +++ b/protobuf/src/main/java/net/averak/gsync/schema/protobuf/resource/player_storage/CriteriaOrBuilder.java @@ -0,0 +1,37 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: resource/player_storage.proto + +// Protobuf Java Version: 3.25.1 +package net.averak.gsync.schema.protobuf.resource.player_storage; + +public interface CriteriaOrBuilder + extends + // @@protoc_insertion_point(interface_extends:gsync.resource.player_storage.Criteria) + com.google.protobuf.MessageOrBuilder { + + /** + * string pattern = 1; + * + * @return The pattern. + */ + java.lang.String getPattern(); + /** + * string pattern = 1; + * + * @return The bytes for pattern. + */ + com.google.protobuf.ByteString getPatternBytes(); + + /** + * .gsync.resource.player_storage.Criteria.MatchingType matching_pattern = 2; + * + * @return The enum numeric value on the wire for matchingPattern. + */ + int getMatchingPatternValue(); + /** + * .gsync.resource.player_storage.Criteria.MatchingType matching_pattern = 2; + * + * @return The matchingPattern. + */ + net.averak.gsync.schema.protobuf.resource.player_storage.Criteria.MatchingType getMatchingPattern(); +} diff --git a/protobuf/src/main/java/net/averak/gsync/schema/protobuf/resource/player_storage/Entry.java b/protobuf/src/main/java/net/averak/gsync/schema/protobuf/resource/player_storage/Entry.java new file mode 100644 index 0000000..1070592 --- /dev/null +++ b/protobuf/src/main/java/net/averak/gsync/schema/protobuf/resource/player_storage/Entry.java @@ -0,0 +1,605 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: resource/player_storage.proto + +// Protobuf Java Version: 3.25.1 +package net.averak.gsync.schema.protobuf.resource.player_storage; + +/** + * Protobuf type {@code gsync.resource.player_storage.Entry} + */ +public final class Entry extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:gsync.resource.player_storage.Entry) + EntryOrBuilder { + private static final long serialVersionUID = 0L; + // Use Entry.newBuilder() to construct. + private Entry(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private Entry() { + key_ = ""; + value_ = com.google.protobuf.ByteString.EMPTY; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new Entry(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return net.averak.gsync.schema.protobuf.resource.player_storage.PlayerStorage.internal_static_gsync_resource_player_storage_Entry_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { + return net.averak.gsync.schema.protobuf.resource.player_storage.PlayerStorage.internal_static_gsync_resource_player_storage_Entry_fieldAccessorTable + .ensureFieldAccessorsInitialized(net.averak.gsync.schema.protobuf.resource.player_storage.Entry.class, + net.averak.gsync.schema.protobuf.resource.player_storage.Entry.Builder.class); + } + + public static final int KEY_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private volatile java.lang.Object key_ = ""; + /** + * string key = 1; + * + * @return The key. + */ + @java.lang.Override + public java.lang.String getKey() { + java.lang.Object ref = key_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + key_ = s; + return s; + } + } + /** + * string key = 1; + * + * @return The bytes for key. + */ + @java.lang.Override + public com.google.protobuf.ByteString getKeyBytes() { + java.lang.Object ref = key_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + key_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int VALUE_FIELD_NUMBER = 2; + private com.google.protobuf.ByteString value_ = com.google.protobuf.ByteString.EMPTY; + /** + *
+	 * 最大 100 KiB まで格納できる
+	 * 
+ * + * bytes value = 2; + * + * @return The value. + */ + @java.lang.Override + public com.google.protobuf.ByteString getValue() { + return value_; + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) + return true; + if (isInitialized == 0) + return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(key_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, key_); + } + if (!value_.isEmpty()) { + output.writeBytes(2, value_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) + return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(key_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, key_); + } + if (!value_.isEmpty()) { + size += com.google.protobuf.CodedOutputStream.computeBytesSize(2, value_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof net.averak.gsync.schema.protobuf.resource.player_storage.Entry)) { + return super.equals(obj); + } + net.averak.gsync.schema.protobuf.resource.player_storage.Entry other = (net.averak.gsync.schema.protobuf.resource.player_storage.Entry) obj; + + if (!getKey().equals(other.getKey())) + return false; + if (!getValue().equals(other.getValue())) + return false; + if (!getUnknownFields().equals(other.getUnknownFields())) + return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + KEY_FIELD_NUMBER; + hash = (53 * hash) + getKey().hashCode(); + hash = (37 * hash) + VALUE_FIELD_NUMBER; + hash = (53 * hash) + getValue().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static net.averak.gsync.schema.protobuf.resource.player_storage.Entry parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static net.averak.gsync.schema.protobuf.resource.player_storage.Entry parseFrom(java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static net.averak.gsync.schema.protobuf.resource.player_storage.Entry parseFrom( + com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static net.averak.gsync.schema.protobuf.resource.player_storage.Entry parseFrom( + com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static net.averak.gsync.schema.protobuf.resource.player_storage.Entry parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static net.averak.gsync.schema.protobuf.resource.player_storage.Entry parseFrom(byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static net.averak.gsync.schema.protobuf.resource.player_storage.Entry parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + public static net.averak.gsync.schema.protobuf.resource.player_storage.Entry parseFrom(java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input, extensionRegistry); + } + + public static net.averak.gsync.schema.protobuf.resource.player_storage.Entry parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static net.averak.gsync.schema.protobuf.resource.player_storage.Entry parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static net.averak.gsync.schema.protobuf.resource.player_storage.Entry parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + public static net.averak.gsync.schema.protobuf.resource.player_storage.Entry parseFrom( + com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(net.averak.gsync.schema.protobuf.resource.player_storage.Entry prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code gsync.resource.player_storage.Entry} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:gsync.resource.player_storage.Entry) + net.averak.gsync.schema.protobuf.resource.player_storage.EntryOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return net.averak.gsync.schema.protobuf.resource.player_storage.PlayerStorage.internal_static_gsync_resource_player_storage_Entry_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { + return net.averak.gsync.schema.protobuf.resource.player_storage.PlayerStorage.internal_static_gsync_resource_player_storage_Entry_fieldAccessorTable + .ensureFieldAccessorsInitialized( + net.averak.gsync.schema.protobuf.resource.player_storage.Entry.class, + net.averak.gsync.schema.protobuf.resource.player_storage.Entry.Builder.class); + } + + // Construct using + // net.averak.gsync.schema.protobuf.resource.player_storage.Entry.newBuilder() + private Builder() { + + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + key_ = ""; + value_ = com.google.protobuf.ByteString.EMPTY; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return net.averak.gsync.schema.protobuf.resource.player_storage.PlayerStorage.internal_static_gsync_resource_player_storage_Entry_descriptor; + } + + @java.lang.Override + public net.averak.gsync.schema.protobuf.resource.player_storage.Entry getDefaultInstanceForType() { + return net.averak.gsync.schema.protobuf.resource.player_storage.Entry.getDefaultInstance(); + } + + @java.lang.Override + public net.averak.gsync.schema.protobuf.resource.player_storage.Entry build() { + net.averak.gsync.schema.protobuf.resource.player_storage.Entry result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public net.averak.gsync.schema.protobuf.resource.player_storage.Entry buildPartial() { + net.averak.gsync.schema.protobuf.resource.player_storage.Entry result = new net.averak.gsync.schema.protobuf.resource.player_storage.Entry( + this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0(net.averak.gsync.schema.protobuf.resource.player_storage.Entry result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.key_ = key_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.value_ = value_; + } + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + @java.lang.Override + public Builder setField(com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, int index, + java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof net.averak.gsync.schema.protobuf.resource.player_storage.Entry) { + return mergeFrom((net.averak.gsync.schema.protobuf.resource.player_storage.Entry) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(net.averak.gsync.schema.protobuf.resource.player_storage.Entry other) { + if (other == net.averak.gsync.schema.protobuf.resource.player_storage.Entry.getDefaultInstance()) + return this; + if (!other.getKey().isEmpty()) { + key_ = other.key_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (other.getValue() != com.google.protobuf.ByteString.EMPTY) { + setValue(other.getValue()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0 : + done = true; + break; + case 10 : { + key_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18 : { + value_ = input.readBytes(); + bitField0_ |= 0x00000002; + break; + } // case 18 + default : { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private java.lang.Object key_ = ""; + /** + * string key = 1; + * + * @return The key. + */ + public java.lang.String getKey() { + java.lang.Object ref = key_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + key_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string key = 1; + * + * @return The bytes for key. + */ + public com.google.protobuf.ByteString getKeyBytes() { + java.lang.Object ref = key_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + key_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string key = 1; + * + * @param value + * The key to set. + * @return This builder for chaining. + */ + public Builder setKey(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + key_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * string key = 1; + * + * @return This builder for chaining. + */ + public Builder clearKey() { + key_ = getDefaultInstance().getKey(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * string key = 1; + * + * @param value + * The bytes for key to set. + * @return This builder for chaining. + */ + public Builder setKeyBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + key_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private com.google.protobuf.ByteString value_ = com.google.protobuf.ByteString.EMPTY; + /** + *
+		 * 最大 100 KiB まで格納できる
+		 * 
+ * + * bytes value = 2; + * + * @return The value. + */ + @java.lang.Override + public com.google.protobuf.ByteString getValue() { + return value_; + } + /** + *
+		 * 最大 100 KiB まで格納できる
+		 * 
+ * + * bytes value = 2; + * + * @param value + * The value to set. + * @return This builder for chaining. + */ + public Builder setValue(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + value_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + *
+		 * 最大 100 KiB まで格納できる
+		 * 
+ * + * bytes value = 2; + * + * @return This builder for chaining. + */ + public Builder clearValue() { + bitField0_ = (bitField0_ & ~0x00000002); + value_ = getDefaultInstance().getValue(); + onChanged(); + return this; + } + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:gsync.resource.player_storage.Entry) + } + + // @@protoc_insertion_point(class_scope:gsync.resource.player_storage.Entry) + private static final net.averak.gsync.schema.protobuf.resource.player_storage.Entry DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new net.averak.gsync.schema.protobuf.resource.player_storage.Entry(); + } + + public static net.averak.gsync.schema.protobuf.resource.player_storage.Entry getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Entry parsePartialFrom(com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public net.averak.gsync.schema.protobuf.resource.player_storage.Entry getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} diff --git a/protobuf/src/main/java/net/averak/gsync/schema/protobuf/resource/player_storage/EntryOrBuilder.java b/protobuf/src/main/java/net/averak/gsync/schema/protobuf/resource/player_storage/EntryOrBuilder.java new file mode 100644 index 0000000..8a5c3f2 --- /dev/null +++ b/protobuf/src/main/java/net/averak/gsync/schema/protobuf/resource/player_storage/EntryOrBuilder.java @@ -0,0 +1,35 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: resource/player_storage.proto + +// Protobuf Java Version: 3.25.1 +package net.averak.gsync.schema.protobuf.resource.player_storage; + +public interface EntryOrBuilder + extends + // @@protoc_insertion_point(interface_extends:gsync.resource.player_storage.Entry) + com.google.protobuf.MessageOrBuilder { + + /** + * string key = 1; + * + * @return The key. + */ + java.lang.String getKey(); + /** + * string key = 1; + * + * @return The bytes for key. + */ + com.google.protobuf.ByteString getKeyBytes(); + + /** + *
+	 * 最大 100 KiB まで格納できる
+	 * 
+ * + * bytes value = 2; + * + * @return The value. + */ + com.google.protobuf.ByteString getValue(); +} diff --git a/protobuf/src/main/java/net/averak/gsync/schema/protobuf/resource/player_storage/PlayerStorage.java b/protobuf/src/main/java/net/averak/gsync/schema/protobuf/resource/player_storage/PlayerStorage.java new file mode 100644 index 0000000..8f699a6 --- /dev/null +++ b/protobuf/src/main/java/net/averak/gsync/schema/protobuf/resource/player_storage/PlayerStorage.java @@ -0,0 +1,46 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: resource/player_storage.proto + +// Protobuf Java Version: 3.25.1 +package net.averak.gsync.schema.protobuf.resource.player_storage; + +public final class PlayerStorage { + private PlayerStorage() { + } + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistryLite registry) { + } + + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions((com.google.protobuf.ExtensionRegistryLite) registry); + } + static final com.google.protobuf.Descriptors.Descriptor internal_static_gsync_resource_player_storage_Entry_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_gsync_resource_player_storage_Entry_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor internal_static_gsync_resource_player_storage_Criteria_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_gsync_resource_player_storage_Criteria_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + return descriptor; + } + private static com.google.protobuf.Descriptors.FileDescriptor descriptor; + static { + java.lang.String[] descriptorData = {"\n\035resource/player_storage.proto\022\035gsync.r" + + "esource.player_storage\"#\n\005Entry\022\013\n\003key\030\001" + + " \001(\t\022\r\n\005value\030\002 \001(\014\"\237\001\n\010Criteria\022\017\n\007patt" + + "ern\030\001 \001(\t\022N\n\020matching_pattern\030\002 \001(\01624.gs" + + "ync.resource.player_storage.Criteria.Mat" + "chingType\"2\n\014MatchingType\022\017\n\013EXACT_MATCH" + + "\020\000\022\021\n\rFORWARD_MATCH\020\001B<\n8net.averak.gsyn" + + "c.schema.protobuf.resource.player_storag" + "eP\001b\006proto3"}; + descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom(descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[]{}); + internal_static_gsync_resource_player_storage_Entry_descriptor = getDescriptor().getMessageTypes().get(0); + internal_static_gsync_resource_player_storage_Entry_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_gsync_resource_player_storage_Entry_descriptor, + new java.lang.String[]{"Key", "Value",}); + internal_static_gsync_resource_player_storage_Criteria_descriptor = getDescriptor().getMessageTypes().get(1); + internal_static_gsync_resource_player_storage_Criteria_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_gsync_resource_player_storage_Criteria_descriptor, + new java.lang.String[]{"Pattern", "MatchingPattern",}); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/app/adapter/src/main/proto/player_api/echo.proto b/schema/protobuf/player_api/echo.proto similarity index 100% rename from app/adapter/src/main/proto/player_api/echo.proto rename to schema/protobuf/player_api/echo.proto diff --git a/app/adapter/src/main/proto/player_api/player_storage.proto b/schema/protobuf/player_api/player_storage.proto similarity index 96% rename from app/adapter/src/main/proto/player_api/player_storage.proto rename to schema/protobuf/player_api/player_storage.proto index 38259b0..04e2b45 100644 --- a/app/adapter/src/main/proto/player_api/player_storage.proto +++ b/schema/protobuf/player_api/player_storage.proto @@ -1,7 +1,6 @@ syntax = "proto3"; package gsync.player_api; -import "google/protobuf/timestamp.proto"; import "resource/player_storage.proto"; option java_multiple_files = true; diff --git a/app/adapter/src/main/proto/resource/player_storage.proto b/schema/protobuf/resource/player_storage.proto similarity index 91% rename from app/adapter/src/main/proto/resource/player_storage.proto rename to schema/protobuf/resource/player_storage.proto index d791669..ac0a546 100644 --- a/app/adapter/src/main/proto/resource/player_storage.proto +++ b/schema/protobuf/resource/player_storage.proto @@ -1,8 +1,6 @@ syntax = "proto3"; package gsync.resource.player_storage; -import "google/protobuf/timestamp.proto"; - option java_multiple_files = true; option java_package = "net.averak.gsync.schema.protobuf.resource.player_storage"; diff --git a/settings.gradle b/settings.gradle index 9a30d66..ddb7ef8 100644 --- a/settings.gradle +++ b/settings.gradle @@ -6,6 +6,7 @@ include(":domain") include(":infrastructure") include(":usecase") include(":testkit") +include(":protobuf") project(":adapter").projectDir = file("app/adapter") project(":core").projectDir = file("app/core") diff --git a/src/main/resources/application.yaml b/src/main/resources/application.yaml index 3148c40..23312ca 100644 --- a/src/main/resources/application.yaml +++ b/src/main/resources/application.yaml @@ -22,6 +22,7 @@ spring: jackson: date-format: yyyy-MM-dd'T'HH:mm:ss'Z' time-zone: UTC + main: allow-bean-definition-overriding: true flyway: @@ -41,10 +42,6 @@ server: charset: UTF-8 force: true -grpc: - port: 6565 - enable-reflection: ${gsync.debug:false} - mybatis: configuration: map-underscore-to-camel-case: true @@ -56,3 +53,6 @@ mybatis: gsync: version: ${git.commit.id.describe} debug: ${IS_DEBUG:false} + grpc: + enable-reflection: ${gsync.debug} + port: ${GRPC_PORT:6565} diff --git a/src/test/resources/application-test.yaml b/src/test/resources/application-test.yaml index d436fcf..e6d9a91 100644 --- a/src/test/resources/application-test.yaml +++ b/src/test/resources/application-test.yaml @@ -2,8 +2,8 @@ spring: data: redis: database: 1 - flyway: - clean-disabled: false gsync: debug: true + grpc: + port: ${random.int[49152,65535]} diff --git a/testkit/src/main/groovy/net/averak/gsync/testkit/AbstractDatabaseSpec.groovy b/testkit/src/main/groovy/net/averak/gsync/testkit/AbstractDatabaseSpec.groovy index c17a047..d723a70 100644 --- a/testkit/src/main/groovy/net/averak/gsync/testkit/AbstractDatabaseSpec.groovy +++ b/testkit/src/main/groovy/net/averak/gsync/testkit/AbstractDatabaseSpec.groovy @@ -5,12 +5,8 @@ import jakarta.annotation.PostConstruct import net.averak.gsync.infrastructure.redis.RedisClient import org.springframework.beans.factory.annotation.Autowired import org.springframework.boot.autoconfigure.EnableAutoConfiguration -import org.springframework.transaction.annotation.Transactional import spock.lang.Shared -// @Transactional を付けるとテストケースがトランザクション内で実行され、テストケース実行後にロールバックされる -// https://spring.pleiades.io/spring-framework/reference/testing/testcontext-framework/tx.html#testcontext-tx-enabling-transactions -@Transactional @EnableAutoConfiguration abstract class AbstractDatabaseSpec extends AbstractSpec { @@ -29,5 +25,15 @@ abstract class AbstractDatabaseSpec extends AbstractSpec { void cleanup() { redis.flushdb() + + // テストクラスに @Transactional を付けても何故かテストケース実行後にロールバックされないので、手動でクリーンアップする + // https://spring.pleiades.io/spring-framework/reference/testing/testcontext-framework/tx.html#testcontext-tx-enabling-transactions + sql.execute("DELETE FROM gsync_echo WHERE TRUE") + sql.execute("DELETE FROM gsync_friend_setting_master WHERE TRUE") + sql.execute("DELETE FROM gsync_game WHERE TRUE") + sql.execute("DELETE FROM gsync_master_version WHERE TRUE") + sql.execute("DELETE FROM gsync_operator WHERE TRUE") + sql.execute("DELETE FROM gsync_player WHERE TRUE") + sql.execute("DELETE FROM gsync_required_client_version WHERE TRUE") } } diff --git a/testkit/src/main/groovy/net/averak/gsync/testkit/AbstractSpec.groovy b/testkit/src/main/groovy/net/averak/gsync/testkit/AbstractSpec.groovy index 4d7d193..e5ce8d8 100644 --- a/testkit/src/main/groovy/net/averak/gsync/testkit/AbstractSpec.groovy +++ b/testkit/src/main/groovy/net/averak/gsync/testkit/AbstractSpec.groovy @@ -1,6 +1,7 @@ package net.averak.gsync.testkit import net.averak.gsync.Entrypoint +import net.averak.gsync.testkit.api.grpc.GrpcTester import net.averak.gsync.testkit.api.rest.RestTester import org.spockframework.spring.EnableSharedInjection import org.springframework.beans.factory.annotation.Autowired @@ -18,4 +19,7 @@ abstract class AbstractSpec extends Specification { @Shared RestTester restTester + @Autowired + @Shared + GrpcTester grpcTester } diff --git a/testkit/src/main/kotlin/net/averak/gsync/testkit/api/grpc/GrpcTester.kt b/testkit/src/main/kotlin/net/averak/gsync/testkit/api/grpc/GrpcTester.kt index b62d771..8662675 100644 --- a/testkit/src/main/kotlin/net/averak/gsync/testkit/api/grpc/GrpcTester.kt +++ b/testkit/src/main/kotlin/net/averak/gsync/testkit/api/grpc/GrpcTester.kt @@ -1,6 +1,28 @@ package net.averak.gsync.testkit.api.grpc +import io.grpc.ManagedChannel +import io.grpc.ManagedChannelBuilder +import jakarta.annotation.PostConstruct +import net.averak.gsync.core.config.Config +import net.averak.gsync.schema.protobuf.player_api.EchoGrpc +import net.averak.gsync.schema.protobuf.player_api.PlayerStorageGrpc import org.springframework.stereotype.Component @Component -class GrpcTester +class GrpcTester( + private val config: Config, +) { + + private lateinit var channel: ManagedChannel + + lateinit var echo: EchoGrpc.EchoBlockingStub + + lateinit var playerStorage: PlayerStorageGrpc.PlayerStorageBlockingStub + + @PostConstruct + fun init() { + channel = ManagedChannelBuilder.forAddress("localhost", config.grpc.port).usePlaintext().build() + echo = EchoGrpc.newBlockingStub(channel) + playerStorage = PlayerStorageGrpc.newBlockingStub(channel) + } +} From d9f65cfec39e3eba7308ea3e2f49f91e1906b62b Mon Sep 17 00:00:00 2001 From: averak Date: Mon, 15 Jan 2024 02:58:53 +0900 Subject: [PATCH 10/13] =?UTF-8?q?refs=20#11=20player-api=E3=80=81admin-api?= =?UTF-8?q?=E3=81=AE=E8=A8=AD=E5=AE=9A=E9=A0=85=E7=9B=AE=E3=82=92=E6=95=B4?= =?UTF-8?q?=E7=90=86=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...pcServerConfig.kt => PlayerApiServerConfig.kt} | 6 +++--- .../kotlin/net/averak/gsync/core/config/Config.kt | 15 +++++++++++---- src/main/resources/application.yaml | 10 +++++----- src/test/resources/application-test.yaml | 2 +- .../averak/gsync/testkit/api/grpc/GrpcTester.kt | 2 +- 5 files changed, 21 insertions(+), 14 deletions(-) rename app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/config/{GrpcServerConfig.kt => PlayerApiServerConfig.kt} (82%) diff --git a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/config/GrpcServerConfig.kt b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/config/PlayerApiServerConfig.kt similarity index 82% rename from app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/config/GrpcServerConfig.kt rename to app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/config/PlayerApiServerConfig.kt index 62afada..7ffe1a8 100644 --- a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/config/GrpcServerConfig.kt +++ b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/config/PlayerApiServerConfig.kt @@ -8,15 +8,15 @@ import net.averak.gsync.core.config.Config import org.springframework.context.annotation.Configuration @Configuration -open class GrpcServerConfig( +open class PlayerApiServerConfig( private val config: Config, private val handlers: List, ) { @PostConstruct fun start() { - val serverBuilder = ServerBuilder.forPort(config.grpc.port) - if (config.grpc.enableReflection) { + val serverBuilder = ServerBuilder.forPort(config.playerApi.port) + if (config.debug) { serverBuilder.addService(ProtoReflectionService.newInstance()) } handlers.forEach { diff --git a/app/core/src/main/kotlin/net/averak/gsync/core/config/Config.kt b/app/core/src/main/kotlin/net/averak/gsync/core/config/Config.kt index f505085..b5c063a 100644 --- a/app/core/src/main/kotlin/net/averak/gsync/core/config/Config.kt +++ b/app/core/src/main/kotlin/net/averak/gsync/core/config/Config.kt @@ -12,14 +12,21 @@ open class Config { var debug: Boolean = false - lateinit var grpc: Grpc + lateinit var playerApi: PlayerApi + + lateinit var adminApi: AdminApi @Configuration - @ConfigurationProperties("gsync.grpc") - open class Grpc { + @ConfigurationProperties("gsync.player-api") + open class PlayerApi { var port: Int = 0 + } - var enableReflection = false + @Configuration + @ConfigurationProperties("gsync.admin-api") + open class AdminApi { + + var port: Int = 0 } } diff --git a/src/main/resources/application.yaml b/src/main/resources/application.yaml index 23312ca..6d3d9b2 100644 --- a/src/main/resources/application.yaml +++ b/src/main/resources/application.yaml @@ -22,7 +22,6 @@ spring: jackson: date-format: yyyy-MM-dd'T'HH:mm:ss'Z' time-zone: UTC - main: allow-bean-definition-overriding: true flyway: @@ -36,7 +35,7 @@ spring: connect-retries: 5 server: - port: ${PORT:8080} + port: ${gsync.admin-api.port} servlet: encoding: charset: UTF-8 @@ -53,6 +52,7 @@ mybatis: gsync: version: ${git.commit.id.describe} debug: ${IS_DEBUG:false} - grpc: - enable-reflection: ${gsync.debug} - port: ${GRPC_PORT:6565} + player-api: + port: ${PLAYER_API_PORT:8080} + admin-api: + port: ${ADMIN_API_PORT:8081} diff --git a/src/test/resources/application-test.yaml b/src/test/resources/application-test.yaml index e6d9a91..559e27c 100644 --- a/src/test/resources/application-test.yaml +++ b/src/test/resources/application-test.yaml @@ -5,5 +5,5 @@ spring: gsync: debug: true - grpc: + player-api: port: ${random.int[49152,65535]} diff --git a/testkit/src/main/kotlin/net/averak/gsync/testkit/api/grpc/GrpcTester.kt b/testkit/src/main/kotlin/net/averak/gsync/testkit/api/grpc/GrpcTester.kt index 8662675..313aa00 100644 --- a/testkit/src/main/kotlin/net/averak/gsync/testkit/api/grpc/GrpcTester.kt +++ b/testkit/src/main/kotlin/net/averak/gsync/testkit/api/grpc/GrpcTester.kt @@ -21,7 +21,7 @@ class GrpcTester( @PostConstruct fun init() { - channel = ManagedChannelBuilder.forAddress("localhost", config.grpc.port).usePlaintext().build() + channel = ManagedChannelBuilder.forAddress("localhost", config.playerApi.port).usePlaintext().build() echo = EchoGrpc.newBlockingStub(channel) playerStorage = PlayerStorageGrpc.newBlockingStub(channel) } From dcf442081c63f8860692787c89b7b375a6e0a900 Mon Sep 17 00:00:00 2001 From: averak Date: Mon, 15 Jan 2024 03:03:26 +0900 Subject: [PATCH 11/13] =?UTF-8?q?refs=20#87=20.gitattributes=E3=82=92?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitattributes | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.gitattributes b/.gitattributes index afa81c9..8eb72f4 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,4 +1,4 @@ -app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base linguist-generated=true -app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base linguist-generated=true -src/main/resources/dao/base linguist-generated=true -protobuf linguist-generated=true +app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/*.java linguist-generated=true +app/adapter/src/main/java/net/averak/gsync/adapter/dao/mapper/base/*.java linguist-generated=true +src/main/resources/dao/base/*.xml linguist-generated=true +protobuf/** linguist-generated=true From dad4f129bf34b300f0b4f1982fbf72e2e5c613ee Mon Sep 17 00:00:00 2001 From: averak Date: Mon, 15 Jan 2024 15:53:20 +0900 Subject: [PATCH 12/13] =?UTF-8?q?refs=20#85=20gRPC=E3=81=AE=E3=83=A1?= =?UTF-8?q?=E3=82=BF=E3=83=87=E3=83=BC=E3=82=BF=E3=82=92=E6=89=B1=E3=81=88?= =?UTF-8?q?=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../adapter/handler/player_api/EchoHandler.kt | 16 +- .../player_api/PlayerStorageHandler.kt | 47 ++---- .../config/PlayerApiServerConfig.kt | 5 + .../interceptor/MetadataInterceptor.kt | 84 ++++++++++ .../player_api}/pbconv/EchoConverter.kt | 2 +- .../pbconv/LocalDateTimeConverter.kt | 2 +- .../pbconv/PlayerStorageConverter.kt | 2 +- .../scope/GrpcMetadataNotFoundException.kt | 3 + .../handler/player_api/scope/IncomingMD.kt | 14 ++ .../handler/player_api/scope/RequestScope.kt | 32 ++++ .../scope/RequestScopeAttributes.kt | 12 ++ .../handler/player_api/EchoHandler_IT.groovy | 9 +- .../player_api/PlayerStorageHandler_IT.groovy | 150 +++++++++--------- build.gradle.kts | 2 + .../net/averak/gsync/testkit/Assert.groovy | 11 +- .../gsync/testkit/api/grpc/GrpcTester.kt | 42 ++++- 16 files changed, 303 insertions(+), 130 deletions(-) create mode 100644 app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/interceptor/MetadataInterceptor.kt rename app/adapter/src/main/kotlin/net/averak/gsync/adapter/{ => handler/player_api}/pbconv/EchoConverter.kt (87%) rename app/adapter/src/main/kotlin/net/averak/gsync/adapter/{ => handler/player_api}/pbconv/LocalDateTimeConverter.kt (88%) rename app/adapter/src/main/kotlin/net/averak/gsync/adapter/{ => handler/player_api}/pbconv/PlayerStorageConverter.kt (97%) create mode 100644 app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/scope/GrpcMetadataNotFoundException.kt create mode 100644 app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/scope/IncomingMD.kt create mode 100644 app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/scope/RequestScope.kt create mode 100644 app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/scope/RequestScopeAttributes.kt diff --git a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/EchoHandler.kt b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/EchoHandler.kt index 31f6e0f..6560cf8 100644 --- a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/EchoHandler.kt +++ b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/EchoHandler.kt @@ -1,28 +1,20 @@ package net.averak.gsync.adapter.handler.player_api -import net.averak.gsync.adapter.pbconv.EchoConverter -import net.averak.gsync.core.daterange.Dateline -import net.averak.gsync.core.game_context.GameContext +import net.averak.gsync.adapter.handler.player_api.pbconv.EchoConverter +import net.averak.gsync.adapter.handler.player_api.scope.RequestScope import net.averak.gsync.schema.protobuf.player_api.EchoEchoV1 import net.averak.gsync.schema.protobuf.player_api.EchoGrpc import net.averak.gsync.usecase.EchoUsecase import org.springframework.stereotype.Service -import java.time.LocalDateTime -import java.util.* @Service class EchoHandler( + private val requestScope: RequestScope, private val echoUsecase: EchoUsecase, ) : EchoGrpc.EchoImplBase() { override fun echoV1(request: EchoEchoV1.Request, responseObserver: io.grpc.stub.StreamObserver) { - val gctx = GameContext( - masterVersion = UUID.randomUUID(), - idempotencyKey = UUID.randomUUID(), - dateline = Dateline.DEFAULT, - currentTime = LocalDateTime.now(), - ) - val result = echoUsecase.echo(gctx, request.message) + val result = echoUsecase.echo(requestScope.gctx, request.message) responseObserver.onNext(EchoConverter.toPb(result)) responseObserver.onCompleted() diff --git a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/PlayerStorageHandler.kt b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/PlayerStorageHandler.kt index e7f5b55..7714cbc 100644 --- a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/PlayerStorageHandler.kt +++ b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/PlayerStorageHandler.kt @@ -1,34 +1,27 @@ package net.averak.gsync.adapter.handler.player_api import io.grpc.stub.StreamObserver -import net.averak.gsync.adapter.pbconv.PlayerStorageConverter -import net.averak.gsync.core.daterange.Dateline -import net.averak.gsync.core.game_context.GameContext +import net.averak.gsync.adapter.handler.player_api.pbconv.PlayerStorageConverter +import net.averak.gsync.adapter.handler.player_api.scope.RequestScope import net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1 import net.averak.gsync.schema.protobuf.player_api.PlayerStorageGrpc import net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1 import net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1 import net.averak.gsync.usecase.PlayerStorageUsecase import org.springframework.stereotype.Service -import java.time.LocalDateTime import java.util.* @Service class PlayerStorageHandler( + private val requestScope: RequestScope, private val playerStorageUsecase: PlayerStorageUsecase, ) : PlayerStorageGrpc.PlayerStorageImplBase() { override fun searchV1(request: PlayerStorageSearchV1.Request, responseObserver: StreamObserver) { - val gctx = GameContext( - masterVersion = UUID.randomUUID(), - idempotencyKey = UUID.randomUUID(), - dateline = Dateline.DEFAULT, - currentTime = LocalDateTime.now(), - ) val result = playerStorageUsecase.search( - gctx, - UUID.randomUUID(), - UUID.randomUUID(), + requestScope.gctx, + requestScope.playerID, + requestScope.gameID, PlayerStorageConverter.fromPb(request.criteria), ) @@ -37,16 +30,10 @@ class PlayerStorageHandler( } override fun setV1(request: PlayerStorageSetV1.Request, responseObserver: StreamObserver) { - val gctx = GameContext( - masterVersion = UUID.randomUUID(), - idempotencyKey = UUID.randomUUID(), - dateline = Dateline.DEFAULT, - currentTime = LocalDateTime.now(), - ) val result = playerStorageUsecase.set( - gctx, - UUID.randomUUID(), - UUID.randomUUID(), + requestScope.gctx, + requestScope.playerID, + requestScope.gameID, PlayerStorageConverter.fromPb(request.entry), UUID.fromString(request.previousRevision), ) @@ -56,24 +43,16 @@ class PlayerStorageHandler( } override fun clearV1(request: PlayerStorageClearV1.Request, responseObserver: StreamObserver) { - val gctx = GameContext( - masterVersion = UUID.randomUUID(), - idempotencyKey = UUID.randomUUID(), - dateline = Dateline.DEFAULT, - currentTime = LocalDateTime.now(), - ) val result = playerStorageUsecase.clear( - gctx, - UUID.randomUUID(), - UUID.randomUUID(), + requestScope.gctx, + requestScope.playerID, + requestScope.gameID, UUID.fromString(request.previousRevision), PlayerStorageConverter.fromPb(request.criteria), ) responseObserver.onNext( - PlayerStorageClearV1.Response.newBuilder() - .setNextRevision(result.toString()) - .build(), + PlayerStorageClearV1.Response.newBuilder().setNextRevision(result.toString()).build(), ) super.clearV1(request, responseObserver) } diff --git a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/config/PlayerApiServerConfig.kt b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/config/PlayerApiServerConfig.kt index 7ffe1a8..0c466b9 100644 --- a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/config/PlayerApiServerConfig.kt +++ b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/config/PlayerApiServerConfig.kt @@ -2,6 +2,7 @@ package net.averak.gsync.adapter.handler.player_api.config import io.grpc.BindableService import io.grpc.ServerBuilder +import io.grpc.ServerInterceptor import io.grpc.protobuf.services.ProtoReflectionService import jakarta.annotation.PostConstruct import net.averak.gsync.core.config.Config @@ -11,6 +12,7 @@ import org.springframework.context.annotation.Configuration open class PlayerApiServerConfig( private val config: Config, private val handlers: List, + private val interceptors: List, ) { @PostConstruct @@ -22,6 +24,9 @@ open class PlayerApiServerConfig( handlers.forEach { serverBuilder.addService(it) } + interceptors.forEach { + serverBuilder.intercept(it) + } serverBuilder.build().start() } } diff --git a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/interceptor/MetadataInterceptor.kt b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/interceptor/MetadataInterceptor.kt new file mode 100644 index 0000000..6b4ac0d --- /dev/null +++ b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/interceptor/MetadataInterceptor.kt @@ -0,0 +1,84 @@ +package net.averak.gsync.adapter.handler.player_api.interceptor + +import com.google.common.annotations.VisibleForTesting +import io.grpc.* +import net.averak.gsync.adapter.dao.dto.base.MasterVersionExample +import net.averak.gsync.adapter.dao.mapper.base.MasterVersionBaseMapper +import net.averak.gsync.adapter.handler.player_api.scope.IncomingMD +import net.averak.gsync.adapter.handler.player_api.scope.RequestScope +import net.averak.gsync.adapter.handler.player_api.scope.RequestScopeAttributes +import net.averak.gsync.core.daterange.Dateline +import net.averak.gsync.core.exception.ErrorCode +import net.averak.gsync.core.exception.GsyncException +import net.averak.gsync.core.game_context.GameContext +import org.springframework.stereotype.Component +import java.time.LocalDateTime +import java.util.* + +@Component +class MetadataInterceptor( + private val requestScope: RequestScope, + private val masterVersionMapper: MasterVersionBaseMapper, +) : ServerInterceptor { + + override fun interceptCall( + call: ServerCall, + headers: Metadata, + next: ServerCallHandler, + ): ServerCall.Listener { + // TODO: デバッグモードの場合のみ、デバッグ用のメタデータを読み取る + val spoofingMasterVersion = + headers[Metadata.Key.of(IncomingMD.DEBUG_SPOOFING_MASTER_VERSION.key, Metadata.ASCII_STRING_MARSHALLER)]?.let { + UUID.fromString(it) + } + val idempotencyKey = + headers[Metadata.Key.of(IncomingMD.IDEMPOTENCY_KEY.key, Metadata.ASCII_STRING_MARSHALLER)]?.let { + UUID.fromString(it) + } + val spoofingCurrentTime = + headers[Metadata.Key.of(IncomingMD.DEBUG_SPOOFING_CURRENT_TIME.key, Metadata.ASCII_STRING_MARSHALLER)]?.let { + LocalDateTime.parse(it) + } + val gctx = GameContext( + getEnabledMasterVersion(spoofingMasterVersion), + // クライアントが Idempotency-Key を必ず設定してくるとは限らないので、未設定の場合はサーバ側でユニークキーを発行し、毎回異なるリクエストとして扱う + idempotencyKey ?: UUID.randomUUID(), + Dateline.DEFAULT, + spoofingCurrentTime ?: LocalDateTime.now(), + ) + + val playerID = headers[Metadata.Key.of(IncomingMD.DEBUG_SPOOFING_PLAYER_ID.key, Metadata.ASCII_STRING_MARSHALLER)]?.let { + UUID.fromString(it) + } + val gameID = headers[Metadata.Key.of(IncomingMD.GAME_ID.key, Metadata.ASCII_STRING_MARSHALLER)]?.let { + UUID.fromString(it) + } + + val context = Context.current() + .withValue(RequestScopeAttributes.GAME_CONTEXT, gctx) + .withValue(RequestScopeAttributes.PLAYER_ID, playerID) + .withValue(RequestScopeAttributes.GAME_ID, gameID) + return Contexts.interceptCall(context, call, headers, next) + } + + @Throws(GsyncException::class) + @VisibleForTesting + fun getEnabledMasterVersion(spoofingMasterVersion: UUID?): UUID { + return if (spoofingMasterVersion == null) { + val dtos = masterVersionMapper.selectByExample( + MasterVersionExample().apply { + createCriteria().andIsEnabledEqualTo(true) + }, + ) + if (dtos.isEmpty()) { + throw GsyncException(ErrorCode.ENABLED_MASTER_VERSION_DEFINITION_IS_NOT_FOUND) + } + if (dtos.size > 1) { + throw GsyncException(ErrorCode.MULTIPLE_ENABLED_MASTER_VERSIONS_ARE_DEFINED) + } + UUID.fromString(dtos[0].version) + } else { + spoofingMasterVersion + } + } +} diff --git a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/pbconv/EchoConverter.kt b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/pbconv/EchoConverter.kt similarity index 87% rename from app/adapter/src/main/kotlin/net/averak/gsync/adapter/pbconv/EchoConverter.kt rename to app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/pbconv/EchoConverter.kt index 6a3589c..f2f91c0 100644 --- a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/pbconv/EchoConverter.kt +++ b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/pbconv/EchoConverter.kt @@ -1,4 +1,4 @@ -package net.averak.gsync.adapter.pbconv +package net.averak.gsync.adapter.handler.player_api.pbconv import net.averak.gsync.domain.model.Echo import net.averak.gsync.schema.protobuf.player_api.EchoEchoV1 diff --git a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/pbconv/LocalDateTimeConverter.kt b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/pbconv/LocalDateTimeConverter.kt similarity index 88% rename from app/adapter/src/main/kotlin/net/averak/gsync/adapter/pbconv/LocalDateTimeConverter.kt rename to app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/pbconv/LocalDateTimeConverter.kt index 1faffb2..17d914b 100644 --- a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/pbconv/LocalDateTimeConverter.kt +++ b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/pbconv/LocalDateTimeConverter.kt @@ -1,4 +1,4 @@ -package net.averak.gsync.adapter.pbconv +package net.averak.gsync.adapter.handler.player_api.pbconv import com.google.protobuf.Timestamp import java.time.LocalDateTime diff --git a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/pbconv/PlayerStorageConverter.kt b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/pbconv/PlayerStorageConverter.kt similarity index 97% rename from app/adapter/src/main/kotlin/net/averak/gsync/adapter/pbconv/PlayerStorageConverter.kt rename to app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/pbconv/PlayerStorageConverter.kt index 55faafa..d5cd9ae 100644 --- a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/pbconv/PlayerStorageConverter.kt +++ b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/pbconv/PlayerStorageConverter.kt @@ -1,4 +1,4 @@ -package net.averak.gsync.adapter.pbconv +package net.averak.gsync.adapter.handler.player_api.pbconv import com.google.protobuf.ByteString import net.averak.gsync.domain.model.PlayerStorage diff --git a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/scope/GrpcMetadataNotFoundException.kt b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/scope/GrpcMetadataNotFoundException.kt new file mode 100644 index 0000000..9f09bb9 --- /dev/null +++ b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/scope/GrpcMetadataNotFoundException.kt @@ -0,0 +1,3 @@ +package net.averak.gsync.adapter.handler.player_api.scope + +class GrpcMetadataNotFoundException(message: String) : RuntimeException(message) diff --git a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/scope/IncomingMD.kt b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/scope/IncomingMD.kt new file mode 100644 index 0000000..9c78389 --- /dev/null +++ b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/scope/IncomingMD.kt @@ -0,0 +1,14 @@ +package net.averak.gsync.adapter.handler.player_api.scope + +enum class IncomingMD(val key: String) { + + CLIENT_VERSION("x-client-version"), + PLATFORM("x-platform"), + IDEMPOTENCY_KEY("x-idempotency-key"), + GAME_ID("x-game-id"), + + // 以下はデバッグモードの場合のみ有効になる + DEBUG_SPOOFING_PLAYER_ID("x-debug-spoofing-player-id"), + DEBUG_SPOOFING_MASTER_VERSION("x-debug-spoofing-master-version"), + DEBUG_SPOOFING_CURRENT_TIME("x-debug-spoofing-current-time"), +} diff --git a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/scope/RequestScope.kt b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/scope/RequestScope.kt new file mode 100644 index 0000000..65d007f --- /dev/null +++ b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/scope/RequestScope.kt @@ -0,0 +1,32 @@ +package net.averak.gsync.adapter.handler.player_api.scope + +import io.grpc.Context +import net.averak.gsync.core.game_context.GameContext +import org.springframework.stereotype.Component +import java.util.* + +@Component +@SuppressWarnings("kotlin:S6518") +class RequestScope { + + val gctx: GameContext + get() = try { + RequestScopeAttributes.GAME_CONTEXT.get(Context.current()) + } catch (_: NullPointerException) { + throw GrpcMetadataNotFoundException("Game context is not found in request scope.") + } + + val playerID: UUID + get() = try { + RequestScopeAttributes.PLAYER_ID.get(Context.current()) + } catch (_: NullPointerException) { + throw GrpcMetadataNotFoundException("PlayerID is not found in request scope.") + } + + val gameID: UUID + get() = try { + RequestScopeAttributes.GAME_ID.get(Context.current()) + } catch (_: NullPointerException) { + throw GrpcMetadataNotFoundException("GameID is not found in request scope.") + } +} diff --git a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/scope/RequestScopeAttributes.kt b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/scope/RequestScopeAttributes.kt new file mode 100644 index 0000000..4755aef --- /dev/null +++ b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/scope/RequestScopeAttributes.kt @@ -0,0 +1,12 @@ +package net.averak.gsync.adapter.handler.player_api.scope + +import io.grpc.Context +import net.averak.gsync.core.game_context.GameContext +import java.util.* + +object RequestScopeAttributes { + + val GAME_CONTEXT: Context.Key = Context.key("x-game-context") + val PLAYER_ID: Context.Key = Context.key("x-player-id") + val GAME_ID: Context.Key = Context.key("x-game-id") +} diff --git a/app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/player_api/EchoHandler_IT.groovy b/app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/player_api/EchoHandler_IT.groovy index 722bc89..55583cb 100644 --- a/app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/player_api/EchoHandler_IT.groovy +++ b/app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/player_api/EchoHandler_IT.groovy @@ -15,11 +15,16 @@ class EchoHandler_EchoV1_IT extends AbstractDatabaseSpec { final message = Faker.alphanumeric() when: - final request = EchoEchoV1.Request.newBuilder().setMessage(message).build() - final response = grpcTester.echo.echoV1(request) + grpcTester.withSpoofingMasterVersion(Faker.uuidv4()) + grpcTester.withSpoofingCurrentTime(now) + final response = grpcTester.invoke( + grpcTester.echo.&echoV1, + EchoEchoV1.Request.newBuilder().setMessage(message).build(), + ) then: response.message == message + Assert.timestampIs(response.timestamp, now) with(sql.rows("SELECT * FROM gsync_echo")) { it.size() == 1 it[0].message == message diff --git a/app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/player_api/PlayerStorageHandler_IT.groovy b/app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/player_api/PlayerStorageHandler_IT.groovy index faee2c2..35d795e 100644 --- a/app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/player_api/PlayerStorageHandler_IT.groovy +++ b/app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/player_api/PlayerStorageHandler_IT.groovy @@ -1,75 +1,75 @@ -//package net.averak.gsync.adapter.handler.player_api -// -//import net.averak.gsync.adapter.dao.dto.base.PlayerDto -//import net.averak.gsync.adapter.pbconv.PlayerStorageConverter -//import net.averak.gsync.domain.model.PlayerStorageEntry -//import net.averak.gsync.schema.protobuf.player_api.EchoEchoV1 -//import net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1 -//import net.averak.gsync.testkit.AbstractDatabaseSpec -//import net.averak.gsync.testkit.Assert -//import net.averak.gsync.testkit.Faker -//import net.averak.gsync.testkit.Fixture -// -//import java.time.LocalDateTime -// -//class PlayerStorageHandler_SearchV1_IT extends AbstractDatabaseSpec { -// -// def "正常系: パターンにマッチしたエントリを取得できる"() { -// given: -// final now = LocalDateTime.now() -// final message = Faker.alphanumeric() -// -// when: -// final request = EchoEchoV1.Request.newBuilder().setMessage(message).build() -// final response = grpcTester.echo.echoV1(request) -// -// then: -// response.message == message -// with(sql.rows("SELECT * FROM gsync_echo")) { -// it.size() == 1 -// it[0].message == message -// Assert.timestampIs(it[0].timestamp, now) -// } -// } -//} -// -//class PlayerStorageHandler_SetV1_IT extends AbstractDatabaseSpec { -// -// def "正常系: パターンにマッチしたエントリを作成できる"() { -// given: -// Fixture.setup( -// Faker.fake(PlayerDto, [ -// "playerId": Faker.uuidv5("p1").toString(), -// ]), -// ) -// -// when: -// final entry = Faker.fake(PlayerStorageEntry) -// final request = PlayerStorageSetV1.Request.newBuilder() -// .setEntry(PlayerStorageConverter.toPb(entry)) -// .setPreviousRevision("00000000-0000-0000-0000-000000000000") -// .build() -// final response = grpcTester.playerStorage.setV1(request) -// -// then: -// response.entry.key == entry.key -// response.entry.value.toByteArray() == entry.value -// -// with(sql.rows("SELECT * FROM gsync_player_storage_revision")) { -// it.size() == 1 -// it[0].player_storage_revision_id == response.nextRevision -// } -// with(sql.rows("SELECT * FROM gsync_player_storage_entry")) { -// it.size() == 1 -// it[0].key == entry.key -// it[0].value == entry.value -// } -// } -//} -// -//class PlayerStorageHandler_ClearV1_IT extends AbstractDatabaseSpec { -// -// def "正常系: パターンにマッチしたエントリを削除できる"() {} -// -//} -// +package net.averak.gsync.adapter.handler.player_api + +import net.averak.gsync.adapter.dao.dto.base.PlayerDto +import net.averak.gsync.adapter.handler.player_api.pbconv.PlayerStorageConverter +import net.averak.gsync.domain.model.PlayerStorageEntry +import net.averak.gsync.schema.protobuf.player_api.EchoEchoV1 +import net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1 +import net.averak.gsync.testkit.AbstractDatabaseSpec +import net.averak.gsync.testkit.Assert +import net.averak.gsync.testkit.Faker +import net.averak.gsync.testkit.Fixture + +import java.time.LocalDateTime + +class PlayerStorageHandler_SearchV1_IT extends AbstractDatabaseSpec { + + def "正常系: パターンにマッチしたエントリを取得できる"() { + given: + final now = LocalDateTime.now() + final message = Faker.alphanumeric() + + when: + final request = EchoEchoV1.Request.newBuilder().setMessage(message).build() + final response = grpcTester.echo.echoV1(request) + + then: + response.message == message + with(sql.rows("SELECT * FROM gsync_echo")) { + it.size() == 1 + it[0].message == message + Assert.timestampIs(it[0].timestamp, now) + } + } +} + +class PlayerStorageHandler_SetV1_IT extends AbstractDatabaseSpec { + + def "正常系: パターンにマッチしたエントリを作成できる"() { + given: + Fixture.setup( + Faker.fake(PlayerDto, [ + "playerId": Faker.uuidv5("p1").toString(), + ]), + ) + + when: + final entry = Faker.fake(PlayerStorageEntry) + final request = PlayerStorageSetV1.Request.newBuilder() + .setEntry(PlayerStorageConverter.toPb(entry)) + .setPreviousRevision("00000000-0000-0000-0000-000000000000") + .build() + final response = grpcTester.playerStorage.setV1(request) + + then: + response.entry.key == entry.key + response.entry.value.toByteArray() == entry.value + + with(sql.rows("SELECT * FROM gsync_player_storage_revision")) { + it.size() == 1 + it[0].player_storage_revision_id == response.nextRevision + } + with(sql.rows("SELECT * FROM gsync_player_storage_entry")) { + it.size() == 1 + it[0].key == entry.key + it[0].value == entry.value + } + } +} + +class PlayerStorageHandler_ClearV1_IT extends AbstractDatabaseSpec { + + def "正常系: パターンにマッチしたエントリを削除できる"() {} + +} + diff --git a/build.gradle.kts b/build.gradle.kts index fc144ac..df93d41 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -164,6 +164,8 @@ project(":domain") { project(":infrastructure") { dependencies { + implementation(project(":core")) + implementation(project(":protobuf")) implementation(rootProject.libs.spring.boot.starter.web) implementation(rootProject.libs.spring.boot.starter.webflux) implementation(rootProject.libs.spring.boot.starter.data.redis) diff --git a/testkit/src/main/groovy/net/averak/gsync/testkit/Assert.groovy b/testkit/src/main/groovy/net/averak/gsync/testkit/Assert.groovy index bb2752f..1236326 100644 --- a/testkit/src/main/groovy/net/averak/gsync/testkit/Assert.groovy +++ b/testkit/src/main/groovy/net/averak/gsync/testkit/Assert.groovy @@ -2,9 +2,10 @@ package net.averak.gsync.testkit import net.averak.gsync.core.exception.GsyncException -import java.sql.Timestamp import java.time.Duration +import java.time.Instant import java.time.LocalDateTime +import java.time.ZoneId import java.time.temporal.ChronoUnit class Assert { @@ -23,8 +24,14 @@ class Assert { assert ChronoUnit.MILLIS.between(actual, expected) <= approxDuration.toMillis() } + @SuppressWarnings('UnnecessaryQualifiedReference') + static void timestampIs(final com.google.protobuf.Timestamp actual, final LocalDateTime expected, final Duration approxDuration = Duration.ofMillis(1000)) { + assert ChronoUnit.MILLIS.between(LocalDateTime.ofInstant(Instant.ofEpochSecond(actual.seconds, actual.nanos), ZoneId.systemDefault()), expected) <= approxDuration.toMillis() + } + + @SuppressWarnings('UnnecessaryQualifiedReference') static void timestampIs(final Object actual, final LocalDateTime expected, final Duration approxDuration = Duration.ofMillis(1000)) { - assert actual instanceof Timestamp + assert actual instanceof java.sql.Timestamp assert ChronoUnit.MILLIS.between(actual.toLocalDateTime(), expected) <= approxDuration.toMillis() } } diff --git a/testkit/src/main/kotlin/net/averak/gsync/testkit/api/grpc/GrpcTester.kt b/testkit/src/main/kotlin/net/averak/gsync/testkit/api/grpc/GrpcTester.kt index 313aa00..f7ac6a9 100644 --- a/testkit/src/main/kotlin/net/averak/gsync/testkit/api/grpc/GrpcTester.kt +++ b/testkit/src/main/kotlin/net/averak/gsync/testkit/api/grpc/GrpcTester.kt @@ -1,18 +1,26 @@ package net.averak.gsync.testkit.api.grpc +import com.google.protobuf.GeneratedMessageV3 import io.grpc.ManagedChannel import io.grpc.ManagedChannelBuilder +import io.grpc.Metadata +import io.grpc.stub.MetadataUtils import jakarta.annotation.PostConstruct +import net.averak.gsync.adapter.handler.player_api.scope.IncomingMD import net.averak.gsync.core.config.Config import net.averak.gsync.schema.protobuf.player_api.EchoGrpc import net.averak.gsync.schema.protobuf.player_api.PlayerStorageGrpc import org.springframework.stereotype.Component +import java.time.LocalDateTime +import java.util.* @Component class GrpcTester( private val config: Config, ) { + private var metadata: MutableMap = mutableMapOf() + private lateinit var channel: ManagedChannel lateinit var echo: EchoGrpc.EchoBlockingStub @@ -22,7 +30,37 @@ class GrpcTester( @PostConstruct fun init() { channel = ManagedChannelBuilder.forAddress("localhost", config.playerApi.port).usePlaintext().build() - echo = EchoGrpc.newBlockingStub(channel) - playerStorage = PlayerStorageGrpc.newBlockingStub(channel) + } + + private fun initStubs() { + val extraHeaders = Metadata() + metadata.forEach { (k, v) -> + extraHeaders.put(Metadata.Key.of(k.key, Metadata.ASCII_STRING_MARSHALLER), v) + } + val interceptor = MetadataUtils.newAttachHeadersInterceptor(extraHeaders) + + echo = EchoGrpc.newBlockingStub(channel).withInterceptors(interceptor) + playerStorage = PlayerStorageGrpc.newBlockingStub(channel).withInterceptors(interceptor) + } + + fun invoke(method: (REQ) -> RES, request: REQ): RES { + val response = method(request) + metadata.clear() + return response + } + + fun withSpoofingPlayerID(value: UUID) { + metadata[IncomingMD.DEBUG_SPOOFING_PLAYER_ID] = value.toString() + initStubs() + } + + fun withSpoofingMasterVersion(value: UUID) { + metadata[IncomingMD.DEBUG_SPOOFING_MASTER_VERSION] = value.toString() + initStubs() + } + + fun withSpoofingCurrentTime(value: LocalDateTime) { + metadata[IncomingMD.DEBUG_SPOOFING_CURRENT_TIME] = value.toString() + initStubs() } } From 14b645cadef4c4acec031d2eb02e219b29dc3673 Mon Sep 17 00:00:00 2001 From: averak Date: Tue, 16 Jan 2024 04:48:22 +0900 Subject: [PATCH 13/13] =?UTF-8?q?refs=20#85=20=E8=AA=8D=E8=A8=BC=E5=BF=85?= =?UTF-8?q?=E9=A0=88API=E3=81=AE=E3=83=86=E3=82=B9=E3=83=88=E3=82=92?= =?UTF-8?q?=E5=8F=AF=E8=83=BD=E3=81=AB=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../interceptor/GameContextInterceptor.kt | 31 +--- .../player_api/PlayerStorageHandler.kt | 2 +- .../interceptor/MetadataInterceptor.kt | 72 ++++----- .../pbconv/PlayerStorageConverter.kt | 2 +- .../handler/utils/MasterVersionUtils.kt | 34 +++++ .../player_api/PlayerStorageHandler_IT.groovy | 140 +++++++++++++++--- .../MasterVersionUtils_UT.groovy} | 6 +- build.gradle.kts | 2 +- .../resource/player_storage/Criteria.java | 86 +++++------ .../player_storage/CriteriaOrBuilder.java | 12 +- .../player_storage/PlayerStorage.java | 13 +- schema/protobuf/resource/player_storage.proto | 4 +- .../gsync/testkit/api/grpc/GrpcTester.kt | 11 ++ 13 files changed, 259 insertions(+), 156 deletions(-) create mode 100644 app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/utils/MasterVersionUtils.kt rename app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/{admin_api/interceptor/GameContextInterceptor_UT.groovy => utils/MasterVersionUtils_UT.groovy} (96%) diff --git a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/admin_api/interceptor/GameContextInterceptor.kt b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/admin_api/interceptor/GameContextInterceptor.kt index b1ef20b..a0a85cb 100644 --- a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/admin_api/interceptor/GameContextInterceptor.kt +++ b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/admin_api/interceptor/GameContextInterceptor.kt @@ -1,14 +1,10 @@ package net.averak.gsync.adapter.handler.admin_api.interceptor -import com.google.common.annotations.VisibleForTesting import jakarta.servlet.http.HttpServletRequest import jakarta.servlet.http.HttpServletResponse -import net.averak.gsync.adapter.dao.dto.base.MasterVersionExample -import net.averak.gsync.adapter.dao.mapper.base.MasterVersionBaseMapper import net.averak.gsync.adapter.handler.admin_api.HttpRequestScope +import net.averak.gsync.adapter.handler.utils.MasterVersionUtils import net.averak.gsync.core.daterange.Dateline -import net.averak.gsync.core.exception.ErrorCode -import net.averak.gsync.core.exception.GsyncException import net.averak.gsync.core.game_context.GameContext import org.springframework.stereotype.Component import org.springframework.web.servlet.ModelAndView @@ -18,12 +14,12 @@ import java.util.* @Component open class GameContextInterceptor( private val requestScope: HttpRequestScope, - private val masterVersionMapper: MasterVersionBaseMapper, + private val masterVersionUtils: MasterVersionUtils, ) : IRequestInterceptor { override fun preHandle(request: HttpServletRequest, response: HttpServletResponse, handler: Any): Boolean { val gctx = GameContext( - getEnabledMasterVersion(requestScope.getSpoofingMasterVersion()), + masterVersionUtils.getEnabledMasterVersion(requestScope.getSpoofingMasterVersion()), // クライアントが Idempotency-Key を必ず設定してくるとは限らないので、未設定の場合はサーバ側でユニークキーを発行し、毎回異なるリクエストとして扱う requestScope.getIdempotencyKey() ?: UUID.randomUUID(), Dateline.DEFAULT, @@ -33,27 +29,6 @@ open class GameContextInterceptor( return true } - @Throws(GsyncException::class) - @VisibleForTesting - fun getEnabledMasterVersion(spoofingMasterVersion: UUID?): UUID { - return if (spoofingMasterVersion == null) { - val dtos = masterVersionMapper.selectByExample( - MasterVersionExample().apply { - createCriteria().andIsEnabledEqualTo(true) - }, - ) - if (dtos.isEmpty()) { - throw GsyncException(ErrorCode.ENABLED_MASTER_VERSION_DEFINITION_IS_NOT_FOUND) - } - if (dtos.size > 1) { - throw GsyncException(ErrorCode.MULTIPLE_ENABLED_MASTER_VERSIONS_ARE_DEFINED) - } - UUID.fromString(dtos[0].version) - } else { - spoofingMasterVersion - } - } - override fun postHandle(request: HttpServletRequest, response: HttpServletResponse, handler: Any, modelAndView: ModelAndView?) { return } diff --git a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/PlayerStorageHandler.kt b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/PlayerStorageHandler.kt index 7714cbc..cee2792 100644 --- a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/PlayerStorageHandler.kt +++ b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/PlayerStorageHandler.kt @@ -54,6 +54,6 @@ class PlayerStorageHandler( responseObserver.onNext( PlayerStorageClearV1.Response.newBuilder().setNextRevision(result.toString()).build(), ) - super.clearV1(request, responseObserver) + responseObserver.onCompleted() } } diff --git a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/interceptor/MetadataInterceptor.kt b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/interceptor/MetadataInterceptor.kt index 6b4ac0d..6bdfaa0 100644 --- a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/interceptor/MetadataInterceptor.kt +++ b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/interceptor/MetadataInterceptor.kt @@ -1,15 +1,11 @@ package net.averak.gsync.adapter.handler.player_api.interceptor -import com.google.common.annotations.VisibleForTesting import io.grpc.* -import net.averak.gsync.adapter.dao.dto.base.MasterVersionExample -import net.averak.gsync.adapter.dao.mapper.base.MasterVersionBaseMapper import net.averak.gsync.adapter.handler.player_api.scope.IncomingMD -import net.averak.gsync.adapter.handler.player_api.scope.RequestScope import net.averak.gsync.adapter.handler.player_api.scope.RequestScopeAttributes +import net.averak.gsync.adapter.handler.utils.MasterVersionUtils +import net.averak.gsync.core.config.Config import net.averak.gsync.core.daterange.Dateline -import net.averak.gsync.core.exception.ErrorCode -import net.averak.gsync.core.exception.GsyncException import net.averak.gsync.core.game_context.GameContext import org.springframework.stereotype.Component import java.time.LocalDateTime @@ -17,8 +13,8 @@ import java.util.* @Component class MetadataInterceptor( - private val requestScope: RequestScope, - private val masterVersionMapper: MasterVersionBaseMapper, + private val config: Config, + private val masterVersionUtils: MasterVersionUtils, ) : ServerInterceptor { override fun interceptCall( @@ -26,59 +22,47 @@ class MetadataInterceptor( headers: Metadata, next: ServerCallHandler, ): ServerCall.Listener { - // TODO: デバッグモードの場合のみ、デバッグ用のメタデータを読み取る + // デバッグモードの場合のみ、なりすましを許容する val spoofingMasterVersion = - headers[Metadata.Key.of(IncomingMD.DEBUG_SPOOFING_MASTER_VERSION.key, Metadata.ASCII_STRING_MARSHALLER)]?.let { - UUID.fromString(it) + if (config.debug) { + headers[Metadata.Key.of(IncomingMD.DEBUG_SPOOFING_MASTER_VERSION.key, Metadata.ASCII_STRING_MARSHALLER)]?.let { + UUID.fromString(it) + } + } else { + null + } + val spoofingCurrentTime = + if (config.debug) { + headers[Metadata.Key.of(IncomingMD.DEBUG_SPOOFING_CURRENT_TIME.key, Metadata.ASCII_STRING_MARSHALLER)]?.let { + LocalDateTime.parse(it) + } + } else { + null } + + val playerID = headers[Metadata.Key.of(IncomingMD.DEBUG_SPOOFING_PLAYER_ID.key, Metadata.ASCII_STRING_MARSHALLER)]?.let { + UUID.fromString(it) + } + val gameID = headers[Metadata.Key.of(IncomingMD.GAME_ID.key, Metadata.ASCII_STRING_MARSHALLER)]?.let { + UUID.fromString(it) + } val idempotencyKey = headers[Metadata.Key.of(IncomingMD.IDEMPOTENCY_KEY.key, Metadata.ASCII_STRING_MARSHALLER)]?.let { UUID.fromString(it) } - val spoofingCurrentTime = - headers[Metadata.Key.of(IncomingMD.DEBUG_SPOOFING_CURRENT_TIME.key, Metadata.ASCII_STRING_MARSHALLER)]?.let { - LocalDateTime.parse(it) - } + val gctx = GameContext( - getEnabledMasterVersion(spoofingMasterVersion), + masterVersionUtils.getEnabledMasterVersion(spoofingMasterVersion), // クライアントが Idempotency-Key を必ず設定してくるとは限らないので、未設定の場合はサーバ側でユニークキーを発行し、毎回異なるリクエストとして扱う idempotencyKey ?: UUID.randomUUID(), Dateline.DEFAULT, spoofingCurrentTime ?: LocalDateTime.now(), ) - val playerID = headers[Metadata.Key.of(IncomingMD.DEBUG_SPOOFING_PLAYER_ID.key, Metadata.ASCII_STRING_MARSHALLER)]?.let { - UUID.fromString(it) - } - val gameID = headers[Metadata.Key.of(IncomingMD.GAME_ID.key, Metadata.ASCII_STRING_MARSHALLER)]?.let { - UUID.fromString(it) - } - val context = Context.current() .withValue(RequestScopeAttributes.GAME_CONTEXT, gctx) .withValue(RequestScopeAttributes.PLAYER_ID, playerID) .withValue(RequestScopeAttributes.GAME_ID, gameID) return Contexts.interceptCall(context, call, headers, next) } - - @Throws(GsyncException::class) - @VisibleForTesting - fun getEnabledMasterVersion(spoofingMasterVersion: UUID?): UUID { - return if (spoofingMasterVersion == null) { - val dtos = masterVersionMapper.selectByExample( - MasterVersionExample().apply { - createCriteria().andIsEnabledEqualTo(true) - }, - ) - if (dtos.isEmpty()) { - throw GsyncException(ErrorCode.ENABLED_MASTER_VERSION_DEFINITION_IS_NOT_FOUND) - } - if (dtos.size > 1) { - throw GsyncException(ErrorCode.MULTIPLE_ENABLED_MASTER_VERSIONS_ARE_DEFINED) - } - UUID.fromString(dtos[0].version) - } else { - spoofingMasterVersion - } - } } diff --git a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/pbconv/PlayerStorageConverter.kt b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/pbconv/PlayerStorageConverter.kt index d5cd9ae..fd37ac5 100644 --- a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/pbconv/PlayerStorageConverter.kt +++ b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/pbconv/PlayerStorageConverter.kt @@ -16,7 +16,7 @@ class PlayerStorageConverter { @JvmStatic fun fromPb(criteria: Criteria): IPlayerStorageRepository.PlayerStorageCriteria { - when (criteria.matchingPattern) { + when (criteria.matchingType) { Criteria.MatchingType.EXACT_MATCH -> { return IPlayerStorageRepository.PlayerStorageCriteria( exactMatch = listOf(criteria.pattern), diff --git a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/utils/MasterVersionUtils.kt b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/utils/MasterVersionUtils.kt new file mode 100644 index 0000000..5670c2d --- /dev/null +++ b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/utils/MasterVersionUtils.kt @@ -0,0 +1,34 @@ +package net.averak.gsync.adapter.handler.utils + +import net.averak.gsync.adapter.dao.dto.base.MasterVersionExample +import net.averak.gsync.adapter.dao.mapper.base.MasterVersionBaseMapper +import net.averak.gsync.core.exception.ErrorCode +import net.averak.gsync.core.exception.GsyncException +import org.springframework.stereotype.Component +import java.util.* + +@Component +class MasterVersionUtils( + private val masterVersionMapper: MasterVersionBaseMapper, +) { + + @Throws(GsyncException::class) + fun getEnabledMasterVersion(spoofingMasterVersion: UUID?): UUID { + return if (spoofingMasterVersion == null) { + val dtos = masterVersionMapper.selectByExample( + MasterVersionExample().apply { + createCriteria().andIsEnabledEqualTo(true) + }, + ) + if (dtos.isEmpty()) { + throw GsyncException(ErrorCode.ENABLED_MASTER_VERSION_DEFINITION_IS_NOT_FOUND) + } + if (dtos.size > 1) { + throw GsyncException(ErrorCode.MULTIPLE_ENABLED_MASTER_VERSIONS_ARE_DEFINED) + } + UUID.fromString(dtos[0].version) + } else { + spoofingMasterVersion + } + } +} diff --git a/app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/player_api/PlayerStorageHandler_IT.groovy b/app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/player_api/PlayerStorageHandler_IT.groovy index 35d795e..eb82ecb 100644 --- a/app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/player_api/PlayerStorageHandler_IT.groovy +++ b/app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/player_api/PlayerStorageHandler_IT.groovy @@ -1,35 +1,70 @@ package net.averak.gsync.adapter.handler.player_api import net.averak.gsync.adapter.dao.dto.base.PlayerDto +import net.averak.gsync.adapter.dao.dto.base.PlayerStorageEntryDto +import net.averak.gsync.adapter.dao.dto.base.PlayerStorageRevisionDto import net.averak.gsync.adapter.handler.player_api.pbconv.PlayerStorageConverter import net.averak.gsync.domain.model.PlayerStorageEntry -import net.averak.gsync.schema.protobuf.player_api.EchoEchoV1 +import net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1 +import net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1 import net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1 +import net.averak.gsync.schema.protobuf.resource.player_storage.Criteria import net.averak.gsync.testkit.AbstractDatabaseSpec -import net.averak.gsync.testkit.Assert import net.averak.gsync.testkit.Faker import net.averak.gsync.testkit.Fixture -import java.time.LocalDateTime - class PlayerStorageHandler_SearchV1_IT extends AbstractDatabaseSpec { def "正常系: パターンにマッチしたエントリを取得できる"() { given: - final now = LocalDateTime.now() - final message = Faker.alphanumeric() + Fixture.setup( + Faker.fake(PlayerDto, [ + "playerId": Faker.uuidv5("p1").toString(), + ]), + ) + Fixture.setup( + Faker.fake(PlayerStorageRevisionDto, [ + "playerId": Faker.uuidv5("p1").toString(), + "gameId" : Faker.uuidv5("g1").toString(), + ]), + ) + Fixture.setup( + Faker.fake(PlayerStorageEntryDto, [ + "playerId": Faker.uuidv5("p1").toString(), + "gameId" : Faker.uuidv5("g1").toString(), + "key" : "group1#key1", + "value" : "value1".bytes, + ]), + Faker.fake(PlayerStorageEntryDto, [ + "playerId": Faker.uuidv5("p1").toString(), + "gameId" : Faker.uuidv5("g1").toString(), + "key" : "group1#key2", + "value" : "value2".bytes, + ]), + Faker.fake(PlayerStorageEntryDto, [ + "playerId": Faker.uuidv5("p1").toString(), + "gameId" : Faker.uuidv5("g1").toString(), + "key" : "group2#key1", + "value" : "value3".bytes, + ]), + ) when: - final request = EchoEchoV1.Request.newBuilder().setMessage(message).build() - final response = grpcTester.echo.echoV1(request) + grpcTester.withSession(Faker.uuidv5("p1"), Faker.uuidv5("g1")) + grpcTester.withSpoofingMasterVersion(Faker.uuidv4()) + final response = grpcTester.invoke( + grpcTester.playerStorage.&searchV1, + PlayerStorageSearchV1.Request.newBuilder() + .setCriteria(Criteria.newBuilder() + .setPattern("group1") + .setMatchingType(Criteria.MatchingType.FORWARD_MATCH) + .build() + ).build() + ) then: - response.message == message - with(sql.rows("SELECT * FROM gsync_echo")) { - it.size() == 1 - it[0].message == message - Assert.timestampIs(it[0].timestamp, now) - } + response.entriesList*.key == ["group1#key1", "group1#key2"] + response.entriesList*.value*.toByteArray() == ["value1".bytes, "value2".bytes] } } @@ -43,13 +78,18 @@ class PlayerStorageHandler_SetV1_IT extends AbstractDatabaseSpec { ]), ) - when: final entry = Faker.fake(PlayerStorageEntry) - final request = PlayerStorageSetV1.Request.newBuilder() - .setEntry(PlayerStorageConverter.toPb(entry)) - .setPreviousRevision("00000000-0000-0000-0000-000000000000") - .build() - final response = grpcTester.playerStorage.setV1(request) + + when: + grpcTester.withSession(Faker.uuidv5("p1"), Faker.uuidv5("g1")) + grpcTester.withSpoofingMasterVersion(Faker.uuidv4()) + final response = grpcTester.invoke( + grpcTester.playerStorage.&setV1, + PlayerStorageSetV1.Request.newBuilder() + .setEntry(PlayerStorageConverter.toPb(entry)) + .setPreviousRevision("00000000-0000-0000-0000-000000000000") + .build() + ) then: response.entry.key == entry.key @@ -69,7 +109,65 @@ class PlayerStorageHandler_SetV1_IT extends AbstractDatabaseSpec { class PlayerStorageHandler_ClearV1_IT extends AbstractDatabaseSpec { - def "正常系: パターンにマッチしたエントリを削除できる"() {} + def "正常系: パターンにマッチしたエントリを削除できる"() { + given: + Fixture.setup( + Faker.fake(PlayerDto, [ + "playerId": Faker.uuidv5("p1").toString(), + ]), + ) + Fixture.setup( + Faker.fake(PlayerStorageRevisionDto, [ + "playerId" : Faker.uuidv5("p1").toString(), + "gameId" : Faker.uuidv5("g1").toString(), + "playerStorageRevisionId": Faker.uuidv5("current revision").toString(), + ]), + ) + Fixture.setup( + Faker.fake(PlayerStorageEntryDto, [ + "playerId": Faker.uuidv5("p1").toString(), + "gameId" : Faker.uuidv5("g1").toString(), + "key" : "group1#key1", + "value" : "value1".bytes, + ]), + Faker.fake(PlayerStorageEntryDto, [ + "playerId": Faker.uuidv5("p1").toString(), + "gameId" : Faker.uuidv5("g1").toString(), + "key" : "group1#key2", + "value" : "value2".bytes, + ]), + Faker.fake(PlayerStorageEntryDto, [ + "playerId": Faker.uuidv5("p1").toString(), + "gameId" : Faker.uuidv5("g1").toString(), + "key" : "group2#key1", + "value" : "value3".bytes, + ]), + ) + + when: + grpcTester.withSession(Faker.uuidv5("p1"), Faker.uuidv5("g1")) + grpcTester.withSpoofingMasterVersion(Faker.uuidv4()) + final response = grpcTester.invoke( + grpcTester.playerStorage.&clearV1, + PlayerStorageClearV1.Request.newBuilder() + .setPreviousRevision(Faker.uuidv5("current revision").toString()) + .setCriteria(Criteria.newBuilder() + .setPattern("group1") + .setMatchingType(Criteria.MatchingType.FORWARD_MATCH) + .build() + ).build() + ) + then: + response.nextRevision != Faker.uuidv5("current revision").toString() + with(sql.rows("SELECT * FROM gsync_player_storage_revision")) { + it.size() == 2 + it*.player_storage_revision_id.sort() == [Faker.uuidv5("current revision").toString(), response.nextRevision].sort() + } + with(sql.rows("SELECT * FROM gsync_player_storage_entry")) { + it.size() == 1 + it[0].key == "group2#key1" + } + } } diff --git a/app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/admin_api/interceptor/GameContextInterceptor_UT.groovy b/app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/utils/MasterVersionUtils_UT.groovy similarity index 96% rename from app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/admin_api/interceptor/GameContextInterceptor_UT.groovy rename to app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/utils/MasterVersionUtils_UT.groovy index cd483c7..bb5f18d 100644 --- a/app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/admin_api/interceptor/GameContextInterceptor_UT.groovy +++ b/app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/utils/MasterVersionUtils_UT.groovy @@ -1,4 +1,4 @@ -package net.averak.gsync.adapter.handler.admin_api.interceptor +package net.averak.gsync.adapter.handler.utils import net.averak.gsync.adapter.dao.dto.base.MasterVersionDto import net.averak.gsync.core.exception.ErrorCode @@ -9,10 +9,10 @@ import net.averak.gsync.testkit.Faker import net.averak.gsync.testkit.Fixture import org.springframework.beans.factory.annotation.Autowired -class GameContextInterceptor_UT extends AbstractDatabaseSpec { +class MasterVersionUtils_UT extends AbstractDatabaseSpec { @Autowired - GameContextInterceptor sut + MasterVersionUtils sut def "getEnabledMasterVersion: 正常系 - 有効なマスターバージョンを取得できる"() { given: diff --git a/build.gradle.kts b/build.gradle.kts index df93d41..7549b08 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -191,7 +191,6 @@ project(":testkit") { implementation(project(":domain")) implementation(project(":infrastructure")) implementation(project(":usecase")) - implementation(project(":protobuf")) implementation(rootProject.libs.spring.boot.starter.test) implementation(rootProject.libs.spring.boot.starter.web) implementation(rootProject.libs.spring.boot.starter.webflux) @@ -199,6 +198,7 @@ project(":testkit") { implementation(rootProject.libs.spring.boot.starter.data.redis) implementation(rootProject.libs.commons.lang3) + api(project(":protobuf")) api(rootProject.libs.spock.core) api(rootProject.libs.spock.spring) api(rootProject.libs.groovy.sql) diff --git a/protobuf/src/main/java/net/averak/gsync/schema/protobuf/resource/player_storage/Criteria.java b/protobuf/src/main/java/net/averak/gsync/schema/protobuf/resource/player_storage/Criteria.java index 07e4bc4..611798a 100644 --- a/protobuf/src/main/java/net/averak/gsync/schema/protobuf/resource/player_storage/Criteria.java +++ b/protobuf/src/main/java/net/averak/gsync/schema/protobuf/resource/player_storage/Criteria.java @@ -18,7 +18,7 @@ private Criteria(com.google.protobuf.GeneratedMessageV3.Builder builder) { } private Criteria() { pattern_ = ""; - matchingPattern_ = 0; + matchingType_ = 0; } @java.lang.Override @@ -176,26 +176,26 @@ public com.google.protobuf.ByteString getPatternBytes() { } } - public static final int MATCHING_PATTERN_FIELD_NUMBER = 2; - private int matchingPattern_ = 0; + public static final int MATCHING_TYPE_FIELD_NUMBER = 2; + private int matchingType_ = 0; /** - * .gsync.resource.player_storage.Criteria.MatchingType matching_pattern = 2; + * .gsync.resource.player_storage.Criteria.MatchingType matching_type = 2; * - * @return The enum numeric value on the wire for matchingPattern. + * @return The enum numeric value on the wire for matchingType. */ @java.lang.Override - public int getMatchingPatternValue() { - return matchingPattern_; + public int getMatchingTypeValue() { + return matchingType_; } /** - * .gsync.resource.player_storage.Criteria.MatchingType matching_pattern = 2; + * .gsync.resource.player_storage.Criteria.MatchingType matching_type = 2; * - * @return The matchingPattern. + * @return The matchingType. */ @java.lang.Override - public net.averak.gsync.schema.protobuf.resource.player_storage.Criteria.MatchingType getMatchingPattern() { + public net.averak.gsync.schema.protobuf.resource.player_storage.Criteria.MatchingType getMatchingType() { net.averak.gsync.schema.protobuf.resource.player_storage.Criteria.MatchingType result = net.averak.gsync.schema.protobuf.resource.player_storage.Criteria.MatchingType - .forNumber(matchingPattern_); + .forNumber(matchingType_); return result == null ? net.averak.gsync.schema.protobuf.resource.player_storage.Criteria.MatchingType.UNRECOGNIZED : result; @@ -219,9 +219,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(pattern_)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 1, pattern_); } - if (matchingPattern_ != net.averak.gsync.schema.protobuf.resource.player_storage.Criteria.MatchingType.EXACT_MATCH + if (matchingType_ != net.averak.gsync.schema.protobuf.resource.player_storage.Criteria.MatchingType.EXACT_MATCH .getNumber()) { - output.writeEnum(2, matchingPattern_); + output.writeEnum(2, matchingType_); } getUnknownFields().writeTo(output); } @@ -236,9 +236,9 @@ public int getSerializedSize() { if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(pattern_)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, pattern_); } - if (matchingPattern_ != net.averak.gsync.schema.protobuf.resource.player_storage.Criteria.MatchingType.EXACT_MATCH + if (matchingType_ != net.averak.gsync.schema.protobuf.resource.player_storage.Criteria.MatchingType.EXACT_MATCH .getNumber()) { - size += com.google.protobuf.CodedOutputStream.computeEnumSize(2, matchingPattern_); + size += com.google.protobuf.CodedOutputStream.computeEnumSize(2, matchingType_); } size += getUnknownFields().getSerializedSize(); memoizedSize = size; @@ -257,7 +257,7 @@ public boolean equals(final java.lang.Object obj) { if (!getPattern().equals(other.getPattern())) return false; - if (matchingPattern_ != other.matchingPattern_) + if (matchingType_ != other.matchingType_) return false; if (!getUnknownFields().equals(other.getUnknownFields())) return false; @@ -273,8 +273,8 @@ public int hashCode() { hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + PATTERN_FIELD_NUMBER; hash = (53 * hash) + getPattern().hashCode(); - hash = (37 * hash) + MATCHING_PATTERN_FIELD_NUMBER; - hash = (53 * hash) + matchingPattern_; + hash = (37 * hash) + MATCHING_TYPE_FIELD_NUMBER; + hash = (53 * hash) + matchingType_; hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; @@ -390,7 +390,7 @@ public Builder clear() { super.clear(); bitField0_ = 0; pattern_ = ""; - matchingPattern_ = 0; + matchingType_ = 0; return this; } @@ -430,7 +430,7 @@ private void buildPartial0(net.averak.gsync.schema.protobuf.resource.player_stor result.pattern_ = pattern_; } if (((from_bitField0_ & 0x00000002) != 0)) { - result.matchingPattern_ = matchingPattern_; + result.matchingType_ = matchingType_; } } @@ -477,8 +477,8 @@ public Builder mergeFrom(net.averak.gsync.schema.protobuf.resource.player_storag bitField0_ |= 0x00000001; onChanged(); } - if (other.matchingPattern_ != 0) { - setMatchingPatternValue(other.getMatchingPatternValue()); + if (other.matchingType_ != 0) { + setMatchingTypeValue(other.getMatchingTypeValue()); } this.mergeUnknownFields(other.getUnknownFields()); onChanged(); @@ -510,7 +510,7 @@ public Builder mergeFrom(com.google.protobuf.CodedInputStream input, break; } // case 10 case 16 : { - matchingPattern_ = input.readEnum(); + matchingType_ = input.readEnum(); bitField0_ |= 0x00000002; break; } // case 16 @@ -608,67 +608,67 @@ public Builder setPatternBytes(com.google.protobuf.ByteString value) { return this; } - private int matchingPattern_ = 0; + private int matchingType_ = 0; /** - * .gsync.resource.player_storage.Criteria.MatchingType matching_pattern = 2; + * .gsync.resource.player_storage.Criteria.MatchingType matching_type = 2; * - * @return The enum numeric value on the wire for matchingPattern. + * @return The enum numeric value on the wire for matchingType. */ @java.lang.Override - public int getMatchingPatternValue() { - return matchingPattern_; + public int getMatchingTypeValue() { + return matchingType_; } /** - * .gsync.resource.player_storage.Criteria.MatchingType matching_pattern = 2; + * .gsync.resource.player_storage.Criteria.MatchingType matching_type = 2; * * @param value - * The enum numeric value on the wire for matchingPattern to set. + * The enum numeric value on the wire for matchingType to set. * @return This builder for chaining. */ - public Builder setMatchingPatternValue(int value) { - matchingPattern_ = value; + public Builder setMatchingTypeValue(int value) { + matchingType_ = value; bitField0_ |= 0x00000002; onChanged(); return this; } /** - * .gsync.resource.player_storage.Criteria.MatchingType matching_pattern = 2; + * .gsync.resource.player_storage.Criteria.MatchingType matching_type = 2; * - * @return The matchingPattern. + * @return The matchingType. */ @java.lang.Override - public net.averak.gsync.schema.protobuf.resource.player_storage.Criteria.MatchingType getMatchingPattern() { + public net.averak.gsync.schema.protobuf.resource.player_storage.Criteria.MatchingType getMatchingType() { net.averak.gsync.schema.protobuf.resource.player_storage.Criteria.MatchingType result = net.averak.gsync.schema.protobuf.resource.player_storage.Criteria.MatchingType - .forNumber(matchingPattern_); + .forNumber(matchingType_); return result == null ? net.averak.gsync.schema.protobuf.resource.player_storage.Criteria.MatchingType.UNRECOGNIZED : result; } /** - * .gsync.resource.player_storage.Criteria.MatchingType matching_pattern = 2; + * .gsync.resource.player_storage.Criteria.MatchingType matching_type = 2; * * @param value - * The matchingPattern to set. + * The matchingType to set. * @return This builder for chaining. */ - public Builder setMatchingPattern( + public Builder setMatchingType( net.averak.gsync.schema.protobuf.resource.player_storage.Criteria.MatchingType value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000002; - matchingPattern_ = value.getNumber(); + matchingType_ = value.getNumber(); onChanged(); return this; } /** - * .gsync.resource.player_storage.Criteria.MatchingType matching_pattern = 2; + * .gsync.resource.player_storage.Criteria.MatchingType matching_type = 2; * * @return This builder for chaining. */ - public Builder clearMatchingPattern() { + public Builder clearMatchingType() { bitField0_ = (bitField0_ & ~0x00000002); - matchingPattern_ = 0; + matchingType_ = 0; onChanged(); return this; } diff --git a/protobuf/src/main/java/net/averak/gsync/schema/protobuf/resource/player_storage/CriteriaOrBuilder.java b/protobuf/src/main/java/net/averak/gsync/schema/protobuf/resource/player_storage/CriteriaOrBuilder.java index b87e3ea..4fafdca 100644 --- a/protobuf/src/main/java/net/averak/gsync/schema/protobuf/resource/player_storage/CriteriaOrBuilder.java +++ b/protobuf/src/main/java/net/averak/gsync/schema/protobuf/resource/player_storage/CriteriaOrBuilder.java @@ -23,15 +23,15 @@ public interface CriteriaOrBuilder com.google.protobuf.ByteString getPatternBytes(); /** - * .gsync.resource.player_storage.Criteria.MatchingType matching_pattern = 2; + * .gsync.resource.player_storage.Criteria.MatchingType matching_type = 2; * - * @return The enum numeric value on the wire for matchingPattern. + * @return The enum numeric value on the wire for matchingType. */ - int getMatchingPatternValue(); + int getMatchingTypeValue(); /** - * .gsync.resource.player_storage.Criteria.MatchingType matching_pattern = 2; + * .gsync.resource.player_storage.Criteria.MatchingType matching_type = 2; * - * @return The matchingPattern. + * @return The matchingType. */ - net.averak.gsync.schema.protobuf.resource.player_storage.Criteria.MatchingType getMatchingPattern(); + net.averak.gsync.schema.protobuf.resource.player_storage.Criteria.MatchingType getMatchingType(); } diff --git a/protobuf/src/main/java/net/averak/gsync/schema/protobuf/resource/player_storage/PlayerStorage.java b/protobuf/src/main/java/net/averak/gsync/schema/protobuf/resource/player_storage/PlayerStorage.java index 8f699a6..cf6097d 100644 --- a/protobuf/src/main/java/net/averak/gsync/schema/protobuf/resource/player_storage/PlayerStorage.java +++ b/protobuf/src/main/java/net/averak/gsync/schema/protobuf/resource/player_storage/PlayerStorage.java @@ -25,11 +25,12 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { static { java.lang.String[] descriptorData = {"\n\035resource/player_storage.proto\022\035gsync.r" + "esource.player_storage\"#\n\005Entry\022\013\n\003key\030\001" - + " \001(\t\022\r\n\005value\030\002 \001(\014\"\237\001\n\010Criteria\022\017\n\007patt" - + "ern\030\001 \001(\t\022N\n\020matching_pattern\030\002 \001(\01624.gs" - + "ync.resource.player_storage.Criteria.Mat" + "chingType\"2\n\014MatchingType\022\017\n\013EXACT_MATCH" - + "\020\000\022\021\n\rFORWARD_MATCH\020\001B<\n8net.averak.gsyn" - + "c.schema.protobuf.resource.player_storag" + "eP\001b\006proto3"}; + + " \001(\t\022\r\n\005value\030\002 \001(\014\"\234\001\n\010Criteria\022\017\n\007patt" + + "ern\030\001 \001(\t\022K\n\rmatching_type\030\002 \001(\01624.gsync" + + ".resource.player_storage.Criteria.Matchi" + + "ngType\"2\n\014MatchingType\022\017\n\013EXACT_MATCH\020\000\022" + + "\021\n\rFORWARD_MATCH\020\001B<\n8net.averak.gsync.s" + "chema.protobuf.resource.player_storageP\001" + + "b\006proto3"}; descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom(descriptorData, new com.google.protobuf.Descriptors.FileDescriptor[]{}); internal_static_gsync_resource_player_storage_Entry_descriptor = getDescriptor().getMessageTypes().get(0); @@ -39,7 +40,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { internal_static_gsync_resource_player_storage_Criteria_descriptor = getDescriptor().getMessageTypes().get(1); internal_static_gsync_resource_player_storage_Criteria_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_gsync_resource_player_storage_Criteria_descriptor, - new java.lang.String[]{"Pattern", "MatchingPattern",}); + new java.lang.String[]{"Pattern", "MatchingType",}); } // @@protoc_insertion_point(outer_class_scope) diff --git a/schema/protobuf/resource/player_storage.proto b/schema/protobuf/resource/player_storage.proto index ac0a546..4bea43d 100644 --- a/schema/protobuf/resource/player_storage.proto +++ b/schema/protobuf/resource/player_storage.proto @@ -16,6 +16,6 @@ message Criteria { FORWARD_MATCH = 1; } - string pattern = 1; - MatchingType matching_pattern = 2; + string pattern = 1; + MatchingType matching_type = 2; } diff --git a/testkit/src/main/kotlin/net/averak/gsync/testkit/api/grpc/GrpcTester.kt b/testkit/src/main/kotlin/net/averak/gsync/testkit/api/grpc/GrpcTester.kt index f7ac6a9..de18b9f 100644 --- a/testkit/src/main/kotlin/net/averak/gsync/testkit/api/grpc/GrpcTester.kt +++ b/testkit/src/main/kotlin/net/averak/gsync/testkit/api/grpc/GrpcTester.kt @@ -49,6 +49,17 @@ class GrpcTester( return response } + fun withSession(playerID: UUID, gameID: UUID) { + metadata[IncomingMD.DEBUG_SPOOFING_PLAYER_ID] = playerID.toString() + metadata[IncomingMD.GAME_ID] = gameID.toString() + initStubs() + } + + fun withGameID(value: UUID) { + metadata[IncomingMD.GAME_ID] = value.toString() + initStubs() + } + fun withSpoofingPlayerID(value: UUID) { metadata[IncomingMD.DEBUG_SPOOFING_PLAYER_ID] = value.toString() initStubs()