package _VisualDVM.Passes.Server; import Common.Database.Objects.riDBObject; import _VisualDVM.Current; import _VisualDVM.Global; import _VisualDVM.Repository.RepositoryServer; public abstract class CloneServerObject extends PublishServerObject { public D src; public CloneServerObject(S server_in, Class d_in) { super(server_in, d_in); } @Override public String getIconPath() { return "/icons/MultiFiles.png"; } @Override public String getDescription_() { return "дублирование"; } protected abstract Current currentName(); @Override protected boolean canStart(Object... args) throws Exception { src = null; if (!Global.mainModule.Check(Log, currentName())) return false; //--------- pk = null; if (Global.mainModule.getAccount().CheckRegistered(Log)) { target = d.newInstance(); target.SynchronizeFields(src = (D) Global.mainModule.get(currentName())); //единственное отличие клона - текущий автор target.description += " копия"; target.sender_name = Global.mainModule.getAccount().name; target.sender_address = Global.mainModule.getAccount().email; return true; } return false; } }