2024-10-14 12:14:01 +03:00
|
|
|
package _VisualDVM.Passes.Server;
|
2024-10-07 00:58:29 +03:00
|
|
|
import Common.Database.Objects.DBObject;
|
|
|
|
|
import Common.Database.Objects.riDBObject;
|
2024-10-13 22:08:13 +03:00
|
|
|
import _VisualDVM.Global;
|
2024-10-09 22:21:57 +03:00
|
|
|
import _VisualDVM.Repository.RepositoryServer;
|
|
|
|
|
import _VisualDVM.Repository.Server.ServerCode;
|
|
|
|
|
import _VisualDVM.Repository.Server.ServerExchangeUnit_2021;
|
2023-11-20 00:15:22 +03:00
|
|
|
public class PublishServerObject<S extends RepositoryServer, D extends DBObject> extends ServerObjectPass<S, D> {
|
|
|
|
|
public Object pk = null;
|
2023-11-16 16:20:20 +03:00
|
|
|
public PublishServerObject(S server_in, Class<D> d_in) {
|
|
|
|
|
super(server_in, d_in);
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
public String getIconPath() {
|
|
|
|
|
return "/icons/RedAdd.png";
|
|
|
|
|
}
|
|
|
|
|
//--
|
|
|
|
|
@Override
|
|
|
|
|
protected boolean canStart(Object... args) throws Exception {
|
2023-11-17 00:58:58 +03:00
|
|
|
pk = null;
|
2024-10-13 22:08:13 +03:00
|
|
|
if (Global.mainModule.getAccount().CheckRegistered(Log)) {
|
2023-11-16 16:20:20 +03:00
|
|
|
target = d.newInstance();
|
2023-11-20 00:15:22 +03:00
|
|
|
if (target instanceof riDBObject) {
|
|
|
|
|
riDBObject rTarget = (riDBObject) target;
|
2024-10-13 22:08:13 +03:00
|
|
|
rTarget.sender_name = Global.mainModule.getAccount().name;
|
|
|
|
|
rTarget.sender_address = Global.mainModule.getAccount().email;
|
2023-11-20 00:15:22 +03:00
|
|
|
}
|
2023-11-16 16:20:20 +03:00
|
|
|
return fillObjectFields();
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2023-11-21 17:44:59 +03:00
|
|
|
protected String getEmail(){return null;}
|
2023-11-16 16:20:20 +03:00
|
|
|
//--
|
|
|
|
|
@Override
|
|
|
|
|
protected void ServerAction() throws Exception {
|
2023-11-21 17:44:59 +03:00
|
|
|
Command(new ServerExchangeUnit_2021(ServerCode.PublishObject, getEmail(), target));
|
2023-11-17 00:58:58 +03:00
|
|
|
pk = response.object;
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
protected void showDone() throws Exception {
|
|
|
|
|
super.showDone();
|
|
|
|
|
getDb().tables.get(d).ui_.Show(pk);
|
2023-11-16 16:20:20 +03:00
|
|
|
}
|
|
|
|
|
}
|