diff --git a/src/main/java/com/github/_1c_syntax/bsl/mdo/ChartOfAccounts.java b/src/main/java/com/github/_1c_syntax/bsl/mdo/ChartOfAccounts.java index be46f4c48..64e99524c 100644 --- a/src/main/java/com/github/_1c_syntax/bsl/mdo/ChartOfAccounts.java +++ b/src/main/java/com/github/_1c_syntax/bsl/mdo/ChartOfAccounts.java @@ -26,6 +26,7 @@ import com.github._1c_syntax.bsl.mdo.children.ObjectCommand; import com.github._1c_syntax.bsl.mdo.children.ObjectForm; import com.github._1c_syntax.bsl.mdo.children.ObjectTemplate; +import com.github._1c_syntax.bsl.mdo.support.CodeSeries; import com.github._1c_syntax.bsl.mdo.support.ObjectBelonging; import com.github._1c_syntax.bsl.mdo.support.RoleRight; import com.github._1c_syntax.bsl.mdo.utils.LazyLoader; @@ -122,6 +123,24 @@ public class ChartOfAccounts implements ReferenceObject, AccessRightsOwner { @Default MultiLanguageString explanation = MultiLanguageString.EMPTY; + /** + * Проверять уникальность кода плана счетов. + * Определяет, нужно ли проверять уникальность кода плана счетов. + * Если значение равно true, то код плана счетов должен быть уникальным в пределах области, + * определяемой свойством {@link #codeSeries}. Если false, проверка уникальности не выполняется. + */ + @Default + boolean checkUnique = false; + + /** + * Серия кодов плана счетов. + * Определяет область действия уникальности кода плана счетов. + * Значение по умолчанию: {@link CodeSeries#WHOLE_CATALOG}. + * Для формата EDT: если поле отсутствует, автоматически устанавливается значение WHOLE_CATALOG. + */ + @Default + CodeSeries codeSeries = CodeSeries.WHOLE_CATALOG; + /** * Возвращает перечень возможных прав доступа */ diff --git a/src/main/java/com/github/_1c_syntax/bsl/mdo/ChartOfCharacteristicTypes.java b/src/main/java/com/github/_1c_syntax/bsl/mdo/ChartOfCharacteristicTypes.java index efff1213b..e9c1a1856 100644 --- a/src/main/java/com/github/_1c_syntax/bsl/mdo/ChartOfCharacteristicTypes.java +++ b/src/main/java/com/github/_1c_syntax/bsl/mdo/ChartOfCharacteristicTypes.java @@ -24,6 +24,7 @@ import com.github._1c_syntax.bsl.mdo.children.ObjectCommand; import com.github._1c_syntax.bsl.mdo.children.ObjectForm; import com.github._1c_syntax.bsl.mdo.children.ObjectTemplate; +import com.github._1c_syntax.bsl.mdo.support.CodeSeries; import com.github._1c_syntax.bsl.mdo.support.ObjectBelonging; import com.github._1c_syntax.bsl.mdo.support.RoleRight; import com.github._1c_syntax.bsl.mdo.utils.LazyLoader; @@ -116,6 +117,24 @@ public class ChartOfCharacteristicTypes implements ReferenceObject, AccessRights @Default MultiLanguageString explanation = MultiLanguageString.EMPTY; + /** + * Проверять уникальность кода плана видов характеристик. + * Определяет, нужно ли проверять уникальность кода плана видов характеристик. + * Если значение равно true, то код плана видов характеристик должен быть уникальным в пределах области, + * определяемой свойством {@link #codeSeries}. Если false, проверка уникальности не выполняется. + */ + @Default + boolean checkUnique = false; + + /** + * Серия кодов плана видов характеристик. + * Определяет область действия уникальности кода плана видов характеристик. + * Значение по умолчанию: {@link CodeSeries#WHOLE_CATALOG}. + * Для формата EDT: если поле отсутствует, автоматически устанавливается значение WHOLE_CATALOG. + */ + @Default + CodeSeries codeSeries = CodeSeries.WHOLE_CATALOG; + /** * Возвращает перечень возможных прав доступа */ diff --git a/src/test/java/com/github/_1c_syntax/bsl/mdo/ChartOfAccountsTest.java b/src/test/java/com/github/_1c_syntax/bsl/mdo/ChartOfAccountsTest.java index f942f662c..0a9b35393 100644 --- a/src/test/java/com/github/_1c_syntax/bsl/mdo/ChartOfAccountsTest.java +++ b/src/test/java/com/github/_1c_syntax/bsl/mdo/ChartOfAccountsTest.java @@ -22,6 +22,7 @@ package com.github._1c_syntax.bsl.mdo; import com.github._1c_syntax.bsl.mdo.support.AttributeKind; +import com.github._1c_syntax.bsl.mdo.support.CodeSeries; import com.github._1c_syntax.bsl.test_utils.MDTestUtils; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.aggregator.ArgumentsAccessor; @@ -49,4 +50,31 @@ void test(ArgumentsAccessor argumentsAccessor) { assertThat(chartOfAccounts.getAccountingFlags()).hasSize(1); assertThat(chartOfAccounts.getExtDimensionAccountingFlags()).hasSize(1); } + + /** + * Проверяет, что для плана счетов "ПланСчетов1" поле checkUnique установлено в true. + *

+ * В формате Designer: в XML файле явно указано {@code true}. + * В формате EDT: в XML файле явно указано {@code true}. + * + * @param argumentsAccessor параметры теста (формат, имя пакета, ссылка на MDO, постфикс фикстуры) + */ + @ParameterizedTest + @CsvSource({ + "true, mdclasses, ChartsOfAccounts.ПланСчетов1, _edt", + "false, mdclasses, ChartsOfAccounts.ПланСчетов1" + }) + void testCheckUniqueTrue(ArgumentsAccessor argumentsAccessor) { + var mdo = MDTestUtils.getMDWithSimpleTest(argumentsAccessor); + assertThat(mdo) + .isInstanceOf(ChartOfAccounts.class); + + var chartOfAccounts = (ChartOfAccounts) mdo; + assertThat(chartOfAccounts.isCheckUnique()) + .as("Поле checkUnique должно быть true для плана счетов ПланСчетов1") + .isTrue(); + assertThat(chartOfAccounts.getCodeSeries()) + .as("Поле codeSeries должно быть WHOLE_CATALOG для плана счетов ПланСчетов1") + .isEqualTo(CodeSeries.WHOLE_CATALOG); + } } \ No newline at end of file diff --git a/src/test/java/com/github/_1c_syntax/bsl/mdo/ChartOfCharacteristicTypesTest.java b/src/test/java/com/github/_1c_syntax/bsl/mdo/ChartOfCharacteristicTypesTest.java index 0a11c722e..eb4d7b5e6 100644 --- a/src/test/java/com/github/_1c_syntax/bsl/mdo/ChartOfCharacteristicTypesTest.java +++ b/src/test/java/com/github/_1c_syntax/bsl/mdo/ChartOfCharacteristicTypesTest.java @@ -21,11 +21,14 @@ */ package com.github._1c_syntax.bsl.mdo; +import com.github._1c_syntax.bsl.mdo.support.CodeSeries; import com.github._1c_syntax.bsl.test_utils.MDTestUtils; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.aggregator.ArgumentsAccessor; import org.junit.jupiter.params.provider.CsvSource; +import static org.assertj.core.api.Assertions.assertThat; + class ChartOfCharacteristicTypesTest { @ParameterizedTest @CsvSource( @@ -39,4 +42,31 @@ class ChartOfCharacteristicTypesTest { void test(ArgumentsAccessor argumentsAccessor) { var mdo = MDTestUtils.getMDWithSimpleTest(argumentsAccessor); } + + /** + * Проверяет, что для плана видов характеристик "ПланВидовХарактеристик1" поле checkUnique установлено в true. + *

+ * В формате Designer: в XML файле явно указано {@code true}. + * В формате EDT: в XML файле явно указано {@code true}. + * + * @param argumentsAccessor параметры теста (формат, имя пакета, ссылка на MDO, постфикс фикстуры) + */ + @ParameterizedTest + @CsvSource({ + "true, mdclasses, ChartsOfCharacteristicTypes.ПланВидовХарактеристик1, _edt", + "false, mdclasses, ChartsOfCharacteristicTypes.ПланВидовХарактеристик1" + }) + void testCheckUniqueTrue(ArgumentsAccessor argumentsAccessor) { + var mdo = MDTestUtils.getMDWithSimpleTest(argumentsAccessor); + assertThat(mdo) + .isInstanceOf(ChartOfCharacteristicTypes.class); + + var chartOfCharacteristicTypes = (ChartOfCharacteristicTypes) mdo; + assertThat(chartOfCharacteristicTypes.isCheckUnique()) + .as("Поле checkUnique должно быть true для плана видов характеристик ПланВидовХарактеристик1") + .isTrue(); + assertThat(chartOfCharacteristicTypes.getCodeSeries()) + .as("Поле codeSeries должно быть WHOLE_CATALOG для плана видов характеристик ПланВидовХарактеристик1") + .isEqualTo(CodeSeries.WHOLE_CATALOG); + } } \ No newline at end of file diff --git "a/src/test/resources/fixtures/mdclasses/ChartsOfAccounts.\320\237\320\273\320\260\320\275\320\241\321\207\320\265\321\202\320\276\320\2621.json" "b/src/test/resources/fixtures/mdclasses/ChartsOfAccounts.\320\237\320\273\320\260\320\275\320\241\321\207\320\265\321\202\320\276\320\2621.json" index 48a70e512..00828abe1 100644 --- "a/src/test/resources/fixtures/mdclasses/ChartsOfAccounts.\320\237\320\273\320\260\320\275\320\241\321\207\320\265\321\202\320\276\320\2621.json" +++ "b/src/test/resources/fixtures/mdclasses/ChartsOfAccounts.\320\237\320\273\320\260\320\275\320\241\321\207\320\265\321\202\320\276\320\2621.json" @@ -670,5 +670,7 @@ }, "tabularSections": [], "templates": [], - "uuid": "2766f353-abd2-4e7f-9a95-53f05c83f5d4" + "uuid": "2766f353-abd2-4e7f-9a95-53f05c83f5d4", + "checkUnique": true, + "codeSeries": "WHOLE_CATALOG" }} \ No newline at end of file diff --git "a/src/test/resources/fixtures/mdclasses/ChartsOfAccounts.\320\237\320\273\320\260\320\275\320\241\321\207\320\265\321\202\320\276\320\2621_edt.json" "b/src/test/resources/fixtures/mdclasses/ChartsOfAccounts.\320\237\320\273\320\260\320\275\320\241\321\207\320\265\321\202\320\276\320\2621_edt.json" index 835816bf3..3fcac59d6 100644 --- "a/src/test/resources/fixtures/mdclasses/ChartsOfAccounts.\320\237\320\273\320\260\320\275\320\241\321\207\320\265\321\202\320\276\320\2621_edt.json" +++ "b/src/test/resources/fixtures/mdclasses/ChartsOfAccounts.\320\237\320\273\320\260\320\275\320\241\321\207\320\265\321\202\320\276\320\2621_edt.json" @@ -670,5 +670,7 @@ }, "tabularSections": [], "templates": [], - "uuid": "2766f353-abd2-4e7f-9a95-53f05c83f5d4" + "uuid": "2766f353-abd2-4e7f-9a95-53f05c83f5d4", + "checkUnique": true, + "codeSeries": "WHOLE_CATALOG" }} \ No newline at end of file diff --git "a/src/test/resources/fixtures/mdclasses/ChartsOfCharacteristicTypes.\320\237\320\273\320\260\320\275\320\222\320\270\320\264\320\276\320\262\320\245\320\260\321\200\320\260\320\272\321\202\320\265\321\200\320\270\321\201\321\202\320\270\320\2721.json" "b/src/test/resources/fixtures/mdclasses/ChartsOfCharacteristicTypes.\320\237\320\273\320\260\320\275\320\222\320\270\320\264\320\276\320\262\320\245\320\260\321\200\320\260\320\272\321\202\320\265\321\200\320\270\321\201\321\202\320\270\320\2721.json" index 54876139a..10e07e5e2 100644 --- "a/src/test/resources/fixtures/mdclasses/ChartsOfCharacteristicTypes.\320\237\320\273\320\260\320\275\320\222\320\270\320\264\320\276\320\262\320\245\320\260\321\200\320\260\320\272\321\202\320\265\321\200\320\270\321\201\321\202\320\270\320\2721.json" +++ "b/src/test/resources/fixtures/mdclasses/ChartsOfCharacteristicTypes.\320\237\320\273\320\260\320\275\320\222\320\270\320\264\320\276\320\262\320\245\320\260\321\200\320\260\320\272\321\202\320\265\321\200\320\270\321\201\321\202\320\270\320\2721.json" @@ -566,5 +566,7 @@ "uuid": "f53a24c3-f1dc-43b7-8dcf-eeb8c0b7f452", "valueType": { "@reference": "/com.github._1c_syntax.bsl.mdo.ChartOfCharacteristicTypes/attributes/c/com.github._1c_syntax.bsl.mdo.children.StandardAttribute[9]/type" - } + }, + "checkUnique": true, + "codeSeries": "WHOLE_CATALOG" }} \ No newline at end of file diff --git "a/src/test/resources/fixtures/mdclasses/ChartsOfCharacteristicTypes.\320\237\320\273\320\260\320\275\320\222\320\270\320\264\320\276\320\262\320\245\320\260\321\200\320\260\320\272\321\202\320\265\321\200\320\270\321\201\321\202\320\270\320\2721_edt.json" "b/src/test/resources/fixtures/mdclasses/ChartsOfCharacteristicTypes.\320\237\320\273\320\260\320\275\320\222\320\270\320\264\320\276\320\262\320\245\320\260\321\200\320\260\320\272\321\202\320\265\321\200\320\270\321\201\321\202\320\270\320\2721_edt.json" index c383ead99..3e5cd6ce7 100644 --- "a/src/test/resources/fixtures/mdclasses/ChartsOfCharacteristicTypes.\320\237\320\273\320\260\320\275\320\222\320\270\320\264\320\276\320\262\320\245\320\260\321\200\320\260\320\272\321\202\320\265\321\200\320\270\321\201\321\202\320\270\320\2721_edt.json" +++ "b/src/test/resources/fixtures/mdclasses/ChartsOfCharacteristicTypes.\320\237\320\273\320\260\320\275\320\222\320\270\320\264\320\276\320\262\320\245\320\260\321\200\320\260\320\272\321\202\320\265\321\200\320\270\321\201\321\202\320\270\320\2721_edt.json" @@ -566,5 +566,7 @@ "uuid": "f53a24c3-f1dc-43b7-8dcf-eeb8c0b7f452", "valueType": { "@reference": "/com.github._1c_syntax.bsl.mdo.ChartOfCharacteristicTypes/attributes/c/com.github._1c_syntax.bsl.mdo.children.StandardAttribute[9]/type" - } + }, + "checkUnique": true, + "codeSeries": "WHOLE_CATALOG" }} \ No newline at end of file diff --git a/src/test/resources/fixtures/mdclasses/Configuration.json b/src/test/resources/fixtures/mdclasses/Configuration.json index d2d77df2a..1e9bcb79d 100644 --- a/src/test/resources/fixtures/mdclasses/Configuration.json +++ b/src/test/resources/fixtures/mdclasses/Configuration.json @@ -791,7 +791,9 @@ ], "explanation": { "@reference": "/com.github._1c_syntax.bsl.mdclasses.Configuration/XDTOPackages/com.github._1c_syntax.bsl.mdo.XDTOPackage/synonym" - } + }, + "checkUnique": true, + "codeSeries": "WHOLE_CATALOG" } ], "chartsOfCalculationTypes": [ @@ -882,7 +884,9 @@ }, "explanation": { "@reference": "/com.github._1c_syntax.bsl.mdclasses.Configuration/XDTOPackages/com.github._1c_syntax.bsl.mdo.XDTOPackage/synonym" - } + }, + "checkUnique": true, + "codeSeries": "WHOLE_CATALOG" } ], "commandGroups": [ diff --git a/src/test/resources/fixtures/mdclasses/Configuration_edt.json b/src/test/resources/fixtures/mdclasses/Configuration_edt.json index 7f7a38da6..254b9852d 100644 --- a/src/test/resources/fixtures/mdclasses/Configuration_edt.json +++ b/src/test/resources/fixtures/mdclasses/Configuration_edt.json @@ -791,7 +791,9 @@ ], "explanation": { "@reference": "/com.github._1c_syntax.bsl.mdclasses.Configuration/XDTOPackages/com.github._1c_syntax.bsl.mdo.XDTOPackage/synonym" - } + }, + "checkUnique": true, + "codeSeries": "WHOLE_CATALOG" } ], "chartsOfCalculationTypes": [ @@ -882,7 +884,9 @@ }, "explanation": { "@reference": "/com.github._1c_syntax.bsl.mdclasses.Configuration/XDTOPackages/com.github._1c_syntax.bsl.mdo.XDTOPackage/synonym" - } + }, + "checkUnique": true, + "codeSeries": "WHOLE_CATALOG" } ], "commandGroups": [ diff --git a/src/test/resources/fixtures/mdclasses_3_18/Configuration.json b/src/test/resources/fixtures/mdclasses_3_18/Configuration.json index cebb7516b..9f0a3ab36 100644 --- a/src/test/resources/fixtures/mdclasses_3_18/Configuration.json +++ b/src/test/resources/fixtures/mdclasses_3_18/Configuration.json @@ -92,7 +92,9 @@ }, "explanation": { "@reference": "/com.github._1c_syntax.bsl.mdclasses.Configuration/bots/com.github._1c_syntax.bsl.mdo.Bot/synonym" - } + }, + "checkUnique": true, + "codeSeries": "WHOLE_CATALOG" } ], "commandGroups": [], diff --git a/src/test/resources/fixtures/mdclasses_3_18/Configuration_edt.json b/src/test/resources/fixtures/mdclasses_3_18/Configuration_edt.json index 0e3b7e8ac..d1fed4d46 100644 --- a/src/test/resources/fixtures/mdclasses_3_18/Configuration_edt.json +++ b/src/test/resources/fixtures/mdclasses_3_18/Configuration_edt.json @@ -92,7 +92,9 @@ }, "explanation": { "@reference": "/com.github._1c_syntax.bsl.mdclasses.Configuration/bots/com.github._1c_syntax.bsl.mdo.Bot/synonym" - } + }, + "checkUnique": true, + "codeSeries": "WHOLE_CATALOG" } ], "commandGroups": [], diff --git a/src/test/resources/fixtures/mdclasses_3_24/Configuration_edt.json b/src/test/resources/fixtures/mdclasses_3_24/Configuration_edt.json index d39198871..9a93761da 100644 --- a/src/test/resources/fixtures/mdclasses_3_24/Configuration_edt.json +++ b/src/test/resources/fixtures/mdclasses_3_24/Configuration_edt.json @@ -791,7 +791,9 @@ ], "explanation": { "@reference": "/com.github._1c_syntax.bsl.mdclasses.Configuration/XDTOPackages/com.github._1c_syntax.bsl.mdo.XDTOPackage/synonym" - } + }, + "checkUnique": true, + "codeSeries": "WHOLE_CATALOG" } ], "chartsOfCalculationTypes": [ @@ -882,7 +884,9 @@ }, "explanation": { "@reference": "/com.github._1c_syntax.bsl.mdclasses.Configuration/XDTOPackages/com.github._1c_syntax.bsl.mdo.XDTOPackage/synonym" - } + }, + "checkUnique": true, + "codeSeries": "WHOLE_CATALOG" } ], "commandGroups": [ diff --git a/src/test/resources/fixtures/mdclasses_5_1/Configuration.json b/src/test/resources/fixtures/mdclasses_5_1/Configuration.json index 0fb231421..0db77764d 100644 --- a/src/test/resources/fixtures/mdclasses_5_1/Configuration.json +++ b/src/test/resources/fixtures/mdclasses_5_1/Configuration.json @@ -92,7 +92,9 @@ }, "explanation": { "@reference": "/com.github._1c_syntax.bsl.mdclasses.Configuration/bots/com.github._1c_syntax.bsl.mdo.Bot/synonym" - } + }, + "checkUnique": true, + "codeSeries": "WHOLE_CATALOG" } ], "commandGroups": [], diff --git "a/src/test/resources/fixtures/ssl_3_1/ChartsOfCharacteristicTypes.\320\224\320\276\320\277\320\276\320\273\320\275\320\270\321\202\320\265\320\273\321\214\320\275\321\213\320\265\320\240\320\265\320\272\320\262\320\270\320\267\320\270\321\202\321\213\320\230\320\241\320\262\320\265\320\264\320\265\320\275\320\270\321\217.json" "b/src/test/resources/fixtures/ssl_3_1/ChartsOfCharacteristicTypes.\320\224\320\276\320\277\320\276\320\273\320\275\320\270\321\202\320\265\320\273\321\214\320\275\321\213\320\265\320\240\320\265\320\272\320\262\320\270\320\267\320\270\321\202\321\213\320\230\320\241\320\262\320\265\320\264\320\265\320\275\320\270\321\217.json" index 49cf1e154..a15ac6c5a 100644 --- "a/src/test/resources/fixtures/ssl_3_1/ChartsOfCharacteristicTypes.\320\224\320\276\320\277\320\276\320\273\320\275\320\270\321\202\320\265\320\273\321\214\320\275\321\213\320\265\320\240\320\265\320\272\320\262\320\270\320\267\320\270\321\202\321\213\320\230\320\241\320\262\320\265\320\264\320\265\320\275\320\270\321\217.json" +++ "b/src/test/resources/fixtures/ssl_3_1/ChartsOfCharacteristicTypes.\320\224\320\276\320\277\320\276\320\273\320\275\320\270\321\202\320\265\320\273\321\214\320\275\321\213\320\265\320\240\320\265\320\272\320\262\320\270\320\267\320\270\321\202\321\213\320\230\320\241\320\262\320\265\320\264\320\265\320\275\320\270\321\217.json" @@ -6659,5 +6659,7 @@ "uuid": "1055d15b-8cb5-4ff0-a526-7fd20a08a96c", "valueType": { "@reference": "/com.github._1c_syntax.bsl.mdo.ChartOfCharacteristicTypes/attributes/c/com.github._1c_syntax.bsl.mdo.children.StandardAttribute[2]/type" - } + }, + "checkUnique": false, + "codeSeries": "WHOLE_CATALOG" }} \ No newline at end of file diff --git "a/src/test/resources/fixtures/ssl_3_1/ChartsOfCharacteristicTypes.\320\224\320\276\320\277\320\276\320\273\320\275\320\270\321\202\320\265\320\273\321\214\320\275\321\213\320\265\320\240\320\265\320\272\320\262\320\270\320\267\320\270\321\202\321\213\320\230\320\241\320\262\320\265\320\264\320\265\320\275\320\270\321\217_edt.json" "b/src/test/resources/fixtures/ssl_3_1/ChartsOfCharacteristicTypes.\320\224\320\276\320\277\320\276\320\273\320\275\320\270\321\202\320\265\320\273\321\214\320\275\321\213\320\265\320\240\320\265\320\272\320\262\320\270\320\267\320\270\321\202\321\213\320\230\320\241\320\262\320\265\320\264\320\265\320\275\320\270\321\217_edt.json" index 957b6f867..d6ba4905e 100644 --- "a/src/test/resources/fixtures/ssl_3_1/ChartsOfCharacteristicTypes.\320\224\320\276\320\277\320\276\320\273\320\275\320\270\321\202\320\265\320\273\321\214\320\275\321\213\320\265\320\240\320\265\320\272\320\262\320\270\320\267\320\270\321\202\321\213\320\230\320\241\320\262\320\265\320\264\320\265\320\275\320\270\321\217_edt.json" +++ "b/src/test/resources/fixtures/ssl_3_1/ChartsOfCharacteristicTypes.\320\224\320\276\320\277\320\276\320\273\320\275\320\270\321\202\320\265\320\273\321\214\320\275\321\213\320\265\320\240\320\265\320\272\320\262\320\270\320\267\320\270\321\202\321\213\320\230\320\241\320\262\320\265\320\264\320\265\320\275\320\270\321\217_edt.json" @@ -6635,5 +6635,7 @@ "uuid": "1055d15b-8cb5-4ff0-a526-7fd20a08a96c", "valueType": { "@reference": "/com.github._1c_syntax.bsl.mdo.ChartOfCharacteristicTypes/attributes/c/com.github._1c_syntax.bsl.mdo.children.StandardAttribute[2]/type" - } + }, + "checkUnique": false, + "codeSeries": "WHOLE_CATALOG" }} \ No newline at end of file