no message
This commit is contained in:
@@ -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{
|
||||
|
||||
Reference in New Issue
Block a user