Skip to content

Commit 97cd65e

Browse files
authored
Merge pull request #153 from silverbulleters/issue/134
Статус поддержки: учет общего уровня "замка"
2 parents 596c344 + 4a59180 commit 97cd65e

File tree

19 files changed

+510
-1
lines changed

19 files changed

+510
-1
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* This file is a part of MDClasses.
3+
*
4+
* Copyright © 2019 - 2020
5+
* Tymko Oleg <[email protected]>, Maximov Valery <[email protected]> and contributors
6+
*
7+
* SPDX-License-Identifier: LGPL-3.0-or-later
8+
*
9+
* MDClasses is free software; you can redistribute it and/or
10+
* modify it under the terms of the GNU Lesser General Public
11+
* License as published by the Free Software Foundation; either
12+
* version 3.0 of the License, or (at your option) any later version.
13+
*
14+
* MDClasses is distributed in the hope that it will be useful,
15+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17+
* Lesser General Public License for more details.
18+
*
19+
* You should have received a copy of the GNU Lesser General Public
20+
* License along with MDClasses.
21+
*/
22+
package com.github._1c_syntax.mdclasses.metadata.additional;
23+
24+
public enum GeneralSupportVariant {
25+
LOCKED, UNLOCKED
26+
}

src/main/java/com/github/_1c_syntax/mdclasses/metadata/additional/ParseSupportData.java

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ public class ParseSupportData {
4747
private static final int SHIFT_CONFIGURATION_COUNT_OBJECT = 6;
4848
private static final int SHIFT_OBJECT_COUNT = 7;
4949
private static final int COUNT_ELEMENT_OBJECT = 4;
50+
private static final int CONFIGURATION_SUPPORT = 1;
5051

5152
private final Path pathToBinFile;
5253
private final Map<String, Map<SupportConfiguration, SupportVariant>> supportMap = new HashMap<>();
@@ -83,6 +84,8 @@ private void read() throws FileNotFoundException {
8384
var configurationProducer = dataStrings[startPoint + SHIFT_CONFIGURATION_PRODUCER];
8485
var configurationName = dataStrings[startPoint + SHIFT_CONFIGURATION_NAME];
8586
var countObjectsConfiguration = Integer.parseInt(dataStrings[startPoint + SHIFT_CONFIGURATION_COUNT_OBJECT]);
87+
var configurationSupport = Integer.parseInt(dataStrings[CONFIGURATION_SUPPORT]);
88+
var configurationSupportVariant = getGeneralSupportVariantByInt(configurationSupport);
8689

8790
var supportConfiguration
8891
= new SupportConfiguration(configurationName, configurationProducer, configurationVersion);
@@ -100,7 +103,12 @@ private void read() throws FileNotFoundException {
100103
// 0 - не редактируется, 1 - с сохранением поддержки, 2 - снято
101104
var support = Integer.parseInt(dataStrings[currentObjectPoint]);
102105
var guidObject = dataStrings[currentObjectPoint + 2];
103-
var supportVariant = getSupportVariantByInt(support);
106+
SupportVariant supportVariant;
107+
if (configurationSupportVariant == GeneralSupportVariant.LOCKED) {
108+
supportVariant = SupportVariant.NOT_EDITABLE;
109+
} else {
110+
supportVariant = getSupportVariantByInt(support);
111+
}
104112

105113
Map<SupportConfiguration, SupportVariant> map = supportMap.computeIfAbsent(guidObject, k -> new HashMap<>());
106114
map.put(supportConfiguration, supportVariant);
@@ -114,6 +122,14 @@ public Map<String, Map<SupportConfiguration, SupportVariant>> getSupportMap() {
114122
return this.supportMap;
115123
}
116124

125+
private static GeneralSupportVariant getGeneralSupportVariantByInt(int support) {
126+
if (support == 0) {
127+
return GeneralSupportVariant.UNLOCKED;
128+
}
129+
130+
return GeneralSupportVariant.LOCKED;
131+
}
132+
117133
private static SupportVariant getSupportVariantByInt(int support) {
118134
switch (support) {
119135
case 0:

src/test/java/com/github/_1c_syntax/mdclasses/ParseSupportDataTest.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,26 @@ void testConfigurationSupportDesigner() {
9090
assertThat(configuration.getModuleSupport(path.toUri())).containsValue(SupportVariant.NOT_EDITABLE);
9191
}
9292

93+
@Test
94+
void testConfigurationFullSupportDesigner() {
95+
96+
final var PATH_TO_SUPPORT = "src/test/resources/support/original-full-support";
97+
var srcPath = new File(PATH_TO_SUPPORT);
98+
var configuration = Configuration.create(srcPath.toPath());
99+
100+
assertThat(configuration.getModulesBySupport()).isNotEmpty();
101+
102+
var path = Paths.get(PATH_TO_SUPPORT, "Catalogs/ПервыйСправочник/Ext/ObjectModule.bsl").toAbsolutePath();
103+
assertThat(configuration.getModuleSupport(path.toUri())).containsValue(SupportVariant.NOT_EDITABLE);
104+
105+
path = Paths.get(PATH_TO_SUPPORT, "Documents/ПервыйДокумент/Ext/ObjectModule.bsl").toAbsolutePath();
106+
assertThat(configuration.getModuleSupport(path.toUri())).containsValue(SupportVariant.NOT_EDITABLE);
107+
108+
path = Paths.get(PATH_TO_SUPPORT, "Catalogs/ПервыйСправочник/Forms/ФормаЭлемента/Ext/Form/Module.bsl")
109+
.toAbsolutePath();
110+
assertThat(configuration.getModuleSupport(path.toUri())).containsValue(SupportVariant.NOT_EDITABLE);
111+
}
112+
93113
@Test
94114
void testIncorrectSupportBin() {
95115
var path = Path.of(BASE_PATH, "incorrect/ParentConfigurations.bin");
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<MetaDataObject xmlns="http://v8.1c.ru/8.3/MDClasses" xmlns:app="http://v8.1c.ru/8.2/managed-application/core" xmlns:cfg="http://v8.1c.ru/8.1/data/enterprise/current-config" xmlns:cmi="http://v8.1c.ru/8.2/managed-application/cmi" xmlns:ent="http://v8.1c.ru/8.1/data/enterprise" xmlns:lf="http://v8.1c.ru/8.2/managed-application/logform" xmlns:style="http://v8.1c.ru/8.1/data/ui/style" xmlns:sys="http://v8.1c.ru/8.1/data/ui/fonts/system" xmlns:v8="http://v8.1c.ru/8.1/data/core" xmlns:v8ui="http://v8.1c.ru/8.1/data/ui" xmlns:web="http://v8.1c.ru/8.1/data/ui/colors/web" xmlns:win="http://v8.1c.ru/8.1/data/ui/colors/windows" xmlns:xen="http://v8.1c.ru/8.3/xcf/enums" xmlns:xpr="http://v8.1c.ru/8.3/xcf/predef" xmlns:xr="http://v8.1c.ru/8.3/xcf/readable" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.6">
3+
<Catalog uuid="3c907782-1b24-440c-b0de-1d62cebde27b">
4+
<InternalInfo>
5+
<xr:GeneratedType name="CatalogObject.ПервыйСправочник" category="Object">
6+
<xr:TypeId>a21c86e8-da1c-4ae4-bdf6-a36f12e10e82</xr:TypeId>
7+
<xr:ValueId>311cfe13-bf49-47ea-8310-91c20a389884</xr:ValueId>
8+
</xr:GeneratedType>
9+
<xr:GeneratedType name="CatalogRef.ПервыйСправочник" category="Ref">
10+
<xr:TypeId>72976dd0-f6de-45e5-b943-4b620b729f99</xr:TypeId>
11+
<xr:ValueId>6e00f5ee-09ab-4b3f-ae2c-e1cbb8f7ef74</xr:ValueId>
12+
</xr:GeneratedType>
13+
<xr:GeneratedType name="CatalogSelection.ПервыйСправочник" category="Selection">
14+
<xr:TypeId>894e7847-9c4a-40b9-8a4b-d41c0a3ee937</xr:TypeId>
15+
<xr:ValueId>75bd6acf-71c4-4a5c-bf4a-4c29d5c1bb24</xr:ValueId>
16+
</xr:GeneratedType>
17+
<xr:GeneratedType name="CatalogList.ПервыйСправочник" category="List">
18+
<xr:TypeId>625e341b-40fa-400e-81c3-2581658c6ba9</xr:TypeId>
19+
<xr:ValueId>f4609031-7be5-4206-905f-dc65b280f316</xr:ValueId>
20+
</xr:GeneratedType>
21+
<xr:GeneratedType name="CatalogManager.ПервыйСправочник" category="Manager">
22+
<xr:TypeId>d8efa11e-5c91-4b7f-942e-6949936ae254</xr:TypeId>
23+
<xr:ValueId>90d851b0-8583-46f7-bf19-f958d46da902</xr:ValueId>
24+
</xr:GeneratedType>
25+
</InternalInfo>
26+
<Properties>
27+
<Name>ПервыйСправочник</Name>
28+
<Synonym>
29+
<v8:item>
30+
<v8:lang>ru</v8:lang>
31+
<v8:content>Первый справочник</v8:content>
32+
</v8:item>
33+
</Synonym>
34+
<Comment/>
35+
<Hierarchical>false</Hierarchical>
36+
<HierarchyType>HierarchyFoldersAndItems</HierarchyType>
37+
<LimitLevelCount>false</LimitLevelCount>
38+
<LevelCount>2</LevelCount>
39+
<FoldersOnTop>true</FoldersOnTop>
40+
<UseStandardCommands>true</UseStandardCommands>
41+
<Owners/>
42+
<SubordinationUse>ToItems</SubordinationUse>
43+
<CodeLength>9</CodeLength>
44+
<DescriptionLength>25</DescriptionLength>
45+
<CodeType>String</CodeType>
46+
<CodeAllowedLength>Variable</CodeAllowedLength>
47+
<CodeSeries>WholeCatalog</CodeSeries>
48+
<CheckUnique>true</CheckUnique>
49+
<Autonumbering>true</Autonumbering>
50+
<DefaultPresentation>AsDescription</DefaultPresentation>
51+
<Characteristics/>
52+
<PredefinedDataUpdate>Auto</PredefinedDataUpdate>
53+
<EditType>InDialog</EditType>
54+
<QuickChoice>false</QuickChoice>
55+
<ChoiceMode>BothWays</ChoiceMode>
56+
<InputByString>
57+
<xr:Field>Catalog.ПервыйСправочник.StandardAttribute.Description</xr:Field>
58+
<xr:Field>Catalog.ПервыйСправочник.StandardAttribute.Code</xr:Field>
59+
</InputByString>
60+
<SearchStringModeOnInputByString>Begin</SearchStringModeOnInputByString>
61+
<FullTextSearchOnInputByString>DontUse</FullTextSearchOnInputByString>
62+
<ChoiceDataGetModeOnInputByString>Directly</ChoiceDataGetModeOnInputByString>
63+
<DefaultObjectForm>Catalog.ПервыйСправочник.Form.ФормаЭлемента</DefaultObjectForm>
64+
<DefaultFolderForm/>
65+
<DefaultListForm/>
66+
<DefaultChoiceForm/>
67+
<DefaultFolderChoiceForm/>
68+
<AuxiliaryObjectForm/>
69+
<AuxiliaryFolderForm/>
70+
<AuxiliaryListForm/>
71+
<AuxiliaryChoiceForm/>
72+
<AuxiliaryFolderChoiceForm/>
73+
<IncludeHelpInContents>false</IncludeHelpInContents>
74+
<BasedOn/>
75+
<DataLockFields/>
76+
<DataLockControlMode>Managed</DataLockControlMode>
77+
<FullTextSearch>Use</FullTextSearch>
78+
<ObjectPresentation/>
79+
<ExtendedObjectPresentation/>
80+
<ListPresentation/>
81+
<ExtendedListPresentation/>
82+
<Explanation/>
83+
<CreateOnInput>Use</CreateOnInput>
84+
<ChoiceHistoryOnInput>Auto</ChoiceHistoryOnInput>
85+
<DataHistory>DontUse</DataHistory>
86+
</Properties>
87+
<ChildObjects>
88+
<Form>ФормаЭлемента</Form>
89+
<Command uuid="28777e74-89cf-4993-8a0a-a5d2b9a758b9">
90+
<Properties>
91+
<Name>ПерваяКоманда</Name>
92+
<Synonym>
93+
<v8:item>
94+
<v8:lang>ru</v8:lang>
95+
<v8:content>Первая команда</v8:content>
96+
</v8:item>
97+
</Synonym>
98+
<Comment/>
99+
<Group>NavigationPanelImportant</Group>
100+
<CommandParameterType/>
101+
<ParameterUseMode>Single</ParameterUseMode>
102+
<ModifiesData>false</ModifiesData>
103+
<Representation>Auto</Representation>
104+
<ToolTip/>
105+
<Picture/>
106+
<Shortcut/>
107+
</Properties>
108+
</Command>
109+
</ChildObjects>
110+
</Catalog>
111+
</MetaDataObject>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
&НаКлиенте
3+
Процедура ОбработкаКоманды(ПараметрКоманды, ПараметрыВыполненияКоманды)
4+
Сообщить("Ошибочка вышла");
5+
КонецПроцедуры
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
3+
Процедура ОбработкаПолученияДанныхВыбора(ДанныеВыбора, Параметры, СтандартнаяОбработка)
4+
5+
Сообщить("Ошибочка вышла");
6+
7+
КонецПроцедуры
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Сообщить("Ошибочка вышла");
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<MetaDataObject xmlns="http://v8.1c.ru/8.3/MDClasses" xmlns:app="http://v8.1c.ru/8.2/managed-application/core" xmlns:cfg="http://v8.1c.ru/8.1/data/enterprise/current-config" xmlns:cmi="http://v8.1c.ru/8.2/managed-application/cmi" xmlns:ent="http://v8.1c.ru/8.1/data/enterprise" xmlns:lf="http://v8.1c.ru/8.2/managed-application/logform" xmlns:style="http://v8.1c.ru/8.1/data/ui/style" xmlns:sys="http://v8.1c.ru/8.1/data/ui/fonts/system" xmlns:v8="http://v8.1c.ru/8.1/data/core" xmlns:v8ui="http://v8.1c.ru/8.1/data/ui" xmlns:web="http://v8.1c.ru/8.1/data/ui/colors/web" xmlns:win="http://v8.1c.ru/8.1/data/ui/colors/windows" xmlns:xen="http://v8.1c.ru/8.3/xcf/enums" xmlns:xpr="http://v8.1c.ru/8.3/xcf/predef" xmlns:xr="http://v8.1c.ru/8.3/xcf/readable" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.6">
3+
<Form uuid="8d639442-519d-4428-9419-101221820694">
4+
<Properties>
5+
<Name>ФормаЭлемента</Name>
6+
<Synonym>
7+
<v8:item>
8+
<v8:lang>ru</v8:lang>
9+
<v8:content>Форма элемента</v8:content>
10+
</v8:item>
11+
</Synonym>
12+
<Comment/>
13+
<FormType>Managed</FormType>
14+
<IncludeHelpInContents>false</IncludeHelpInContents>
15+
<UsePurposes>
16+
<v8:Value xsi:type="app:ApplicationUsePurpose">PlatformApplication</v8:Value>
17+
<v8:Value xsi:type="app:ApplicationUsePurpose">MobilePlatformApplication</v8:Value>
18+
</UsePurposes>
19+
</Properties>
20+
</Form>
21+
</MetaDataObject>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Form xmlns="http://v8.1c.ru/8.3/xcf/logform" xmlns:app="http://v8.1c.ru/8.2/managed-application/core" xmlns:cfg="http://v8.1c.ru/8.1/data/enterprise/current-config" xmlns:dcscor="http://v8.1c.ru/8.1/data-composition-system/core" xmlns:dcsset="http://v8.1c.ru/8.1/data-composition-system/settings" xmlns:ent="http://v8.1c.ru/8.1/data/enterprise" xmlns:lf="http://v8.1c.ru/8.2/managed-application/logform" xmlns:style="http://v8.1c.ru/8.1/data/ui/style" xmlns:sys="http://v8.1c.ru/8.1/data/ui/fonts/system" xmlns:v8="http://v8.1c.ru/8.1/data/core" xmlns:v8ui="http://v8.1c.ru/8.1/data/ui" xmlns:web="http://v8.1c.ru/8.1/data/ui/colors/web" xmlns:win="http://v8.1c.ru/8.1/data/ui/colors/windows" xmlns:xr="http://v8.1c.ru/8.3/xcf/readable" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.6">
3+
<WindowOpeningMode>LockOwnerWindow</WindowOpeningMode>
4+
<UseForFoldersAndItems>Items</UseForFoldersAndItems>
5+
<AutoCommandBar name="ФормаКоманднаяПанель" id="-1"/>
6+
<Events>
7+
<Event name="OnCreateAtServer">ПриСозданииНаСервере</Event>
8+
</Events>
9+
<ChildItems>
10+
<InputField name="Код" id="1">
11+
<DataPath>Объект.Code</DataPath>
12+
<EditMode>EnterOnInput</EditMode>
13+
<ContextMenu name="КодКонтекстноеМеню" id="2"/>
14+
<ExtendedTooltip name="КодРасширеннаяПодсказка" id="3"/>
15+
</InputField>
16+
<InputField name="Наименование" id="4">
17+
<DataPath>Объект.Description</DataPath>
18+
<EditMode>EnterOnInput</EditMode>
19+
<ContextMenu name="НаименованиеКонтекстноеМеню" id="5"/>
20+
<ExtendedTooltip name="НаименованиеРасширеннаяПодсказка" id="6"/>
21+
</InputField>
22+
</ChildItems>
23+
<Attributes>
24+
<Attribute name="Объект" id="1">
25+
<Type>
26+
<v8:Type>cfg:CatalogObject.ПервыйСправочник</v8:Type>
27+
</Type>
28+
<MainAttribute>true</MainAttribute>
29+
<SavedData>true</SavedData>
30+
</Attribute>
31+
</Attributes>
32+
</Form>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
&НаСервере
3+
Процедура ПриСозданииНаСервере(Отказ, СтандартнаяОбработка)
4+
Сообщить("Ошибочка вышла");
5+
КонецПроцедуры

0 commit comments

Comments
 (0)