public boolean executeJob(ZCDeployJobSchema job) { ZCDeployConfigSchema config = new ZCDeployConfigSchema(); config.setID(job.getConfigID()); if (!config.fill()) { return false; } return executeJob(config, job); }
public boolean addOneJob(long configID, boolean immediate) { ZCDeployJobSchema job = new ZCDeployJobSchema(); ZCDeployConfigSchema config = new ZCDeployConfigSchema(); config.setID(configID); if (!config.fill()) { return false; } String staticDir = Config.getContextRealPath() + Config.getValue("Statical.TargetDir").replace('\\', '/'); String sourcePath = staticDir + "/" + ApplicationPage.getCurrentSiteAlias() + config.getSourceDir(); job.setID(NoUtil.getMaxID("DeployJobID")); job.setConfigID(config.getID()); job.setSource(sourcePath); job.setMethod(config.getMethod()); String targetDir = config.getTargetDir(); if (XString.isEmpty(targetDir)) { targetDir = "/"; } else if (!targetDir.endsWith("/")) { targetDir = targetDir + "/"; } job.setTarget(targetDir); job.setSiteID(config.getSiteID()); job.setHost(config.getHost()); job.setPort(config.getPort()); job.setUserName(config.getUserName()); job.setPassword(config.getPassword()); job.setStatus(0L); job.setAddTime(new Date()); job.setAddUser(User.getUserName()); Transaction trans = new Transaction(); trans.add(job, OperateType.INSERT); if (trans.commit()) { if (immediate) { executeJob(config, job); } return true; } LogUtil.getLogger().info("添加部署任务时,数据库操作失败"); return false; }