-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
91 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/main/java/com/github/_1c_syntax/bsl/support/CompatibilityMode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/* | ||
* This file is a part of BSL Common library. | ||
* | ||
* Copyright (c) 2021 - 2022 | ||
* Copyright (c) 2021 - 2023 | ||
* Tymko Oleg <[email protected]>, Maximov Valery <[email protected]> and contributors | ||
* | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
|
2 changes: 1 addition & 1 deletion
2
src/main/java/com/github/_1c_syntax/bsl/support/SupportVariant.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/* | ||
* This file is a part of BSL Common library. | ||
* | ||
* Copyright (c) 2021 - 2022 | ||
* Copyright (c) 2021 - 2023 | ||
* Tymko Oleg <[email protected]>, Maximov Valery <[email protected]> and contributors | ||
* | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
|
2 changes: 1 addition & 1 deletion
2
src/main/java/com/github/_1c_syntax/bsl/types/ConfigurationSource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/* | ||
* This file is a part of BSL Common library. | ||
* | ||
* Copyright (c) 2021 - 2022 | ||
* Copyright (c) 2021 - 2023 | ||
* Tymko Oleg <[email protected]>, Maximov Valery <[email protected]> and contributors | ||
* | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,25 @@ | ||
/* | ||
* This file is a part of BSL Common library. | ||
* | ||
* Copyright (c) 2021 - 2022 | ||
* Tymko Oleg <[email protected]>, Maximov Valery <[email protected]> and contributors | ||
* | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
* | ||
* BSL Common library 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. | ||
* | ||
* BSL Common library 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 BSL Common library. | ||
*/ | ||
package com.github._1c_syntax.bsl.types; | ||
/* | ||
* This file is a part of BSL Common library. | ||
* | ||
* Copyright (c) 2021 - 2023 | ||
* Tymko Oleg <[email protected]>, Maximov Valery <[email protected]> and contributors | ||
* | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
* | ||
* BSL Common library 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. | ||
* | ||
* BSL Common library 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 BSL Common library. | ||
*/ | ||
package com.github._1c_syntax.bsl.types; | ||
|
||
import lombok.Getter; | ||
import org.apache.commons.collections4.map.CaseInsensitiveMap; | ||
|
@@ -91,7 +91,9 @@ public enum MDOType { | |
COMMAND("Command", "Commands", "Команда", "Команды"), | ||
TEMPLATE("Template", "Templates", "Макет", "Макеты"), | ||
ATTRIBUTE("Attribute", "Attributes", "Реквизит", "Реквизиты"), | ||
STANDARD_ATTRIBUTE("StandardAttribute", "StandardAttributes", "СтандартныйРеквизит", "СтандартныеРеквизиты"), | ||
TABULAR_SECTION("TabularSection", "TabularSections", "ТабличнаяЧасть", "ТабличныеЧасти"), | ||
STANDARD_TABULAR_SECTION("StandardTabularSection", "StandardTabularSections", "СтандартнаяТабличнаяЧасть", "СтандартныеТабличныеЧасти"), | ||
RECALCULATION("Recalculation", "Recalculations", "Перерасчет", "Перерасчеты"), | ||
WS_OPERATION("Operation", "Operations", "Операция", "Операции"), | ||
WS_OPERATION_PARAMETER("Parameter", "Parameters", "Параметр", "Параметры"), | ||
|
@@ -105,6 +107,9 @@ public enum MDOType { | |
COLUMN("Column", "Columns", "Колонка", "Колонки"), | ||
ACCOUNTING_FLAG("AccountingFlag", "AccountingFlags", "ПризнакУчета", "ПризнакиУчета"), | ||
EXT_DIMENSION_ACCOUNTING_FLAG("ExtDimensionAccountingFlag", "ExtDimensionAccountingFlags", "ПризнакУчетаСубконто", "ПризнакиУчетаСубконто"), | ||
|
||
EXTERNAL_DATA_SOURCE_TABLE("Table", "Tables", "Таблица", "Таблицы"), | ||
EXTERNAL_DATA_SOURCE_TABLE_FILED("Field", "Fields", "Поле", "Поля"), | ||
UNKNOWN("", "", "", ""); | ||
|
||
private static final Map<String, MDOType> MAP_TYPES = computeMapTypes(); | ||
|
@@ -148,7 +153,7 @@ public enum MDOType { | |
*/ | ||
public static List<MDOType> valuesWithoutChildren() { | ||
return Arrays.stream(values()).filter(mdoType -> | ||
!CHILD_TYPES.contains(mdoType) && mdoType != UNKNOWN) | ||
!CHILD_TYPES.contains(mdoType) && mdoType != UNKNOWN) | ||
.collect(Collectors.toList()); | ||
} | ||
|
||
|
@@ -178,6 +183,7 @@ private static Set<MDOType> computeChildTypes() { | |
return Set.of(FORM, COMMAND, TEMPLATE, ATTRIBUTE, TABULAR_SECTION, RECALCULATION, WS_OPERATION, | ||
WS_OPERATION_PARAMETER, HTTP_SERVICE_URL_TEMPLATE, HTTP_SERVICE_METHOD, INTEGRATION_SERVICE_CHANNEL, | ||
TASK_ADDRESSING_ATTRIBUTE, DIMENSION, RESOURCE, ENUM_VALUE, COLUMN, | ||
ACCOUNTING_FLAG, EXT_DIMENSION_ACCOUNTING_FLAG); | ||
ACCOUNTING_FLAG, EXT_DIMENSION_ACCOUNTING_FLAG, STANDARD_ATTRIBUTE, STANDARD_TABULAR_SECTION, | ||
EXTERNAL_DATA_SOURCE_TABLE, EXTERNAL_DATA_SOURCE_TABLE_FILED); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/* | ||
* This file is a part of BSL Common library. | ||
* | ||
* Copyright (c) 2021 - 2022 | ||
* Copyright (c) 2021 - 2023 | ||
* Tymko Oleg <[email protected]>, Maximov Valery <[email protected]> and contributors | ||
* | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
|
@@ -27,6 +27,7 @@ | |
import lombok.ToString; | ||
import lombok.Value; | ||
|
||
import javax.annotation.Nullable; | ||
import java.util.Map; | ||
import java.util.Optional; | ||
import java.util.concurrent.ConcurrentSkipListMap; | ||
|
@@ -76,6 +77,15 @@ private MdoReference(MDOType type, String mdoRef, String mdoRefRu) { | |
this.mdoRefRu = mdoRefRu; | ||
} | ||
|
||
/** | ||
* Возвращает признак пустоты текущей ссылки | ||
* | ||
* @return Признак пустоты | ||
*/ | ||
public boolean isEmpty() { | ||
return this == EMPTY; | ||
} | ||
|
||
/** | ||
* Создает ссылку, сохраняя ее в кэш. | ||
* Ответственность за корректность сформированных представлений ссылки ложится на вызывающую сторону | ||
|
@@ -111,13 +121,17 @@ public static MdoReference create(@NonNull MDOType mdoType, @NonNull String name | |
* @param name Имя дочернего элемента | ||
* @return Ссылка на элемент | ||
*/ | ||
public static MdoReference create(@NonNull MdoReference mdoReferenceOwner, | ||
public static MdoReference create(@Nullable MdoReference mdoReferenceOwner, | ||
@NonNull MDOType mdoType, | ||
@NonNull String name) { | ||
var mdoRef = stringInterner.intern(mdoReferenceOwner.getMdoRef() + "." + mdoType.getName() + "." + name); | ||
var mdoRefRu = stringInterner.intern(mdoReferenceOwner.getMdoRefRu() + "." + mdoType.getNameRu() + "." + name); | ||
if (mdoReferenceOwner == null || mdoReferenceOwner.isEmpty()) { | ||
return create(mdoType, name); | ||
} else { | ||
var mdoRef = stringInterner.intern(mdoReferenceOwner.getMdoRef() + "." + mdoType.getName() + "." + name); | ||
var mdoRefRu = stringInterner.intern(mdoReferenceOwner.getMdoRefRu() + "." + mdoType.getNameRu() + "." + name); | ||
|
||
return getOrCompute(mdoType, mdoRef, mdoRefRu); | ||
return getOrCompute(mdoType, mdoRef, mdoRefRu); | ||
} | ||
} | ||
|
||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/* | ||
* This file is a part of BSL Common library. | ||
* | ||
* Copyright (c) 2021 - 2022 | ||
* Copyright (c) 2021 - 2023 | ||
* Tymko Oleg <[email protected]>, Maximov Valery <[email protected]> and contributors | ||
* | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
|
@@ -89,6 +89,7 @@ private static Map<MDOType, Set<ModuleType>> moduleTypesForMDOTypes() { | |
case ACCUMULATION_REGISTER: | ||
case CALCULATION_REGISTER: | ||
case INFORMATION_REGISTER: | ||
case EXTERNAL_DATA_SOURCE_TABLE: | ||
types.add(ManagerModule); | ||
types.add(RecordSetModule); | ||
break; | ||
|
2 changes: 1 addition & 1 deletion
2
src/main/java/com/github/_1c_syntax/bsl/types/package-info.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/* | ||
* This file is a part of BSL Common library. | ||
* | ||
* Copyright (c) 2021 - 2022 | ||
* Copyright (c) 2021 - 2023 | ||
* Tymko Oleg <[email protected]>, Maximov Valery <[email protected]> and contributors | ||
* | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
|
2 changes: 1 addition & 1 deletion
2
src/test/java/com/github/_1c_syntax/bsl/support/CompatibilityModeTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/* | ||
* This file is a part of BSL Common library. | ||
* | ||
* Copyright (c) 2021 - 2022 | ||
* Copyright (c) 2021 - 2023 | ||
* Tymko Oleg <[email protected]>, Maximov Valery <[email protected]> and contributors | ||
* | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
|
2 changes: 1 addition & 1 deletion
2
src/test/java/com/github/_1c_syntax/bsl/support/SupportVariantTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/* | ||
* This file is a part of BSL Common library. | ||
* | ||
* Copyright (c) 2021 - 2022 | ||
* Copyright (c) 2021 - 2023 | ||
* Tymko Oleg <[email protected]>, Maximov Valery <[email protected]> and contributors | ||
* | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/* | ||
* This file is a part of BSL Common library. | ||
* | ||
* Copyright (c) 2021 - 2022 | ||
* Copyright (c) 2021 - 2023 | ||
* Tymko Oleg <[email protected]>, Maximov Valery <[email protected]> and contributors | ||
* | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/* | ||
* This file is a part of BSL Common library. | ||
* | ||
* Copyright (c) 2021 - 2022 | ||
* Copyright (c) 2021 - 2023 | ||
* Tymko Oleg <[email protected]>, Maximov Valery <[email protected]> and contributors | ||
* | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
|
@@ -24,7 +24,7 @@ | |
import org.junit.jupiter.api.Test; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.junit.jupiter.api.Assertions.*; | ||
import static org.junit.jupiter.api.Assertions.assertThrows; | ||
|
||
class MdoReferenceTest { | ||
|
||
|
@@ -124,4 +124,30 @@ void testCreateCascade() { | |
assertThat(mdoRefParent0.get().getMdoRef()).isEqualTo("Catalog.test12"); | ||
assertThat(mdoRefParent0.get().getType()).isEqualTo(MDOType.CATALOG); | ||
} | ||
|
||
@Test | ||
void testEmpty() { | ||
assertThat(MdoReference.EMPTY.isEmpty()).isTrue(); | ||
|
||
var mdoRef = MdoReference.create("catalogs.test"); | ||
assertThat(mdoRef).isNotNull(); | ||
assertThat(mdoRef.isEmpty()).isFalse(); | ||
} | ||
|
||
@Test | ||
void testCreateWithEmptyParent() { | ||
var mdoRef = MdoReference.create(MDOType.CATALOG, "test10"); | ||
assertThat(mdoRef).isNotNull(); | ||
assertThat(mdoRef.isEmpty()).isFalse(); | ||
|
||
var mdoRef2 = MdoReference.create(MdoReference.EMPTY, MDOType.CATALOG, "test10"); | ||
assertThat(mdoRef2).isNotNull(); | ||
assertThat(mdoRef2.isEmpty()).isFalse(); | ||
assertThat(mdoRef2).isEqualTo(mdoRef); | ||
|
||
var mdoRef3 = MdoReference.create(null, MDOType.CATALOG, "test10"); | ||
assertThat(mdoRef3).isNotNull(); | ||
assertThat(mdoRef3.isEmpty()).isFalse(); | ||
assertThat(mdoRef3).isEqualTo(mdoRef); | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
src/test/java/com/github/_1c_syntax/bsl/types/ModuleTypeTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/* | ||
* This file is a part of BSL Common library. | ||
* | ||
* Copyright (c) 2021 - 2022 | ||
* Copyright (c) 2021 - 2023 | ||
* Tymko Oleg <[email protected]>, Maximov Valery <[email protected]> and contributors | ||
* | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
|