-
Notifications
You must be signed in to change notification settings - Fork 21
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
599 changed files
with
25,821 additions
and
40,342 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
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
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 |
---|---|---|
|
@@ -12,3 +12,7 @@ build/ | |
/.idea/sonar* | ||
|
||
/.idea/misc.xml | ||
Gradle_*.xml | ||
/.idea/material_theme_project_new.xml | ||
*.hprof | ||
*.hprof.idom |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
This file was deleted.
Oops, something went wrong.
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 MDClasses. | ||
* | ||
* Copyright (c) 2019 - 2023 | ||
* Copyright (c) 2019 - 2024 | ||
* Tymko Oleg <[email protected]>, Maximov Valery <[email protected]> and contributors | ||
* | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
|
@@ -21,12 +21,10 @@ | |
*/ | ||
package com.github._1c_syntax.bsl.mdclasses; | ||
|
||
import com.github._1c_syntax.bsl.mdo.CommonModule; | ||
import com.github._1c_syntax.bsl.mdo.MD; | ||
import com.github._1c_syntax.bsl.mdo.Module; | ||
import com.github._1c_syntax.bsl.mdo.ModuleOwner; | ||
import com.github._1c_syntax.bsl.mdo.Subsystem; | ||
import com.github._1c_syntax.bsl.mdo.children.ObjectModule; | ||
import com.github._1c_syntax.bsl.mdo.support.ApplicationRunMode; | ||
import com.github._1c_syntax.bsl.mdo.support.ScriptVariant; | ||
import com.github._1c_syntax.bsl.mdo.support.UsePurposes; | ||
|
@@ -38,7 +36,7 @@ | |
import java.util.Collections; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.stream.Collectors; | ||
import java.util.Optional; | ||
|
||
public interface CF extends MDClass, ConfigurationTree { | ||
|
||
|
@@ -85,24 +83,12 @@ public interface CF extends MDClass, ConfigurationTree { | |
/** | ||
* Возвращает соответствие пути к модулю его типу | ||
*/ | ||
default Map<URI, ModuleType> getModulesByType() { | ||
return getAllModules().stream().collect(Collectors.toMap(Module::getUri, Module::getModuleType)); | ||
} | ||
Map<URI, ModuleType> getModulesByType(); | ||
|
||
/** | ||
* Возвращает соответствие типов модулей их путям к файлам сгруппированные по представлению ссылки объекта-владельца | ||
* Возвращает соответствие пути к модулю к нему самому | ||
*/ | ||
default Map<String, Map<ModuleType, URI>> modulesByMDORef() { | ||
return getPlainChildren().stream() | ||
.filter(ModuleOwner.class::isInstance) | ||
.map(ModuleOwner.class::cast) | ||
.collect(Collectors.toMap( | ||
(MD md) -> md.getMdoReference().getMdoRef(), | ||
md -> md.getModules().stream() | ||
.collect(Collectors.toMap(Module::getModuleType, Module::getUri)) | ||
) | ||
); | ||
} | ||
Map<URI, Module> getModulesByURI(); | ||
|
||
/** | ||
* Возвращает соответствие типов модулей их путям к файлам для дочернего объекта | ||
|
@@ -126,15 +112,7 @@ default Map<ModuleType, URI> mdoModuleTypes(String mdoRef) { | |
/** | ||
* Возвращает соответствие пути файла модуля ссылке его владельца | ||
*/ | ||
default Map<URI, MdoReference> modulesByObject() { | ||
return getAllModules().stream().collect(Collectors.toMap(Module::getUri, (Module module) -> { | ||
if (module instanceof ObjectModule objectModule) { | ||
return objectModule.getOwner(); | ||
} else { | ||
return ((CommonModule) module).getMdoReference(); | ||
} | ||
})); | ||
} | ||
Map<URI, MD> getModulesByObject(); | ||
|
||
/** | ||
* Возвращает список подсистем, в состав которых входит объект метаданных | ||
|
@@ -165,4 +143,19 @@ default List<Subsystem> includedSubsystems(MdoReference mdoReference, boolean ad | |
.flatMap(subsystem -> subsystem.included(mdoReference, addParentSubsystem).stream()) | ||
.toList(); | ||
} | ||
|
||
@Override | ||
default ModuleType getModuleTypeByURI(URI uri) { | ||
return getModulesByType().getOrDefault(uri, ModuleType.UNKNOWN); | ||
} | ||
|
||
@Override | ||
default Optional<Module> getModuleByUri(URI uri) { | ||
return Optional.ofNullable(getModulesByURI().get(uri)); | ||
} | ||
|
||
@Override | ||
default Optional<MD> findChild(URI uri) { | ||
return Optional.ofNullable(getModulesByObject().get(uri)); | ||
} | ||
} |
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 MDClasses. | ||
* | ||
* Copyright (c) 2019 - 2023 | ||
* Copyright (c) 2019 - 2024 | ||
* Tymko Oleg <[email protected]>, Maximov Valery <[email protected]> and contributors | ||
* | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
|
@@ -77,10 +77,13 @@ | |
import com.github._1c_syntax.bsl.mdo.support.ScriptVariant; | ||
import com.github._1c_syntax.bsl.mdo.support.UseMode; | ||
import com.github._1c_syntax.bsl.mdo.support.UsePurposes; | ||
import com.github._1c_syntax.bsl.mdo.utils.LazyLoader; | ||
import com.github._1c_syntax.bsl.support.CompatibilityMode; | ||
import com.github._1c_syntax.bsl.support.SupportVariant; | ||
import com.github._1c_syntax.bsl.types.ConfigurationSource; | ||
import com.github._1c_syntax.bsl.types.MdoReference; | ||
import com.github._1c_syntax.bsl.types.ModuleType; | ||
import com.github._1c_syntax.utils.Lazy; | ||
import lombok.Builder; | ||
import lombok.Builder.Default; | ||
import lombok.EqualsAndHashCode; | ||
|
@@ -89,8 +92,10 @@ | |
import lombok.ToString; | ||
import lombok.Value; | ||
|
||
import java.net.URI; | ||
import java.util.Collections; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
/** | ||
* Корневой класс конфигурации 1с | ||
|
@@ -139,6 +144,7 @@ public class Configuration implements CF { | |
ApplicationRunMode defaultRunMode = ApplicationRunMode.AUTO; | ||
@Default | ||
List<Module> modules = Collections.emptyList(); | ||
Lazy<List<Module>> allModules = new Lazy<>(this::computeAllModules); | ||
@Default | ||
String vendor = ""; | ||
@Default | ||
|
@@ -243,6 +249,11 @@ public class Configuration implements CF { | |
|
||
@Singular | ||
List<MD> children; | ||
Lazy<List<MD>> plainChildren = new Lazy<>(this::computePlainChildren); | ||
|
||
Lazy<Map<URI, ModuleType>> modulesByType = new Lazy<>(this::computeModulesByType); | ||
Lazy<Map<URI, Module>> modulesByURI = new Lazy<>(this::computeModulesByURI); | ||
Lazy<Map<URI, MD>> modulesByObject = new Lazy<>(this::computeModulesByObject); | ||
|
||
/* | ||
* Свое | ||
|
@@ -306,6 +317,51 @@ public class Configuration implements CF { | |
@Default | ||
MultiLanguageString briefInformation = MultiLanguageString.EMPTY; | ||
|
||
@Override | ||
public List<Module> getAllModules() { | ||
return allModules.getOrCompute(); | ||
} | ||
|
||
@Override | ||
public List<MD> getPlainChildren() { | ||
return plainChildren.getOrCompute(); | ||
} | ||
|
||
@Override | ||
public Map<URI, ModuleType> getModulesByType() { | ||
return modulesByType.getOrCompute(); | ||
} | ||
|
||
@Override | ||
public Map<URI, MD> getModulesByObject() { | ||
return modulesByObject.getOrCompute(); | ||
} | ||
|
||
@Override | ||
public Map<URI, Module> getModulesByURI() { | ||
return modulesByURI.getOrCompute(); | ||
} | ||
|
||
private List<MD> computePlainChildren() { | ||
return LazyLoader.computePlainChildren(this); | ||
} | ||
|
||
private Map<URI, ModuleType> computeModulesByType() { | ||
return LazyLoader.computeModulesByType(this); | ||
} | ||
|
||
private Map<URI, MD> computeModulesByObject() { | ||
return LazyLoader.computeModulesByObject(this); | ||
} | ||
|
||
private List<Module> computeAllModules() { | ||
return LazyLoader.computeAllModules(this); | ||
} | ||
|
||
private Map<URI, Module> computeModulesByURI() { | ||
return LazyLoader.computeModulesByURI(this); | ||
} | ||
|
||
private static Configuration createEmptyConfiguration() { | ||
var emptyString = "empty"; | ||
|
||
|
Oops, something went wrong.