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
Expand Up @@ -28,6 +28,7 @@
import com.github._1c_syntax.bsl.mdo.children.ObjectCommand;
import com.github._1c_syntax.bsl.mdo.children.ObjectForm;
import com.github._1c_syntax.bsl.mdo.children.ObjectTemplate;
import com.github._1c_syntax.bsl.mdo.support.DefaultFormKind;
import com.github._1c_syntax.bsl.mdo.utils.LazyLoader;
import com.github._1c_syntax.bsl.types.ConfigurationSource;
import com.github._1c_syntax.bsl.types.MdoReference;
Expand All @@ -42,6 +43,7 @@

import java.util.Collections;
import java.util.List;
import java.util.Map;

/**
* Внешняя обработка
Expand Down Expand Up @@ -95,4 +97,29 @@ public class ExternalDataProcessor implements ExternalSource {
List<MD> children = LazyLoader.computeChildren(this);
@Getter(lazy = true)
List<MD> plainChildren = LazyLoader.computePlainChildren(this);

/**
* Ссылка на форму по умолчанию
*/
@Default
MdoReference defaultForm = MdoReference.EMPTY;

/**
* Ссылка на дополнительную форму
*/
@Default
MdoReference auxiliaryForm = MdoReference.EMPTY;

/**
* Возможные формы по умолчанию
*/
@Getter(lazy = true)
Map<DefaultFormKind, MdoReference> defaultFormMap = createDefaultFormMap();

private Map<DefaultFormKind, MdoReference> createDefaultFormMap() {
return Map.ofEntries(
Map.entry(DefaultFormKind.DEFAULT_FORM, getDefaultForm()),
Map.entry(DefaultFormKind.AUX_FORM, getAuxiliaryForm())
);
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import com.github._1c_syntax.bsl.mdo.children.ObjectCommand;
import com.github._1c_syntax.bsl.mdo.children.ObjectForm;
import com.github._1c_syntax.bsl.mdo.children.ObjectTemplate;
import com.github._1c_syntax.bsl.mdo.support.DefaultFormKind;
import com.github._1c_syntax.bsl.mdo.utils.LazyLoader;
import com.github._1c_syntax.bsl.types.ConfigurationSource;
import com.github._1c_syntax.bsl.types.MdoReference;
Expand All @@ -42,6 +43,7 @@

import java.util.Collections;
import java.util.List;
import java.util.Map;

/**
* Внешний отчет
Expand Down Expand Up @@ -101,6 +103,48 @@ public class ExternalReport implements ExternalSource {
@Getter(lazy = true)
List<MD> plainChildren = LazyLoader.computePlainChildren(this);

/**
* Ссылка на форму по умолчанию
*/
@Default
MdoReference defaultForm = MdoReference.EMPTY;

/**
* Ссылка на форму настроек по умолчанию
*/
@Default
MdoReference defaultSettingsForm = MdoReference.EMPTY;

/**
* Ссылка на форму варианта по умолчанию
*/
@Default
MdoReference defaultVariantForm = MdoReference.EMPTY;

/**
* Ссылка на дополнительную форму
*/
@Default
MdoReference auxiliaryForm = MdoReference.EMPTY;

/**
* Ссылка на дополнительную форму настроек
*/
@Default
MdoReference auxiliarySettingsForm = MdoReference.EMPTY;

/**
* Ссылка на дополнительную форму варианта
*/
@Default
MdoReference auxiliaryVariantForm = MdoReference.EMPTY;

/**
* Возможные формы по умолчанию
*/
@Getter(lazy = true)
Map<DefaultFormKind, MdoReference> defaultFormMap = createDefaultFormMap();

private static ExternalReport createEmptyExternalReport() {
var emptyString = "empty";

Expand All @@ -110,4 +154,15 @@ private static ExternalReport createEmptyExternalReport() {
.uuid(emptyString)
.build();
}

private Map<DefaultFormKind, MdoReference> createDefaultFormMap() {
return Map.ofEntries(
Map.entry(DefaultFormKind.DEFAULT_FORM, getDefaultForm()),
Map.entry(DefaultFormKind.SETTINGS_FORM, getDefaultSettingsForm()),
Map.entry(DefaultFormKind.VARIANT_FORM, getDefaultVariantForm()),
Map.entry(DefaultFormKind.AUX_FORM, getAuxiliaryForm()),
Map.entry(DefaultFormKind.AUX_SETTINGS_FORM, getAuxiliarySettingsForm()),
Map.entry(DefaultFormKind.AUX_VARIANT_FORM, getAuxiliaryVariantForm())
);
}
}
251 changes: 139 additions & 112 deletions src/main/java/com/github/_1c_syntax/bsl/mdo/AccountingRegister.java
Original file line number Diff line number Diff line change
@@ -1,112 +1,139 @@
/*
* This file is a part of MDClasses.
*
* Copyright (c) 2019 - 2026
* 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.bsl.mdo;

import com.github._1c_syntax.bsl.mdo.children.Dimension;
import com.github._1c_syntax.bsl.mdo.children.ObjectCommand;
import com.github._1c_syntax.bsl.mdo.children.ObjectForm;
import com.github._1c_syntax.bsl.mdo.children.ObjectTemplate;
import com.github._1c_syntax.bsl.mdo.children.Resource;
import com.github._1c_syntax.bsl.mdo.support.ObjectBelonging;
import com.github._1c_syntax.bsl.mdo.support.RoleRight;
import com.github._1c_syntax.bsl.mdo.utils.LazyLoader;
import com.github._1c_syntax.bsl.support.SupportVariant;
import com.github._1c_syntax.bsl.types.MdoReference;
import com.github._1c_syntax.bsl.types.MultiLanguageString;
import lombok.Builder;
import lombok.Builder.Default;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Singular;
import lombok.ToString;
import lombok.Value;

import java.util.Collections;
import java.util.List;

@Value
@Builder(toBuilder = true)
@ToString(of = {"name", "uuid"})
@EqualsAndHashCode(of = {"name", "uuid"})
public class AccountingRegister implements Register, AccessRightsOwner {

/*
* Register
*/

@Default
String uuid = "";
@Default
String name = "";
@Default
MdoReference mdoReference = MdoReference.EMPTY;
@Default
ObjectBelonging objectBelonging = ObjectBelonging.OWN;
@Default
String comment = "";
@Default
MultiLanguageString synonym = MultiLanguageString.EMPTY;
@Default
SupportVariant supportVariant = SupportVariant.NONE;

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

@Singular
List<ObjectCommand> commands;

@Singular
List<Attribute> attributes;
@Singular
List<Resource> resources;
@Singular
List<Dimension> dimensions;
@Getter(lazy = true)
List<Attribute> allAttributes = LazyLoader.computeAllAttributes(this);

@Singular
List<ObjectForm> forms;

@Singular
List<ObjectTemplate> templates;
@Getter(lazy = true)
List<MD> children = LazyLoader.computeChildren(this);

/*
* Свое
*/

/**
* Пояснение
*/
@Default
MultiLanguageString explanation = MultiLanguageString.EMPTY;

/**
* Возвращает перечень возможных прав доступа
*/
public static List<RoleRight> possibleRights() {
return AccumulationRegister.possibleRights();
}
}
/*
* This file is a part of MDClasses.
*
* Copyright (c) 2019 - 2026
* 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.bsl.mdo;

import com.github._1c_syntax.bsl.mdo.children.Dimension;
import com.github._1c_syntax.bsl.mdo.children.ObjectCommand;
import com.github._1c_syntax.bsl.mdo.children.ObjectForm;
import com.github._1c_syntax.bsl.mdo.children.ObjectTemplate;
import com.github._1c_syntax.bsl.mdo.children.Resource;
import com.github._1c_syntax.bsl.mdo.support.DefaultFormKind;
import com.github._1c_syntax.bsl.mdo.support.ObjectBelonging;
import com.github._1c_syntax.bsl.mdo.support.RoleRight;
import com.github._1c_syntax.bsl.mdo.utils.LazyLoader;
import com.github._1c_syntax.bsl.support.SupportVariant;
import com.github._1c_syntax.bsl.types.MdoReference;
import com.github._1c_syntax.bsl.types.MultiLanguageString;
import lombok.Builder;
import lombok.Builder.Default;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Singular;
import lombok.ToString;
import lombok.Value;

import java.util.Collections;
import java.util.List;
import java.util.Map;

@Value
@Builder(toBuilder = true)
@ToString(of = {"name", "uuid"})
@EqualsAndHashCode(of = {"name", "uuid"})
public class AccountingRegister implements Register, AccessRightsOwner {

/*
* Register
*/

@Default
String uuid = "";
@Default
String name = "";
@Default
MdoReference mdoReference = MdoReference.EMPTY;
@Default
ObjectBelonging objectBelonging = ObjectBelonging.OWN;
@Default
String comment = "";
@Default
MultiLanguageString synonym = MultiLanguageString.EMPTY;
@Default
SupportVariant supportVariant = SupportVariant.NONE;

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

@Singular
List<ObjectCommand> commands;

@Singular
List<Attribute> attributes;
@Singular
List<Resource> resources;
@Singular
List<Dimension> dimensions;
@Getter(lazy = true)
List<Attribute> allAttributes = LazyLoader.computeAllAttributes(this);

@Singular
List<ObjectForm> forms;

@Singular
List<ObjectTemplate> templates;
@Getter(lazy = true)
List<MD> children = LazyLoader.computeChildren(this);

/*
* Свое
*/

/**
* Ссылка на форму списка по умолчанию
*/
@Default
MdoReference defaultListForm = MdoReference.EMPTY;

/**
* Ссылка на дополнительную форму списка
*/
@Default
MdoReference auxiliaryListForm = MdoReference.EMPTY;

/**
* Возможные формы по умолчанию
*/
@Getter(lazy = true)
Map<DefaultFormKind, MdoReference> defaultFormMap = createDefaultFormMap();

/**
* Пояснение
*/
@Default
MultiLanguageString explanation = MultiLanguageString.EMPTY;

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

private Map<DefaultFormKind, MdoReference> createDefaultFormMap() {
return Map.ofEntries(
Map.entry(DefaultFormKind.LIST_FORM, getDefaultListForm()),
Map.entry(DefaultFormKind.AUX_LIST_FORM, getAuxiliaryListForm())
);
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.
}
Loading
Loading