Skip to content

Commit 5acfeaa

Browse files
authored
Merge pull request #156 from 1c-syntax/develop
Релиз v0.7.0
2 parents 5186914 + 97cd65e commit 5acfeaa

File tree

102 files changed

+9297
-165
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+9297
-165
lines changed

build.gradle.kts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ dependencies {
2828
implementation("org.apache.commons", "commons-collections4", "4.4")
2929

3030
// https://mvnrepository.com/artifact/com.thoughtworks.xstream/xstream
31-
implementation("com.thoughtworks.xstream", "xstream", "1.4.12")
31+
// https://github.com/x-stream/xstream/pull/228
32+
implementation("com.github.nixel2007.xstream", "xstream", "7c5b15dedea167761ebeae31097f8d91ad3acc81")
3233

3334
// логирование
3435
implementation("org.slf4j", "slf4j-api", "1.7.30")

src/main/java/com/github/_1c_syntax/mdclasses/mdo/CommonForm.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,27 @@
2121
*/
2222
package com.github._1c_syntax.mdclasses.mdo;
2323

24+
import com.github._1c_syntax.mdclasses.mdo.form.FormData;
2425
import com.github._1c_syntax.mdclasses.mdo.wrapper.DesignerMDO;
2526
import com.github._1c_syntax.mdclasses.metadata.additional.MDOType;
27+
import lombok.Data;
2628
import lombok.EqualsAndHashCode;
2729
import lombok.NoArgsConstructor;
2830
import lombok.ToString;
29-
import lombok.Value;
3031

31-
@Value
32+
@Data
3233
@EqualsAndHashCode(callSuper = true)
3334
@ToString(callSuper = true, onlyExplicitlyIncluded = true)
3435
@NoArgsConstructor
35-
public class CommonForm extends MDObjectBSL {
36+
public class CommonForm extends MDObjectBSL implements MDOForm {
37+
/**
38+
* Данные формы. Читается из отдельного файла
39+
* и предоставляет информацию о:
40+
* + список элементов формы
41+
* + список обработчиков формы
42+
* + список реквизитов формы
43+
*/
44+
private FormData data;
3645

3746
public CommonForm(DesignerMDO designerMDO) {
3847
super(designerMDO);

src/main/java/com/github/_1c_syntax/mdclasses/mdo/Document.java

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,35 @@
2222
package com.github._1c_syntax.mdclasses.mdo;
2323

2424
import com.github._1c_syntax.mdclasses.mdo.wrapper.DesignerMDO;
25+
import com.github._1c_syntax.mdclasses.mdo.wrapper.DesignerXRItems;
2526
import com.github._1c_syntax.mdclasses.metadata.additional.MDOType;
27+
import com.thoughtworks.xstream.annotations.XStreamImplicit;
28+
import lombok.Data;
2629
import lombok.EqualsAndHashCode;
2730
import lombok.NoArgsConstructor;
2831
import lombok.ToString;
29-
import lombok.Value;
3032

31-
@Value
33+
import java.util.Collections;
34+
import java.util.List;
35+
import java.util.Optional;
36+
37+
@Data
3238
@EqualsAndHashCode(callSuper = true)
3339
@ToString(callSuper = true, onlyExplicitlyIncluded = true)
3440
@NoArgsConstructor
3541
public class Document extends MDObjectComplex {
42+
/**
43+
* Список связанных регистров (где документ является регистратором)
44+
*/
45+
@XStreamImplicit
46+
private List<String> registerRecords = Collections.emptyList();
47+
3648
public Document(DesignerMDO designerMDO) {
3749
super(designerMDO);
50+
// registerRecords
51+
Optional.ofNullable(designerMDO.getProperties().getRegisterRecords())
52+
.map(DesignerXRItems::getItems)
53+
.ifPresent(this::setRegisterRecords);
3854
}
3955

4056
@Override

src/main/java/com/github/_1c_syntax/mdclasses/mdo/Form.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
*/
2222
package com.github._1c_syntax.mdclasses.mdo;
2323

24+
import com.github._1c_syntax.mdclasses.mdo.form.FormData;
2425
import com.github._1c_syntax.mdclasses.mdo.wrapper.DesignerMDO;
2526
import com.github._1c_syntax.mdclasses.metadata.additional.MDOType;
2627
import lombok.Data;
@@ -32,7 +33,15 @@
3233
@EqualsAndHashCode(callSuper = true)
3334
@ToString(callSuper = true, onlyExplicitlyIncluded = true)
3435
@NoArgsConstructor
35-
public class Form extends MDObjectBSL {
36+
public class Form extends MDObjectBSL implements MDOForm {
37+
/**
38+
* Данные формы. Читается из отдельного файла
39+
* и предоставляет информацию о:
40+
* + список элементов формы
41+
* + список обработчиков формы
42+
* + список реквизитов формы
43+
*/
44+
private FormData data;
3645

3746
public Form(DesignerMDO designerMDO) {
3847
super(designerMDO);
@@ -42,5 +51,4 @@ public Form(DesignerMDO designerMDO) {
4251
public MDOType getType() {
4352
return MDOType.FORM;
4453
}
45-
4654
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/*
2+
* This file is a part of MDClasses.
3+
*
4+
* Copyright © 2019 - 2020
5+
* Tymko Oleg <[email protected]>, Maximov Valery <[email protected]> and contributors
6+
*
7+
* SPDX-License-Identifier: LGPL-3.0-or-later
8+
*
9+
* MDClasses is free software; you can redistribute it and/or
10+
* modify it under the terms of the GNU Lesser General Public
11+
* License as published by the Free Software Foundation; either
12+
* version 3.0 of the License, or (at your option) any later version.
13+
*
14+
* MDClasses is distributed in the hope that it will be useful,
15+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17+
* Lesser General Public License for more details.
18+
*
19+
* You should have received a copy of the GNU Lesser General Public
20+
* License along with MDClasses.
21+
*/
22+
package com.github._1c_syntax.mdclasses.mdo;
23+
24+
import lombok.Getter;
25+
import lombok.NoArgsConstructor;
26+
import lombok.Setter;
27+
28+
import java.util.regex.Pattern;
29+
30+
/**
31+
* POJO представление свойств типа «Обработчики событий» для таких типов метаданных как
32+
* «Регламентные задания» или «Подписки на события»
33+
*/
34+
@Getter
35+
@Setter
36+
@NoArgsConstructor
37+
public class Handler {
38+
39+
private static final String METHOD_HANDLER_SPLIT_REGEX = "\\.";
40+
private static final Pattern METHOD_HANDLER_SPLIT_PATTERN = Pattern.compile(METHOD_HANDLER_SPLIT_REGEX);
41+
42+
private String methodPath = "";
43+
private String moduleName = "";
44+
private String methodName = "";
45+
46+
public Handler(String methodPath) {
47+
methodPath = methodPath == null ? "" : methodPath;
48+
49+
this.methodPath = methodPath;
50+
String[] data = METHOD_HANDLER_SPLIT_PATTERN.split(methodPath);
51+
if (data.length > 1) {
52+
this.methodName = data[2];
53+
this.moduleName = data[1];
54+
}
55+
}
56+
57+
public boolean isEmpty() {
58+
return methodPath.isBlank();
59+
}
60+
}

src/main/java/com/github/_1c_syntax/mdclasses/mdo/MDOConfiguration.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,16 @@ public class MDOConfiguration extends MDObjectBSL {
7373
*/
7474
private UseMode synchronousPlatformExtensionAndAddInCallUseMode = UseMode.USE;
7575

76+
/**
77+
* Использовать управляемые формы в обычном приложении
78+
*/
79+
private boolean useManagedFormInOrdinaryApplication;
80+
81+
/**
82+
* Использовать обычные формы в управляемом приложении
83+
*/
84+
private boolean useOrdinaryFormInManagedApplication;
85+
7686
/**
7787
* Режим запуска клиента по умолчанию
7888
*/
@@ -126,6 +136,9 @@ public MDOConfiguration(DesignerMDO designerMDO) {
126136
configurationExtensionPurpose = designerProperties.getConfigurationExtensionPurpose();
127137
namePrefix = designerProperties.getNamePrefix();
128138

139+
useManagedFormInOrdinaryApplication = designerProperties.isUseManagedFormInOrdinaryApplication();
140+
useOrdinaryFormInManagedApplication = designerProperties.isUseOrdinaryFormInManagedApplication();
141+
129142
children = designerMDO.getChildObjects().getChildren();
130143
}
131144

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* This file is a part of MDClasses.
3+
*
4+
* Copyright © 2019 - 2020
5+
* Tymko Oleg <[email protected]>, Maximov Valery <[email protected]> and contributors
6+
*
7+
* SPDX-License-Identifier: LGPL-3.0-or-later
8+
*
9+
* MDClasses is free software; you can redistribute it and/or
10+
* modify it under the terms of the GNU Lesser General Public
11+
* License as published by the Free Software Foundation; either
12+
* version 3.0 of the License, or (at your option) any later version.
13+
*
14+
* MDClasses is distributed in the hope that it will be useful,
15+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17+
* Lesser General Public License for more details.
18+
*
19+
* You should have received a copy of the GNU Lesser General Public
20+
* License along with MDClasses.
21+
*/
22+
package com.github._1c_syntax.mdclasses.mdo;
23+
24+
import com.github._1c_syntax.mdclasses.mdo.form.FormData;
25+
26+
public interface MDOForm {
27+
FormData getData();
28+
void setData(FormData formData);
29+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* This file is a part of MDClasses.
3+
*
4+
* Copyright © 2019 - 2020
5+
* Tymko Oleg <[email protected]>, Maximov Valery <[email protected]> and contributors
6+
*
7+
* SPDX-License-Identifier: LGPL-3.0-or-later
8+
*
9+
* MDClasses is free software; you can redistribute it and/or
10+
* modify it under the terms of the GNU Lesser General Public
11+
* License as published by the Free Software Foundation; either
12+
* version 3.0 of the License, or (at your option) any later version.
13+
*
14+
* MDClasses is distributed in the hope that it will be useful,
15+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17+
* Lesser General Public License for more details.
18+
*
19+
* You should have received a copy of the GNU Lesser General Public
20+
* License along with MDClasses.
21+
*/
22+
package com.github._1c_syntax.mdclasses.mdo;
23+
24+
import com.thoughtworks.xstream.annotations.XStreamAlias;
25+
import lombok.Data;
26+
import lombok.NoArgsConstructor;
27+
28+
@Data
29+
@NoArgsConstructor
30+
public class MDOSynonym {
31+
@XStreamAlias("key")
32+
private String language;
33+
@XStreamAlias("value")
34+
private String content;
35+
}

src/main/java/com/github/_1c_syntax/mdclasses/mdo/MDObjectBase.java

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,18 @@
2222
package com.github._1c_syntax.mdclasses.mdo;
2323

2424
import com.github._1c_syntax.mdclasses.mdo.wrapper.DesignerMDO;
25+
import com.github._1c_syntax.mdclasses.mdo.wrapper.DesignerSynonym;
2526
import com.github._1c_syntax.mdclasses.metadata.additional.MDOReference;
2627
import com.github._1c_syntax.mdclasses.metadata.additional.MDOType;
2728
import com.github._1c_syntax.mdclasses.metadata.additional.ObjectBelonging;
2829
import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
30+
import com.thoughtworks.xstream.annotations.XStreamImplicit;
2931
import lombok.Data;
3032
import lombok.EqualsAndHashCode;
3133
import lombok.NoArgsConstructor;
3234
import lombok.ToString;
3335

36+
import java.nio.file.Path;
3437
import java.util.ArrayList;
3538
import java.util.Collections;
3639
import java.util.List;
@@ -55,6 +58,17 @@ public class MDObjectBase implements MDOExtensions {
5558
*/
5659
protected String name = "";
5760

61+
/**
62+
* Путь к файлу объекта
63+
*/
64+
protected Path path;
65+
66+
/**
67+
* Синонимы объекта
68+
*/
69+
@XStreamImplicit(itemFieldName = "synonym")
70+
protected List<MDOSynonym> synonyms = Collections.emptyList();
71+
5872
/**
5973
* Строка с комментарием объекта
6074
*/
@@ -83,6 +97,7 @@ public class MDObjectBase implements MDOExtensions {
8397
public MDObjectBase(DesignerMDO designerMDO) {
8498
uuid = designerMDO.getUuid();
8599
name = designerMDO.getProperties().getName();
100+
synonyms = getSynonymsFromDesignerMDO(designerMDO.getProperties().getSynonyms());
86101
comment = designerMDO.getProperties().getComment();
87102
objectBelonging = designerMDO.getProperties().getObjectBelonging();
88103
}
@@ -103,4 +118,21 @@ public void addIncludedSubsystem(Subsystem subsystem) {
103118
}
104119
includedSubsystems.add(subsystem);
105120
}
121+
122+
private List<MDOSynonym> getSynonymsFromDesignerMDO(List<DesignerSynonym> synonyms) {
123+
124+
if (synonyms.isEmpty()) {
125+
return Collections.emptyList();
126+
}
127+
List<MDOSynonym> result = new ArrayList<>();
128+
for (DesignerSynonym synonym : synonyms) {
129+
MDOSynonym mdoSynonym = new MDOSynonym();
130+
mdoSynonym.setLanguage(synonym.getLanguage());
131+
mdoSynonym.setContent(synonym.getContent());
132+
133+
result.add(mdoSynonym);
134+
}
135+
136+
return result;
137+
}
106138
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*
2+
* This file is a part of MDClasses.
3+
*
4+
* Copyright © 2019 - 2020
5+
* Tymko Oleg <[email protected]>, Maximov Valery <[email protected]> and contributors
6+
*
7+
* SPDX-License-Identifier: LGPL-3.0-or-later
8+
*
9+
* MDClasses is free software; you can redistribute it and/or
10+
* modify it under the terms of the GNU Lesser General Public
11+
* License as published by the Free Software Foundation; either
12+
* version 3.0 of the License, or (at your option) any later version.
13+
*
14+
* MDClasses is distributed in the hope that it will be useful,
15+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17+
* Lesser General Public License for more details.
18+
*
19+
* You should have received a copy of the GNU Lesser General Public
20+
* License along with MDClasses.
21+
*/
22+
package com.github._1c_syntax.mdclasses.mdo;
23+
24+
import com.thoughtworks.xstream.annotations.XStreamAlias;
25+
import com.thoughtworks.xstream.annotations.XStreamImplicit;
26+
import lombok.Getter;
27+
import lombok.NoArgsConstructor;
28+
import lombok.Setter;
29+
30+
import java.util.Collections;
31+
import java.util.List;
32+
33+
/**
34+
* POJO представление прав доступа объекта метаданных, содержащихся в конкретной роли
35+
*/
36+
@Getter
37+
@Setter
38+
@NoArgsConstructor
39+
public class ObjectRight {
40+
private String name = "";
41+
42+
@XStreamAlias("right")
43+
@XStreamImplicit
44+
List<Right> rights = Collections.emptyList();
45+
}

0 commit comments

Comments
 (0)