Skip to content
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@
import com.github._1c_syntax.bsl.types.ModuleType;
import com.github._1c_syntax.bsl.types.MultiLanguageString;
import com.github._1c_syntax.bsl.types.ScriptVariant;
import com.github._1c_syntax.utils.Lazy;
import lombok.Builder;
import lombok.Builder.Default;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Singular;
import lombok.ToString;
import lombok.Value;
Expand Down Expand Up @@ -150,7 +150,8 @@ public class Configuration implements CF {
ApplicationRunMode defaultRunMode = ApplicationRunMode.AUTO;
@Default
List<Module> modules = Collections.emptyList();
Lazy<List<Module>> allModules = new Lazy<>(this::computeAllModules);
@Getter(lazy = true)
List<Module> allModules = LazyLoader.computeAllModules(this);
@Default
String vendor = "";
@Default
Expand Down Expand Up @@ -259,13 +260,19 @@ 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);
Lazy<Map<String, CommonModule>> commonModulesByName = new Lazy<>(this::computeCommonModulesByName);
Lazy<Map<MdoReference, MD>> childrenByMdoRef = new Lazy<>(this::computeChildrenByMdoRef);
@Getter(lazy = true)
List<MD> plainChildren = LazyLoader.computePlainChildren(this);

@Getter(lazy = true)
Map<URI, ModuleType> modulesByType = LazyLoader.computeModulesByType(this);
@Getter(lazy = true)
Map<URI, Module> modulesByURI = LazyLoader.computeModulesByURI(this);
@Getter(lazy = true)
Map<URI, MD> modulesByObject = LazyLoader.computeModulesByObject(this);
@Getter(lazy = true)
Map<String, CommonModule> commonModulesByName = LazyLoader.computeCommonModulesByName(this);
@Getter(lazy = true)
Map<MdoReference, MD> childrenByMdoRef = LazyLoader.computeChildrenByMdoRef(this);

/*
* Свое
Expand Down Expand Up @@ -329,76 +336,13 @@ 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();
}

@Override
public Map<String, CommonModule> getCommonModulesByName() {
return commonModulesByName.getOrCompute();
}

@Override
public Map<MdoReference, MD> getChildrenByMdoRef() {
return childrenByMdoRef.getOrCompute();
}

/**
* Возвращает перечень возможных прав доступа
*/
public static List<RoleRight> possibleRights() {
return POSSIBLE_RIGHTS;
}

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 Map<String, CommonModule> computeCommonModulesByName() {
return LazyLoader.computeCommonModulesByName(this);
}

private Map<MdoReference, MD> computeChildrenByMdoRef() {
return LazyLoader.computeChildrenByMdoRef(this);
}

private static Configuration createEmptyConfiguration() {
var emptyString = "empty";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@
import com.github._1c_syntax.bsl.types.ModuleType;
import com.github._1c_syntax.bsl.types.MultiLanguageString;
import com.github._1c_syntax.bsl.types.ScriptVariant;
import com.github._1c_syntax.utils.Lazy;
import lombok.Builder;
import lombok.Builder.Default;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Singular;
import lombok.ToString;
import lombok.Value;
Expand Down Expand Up @@ -143,7 +143,8 @@ public class ConfigurationExtension implements CF {
ApplicationRunMode defaultRunMode = ApplicationRunMode.AUTO;
@Default
List<Module> modules = Collections.emptyList();
Lazy<List<Module>> allModules = new Lazy<>(this::computeAllModules);
@Getter(lazy = true)
List<Module> allModules = LazyLoader.computeAllModules(this);
@Default
String vendor = "";
@Default
Expand Down Expand Up @@ -252,13 +253,19 @@ public class ConfigurationExtension implements CF {

@Singular
List<MD> children;
Lazy<List<MD>> plainChildren = new Lazy<>(this::computePlainChildren);
@Getter(lazy = true)
List<MD> plainChildren = LazyLoader.computePlainChildren(this);

Lazy<Map<URI, ModuleType>> modulesByType = new Lazy<>(this::computeModulesByType);
Lazy<Map<URI, MD>> modulesByObject = new Lazy<>(this::computeModulesByObject);
Lazy<Map<URI, Module>> modulesByURI = new Lazy<>(this::computeModulesByURI);
Lazy<Map<String, CommonModule>> commonModulesByName = new Lazy<>(this::computeCommonModulesByName);
Lazy<Map<MdoReference, MD>> childrenByMdoRef = new Lazy<>(this::computeChildrenByMdoRef);
@Getter(lazy = true)
Map<URI, ModuleType> modulesByType = LazyLoader.computeModulesByType(this);
@Getter(lazy = true)
Map<URI, Module> modulesByURI = LazyLoader.computeModulesByURI(this);
@Getter(lazy = true)
Map<URI, MD> modulesByObject = LazyLoader.computeModulesByObject(this);
@Getter(lazy = true)
Map<String, CommonModule> commonModulesByName = LazyLoader.computeCommonModulesByName(this);
@Getter(lazy = true)
Map<MdoReference, MD> childrenByMdoRef = LazyLoader.computeChildrenByMdoRef(this);

/*
* Свое
Expand All @@ -276,74 +283,11 @@ public class ConfigurationExtension implements CF {
@Default
String namePrefix = "";

@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();
}

@Override
public Map<String, CommonModule> getCommonModulesByName() {
return commonModulesByName.getOrCompute();
}

@Override
public Map<MdoReference, MD> getChildrenByMdoRef() {
return childrenByMdoRef.getOrCompute();
}

/**
* Возвращает перечень возможных прав доступа
*/
public static List<RoleRight> possibleRights() {
return Configuration.possibleRights();
}

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 Map<String, CommonModule> computeCommonModulesByName() {
return LazyLoader.computeCommonModulesByName(this);
}

private Map<MdoReference, MD> computeChildrenByMdoRef() {
return LazyLoader.computeChildrenByMdoRef(this);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@
import com.github._1c_syntax.bsl.types.ConfigurationSource;
import com.github._1c_syntax.bsl.types.MdoReference;
import com.github._1c_syntax.bsl.types.MultiLanguageString;
import com.github._1c_syntax.utils.Lazy;
import lombok.Builder;
import lombok.Builder.Default;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Singular;
import lombok.ToString;
import lombok.Value;
Expand Down Expand Up @@ -65,7 +65,8 @@ public class ExternalDataProcessor implements ExternalSource {

@Default
List<Module> modules = Collections.emptyList();
Lazy<List<Module>> allModules = new Lazy<>(this::computeAllModules);
@Getter(lazy = true)
List<Module> allModules = LazyLoader.computeAllModules(this);

@Default
ConfigurationSource configurationSource = ConfigurationSource.EMPTY;
Expand All @@ -79,61 +80,19 @@ public class ExternalDataProcessor implements ExternalSource {
@Singular
List<TabularSection> tabularSections;

Lazy<List<MD>> storageFields = new Lazy<>(this::computeStorageFields);
Lazy<List<MD>> plainStorageFields = new Lazy<>(this::computePlainStorageFields);
@Getter(lazy = true)
List<MD> storageFields = LazyLoader.computeStorageFields(this);
@Getter(lazy = true)
List<MD> plainStorageFields = LazyLoader.computePlainStorageFields(this);

@Singular
List<ObjectForm> forms;

@Singular
List<ObjectTemplate> templates;

Lazy<List<MD>> children = new Lazy<>(this::computeChildren);
Lazy<List<MD>> plainChildren = new Lazy<>(this::computePlainChildren);

@Override
public List<MD> getChildren() {
return children.getOrCompute();
}

@Override
public List<MD> getPlainChildren() {
return plainChildren.getOrCompute();
}

@Override
public List<MD> getStorageFields() {
return storageFields.getOrCompute();
}

@Override
public List<MD> getPlainStorageFields() {
return plainStorageFields.getOrCompute();
}

@Override
public List<Module> getAllModules() {
return allModules.getOrCompute();
}

private List<MD> computeChildren() {
return LazyLoader.computeChildren(this);
}

private List<MD> computePlainChildren() {
return LazyLoader.computePlainChildren(this);
}

private List<MD> computeStorageFields() {
return LazyLoader.computeStorageFields(this);
}

private List<MD> computePlainStorageFields() {
return LazyLoader.computePlainStorageFields(this);
}

private List<Module> computeAllModules() {
return LazyLoader.computeAllModules(this);
}

@Getter(lazy = true)
List<MD> children = LazyLoader.computeChildren(this);
@Getter(lazy = true)
List<MD> plainChildren = LazyLoader.computePlainChildren(this);
}
Loading
Loading