Compare commits
278 Commits
de9f5ce5c7
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 170431081f | |||
| 43a0e60f65 | |||
| f4c54acb3e | |||
| 9cadbef661 | |||
| bedb5eefd1 | |||
| 1329bb3038 | |||
| 00a30bdec4 | |||
| 8d1e360249 | |||
| fa6f39bb21 | |||
| 651f65060a | |||
| c5cd8113c0 | |||
| 6263934cbb | |||
| f2644392ad | |||
| 641ce80102 | |||
| 7924212fed | |||
| 3090e80f72 | |||
| b418066932 | |||
| f5eaf3df25 | |||
| bf5a648582 | |||
| 114e2ac4ad | |||
| b5e3a2c011 | |||
| b8d10a1434 | |||
| 46cdd480bc | |||
| 93396a00b1 | |||
| eeb57ab7c2 | |||
| e53f0ed939 | |||
| 9eede4802e | |||
| 688f36c4c3 | |||
| c270429c66 | |||
| 6135b738ba | |||
| 41ce6527d5 | |||
| cba4425cd7 | |||
| 0cb4022969 | |||
| 0ec1ce09da | |||
| ef92651552 | |||
| d8178fa704 | |||
| c148f62198 | |||
| e1291446c8 | |||
| 1f4b736188 | |||
| 47a4772632 | |||
| 571e2d2544 | |||
| 62a45fd8be | |||
| 6e0956e3e5 | |||
| b46f86bebb | |||
| d2c2f571ff | |||
| 70771dd0ce | |||
| b37e20e4a4 | |||
| e8c748eb7e | |||
| da4e8b07bc | |||
| 611194be8c | |||
| a0c45a2df0 | |||
| 8d236c99b8 | |||
| ccf20c354b | |||
| 28eee09056 | |||
| cb1f19cfb7 | |||
| 74f9a68ceb | |||
| 9303839e8e | |||
| dc17b7d741 | |||
| eb86b936bc | |||
| cd86f1257a | |||
| 46e1bd17f1 | |||
| 7efe852bc1 | |||
| 829cd0c770 | |||
| 6faf06f949 | |||
| 73a39681f1 | |||
| 4c5331de55 | |||
| 411e97abb8 | |||
| fd21de489e | |||
| aac4221a4d | |||
| f1a1ce0436 | |||
| 419af0766e | |||
| 98ec37233a | |||
| 32e1e68d9a | |||
| 68cf40367a | |||
| c6d2452530 | |||
| 76c710b1bc | |||
| 029947c793 | |||
| 38f39411ad | |||
| cb7b5809f1 | |||
| ddf04c6f39 | |||
| 48290ccf97 | |||
| e706b52b53 | |||
| c8045a5db1 | |||
| 5ef516d019 | |||
| 4f5a091af7 | |||
| cc21931ebe | |||
| 18227f565a | |||
| ef5bd5b1a8 | |||
| 41b98607cd | |||
| 7178ecbc9c | |||
| dcdbaa83cf | |||
| 86b582dd1f | |||
| c7a618dd25 | |||
| fb296a02ee | |||
| 19afec4d25 | |||
| 1ae4d1980a | |||
| 919e7a2e10 | |||
| fef75270a7 | |||
| 2a30a42e77 | |||
| b900622e4e | |||
| a47a6705d8 | |||
| 809b1f8d14 | |||
| 23b143f916 | |||
| 7ef9ee0d5c | |||
| a60ed8f661 | |||
| 74ae6abf50 | |||
| b4d0a62d6c | |||
| 535053baca | |||
| af644f8f04 | |||
| dae9d58d82 | |||
| 4f50c4a559 | |||
| fcebae094f | |||
| abab3f067c | |||
| 167ceb42a5 | |||
| cf9b028400 | |||
| b763c2c266 | |||
| 811acba5a7 | |||
| bc1faa1a06 | |||
| f6cc447481 | |||
| 10c213feae | |||
| 74146fae4c | |||
| df204b64a7 | |||
| 2d0d69fd7a | |||
| 637e9c5c0f | |||
| 78ee5bc428 | |||
| 0b5f8c6ec7 | |||
| 3f4ef5f198 | |||
| afaaaba1e7 | |||
| 21a41987b4 | |||
| 933638afb8 | |||
| b6b7bb3ae5 | |||
| 6a3be45b1a | |||
| 55aa66fa18 | |||
| 2ab2a79d8d | |||
| c8d597e9cd | |||
| 9a5b84c068 | |||
| 174bc344a4 | |||
| e2b307d4f6 | |||
| a2017f9e01 | |||
| 9f4eb9d88e | |||
| 04cf5c1552 | |||
| c7626e877e | |||
|
|
cb7360ae86 | ||
| 8fc70d48ad | |||
| 4ce7190905 | |||
| dc68667b20 | |||
| 1d97048de1 | |||
| 91e40c4393 | |||
| a6e02172f8 | |||
| 8a6c9804b4 | |||
| 8aea85a009 | |||
| b1740da1f1 | |||
| 5653438b75 | |||
| c85661a264 | |||
| d2a333c7cb | |||
| f3747a359b | |||
| e123600e06 | |||
| c4157fc30b | |||
| e428d621ac | |||
| aa5bcc7df7 | |||
| dec4835187 | |||
| d66fdc5e77 | |||
| 670324837d | |||
| ab0e0af6b3 | |||
| b08242fed4 | |||
| 7b81a8bdd0 | |||
| 20aef1f340 | |||
| 39f5b99ade | |||
| e8d6764563 | |||
| 9c0f3215ad | |||
| b908ddc8f1 | |||
| 0b35c948ab | |||
| b79b33e232 | |||
| 0e2d2abb84 | |||
| fe78d89a58 | |||
| 7f9305f02b | |||
|
|
fca5bb42bd | ||
|
|
4ae8c2f664 | ||
|
|
683d5249eb | ||
|
|
278782a244 | ||
|
|
4288f83105 | ||
|
|
242719e7a7 | ||
| 4da5f4bc03 | |||
| cba10bef14 | |||
| 7728ddbf23 | |||
| d455c21b9c | |||
|
|
b8751d9b67 | ||
|
|
74f4be7027 | ||
| eb7c0ffbc5 | |||
| b4808bcd7c | |||
|
|
90b45fc806 | ||
|
|
9b02a5c9ea | ||
| e98127880b | |||
| 1ee8256885 | |||
| c9a013a17b | |||
| 6413f2340a | |||
| 3c9bc3f9b7 | |||
| d019beff5f | |||
| 4441864b6f | |||
| 33f3d615da | |||
| 61d8670416 | |||
| c551fdd2c9 | |||
| d7ea2f862e | |||
| d81abc226c | |||
| 2f4f841dcc | |||
| c83cfd9eff | |||
| f7973e0991 | |||
| 8701c8ba36 | |||
| 49f0a56c4f | |||
| ed61eb2ae0 | |||
| 25fc55c03e | |||
| a8244bf872 | |||
| daa53d9d73 | |||
| b445e3e879 | |||
| f1440dd1e2 | |||
| 4e3597ba7a | |||
| 7a9c70f396 | |||
| 8215388bc6 | |||
| 39595d849e | |||
| 024f274360 | |||
| 7eba13370d | |||
| 5046d84b86 | |||
| 073bbfd544 | |||
| 1b4b375f39 | |||
| 794097f81f | |||
| 9d11ebb653 | |||
| 0a123988b3 | |||
| 9c0ed53d52 | |||
| 77179789f5 | |||
| 68bd1ef6b4 | |||
| c76908ad58 | |||
| 209bb2455d | |||
| a86a5b1e6b | |||
| 05b49a842e | |||
| 6d9bd4bc9b | |||
| 245ed7c5f0 | |||
| f2b2acb49f | |||
| 36438e5b20 | |||
| 5e6719412d | |||
| 0bdc870a72 | |||
| 54ec1fee99 | |||
| 91f4ed4a17 | |||
| dd1f7f8040 | |||
| 016e51dbe5 | |||
| 90b6f3648e | |||
| 57baa6c9c1 | |||
| 74fcc2150d | |||
| b80bea4c1b | |||
| ede6438fbf | |||
| 62de67ccb7 | |||
| c69e7194bc | |||
| 25eabf6852 | |||
| 4ef8d4b52c | |||
| 0049409cdf | |||
| 7eecdf8f4d | |||
| bc750f8db0 | |||
| 75abb0ae46 | |||
| a27ab3acef | |||
| 950b47d145 | |||
| 2eca19cad4 | |||
| b8f1ad56ed | |||
| 7dd3069445 | |||
| 407294c6ae | |||
| 0c2b716368 | |||
| bd2e8643fd | |||
| dcdd392e95 | |||
| fa31d5570c | |||
| 16c307103f | |||
| 467c9b5b31 | |||
| 305b607c24 | |||
| 20e82075b7 | |||
| 6e0e51beff | |||
| 63b923e33b | |||
| 775526b5e3 | |||
| 82fbe8a751 | |||
| 19bcc13048 | |||
|
|
d5aabbace7 | ||
|
|
fa12c4b672 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -49,4 +49,5 @@ Makefiles/*
|
||||
Repo/*
|
||||
Sts/*
|
||||
Tests/*
|
||||
Keys/*
|
||||
debug.log
|
||||
2
.idea/artifacts/VisualSapfor_jar.xml
generated
2
.idea/artifacts/VisualSapfor_jar.xml
generated
@@ -22,6 +22,8 @@
|
||||
<element id="extracted-dir" path="$PROJECT_DIR$/libs/junit-4.12.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$PROJECT_DIR$/libs/log4j-1.2.17.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$PROJECT_DIR$/libs/xmlbeans-2.6.0.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$PROJECT_DIR$/libs/commons-lang-2.6.0.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$PROJECT_DIR$/libs/java-diff-utils.jar" path-in-jar="/" />
|
||||
</root>
|
||||
</artifact>
|
||||
</component>
|
||||
9
.idea/libraries/commons_lang_2_6_0.xml
generated
Normal file
9
.idea/libraries/commons_lang_2_6_0.xml
generated
Normal file
@@ -0,0 +1,9 @@
|
||||
<component name="libraryTable">
|
||||
<library name="commons-lang-2.6.0">
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/libs/commons-lang-2.6.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</component>
|
||||
24
.idea/workspace.xml
generated
24
.idea/workspace.xml
generated
@@ -7,7 +7,8 @@
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="e42177c3-2328-4b27-8a01-35779b2beb99" name="Default Changelist" comment="">
|
||||
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Constants.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Constants.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Passes/PassCode.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Passes/PassCode.java" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
@@ -46,9 +47,9 @@
|
||||
</file-type-list>
|
||||
</component>
|
||||
<component name="HighlightingSettingsPerFile">
|
||||
<setting file="file://$PROJECT_DIR$/src/_VisualDVM/Passes/All/ConvertCorrectnessTests.java" root0="FORCE_HIGHLIGHTING" />
|
||||
<setting file="file://$PROJECT_DIR$/src/_VisualDVM/Passes/All/PublishGroup.java" root0="FORCE_HIGHLIGHTING" />
|
||||
<setting file="file://$PROJECT_DIR$/src/_VisualDVM/Passes/All/PublishTest.java" root0="FORCE_HIGHLIGHTING" />
|
||||
<setting file="file://$PROJECT_DIR$/src/_VisualDVM/Passes/All/ConvertCorrectnessTests.java" root0="FORCE_HIGHLIGHTING" />
|
||||
<setting file="file://$PROJECT_DIR$/src/_VisualDVM/TestingSystem/Common/TestingServer.java" root0="FORCE_HIGHLIGHTING" />
|
||||
</component>
|
||||
<component name="KotlinCodeInsightWorkspaceSettings">
|
||||
@@ -58,7 +59,7 @@
|
||||
<option name="stateVersion" value="1" />
|
||||
</component>
|
||||
<component name="ProblemsViewState">
|
||||
<option name="selectedTabId" value="ProjectErrors" />
|
||||
<option name="selectedTabId" value="CurrentFile" />
|
||||
</component>
|
||||
<component name="ProjectId" id="1UqWSAGBQQNofrCLxSPPtOZrGP7" />
|
||||
<component name="ProjectLevelVcsManager" settingsEditedManually="true">
|
||||
@@ -77,6 +78,7 @@
|
||||
<property name="JavaClassFindUsagesOptions.isDerivedClasses" value="true" />
|
||||
<property name="JavaClassFindUsagesOptions.isFieldsUsages" value="true" />
|
||||
<property name="JavaClassFindUsagesOptions.isMethodsUsages" value="true" />
|
||||
<property name="OverrideImplement.combined" value="false" />
|
||||
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
|
||||
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
|
||||
<property name="SHARE_PROJECT_CONFIGURATION_FILES" value="true" />
|
||||
@@ -87,9 +89,9 @@
|
||||
<property name="UI_DESIGNER_EDITOR_MODE.UIDesignerToolWindowManager.WIDTH" value="509" />
|
||||
<property name="extract.method.default.visibility" value="public" />
|
||||
<property name="last_opened_file_path" value="$PROJECT_DIR$/src/icons/Transformations" />
|
||||
<property name="project.structure.last.edited" value="Modules" />
|
||||
<property name="project.structure.last.edited" value="Artifacts" />
|
||||
<property name="project.structure.proportion" value="0.15" />
|
||||
<property name="project.structure.side.proportion" value="0.2" />
|
||||
<property name="project.structure.side.proportion" value="0.27322906" />
|
||||
<property name="run.code.analysis.last.selected.profile" value="pProject Default" />
|
||||
<property name="settings.editor.selected.configurable" value="reference.settings.project.statistic.project.settings" />
|
||||
</component>
|
||||
@@ -100,17 +102,17 @@
|
||||
</key>
|
||||
<key name="CopyFile.RECENT_KEYS">
|
||||
<recent name="C:\Users\misha\Documents\visual_sapfor_2023\src\icons\Transformations" />
|
||||
<recent name="C:\Users\misha\Documents\visual_sapfor_2023\src\Common\icons" />
|
||||
<recent name="C:\Users\misha\Documents\visual_sapfor_2023\src\icons" />
|
||||
<recent name="C:\Users\misha\Documents\visual_sapfor_2023\src\icons\versions" />
|
||||
<recent name="C:\Users\misha\Documents\visual_sapfor_2023\src\files" />
|
||||
<recent name="C:\Users\misha\Documents\visual_sapfor_2023\src" />
|
||||
<recent name="C:\Users\misha\Documents\visual_sapfor_2023\src\_dif_utils" />
|
||||
<recent name="C:\Users\misha\Documents\visual_sapfor_2023\libs" />
|
||||
<recent name="C:\Users\misha\Documents\visual_sapfor_2023\src\_VisualDVM\TestingSystem\DVM\DVMTasks\UI" />
|
||||
</key>
|
||||
<key name="MoveMembersDialog.RECENTS_KEY">
|
||||
<recent name="_VisualDVM.ComponentsServer.Component.Sapfor.Sapfor" />
|
||||
<recent name="_VisualDVM.Constants" />
|
||||
<recent name="_VisualDVM.Global" />
|
||||
<recent name="_VisualDVM.ProjectData.SapforData.Arrays.UI.ProjectArraysForm" />
|
||||
<recent name="_VisualDVM.TestingSystem.SAPFOR.SapforPackage.UI.SapforPackagesForm" />
|
||||
<recent name="_VisualDVM.TestingSystem.DVM.DVMPackage.UI.DVMPackagesForm" />
|
||||
<recent name="_VisualDVM.TestingSystem.Common.Group.UI.GroupsForm" />
|
||||
</key>
|
||||
<key name="MoveFile.RECENT_KEYS">
|
||||
<recent name="C:\Users\misha\Documents\visual_sapfor_2023\src\_VisualDVM\TestingSystem\SAPFOR\SapforSettingsCommand\UI" />
|
||||
|
||||
@@ -94,5 +94,6 @@
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="library" name="commons-lang-2.6.0" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
BIN
Visualizer_2.exe
BIN
Visualizer_2.exe
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 163 KiB |
28
properties
28
properties
@@ -1,18 +1,22 @@
|
||||
{
|
||||
"Email": "vmk-post@yandex.ru",
|
||||
"Name": "M",
|
||||
"ServerUserPassword": "mprit_2011",
|
||||
"OfferRegistrationOnStart": true,
|
||||
"Workspace": "E:\\Tests",
|
||||
"ProjectsSearchDirectory": "E:\\Tests\\Downloads",
|
||||
"ProjectsSearchDirectory": "E:\\Tests",
|
||||
"DocumentsDirectory": "C:\\Users\\misha\\Documents\\_testing_system",
|
||||
"VisualiserPath": "C:\\Users\\misha\\Downloads",
|
||||
"Sapfor_FPath": "E:\\_sapfor_x64\\Components\\Sapfor_F",
|
||||
"Visualizer_2Path": "C:\\Users\\misha\\Documents",
|
||||
"InstructionPath": "C:\\Users\\misha\\Documents",
|
||||
"PerformanceAnalyzerPath": "C:\\Users\\misha\\Documents",
|
||||
"AutoUpdateSearch": true,
|
||||
"AutoBugReportsLoad": true,
|
||||
"AutoTestsLoad": true,
|
||||
"ConfirmPassesStart": true,
|
||||
"ShowPassesDone": true,
|
||||
"FocusPassesResult": true,
|
||||
"collapseCredentials": false,
|
||||
"FocusPassesResult": false,
|
||||
"collapseCredentials": true,
|
||||
"collapseFileGraphs": false,
|
||||
"collapseFileMessages": false,
|
||||
"collapseProjectTrees": false,
|
||||
@@ -21,26 +25,28 @@
|
||||
"ComponentsWindowHeight": 250,
|
||||
"Kernels": 8,
|
||||
"LocalMakePathWindows": "C:\\MinGW\\msys\\1.0\\bin\\make.exe",
|
||||
"PrecompilationFlags": " ",
|
||||
"CheckTestingIntervalSeconds": 10,
|
||||
"AutoCheckTesting": true,
|
||||
"EmailOnTestingProgress": true,
|
||||
"CompleteCompilationOptions": true,
|
||||
"CompleteRunEnvironments": true,
|
||||
"CreateEthalonTasks": true,
|
||||
"ErasePackageWorkspace": true,
|
||||
"lastMachineId": 13,
|
||||
"lastUserId": 24,
|
||||
"lastUserId": 34,
|
||||
"lastCompilerId": 52,
|
||||
"RegisterOn": false,
|
||||
"SpacesOn": false,
|
||||
"EmptyLinesOn": false,
|
||||
"FortranWrapsOn": false,
|
||||
"ExtensionsOn": false,
|
||||
"ComparsionDiffMergeOn": false,
|
||||
"ShowFullArraysDeclarations": false,
|
||||
"ComparsionDiffMergeOn": true,
|
||||
"ShowFullArraysDeclarations": true,
|
||||
"ShowFullTabsNames": true,
|
||||
"SmallScreen": false,
|
||||
"BugReportsAgeLimit": 1,
|
||||
"FastAccessPassesCount": 10,
|
||||
"LastOpenedProjectsCount": 25,
|
||||
"Mode": "Normal",
|
||||
"ComponentsServerPort": 7995,
|
||||
"TestingServerPort": 7998,
|
||||
"SocketTimeout": 5000
|
||||
"Mode": "Normal"
|
||||
}
|
||||
@@ -34,6 +34,12 @@ public abstract class Database {
|
||||
// UI.Print(DebugPrintLevel.Database, "соединение с базой данных " + file.getAbsolutePath());
|
||||
connect();
|
||||
}
|
||||
public void Activate() throws Exception {
|
||||
Connect();
|
||||
CreateAllTables();
|
||||
prepareTablesStatements();
|
||||
Synchronize();
|
||||
}
|
||||
public void prepareTablesStatements() throws Exception {
|
||||
}
|
||||
public void Disconnect() throws Exception {
|
||||
@@ -218,6 +224,20 @@ public abstract class Database {
|
||||
public <O extends DBObject, F extends iDBObject> LinkedHashMap<Integer, F> getMapByFKi(O owner, Class<F> fk_class) {
|
||||
return getMapByFK(owner, fk_class, java.lang.Integer.class);
|
||||
}
|
||||
public <O extends iDBObject, F extends iDBObject> Vector<Integer> getFKi(
|
||||
Integer owner_pk, Class<O> owner_class, Class<F> fk_class) {
|
||||
String fk_name = owner_class.getSimpleName().toLowerCase() + "_id";
|
||||
Vector<Integer> res = new Vector<>();
|
||||
try {
|
||||
for (Object o : tables.get(fk_class).Data.values()) {
|
||||
F f = (F) o;
|
||||
if (fk_class.getField(fk_name).get(f).equals(owner_pk)) res.add((Integer) f.getPK());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Utils_.MainLog.PrintException(e);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
//-
|
||||
public <O extends DBObject, F extends DBObject> Vector<String> getVectorStringByFK(O owner, Class<F> fk_class) {
|
||||
Vector<String> res = new Vector<>();
|
||||
@@ -294,6 +314,14 @@ public abstract class Database {
|
||||
}
|
||||
return log.isEmpty();
|
||||
}
|
||||
public boolean canModifyCurrent(TextLog log, Class... tablesClasses) {
|
||||
for (Class tableClass : tablesClasses) {
|
||||
DBTable table = getTable(tableClass);
|
||||
if (table.getUI() != null)
|
||||
table.getUI().canModifyCurrent(log);
|
||||
}
|
||||
return log.isEmpty();
|
||||
}
|
||||
public abstract PassCode_ getSynchronizePassCode(); //если бд есть на сервере.
|
||||
//--
|
||||
public void ReplaceFileAndReconnect(File file_in) throws Exception {
|
||||
@@ -304,4 +332,25 @@ public abstract class Database {
|
||||
prepareTablesStatements();
|
||||
Synchronize();
|
||||
}
|
||||
public void DeleteDependencies(DBObject object) throws Exception {
|
||||
DBTable object_table = getTable(object.getClass());
|
||||
for (Class dep : object_table.getFKDependencies().keySet()) {
|
||||
switch (object_table.getFKDependencies().get(dep).data) {
|
||||
case NONE:
|
||||
break;
|
||||
case DROP:
|
||||
DropByFK(object, dep);
|
||||
break;
|
||||
case DELETE:
|
||||
DeleteByFK(object, dep);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
public void DropUI() {
|
||||
SaveLastSelections();
|
||||
}
|
||||
public void ResetUI() {
|
||||
RestoreLastSelections();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,9 @@ public abstract class nDBObject extends DBObject {
|
||||
public Object getEmptyFK() {
|
||||
return "";
|
||||
}
|
||||
public String getFKName() {
|
||||
return getClass().getSimpleName().toLowerCase() + "_id";
|
||||
}
|
||||
public void genName() {
|
||||
id = Utils_.getDateName(getClass().getSimpleName().toLowerCase());
|
||||
}
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package Common.Database.Objects;
|
||||
public class riDBObject extends iDBObject {
|
||||
//-
|
||||
//todo int useraccount_id по объекту аккаунтов. сюда и права. и проверку их.
|
||||
public String sender_name = "";
|
||||
public String sender_address = "";
|
||||
//---
|
||||
public String description = "";
|
||||
//-
|
||||
@Override
|
||||
|
||||
@@ -4,9 +4,9 @@ import Common.Database.Objects.DBObject;
|
||||
import Common.Database.Tables.DBTable;
|
||||
import Common.Database.Tables.DBTableColumn;
|
||||
import Common.Passes.PassException;
|
||||
import Common.Utils.Pair;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.UI;
|
||||
import javafx.util.Pair;
|
||||
|
||||
import java.io.File;
|
||||
import java.sql.*;
|
||||
|
||||
@@ -3,6 +3,7 @@ import Common.Database.Database;
|
||||
import Common.Database.Objects.DBObject;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Vector;
|
||||
public abstract class DBTable<K, D extends DBObject> extends DataSet<K, D> {
|
||||
//-
|
||||
public DBTableColumn PK = null;
|
||||
@@ -34,4 +35,31 @@ public abstract class DBTable<K, D extends DBObject> extends DataSet<K, D> {
|
||||
res.append(c).append("\n");
|
||||
return res.toString();
|
||||
}
|
||||
boolean vectorContains(D object, Vector<D> vector) {
|
||||
for (D v_object : vector) {
|
||||
if (isEqual(object, v_object))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public void ActualizeData(Vector<D> old, Vector<D> actual) throws Exception {
|
||||
//привести данные вектора old в соответствие с вектором new
|
||||
//те, что в нем появились вставить, те что отсутствуют но есть в old удалить
|
||||
Vector<D> to_delete = new Vector<>();
|
||||
Vector<D> to_insert = new Vector<>();
|
||||
for (D object : old) {
|
||||
if (!vectorContains(object, actual))
|
||||
to_delete.add(object);
|
||||
}
|
||||
for (D object : actual) {
|
||||
if (!vectorContains(object, old))
|
||||
to_insert.add(object);
|
||||
}
|
||||
db.BeginTransaction();
|
||||
for (D object : to_delete)
|
||||
db.Delete(object);
|
||||
for (D object : to_insert)
|
||||
db.Insert(object);
|
||||
db.Commit();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,4 +87,8 @@ public class DataSet<K, D extends DBObject> extends DataSetAnchestor {
|
||||
public boolean containsKey(Object key) {
|
||||
return Data.containsKey(key);
|
||||
}
|
||||
//--
|
||||
public boolean isEqual(D o1, D o2) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,18 +35,7 @@ public abstract class DeleteObjectPass<D extends DBObject> extends ObjectPass<D>
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
getDb().Delete(target);
|
||||
for (Class dep : getTable().getFKDependencies().keySet()) {
|
||||
switch (getTable().getFKDependencies().get(dep).data) {
|
||||
case NONE:
|
||||
break;
|
||||
case DROP:
|
||||
getDb().DropByFK(target, dep);
|
||||
break;
|
||||
case DELETE:
|
||||
getDb().DeleteByFK(target, dep);
|
||||
break;
|
||||
}
|
||||
}
|
||||
getDb().DeleteDependencies(target);
|
||||
}
|
||||
//тут именно на финише, чтобы в любом случае вся таблица всегда была видна.
|
||||
@Override
|
||||
|
||||
@@ -20,6 +20,7 @@ public class Pass<T> {
|
||||
public PassState state = PassState.Inactive; //текущее состояние прохода.
|
||||
public Semaphore animation_sem;
|
||||
//--------------
|
||||
public boolean ui_visible = true;
|
||||
public Vector<PassControl> controls = new Vector<>();
|
||||
public TextLog Log; //внутренний журнал прохода.
|
||||
protected boolean interrupt;
|
||||
@@ -29,6 +30,10 @@ public class Pass<T> {
|
||||
private JButton button = null;
|
||||
private JButton tabButton = null;
|
||||
private Exception last_error; //последнее пойманное исключение выполнения.
|
||||
public void addControl(PassControl control_in) {
|
||||
control_in.setVisible(ui_visible);
|
||||
controls.add(control_in);
|
||||
}
|
||||
//->>
|
||||
public Throwable getCauseRec(Throwable ex) {
|
||||
Throwable cause = ex.getCause();
|
||||
@@ -74,8 +79,9 @@ public class Pass<T> {
|
||||
control.setEnabled(flag);
|
||||
}
|
||||
public void setControlsVisible(boolean flag) {
|
||||
ui_visible = flag;
|
||||
for (PassControl control : controls)
|
||||
control.setVisible(flag);
|
||||
control.setVisible(ui_visible);
|
||||
}
|
||||
public void setControlsToolTipText(String text) {
|
||||
for (PassControl control : controls)
|
||||
|
||||
@@ -11,6 +11,11 @@ import java.util.LinkedHashMap;
|
||||
public class Properties {
|
||||
protected LinkedHashMap<String, JMenuItem> controls = new LinkedHashMap<>();
|
||||
private File file = null; //файл где хранятся настройки.
|
||||
public Properties() {
|
||||
}
|
||||
public Properties(File file_in) {
|
||||
setFile(file_in);
|
||||
}
|
||||
public File getFile() {
|
||||
return file;
|
||||
}
|
||||
@@ -24,11 +29,6 @@ public class Properties {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
public Properties() {
|
||||
}
|
||||
public Properties(File file_in) {
|
||||
setFile(file_in);
|
||||
}
|
||||
public boolean updateField(String name, Object newValue) {
|
||||
try {
|
||||
Field field = getClass().getField(name);
|
||||
@@ -86,4 +86,9 @@ public class Properties {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
public void setControlVisible(String settingName, boolean flag) {
|
||||
if (controls.containsKey(settingName)) {
|
||||
controls.get(settingName).setVisible(flag);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
20
src/Common/Utils/IntegerPairJson.java
Normal file
20
src/Common/Utils/IntegerPairJson.java
Normal file
@@ -0,0 +1,20 @@
|
||||
package Common.Utils;
|
||||
import com.google.gson.annotations.Expose;
|
||||
public class IntegerPairJson {
|
||||
@Expose
|
||||
public int key;
|
||||
@Expose
|
||||
public int value;
|
||||
public IntegerPairJson(int key_in, int value_in) {
|
||||
key = key_in;
|
||||
value = value_in;
|
||||
}
|
||||
public IntegerPairJson() {
|
||||
}
|
||||
public int getKey() {
|
||||
return key;
|
||||
}
|
||||
public int getValue() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package Common.Utils;
|
||||
import Common.Visual.UI;
|
||||
import Common.Visual.Windows.ReadOnlyMultilineTextForm;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
@@ -34,8 +35,10 @@ public interface Loggable {
|
||||
ex.printStackTrace(writer);
|
||||
writer.flush();
|
||||
Print(out.toString());
|
||||
if (UI.isActive())
|
||||
UI.Error("Возникло исключение. Подробности в файле журнала\n" +
|
||||
Utils_.Brackets(getLogFile().getAbsolutePath()));
|
||||
if (UI.isActive()) {
|
||||
Utils_.CopyToClipboard(out.toString());
|
||||
ReadOnlyMultilineTextForm ff = new ReadOnlyMultilineTextForm();
|
||||
ff.ShowDialog("Возникло исключение", out.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
95
src/Common/Utils/Pair.java
Normal file
95
src/Common/Utils/Pair.java
Normal file
@@ -0,0 +1,95 @@
|
||||
package Common.Utils;
|
||||
import java.io.Serializable;
|
||||
public class Pair<K, V> implements Serializable {
|
||||
/**
|
||||
* Key of this <code>Pair</code>.
|
||||
*/
|
||||
private K key;
|
||||
/**
|
||||
* Value of this this <code>Pair</code>.
|
||||
*/
|
||||
private V value;
|
||||
/**
|
||||
* Creates a new pair
|
||||
*
|
||||
* @param key The key for this pair
|
||||
* @param value The value to use for this pair
|
||||
*/
|
||||
public Pair(K key, V value) {
|
||||
this.key = key;
|
||||
this.value = value;
|
||||
}
|
||||
/**
|
||||
* Gets the key for this pair.
|
||||
*
|
||||
* @return key for this pair
|
||||
*/
|
||||
public K getKey() {
|
||||
return key;
|
||||
}
|
||||
/**
|
||||
* Gets the value for this pair.
|
||||
*
|
||||
* @return value for this pair
|
||||
*/
|
||||
public V getValue() {
|
||||
return value;
|
||||
}
|
||||
/**
|
||||
* <p><code>String</code> representation of this
|
||||
* <code>Pair</code>.</p>
|
||||
*
|
||||
* <p>The default name/value delimiter '=' is always used.</p>
|
||||
*
|
||||
* @return <code>String</code> representation of this <code>Pair</code>
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return key + "=" + value;
|
||||
}
|
||||
/**
|
||||
* <p>Generate a hash code for this <code>Pair</code>.</p>
|
||||
*
|
||||
* <p>The hash code is calculated using both the name and
|
||||
* the value of the <code>Pair</code>.</p>
|
||||
*
|
||||
* @return hash code for this <code>Pair</code>
|
||||
*/
|
||||
@Override
|
||||
public int hashCode() {
|
||||
// name's hashCode is multiplied by an arbitrary prime number (13)
|
||||
// in order to make sure there is a difference in the hashCode between
|
||||
// these two parameters:
|
||||
// name: a value: aa
|
||||
// name: aa value: a
|
||||
return key.hashCode() * 13 + (value == null ? 0 : value.hashCode());
|
||||
}
|
||||
/**
|
||||
* <p>Test this <code>Pair</code> for equality with another
|
||||
* <code>Object</code>.</p>
|
||||
*
|
||||
* <p>If the <code>Object</code> to be tested is not a
|
||||
* <code>Pair</code> or is <code>null</code>, then this method
|
||||
* returns <code>false</code>.</p>
|
||||
*
|
||||
* <p>Two <code>Pair</code>s are considered equal if and only if
|
||||
* both the names and values are equal.</p>
|
||||
*
|
||||
* @param o the <code>Object</code> to test for
|
||||
* equality with this <code>Pair</code>
|
||||
* @return <code>true</code> if the given <code>Object</code> is
|
||||
* equal to this <code>Pair</code> else <code>false</code>
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o instanceof Pair) {
|
||||
Pair pair = (Pair) o;
|
||||
if (key != null ? !key.equals(pair.key) : pair.key != null) return false;
|
||||
if (value != null ? !value.equals(pair.value) : pair.value != null) return false;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -488,6 +488,16 @@ public class Utils_ {
|
||||
//--
|
||||
return hours + " часов, " + minutes + " минут, " + seconds + " секунд";
|
||||
}
|
||||
public static String printSplittedDateIntervalShort(long milliseconds) {
|
||||
//--
|
||||
long seconds = milliseconds / 1000;
|
||||
long hours = seconds / 3600;
|
||||
seconds = seconds - hours * 3600;
|
||||
long minutes = (seconds) / 60;
|
||||
seconds = seconds - minutes * 60;
|
||||
//--
|
||||
return hours + ":" + minutes + ":" + seconds;
|
||||
}
|
||||
//Синхронизация
|
||||
public static void sleep(long millis) {
|
||||
try {
|
||||
|
||||
@@ -16,7 +16,7 @@ public class PassButton extends MenuBarButton implements PassControl {
|
||||
setIcon(pass.getIconPath());
|
||||
}
|
||||
addActionListener(pass.getControlAction());
|
||||
pass.controls.add(this);
|
||||
pass.addControl(this);
|
||||
}
|
||||
public PassButton(Pass pass) {
|
||||
this(pass, false);
|
||||
|
||||
@@ -8,7 +8,7 @@ public class PassMenuItem extends VisualiserMenuItem implements PassControl {
|
||||
setToolTipText(pass.getDescription());
|
||||
if (pass.getIconPath() != null) setIcon(pass.getIconPath());
|
||||
addActionListener(pass.getControlAction());
|
||||
pass.controls.add(this);
|
||||
pass.addControl(this);
|
||||
}
|
||||
@Override
|
||||
public void setIcon(String icon_path) {
|
||||
|
||||
@@ -7,7 +7,7 @@ public class StablePassMenuItem extends StableMenuItem implements PassControl {
|
||||
setToolTipText(pass.getDescription());
|
||||
if (pass.getIconPath() != null) setIcon(pass.getIconPath());
|
||||
addActionListener(pass.getControlAction());
|
||||
pass.controls.add(this);
|
||||
pass.addControl(this);
|
||||
}
|
||||
@Override
|
||||
public void setIcon(String icon_path) {
|
||||
|
||||
@@ -40,7 +40,6 @@ public abstract class DataSetControlForm<D extends DBObject> extends ControlForm
|
||||
//--
|
||||
Object savedCurrentKey = null;
|
||||
Vector<Object> savedSelectedKeys = new Vector<>();
|
||||
//--
|
||||
public DataSetControlForm(DataSet<?, D> dataSource_in, JPanel mountPanel_in) {
|
||||
super(DataTable.class, mountPanel_in);
|
||||
dataSource = dataSource_in;
|
||||
@@ -68,7 +67,7 @@ public abstract class DataSetControlForm<D extends DBObject> extends ControlForm
|
||||
//--
|
||||
counter_ui = (count -> bar.countLabel.setText(String.valueOf(count)));
|
||||
//--фильтры всегда в конец бара.
|
||||
bar.add(new JSeparator());
|
||||
// bar.add(new JSeparator());
|
||||
for (FilterFlag filter : getFilters(FilterFlag.class)) {
|
||||
bar.add(filter.getControl());
|
||||
}
|
||||
@@ -81,6 +80,10 @@ public abstract class DataSetControlForm<D extends DBObject> extends ControlForm
|
||||
}
|
||||
}
|
||||
}
|
||||
//--
|
||||
public DataMenuBar getMenuBar() {
|
||||
return bar;
|
||||
}
|
||||
protected boolean isPKVisible() {
|
||||
return true;
|
||||
}
|
||||
@@ -559,6 +562,7 @@ public abstract class DataSetControlForm<D extends DBObject> extends ControlForm
|
||||
} else {
|
||||
title += "просмотр";
|
||||
dialog.SetReadonly();
|
||||
dialog.BlockButtons();
|
||||
}
|
||||
return dialog.ShowDialog(title, object);
|
||||
}
|
||||
@@ -574,4 +578,14 @@ public abstract class DataSetControlForm<D extends DBObject> extends ControlForm
|
||||
public Object getCurrentPK(Object nanValue) {
|
||||
return current == null ? nanValue : current.getPK();
|
||||
}
|
||||
public boolean canModifyCurrent(TextLog Log) {
|
||||
return CheckCurrent(Log);
|
||||
}
|
||||
public void SelectKeys(Vector<?> keys_in) {
|
||||
SelectAll(false);
|
||||
for (Object key_ : keys_in)
|
||||
dataSource.get(key_).Select(true);
|
||||
if (!keys_in.isEmpty())
|
||||
Show(keys_in.lastElement());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
package _VisualDVM.Visual.Editor;
|
||||
package Common.Visual.Editor;
|
||||
import Common.MainModule_;
|
||||
import Common.Utils.Pair;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.Menus.StyledPopupMenu;
|
||||
import Common.Visual.Menus.TextEditorMenu;
|
||||
import Common.Visual.Themes.ThemeElement;
|
||||
import Common.Visual.UI;
|
||||
import Common.Visual.Windows.Dialog.DialogFields;
|
||||
import _VisualDVM.Utils;
|
||||
import _VisualDVM.Visual.Syntax.SPFEditorTheme;
|
||||
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea;
|
||||
|
||||
@@ -15,8 +17,9 @@ import java.awt.*;
|
||||
import java.awt.event.KeyAdapter;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.net.URI;
|
||||
import java.util.Vector;
|
||||
public class BaseEditor extends RSyntaxTextArea implements ThemeElement, DialogFields {
|
||||
private final StyledPopupMenu menu;
|
||||
protected final StyledPopupMenu menu;
|
||||
// protected int changesCount = 0;
|
||||
// protected int insertsCount = 0;
|
||||
// protected int removesCount = 0;
|
||||
@@ -128,14 +131,6 @@ public class BaseEditor extends RSyntaxTextArea implements ThemeElement, DialogF
|
||||
changeFont(getFont().getSize() - 1);
|
||||
}
|
||||
@Override
|
||||
public void applyTheme() {
|
||||
float font_size = (float) getFont().getSize();
|
||||
((SPFEditorTheme) MainModule_.instance.getUI().getTheme()).getEditorTheme().apply(this);
|
||||
setFont(getFont().deriveFont(font_size));
|
||||
menu.applyTheme();
|
||||
//меню связано с редактором. поэтому тема меняется только вместе с ним.
|
||||
}
|
||||
@Override
|
||||
public Component getContent() {
|
||||
return this;
|
||||
}
|
||||
@@ -152,4 +147,29 @@ public class BaseEditor extends RSyntaxTextArea implements ThemeElement, DialogF
|
||||
}
|
||||
return res;
|
||||
}
|
||||
//todo как то вывести из коммон.
|
||||
@Override
|
||||
public void applyTheme() {
|
||||
float font_size = (float) getFont().getSize();
|
||||
((SPFEditorTheme) MainModule_.instance.getUI().getTheme()).getEditorTheme().apply(this);
|
||||
setFont(getFont().deriveFont(font_size));
|
||||
menu.applyTheme();
|
||||
//меню связано с редактором. поэтому тема меняется только вместе с ним.
|
||||
}
|
||||
//--
|
||||
public Vector<Pair<Integer, Integer>> getErrorsForHightlight() {
|
||||
Vector<Pair<Integer, Integer>> res = new Vector<>();
|
||||
for (int i = 0; i < this.getLineCount(); ++i) {
|
||||
try {
|
||||
int start = getLineStartOffset(i);
|
||||
int end = getLineEndOffset(i);
|
||||
String line = this.getText(start, end);
|
||||
if (Utils.isCrushedLine(line))
|
||||
res.add(new Pair<>(start, end));
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package _VisualDVM.Visual.Editor;
|
||||
package Common.Visual.Editor;
|
||||
public class Viewer extends BaseEditor {
|
||||
public Viewer() {
|
||||
setLineWrap(true);
|
||||
@@ -8,12 +8,12 @@ import java.awt.*;
|
||||
import java.awt.event.ActionListener;
|
||||
public class DataMenuBar extends VisualiserMenuBar {
|
||||
public JLabel countLabel = null;
|
||||
private DataSet dataSource = null;
|
||||
//-
|
||||
public ActionListener selectAllListener = null;
|
||||
public ActionListener unselectAllListener = null;
|
||||
JButton selectAllButton = null;
|
||||
JButton unselectAllButton = null;
|
||||
private DataSet dataSource = null;
|
||||
//-
|
||||
public DataMenuBar(String dataName, PassCode_... passes) {
|
||||
add(new JLabel(dataName + " : "));
|
||||
|
||||
@@ -3,6 +3,8 @@ import Common.CommonConstants;
|
||||
import Common.Utils.Utils_;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.util.Vector;
|
||||
public class TableMenu extends StyledPopupMenu {
|
||||
int row = CommonConstants.Nan;
|
||||
int column = CommonConstants.Nan;
|
||||
@@ -10,12 +12,19 @@ public class TableMenu extends StyledPopupMenu {
|
||||
//-
|
||||
JTable owner = null;
|
||||
VisualiserMenuItem mcopy;
|
||||
JTextArea value_view;
|
||||
JScrollPane value_scroll;
|
||||
public TableMenu(JTable owner_in) {
|
||||
owner = owner_in;
|
||||
mcopy = new VisualiserMenuItem("Копировать текст текущей ячейки", "/icons/Editor/Copy.png");
|
||||
//если удалось нажать значит все условия выполнены
|
||||
mcopy.addActionListener(e -> Utils_.CopyToClipboard(target.toString()));
|
||||
add(mcopy);
|
||||
//
|
||||
add(value_scroll = new JScrollPane(value_view = new JTextArea()));
|
||||
value_view.setEditable(false);
|
||||
//value_view.setLineWrap(true);
|
||||
//value_view.setWrapStyleWord(true);
|
||||
}
|
||||
@Override
|
||||
public void CheckElementsVisibility() {
|
||||
@@ -24,7 +33,23 @@ public class TableMenu extends StyledPopupMenu {
|
||||
if ((row >= 0) && (column >= 0)) {
|
||||
target = owner.getValueAt(row, column);
|
||||
mcopy.setVisible(true);
|
||||
} else mcopy.setVisible(false);
|
||||
Dimension d = new Dimension(Math.max(mcopy.getWidth(), 300), 100);
|
||||
value_view.setVisible(true);
|
||||
String res = target.toString();
|
||||
if (target instanceof Vector) {
|
||||
Vector<Object> v = (Vector<Object>) target;
|
||||
Vector<String> res_ = new Vector<>();
|
||||
for (Object o : v) {
|
||||
res_.add(o.toString());
|
||||
}
|
||||
res = String.join("\n", res_);
|
||||
}
|
||||
value_view.setText(res);
|
||||
value_scroll.setPreferredSize(d);
|
||||
} else {
|
||||
mcopy.setVisible(false);
|
||||
value_view.setVisible(false);
|
||||
}
|
||||
super.CheckElementsVisibility();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package Common.Visual.Menus;
|
||||
import Common.MainModule_;
|
||||
import Common.Passes.Pass;
|
||||
import Common.Passes.PassCode_;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.Fonts.VisualiserFonts;
|
||||
@@ -20,6 +21,10 @@ public class VisualiserMenuBar extends JToolBar {
|
||||
}
|
||||
}
|
||||
}
|
||||
public void addPasses(Pass... passes) {
|
||||
for (Pass pass : passes)
|
||||
add(pass.createButton());
|
||||
}
|
||||
public JMenuBar addMenus(JMenu... menus) {
|
||||
JMenuBar bar = new JMenuBar() {
|
||||
{
|
||||
|
||||
@@ -21,7 +21,7 @@ public abstract class DataTable extends StyledTable implements DataControl {
|
||||
}
|
||||
}
|
||||
}
|
||||
//-------------------------------
|
||||
//------------------------------
|
||||
/*
|
||||
public void SelectRow(int r) {
|
||||
getSelectionModel().setSelectionInterval(r, r);
|
||||
|
||||
@@ -18,18 +18,28 @@ public class HeaderTextFilter<D extends DBObject> implements DBObjectFilter_<D>
|
||||
int columnIndex = CommonConstants.Nan; //номер столбца к которому привязан фильтр.
|
||||
JTextField textField = null;
|
||||
JPopupMenu popup = null;
|
||||
boolean contains = true;
|
||||
private String filterValue = "";
|
||||
private int offset = 0;
|
||||
//при одиночном клике, показать поверх заголовка столбца выпавшее меню с полем фильтра.
|
||||
public HeaderTextFilter(DataSet dataSet_in, int columnIndex_in, int offset_in) {
|
||||
public HeaderTextFilter(DataSet dataSet_in, int columnIndex_in, int offset_in, boolean contains_in) {
|
||||
dataSet = dataSet_in;
|
||||
columnIndex = columnIndex_in;
|
||||
offset = offset_in;
|
||||
contains = contains_in;
|
||||
}
|
||||
public HeaderTextFilter(DataSet dataSet_in, int columnIndex_in, int offset_in) {
|
||||
this(dataSet_in, columnIndex_in, offset_in, true);
|
||||
}
|
||||
@Override
|
||||
public boolean Validate(D object) {
|
||||
Object field = dataSet.getUI().getColumnInfo(columnIndex).getFieldAt(object);
|
||||
return (field instanceof String) && field.toString().toLowerCase().contains(filterValue);
|
||||
if (field instanceof String) {
|
||||
String s = field.toString().toLowerCase();
|
||||
return contains ? s.contains(filterValue) :
|
||||
(filterValue.isEmpty() || s.equals(filterValue)) || (filterValue.trim().isEmpty() && s.isEmpty());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
//---
|
||||
public void Mount(DataTable control) {
|
||||
|
||||
16
src/Common/Visual/Tables/RendererLongCell.java
Normal file
16
src/Common/Visual/Tables/RendererLongCell.java
Normal file
@@ -0,0 +1,16 @@
|
||||
package Common.Visual.Tables;
|
||||
import Common.MainModule_;
|
||||
import Common.Visual.Fonts.VisualiserFonts;
|
||||
|
||||
import javax.swing.*;
|
||||
public class RendererLongCell extends RendererCell {
|
||||
@Override
|
||||
public Object Init(JTable table, Object value, int row, int column) {
|
||||
return value;
|
||||
}
|
||||
@Override
|
||||
public void Display() {
|
||||
setText(value.toString());
|
||||
setFont(MainModule_.instance.getUI().getTheme().Fonts.get(VisualiserFonts.TreePlain).deriveFont(12.0f));
|
||||
}
|
||||
}
|
||||
16
src/Common/Visual/Tables/RendererMilliseconds.java
Normal file
16
src/Common/Visual/Tables/RendererMilliseconds.java
Normal file
@@ -0,0 +1,16 @@
|
||||
package Common.Visual.Tables;
|
||||
import Common.Utils.Utils_;
|
||||
|
||||
import javax.swing.*;
|
||||
public class RendererMilliseconds extends RendererCell<Long> {
|
||||
@Override
|
||||
public Long Init(JTable table, Object value, int row, int column) {
|
||||
return (Long) value;
|
||||
}
|
||||
@Override
|
||||
public void Display() {
|
||||
if (value != null) {
|
||||
setText(Utils_.printSplittedDateIntervalShort(value));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,5 +4,7 @@ public interface ThemeElement {
|
||||
}
|
||||
default void FontDown() {
|
||||
}
|
||||
void applyTheme();
|
||||
default void applyTheme() {
|
||||
}
|
||||
;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package Common.Visual;
|
||||
import Common.MainModule_;
|
||||
import Common.Utils.Utils_;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.ChangeListener;
|
||||
@@ -59,12 +58,10 @@ public class UI {
|
||||
return Question(MainModule_.instance.getUI().getFrontWindow(), text);
|
||||
}
|
||||
public static void Info(String message) {
|
||||
Utils_.CopyToClipboard(message);
|
||||
if (UI.isActive())
|
||||
JOptionPane.showMessageDialog(MainModule_.instance.getUI().getFrontWindow(), message, "", 1);
|
||||
}
|
||||
public static void Error(String message) {
|
||||
Utils_.CopyToClipboard(message);
|
||||
if (UI.isActive())
|
||||
JOptionPane.showMessageDialog(MainModule_.instance.getUI().getFrontWindow(), message, "", 0);
|
||||
}
|
||||
|
||||
@@ -108,6 +108,10 @@ public class Dialog<T, F extends DialogFields> extends JDialog implements ThemeE
|
||||
}
|
||||
getContentPane().add(buttonsPane, BorderLayout.SOUTH);
|
||||
}
|
||||
public void BlockButtons() {
|
||||
btnOK.setVisible(false);
|
||||
btnCancel.setVisible(false);
|
||||
}
|
||||
public boolean isOnTop() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -30,6 +30,6 @@ public class ComboTextDialog extends Dialog<String, DialogTextComboBox> {
|
||||
}
|
||||
@Override
|
||||
public int getDefaultHeight() {
|
||||
return 135;
|
||||
return 200;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package _VisualDVM.Visual.Windows;
|
||||
package Common.Visual.Windows;
|
||||
import Common.Visual.Editor.BaseEditor;
|
||||
import Common.Visual.Windows.Dialog.Text.TextDialog;
|
||||
import _VisualDVM.Visual.Editor.BaseEditor;
|
||||
public class MultilineTextForm extends TextDialog<BaseEditor> {
|
||||
public MultilineTextForm() {
|
||||
super(BaseEditor.class);
|
||||
@@ -1,4 +1,4 @@
|
||||
package _VisualDVM.Visual.Windows;
|
||||
package Common.Visual.Windows;
|
||||
public class ReadOnlyMultilineTextForm extends MultilineTextForm {
|
||||
public ReadOnlyMultilineTextForm() {
|
||||
}
|
||||
@@ -1,18 +1,16 @@
|
||||
package _VisualDVM.Repository.BugReport;
|
||||
package _VisualDVM.ComponentsServer.BugReport;
|
||||
import Common.Database.Objects.DBObject;
|
||||
import Common.Database.Objects.rDBObject;
|
||||
import Common.Utils.TextLog;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Utils.Vector_;
|
||||
import _VisualDVM.ComponentsServer.BugReportRecipient.BugReportRecipient;
|
||||
import _VisualDVM.ComponentsServer.BugReportSetting.BugReportSetting;
|
||||
import _VisualDVM.ComponentsServer.Component.ComponentType;
|
||||
import _VisualDVM.ComponentsServer.UserAccount.UserAccount;
|
||||
import _VisualDVM.Constants;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.GlobalData.Account.Account;
|
||||
import _VisualDVM.ProjectData.SapforData.SapforProperties;
|
||||
import _VisualDVM.Repository.BugReport.Json.RecipientJson;
|
||||
import _VisualDVM.Repository.BugReport.Json.RecipientsJson;
|
||||
import _VisualDVM.Repository.BugReport.Json.VisualiserSettingsJson;
|
||||
import _VisualDVM.Repository.Component.ComponentType;
|
||||
import _VisualDVM.Repository.RepositoryServer;
|
||||
import _VisualDVM.Repository.Subscribes.Subscriber;
|
||||
import com.sun.org.glassfish.gmbal.Description;
|
||||
|
||||
import java.io.File;
|
||||
@@ -24,10 +22,8 @@ public class BugReport extends rDBObject {
|
||||
public long visualiser_version = -1;
|
||||
public long sapfor_version = -1;
|
||||
public String comment = "";
|
||||
@Description("DEFAULT ''")
|
||||
public String packedRecipientsJson = "";
|
||||
@Description("DEFAULT ''")
|
||||
public String packedSettingsJson = ""; //устарело. (?)
|
||||
public Vector<BugReportSetting> settings = null;
|
||||
public Vector<BugReportRecipient> recipients = null;
|
||||
public String executor = "";
|
||||
@Description("DEFAULT ''")
|
||||
public String executor_address = "";
|
||||
@@ -54,7 +50,7 @@ public class BugReport extends rDBObject {
|
||||
project_version = version_in;
|
||||
visualiser_version = Global.visualiser.version;
|
||||
sapfor_version = Global.components.get(ComponentType.Sapfor_F).version;
|
||||
packedSettingsJson = Utils_.gson.toJson(Global.mainModule.getProject().sapforProperties);
|
||||
settings = Global.mainModule.getProject().sapforProperties.toBugReportSettings();
|
||||
percentage = 0;
|
||||
description = description_in;
|
||||
date = new Date().getTime();
|
||||
@@ -69,7 +65,6 @@ public class BugReport extends rDBObject {
|
||||
change_date = b.change_date;
|
||||
description = b.description;
|
||||
comment = b.comment;
|
||||
packedRecipientsJson = b.packedRecipientsJson;
|
||||
state = b.state;
|
||||
percentage = b.percentage;
|
||||
//-
|
||||
@@ -78,8 +73,6 @@ public class BugReport extends rDBObject {
|
||||
project_version = b.project_version;
|
||||
visualiser_version = b.visualiser_version;
|
||||
sapfor_version = b.sapfor_version;
|
||||
packedSettingsJson = b.packedSettingsJson;
|
||||
//-
|
||||
descriptionAdditionDraft = b.descriptionAdditionDraft;
|
||||
commentAdditionDraft = b.commentAdditionDraft;
|
||||
owner = b.owner;
|
||||
@@ -127,57 +120,45 @@ public class BugReport extends rDBObject {
|
||||
}
|
||||
public String getSettingsSummary() {
|
||||
Vector<String> res = new Vector_<String>(
|
||||
(Global.mainModule.HasAccount() ? (Global.mainModule.getAccount().isAdmin() ? ("Адрес отправителя: " + sender_address + "\n") : "") : ""),
|
||||
(Global.mainModule.getAccount().isAdmin() ? ("Адрес отправителя: " + sender_address + "\n") : ""),
|
||||
"Версия SAPFOR: " + sapfor_version,
|
||||
"Версия визуализатора: " + visualiser_version,
|
||||
"----------------------------------"
|
||||
);
|
||||
if (!project_version.isEmpty()) {
|
||||
if (visualiser_version < 1134) {
|
||||
res.add(getSettingsJson().getSummary());
|
||||
} else {
|
||||
res.add(getPropertiesJson().getSummary());
|
||||
}
|
||||
}
|
||||
//--
|
||||
Vector<BugReportSetting> settings_ = Global.componentsServer.db.getVectorByFK(this, BugReportSetting.class);
|
||||
SapforProperties dummy = new SapforProperties();
|
||||
for (BugReportSetting bugReportSetting : settings_)
|
||||
res.add(dummy.getFieldDescription(bugReportSetting.name) + "=" + Utils_.DQuotes(bugReportSetting.value));
|
||||
//--
|
||||
return String.join("\n", res);
|
||||
}
|
||||
public String getPassport() {
|
||||
return String.join("\n",
|
||||
RepositoryServer.separator,
|
||||
Constants.separator,
|
||||
"Отправитель: " + sender_name,
|
||||
"Исполнитель: " + executor,
|
||||
"Проект: " + project_version,
|
||||
RepositoryServer.separator,
|
||||
Constants.separator,
|
||||
getSettingsSummary(),
|
||||
RepositoryServer.separator);
|
||||
Constants.separator);
|
||||
}
|
||||
public boolean isNoneProject() {
|
||||
return project_version.isEmpty();
|
||||
}
|
||||
//--->
|
||||
public void CheckSubscribers() {
|
||||
for (Subscriber subscriber : Global.componentsServer.db.subscribers.Data.values())
|
||||
subscriber.Select(packedRecipientsJson.contains(subscriber.address));
|
||||
public void CheckRecipients() {
|
||||
Global.componentsServer.db.recipients.getUI().SelectAll(false);
|
||||
Vector<BugReportRecipient> recipients_ = state.equals(BugReportState.draft) ?
|
||||
recipients : Global.componentsServer.db.getVectorByFK(this, BugReportRecipient.class);
|
||||
if (recipients_ != null) {
|
||||
for (BugReportRecipient bugReportRecipient : recipients_) {
|
||||
if (Global.componentsServer.db.recipients.containsKey(bugReportRecipient.email))
|
||||
Global.componentsServer.db.recipients.get(bugReportRecipient.email).Select(true);
|
||||
}
|
||||
public void saveRecipientsAsJson(Vector<Subscriber> subscribers) {
|
||||
packedRecipientsJson = Utils_.gson.toJson(new RecipientsJson(subscribers));
|
||||
}
|
||||
public Vector<String> getRecipients() {
|
||||
Vector<String> res = new Vector<>();
|
||||
if (packedRecipientsJson.isEmpty()) return res;
|
||||
RecipientsJson recipients = Utils_.gson.fromJson(packedRecipientsJson, RecipientsJson.class);
|
||||
for (RecipientJson recipientJson : recipients.array) {
|
||||
res.add(recipientJson.address);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
public VisualiserSettingsJson getSettingsJson() {
|
||||
return packedSettingsJson.isEmpty() ? new VisualiserSettingsJson() : Utils_.gson.fromJson(packedSettingsJson, VisualiserSettingsJson.class);
|
||||
}
|
||||
public SapforProperties getPropertiesJson() {
|
||||
return packedSettingsJson.isEmpty() ? new SapforProperties() : Utils_.gson.fromJson(packedSettingsJson, SapforProperties.class);
|
||||
}
|
||||
public boolean canAppend(Account account, TextLog log) {
|
||||
public boolean canAppend(UserAccount account, TextLog log) {
|
||||
if (account.CheckRegistered(log)) {
|
||||
if (account.email.equals(sender_address) || account.email.equals(executor_address)) {
|
||||
return true;
|
||||
@@ -195,7 +176,7 @@ public class BugReport extends rDBObject {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public boolean canModify(Account account, TextLog log) {
|
||||
public boolean canModify(UserAccount account, TextLog log) {
|
||||
if (account.CheckRegistered(log)) {
|
||||
switch (account.role) {
|
||||
case Admin:
|
||||
@@ -1,4 +1,4 @@
|
||||
package _VisualDVM.Repository.BugReport;
|
||||
package _VisualDVM.ComponentsServer.BugReport;
|
||||
import Common.Visual.Fonts.VisualiserFonts;
|
||||
import Common.Visual.StatusEnum;
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
package _VisualDVM.ComponentsServer.BugReport;
|
||||
import Common.Database.Objects.DBObject;
|
||||
import Common.Database.Tables.DBTable;
|
||||
import Common.Database.Tables.FKBehaviour;
|
||||
import Common.Database.Tables.FKCurrentObjectBehaviuor;
|
||||
import Common.Database.Tables.FKDataBehaviour;
|
||||
import Common.Visual.DataSetControlForm;
|
||||
import _VisualDVM.ComponentsServer.BugReport.UI.BugReportsForm;
|
||||
import _VisualDVM.ComponentsServer.BugReportRecipient.BugReportRecipient;
|
||||
import _VisualDVM.ComponentsServer.BugReportSetting.BugReportSetting;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Vector;
|
||||
import java.util.stream.Collectors;
|
||||
public class BugReportsDBTable extends DBTable<String, BugReport> {
|
||||
public BugReportsDBTable() {
|
||||
super(String.class, BugReport.class);
|
||||
}
|
||||
@Override
|
||||
public String getSingleDescription() {
|
||||
return "отчёт об ошибке";
|
||||
}
|
||||
@Override
|
||||
public String getPluralDescription() {
|
||||
return "отчёты об ошибках";
|
||||
}
|
||||
@Override
|
||||
protected DataSetControlForm createUI(JPanel mountPanel) {
|
||||
return new BugReportsForm(this, mountPanel);
|
||||
}
|
||||
public Vector<BugReport> getAllDrafts() throws Exception {
|
||||
return Data.values().stream().filter(bugReport -> bugReport.state.equals(BugReportState.draft)).collect(Collectors.toCollection(Vector::new));
|
||||
}
|
||||
@Override
|
||||
public LinkedHashMap<Class<? extends DBObject>, FKBehaviour> getFKDependencies() {
|
||||
LinkedHashMap<Class<? extends DBObject>, FKBehaviour> res = new LinkedHashMap<>();
|
||||
res.put(BugReportSetting.class, new FKBehaviour(FKDataBehaviour.DELETE, FKCurrentObjectBehaviuor.PASSIVE));
|
||||
res.put(BugReportRecipient.class, new FKBehaviour(FKDataBehaviour.DELETE, FKCurrentObjectBehaviuor.PASSIVE));
|
||||
return res;
|
||||
}
|
||||
//-
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
package _VisualDVM.Repository.BugReport.Json;
|
||||
import _VisualDVM.Repository.BugReport.BugReport;
|
||||
package _VisualDVM.ComponentsServer.BugReport.Json;
|
||||
import _VisualDVM.ComponentsServer.BugReport.BugReport;
|
||||
import com.google.gson.annotations.Expose;
|
||||
|
||||
import java.io.Serializable;
|
||||
@@ -1,4 +1,4 @@
|
||||
package _VisualDVM.Repository.BugReport.UI;
|
||||
package _VisualDVM.ComponentsServer.BugReport.UI;
|
||||
import Common.Database.Tables.DataSet;
|
||||
import Common.Passes.PassCode_;
|
||||
import Common.Visual.DataSetControlForm;
|
||||
@@ -7,10 +7,10 @@ import Common.Visual.Tables.ColumnInfo;
|
||||
import Common.Visual.Tables.RendererDate;
|
||||
import Common.Visual.Tables.RendererProgressBar;
|
||||
import Common.Visual.Tables.RendererStatusEnum;
|
||||
import _VisualDVM.ComponentsServer.BugReport.BugReport;
|
||||
import _VisualDVM.ComponentsServer.BugReport.BugReportState;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
import _VisualDVM.Repository.BugReport.BugReport;
|
||||
import _VisualDVM.Repository.BugReport.BugReportState;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
@@ -0,0 +1,24 @@
|
||||
package _VisualDVM.ComponentsServer.BugReportRecipient;
|
||||
import Common.Database.Objects.DBObject;
|
||||
import Common.Database.Objects.iDBObject;
|
||||
import _VisualDVM.ComponentsServer.BugReport.BugReport;
|
||||
public class BugReportRecipient extends iDBObject {
|
||||
public String bugreport_id = "";
|
||||
public String email = "";
|
||||
public BugReportRecipient() {
|
||||
}
|
||||
public BugReportRecipient(BugReport bugReport, String email_in) {
|
||||
bugreport_id = bugReport.id;
|
||||
email = email_in;
|
||||
}
|
||||
public BugReportRecipient(String email_in) {
|
||||
email = email_in;
|
||||
}
|
||||
@Override
|
||||
public void SynchronizeFields(DBObject src) {
|
||||
super.SynchronizeFields(src);
|
||||
BugReportRecipient src_ = (BugReportRecipient) src;
|
||||
bugreport_id = src_.bugreport_id;
|
||||
email = src_.email;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package _VisualDVM.ComponentsServer.BugReportRecipient;
|
||||
import Common.Database.Tables.iDBTable;
|
||||
public class BugReportRecipientsDBTable extends iDBTable<BugReportRecipient> {
|
||||
public BugReportRecipientsDBTable() {
|
||||
super(BugReportRecipient.class);
|
||||
}
|
||||
@Override
|
||||
public boolean isEqual(BugReportRecipient o1, BugReportRecipient o2) {
|
||||
return o1.bugreport_id.equals(o2.bugreport_id) && o1.email.equals(o2.email);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package _VisualDVM.ComponentsServer.BugReportSetting;
|
||||
import Common.Database.Objects.DBObject;
|
||||
import Common.Database.Objects.iDBObject;
|
||||
import _VisualDVM.ComponentsServer.BugReport.BugReport;
|
||||
public class BugReportSetting extends iDBObject {
|
||||
public String bugreport_id = "";
|
||||
public String name = "";
|
||||
public String value = "";
|
||||
public BugReportSetting() {
|
||||
}
|
||||
public BugReportSetting(BugReport bugReport, String name_in, Object value_in) {
|
||||
this(name_in, value_in);
|
||||
bugreport_id = bugReport.id;
|
||||
}
|
||||
public BugReportSetting(String name_in, Object value_in) {
|
||||
name = name_in;
|
||||
value = (value_in instanceof Boolean) ? ((boolean) value_in ? "1" : "0") : value_in.toString();
|
||||
}
|
||||
@Override
|
||||
public void SynchronizeFields(DBObject src) {
|
||||
super.SynchronizeFields(src);
|
||||
BugReportSetting src_ = (BugReportSetting) src;
|
||||
bugreport_id = src_.bugreport_id;
|
||||
name = src_.name;
|
||||
value = src_.value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package _VisualDVM.ComponentsServer.BugReportSetting;
|
||||
import Common.Database.Tables.iDBTable;
|
||||
public class BugReportSettingsDBTable extends iDBTable<BugReportSetting> {
|
||||
public BugReportSettingsDBTable() {
|
||||
super(BugReportSetting.class);
|
||||
}
|
||||
}
|
||||
62
src/_VisualDVM/ComponentsServer/BugReportsDatabase.java
Normal file
62
src/_VisualDVM/ComponentsServer/BugReportsDatabase.java
Normal file
@@ -0,0 +1,62 @@
|
||||
package _VisualDVM.ComponentsServer;
|
||||
import Common.Database.SQLITE.SQLiteDatabase;
|
||||
import _VisualDVM.ComponentsServer.BugReport.BugReport;
|
||||
import _VisualDVM.ComponentsServer.BugReport.BugReportsDBTable;
|
||||
import _VisualDVM.ComponentsServer.BugReportRecipient.BugReportRecipient;
|
||||
import _VisualDVM.ComponentsServer.BugReportRecipient.BugReportRecipientsDBTable;
|
||||
import _VisualDVM.ComponentsServer.BugReportSetting.BugReportSettingsDBTable;
|
||||
import _VisualDVM.ComponentsServer.Recipient.RecipientsDataSet;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Vector;
|
||||
public class BugReportsDatabase extends SQLiteDatabase {
|
||||
public BugReportsDBTable bugReports;
|
||||
public BugReportSettingsDBTable bugReportSettings;
|
||||
public BugReportRecipientsDBTable bugReportRecipients;
|
||||
public RecipientsDataSet recipients = new RecipientsDataSet();
|
||||
public BugReportsDatabase() {
|
||||
super(Paths.get(System.getProperty("user.dir"), "Data", "bug_reports.sqlite").toFile());
|
||||
}
|
||||
@Override
|
||||
protected void initAllTables() throws Exception {
|
||||
addTable(bugReports = new BugReportsDBTable());
|
||||
addTable(bugReportSettings = new BugReportSettingsDBTable());
|
||||
addTable(bugReportRecipients = new BugReportRecipientsDBTable());
|
||||
}
|
||||
@Override
|
||||
public void Init() throws Exception {
|
||||
DeleteDrafts();
|
||||
}
|
||||
@Override
|
||||
public PassCode getSynchronizePassCode() {
|
||||
return PassCode.SynchronizeBugReports;
|
||||
}
|
||||
public void DeleteDrafts() throws Exception {
|
||||
Vector<BugReport> drafts = bugReports.getAllDrafts();
|
||||
for (BugReport draft : drafts)
|
||||
Delete(draft);
|
||||
}
|
||||
@Override
|
||||
public void DropUI() {
|
||||
super.DropUI();
|
||||
bugReports.ClearUI();
|
||||
recipients.ClearUI();
|
||||
}
|
||||
@Override
|
||||
public void ResetUI() {
|
||||
bugReports.ShowUI();
|
||||
recipients.ShowUI(); //todo временно.
|
||||
super.ResetUI();
|
||||
}
|
||||
public void saveBugreportRecipients(BugReport bugReport) throws Exception {
|
||||
if (bugReport.recipients != null) {
|
||||
for (BugReportRecipient recipient : bugReport.recipients) {
|
||||
recipient.bugreport_id = bugReport.id;
|
||||
Insert(recipient);
|
||||
}
|
||||
}
|
||||
}
|
||||
public void Patch() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package _VisualDVM.Repository.Component;
|
||||
package _VisualDVM.ComponentsServer.Component;
|
||||
import Common.CommonConstants;
|
||||
import Common.Database.Objects.DBObject;
|
||||
import Common.Passes.PassException;
|
||||
@@ -1,4 +1,4 @@
|
||||
package _VisualDVM.Repository.Component;
|
||||
package _VisualDVM.ComponentsServer.Component;
|
||||
import Common.Visual.Fonts.VisualiserFonts;
|
||||
import Common.Visual.StatusEnum;
|
||||
public enum ComponentState implements StatusEnum {
|
||||
@@ -1,4 +1,4 @@
|
||||
package _VisualDVM.Repository.Component;
|
||||
package _VisualDVM.ComponentsServer.Component;
|
||||
import java.io.Serializable;
|
||||
public enum ComponentType implements Serializable {
|
||||
Undefined,
|
||||
@@ -1,12 +1,11 @@
|
||||
package _VisualDVM.Repository.Component;
|
||||
package _VisualDVM.ComponentsServer.Component;
|
||||
import Common.Database.Tables.DataSet;
|
||||
import Common.MainModule_;
|
||||
import Common.Visual.DataSetControlForm;
|
||||
import _VisualDVM.ComponentsServer.Component.Sapfor.Sapfor_F;
|
||||
import _VisualDVM.ComponentsServer.Component.UI.ComponentsForm;
|
||||
import _VisualDVM.Current;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Repository.Component.PerformanceAnalyzer.PerformanceAnalyzer;
|
||||
import _VisualDVM.Repository.Component.Sapfor.Sapfor_F;
|
||||
import _VisualDVM.Repository.Component.UI.ComponentsForm;
|
||||
|
||||
import javax.swing.*;
|
||||
public class ComponentsSet extends DataSet<ComponentType, Component> {
|
||||
@@ -18,7 +17,7 @@ public class ComponentsSet extends DataSet<ComponentType, Component> {
|
||||
put(ComponentType.Visualiser, Global.visualiser = new Visualiser());
|
||||
put(ComponentType.Sapfor_F, (Component) MainModule_.instance.set(Current.Sapfor, new Sapfor_F()));
|
||||
put(ComponentType.Visualizer_2, Global.visualizer_2);
|
||||
put(ComponentType.PerformanceAnalyzer, Global.performanceAnalyzer = new PerformanceAnalyzer());
|
||||
// put(ComponentType.PerformanceAnalyzer, Global.performanceAnalyzer = new PerformanceAnalyzer());
|
||||
put(ComponentType.Instruction, new Instruction());
|
||||
}
|
||||
public boolean needChanges() {
|
||||
@@ -75,7 +74,10 @@ public class ComponentsSet extends DataSet<ComponentType, Component> {
|
||||
return !bad_state;
|
||||
}
|
||||
public void initialVersionsCheck() {
|
||||
for (Component component : Data.values())
|
||||
for (Component component : Data.values()) {
|
||||
System.out.println(component.getComponentType() + " initial version checking...");
|
||||
component.InitialVersionCheck();
|
||||
System.out.println("done");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package _VisualDVM.Repository.Component;
|
||||
package _VisualDVM.ComponentsServer.Component;
|
||||
import Common.Utils.Utils_;
|
||||
import _VisualDVM.Utils;
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
package _VisualDVM.Repository.Component.Json;
|
||||
package _VisualDVM.ComponentsServer.Component.Json;
|
||||
import Common.CommonConstants;
|
||||
import Common.Utils.Utils_;
|
||||
import _VisualDVM.Repository.Component.Component;
|
||||
import _VisualDVM.Repository.Component.ComponentType;
|
||||
import _VisualDVM.ComponentsServer.Component.Component;
|
||||
import _VisualDVM.ComponentsServer.Component.ComponentType;
|
||||
import com.google.gson.annotations.Expose;
|
||||
|
||||
import java.io.Serializable;
|
||||
@@ -13,15 +14,22 @@ public class ComponentPublicationInfoJson implements Serializable {
|
||||
@Expose
|
||||
public byte[] packedFile = null;
|
||||
@Expose
|
||||
public long versionNumber = CommonConstants.Nan;
|
||||
@Expose
|
||||
public String versionText = "";
|
||||
@Expose
|
||||
public String changeRecord = "";
|
||||
@Expose
|
||||
public boolean needsUpdateMinimalVersion = false;
|
||||
@Expose
|
||||
public boolean needsEmail = false;
|
||||
@Expose
|
||||
public boolean needsSendFile = false;
|
||||
public ComponentPublicationInfoJson(Component component) throws Exception {
|
||||
componentType = component.getComponentType();
|
||||
fileName = component.getFileName();
|
||||
packedFile = Utils_.fileToBytes(component.getFile());
|
||||
versionNumber = component.version;
|
||||
versionText = component.getVersionText();
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
package _VisualDVM.Repository.Component.Json;
|
||||
import _VisualDVM.Repository.Component.ComponentType;
|
||||
package _VisualDVM.ComponentsServer.Component.Json;
|
||||
import _VisualDVM.ComponentsServer.Component.ComponentType;
|
||||
import com.google.gson.annotations.Expose;
|
||||
|
||||
import java.io.Serializable;
|
||||
@@ -0,0 +1,10 @@
|
||||
package _VisualDVM.ComponentsServer.Component.Json;
|
||||
import com.google.gson.annotations.Expose;
|
||||
public class VersionInfo_json {
|
||||
@Expose
|
||||
public int version;
|
||||
@Expose
|
||||
public String build_date;
|
||||
@Expose
|
||||
public String build_time;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package _VisualDVM.Repository.Component;
|
||||
package _VisualDVM.ComponentsServer.Component;
|
||||
import Common.Utils.Utils_;
|
||||
public abstract class OSDComponent extends Component {
|
||||
@Override
|
||||
@@ -1,9 +1,9 @@
|
||||
package _VisualDVM.Repository.Component.PerformanceAnalyzer;
|
||||
package _VisualDVM.ComponentsServer.Component.PerformanceAnalyzer;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.UI;
|
||||
import _VisualDVM.ComponentsServer.Component.Component;
|
||||
import _VisualDVM.ComponentsServer.Component.ComponentType;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Repository.Component.Component;
|
||||
import _VisualDVM.Repository.Component.ComponentType;
|
||||
import _VisualDVM.Utils;
|
||||
import analyzer.common.MessageJtoJ;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package _VisualDVM.Repository.Component.Sapfor;
|
||||
package _VisualDVM.ComponentsServer.Component.Sapfor;
|
||||
import Common.MainModule_;
|
||||
import Common.Utils.Utils_;
|
||||
|
||||
@@ -1,26 +1,27 @@
|
||||
package _VisualDVM.Repository.Component.Sapfor;
|
||||
package _VisualDVM.ComponentsServer.Component.Sapfor;
|
||||
import Common.CommonConstants;
|
||||
import Common.Passes.PassException;
|
||||
import Common.Utils.Pair;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.UI;
|
||||
import _VisualDVM.ComponentsServer.Component.Json.VersionInfo_json;
|
||||
import _VisualDVM.ComponentsServer.Component.OSDComponent;
|
||||
import _VisualDVM.Constants;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
import _VisualDVM.Passes.Sapfor.SapforAnalysis;
|
||||
import _VisualDVM.ProjectData.Files.DBProjectFile;
|
||||
import _VisualDVM.ProjectData.Files.UI.Editor.SPFEditor;
|
||||
import _VisualDVM.Repository.Component.OSDComponent;
|
||||
import _VisualDVM.Repository.Component.Visualizer_2;
|
||||
import _VisualDVM.ProjectData.Project.db_project_info;
|
||||
import _VisualDVM.ProjectData.SapforData.ModifiedFile_json;
|
||||
import _VisualDVM.ProjectData.SapforData.SapforResult_json;
|
||||
import _VisualDVM.TestingSystem.Common.Test.Test;
|
||||
import _VisualDVM.Utils;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
import java.util.*;
|
||||
public abstract class Sapfor extends OSDComponent {
|
||||
public static final int empty_code = -100;
|
||||
public static final int canceled_code = -99;
|
||||
@@ -31,8 +32,6 @@ public abstract class Sapfor extends OSDComponent {
|
||||
public Vector<String> Intrinsics = new Vector<>();
|
||||
public LinkedHashMap<String, String> ModifiedFiles = new LinkedHashMap<>();
|
||||
public LinkedHashMap<String, String> OldFiles = new LinkedHashMap<>();
|
||||
int size;
|
||||
int[] sizes;
|
||||
String PID = "";
|
||||
private int errorCode;
|
||||
private String result;
|
||||
@@ -72,7 +71,8 @@ public abstract class Sapfor extends OSDComponent {
|
||||
PassCode.SPF_PrivateShrinking,
|
||||
PassCode.SPF_PrivateExpansion,
|
||||
PassCode.SPF_PrivateRemoving,
|
||||
PassCode.SPF_InsertPrivateFromGUI
|
||||
PassCode.SPF_InsertPrivateFromGUI,
|
||||
PassCode.SPF_InsertPrivateArrayDirectives
|
||||
};
|
||||
}
|
||||
public static PassCode[] getProceduresTransformationsCodes() {
|
||||
@@ -87,7 +87,8 @@ public abstract class Sapfor extends OSDComponent {
|
||||
return new PassCode[]{
|
||||
PassCode.SPF_RemoveDvmDirectivesToComments,
|
||||
PassCode.SPF_RemoveDvmDirectives,
|
||||
PassCode.SPF_RemoveOmpDirectives
|
||||
PassCode.SPF_RemoveOmpDirectives,
|
||||
PassCode.SPF_RemoveSpfDirectives
|
||||
};
|
||||
}
|
||||
public static PassCode[] getIntervalsTransformationsCodes() {
|
||||
@@ -177,6 +178,11 @@ public abstract class Sapfor extends OSDComponent {
|
||||
if (line.toLowerCase().contains("segmentation fault")) {
|
||||
return false;
|
||||
}
|
||||
/*
|
||||
if (line.toLowerCase().contains("error in unparse")) {
|
||||
return false;
|
||||
}
|
||||
*/
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -213,7 +219,7 @@ public abstract class Sapfor extends OSDComponent {
|
||||
Charset.defaultCharset());
|
||||
if (!file.setExecutable(true))
|
||||
throw new Exception("Не удалось сделать файл скрипта " + name + " исполняемым!");
|
||||
//--
|
||||
//-- Windows
|
||||
boolean flag = false;
|
||||
do {
|
||||
try {
|
||||
@@ -271,37 +277,7 @@ public abstract class Sapfor extends OSDComponent {
|
||||
result_lines
|
||||
);
|
||||
}
|
||||
public static File getTempCopy(File src) throws Exception {
|
||||
if (temp_copy == null || !temp_copy.exists()) {
|
||||
temp_copy = Utils.getTempFileName("SAPFOR" + (Utils_.isWindows() ? ".exe" : ""));
|
||||
FileUtils.copyFile(src, temp_copy);
|
||||
temp_copy.setExecutable(true);
|
||||
}
|
||||
return temp_copy;
|
||||
}
|
||||
//--
|
||||
public static boolean getMinMaxDim(File sapfor_drv, File workspace, Test test) throws Exception {
|
||||
File sapfor = Sapfor.getTempCopy(sapfor_drv);
|
||||
String flags = "-noLogo";
|
||||
if (Sapfor.parse(sapfor, workspace, flags)
|
||||
) {
|
||||
Vector<String> outputLines = new Vector<>();
|
||||
if (Sapfor.analysis(sapfor, workspace, PassCode.SPF_GetMaxMinBlockDistribution, flags, outputLines)) {
|
||||
//---
|
||||
for (String line : outputLines) {
|
||||
String prefix = "GET_MIN_MAX_BLOCK_DIST: ";
|
||||
if (line.startsWith(prefix)) {
|
||||
String s = line.substring(prefix.length());
|
||||
String[] data = s.split(" ");
|
||||
test.min_dim = Math.max(Integer.parseInt(data[0]), 0);
|
||||
test.max_dim = Math.max(Integer.parseInt(data[1]), 0);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public static int readVersionFromCode(File versionFile) {
|
||||
int res = CommonConstants.Nan;
|
||||
if (versionFile.exists()) {
|
||||
@@ -327,6 +303,106 @@ public abstract class Sapfor extends OSDComponent {
|
||||
}
|
||||
return res;
|
||||
}
|
||||
//--
|
||||
public static int getFileMaxDim_C(File file) {
|
||||
int fileMax = 0;
|
||||
final String prefix = "#pragma dvm array distribute";
|
||||
int n = 0;
|
||||
try {
|
||||
for (String line : FileUtils.readLines(file, Charset.defaultCharset())) {
|
||||
// #pragma dvm array distribute[block][block], не важно
|
||||
String packedLine = Utils_.removeCharacters(Utils_.removeRedundantSpaces(line).toLowerCase(), "\n", "\r", "\t");
|
||||
if (packedLine.startsWith(prefix)) {
|
||||
packedLine = packedLine.substring(prefix.length());
|
||||
boolean bracketOpen = false;
|
||||
int pragmaMax = 0;
|
||||
String distr = "";
|
||||
for (int i = packedLine.indexOf('['); i < packedLine.length(); ++i) {
|
||||
char c = packedLine.charAt(i);
|
||||
if (bracketOpen) {
|
||||
if (c == ']') {
|
||||
bracketOpen = false;
|
||||
if (distr.equals("block"))
|
||||
pragmaMax++;
|
||||
distr = "";
|
||||
} else {
|
||||
distr += c;
|
||||
}
|
||||
} else {
|
||||
if (c == '[') {
|
||||
bracketOpen = true;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
fileMax = Math.max(fileMax, pragmaMax);
|
||||
}
|
||||
++n;
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return fileMax;
|
||||
}
|
||||
public static int getProjectMinMaxDim_C(db_project_info project) {
|
||||
int res = 0;
|
||||
for (DBProjectFile file : project.db.files.Data.values()) {
|
||||
if (file.isActiveProgram())
|
||||
res = Math.max(res, Sapfor.getFileMaxDim_C(file.file));
|
||||
}
|
||||
return res;
|
||||
}
|
||||
public static Pair<Integer, Integer> getProjectFolderMinMaxDim_F(File sapfor_drv, File projectPath) {
|
||||
String flags = "-noLogo";
|
||||
Pair<Integer, Integer> res = new Pair<>(0, 0);
|
||||
try {
|
||||
if (Sapfor.parse(sapfor_drv, projectPath, flags)
|
||||
) {
|
||||
Vector<String> outputLines = new Vector<>();
|
||||
if (Sapfor.analysis(sapfor_drv, projectPath, PassCode.SPF_GetMaxMinBlockDistribution, flags, outputLines)) {
|
||||
//---
|
||||
for (String line : outputLines) {
|
||||
String prefix = "GET_MIN_MAX_BLOCK_DIST: ";
|
||||
if (line.startsWith(prefix)) {
|
||||
String s = line.substring(prefix.length());
|
||||
String[] data = s.split(" ");
|
||||
res = new Pair<>(Math.max(Integer.parseInt(data[0]), 0), Math.max(Integer.parseInt(data[1]), 0));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
} finally {
|
||||
try {
|
||||
Utils.deleteFilesByExtensions(projectPath,
|
||||
"proj", "dep", "jar"
|
||||
);
|
||||
File visualiser_data = new File(projectPath, Constants.data);
|
||||
if (visualiser_data.exists())
|
||||
FileUtils.forceDelete(visualiser_data);
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
public static void getTestMinMaxDim_F(File sapfor_drv, Test test) {
|
||||
Pair<Integer, Integer> res = getProjectFolderMinMaxDim_F(sapfor_drv, test.getServerPath());
|
||||
test.min_dim = res.getKey();
|
||||
test.max_dim = res.getValue();
|
||||
}
|
||||
public static void getTestMinMaxDime_C(Test test) {
|
||||
int min_dim = 0;
|
||||
int max_dim = 0;
|
||||
for (File file : test.getServerFiles()) {
|
||||
max_dim = Math.max(max_dim, getFileMaxDim_C(file));
|
||||
}
|
||||
test.min_dim = min_dim;
|
||||
test.max_dim = max_dim;
|
||||
}
|
||||
public void refreshPid() {
|
||||
try {
|
||||
// UI.Info("Calling SPF_GetCurrentPID...");
|
||||
@@ -342,7 +418,9 @@ public abstract class Sapfor extends OSDComponent {
|
||||
public void GetVersionInfo() {
|
||||
try {
|
||||
RunAnalysis("SPF_GetVersionAndBuildDate", -1, "", "");
|
||||
Visualizer_2.UnpackVersionInfo(this, getResult());
|
||||
VersionInfo_json versionInfo_json = Utils_.gson.fromJson(getResult(),VersionInfo_json.class);
|
||||
version = versionInfo_json.version;
|
||||
date_text = versionInfo_json.build_date+" "+ versionInfo_json.build_time;
|
||||
} catch (Exception e) {
|
||||
Utils_.MainLog.PrintException(e);
|
||||
UI.Error("Не удалось получить версию компонента " + Utils_.DQuotes(getComponentType().getDescription()));
|
||||
@@ -424,6 +502,21 @@ public abstract class Sapfor extends OSDComponent {
|
||||
this.predictorStats = predictorStats;
|
||||
}
|
||||
public void decodeString(String runResult) throws Exception {
|
||||
SapforResult_json resultJson = Utils_.gson.fromJson(runResult, SapforResult_json.class);
|
||||
//---
|
||||
setErrorCode(resultJson.errorCode);
|
||||
setOutput(resultJson.output);
|
||||
setResult(resultJson.result);
|
||||
setOutputMessage(resultJson.outputMessage);
|
||||
setPredictorStats(resultJson.predictorStats);
|
||||
//--
|
||||
if (resultJson.files!=null && !resultJson.files.isEmpty()){
|
||||
for (ModifiedFile_json file: resultJson.files){
|
||||
ModifiedFiles.put(Utils_.toW(file.name), file.text);
|
||||
}
|
||||
}
|
||||
//--
|
||||
/*
|
||||
int codeIdx = runResult.indexOf(' ');
|
||||
if (codeIdx == -1) throw new PassException("Wrong input parameter");
|
||||
setErrorCode(Integer.parseInt(runResult.substring(0, codeIdx)));
|
||||
@@ -467,13 +560,12 @@ public abstract class Sapfor extends OSDComponent {
|
||||
}
|
||||
codeIdx += count;
|
||||
}
|
||||
*/
|
||||
}
|
||||
//-
|
||||
public void Command(String request_in) throws Exception {
|
||||
setErrorCode(empty_code);
|
||||
outputMessage = output = result = predictorStats = "";
|
||||
size = 0;
|
||||
sizes = null;
|
||||
ModifiedFiles.clear();
|
||||
//модификации.-------------------------------------------------------------->>>>
|
||||
decodeString(Global.visualizer_2.Command(request_in).replace((char) 1, '\n'));
|
||||
@@ -567,26 +659,5 @@ public abstract class Sapfor extends OSDComponent {
|
||||
if ((UI.isActive()) && (Global.mainModule.getUI().hasMainWindow()) && (Global.mainModule.getUI().getVersionsWindow() != null))
|
||||
Global.mainModule.getUI().getVersionsWindow().BlockVariants();
|
||||
}
|
||||
//--------------------------------------------------------------------------->>
|
||||
//временный (?) проход, по тихому получить размерность теста, предварительно выполнив тихий парс.
|
||||
//тут все одноразовое. считаем что таблицы бд уже заполнены как надо.
|
||||
/*
|
||||
public LanguageStyle getStyle() throws Exception {
|
||||
return (Global.mainModule.getDb()).settings.get(SettingName.FREE_FORM).toBoolean() ? LanguageStyle.free : LanguageStyle.fixed;
|
||||
}
|
||||
*/
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
/*
|
||||
public String getConsoleFlags() throws Exception {
|
||||
Vector<String> res = new Vector<>();
|
||||
if ((Global.mainModule.getDb()).settings.get(SettingName.FREE_FORM).toBoolean())
|
||||
res.add("-f90");
|
||||
if ((Global.mainModule.getDb()).settings.get(SettingName.STATIC_SHADOW_ANALYSIS).toBoolean())
|
||||
res.add("-sh");
|
||||
res.add("-shwidth " + (Global.mainModule.getDb()).settings.get(SettingName.MAX_SHADOW_WIDTH));
|
||||
if ((Global.mainModule.getDb()).settings.get(SettingName.KEEP_SPF_DIRECTIVES).toBoolean())
|
||||
res.add("-keepSPF");
|
||||
return String.join(" ", res);
|
||||
}
|
||||
*/
|
||||
//--
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
package _VisualDVM.Repository.Component.Sapfor;
|
||||
package _VisualDVM.ComponentsServer.Component.Sapfor;
|
||||
import _VisualDVM.ComponentsServer.Component.ComponentType;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Repository.Component.ComponentType;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Paths;
|
||||
@@ -11,7 +11,7 @@ public class Sapfor_F extends Sapfor {
|
||||
}
|
||||
@Override
|
||||
public String getAssemblyCommand() {
|
||||
return "cd Repo/sapfor/experts/Sapfor_2017/_bin\n" +
|
||||
return "cd Repo/SAPFOR/install\n" +
|
||||
"cmake ../\n" +
|
||||
"make -j 4\n";
|
||||
}
|
||||
@@ -19,7 +19,7 @@ public class Sapfor_F extends Sapfor {
|
||||
public File getAssemblyFile() {
|
||||
return Paths.get(
|
||||
Global.RepoDirectory.getAbsolutePath(),
|
||||
"sapfor/experts/Sapfor_2017/_bin/Sapfor_F").toFile();
|
||||
"SAPFOR/install/Sapfor_F").toFile();
|
||||
}
|
||||
@Override
|
||||
public String getUpdateCommand() {
|
||||
@@ -1,4 +1,4 @@
|
||||
package _VisualDVM.Repository.Component.Sapfor;
|
||||
package _VisualDVM.ComponentsServer.Component.Sapfor;
|
||||
public enum TransformationPermission {
|
||||
None,
|
||||
All,
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="_VisualDVM.Repository.Component.UI.ComponentsFields">
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="_VisualDVM.ComponentsServer.Component.UI.ComponentsFields">
|
||||
<grid id="27dc6" binding="content" layout-manager="BorderLayout" hgap="0" vgap="0">
|
||||
<constraints>
|
||||
<xy x="20" y="20" width="802" height="400"/>
|
||||
@@ -1,4 +1,4 @@
|
||||
package _VisualDVM.Repository.Component.UI;
|
||||
package _VisualDVM.ComponentsServer.Component.UI;
|
||||
import Common.Visual.Windows.Dialog.DialogFields;
|
||||
import _VisualDVM.Global;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package _VisualDVM.Repository.Component.UI;
|
||||
package _VisualDVM.ComponentsServer.Component.UI;
|
||||
import Common.Database.Tables.DataSet;
|
||||
import Common.MainModule_;
|
||||
import Common.Visual.DataSetControlForm;
|
||||
@@ -8,9 +8,9 @@ import Common.Visual.Menus.VisualiserMenu;
|
||||
import Common.Visual.Tables.ColumnInfo;
|
||||
import Common.Visual.Tables.RendererMaskedNanInteger;
|
||||
import Common.Visual.Tables.RendererStatusEnum;
|
||||
import _VisualDVM.ComponentsServer.Component.Component;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
import _VisualDVM.Repository.Component.Component;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.Vector;
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="_VisualDVM.Repository.Component.UI.PickUpComponentFields">
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="_VisualDVM.ComponentsServer.Component.UI.PickUpComponentFields">
|
||||
<grid id="27dc6" binding="content" layout-manager="BorderLayout" hgap="0" vgap="0">
|
||||
<constraints>
|
||||
<xy x="20" y="20" width="500" height="400"/>
|
||||
@@ -1,4 +1,4 @@
|
||||
package _VisualDVM.Repository.Component.UI;
|
||||
package _VisualDVM.ComponentsServer.Component.UI;
|
||||
import Common.Visual.Windows.Dialog.DialogFields;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="_VisualDVM.Repository.Component.UI.PublishFields">
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="_VisualDVM.ComponentsServer.Component.UI.PublishFields">
|
||||
<grid id="27dc6" binding="content" layout-manager="GridLayoutManager" row-count="8" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
@@ -1,6 +1,6 @@
|
||||
package _VisualDVM.Repository.Component.UI;
|
||||
package _VisualDVM.ComponentsServer.Component.UI;
|
||||
import Common.Visual.Editor.BaseEditor;
|
||||
import Common.Visual.Windows.Dialog.DialogFields;
|
||||
import _VisualDVM.Visual.Editor.BaseEditor;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@@ -1,4 +1,4 @@
|
||||
package _VisualDVM.Repository.Component.UI;
|
||||
package _VisualDVM.ComponentsServer.Component.UI;
|
||||
import Common.Visual.Windows.Dialog.Dialog;
|
||||
public class PublishForm extends Dialog<String, PublishFields> {
|
||||
public PublishForm() {
|
||||
@@ -1,4 +1,4 @@
|
||||
package _VisualDVM.Repository.Component;
|
||||
package _VisualDVM.ComponentsServer.Component;
|
||||
import Common.Utils.Utils_;
|
||||
import _VisualDVM.Constants;
|
||||
import _VisualDVM.Global;
|
||||
@@ -62,7 +62,7 @@ public class Visualiser extends Component {
|
||||
//http://www.seostella.com/ru/article/2012/02/05/formatirovanie-daty-v-java.html
|
||||
@Override
|
||||
public void GetVersionInfo() {
|
||||
version = 1144;
|
||||
version = Constants.version;
|
||||
String pattern = "MMM dd yyyy HH:mm:ss";
|
||||
DateFormat df = new SimpleDateFormat(pattern, Locale.ENGLISH);
|
||||
date_text = df.format(getClassBuildTime());
|
||||
@@ -1,4 +1,4 @@
|
||||
package _VisualDVM.Repository.Component;
|
||||
package _VisualDVM.ComponentsServer.Component;
|
||||
import Common.Passes.PassException;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.UI;
|
||||
@@ -12,6 +12,7 @@ import java.io.PrintWriter;
|
||||
import java.net.InetAddress;
|
||||
import java.net.Socket;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Date;
|
||||
public class Visualizer_2 extends OSDComponent {
|
||||
public String PID = "";
|
||||
//</editor-fold>
|
||||
@@ -27,11 +28,15 @@ public class Visualizer_2 extends OSDComponent {
|
||||
port = port_in;
|
||||
}
|
||||
public static void UnpackVersionInfo(Component component, String packed) {
|
||||
|
||||
String[] data = packed.split("\\|");
|
||||
//лишний пробел.
|
||||
String text = data[0].substring(0, data[0].length() - 1);
|
||||
component.date_text = data[1] + data[2] + data[3];
|
||||
component.version = Long.parseLong(text);
|
||||
|
||||
// component.version = 6666;
|
||||
// component.date_text = new Date().toString();
|
||||
}
|
||||
//<editor-fold desc="компонент">
|
||||
@Override
|
||||
@@ -73,14 +78,16 @@ public class Visualizer_2 extends OSDComponent {
|
||||
}
|
||||
@Override
|
||||
public String getAssemblyCommand() {
|
||||
return "cd Repo/sapfor/experts/Sapfor_2017/_src/Server\n" +
|
||||
File src_home = Paths.get(Global.RepoDirectory.getAbsolutePath(), "SAPFOR/src/Server").toFile();
|
||||
return "cd " + Utils_.DQuotes(src_home) +
|
||||
"\n" +
|
||||
"g++ -O3 -std=c++17 checkUniq.cpp server.cpp -o Visualizer_2 -lpthread -lstdc++fs\n";
|
||||
}
|
||||
@Override
|
||||
public File getAssemblyFile() {
|
||||
return Paths.get(
|
||||
Global.RepoDirectory.getAbsolutePath(),
|
||||
"sapfor/experts/Sapfor_2017/_src/Server/Visualizer_2").toFile();
|
||||
"SAPFOR/src/Server/Visualizer_2").toFile();
|
||||
}
|
||||
public void Connect() throws Exception {
|
||||
ClearLog();
|
||||
381
src/_VisualDVM/ComponentsServer/ComponentsServer.java
Normal file
381
src/_VisualDVM/ComponentsServer/ComponentsServer.java
Normal file
@@ -0,0 +1,381 @@
|
||||
package _VisualDVM.ComponentsServer;
|
||||
import Common.Database.Database;
|
||||
import Common.Database.Objects.DBObject;
|
||||
import Common.Database.RepositoryRefuseException;
|
||||
import Common.Utils.Pair;
|
||||
import Common.Utils.Utils_;
|
||||
import _VisualDVM.ComponentsServer.BugReport.BugReport;
|
||||
import _VisualDVM.ComponentsServer.BugReport.Json.BugReportAdditionJson;
|
||||
import _VisualDVM.ComponentsServer.BugReportRecipient.BugReportRecipient;
|
||||
import _VisualDVM.ComponentsServer.BugReportSetting.BugReportSetting;
|
||||
import _VisualDVM.ComponentsServer.Component.ComponentType;
|
||||
import _VisualDVM.ComponentsServer.Component.Json.ComponentPublicationInfoJson;
|
||||
import _VisualDVM.ComponentsServer.Component.Json.ComponentVersionsInfoJson;
|
||||
import _VisualDVM.ComponentsServer.UserAccount.AccountRole;
|
||||
import _VisualDVM.ComponentsServer.UserAccount.UserAccount;
|
||||
import _VisualDVM.Constants;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.GlobalData.RemoteFile.RemoteFile;
|
||||
import _VisualDVM.Passes.All.ZipFolderPass;
|
||||
import _VisualDVM.ProjectData.LanguageName;
|
||||
import _VisualDVM.Repository.EmailMessage;
|
||||
import _VisualDVM.Repository.Server.RepositoryServer;
|
||||
import _VisualDVM.Utils;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.lang.reflect.Field;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.Vector;
|
||||
public class ComponentsServer extends RepositoryServer<BugReportsDatabase> {
|
||||
public CredentialsDatabase credentials_db = null;
|
||||
public ComponentsServer() {
|
||||
super(BugReportsDatabase.class);
|
||||
}
|
||||
@Override
|
||||
public String getServerHomeName() {
|
||||
return "_sapfor_x64";
|
||||
}
|
||||
@Override
|
||||
public int getPort() {
|
||||
return Constants.ComponentsServerPort;
|
||||
}
|
||||
@Override
|
||||
protected void extraBackup(File todayBackUp) {
|
||||
zip.Do("Bugs", new File(todayBackUp, "Bugs.zip").getAbsolutePath());
|
||||
}
|
||||
@Override
|
||||
public Database getDb() {
|
||||
if (request.arg.equals("credentials"))
|
||||
return credentials_db;
|
||||
return super.getDb();
|
||||
}
|
||||
@Override
|
||||
protected void beforePublishAction(DBObject object) throws Exception {
|
||||
if (object instanceof BugReport) {
|
||||
BugReport bugReport = (BugReport) object;
|
||||
if (bugReport.packed_archive != null) {
|
||||
File bugArchive = Utils_.getFile(Utils_.getHomePath(), "Bugs", bugReport.id);
|
||||
Utils_.bytesToFile(bugReport.packed_archive, bugArchive);
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected void afterPublishAction(DBObject object) throws Exception {
|
||||
if (object instanceof BugReport) {
|
||||
BugReport bugReport = (BugReport) object;
|
||||
if (bugReport.settings != null) {
|
||||
for (BugReportSetting setting : bugReport.settings) {
|
||||
setting.bugreport_id = bugReport.id;
|
||||
db.Insert(setting);
|
||||
}
|
||||
}
|
||||
if (bugReport.recipients != null) {
|
||||
db.saveBugreportRecipients(bugReport);
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected void afterEditAction(DBObject object) throws Exception {
|
||||
if (object instanceof BugReport) {
|
||||
BugReport bugReport = (BugReport) object;
|
||||
if (bugReport.recipients != null) {
|
||||
db.bugReportRecipients.ActualizeData(
|
||||
db.getVectorByFK(bugReport, BugReportRecipient.class),
|
||||
bugReport.recipients);
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected void afterDeleteAction(DBObject object) throws Exception {
|
||||
if (object instanceof BugReport) {
|
||||
BugReport bugReport = (BugReport) object;
|
||||
if (!bugReport.project_version.isEmpty()) Utils_.forceDeleteWithCheck(bugReport.getArchiveFile());
|
||||
} else if (object instanceof UserAccount) {
|
||||
UserAccount account = (UserAccount) object;
|
||||
Utils_.forceDeleteWithCheck(account.getServerKeyFile());
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void ActivateDB() {
|
||||
super.ActivateDB();
|
||||
try {
|
||||
credentials_db = new CredentialsDatabase();
|
||||
credentials_db.Activate();
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
//-
|
||||
void DVMConvertProject() throws Exception {
|
||||
String[] args = request.arg.split("\n");
|
||||
//-
|
||||
String projectName = args[0];
|
||||
LanguageName projectLanguage = LanguageName.valueOf(args[1]);
|
||||
String options = args[2];
|
||||
Vector<String> filesNames = new Vector<>(Arrays.asList(args).subList(3, args.length));
|
||||
//-
|
||||
File workspace = Utils.getTempFileName("convertation");
|
||||
FileUtils.forceMkdir(workspace);
|
||||
File archive = new File(workspace, projectName + ".zip");
|
||||
request.Unpack(archive);
|
||||
File project = new File(workspace, projectName);
|
||||
Vector<String> badFiles = new Vector<>();
|
||||
if (unzip.Do(archive.getAbsolutePath(), workspace.getAbsolutePath()) && project.exists()) {
|
||||
String output = "";
|
||||
for (String fileName : filesNames) {
|
||||
File program = Paths.get(project.getAbsolutePath(), fileName).toFile();
|
||||
//--
|
||||
File convertedProgram = Paths.get(program.getParent(), Utils_.getFileNameWithoutExtension(program) + ".DVMH." + (projectLanguage.equals(LanguageName.fortran) ? "f" : "c")).toFile();
|
||||
String command = Utils_.DQuotes(Global.componentsServerProperties.default_dvm_drv) + " " + projectLanguage.getDVMCompile() + "dv " + options + " " + Utils_.DQuotes(program.getName());
|
||||
//--
|
||||
File fileWorkspace = program.getParentFile();
|
||||
Process process = Utils.startScript(workspace, fileWorkspace, Utils_.getDateName("convert_script"), command);
|
||||
process.waitFor();
|
||||
String convertationOut = Utils.readAllOutput(process);
|
||||
convertationOut = convertationOut.replace(program.getName(), fileName); //для учета пути.
|
||||
if (!convertationOut.isEmpty()) output += convertationOut + "\n";
|
||||
try {
|
||||
if (convertedProgram.exists()) {
|
||||
FileUtils.forceDelete(program);
|
||||
convertedProgram.renameTo(program);
|
||||
} else badFiles.add(program.getName());
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
//--
|
||||
}
|
||||
response.arg = String.join("\n", badFiles) + "|" + output;
|
||||
File resultArchive = new File(workspace, projectName + "_result.zip");
|
||||
if (ComponentsServer.zip.Do(project.getAbsolutePath(), resultArchive.getAbsolutePath())) {
|
||||
response.object = Utils_.fileToBytes(resultArchive);
|
||||
} else throw new RepositoryRefuseException("Внутренняя ошибка. Не удалось запаковать версию");
|
||||
//--
|
||||
} else throw new RepositoryRefuseException("Внутренняя ошибка. Не удалось распаковать проект");
|
||||
}
|
||||
void AppendBugReportField() throws Exception {
|
||||
BugReportAdditionJson transport = (BugReportAdditionJson) request.object;
|
||||
checkExistense(transport.id, BugReport.class);
|
||||
BugReport actual = db.bugReports.get(transport.id);
|
||||
Field field = BugReport.class.getField(transport.fieldName);
|
||||
field.set(actual, field.get(actual) + "\n" + transport.textAddition);
|
||||
actual.change_date = new Date().getTime();
|
||||
db.Update(actual);
|
||||
response.object = actual;
|
||||
}
|
||||
void ReceiveAllArchives() throws Exception {
|
||||
ZipFolderPass zip = new ZipFolderPass();
|
||||
File archives = new File(Utils_.getDateName("Bugs"));
|
||||
if (zip.Do("Bugs", archives.getAbsolutePath())) {
|
||||
response.object = Utils_.fileToBytes(archives);
|
||||
} else throw new RepositoryRefuseException("Не удалось запаковать архивы");
|
||||
}
|
||||
void ReceiveBugReportsDatabase() throws Exception {
|
||||
response.object = Utils_.fileToBytes(db.getFile());
|
||||
response.arg = credentials_db.userAccounts.getPackedActiveRecipients();
|
||||
}
|
||||
void ReceiveBugReport() throws Exception {
|
||||
File bugArchive = Utils_.getFile(Utils_.getHomePath(), "Bugs", request.arg);
|
||||
response.object = Utils_.fileToBytes(bugArchive);
|
||||
}
|
||||
void UpdateBugReport() throws Exception {
|
||||
BugReport oldBugReport = (BugReport) request.object;
|
||||
checkExistense(oldBugReport.id, BugReport.class);
|
||||
BugReport bugReport = db.bugReports.get(oldBugReport.id);
|
||||
bugReport.SynchronizeFields(oldBugReport);
|
||||
bugReport.change_date = new Date().getTime();
|
||||
db.Update(bugReport);
|
||||
}
|
||||
//--
|
||||
void GetComponentsBackUps() throws Exception {
|
||||
File backupsDirectory = Paths.get(Utils_.getHomePath(), "Components", request.arg, "Backups").toFile();
|
||||
//--
|
||||
if (backupsDirectory.exists()) {
|
||||
File[] files = backupsDirectory.listFiles(File::isFile);
|
||||
if (files != null) {
|
||||
Vector<RemoteFile> res = new Vector<>();
|
||||
for (File file : files)
|
||||
res.add(new RemoteFile(file.getAbsolutePath(), false)); //тут всегда линух.
|
||||
response.object = res;
|
||||
} else throw new RepositoryRefuseException("Не удалось получить список предыдущих версий");
|
||||
} else {
|
||||
//баги еще не создавались. штатная ситуация.
|
||||
response.object = new Vector<>();
|
||||
}
|
||||
}
|
||||
void CheckURLRegistered() throws Exception {
|
||||
String[] data = request.arg.split("\n");
|
||||
String email = data[0];
|
||||
String machineURL = data[1];
|
||||
String login = data[2];
|
||||
response.object = credentials_db.workspaces.findWorkspace(email, machineURL, login);
|
||||
}
|
||||
void GetComponentChangesLog() throws Exception {
|
||||
response.object = Utils_.fileToBytes(Paths.get(Utils_.getHomePath(), "Components", request.arg, "changes.txt").toFile());
|
||||
}
|
||||
void PublishComponent() throws Exception {
|
||||
ComponentPublicationInfoJson info = (ComponentPublicationInfoJson) request.object;
|
||||
File componentHome = Utils_.getFile(Utils_.getHomePath(), "Components", info.componentType.toString());
|
||||
File componentFile = new File(componentHome, info.fileName);
|
||||
File versionFile = new File(componentHome, "version.txt");
|
||||
File backupsFolder = new File(componentHome, "Backups");
|
||||
//0 архивация старой версии, если она есть.
|
||||
if (componentFile.exists()) {
|
||||
String versionText = "";
|
||||
if (versionFile.exists()) versionText = Utils.ReadAllText(versionFile);
|
||||
//---->>
|
||||
Utils_.CheckDirectory(backupsFolder);
|
||||
Utils.keepNewFiles(backupsFolder, Global.componentsServerProperties.ComponentsBackUpsCount);
|
||||
//-->>
|
||||
File backupFile = new File(backupsFolder, info.componentType + "_" + versionText);
|
||||
if (backupFile.exists()) Utils_.forceDeleteWithCheck(backupFile);
|
||||
FileUtils.moveFile(componentFile, backupFile);
|
||||
}
|
||||
//1 распаковка компонента
|
||||
Utils_.bytesToFile((byte[]) info.packedFile, componentFile);
|
||||
//2 запись версии компонента
|
||||
FileUtils.writeStringToFile(versionFile, info.versionText);
|
||||
//3 запись в журнал компонента
|
||||
File changesLog = new File(componentHome, "changes.txt");
|
||||
FileWriter writer = new FileWriter(changesLog.getAbsolutePath(), true);
|
||||
BufferedWriter bufferWriter = new BufferedWriter(writer);
|
||||
bufferWriter.write(info.changeRecord);
|
||||
bufferWriter.close();
|
||||
//-
|
||||
if (info.needsUpdateMinimalVersion) {
|
||||
Print("Поднять минимальную версию компонента " + info.componentType);
|
||||
File minimal_versionFile = new File(componentHome, "minimal_version.txt");
|
||||
FileUtils.writeStringToFile(minimal_versionFile, info.versionText);
|
||||
//-
|
||||
//3 запись в журнал компонента
|
||||
FileWriter writer_ = new FileWriter(changesLog, true);
|
||||
BufferedWriter bufferWriter_ = new BufferedWriter(writer_);
|
||||
bufferWriter_.write("Минимальная версия поднята до " + info.versionText + "\n");
|
||||
bufferWriter_.close();
|
||||
}
|
||||
//-рассылка об изменениях.
|
||||
if (info.needsEmail) {
|
||||
String version_mail_header = String.join(" ",
|
||||
"Опубликована версия",
|
||||
Utils_.DQuotes(info.versionNumber),
|
||||
"компонента",
|
||||
Utils_.DQuotes(info.componentType.getDescription()));
|
||||
//-
|
||||
EmailMessage message =
|
||||
new EmailMessage(version_mail_header,
|
||||
info.changeRecord
|
||||
);
|
||||
if (info.needsSendFile)
|
||||
message.addAttachement(componentFile);
|
||||
//--
|
||||
for (String address : credentials_db.userAccounts.getActiveMails()) {
|
||||
EmailMessagesQueue.add(new Pair<>(address, message));
|
||||
}
|
||||
}
|
||||
}
|
||||
void GetComponentsVersionsInfo() throws Exception {
|
||||
Vector<String> types = (Vector<String>) request.object;
|
||||
Vector<ComponentVersionsInfoJson> res = new Vector<>();
|
||||
for (String sType : types) {
|
||||
ComponentType componentType = ComponentType.valueOf(sType);
|
||||
File actualVersionFile = Paths.get(Utils_.getHomePath(), "Components", sType, "version.txt").toFile();
|
||||
File minimalVersionFile = Paths.get(Utils_.getHomePath(), "Components", sType, "minimal_version.txt").toFile();
|
||||
ComponentVersionsInfoJson info = new ComponentVersionsInfoJson(componentType);
|
||||
info.actual_version = Utils_.removeCharacters(Utils.ReadAllText(actualVersionFile), "\n", "\r");
|
||||
info.minimal_version = Utils_.removeCharacters(Utils.ReadAllText(minimalVersionFile), "\n", "\r");
|
||||
res.add(info);
|
||||
}
|
||||
response.object = res;
|
||||
}
|
||||
void ReceiveComponent() throws Exception {
|
||||
String[] packed1 = request.arg.split("\n");
|
||||
//тип/имя файла
|
||||
File componentFile1 = Paths.get(Utils_.getHomePath(), "Components", packed1[0], packed1[1]).toFile();
|
||||
Print("Получить компонент " + packed1[0]);
|
||||
response.object = Utils_.fileToBytes(componentFile1);
|
||||
}
|
||||
void GetUserAccountByKey() throws Exception {
|
||||
UserAccount account = credentials_db.userAccounts.getByKey(request.arg);
|
||||
response.object = account == null ? null : account;
|
||||
}
|
||||
void GetUserAccountByEmail() throws Exception {
|
||||
UserAccount account_info = (UserAccount) request.object;
|
||||
UserAccount account = credentials_db.userAccounts.getByEmail(account_info.email);
|
||||
if (account == null) {
|
||||
account = new UserAccount(account_info);
|
||||
account.role = Constants.admins_mails.contains(account.email) ? AccountRole.Admin : AccountRole.User;
|
||||
credentials_db.Insert(account);
|
||||
account.generateKey();
|
||||
}
|
||||
response.object = account;
|
||||
response.arg = FileUtils.readFileToString(account.getServerKeyFile());
|
||||
}
|
||||
void ReceiveCredentialsDatabase() throws Exception {
|
||||
response.object = Utils_.fileToBytes(credentials_db.getFile());
|
||||
}
|
||||
//--
|
||||
@Override
|
||||
protected void UnsafeSession() throws Exception {
|
||||
switch (code) {
|
||||
case GetUserAccountByKey:
|
||||
GetUserAccountByKey();
|
||||
break;
|
||||
case GetUserAccountByEmail:
|
||||
GetUserAccountByEmail();
|
||||
break;
|
||||
case GetComponentsBackups:
|
||||
GetComponentsBackUps();
|
||||
break;
|
||||
case UpdateComponent:
|
||||
//zip
|
||||
PublishComponent();
|
||||
break;
|
||||
case ReceiveComponent:
|
||||
ReceiveComponent();
|
||||
break;
|
||||
case GetComponentsVersionsInfo:
|
||||
GetComponentsVersionsInfo();
|
||||
break;
|
||||
case GetComponentChangesLog:
|
||||
GetComponentChangesLog();
|
||||
break;
|
||||
default:
|
||||
throw new RepositoryRefuseException("Неподдерживаемый код: " + code);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected void Session() throws Exception {
|
||||
switch (code) {
|
||||
case ReceiveCredentialsDatabase:
|
||||
ReceiveCredentialsDatabase();
|
||||
break;
|
||||
case ReceiveAllArchives:
|
||||
ReceiveAllArchives();
|
||||
break;
|
||||
case UpdateBugReport:
|
||||
UpdateBugReport();
|
||||
break;
|
||||
case AppendBugReportTextField:
|
||||
AppendBugReportField();
|
||||
break;
|
||||
case ReceiveBugReportsDatabase:
|
||||
ReceiveBugReportsDatabase();
|
||||
break;
|
||||
case ReceiveBugReport:
|
||||
ReceiveBugReport();
|
||||
break;
|
||||
case DVMConvertProject:
|
||||
DVMConvertProject();
|
||||
break;
|
||||
case CheckURLRegistered:
|
||||
CheckURLRegistered();
|
||||
break;
|
||||
default:
|
||||
throw new RepositoryRefuseException("Неподдерживаемый код: " + code);
|
||||
}
|
||||
}
|
||||
}
|
||||
35
src/_VisualDVM/ComponentsServer/CredentialsDatabase.java
Normal file
35
src/_VisualDVM/ComponentsServer/CredentialsDatabase.java
Normal file
@@ -0,0 +1,35 @@
|
||||
package _VisualDVM.ComponentsServer;
|
||||
import Common.Database.SQLITE.SQLiteDatabase;
|
||||
import Common.Passes.PassCode_;
|
||||
import _VisualDVM.ComponentsServer.SubscriberWorkspace.SubscriberWorkspaceDBTable;
|
||||
import _VisualDVM.ComponentsServer.UserAccount.UserAccountsDBTable;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
|
||||
import java.nio.file.Paths;
|
||||
public class CredentialsDatabase extends SQLiteDatabase {
|
||||
public UserAccountsDBTable userAccounts;
|
||||
public SubscriberWorkspaceDBTable workspaces;
|
||||
public CredentialsDatabase() {
|
||||
super(Paths.get(System.getProperty("user.dir"), "Data", "credentials.sqlite").toFile());
|
||||
}
|
||||
@Override
|
||||
protected void initAllTables() throws Exception {
|
||||
addTable(userAccounts = new UserAccountsDBTable());
|
||||
addTable(workspaces = new SubscriberWorkspaceDBTable());
|
||||
}
|
||||
@Override
|
||||
public PassCode_ getSynchronizePassCode() {
|
||||
return PassCode.SynchronizeCredentials;
|
||||
}
|
||||
@Override
|
||||
public void DropUI() {
|
||||
super.DropUI();
|
||||
userAccounts.ClearUI();
|
||||
workspaces.ClearUI();
|
||||
}
|
||||
@Override
|
||||
public void ResetUI() {
|
||||
userAccounts.ShowUI();
|
||||
super.ResetUI();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package _VisualDVM.ComponentsServer.Recipient.Json;
|
||||
import com.google.gson.annotations.Expose;
|
||||
public class UserAccountJson {
|
||||
@Expose
|
||||
public String email;
|
||||
@Expose
|
||||
public String name;
|
||||
public UserAccountJson(String email_in, String name_in) {
|
||||
email = email_in;
|
||||
name = name_in;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package _VisualDVM.ComponentsServer.Recipient.Json;
|
||||
import com.google.gson.annotations.Expose;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
public class UserAccountsJson {
|
||||
@Expose
|
||||
public List<UserAccountJson> values = new Vector<>();
|
||||
}
|
||||
24
src/_VisualDVM/ComponentsServer/Recipient/Recipient.java
Normal file
24
src/_VisualDVM/ComponentsServer/Recipient/Recipient.java
Normal file
@@ -0,0 +1,24 @@
|
||||
package _VisualDVM.ComponentsServer.Recipient;
|
||||
import Common.Database.Objects.DBObject;
|
||||
import _VisualDVM.ComponentsServer.Recipient.Json.UserAccountJson;
|
||||
public class Recipient extends DBObject {
|
||||
public String email = "";
|
||||
public String name = "";
|
||||
public Recipient() {
|
||||
}
|
||||
public Recipient(UserAccountJson json) {
|
||||
email = json.email;
|
||||
name = json.name;
|
||||
}
|
||||
@Override
|
||||
public Object getPK() {
|
||||
return email;
|
||||
}
|
||||
@Override
|
||||
public void SynchronizeFields(DBObject src) {
|
||||
super.SynchronizeFields(src);
|
||||
Recipient src_ = (Recipient) src;
|
||||
email = src_.email;
|
||||
name = src_.name;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package _VisualDVM.ComponentsServer.Recipient;
|
||||
import Common.Database.Tables.DataSet;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.DataSetControlForm;
|
||||
import _VisualDVM.ComponentsServer.Recipient.Json.UserAccountJson;
|
||||
import _VisualDVM.ComponentsServer.Recipient.Json.UserAccountsJson;
|
||||
import _VisualDVM.ComponentsServer.Recipient.UI.RecipientsForm;
|
||||
import _VisualDVM.Constants;
|
||||
import _VisualDVM.Global;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.Vector;
|
||||
public class RecipientsDataSet extends DataSet<String, Recipient> {
|
||||
public RecipientsDataSet() {
|
||||
super(String.class, Recipient.class);
|
||||
}
|
||||
public void Unpack(String packed) {
|
||||
clear();
|
||||
UserAccountsJson jsons = Utils_.gson.fromJson(packed, UserAccountsJson.class);
|
||||
for (UserAccountJson userAccountJson : jsons.values) {
|
||||
Global.componentsServer.db.recipients.put(userAccountJson.email, new Recipient(userAccountJson));
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected DataSetControlForm createUI(JPanel mountPanel) {
|
||||
return new RecipientsForm(this, mountPanel);
|
||||
}
|
||||
@Override
|
||||
public String getPluralDescription() {
|
||||
return "адресаты";
|
||||
}
|
||||
@Override
|
||||
public String getSingleDescription() {
|
||||
return "адресат";
|
||||
}
|
||||
public Vector<String> getSelectedMails() {
|
||||
//баг текущий. значит адресаты уже активные и правильные. дополняем их админами и автором.
|
||||
Vector<String> res = new Vector<>();
|
||||
for (Recipient recipient : Data.values()) {
|
||||
if (recipient.isSelected() && !res.contains(recipient.email))
|
||||
res.add(recipient.email);
|
||||
}
|
||||
//--
|
||||
if (!res.contains(Global.mainModule.getAccount().email))
|
||||
res.add(Global.mainModule.getAccount().email);
|
||||
//--
|
||||
for (String admin_mail : Constants.admins_mails) {
|
||||
if (!res.contains(admin_mail))
|
||||
res.add(admin_mail);
|
||||
}
|
||||
//--
|
||||
return res;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package _VisualDVM.ComponentsServer.Recipient.UI;
|
||||
import Common.Database.Tables.DataSet;
|
||||
import Common.Visual.DataSetControlForm;
|
||||
import Common.Visual.Menus.DataMenuBar;
|
||||
import Common.Visual.Tables.ColumnInfo;
|
||||
import _VisualDVM.ComponentsServer.Recipient.Recipient;
|
||||
import _VisualDVM.ComponentsServer.UserAccount.AccountRole;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
|
||||
import javax.swing.*;
|
||||
public class RecipientsForm extends DataSetControlForm<Recipient> {
|
||||
public RecipientsForm(DataSet<?, Recipient> dataSource_in, JPanel mountPanel_in) {
|
||||
super(dataSource_in, mountPanel_in);
|
||||
}
|
||||
@Override
|
||||
protected void createColumns() {
|
||||
AddColumns(
|
||||
new ColumnInfo<Recipient>("Имя") {
|
||||
@Override
|
||||
public Object getFieldAt(Recipient object) {
|
||||
return object.name;
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
@Override
|
||||
protected DataMenuBar createMenuBar() {
|
||||
return new DataMenuBar(dataSource.getPluralDescription(), PassCode.SaveBugReportExecutor, PassCode.SaveBugReportRecipients);
|
||||
}
|
||||
@Override
|
||||
protected ColumnInfo<Recipient> createPKColumn() {
|
||||
return new ColumnInfo<Recipient>(dataSource.getPKName()) {
|
||||
@Override
|
||||
public Object getFieldAt(Recipient object) {
|
||||
return object.getPK();
|
||||
}
|
||||
@Override
|
||||
public boolean isVisible() {
|
||||
return Global.mainModule.getAccount().role.equals(AccountRole.Admin);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package _VisualDVM.Repository.SubscriberRights;
|
||||
package _VisualDVM.ComponentsServer.SubscriberRights;
|
||||
import Common.Database.Objects.DBObject;
|
||||
public class SubscriberRights extends DBObject {
|
||||
public String email; //почта
|
||||
@@ -1,4 +1,4 @@
|
||||
package _VisualDVM.Repository.SubscriberWorkspace;
|
||||
package _VisualDVM.ComponentsServer.SubscriberWorkspace;
|
||||
import Common.Database.Objects.iDBObject;
|
||||
public class SubscriberWorkspace extends iDBObject {
|
||||
public String email; //почта
|
||||
@@ -1,7 +1,7 @@
|
||||
package _VisualDVM.Repository.SubscriberWorkspace;
|
||||
package _VisualDVM.ComponentsServer.SubscriberWorkspace;
|
||||
import Common.Database.Tables.iDBTable;
|
||||
import Common.Visual.DataSetControlForm;
|
||||
import _VisualDVM.Repository.SubscriberWorkspace.UI.SubscriberWorkspacesForm;
|
||||
import _VisualDVM.ComponentsServer.SubscriberWorkspace.UI.SubscriberWorkspacesForm;
|
||||
|
||||
import javax.swing.*;
|
||||
public class SubscriberWorkspaceDBTable extends iDBTable<SubscriberWorkspace> {
|
||||
@@ -1,13 +1,12 @@
|
||||
package _VisualDVM.Repository.SubscriberWorkspace.UI;
|
||||
package _VisualDVM.ComponentsServer.SubscriberWorkspace.UI;
|
||||
import Common.Database.Tables.DataSet;
|
||||
import Common.Passes.PassCode_;
|
||||
import Common.Visual.DataSetControlForm;
|
||||
import Common.Visual.Menus.DataMenuBar;
|
||||
import Common.Visual.Tables.ColumnInfo;
|
||||
import _VisualDVM.ComponentsServer.SubscriberWorkspace.SubscriberWorkspace;
|
||||
import _VisualDVM.ComponentsServer.UserAccount.UserAccount;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
import _VisualDVM.Repository.SubscriberWorkspace.SubscriberWorkspace;
|
||||
import _VisualDVM.Repository.Subscribes.Subscriber;
|
||||
|
||||
import javax.swing.*;
|
||||
public class SubscriberWorkspacesForm extends DataSetControlForm<SubscriberWorkspace> {
|
||||
@@ -46,17 +45,13 @@ public class SubscriberWorkspacesForm extends DataSetControlForm<SubscriberWorks
|
||||
);
|
||||
}
|
||||
@Override
|
||||
public PassCode_ getDeletePassCode() {
|
||||
return PassCode.DeleteSubscriberWorkspace;
|
||||
}
|
||||
@Override
|
||||
public DataMenuBar createMenuBar() {
|
||||
return new DataMenuBar(dataSource.getPluralDescription(), PassCode.DeleteSubscriberWorkspace);
|
||||
return new DataMenuBar(dataSource.getPluralDescription(), PassCode.DeleteRemoteWorkspace);
|
||||
}
|
||||
@Override
|
||||
public boolean isObjectVisible(SubscriberWorkspace object) {
|
||||
Subscriber subscriber = Global.componentsServer.db.subscribers.getUI().getCurrent();
|
||||
return super.isObjectVisible(object) && (subscriber != null) && subscriber.address.equals(object.email) &&
|
||||
(Global.mainModule.getAccount().isAdmin() || Global.mainModule.getAccount().email.equals(subscriber.address));
|
||||
UserAccount account = Global.componentsServer.credentials_db.userAccounts.getUI().getCurrent();
|
||||
return super.isObjectVisible(object) && (account != null) && account.email.equals(object.email) &&
|
||||
(Global.mainModule.getAccount().isAdmin() || Global.mainModule.getAccount().email.equals(account.email));
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,9 @@
|
||||
package _VisualDVM.GlobalData.Account;
|
||||
public enum AccountRole {
|
||||
package _VisualDVM.ComponentsServer.UserAccount;
|
||||
import java.io.Serializable;
|
||||
public enum AccountRole implements Serializable {
|
||||
Undefined,
|
||||
User,
|
||||
Student,
|
||||
Developer,
|
||||
Admin;
|
||||
public String getDescription() {
|
||||
@@ -10,6 +12,8 @@ public enum AccountRole {
|
||||
return "не зарегистрирован";
|
||||
case User:
|
||||
return "Пользователь";
|
||||
case Student:
|
||||
return "Студент";
|
||||
case Developer:
|
||||
return "Разработчик";
|
||||
case Admin:
|
||||
@@ -1,13 +1,13 @@
|
||||
package _VisualDVM.Repository.Subscribes.UI;
|
||||
package _VisualDVM.ComponentsServer.UserAccount.UI;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.UI;
|
||||
import Common.Visual.Windows.Dialog.DBObjectDialog;
|
||||
import _VisualDVM.ComponentsServer.UserAccount.AccountRole;
|
||||
import _VisualDVM.ComponentsServer.UserAccount.UserAccount;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.GlobalData.Account.AccountRole;
|
||||
import _VisualDVM.Repository.Subscribes.Subscriber;
|
||||
public class SubscriberDialog extends DBObjectDialog<Subscriber, SubscriberFields> {
|
||||
public SubscriberDialog() {
|
||||
super(SubscriberFields.class);
|
||||
public class UserAccountDialog extends DBObjectDialog<UserAccount, UserAccountFields> {
|
||||
public UserAccountDialog() {
|
||||
super(UserAccountFields.class);
|
||||
}
|
||||
@Override
|
||||
public int getDefaultHeight() {
|
||||
@@ -24,15 +24,15 @@ public class SubscriberDialog extends DBObjectDialog<Subscriber, SubscriberField
|
||||
Utils_.validateEmail(fields.tfAddress.getText(), Log);
|
||||
if (fields.tfAddress.getText().isEmpty())
|
||||
Log.Writeln_("Адрес электронной почты не может быть пустым");
|
||||
if (!title_text.equals("Регистрация") && (fields.tfAddress.isEditable() && Global.componentsServer.db.subscribers.Data.containsKey(fields.tfAddress.getText()))) {
|
||||
if (!title_text.equals("Регистрация") && (fields.tfAddress.isEditable() && Global.componentsServer.credentials_db.userAccounts.Data.containsKey(fields.tfAddress.getText()))) {
|
||||
Log.Writeln_("Адрес электронной почты " + Utils_.Brackets(fields.tfAddress.getText()) + " уже есть в списке.");
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void fillFields() {
|
||||
fields.tfName.setText(Result.name);
|
||||
fields.tfAddress.setText(Result.address);
|
||||
fields.cbMail.setSelected(Result.mailOn != 0);
|
||||
fields.tfAddress.setText(Result.email);
|
||||
fields.cbMail.setSelected(Result.subscribe_active != 0);
|
||||
UI.TrySelect(fields.cbRole, Result.role);
|
||||
}
|
||||
@Override
|
||||
@@ -45,9 +45,8 @@ public class SubscriberDialog extends DBObjectDialog<Subscriber, SubscriberField
|
||||
@Override
|
||||
public void ProcessResult() {
|
||||
Result.name = fields.tfName.getText();
|
||||
Result.address = fields.tfAddress.getText();
|
||||
Result.mailOn = fields.cbMail.isSelected() ? 1 : 0;
|
||||
Result.email = fields.tfAddress.getText();
|
||||
Result.subscribe_active = fields.cbMail.isSelected() ? 1 : 0;
|
||||
Result.role = getSelectedRole();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="_VisualDVM.Repository.Subscribes.UI.SubscriberFields">
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="_VisualDVM.ComponentsServer.UserAccount.UI.UserAccountFields">
|
||||
<grid id="27dc6" binding="content" layout-manager="GridLayoutManager" row-count="5" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
@@ -8,7 +8,7 @@
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="81c98" class="javax.swing.JLabel">
|
||||
<component id="5e1da" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="2" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
@@ -17,12 +17,20 @@
|
||||
<text value="имя"/>
|
||||
</properties>
|
||||
</component>
|
||||
<vspacer id="8f1c6">
|
||||
<vspacer id="de3f0">
|
||||
<constraints>
|
||||
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</vspacer>
|
||||
<component id="4c488" class="javax.swing.JLabel">
|
||||
<component id="e0e31" class="javax.swing.JTextField" binding="tfName" custom-create="true">
|
||||
<constraints>
|
||||
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="150" height="-1"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties/>
|
||||
</component>
|
||||
<component id="c014a" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="2" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
@@ -31,15 +39,7 @@
|
||||
<text value="адрес"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="675ad" class="javax.swing.JTextField" binding="tfName" custom-create="true">
|
||||
<constraints>
|
||||
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="150" height="-1"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties/>
|
||||
</component>
|
||||
<component id="a96c1" class="javax.swing.JTextField" binding="tfAddress" custom-create="true">
|
||||
<component id="2761d" class="javax.swing.JTextField" binding="tfAddress" custom-create="true">
|
||||
<constraints>
|
||||
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="150" height="-1"/>
|
||||
@@ -47,22 +47,7 @@
|
||||
</constraints>
|
||||
<properties/>
|
||||
</component>
|
||||
<component id="1c24b" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="2" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<font name="Times New Roman" size="16" style="2"/>
|
||||
<text value="роль"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="81d94" class="javax.swing.JComboBox" binding="cbRole" custom-create="true">
|
||||
<constraints>
|
||||
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
</component>
|
||||
<component id="fe07e" class="javax.swing.JLabel">
|
||||
<component id="15e49" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="2" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
@@ -71,7 +56,7 @@
|
||||
<text value="рассылка"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="e0879" class="javax.swing.JCheckBox" binding="cbMail">
|
||||
<component id="4da2" class="javax.swing.JCheckBox" binding="cbMail">
|
||||
<constraints>
|
||||
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
@@ -84,6 +69,21 @@
|
||||
<toolTipText value="Будет ли включена рассылка для этого пользователя"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="398ee" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="2" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<font name="Times New Roman" size="16" style="2"/>
|
||||
<text value="роль"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="34bef" class="javax.swing.JComboBox" binding="cbRole" custom-create="true">
|
||||
<constraints>
|
||||
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
</form>
|
||||
@@ -1,27 +1,28 @@
|
||||
package _VisualDVM.Repository.Subscribes.UI;
|
||||
package _VisualDVM.ComponentsServer.UserAccount.UI;
|
||||
import Common.Visual.TextField.StyledTextField;
|
||||
import Common.Visual.Windows.Dialog.DialogFields;
|
||||
import _VisualDVM.GlobalData.Account.AccountRole;
|
||||
import _VisualDVM.ComponentsServer.UserAccount.AccountRole;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
public class SubscriberFields implements DialogFields {
|
||||
public class UserAccountFields implements DialogFields {
|
||||
public JTextField tfName;
|
||||
public JTextField tfAddress;
|
||||
public JComboBox<AccountRole> cbRole;
|
||||
public JCheckBox cbMail;
|
||||
public JComboBox cbRole;
|
||||
private JPanel content;
|
||||
@Override
|
||||
public Component getContent() {
|
||||
return content;
|
||||
}
|
||||
private void createUIComponents() {
|
||||
// TODO: place custom component creation code here
|
||||
tfName = new StyledTextField();
|
||||
tfAddress = new StyledTextField();
|
||||
cbRole = new JComboBox<>();
|
||||
cbRole.addItem(AccountRole.User);
|
||||
cbRole.addItem(AccountRole.Student);
|
||||
cbRole.addItem(AccountRole.Developer);
|
||||
cbRole.addItem(AccountRole.Admin);
|
||||
}
|
||||
@Override
|
||||
public Component getContent() {
|
||||
return content;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package _VisualDVM.ComponentsServer.UserAccount.UI;
|
||||
import Common.Database.Tables.DataSet;
|
||||
import Common.Visual.DataSetControlForm;
|
||||
import Common.Visual.Menus.DataMenuBar;
|
||||
import Common.Visual.Tables.ColumnInfo;
|
||||
import Common.Visual.Windows.Dialog.DBObjectDialog;
|
||||
import _VisualDVM.ComponentsServer.UserAccount.AccountRole;
|
||||
import _VisualDVM.ComponentsServer.UserAccount.UserAccount;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
|
||||
import javax.swing.*;
|
||||
public class UserAccountsForm extends DataSetControlForm<UserAccount> {
|
||||
public UserAccountsForm(DataSet<?, UserAccount> dataSource_in, JPanel mountPanel_in) {
|
||||
super(dataSource_in, mountPanel_in);
|
||||
}
|
||||
@Override
|
||||
protected void createColumns() {
|
||||
AddColumns(
|
||||
new ColumnInfo<UserAccount>("Имя") {
|
||||
@Override
|
||||
public Object getFieldAt(UserAccount object) {
|
||||
return object.name;
|
||||
}
|
||||
},
|
||||
new ColumnInfo<UserAccount>("Почта") {
|
||||
@Override
|
||||
public Object getFieldAt(UserAccount object) {
|
||||
return object.email;
|
||||
}
|
||||
},
|
||||
new ColumnInfo<UserAccount>("Роль") {
|
||||
@Override
|
||||
public Object getFieldAt(UserAccount object) {
|
||||
return object.role.getDescription();
|
||||
}
|
||||
@Override
|
||||
public boolean isVisible() {
|
||||
return Global.mainModule.getAccount().role.equals(AccountRole.Admin);
|
||||
}
|
||||
},
|
||||
new ColumnInfo<UserAccount>("Рассылка") {
|
||||
@Override
|
||||
public Object getFieldAt(UserAccount object) {
|
||||
return (object.subscribe_active == 0) ? "выключена" : "включена";
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
@Override
|
||||
protected DataMenuBar createMenuBar() {
|
||||
return new DataMenuBar(dataSource.getPluralDescription(), PassCode.SynchronizeCredentials,
|
||||
PassCode.PublishUserAccount,
|
||||
PassCode.EditUserAccount,
|
||||
PassCode.DeleteUserAccount);
|
||||
}
|
||||
@Override
|
||||
protected DBObjectDialog getDialog() {
|
||||
return new UserAccountDialog();
|
||||
}
|
||||
}
|
||||
@@ -1,18 +1,55 @@
|
||||
package _VisualDVM.GlobalData.Account;
|
||||
package _VisualDVM.ComponentsServer.UserAccount;
|
||||
import Common.Database.Objects.DBObject;
|
||||
import Common.Database.Objects.iDBObject;
|
||||
import Common.Utils.TextLog;
|
||||
import _VisualDVM.ComponentsServer.BugReport.BugReport;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Repository.BugReport.BugReport;
|
||||
import com.sun.org.glassfish.gmbal.Description;
|
||||
public class Account extends DBObject {
|
||||
@Description("PRIMARY KEY,NOT NULL")
|
||||
public int id = 0;
|
||||
public String name = "?";
|
||||
public String email = "?";
|
||||
//--
|
||||
@Description("IGNORE")
|
||||
public AccountRole role = AccountRole.Undefined; //роль незареганного пользователя
|
||||
//--
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.lang.RandomStringUtils;
|
||||
|
||||
import java.io.File;
|
||||
public class UserAccount extends iDBObject {
|
||||
public String name = "";
|
||||
public String email = "";
|
||||
@Description("DEFAULT ''")
|
||||
public String telegram_name = "";
|
||||
@Description("DEFAULT 1")
|
||||
public int subscribe_active = 1;
|
||||
@Description("DEFAULT 'Undefined'")
|
||||
public AccountRole role = AccountRole.Undefined; //права доступа
|
||||
public UserAccount() {
|
||||
}
|
||||
public UserAccount(UserAccount account_in) {
|
||||
this.SynchronizeFields(account_in);
|
||||
}
|
||||
public UserAccount(String name_in, String email_in) {
|
||||
name = name_in;
|
||||
email = email_in;
|
||||
}
|
||||
@Override
|
||||
public void SynchronizeFields(DBObject src) {
|
||||
super.SynchronizeFields(src);
|
||||
UserAccount src_ = (UserAccount) src;
|
||||
name = src_.name;
|
||||
email = src_.email;
|
||||
telegram_name = src_.telegram_name;
|
||||
subscribe_active = src_.subscribe_active;
|
||||
role = src_.role;
|
||||
}
|
||||
public File getClientKeyFile() {
|
||||
return new File(Global.KeysDirectory, "key");
|
||||
}
|
||||
public File getServerKeyFile() {
|
||||
return new File(Global.KeysDirectory, String.valueOf(id));
|
||||
}
|
||||
public String getKey() throws Exception {
|
||||
return FileUtils.readFileToString(getServerKeyFile());
|
||||
}
|
||||
public void generateKey() throws Exception {
|
||||
FileUtils.writeStringToFile(getServerKeyFile(), RandomStringUtils.random(100, true, true));
|
||||
}
|
||||
//todo часть устарело.разобрать.
|
||||
public boolean CheckRegistered(TextLog Log) {
|
||||
if (role.equals(AccountRole.Undefined)) {
|
||||
if (Log != null) {
|
||||
@@ -62,9 +99,5 @@ public class Account extends DBObject {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public Object getPK() {
|
||||
return id;
|
||||
//---
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
package _VisualDVM.ComponentsServer.UserAccount;
|
||||
import Common.Database.Objects.DBObject;
|
||||
import Common.Database.Tables.FKBehaviour;
|
||||
import Common.Database.Tables.FKCurrentObjectBehaviuor;
|
||||
import Common.Database.Tables.FKDataBehaviour;
|
||||
import Common.Database.Tables.iDBTable;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.DataSetControlForm;
|
||||
import _VisualDVM.ComponentsServer.Recipient.Json.UserAccountJson;
|
||||
import _VisualDVM.ComponentsServer.Recipient.Json.UserAccountsJson;
|
||||
import _VisualDVM.ComponentsServer.SubscriberWorkspace.SubscriberWorkspace;
|
||||
import _VisualDVM.ComponentsServer.UserAccount.UI.UserAccountsForm;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Vector;
|
||||
public class UserAccountsDBTable extends iDBTable<UserAccount> {
|
||||
public UserAccountsDBTable() {
|
||||
super(UserAccount.class);
|
||||
}
|
||||
public UserAccount getByKey(String key_in) throws Exception {
|
||||
for (UserAccount userAccount : Data.values()) {
|
||||
if (userAccount.getKey().equals(key_in))
|
||||
return userAccount;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public UserAccount getByEmail(String email_in) {
|
||||
for (UserAccount userAccount : Data.values()) {
|
||||
if (userAccount.email.equals(email_in))
|
||||
return userAccount;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
protected DataSetControlForm createUI(JPanel mountPanel) {
|
||||
return new UserAccountsForm(this, mountPanel);
|
||||
}
|
||||
@Override
|
||||
public String getSingleDescription() {
|
||||
return "учётная запись";
|
||||
}
|
||||
@Override
|
||||
public String getPluralDescription() {
|
||||
return "учётные записи";
|
||||
}
|
||||
@Override
|
||||
public LinkedHashMap<Class<? extends DBObject>, FKBehaviour> getFKDependencies() {
|
||||
LinkedHashMap<Class<? extends DBObject>, FKBehaviour> res = new LinkedHashMap<>();
|
||||
//-
|
||||
res.put(SubscriberWorkspace.class, new FKBehaviour(FKDataBehaviour.DELETE, FKCurrentObjectBehaviuor.ACTIVE));
|
||||
return res;
|
||||
}
|
||||
public String getPackedActiveRecipients() {
|
||||
UserAccountsJson res = new UserAccountsJson();
|
||||
Vector<String> active = new Vector<>();
|
||||
for (UserAccount userAccount : Data.values()) {
|
||||
if ((userAccount.subscribe_active != 0) && !active.contains(userAccount.email)) {
|
||||
active.add(userAccount.email);
|
||||
res.values.add(new UserAccountJson(userAccount.email, userAccount.name));
|
||||
}
|
||||
}
|
||||
return Utils_.gson.toJson(res);
|
||||
}
|
||||
public Vector<String> getActiveMails() {
|
||||
Vector<String> res = new Vector<>();
|
||||
for (UserAccount account : Data.values()) {
|
||||
if ((account.subscribe_active != 0) && !res.contains(account.email))
|
||||
res.add(account.email);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,15 +5,9 @@ import java.io.File;
|
||||
public class ComponentsServerProperties extends VisualDVMProperties {
|
||||
//---
|
||||
@Expose
|
||||
public boolean EmailAdminsOnStart = false;
|
||||
@Expose
|
||||
public String BackupWorkspace = "_sapfor_x64_backups";
|
||||
@Expose
|
||||
public int BackupHour = 5;
|
||||
@Expose
|
||||
public int BackupMinute = 0;
|
||||
@Expose
|
||||
public int ComponentsBackUpsCount = 10;
|
||||
@Expose
|
||||
public String default_dvm_drv = "";
|
||||
//---
|
||||
public ComponentsServerProperties() {
|
||||
Mode = _VisualDVM.Mode.Server;
|
||||
|
||||
@@ -3,8 +3,11 @@ import Common.Utils.Vector_;
|
||||
|
||||
import java.util.Vector;
|
||||
public class Constants {
|
||||
public static final int planner_version = 4;
|
||||
public static final int testingMaxKernels = 64; //вообще говоря, это параметр машины.
|
||||
public static final int version = 1260;
|
||||
public static final int planner_version = 24;
|
||||
public static final int testingMaxKernels = 64;
|
||||
//--
|
||||
public static final String ApplicationFileName = "VisualSapfor.jar";
|
||||
//--
|
||||
public static final String ComponentsDirectoryName = "Components";
|
||||
public static final String DataDirectoryName = "Data";
|
||||
@@ -21,12 +24,12 @@ public class Constants {
|
||||
public static final String TestsDirectoryName = "Tests";
|
||||
public static final String DVMPackagesDirectoryName = "DVMPackages";
|
||||
public static final String PerformanceAnalyzerDirectoryName = "PerformanceAnalyzer";
|
||||
public static final String KeyDirectoryName = "Keys";
|
||||
//--
|
||||
//SVN vmk-post@yandex.ru
|
||||
public static final String REPOSITORY_AUTHENTICATION = "--username dvmhuser --password dvmh2013 --non-interactive";
|
||||
public static final String DVM_REPOSITORY = "http://svn.dvm-system.org/svn/dvmhrepo/dvm";
|
||||
public static final String SAPFOR_REPOSITORY = "http://svn.dvm-system.org/svn/dvmhrepo/sapfor";
|
||||
public static final String SAPFOR_REPOSITORY_BIN = "/sapfor/experts/Sapfor_2017/_bin";
|
||||
//GIT
|
||||
public static final String DVM_TESTS_REPOSITORY = "https://dvmguest:dvmguest@dvm.keldysh.ru/dvm-system/dvm-auto-test";
|
||||
public static final String SAPFOR_REPOSITORY = "http://dvmh-server.ddns.net:3000/Alexander_KS/SAPFOR.git";
|
||||
public static final String SAPFOR_VERSION_URL = "http://dvmh-server.ddns.net:3000/Alexander_KS/SAPFOR/raw/branch/master/src/Utils/version.h";
|
||||
//-вывод задач
|
||||
public final static String parse_out_file = "parse_out.txt";
|
||||
public final static String parse_err_file = "parse_err.txt";
|
||||
@@ -42,15 +45,20 @@ public class Constants {
|
||||
public static final String SMTPHost = "smtp.mail.ru";
|
||||
public static final int SMTPPort = 465;
|
||||
public static final int MailSocketPort = 465;
|
||||
//
|
||||
//7998 отладочный порт. теперь.
|
||||
public static final int ComponentsServerPort = 7995; //7795
|
||||
public static final int TestingServerPort = 7996; //7996
|
||||
public static final int SocketTimeout = 0;
|
||||
//-
|
||||
public static final String ServerAddress = "alex-freenas.ddns.net";
|
||||
public static final String ServerUserName = "testuser";
|
||||
public static final int ServerUserSHHPort = 23;
|
||||
public static final int ServerUserSHHPort = 2000;
|
||||
//--
|
||||
public static final String package_json = "package_json";
|
||||
public static final String results_json = "results_json";
|
||||
//--
|
||||
public static final int parser_group = -1;
|
||||
public static final int parser_group = 6000;
|
||||
public static final int compiler_group = -2;
|
||||
// DBProjectFile
|
||||
public static final String no_data = "Нет данных";
|
||||
@@ -69,7 +77,9 @@ public class Constants {
|
||||
public static final String unknown_metric = " — ";
|
||||
public static final String tests_db_name = "tests2027";
|
||||
public static final String dateNaN = "NaN";
|
||||
//------
|
||||
//--
|
||||
public static final String pause = "pause";
|
||||
//--
|
||||
public static final String[] crushed_cases = new String[]{
|
||||
"rts err",
|
||||
"rts stack trace",
|
||||
@@ -87,6 +97,7 @@ public class Constants {
|
||||
"killed by signal",
|
||||
"bad termination"
|
||||
};
|
||||
public final static String separator = "----------------------------------";
|
||||
//-------------------------------------------------------
|
||||
public static String[] resourses_names = new String[]{
|
||||
//--
|
||||
@@ -458,7 +469,7 @@ public class Constants {
|
||||
};
|
||||
public static Vector<String> admins_mails = new Vector_<>(
|
||||
"sapfor.tracker@internet.ru",
|
||||
"vmk-post@yandex.ru",
|
||||
"79854210702@ya.ru"
|
||||
"vmk-post@yandex.ru"
|
||||
, "79854210702@ya.ru"
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2,14 +2,14 @@ package _VisualDVM;
|
||||
import Common.Utils.Loggable;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.UI;
|
||||
import _VisualDVM.ComponentsServer.Component.ComponentsSet;
|
||||
import _VisualDVM.ComponentsServer.Component.PerformanceAnalyzer.PerformanceAnalyzer;
|
||||
import _VisualDVM.ComponentsServer.Component.Sapfor.MessagesServer;
|
||||
import _VisualDVM.ComponentsServer.Component.Visualiser;
|
||||
import _VisualDVM.ComponentsServer.Component.Visualizer_2;
|
||||
import _VisualDVM.ComponentsServer.ComponentsServer;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
import _VisualDVM.ProjectData.ProjectView;
|
||||
import _VisualDVM.Repository.Component.ComponentsSet;
|
||||
import _VisualDVM.Repository.Component.PerformanceAnalyzer.PerformanceAnalyzer;
|
||||
import _VisualDVM.Repository.Component.Sapfor.MessagesServer;
|
||||
import _VisualDVM.Repository.Component.Visualiser;
|
||||
import _VisualDVM.Repository.Component.Visualizer_2;
|
||||
import _VisualDVM.Repository.Server.ComponentsServer;
|
||||
import _VisualDVM.TestingSystem.Common.TestingServer;
|
||||
import _VisualDVM.TestingSystem.DVM.RemoteDVMTestingPlanner;
|
||||
import _VisualDVM.TestingSystem.SAPFOR.PackageModeSupervisor;
|
||||
@@ -19,11 +19,11 @@ import org.fife.ui.rsyntaxtextarea.TokenMakerFactory;
|
||||
import java.io.File;
|
||||
import java.nio.file.Paths;
|
||||
public class Global {
|
||||
//todo свести большинство к содержимому mainModule, сделать различные типы properties, переместить туда глобальный журнал (?)
|
||||
//todo свести большинство к содержимому mainModule
|
||||
public static MainModule mainModule = null;
|
||||
//Режим
|
||||
public static Mode mode = Mode.Undefined;
|
||||
//--------------------------------------------------
|
||||
//setAdminRights-------------
|
||||
public static VisualDVMProperties properties = null;
|
||||
public static NormalProperties normalProperties = null;
|
||||
public static ComponentsServerProperties componentsServerProperties = null;
|
||||
@@ -35,9 +35,10 @@ public class Global {
|
||||
public static ComponentsSet components = null;
|
||||
public static MessagesServer messagesServer = null;
|
||||
public static File ComponentsDirectory;
|
||||
public static File KeysDirectory;
|
||||
public static File DataDirectory;
|
||||
public static File BugReportsDirectory;
|
||||
public static File BackUpsDirectory;
|
||||
public static File BackUpsDirectory; //бекапы компонентов на локальной машине.
|
||||
public static File TempDirectory;
|
||||
public static File ProjectsDirectory;
|
||||
public static File CompilationTasksDirectory;
|
||||
@@ -46,7 +47,7 @@ public class Global {
|
||||
public static File RepoDirectory;
|
||||
public static File TestsDirectory;
|
||||
public static File PerformanceAnalyzerDirectory;
|
||||
public static File DataBackUpsDirectory;
|
||||
public static File DataBackUpsDirectory; //бекапы данных сервера.
|
||||
public static File DVMPackagesDirectory;
|
||||
public static File SapforsDirectory;
|
||||
public static File SapforPackagesDirectory;
|
||||
@@ -59,8 +60,8 @@ public class Global {
|
||||
public static Visualiser visualiser = null;
|
||||
public static Visualizer_2 visualizer_2 = null;
|
||||
public static void CheckVisualiserDirectories() {
|
||||
Utils_.CheckDirectory(ComponentsDirectory = new File(Utils_.getHomeDirectory(), Constants.ComponentsDirectoryName));
|
||||
Utils_.CheckAndCleanDirectory(TempDirectory = new File(Utils_.getHomeDirectory(), Constants.TempDirectoryName));
|
||||
Utils_.CheckDirectory(ComponentsDirectory = new File(Utils_.getHomeDirectory(), Constants.ComponentsDirectoryName));
|
||||
Utils_.CheckDirectory(DataDirectory = new File(Utils_.getHomeDirectory(), Constants.DataDirectoryName));
|
||||
//-
|
||||
Utils_.CheckDirectory(RepoDirectory = new File(Utils_.getHomeDirectory(), Constants.RepoDirectoryName));
|
||||
@@ -73,30 +74,33 @@ public class Global {
|
||||
Utils_.CheckDirectory(TestsDirectory = new File(Utils_.getHomeDirectory(), Constants.TestsDirectoryName));
|
||||
Utils_.CheckDirectory(PerformanceAnalyzerDirectory = new File(Utils_.getHomeDirectory(), Constants.PerformanceAnalyzerDirectoryName));
|
||||
Utils_.CheckDirectory(DVMPackagesDirectory = new File(Utils_.getHomeDirectory(), Constants.DVMPackagesDirectoryName));
|
||||
//через пару версий заменить на clean.
|
||||
Utils_.CheckDirectory(SapforPackagesDirectory = new File(Utils_.getHomeDirectory(), "SapforPackages"));
|
||||
Utils_.CheckDirectory(MachinesDirectory = new File(Utils_.getHomeDirectory(), "Machines"));
|
||||
Utils_.CheckDirectory(KeysDirectory = new File(Utils_.getHomeDirectory(), Constants.KeyDirectoryName));
|
||||
try {
|
||||
Utils_.forceDeleteWithCheck(new File(DataDirectory, "credentials.sqlite"));
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
public static void CheckServerDirectories() {
|
||||
Utils_.CheckDirectory(ComponentsDirectory = new File(Utils_.getHomeDirectory(), Constants.ComponentsDirectoryName));
|
||||
Utils_.CheckAndCleanDirectory(TempDirectory = new File(Utils_.getHomeDirectory(), Constants.TempDirectoryName));
|
||||
Utils_.CheckDirectory(ComponentsDirectory = new File(Utils_.getHomeDirectory(), Constants.ComponentsDirectoryName));
|
||||
Utils_.CheckDirectory(DataDirectory = new File(Utils_.getHomeDirectory(), Constants.DataDirectoryName));
|
||||
//-
|
||||
Utils_.CheckDirectory(BugReportsDirectory = new File(Utils_.getHomeDirectory(), Constants.BugsDirectoryName));
|
||||
Utils_.CheckDirectory(DataBackUpsDirectory = new File(Utils_.getHomeDirectory(), Constants.DataBackUpsDirectoryName));
|
||||
Utils_.CheckDirectory(MachinesDirectory = new File(Utils_.getHomeDirectory(), "Machines"));
|
||||
//--
|
||||
Utils_.CheckDirectory(BugReportsDirectory = new File(Utils_.getHomeDirectory(), Constants.BugsDirectoryName));
|
||||
Utils_.CheckDirectory(KeysDirectory = new File(Utils_.getHomeDirectory(), Constants.KeyDirectoryName));
|
||||
}
|
||||
public static void CheckTestingSystemDirectories() {
|
||||
Utils_.CheckDirectory(ComponentsDirectory = new File(Utils_.getHomeDirectory(), Constants.ComponentsDirectoryName));
|
||||
Utils_.CheckAndCleanDirectory(TempDirectory = new File(Utils_.getHomeDirectory(), Constants.TempDirectoryName));
|
||||
Utils_.CheckDirectory(DataDirectory = new File(Utils_.getHomeDirectory(), Constants.DataDirectoryName));
|
||||
Utils_.CheckDirectory(DataBackUpsDirectory = new File(Utils_.getHomeDirectory(), Constants.DataBackUpsDirectoryName));
|
||||
//-
|
||||
Utils_.CheckDirectory(TestsDirectory = new File(Utils_.getHomeDirectory(), Constants.TestsDirectoryName));
|
||||
Utils_.CheckDirectory(RepoDirectory = new File(Utils_.getHomeDirectory(), Constants.RepoDirectoryName));
|
||||
Utils_.CheckDirectory(DVMPackagesDirectory = new File(Utils_.getHomeDirectory(), Constants.DVMPackagesDirectoryName));
|
||||
Utils_.CheckDirectory(SapforsDirectory = new File(Utils_.getHomeDirectory(), "Sapfors"));
|
||||
Utils_.CheckDirectory(SapforPackagesDirectory = new File(Utils_.getHomeDirectory(), "SapforPackages"));
|
||||
//CheclAndClean через неделю
|
||||
Utils_.CheckDirectory(MachinesDirectory = new File(Utils_.getHomeDirectory(), "Machines"));
|
||||
}
|
||||
public static void CreateLogAtComponentsPath() {
|
||||
@@ -131,6 +135,8 @@ public class Global {
|
||||
mainModule.DeactivateDB();
|
||||
if (componentsServer.db != null)
|
||||
componentsServer.db.Disconnect();
|
||||
if (componentsServer.credentials_db != null)
|
||||
componentsServer.credentials_db.Disconnect();
|
||||
if (testingServer.db != null)
|
||||
testingServer.db.Disconnect();
|
||||
if (visualizer_2 != null)
|
||||
@@ -152,13 +158,17 @@ public class Global {
|
||||
public static void NormalMode(int port) throws Exception {
|
||||
//-------------------------------->>
|
||||
mainModule = new MainModule();
|
||||
System.out.println("main module initialization..");
|
||||
mainModule.Init();
|
||||
System.out.println("DONE");
|
||||
//--
|
||||
CheckVisualiserDirectories();
|
||||
CreateLogAtComponentsPath();
|
||||
//-
|
||||
System.out.println("connection to visualiser_2..");
|
||||
visualizer_2 = new Visualizer_2(port);
|
||||
visualizer_2.Connect();
|
||||
System.out.println("DONE");
|
||||
visualizer_2.refreshPid();
|
||||
//если делать раньше, то не удастся убить сервер.
|
||||
if (Utils_.ContainsCyrillic(Utils_.getHomePath())) {
|
||||
@@ -167,18 +177,27 @@ public class Global {
|
||||
"Визуализатор завершает работу."); //
|
||||
FinishApplication();
|
||||
}
|
||||
System.out.println("messages server starting..");
|
||||
messagesServer = new MessagesServer();
|
||||
messagesServer.Start();
|
||||
System.out.println("DONE");
|
||||
components = new ComponentsSet();
|
||||
System.out.println("component initial versions checking..");
|
||||
components.initialVersionsCheck();
|
||||
//-------->>
|
||||
if (normalProperties.AutoUpdateSearch)
|
||||
System.out.println("DONE");
|
||||
System.out.println("geting component actual versions..");
|
||||
Global.mainModule.getPass(PassCode.GetComponentsActualVersions).Do();
|
||||
System.out.println("DONE");
|
||||
System.out.println("validation component actual versions..");
|
||||
components.validateStates();
|
||||
System.out.println("DONE");
|
||||
if (components.needChanges()) {
|
||||
System.out.println("components need changes!!");
|
||||
boolean flag = true;
|
||||
do {
|
||||
System.out.println("Show components window...");
|
||||
Global.mainModule.getUI().getComponentsWindow().ShowDialog("");
|
||||
System.out.println("DONE");
|
||||
if (flag = (!components.validateStates())) {
|
||||
if (!UI.Question("Обнаружены некорректные компоненты.Работа визуализатора невозможна.\n" +
|
||||
"Вернуться к окну компонент"
|
||||
@@ -198,15 +217,8 @@ public class Global {
|
||||
// FoldParserManager.get().addFoldParserMapping("text/FortranSPF", new FortranFolder()); блоки кода. todo
|
||||
//light_editor.xml-------->>
|
||||
mainModule.ActivateDB();
|
||||
/*
|
||||
mainModule.set(Current.Account, new Account() {
|
||||
{
|
||||
name = "M";
|
||||
email = "vmk-post@yandex.ru";
|
||||
role = AccountRole.Admin;
|
||||
}
|
||||
});
|
||||
*/
|
||||
// https://habr.com/ru/articles/446888/ сертификат?
|
||||
if (Global.normalProperties.OfferRegistrationOnStart)
|
||||
mainModule.getPass(PassCode.CheckAccount).Do();
|
||||
//---------------
|
||||
componentsServer.ActivateDB();
|
||||
@@ -216,13 +228,14 @@ public class Global {
|
||||
Global.mainModule.getPass(PassCode.SynchronizeBugReports).Do();
|
||||
if (normalProperties.AutoTestsLoad)
|
||||
Global.mainModule.getPass(PassCode.SynchronizeTests).Do();
|
||||
Global.mainModule.getPass(PassCode.SynchronizeCredentials).Do();
|
||||
//--
|
||||
Global.mainModule.getSapfor().refreshPid(); //без сапфора сюда это все равно не дойдет.
|
||||
Global.mainModule.getUI().getMainWindow().Show();
|
||||
}
|
||||
public static void ServerMode() throws Exception {
|
||||
CheckServerDirectories();
|
||||
CreateLogAtComponentsPath();
|
||||
CreateLogAtHome();
|
||||
componentsServer = new ComponentsServer();
|
||||
componentsServer.ActivateDB();
|
||||
componentsServer.Start();
|
||||
@@ -230,7 +243,7 @@ public class Global {
|
||||
}
|
||||
public static void TestingSystemMode() throws Exception {
|
||||
CheckTestingSystemDirectories();
|
||||
CreateLogAtComponentsPath();
|
||||
CreateLogAtHome();
|
||||
testingServer = new TestingServer();
|
||||
testingServer.ActivateDB();
|
||||
testingServer.Start();
|
||||
@@ -280,6 +293,10 @@ public class Global {
|
||||
public static void Init(String... args) {
|
||||
System.out.println("VisualSapfor.jar started..");
|
||||
System.out.println("home directory is" + Utils_.Brackets(Utils_.getHomePath()));
|
||||
System.out.println("args size = " + args.length);
|
||||
for (int i = 0; i < args.length; ++i)
|
||||
System.out.println("args[" + i + "]=" + Utils_.DQuotes(args[i]));
|
||||
System.out.println("====");
|
||||
//--->
|
||||
try {
|
||||
SynchronizeProperties();
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
package _VisualDVM.GlobalData.Account;
|
||||
public enum AccountSubscribeState {
|
||||
Undefined,
|
||||
None,
|
||||
Active;
|
||||
public String getDescription() {
|
||||
switch (this) {
|
||||
case Undefined:
|
||||
return "Подписка: нет данных";
|
||||
case None:
|
||||
return "Подписка: аннулирована";
|
||||
case Active:
|
||||
return "Подписка: активна";
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package _VisualDVM.GlobalData.Account;
|
||||
import Common.Database.Tables.DBTable;
|
||||
public class AccountsDBTable extends DBTable<Integer, Account> {
|
||||
public AccountsDBTable() {
|
||||
super(Integer.class, Account.class);
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
package _VisualDVM.GlobalData.Compiler;
|
||||
import Common.Database.Objects.iDBObject;
|
||||
import Common.Utils.Utils_;
|
||||
import _VisualDVM.GlobalData.CompilerEnvironment.CompilerEnvironmentsSet;
|
||||
import _VisualDVM.GlobalData.CompilerOption.CompilerOptionsSet;
|
||||
import _VisualDVM.GlobalData.CompilerEnvironment.RawCompilerEnvironmentsSet;
|
||||
import _VisualDVM.GlobalData.CompilerOption.RawCompilerOptionsSet;
|
||||
import _VisualDVM.GlobalData.Machine.Machine;
|
||||
import _VisualDVM.ProjectData.Files.DBProjectFile;
|
||||
import _VisualDVM.ProjectData.LanguageName;
|
||||
@@ -29,8 +29,8 @@ public class Compiler extends iDBObject {
|
||||
@Description("IGNORE")
|
||||
public String versionText = "";
|
||||
//-
|
||||
public CompilerOptionsSet options = new CompilerOptionsSet();
|
||||
public CompilerEnvironmentsSet environments = new CompilerEnvironmentsSet();
|
||||
public RawCompilerOptionsSet options = new RawCompilerOptionsSet();
|
||||
public RawCompilerEnvironmentsSet environments = new RawCompilerEnvironmentsSet();
|
||||
//-
|
||||
public Compiler() {
|
||||
}
|
||||
|
||||
@@ -13,8 +13,12 @@ public class CompilerDialog extends DBObjectDialog<Compiler, CompilerFields> {
|
||||
super(CompilerFields.class);
|
||||
}
|
||||
@Override
|
||||
public int getDefaultWidth() {
|
||||
return 600;
|
||||
}
|
||||
@Override
|
||||
public int getDefaultHeight() {
|
||||
return 300;
|
||||
return 450;
|
||||
}
|
||||
@Override
|
||||
public void validateFields() {
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="_VisualDVM.GlobalData.Compiler.UI.CompilerFields">
|
||||
<grid id="27dc6" binding="content" layout-manager="GridLayoutManager" row-count="7" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<grid id="27dc6" binding="content" layout-manager="GridLayoutManager" row-count="13" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<xy x="20" y="20" width="500" height="400"/>
|
||||
<xy x="20" y="20" width="500" height="437"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="87831" class="javax.swing.JTextField" binding="tfHome" custom-create="true">
|
||||
<constraints>
|
||||
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
||||
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="150" height="-1"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
@@ -18,21 +18,12 @@
|
||||
</component>
|
||||
<vspacer id="44b33">
|
||||
<constraints>
|
||||
<grid row="6" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||
<grid row="12" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</vspacer>
|
||||
<component id="627cc" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="2" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<font name="Times New Roman" size="16" style="2"/>
|
||||
<text value="расположение"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="48916" class="javax.swing.JButton" binding="bBrowse">
|
||||
<constraints>
|
||||
<grid row="1" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<enabled value="true"/>
|
||||
@@ -42,29 +33,48 @@
|
||||
</component>
|
||||
<component id="d58a0" class="javax.swing.JTextField" binding="tfCallCommand" custom-create="true">
|
||||
<constraints>
|
||||
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
||||
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="150" height="-1"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties/>
|
||||
</component>
|
||||
<component id="f3f87" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="2" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<font name="Times New Roman" size="16" style="2"/>
|
||||
<text value="команда вызова"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="87234" class="javax.swing.JTextField" binding="tfDescription" custom-create="true">
|
||||
<constraints>
|
||||
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="150" height="-1"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties/>
|
||||
</component>
|
||||
<component id="ac56f" class="javax.swing.JTextField" binding="tfVersionCommand" custom-create="true">
|
||||
<constraints>
|
||||
<grid row="7" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="150" height="-1"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<editable value="false"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="b2235" class="javax.swing.JTextField" binding="tfHelpCommand" custom-create="true">
|
||||
<constraints>
|
||||
<grid row="9" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="150" height="-1"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<editable value="false"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="673a2" class="javax.swing.JComboBox" binding="cbCompilerType" custom-create="true">
|
||||
<constraints>
|
||||
<grid row="11" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<toolTipText value="выберите тип компилятора"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="d1e8b" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="2" use-parent-layout="false"/>
|
||||
@@ -74,38 +84,36 @@
|
||||
<text value="описание"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="ac56f" class="javax.swing.JTextField" binding="tfVersionCommand" custom-create="true">
|
||||
<component id="627cc" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="150" height="-1"/>
|
||||
</grid>
|
||||
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="2" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<editable value="false"/>
|
||||
<font name="Times New Roman" size="16" style="2"/>
|
||||
<text value="расположение"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="f3f87" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="2" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<font name="Times New Roman" size="16" style="2"/>
|
||||
<text value="команда вызова"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="34097" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="2" use-parent-layout="false"/>
|
||||
<grid row="6" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="2" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<font name="Times New Roman" size="16" style="2"/>
|
||||
<text value="запрос версии"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="b2235" class="javax.swing.JTextField" binding="tfHelpCommand" custom-create="true">
|
||||
<constraints>
|
||||
<grid row="4" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="150" height="-1"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<editable value="false"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="8982d" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="2" use-parent-layout="false"/>
|
||||
<grid row="8" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="2" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<font name="Times New Roman" size="16" style="2"/>
|
||||
@@ -114,21 +122,13 @@
|
||||
</component>
|
||||
<component id="19a71" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="2" use-parent-layout="false"/>
|
||||
<grid row="10" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="2" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<font name="Times New Roman" size="16" style="2"/>
|
||||
<text value="тип"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="673a2" class="javax.swing.JComboBox" binding="cbCompilerType" custom-create="true">
|
||||
<constraints>
|
||||
<grid row="5" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<toolTipText value="выберите тип компилятора"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
</form>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user