no message
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
package _VisualDVM.Repository.Component.Json;
|
||||
import Common.CommonConstants;
|
||||
import _VisualDVM.Repository.Component.ComponentType;
|
||||
import com.google.gson.annotations.Expose;
|
||||
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
package _VisualDVM.Repository;
|
||||
import Common.Database.Database;
|
||||
import Common.Database.Objects.DBObject;
|
||||
import Common.Passes.PassException;
|
||||
import Common.Database.Objects.riDBObject;
|
||||
import Common.Utils.InterruptThread;
|
||||
import Common.Utils.Utils_;
|
||||
import _VisualDVM.Constants;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Passes.Server.RepositoryPass;
|
||||
import _VisualDVM.Repository.BugReport.BugReport;
|
||||
import _VisualDVM.Repository.Server.DiagnosticSignalHandler;
|
||||
import _VisualDVM.Repository.Server.ServerCode;
|
||||
import _VisualDVM.Repository.Server.ServerExchangeUnit_2021;
|
||||
@@ -26,7 +24,10 @@ import javax.mail.internet.MimeMultipart;
|
||||
import java.io.*;
|
||||
import java.net.ServerSocket;
|
||||
import java.net.Socket;
|
||||
import java.util.*;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Properties;
|
||||
import java.util.Vector;
|
||||
public abstract class RepositoryServer<D extends Database> {
|
||||
public final static String separator = "----------------------------------";
|
||||
protected static FileWriter Log;
|
||||
@@ -54,8 +55,8 @@ public abstract class RepositoryServer<D extends Database> {
|
||||
public RepositoryServer(Class<D> d_class_in) {
|
||||
d_class = d_class_in;
|
||||
}
|
||||
protected static void ResetLog(){
|
||||
if (printOn){
|
||||
protected static void ResetLog() {
|
||||
if (printOn) {
|
||||
try {
|
||||
Log = new FileWriter("Log.txt", false);
|
||||
Log.close();
|
||||
@@ -274,6 +275,9 @@ public abstract class RepositoryServer<D extends Database> {
|
||||
case DeleteObjectsByPK:
|
||||
DeleteObjectsByPK();
|
||||
break;
|
||||
case CloneObjectByPK:
|
||||
CloneObject();
|
||||
break;
|
||||
//</editor-fold>
|
||||
case EXIT:
|
||||
Print("ЗАВЕРШИТЬ РАБОТУ СЕРВЕРА");
|
||||
@@ -324,10 +328,10 @@ public abstract class RepositoryServer<D extends Database> {
|
||||
}
|
||||
}
|
||||
}
|
||||
private void EmailBroadcast() throws Exception{
|
||||
String [] packed = request.arg.split("\n");
|
||||
for (String address: packed){
|
||||
if (!address.isEmpty()){
|
||||
private void EmailBroadcast() throws Exception {
|
||||
String[] packed = request.arg.split("\n");
|
||||
for (String address : packed) {
|
||||
if (!address.isEmpty()) {
|
||||
Email((EmailMessage) request.object, address);
|
||||
}
|
||||
}
|
||||
@@ -355,6 +359,27 @@ public abstract class RepositoryServer<D extends Database> {
|
||||
afterPublishAction(dbObject);
|
||||
}
|
||||
}
|
||||
private void CloneObject() throws Exception {
|
||||
response = new ServerExchangeUnit_2021(ServerCode.OK);
|
||||
Print("Дублировать объект по ключу");
|
||||
Pair<Class, Object> to_clone = (Pair<Class, Object>) request.object;
|
||||
Object pk = to_clone.getValue();
|
||||
if (db.getTable(to_clone.getKey()).containsKey(to_clone.getValue())) {
|
||||
riDBObject src = (riDBObject) db.getTable(to_clone.getKey()).get(to_clone.getValue());
|
||||
riDBObject dst = (riDBObject) to_clone.getKey().newInstance();
|
||||
dst.SynchronizeFields(src);
|
||||
//единственное отличие клона - текущий автор
|
||||
dst.description += " копия";
|
||||
String[] packed = request.arg.split("\n");
|
||||
dst.sender_name = packed[0];
|
||||
dst.sender_address = packed[1];
|
||||
db.Insert(dst);
|
||||
afterCloneAction(src,dst);
|
||||
response.object= (Serializable) dst.getPK();
|
||||
}
|
||||
}
|
||||
protected void afterCloneAction(riDBObject src, riDBObject dst) throws Exception {
|
||||
}
|
||||
protected void beforePublishAction(DBObject object) throws Exception {
|
||||
}
|
||||
protected void afterPublishAction(DBObject object) throws Exception {
|
||||
@@ -382,7 +407,6 @@ public abstract class RepositoryServer<D extends Database> {
|
||||
public void Ping() {
|
||||
response = new ServerExchangeUnit_2021(ServerCode.OK);
|
||||
}
|
||||
|
||||
//---
|
||||
/*
|
||||
public <T extends DBObject> T getActual(T object_in, Class<T> object_class)throws Exception{
|
||||
|
||||
@@ -11,7 +11,6 @@ import _VisualDVM.GlobalData.RemoteFile.RemoteFile;
|
||||
import _VisualDVM.GlobalData.User.User;
|
||||
import _VisualDVM.Passes.All.ArchivesBackupPass;
|
||||
import _VisualDVM.Passes.All.UnzipFolderPass;
|
||||
import _VisualDVM.Passes.All.UpdateBugReportField;
|
||||
import _VisualDVM.Passes.All.ZipFolderPass;
|
||||
import _VisualDVM.ProjectData.LanguageName;
|
||||
import _VisualDVM.Repository.BugReport.BugReport;
|
||||
|
||||
@@ -33,7 +33,9 @@ public enum ServerCode {
|
||||
GetObjectsCopiesByPK,
|
||||
DeleteObjects,
|
||||
DeleteObjectsByPK,
|
||||
CheckObjectExistense, //
|
||||
CheckObjectExistense,
|
||||
CloneObjectByPK,
|
||||
//
|
||||
//--
|
||||
EXIT,
|
||||
//--
|
||||
@@ -134,6 +136,12 @@ public enum ServerCode {
|
||||
return "Удаление объекта с сервера";
|
||||
case CheckSubscriberRole:
|
||||
return "Проверка роли подписчика на сервере";
|
||||
case CloneObjectByPK:
|
||||
return "Дублирование объекта на сервере";
|
||||
case UpdateActiveDVMPackages:
|
||||
return "Актуализация активных DVM пакетов на сервере";
|
||||
case ActualizeSAPFORPackages:
|
||||
return "Актуализация активных SAPFOR пакетов на сервере";
|
||||
default:
|
||||
return this.toString();
|
||||
}
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
package _VisualDVM.Repository;
|
||||
import Common.Passes.PassException;
|
||||
import Common.Utils.Utils_;
|
||||
import _VisualDVM.Passes.Server.TestingSystemPass_OLD;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Passes.Server.RepositoryPass;
|
||||
import _VisualDVM.Repository.Server.ServerCode;
|
||||
import _VisualDVM.Repository.Server.ServerExchangeUnit_2021;
|
||||
import _VisualDVM.TestingSystem.Common.TestingServer;
|
||||
|
||||
import java.io.FileWriter;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
public abstract class RepositoryClient {
|
||||
public abstract class TestingClient {
|
||||
//--
|
||||
protected int getSleepMillis() {
|
||||
return 2000;
|
||||
@@ -31,7 +33,7 @@ public abstract class RepositoryClient {
|
||||
}
|
||||
//--
|
||||
protected Object ServerCommand(ServerCode code_in, String arg, Serializable object_in) throws Exception {
|
||||
TestingSystemPass_OLD<Object> pass = new TestingSystemPass_OLD<Object>() {
|
||||
RepositoryPass<TestingServer,Object> pass = new RepositoryPass<TestingServer, Object>(Global.testingServer) {
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "";
|
||||
@@ -45,6 +47,10 @@ public abstract class RepositoryClient {
|
||||
protected boolean validate() {
|
||||
return Log.isEmpty();
|
||||
}
|
||||
@Override
|
||||
protected int getTimeout() {
|
||||
return 120000;
|
||||
}
|
||||
};
|
||||
if (!pass.Do()) {
|
||||
ServerConnectionError(code_in, pass.Log.toString());
|
||||
Reference in New Issue
Block a user