Skip to content

GEM: EntityViewのView名に予約文字が含まれないようにする#1763

Merged
NonakaKazuhiro merged 11 commits into
masterfrom
feature/1699-validation-defname4
Aug 19, 2025
Merged

GEM: EntityViewのView名に予約文字が含まれないようにする#1763
NonakaKazuhiro merged 11 commits into
masterfrom
feature/1699-validation-defname4

Conversation

@NonakaKazuhiro

Copy link
Copy Markdown
Contributor

対応内容

fixes #1699

  • AdminConsoleにてメタデータ登録更新時にメタデータ定義名チェック追加
  • Tools(メタデータインポートなど)にてメタデータ定義名チェック追加
  • メタデータ定義関連WebAPIやカスタムコード(AbstractTypedDefinitionManager経由でのメタデータ更新)でのメタデータ更新時にメタデータ定義名チェック追加
  • EntityViewにてView名のチェックを追加(CheckStatus)

動作確認・スクリーンショット(任意)

レビュー観点・補足情報(任意)

@NonakaKazuhiro
NonakaKazuhiro requested a review from Copilot May 8, 2025 08:46

This comment was marked as outdated.

@NonakaKazuhiro
NonakaKazuhiro requested a review from Copilot August 7, 2025 01:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements metadata definition name validation to prevent reserved characters from being used in entity view names and other metadata definitions. The change addresses issue #1699 by adding comprehensive definition name checking across multiple layers.

  • Adds definition name validation infrastructure with configurable patterns and error messages
  • Implements check status validation during metadata import to identify inconsistencies
  • Adds view name validation specifically for EntityView definitions with proper error messages

Reviewed Changes

Copilot reviewed 55 out of 55 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
iplass-core/src/main/java/org/iplass/mtp/impl/definition/DefinitionNameChecker.java Core definition name validation logic with regex patterns
iplass-core/src/main/java/org/iplass/mtp/impl/entity/EntityDefinitionNameChecker.java Entity-specific definition name checker implementation
iplass-gem/src/main/java/org/iplass/mtp/impl/view/generic/EntityViewRuntime.java EntityView runtime validation for view names
iplass-tools/src/main/java/org/iplass/mtp/impl/tools/metaport/MetaDataPortingServiceImpl.java Added check status validation after metadata import
Multiple service files Integration of definition name checkers across various metadata services

* @param <M> メタデータの型
* @param metaType メタデータタイプ
* @param メタデータ定義名
* @return メタデータ定義名チェック結果

Copilot AI Aug 7, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parameter name is missing in the JavaDoc comment. It should be '@param defName メタデータ定義名'.

Suggested change
* @return メタデータ定義名チェック結果
* @param <M> メタデータの型
* @param metaType メタデータタイプ
* @param defName メタデータ定義名
* @return メタデータ定義名チェック結果

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

修正しました。

import java.util.List;
import java.util.Map;

import javax.xml.parsers.ParserConfigurationException;

Copilot AI Aug 7, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The javax.xml imports have been moved after the jakarta.xml imports, breaking the typical import ordering convention where javax imports should come before custom package imports.

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

プロジェクトで利用してるフォーマッターの順序になっているのでそのままとさせてください。


// View名の正規表現(英数字、ハイフン、アンダーバー、ピリオドのみ可で先頭にハイフン、ピリオドは除き、末尾にピリオドは除く)
private static final Pattern VIEW_NAME_PATTERN = Pattern.compile("^[0-9a-zA-Z_][0-9a-zA-Z_-]*(\\.[0-9a-zA-Z_-]+)*$");

Copilot AI Aug 7, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The regex pattern is hardcoded and duplicates validation logic. Consider using the EntityDefinitionNameChecker or creating a shared constant to maintain consistency with other definition name patterns.

Suggested change
// View名の正規表現は EntityDefinitionNameChecker で一元管理

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

修正しました。
重複ロジックを避ける修正としてViewNameCheckerを作成。


@Override
protected DefinitionNameChecker createDefinitionNameChecker() {
return new DefinitionNameChecker(NAME_CHECK_PATTERN, NAME_CHECK_MESSAGE) {

Copilot AI Aug 7, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty anonymous class with no overridden methods. This can be simplified to 'return new DefinitionNameChecker(NAME_CHECK_PATTERN, NAME_CHECK_MESSAGE);'

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

修正しました。

@NonakaKazuhiro
NonakaKazuhiro merged commit 569cce1 into master Aug 19, 2025
3 checks passed
@NonakaKazuhiro
NonakaKazuhiro deleted the feature/1699-validation-defname4 branch August 20, 2025 07:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GEM: メタデータパス、定義名、EntityViewのView名のバリデーションチェックを行うようにする

2 participants