Files
VisualSapfor/src/Visual_DVM_2021/Passes/Server/CloneServerObject.java

36 lines
1.3 KiB
Java
Raw Normal View History

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