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
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* This file is a part of MDClasses.
*
* Copyright © 2019 - 2020
* Tymko Oleg <olegtymko@yandex.ru>, Maximov Valery <maximovvalery@gmail.com> and contributors
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*
* MDClasses is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
* MDClasses is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with MDClasses.
*/
package com.github._1c_syntax.mdclasses.metadata.additional;

public enum GeneralSupportVariant {
LOCKED, UNLOCKED
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public class ParseSupportData {
private static final int SHIFT_CONFIGURATION_COUNT_OBJECT = 6;
private static final int SHIFT_OBJECT_COUNT = 7;
private static final int COUNT_ELEMENT_OBJECT = 4;
private static final int CONFIGURATION_SUPPORT = 1;

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

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

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

private static GeneralSupportVariant getGeneralSupportVariantByInt(int support) {
if (support == 0) {
return GeneralSupportVariant.UNLOCKED;
}

return GeneralSupportVariant.LOCKED;
}

private static SupportVariant getSupportVariantByInt(int support) {
switch (support) {
case 0:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,26 @@ void testConfigurationSupportDesigner() {
assertThat(configuration.getModuleSupport(path.toUri())).containsValue(SupportVariant.NOT_EDITABLE);
}

@Test
void testConfigurationFullSupportDesigner() {

final var PATH_TO_SUPPORT = "src/test/resources/support/original-full-support";
var srcPath = new File(PATH_TO_SUPPORT);
var configuration = Configuration.create(srcPath.toPath());

assertThat(configuration.getModulesBySupport()).isNotEmpty();

var path = Paths.get(PATH_TO_SUPPORT, "Catalogs/ПервыйСправочник/Ext/ObjectModule.bsl").toAbsolutePath();
assertThat(configuration.getModuleSupport(path.toUri())).containsValue(SupportVariant.NOT_EDITABLE);

path = Paths.get(PATH_TO_SUPPORT, "Documents/ПервыйДокумент/Ext/ObjectModule.bsl").toAbsolutePath();
assertThat(configuration.getModuleSupport(path.toUri())).containsValue(SupportVariant.NOT_EDITABLE);

path = Paths.get(PATH_TO_SUPPORT, "Catalogs/ПервыйСправочник/Forms/ФормаЭлемента/Ext/Form/Module.bsl")
.toAbsolutePath();
assertThat(configuration.getModuleSupport(path.toUri())).containsValue(SupportVariant.NOT_EDITABLE);
}

@Test
void testIncorrectSupportBin() {
var path = Path.of(BASE_PATH, "incorrect/ParentConfigurations.bin");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
<?xml version="1.0" encoding="UTF-8"?>
<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">
<Catalog uuid="3c907782-1b24-440c-b0de-1d62cebde27b">
<InternalInfo>
<xr:GeneratedType name="CatalogObject.ПервыйСправочник" category="Object">
<xr:TypeId>a21c86e8-da1c-4ae4-bdf6-a36f12e10e82</xr:TypeId>
<xr:ValueId>311cfe13-bf49-47ea-8310-91c20a389884</xr:ValueId>
</xr:GeneratedType>
<xr:GeneratedType name="CatalogRef.ПервыйСправочник" category="Ref">
<xr:TypeId>72976dd0-f6de-45e5-b943-4b620b729f99</xr:TypeId>
<xr:ValueId>6e00f5ee-09ab-4b3f-ae2c-e1cbb8f7ef74</xr:ValueId>
</xr:GeneratedType>
<xr:GeneratedType name="CatalogSelection.ПервыйСправочник" category="Selection">
<xr:TypeId>894e7847-9c4a-40b9-8a4b-d41c0a3ee937</xr:TypeId>
<xr:ValueId>75bd6acf-71c4-4a5c-bf4a-4c29d5c1bb24</xr:ValueId>
</xr:GeneratedType>
<xr:GeneratedType name="CatalogList.ПервыйСправочник" category="List">
<xr:TypeId>625e341b-40fa-400e-81c3-2581658c6ba9</xr:TypeId>
<xr:ValueId>f4609031-7be5-4206-905f-dc65b280f316</xr:ValueId>
</xr:GeneratedType>
<xr:GeneratedType name="CatalogManager.ПервыйСправочник" category="Manager">
<xr:TypeId>d8efa11e-5c91-4b7f-942e-6949936ae254</xr:TypeId>
<xr:ValueId>90d851b0-8583-46f7-bf19-f958d46da902</xr:ValueId>
</xr:GeneratedType>
</InternalInfo>
<Properties>
<Name>ПервыйСправочник</Name>
<Synonym>
<v8:item>
<v8:lang>ru</v8:lang>
<v8:content>Первый справочник</v8:content>
</v8:item>
</Synonym>
<Comment/>
<Hierarchical>false</Hierarchical>
<HierarchyType>HierarchyFoldersAndItems</HierarchyType>
<LimitLevelCount>false</LimitLevelCount>
<LevelCount>2</LevelCount>
<FoldersOnTop>true</FoldersOnTop>
<UseStandardCommands>true</UseStandardCommands>
<Owners/>
<SubordinationUse>ToItems</SubordinationUse>
<CodeLength>9</CodeLength>
<DescriptionLength>25</DescriptionLength>
<CodeType>String</CodeType>
<CodeAllowedLength>Variable</CodeAllowedLength>
<CodeSeries>WholeCatalog</CodeSeries>
<CheckUnique>true</CheckUnique>
<Autonumbering>true</Autonumbering>
<DefaultPresentation>AsDescription</DefaultPresentation>
<Characteristics/>
<PredefinedDataUpdate>Auto</PredefinedDataUpdate>
<EditType>InDialog</EditType>
<QuickChoice>false</QuickChoice>
<ChoiceMode>BothWays</ChoiceMode>
<InputByString>
<xr:Field>Catalog.ПервыйСправочник.StandardAttribute.Description</xr:Field>
<xr:Field>Catalog.ПервыйСправочник.StandardAttribute.Code</xr:Field>
</InputByString>
<SearchStringModeOnInputByString>Begin</SearchStringModeOnInputByString>
<FullTextSearchOnInputByString>DontUse</FullTextSearchOnInputByString>
<ChoiceDataGetModeOnInputByString>Directly</ChoiceDataGetModeOnInputByString>
<DefaultObjectForm>Catalog.ПервыйСправочник.Form.ФормаЭлемента</DefaultObjectForm>
<DefaultFolderForm/>
<DefaultListForm/>
<DefaultChoiceForm/>
<DefaultFolderChoiceForm/>
<AuxiliaryObjectForm/>
<AuxiliaryFolderForm/>
<AuxiliaryListForm/>
<AuxiliaryChoiceForm/>
<AuxiliaryFolderChoiceForm/>
<IncludeHelpInContents>false</IncludeHelpInContents>
<BasedOn/>
<DataLockFields/>
<DataLockControlMode>Managed</DataLockControlMode>
<FullTextSearch>Use</FullTextSearch>
<ObjectPresentation/>
<ExtendedObjectPresentation/>
<ListPresentation/>
<ExtendedListPresentation/>
<Explanation/>
<CreateOnInput>Use</CreateOnInput>
<ChoiceHistoryOnInput>Auto</ChoiceHistoryOnInput>
<DataHistory>DontUse</DataHistory>
</Properties>
<ChildObjects>
<Form>ФормаЭлемента</Form>
<Command uuid="28777e74-89cf-4993-8a0a-a5d2b9a758b9">
<Properties>
<Name>ПерваяКоманда</Name>
<Synonym>
<v8:item>
<v8:lang>ru</v8:lang>
<v8:content>Первая команда</v8:content>
</v8:item>
</Synonym>
<Comment/>
<Group>NavigationPanelImportant</Group>
<CommandParameterType/>
<ParameterUseMode>Single</ParameterUseMode>
<ModifiesData>false</ModifiesData>
<Representation>Auto</Representation>
<ToolTip/>
<Picture/>
<Shortcut/>
</Properties>
</Command>
</ChildObjects>
</Catalog>
</MetaDataObject>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

&НаКлиенте
Процедура ОбработкаКоманды(ПараметрКоманды, ПараметрыВыполненияКоманды)
Сообщить("Ошибочка вышла");
КонецПроцедуры
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@


Процедура ОбработкаПолученияДанныхВыбора(ДанныеВыбора, Параметры, СтандартнаяОбработка)

Сообщить("Ошибочка вышла");

КонецПроцедуры
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Сообщить("Ошибочка вышла");
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<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">
<Form uuid="8d639442-519d-4428-9419-101221820694">
<Properties>
<Name>ФормаЭлемента</Name>
<Synonym>
<v8:item>
<v8:lang>ru</v8:lang>
<v8:content>Форма элемента</v8:content>
</v8:item>
</Synonym>
<Comment/>
<FormType>Managed</FormType>
<IncludeHelpInContents>false</IncludeHelpInContents>
<UsePurposes>
<v8:Value xsi:type="app:ApplicationUsePurpose">PlatformApplication</v8:Value>
<v8:Value xsi:type="app:ApplicationUsePurpose">MobilePlatformApplication</v8:Value>
</UsePurposes>
</Properties>
</Form>
</MetaDataObject>
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<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">
<WindowOpeningMode>LockOwnerWindow</WindowOpeningMode>
<UseForFoldersAndItems>Items</UseForFoldersAndItems>
<AutoCommandBar name="ФормаКоманднаяПанель" id="-1"/>
<Events>
<Event name="OnCreateAtServer">ПриСозданииНаСервере</Event>
</Events>
<ChildItems>
<InputField name="Код" id="1">
<DataPath>Объект.Code</DataPath>
<EditMode>EnterOnInput</EditMode>
<ContextMenu name="КодКонтекстноеМеню" id="2"/>
<ExtendedTooltip name="КодРасширеннаяПодсказка" id="3"/>
</InputField>
<InputField name="Наименование" id="4">
<DataPath>Объект.Description</DataPath>
<EditMode>EnterOnInput</EditMode>
<ContextMenu name="НаименованиеКонтекстноеМеню" id="5"/>
<ExtendedTooltip name="НаименованиеРасширеннаяПодсказка" id="6"/>
</InputField>
</ChildItems>
<Attributes>
<Attribute name="Объект" id="1">
<Type>
<v8:Type>cfg:CatalogObject.ПервыйСправочник</v8:Type>
</Type>
<MainAttribute>true</MainAttribute>
<SavedData>true</SavedData>
</Attribute>
</Attributes>
</Form>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

&НаСервере
Процедура ПриСозданииНаСервере(Отказ, СтандартнаяОбработка)
Сообщить("Ошибочка вышла");
КонецПроцедуры
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<ConfigDumpInfo xmlns="http://v8.1c.ru/8.3/xcf/dumpinfo" xmlns:xen="http://v8.1c.ru/8.3/xcf/enums" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" format="Hierarchical" version="2.6">
<ConfigVersions>
<Metadata name="Catalog.ПервыйСправочник" id="3c907782-1b24-440c-b0de-1d62cebde27b" configVersion="dcb26e17c0261c409d500d02a724818100000000">
<Metadata name="Catalog.ПервыйСправочник.Command.ПерваяКоманда" id="28777e74-89cf-4993-8a0a-a5d2b9a758b9"/>
</Metadata>
<Metadata name="Catalog.ПервыйСправочник.Command.ПерваяКоманда.CommandModule" id="28777e74-89cf-4993-8a0a-a5d2b9a758b9.2" configVersion="5abbf92695059e4197c30d2f189de67200000000"/>
<Metadata name="Catalog.ПервыйСправочник.Form.ФормаЭлемента" id="8d639442-519d-4428-9419-101221820694" configVersion="aa19f7e95af93845b26b08df10d6eefd00000000"/>
<Metadata name="Catalog.ПервыйСправочник.Form.ФормаЭлемента.Form" id="8d639442-519d-4428-9419-101221820694.0" configVersion="e4cb0178c3a26b4d9030ae5e17b274db00000000"/>
<Metadata name="Catalog.ПервыйСправочник.ManagerModule" id="3c907782-1b24-440c-b0de-1d62cebde27b.3" configVersion="2d80d205c0b9ca4b8487dee591e5ec6900000000"/>
<Metadata name="Catalog.ПервыйСправочник.ObjectModule" id="3c907782-1b24-440c-b0de-1d62cebde27b.0" configVersion="4bbdb05f48a69f479f65180d6de2077100000000"/>
<Metadata name="CommonForm.ЛучшаяОбщаяФорма" id="df133230-33b2-42ac-8b8b-aae801d5007f" configVersion="c2e95cb01fa9274697fca7e552e09bd100000000"/>
<Metadata name="CommonForm.ЛучшаяОбщаяФорма.Form" id="df133230-33b2-42ac-8b8b-aae801d5007f.0" configVersion="de1553e38a42ff469b04c41da6c2615300000000"/>
<Metadata name="CommonModule.ПервыйОбщийМодуль" id="c3095903-aa1e-4d1f-b5d2-420ec6099865" configVersion="a3bc0356414571439d21bcb4b6881efb00000000"/>
<Metadata name="Configuration.Конфигурация" id="50791551-3395-4b3f-94e4-c4dac0be017f" configVersion="00c30239831f9340a55716a527daee7600000000"/>
<Metadata name="Configuration.Конфигурация.ExternalConnectionModule" id="5b69bac5-4e0e-41d2-9bcb-53cf67d461b4.5" configVersion="8c26e96b8a6bf24b81920872a64e6e9f00000000"/>
<Metadata name="Configuration.Конфигурация.ManagedApplicationModule" id="5b69bac5-4e0e-41d2-9bcb-53cf67d461b4.6" configVersion="cdad99eee82096428c316687e22215e000000000"/>
<Metadata name="Configuration.Конфигурация.ParentConfigurations" id="5b69bac5-4e0e-41d2-9bcb-53cf67d461b4.4" configVersion="f4aff972deb12343ae6f74085de4bbb000000000"/>
<Metadata name="Configuration.Конфигурация.SessionModule" id="5b69bac5-4e0e-41d2-9bcb-53cf67d461b4.7" configVersion="fc84deba0ea13a4eb08a917ee6d12fc800000000"/>
<Metadata name="Document.ПервыйДокумент" id="2b5d5d5d-3fa5-4448-a8e3-13011eb483cb" configVersion="0b0b3ee47e6ff84f83ffe6028be26e0500000000"/>
<Metadata name="Document.ПервыйДокумент.ObjectModule" id="2b5d5d5d-3fa5-4448-a8e3-13011eb483cb.0" configVersion="4b21c00e5fae234aae841292057494ea00000000"/>
<Metadata name="Enum.ПервоеПеречисление" id="4767485f-69d9-400f-8be7-af5c460f1664" configVersion="12780e69c504c348bd8d26899dc96d1b00000000"/>
<Metadata name="Enum.ПервоеПеречисление.ManagerModule" id="4767485f-69d9-400f-8be7-af5c460f1664.0" configVersion="1b389e4a259de74d9e1d70098027a17400000000"/>
<Metadata name="Language.Русский" id="f8329cee-9d65-483d-b30f-f14618ca8e9c" configVersion="be77dd1dca46a4449ceac52b7c2f8f2100000000"/>
</ConfigVersions>
</ConfigDumpInfo>
Loading