Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions src/main/java/com/github/_1c_syntax/bsl/mdo/ChartOfAccounts.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;

/**
* Возвращает перечень возможных прав доступа
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;

/**
* Возвращает перечень возможных прав доступа
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -49,4 +50,31 @@ void test(ArgumentsAccessor argumentsAccessor) {
assertThat(chartOfAccounts.getAccountingFlags()).hasSize(1);
assertThat(chartOfAccounts.getExtDimensionAccountingFlags()).hasSize(1);
}

/**
* Проверяет, что для плана счетов "ПланСчетов1" поле checkUnique установлено в true.
* <p>
* В формате Designer: в XML файле явно указано {@code <checkUnique>true</checkUnique>}.
* В формате EDT: в XML файле явно указано {@code <checkUnique>true</checkUnique>}.
*
* @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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -39,4 +42,31 @@ class ChartOfCharacteristicTypesTest {
void test(ArgumentsAccessor argumentsAccessor) {
var mdo = MDTestUtils.getMDWithSimpleTest(argumentsAccessor);
}

/**
* Проверяет, что для плана видов характеристик "ПланВидовХарактеристик1" поле checkUnique установлено в true.
* <p>
* В формате Designer: в XML файле явно указано {@code <checkUnique>true</checkUnique>}.
* В формате EDT: в XML файле явно указано {@code <checkUnique>true</checkUnique>}.
*
* @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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -670,5 +670,7 @@
},
"tabularSections": [],
"templates": [],
"uuid": "2766f353-abd2-4e7f-9a95-53f05c83f5d4"
"uuid": "2766f353-abd2-4e7f-9a95-53f05c83f5d4",
"checkUnique": true,
"codeSeries": "WHOLE_CATALOG"
}}
Original file line number Diff line number Diff line change
Expand Up @@ -670,5 +670,7 @@
},
"tabularSections": [],
"templates": [],
"uuid": "2766f353-abd2-4e7f-9a95-53f05c83f5d4"
"uuid": "2766f353-abd2-4e7f-9a95-53f05c83f5d4",
"checkUnique": true,
"codeSeries": "WHOLE_CATALOG"
}}
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}}
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}}
8 changes: 6 additions & 2 deletions src/test/resources/fixtures/mdclasses/Configuration.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down Expand Up @@ -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": [
Expand Down
8 changes: 6 additions & 2 deletions src/test/resources/fixtures/mdclasses/Configuration_edt.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down Expand Up @@ -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": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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": [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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": [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down Expand Up @@ -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": [
Expand Down
4 changes: 3 additions & 1 deletion src/test/resources/fixtures/mdclasses_5_1/Configuration.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}}
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}}
Loading