/** {@inheritDoc} */ @Override public void from(io.cattle.platform.core.model.Credential from) { setId(from.getId()); setName(from.getName()); setAccountId(from.getAccountId()); setKind(from.getKind()); setUuid(from.getUuid()); setDescription(from.getDescription()); setState(from.getState()); setCreated(from.getCreated()); setRemoved(from.getRemoved()); setRemoveTime(from.getRemoveTime()); setData(from.getData()); setPublicValue(from.getPublicValue()); setSecretValue(from.getSecretValue()); setRegistryId(from.getRegistryId()); }
@Override public HandlerResult handle(ProcessState state, ProcessInstance process) { Account account = (Account) state.getResource(); for (Certificate cert : getObjectManager().children(account, Certificate.class)) { if (cert.getRemoved() != null) { continue; } deactivateThenRemove(cert, state.getData()); } for (Credential cred : getObjectManager().children(account, Credential.class)) { if (cred.getRemoved() != null) { continue; } deactivateThenRemove(cred, state.getData()); } for (Host host : getObjectManager().children(account, Host.class)) { try { deactivateThenRemove(host, state.getData()); } catch (ProcessCancelException e) { // ignore } purge(host, null); } for (PhysicalHost host : getObjectManager().children(account, PhysicalHost.class)) { try { getObjectProcessManager().executeStandardProcess(StandardProcess.REMOVE, host, null); } catch (ProcessCancelException e) { // ignore } } for (Agent agent : getObjectManager().children(account, Agent.class)) { if (agent.getRemoved() != null) { continue; } deactivateThenRemove(agent, state.getData()); } for (Environment env : getObjectManager().children(account, Environment.class)) { if (env.getRemoved() != null) { continue; } objectProcessManager.scheduleStandardProcessAsync(StandardProcess.REMOVE, env, null); } for (Instance instance : instanceDao.listNonRemovedInstances(account, false)) { deleteAgentAccount(instance.getAgentId(), state.getData()); try { objectProcessManager.scheduleStandardProcess(StandardProcess.REMOVE, instance, null); } catch (ProcessCancelException e) { objectProcessManager.scheduleProcessInstance( InstanceConstants.PROCESS_STOP, instance, CollectionUtils.asMap(InstanceConstants.REMOVE_OPTION, true)); } } accountDao.deleteProjectMemberEntries(account); return null; }