Skip to content

Commit 4247395

Browse files
authored
1, добавлена обработка чтения квалификатора двоичных данных в измененном формате edt (#569)
2. обновлены зависимости
1 parent 54237f6 commit 4247395

File tree

4 files changed

+31
-10
lines changed

4 files changed

+31
-10
lines changed

build.gradle.kts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,9 @@ dependencies {
5959

6060
// прочее
6161
implementation("commons-io", "commons-io", "2.18.0")
62-
implementation("io.github.1c-syntax", "bsl-common-library", "0.9.1")
63-
implementation("io.github.1c-syntax", "utils", "0.6.4")
62+
63+
implementation("io.github.1c-syntax", "bsl-common-library", "0.9.2")
64+
implementation("io.github.1c-syntax", "utils", "0.6.8")
6465
implementation("io.github.1c-syntax", "supportconf", "0.15.0") {
6566
exclude("io.github.1c-syntax", "bsl-common-library")
6667
}

src/main/java/com/github/_1c_syntax/bsl/reader/common/converter/ValueTypeQualifierConverter.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,10 @@ public class ValueTypeQualifierConverter implements ReadConverter {
4343
private static final String DATE_QUALIFIERS_NODE_NAME = "DateQualifiers";
4444
private static final String NUMBER_QUALIFIERS_NODE_NAME = "NumberQualifiers";
4545
private static final String BINARY_DATA_QUALIFIERS_NODE_NAME = "BinaryDataQualifiers";
46+
private static final String BINARY_QUALIFIERS_NODE_NAME = "BinaryQualifiers";
4647
private static final String LENGTH_NODE_NAME = "length";
4748
private static final String ALLOWED_LENGTH_NODE_NAME = "allowedLength";
49+
private static final String FIXED_NODE_NAME = "fixed";
4850
private static final String DATE_FRACTIONS_NODE_NAME = "dateFractions";
4951
private static final String SCALE_NODE_NAME = "scale";
5052
private static final String PRECISION_NODE_NAME = "precision";
@@ -71,6 +73,9 @@ public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext co
7173
length = Integer.parseInt(reader.getValue());
7274
} else if (ALLOWED_LENGTH_NODE_NAME.equalsIgnoreCase(reader.getNodeName())) {
7375
allowedLength = AllowedLength.valueByName(reader.getValue());
76+
} else if (FIXED_NODE_NAME.equalsIgnoreCase(reader.getNodeName())) {
77+
var value = Boolean.parseBoolean(reader.getValue());
78+
allowedLength = value ? AllowedLength.FIXED : AllowedLength.VARIABLE;
7479
} else if (DATE_FRACTIONS_NODE_NAME.equalsIgnoreCase(reader.getNodeName())) {
7580
dateFractions = DateFractions.valueByName(reader.getValue());
7681
} else if (SCALE_NODE_NAME.equalsIgnoreCase(reader.getNodeName())
@@ -93,7 +98,8 @@ public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext co
9398
return DateQualifiers.create(dateFractions);
9499
} else if (NUMBER_QUALIFIERS_NODE_NAME.equalsIgnoreCase(nodeName)) {
95100
return NumberQualifiers.create(precision, scale, nonNegative);
96-
} else if (BINARY_DATA_QUALIFIERS_NODE_NAME.equalsIgnoreCase(nodeName)) {
101+
} else if (BINARY_DATA_QUALIFIERS_NODE_NAME.equalsIgnoreCase(nodeName)
102+
|| BINARY_QUALIFIERS_NODE_NAME.equalsIgnoreCase(nodeName)) {
97103
return BinaryDataQualifiers.create(length, allowedLength);
98104
} else { // квалификаторы пока не обрабатываются
99105
LOGGER.warn("Unknown qualifiers {}", nodeName);

src/test/resources/ext/edt/mdclasses/configuration/src/Documents/Документ1/Документ1.mdo

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,14 @@
3232
<name>Реквизит1</name>
3333
<type>
3434
<types>String</types>
35+
<types>BinaryData</types>
3536
<stringQualifiers>
3637
<length>10</length>
3738
</stringQualifiers>
39+
<binaryQualifiers>
40+
<length>16</length>
41+
<fixed>true</fixed>
42+
</binaryQualifiers>
3843
</type>
3944
<minValue xsi:type="core:UndefinedValue"/>
4045
<maxValue xsi:type="core:UndefinedValue"/>

src/test/resources/fixtures/mdclasses/Documents.Документ1_edt.json

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,26 @@
2929
"default": {
3030
"tag": 4
3131
},
32-
"int": 1,
32+
"int": 2,
33+
"com.github._1c_syntax.bsl.types.value.V8ValueType": "BINARY_DATA",
3334
"com.github._1c_syntax.bsl.types.value.PrimitiveValueType": "STRING"
3435
}
3536
],
36-
"composite": false,
37+
"composite": true,
3738
"qualifiers": [
3839
{
3940
"default": {
4041
"tag": 4
4142
},
42-
"int": 1,
43+
"int": 2,
44+
"com.github._1c_syntax.bsl.types.qualifiers.BinaryDataQualifiers": {
45+
"length": 16,
46+
"allowedLength": "FIXED",
47+
"description": {
48+
"nameRu": "КвалификаторыДвоичныхДанных (16, Фиксированная)",
49+
"nameEn": "BinaryDataQualifiers (16, Fixed)"
50+
}
51+
},
4352
"com.github._1c_syntax.bsl.types.qualifiers.StringQualifiers": {
4453
"length": 10,
4554
"allowedLength": "VARIABLE",
@@ -1110,15 +1119,15 @@
11101119
"mdoType": "DOCUMENT",
11111120
"moduleTypes": [
11121121
[
1113-
"ObjectModule",
1122+
"ManagerModule",
11141123
[
1115-
"src/test/resources/ext/edt/mdclasses/configuration/src/Documents/Документ1/ObjectModule.bsl"
1124+
"src/test/resources/ext/edt/mdclasses/configuration/src/Documents/Документ1/ManagerModule.bsl"
11161125
]
11171126
],
11181127
[
1119-
"ManagerModule",
1128+
"ObjectModule",
11201129
[
1121-
"src/test/resources/ext/edt/mdclasses/configuration/src/Documents/Документ1/ManagerModule.bsl"
1130+
"src/test/resources/ext/edt/mdclasses/configuration/src/Documents/Документ1/ObjectModule.bsl"
11221131
]
11231132
]
11241133
],

0 commit comments

Comments
 (0)