private File unzipFile(final File archiveFile) throws IOException { final ZipFile zipfile = new ZipFile(archiveFile); final File unzipped = Utils.createTempDir(this.tempDir); Utils.unzip(zipfile, unzipped); zipfile.close(); return unzipped; }
public TriggerAction createAction(final String type, final Object... args) { TriggerAction action = null; final Class<? extends TriggerAction> actionClass = actionToClass.get(type); action = (TriggerAction) Utils.callConstructor(actionClass, args); return action; }
@Override public Object toJson() { final Map<String, Object> jsonObj = new HashMap<>(); jsonObj.put("type", type); jsonObj.put("firstCheckTime", String.valueOf(this.firstCheckTime)); jsonObj.put("timezone", this.timezone.getID()); jsonObj.put("nextCheckTime", String.valueOf(this.nextCheckTime)); jsonObj.put("isRecurring", String.valueOf(this.isRecurring)); jsonObj.put("skipPastChecks", String.valueOf(this.skipPastChecks)); jsonObj.put("period", Utils.createPeriodString(this.period)); jsonObj.put("id", this.id); jsonObj.put("cronExpression", this.cronExpression); return jsonObj; }
public static Object callConstructor(final Class<?> c, final Object... args) { return callConstructor(c, getTypes(args), args); }
public static File createTempDir() { return createTempDir(new File(System.getProperty("java.io.tmpdir"))); }
public static BasicTimeChecker createFromJson(final HashMap<String, Object> obj) throws Exception { final Map<String, Object> jsonObj = (HashMap<String, Object>) obj; if (!jsonObj.get("type").equals(type)) { throw new Exception("Cannot create checker of " + type + " from " + jsonObj.get("type")); } final Long firstCheckTime = Long.valueOf((String) jsonObj.get("firstCheckTime")); final String timezoneId = (String) jsonObj.get("timezone"); final long nextCheckTime = Long.valueOf((String) jsonObj.get("nextCheckTime")); final DateTimeZone timezone = DateTimeZone.forID(timezoneId); final boolean isRecurring = Boolean.valueOf((String) jsonObj.get("isRecurring")); final boolean skipPastChecks = Boolean.valueOf((String) jsonObj.get("skipPastChecks")); final ReadablePeriod period = Utils.parsePeriodString((String) jsonObj.get("period")); final String id = (String) jsonObj.get("id"); final String cronExpression = (String) jsonObj.get("cronExpression"); final BasicTimeChecker checker = new BasicTimeChecker(id, firstCheckTime, timezone, nextCheckTime, isRecurring, skipPastChecks, period, cronExpression); if (skipPastChecks) { checker.updateNextCheckTime(); } return checker; }
message.println("<tr><td>" + sdf.format(new Date(triggerInst.getEndTime())) + "</td><td>"); message.println("<tr><td>Duration</td><td>" + Utils.formatDuration(triggerInst.getStartTime(), triggerInst.getEndTime()) + "</td></tr>"); message.println("<tr><td>Status</td><td>" + triggerInst.getStatus() + "</td></tr>");
@Override public String toString() { return Utils.flattenToString(this.permissions, ","); }
public TriggerAction createActionFromJson(final String type, final Object obj) throws Exception { TriggerAction action = null; final Class<? extends TriggerAction> actionClass = actionToClass.get(type); if (actionClass == null) { throw new Exception("Action Type " + type + " not supported!"); } action = (TriggerAction) Utils.invokeStaticMethod(actionClass.getClassLoader(), actionClass.getName(), "createFromJson", obj); return action; }
public BasicTimeChecker(final String id, final long firstCheckTime, final DateTimeZone timezone, final long nextCheckTime, final boolean isRecurring, final boolean skipPastChecks, final ReadablePeriod period, final String cronExpression) { this.id = id; this.firstCheckTime = firstCheckTime; this.timezone = timezone; this.nextCheckTime = nextCheckTime; this.isRecurring = isRecurring; this.skipPastChecks = skipPastChecks; this.period = period; this.cronExpression = cronExpression; this.cronExecutionTime = Utils.parseCronExpression(cronExpression, timezone); }
logger.info("Downloading zip file."); ZipFile zip = new ZipFile(projectFileHandler.getLocalFile()); Utils.unzip(zip, tempDir);
x = Utils.convertToDouble(layoutInfo.get("x")); y = Utils.convertToDouble(layoutInfo.get("y")); level = (Integer) layoutInfo.get("level"); } catch (final ClassCastException e) {
final File tempDir = Utils.createTempDir(); OutputStream out = null; try {
public static Object callConstructor(Class<?> c, Object... args) { return callConstructor(c, getTypes(args), args); }
if (this.checkTime < flow.getStartTime()) { final ReadablePeriod duration = Utils.parsePeriodString((String) this.slaOption.getInfo().get( SlaOption.INFO_DURATION)); final DateTime startTime = new DateTime(flow.getStartTime()); if (this.checkTime < flow.getStartTime()) { final ReadablePeriod duration = Utils.parsePeriodString((String) this.slaOption.getInfo().get( SlaOption.INFO_DURATION)); final DateTime startTime = new DateTime(flow.getStartTime()); Utils.parsePeriodString((String) this.slaOption.getInfo().get( SlaOption.INFO_DURATION)); final DateTime startTime = new DateTime(node.getStartTime()); Utils.parsePeriodString((String) this.slaOption.getInfo().get( SlaOption.INFO_DURATION)); final DateTime startTime = new DateTime(node.getStartTime());
+ convertMSToString(flow.getEndTime()) + "</td></tr>"); message.println("<tr><td>Duration</td><td>" + Utils.formatDuration(flow.getStartTime(), flow.getEndTime()) + "</td></tr>"); message.println("<tr><td>Status</td><td>" + flow.getStatus() + "</td></tr>");
page.add("admins", Utils.flattenToString( project.getUsersWithPermission(Type.ADMIN), ",")); final Permission perm = this.getPermissionObject(project, user, Type.ADMIN);
public ConditionChecker createCheckerFromJson(final String type, final Object obj) throws Exception { ConditionChecker checker = null; final Class<? extends ConditionChecker> checkerClass = checkerToClass.get(type); if (checkerClass == null) { throw new Exception("Checker type " + type + " not supported!"); } checker = (ConditionChecker) Utils.invokeStaticMethod( checkerClass.getClassLoader(), checkerClass.getName(), "createFromJson", obj); return checker; }
public BasicTimeChecker(final String id, final long firstCheckTime, final DateTimeZone timezone, final boolean isRecurring, final boolean skipPastChecks, final ReadablePeriod period, final String cronExpression) { this.id = id; this.firstCheckTime = firstCheckTime; this.timezone = timezone; this.isRecurring = isRecurring; this.skipPastChecks = skipPastChecks; this.period = period; this.nextCheckTime = firstCheckTime; this.cronExpression = cronExpression; this.cronExecutionTime = Utils.parseCronExpression(cronExpression, timezone); this.nextCheckTime = calculateNextCheckTime(); }
x = Utils.convertToDouble(layoutInfo.get("x")); y = Utils.convertToDouble(layoutInfo.get("y")); level = (Integer)layoutInfo.get("level");