no message
This commit is contained in:
@@ -155,12 +155,10 @@ public class BugReport extends rDBObject {
|
||||
return project_version.isEmpty();
|
||||
}
|
||||
//--->
|
||||
|
||||
public void CheckRecipients() {
|
||||
for (Recipient recipient : Global.componentsServer.db.recipients.Data.values())
|
||||
recipient.Select(packedRecipientsJson.contains(recipient.email));
|
||||
}
|
||||
|
||||
public void saveRecipientsAsJson(Vector<Recipient> recipients) {
|
||||
packedRecipientsJson = Utils_.gson.toJson(new RecipientsJson(recipients));
|
||||
}
|
||||
|
||||
@@ -9,8 +9,8 @@ public class BugReportAdditionJson implements Serializable {
|
||||
@Expose
|
||||
public String fieldName = "";
|
||||
@Expose
|
||||
public String textAddition ="";
|
||||
public BugReportAdditionJson(BugReport bugReport, String fieldName_in, String addition_in){
|
||||
public String textAddition = "";
|
||||
public BugReportAdditionJson(BugReport bugReport, String fieldName_in, String addition_in) {
|
||||
id = bugReport.id;
|
||||
fieldName = fieldName_in;
|
||||
textAddition = addition_in;
|
||||
|
||||
@@ -4,7 +4,7 @@ public class RecipientJson {
|
||||
@Expose
|
||||
public String address;
|
||||
public RecipientJson(String addres_in) {
|
||||
address= addres_in;
|
||||
address = addres_in;
|
||||
}
|
||||
public RecipientJson() {
|
||||
}
|
||||
|
||||
@@ -5,6 +5,6 @@ public class VisualiserSettingJson {
|
||||
public String name;
|
||||
@Expose
|
||||
public String value;
|
||||
public VisualiserSettingJson(){
|
||||
public VisualiserSettingJson() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ import Common.Database.SQLITE.SQLiteDatabase;
|
||||
import _VisualDVM.ComponentsServer.BugReport.BugReport;
|
||||
import _VisualDVM.ComponentsServer.BugReport.BugReportsDBTable;
|
||||
import _VisualDVM.ComponentsServer.Recipient.RecipientsDataSet;
|
||||
import _VisualDVM.ComponentsServer.SubscriberWorkspace.SubscriberWorkspaceDBTable;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
|
||||
import java.nio.file.Paths;
|
||||
|
||||
@@ -25,7 +25,7 @@ public class ComponentPublicationInfoJson implements Serializable {
|
||||
public boolean needsEmail = false;
|
||||
@Expose
|
||||
public boolean needsSendFile = false;
|
||||
public ComponentPublicationInfoJson(Component component) throws Exception{
|
||||
public ComponentPublicationInfoJson(Component component) throws Exception {
|
||||
componentType = component.getComponentType();
|
||||
fileName = component.getFileName();
|
||||
packedFile = Utils_.fileToBytes(component.getFile());
|
||||
|
||||
@@ -10,7 +10,7 @@ public class ComponentVersionsInfoJson implements Serializable {
|
||||
public String minimal_version = "";
|
||||
@Expose
|
||||
public String actual_version = "";
|
||||
public ComponentVersionsInfoJson(ComponentType componentType_in){
|
||||
componentType=componentType_in;
|
||||
public ComponentVersionsInfoJson(ComponentType componentType_in) {
|
||||
componentType = componentType_in;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -301,6 +301,112 @@ 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) {
|
||||
File workspace = test.getServerPath();
|
||||
Vector<File> files = new Vector<>();
|
||||
TestFilesJson filesJson = Utils_.gson.fromJson(test.packedFilesJson, TestFilesJson.class);
|
||||
for (TestFileJson fileJson : filesJson.values) {
|
||||
files.add(new File(workspace, fileJson.name));
|
||||
}
|
||||
int min_dim = 0;
|
||||
int max_dim = 0;
|
||||
for (File file : files) {
|
||||
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...");
|
||||
@@ -542,110 +648,4 @@ public abstract class Sapfor extends OSDComponent {
|
||||
Global.mainModule.getUI().getVersionsWindow().BlockVariants();
|
||||
}
|
||||
//--
|
||||
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) {
|
||||
File workspace = test.getServerPath();
|
||||
Vector<File> files = new Vector<>();
|
||||
TestFilesJson filesJson = Utils_.gson.fromJson(test.packedFilesJson,TestFilesJson.class);
|
||||
for (TestFileJson fileJson : filesJson.values) {
|
||||
files.add(new File(workspace, fileJson.name));
|
||||
}
|
||||
int min_dim = 0;
|
||||
int max_dim = 0;
|
||||
for (File file: files){
|
||||
max_dim = Math.max(max_dim,getFileMaxDim_C(file));
|
||||
}
|
||||
test.min_dim = min_dim;
|
||||
test.max_dim = max_dim;
|
||||
}
|
||||
//--
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
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.*;
|
||||
|
||||
@@ -85,7 +85,7 @@ public class Visualiser extends Component {
|
||||
}
|
||||
return res;
|
||||
}
|
||||
public File getDownloadsDirectory(){
|
||||
public File getDownloadsDirectory() {
|
||||
File res = new File(getWorkspace(), Constants.DownloadsDirectoryName);
|
||||
Utils_.CheckDirectory(res);
|
||||
return res;
|
||||
|
||||
@@ -73,8 +73,8 @@ public class Visualizer_2 extends OSDComponent {
|
||||
}
|
||||
@Override
|
||||
public String getAssemblyCommand() {
|
||||
File src_home= Paths.get(Global.RepoDirectory.getAbsolutePath(),"SAPFOR/src/Server").toFile();
|
||||
return "cd " +Utils_.DQuotes(src_home)+
|
||||
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";
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package _VisualDVM.ComponentsServer;
|
||||
import Common.Database.Objects.DBObject;
|
||||
import Common.Database.Objects.riDBObject;
|
||||
import Common.Database.RepositoryRefuseException;
|
||||
import Common.Utils.Utils_;
|
||||
import _VisualDVM.ComponentsServer.BugReport.BugReport;
|
||||
@@ -12,13 +11,7 @@ import _VisualDVM.ComponentsServer.UserAccount.AccountRole;
|
||||
import _VisualDVM.ComponentsServer.UserAccount.UserAccount;
|
||||
import _VisualDVM.Constants;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.GlobalData.Machine.Machine;
|
||||
import _VisualDVM.GlobalData.Machine.MachineType;
|
||||
import _VisualDVM.GlobalData.RemoteFile.RemoteFile;
|
||||
import _VisualDVM.GlobalData.User.User;
|
||||
import _VisualDVM.Passes.All.ArchivesBackupPass;
|
||||
import _VisualDVM.Passes.All.Email;
|
||||
import _VisualDVM.Passes.All.UnzipFolderPass;
|
||||
import _VisualDVM.Passes.All.ZipFolderPass;
|
||||
import _VisualDVM.ProjectData.LanguageName;
|
||||
import _VisualDVM.Repository.EmailMessage;
|
||||
@@ -26,17 +19,14 @@ import _VisualDVM.Repository.Server.RepositoryServer;
|
||||
import _VisualDVM.Utils;
|
||||
import javafx.util.Pair;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.lang.RandomStringUtils;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.Serializable;
|
||||
import java.lang.reflect.Field;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Arrays;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.Vector;
|
||||
public class ComponentsServer extends RepositoryServer<BugReportsDatabase> {
|
||||
@@ -54,7 +44,7 @@ public class ComponentsServer extends RepositoryServer<BugReportsDatabase> {
|
||||
}
|
||||
@Override
|
||||
protected void extraBackup(File todayBackUp) {
|
||||
zip.Do("Bugs",new File (todayBackUp, "Bugs.zip").getAbsolutePath());
|
||||
zip.Do("Bugs", new File(todayBackUp, "Bugs.zip").getAbsolutePath());
|
||||
}
|
||||
@Override
|
||||
protected void beforePublishAction(DBObject object) throws Exception {
|
||||
@@ -71,7 +61,7 @@ public class ComponentsServer extends RepositoryServer<BugReportsDatabase> {
|
||||
if (object instanceof BugReport) {
|
||||
BugReport bugReport = (BugReport) object;
|
||||
if (!bugReport.project_version.isEmpty()) Utils_.forceDeleteWithCheck(bugReport.getArchiveFile());
|
||||
}else if (object instanceof UserAccount){
|
||||
} else if (object instanceof UserAccount) {
|
||||
UserAccount account = (UserAccount) object;
|
||||
Utils_.forceDeleteWithCheck(account.getServerKeyFile());
|
||||
}
|
||||
@@ -237,7 +227,7 @@ public class ComponentsServer extends RepositoryServer<BugReportsDatabase> {
|
||||
bufferWriter_.close();
|
||||
}
|
||||
//-рассылка об изменениях.
|
||||
if (info.needsEmail){
|
||||
if (info.needsEmail) {
|
||||
String version_mail_header = String.join(" ",
|
||||
"Опубликована версия",
|
||||
Utils_.DQuotes(info.versionNumber),
|
||||
@@ -246,13 +236,13 @@ public class ComponentsServer extends RepositoryServer<BugReportsDatabase> {
|
||||
//-
|
||||
EmailMessage message =
|
||||
new EmailMessage(version_mail_header,
|
||||
info.changeRecord
|
||||
info.changeRecord
|
||||
);
|
||||
if (info.needsSendFile)
|
||||
message.addAttachement(componentFile);
|
||||
//--
|
||||
for (String address: credentials_db.userAccounts.getActiveMails()){
|
||||
EmailMessagesQueue.add(new Pair<>(address,message));
|
||||
for (String address : credentials_db.userAccounts.getActiveMails()) {
|
||||
EmailMessagesQueue.add(new Pair<>(address, message));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +1,11 @@
|
||||
package _VisualDVM.ComponentsServer;
|
||||
import Common.Database.Objects.DBObject;
|
||||
import Common.Database.SQLITE.SQLiteDatabase;
|
||||
import Common.Database.Tables.FKBehaviour;
|
||||
import Common.Database.Tables.FKCurrentObjectBehaviuor;
|
||||
import Common.Database.Tables.FKDataBehaviour;
|
||||
import Common.Passes.PassCode_;
|
||||
import _VisualDVM.ComponentsServer.SubscriberWorkspace.SubscriberWorkspace;
|
||||
import _VisualDVM.ComponentsServer.SubscriberWorkspace.SubscriberWorkspaceDBTable;
|
||||
import _VisualDVM.ComponentsServer.UserAccount.UserAccountsDBTable;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
|
||||
import java.nio.file.Paths;
|
||||
import java.util.LinkedHashMap;
|
||||
public class CredentialsDatabase extends SQLiteDatabase {
|
||||
public UserAccountsDBTable userAccounts;
|
||||
public SubscriberWorkspaceDBTable workspaces;
|
||||
@@ -38,5 +32,4 @@ public class CredentialsDatabase extends SQLiteDatabase {
|
||||
userAccounts.ShowUI();
|
||||
super.ResetUI();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ public class UserAccountJson {
|
||||
public String email;
|
||||
@Expose
|
||||
public String name;
|
||||
public UserAccountJson(String email_in, String name_in){
|
||||
public UserAccountJson(String email_in, String name_in) {
|
||||
email = email_in;
|
||||
name = name_in;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,12 @@ 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;
|
||||
@@ -15,10 +21,4 @@ public class Recipient extends DBObject {
|
||||
email = src_.email;
|
||||
name = src_.name;
|
||||
}
|
||||
public Recipient() {
|
||||
}
|
||||
public Recipient(UserAccountJson json) {
|
||||
email = json.email;
|
||||
name = json.name;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ import Common.Visual.DataSetControlForm;
|
||||
import _VisualDVM.ComponentsServer.Recipient.Json.UserAccountJson;
|
||||
import _VisualDVM.ComponentsServer.Recipient.Json.UserAccountsJson;
|
||||
import _VisualDVM.ComponentsServer.Recipient.UI.RecipientsForm;
|
||||
import _VisualDVM.ComponentsServer.UserAccount.UserAccount;
|
||||
import _VisualDVM.Constants;
|
||||
import _VisualDVM.Global;
|
||||
|
||||
@@ -15,16 +14,16 @@ public class RecipientsDataSet extends DataSet<String, Recipient> {
|
||||
public RecipientsDataSet() {
|
||||
super(String.class, Recipient.class);
|
||||
}
|
||||
public void Unpack(String packed){
|
||||
public void Unpack(String packed) {
|
||||
clear();
|
||||
UserAccountsJson jsons = Utils_.gson.fromJson(packed, UserAccountsJson.class);
|
||||
for (UserAccountJson userAccountJson: jsons.values){
|
||||
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);
|
||||
return new RecipientsForm(this, mountPanel);
|
||||
}
|
||||
@Override
|
||||
public String getPluralDescription() {
|
||||
@@ -34,11 +33,11 @@ public class RecipientsDataSet extends DataSet<String, Recipient> {
|
||||
public String getSingleDescription() {
|
||||
return "адресат";
|
||||
}
|
||||
public Vector<String> getSelectedMails(){
|
||||
public Vector<String> getSelectedMails() {
|
||||
//баг текущий. значит адресаты уже активные и правильные. дополняем их админами и автором.
|
||||
Vector<String> res = new Vector<>();
|
||||
for (Recipient recipient:Data.values()){
|
||||
if (recipient.isSelected()&& !res.contains(recipient.email))
|
||||
for (Recipient recipient : Data.values()) {
|
||||
if (recipient.isSelected() && !res.contains(recipient.email))
|
||||
res.add(recipient.email);
|
||||
}
|
||||
//--
|
||||
|
||||
@@ -26,7 +26,7 @@ public class RecipientsForm extends DataSetControlForm<Recipient> {
|
||||
}
|
||||
@Override
|
||||
protected DataMenuBar createMenuBar() {
|
||||
return new DataMenuBar(dataSource.getPluralDescription(), PassCode.SaveBugReportExecutor,PassCode.SaveBugReportRecipients);
|
||||
return new DataMenuBar(dataSource.getPluralDescription(), PassCode.SaveBugReportExecutor, PassCode.SaveBugReportRecipients);
|
||||
}
|
||||
@Override
|
||||
protected ColumnInfo<Recipient> createPKColumn() {
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
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 javax.swing.*;
|
||||
public class SubscriberWorkspacesForm extends DataSetControlForm<SubscriberWorkspace> {
|
||||
|
||||
@@ -2,9 +2,9 @@ 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.ComponentsServer.UserAccount.AccountRole;
|
||||
public class UserAccountDialog extends DBObjectDialog<UserAccount, UserAccountFields> {
|
||||
public UserAccountDialog() {
|
||||
super(UserAccountFields.class);
|
||||
|
||||
@@ -6,11 +6,11 @@ import _VisualDVM.ComponentsServer.UserAccount.AccountRole;
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
public class UserAccountFields implements DialogFields {
|
||||
private JPanel content;
|
||||
public JTextField tfName;
|
||||
public JTextField tfAddress;
|
||||
public JCheckBox cbMail;
|
||||
public JComboBox cbRole;
|
||||
private JPanel content;
|
||||
private void createUIComponents() {
|
||||
// TODO: place custom component creation code here
|
||||
tfName = new StyledTextField();
|
||||
|
||||
@@ -13,38 +13,37 @@ public class UserAccount extends iDBObject {
|
||||
public String name = "";
|
||||
public String email = "";
|
||||
@Description("DEFAULT ''")
|
||||
public String telegram_name="";
|
||||
public String telegram_name = "";
|
||||
@Description("DEFAULT 1")
|
||||
public int subscribe_active = 1;
|
||||
@Description("DEFAULT 'Undefined'")
|
||||
public AccountRole role = AccountRole.Undefined; //права доступа
|
||||
public UserAccount(){
|
||||
|
||||
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;
|
||||
telegram_name = src_.telegram_name;
|
||||
subscribe_active = src_.subscribe_active;
|
||||
role = src_.role;
|
||||
}
|
||||
public UserAccount(String name_in, String email_in){
|
||||
name = name_in;
|
||||
email=email_in;
|
||||
public File getClientKeyFile() {
|
||||
return new File(Global.KeysDirectory, "key");
|
||||
}
|
||||
public File getClientKeyFile(){
|
||||
return new File(Global.KeysDirectory,"key");
|
||||
public File getServerKeyFile() {
|
||||
return new File(Global.KeysDirectory, String.valueOf(id));
|
||||
}
|
||||
public File getServerKeyFile(){
|
||||
return new File(Global.KeysDirectory,String.valueOf(id));
|
||||
}
|
||||
public String getKey() throws Exception{
|
||||
public String getKey() throws Exception {
|
||||
return FileUtils.readFileToString(getServerKeyFile());
|
||||
}
|
||||
public void generateKey() throws Exception {
|
||||
|
||||
@@ -11,7 +11,6 @@ import _VisualDVM.ComponentsServer.Recipient.Json.UserAccountsJson;
|
||||
import _VisualDVM.ComponentsServer.SubscriberWorkspace.SubscriberWorkspace;
|
||||
import _VisualDVM.ComponentsServer.UserAccount.UI.UserAccountsForm;
|
||||
import _VisualDVM.Constants;
|
||||
import _VisualDVM.Global;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.LinkedHashMap;
|
||||
@@ -20,15 +19,15 @@ public class UserAccountsDBTable extends iDBTable<UserAccount> {
|
||||
public UserAccountsDBTable() {
|
||||
super(UserAccount.class);
|
||||
}
|
||||
public UserAccount getByKey(String key_in) throws Exception{
|
||||
for (UserAccount userAccount: Data.values()){
|
||||
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()){
|
||||
public UserAccount getByEmail(String email_in) {
|
||||
for (UserAccount userAccount : Data.values()) {
|
||||
if (userAccount.email.equals(email_in))
|
||||
return userAccount;
|
||||
}
|
||||
@@ -53,22 +52,21 @@ public class UserAccountsDBTable extends iDBTable<UserAccount> {
|
||||
res.put(SubscriberWorkspace.class, new FKBehaviour(FKDataBehaviour.DELETE, FKCurrentObjectBehaviuor.ACTIVE));
|
||||
return res;
|
||||
}
|
||||
public String getPackedActiveRecipients(){
|
||||
UserAccountsJson res = new UserAccountsJson();
|
||||
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)){
|
||||
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(){
|
||||
public Vector<String> getActiveMails() {
|
||||
Vector<String> res = new Vector<>();
|
||||
for (UserAccount account: Data.values()){
|
||||
if ((account.subscribe_active!=0)&& !res.contains(account.email))
|
||||
for (UserAccount account : Data.values()) {
|
||||
if ((account.subscribe_active != 0) && !res.contains(account.email))
|
||||
res.add(account.email);
|
||||
}
|
||||
for (String admin_mail : Constants.admins_mails) {
|
||||
|
||||
Reference in New Issue
Block a user