public Integer getAppDurationSecond() { if (null == durationValueSecond) { durationValueSecond = 0; Tree drugAppT = getParentT().getParentT().getDrugAppT(); if (null != drugAppT) { App appO = drugAppT.getAppO(); durationValueSecond = appO.getDurationValue(); if ("min".equals(appO.getUnit())) durationValueSecond *= 60; if ("h".equals(appO.getUnit())) durationValueSecond *= 60 * 60; if ("d".equals(appO.getUnit())) durationValueSecond *= 60 * 60 * 24; } } return durationValueSecond; }
public void setTsEnd() { for (Tree appT : timesT.getParentT().getParentT().getChildTs()) if (appT.getMtlO() instanceof App) this.appT = appT; duration = TsTask._1s; if (appT != null) { App appO = (App) appT.getMtlO(); int hms = TsTask._1s; if (appO.getUnit().equals("h")) hms = TsTask._1h; else if (appO.getUnit().equals("min")) hms = TsTask._1m; Integer appValue = 1; if (appO.getAppapp() != null) appValue = appO.getAppapp(); duration = appValue * hms; } MObject timesO = timesT.getMtlO(); if (timesO != null && timesO instanceof Times && TsTask.apporder_endBeforeBegin.equals(((Times) timesO).getApporder())) { this.tsEnd = new Timestamp(ts.getTime()); this.ts = new Timestamp(tsEnd.getTime() - duration); } else { this.tsEnd = new Timestamp(ts.getTime() + duration); } }