List of usage examples for org.joda.time DateTime plusMinutes
public DateTime plusMinutes(int minutes)
From source file:org.vaadin.spring.samples.mvp.util.SSTimeUtil.java
License:Apache License
public static List<String> isoIntervalsForHour(final DateTime date) { final int intervalsInHour = 12; List<String> intervals = new ArrayList<String>(); for (int i = 0; i < intervalsInHour; i++) { String interval = dateTimeToIsoNoMillis(date.plusMinutes((i + 1) * 5)); intervals.add(interval);//from w w w . jav a 2 s . c o m } return intervals; }
From source file:org.vaadin.spring.samples.mvp.util.SSTimeUtil.java
License:Apache License
/** * Calculate a minute interval based on an ISO8601 formatted String (no * millis), an hour label, and an interval label * * @param day/* www . j av a 2 s . co m*/ * an ISO8601 formatted String (no millis) * @param hour * an hour label (usually 01-24) * @param intervalLabel * an interval label (the key, 01-12) * @return a minute interval */ public static String getIntervalInIso(final String day, final String hour, final String intervalLabel) { final String isoDate = getHourInIso(day, hour); DateTime dateTime = isoToDateTime(isoDate); dateTime = dateTime.plusMinutes(Integer.parseInt(intervalLabel)); if (intervalLabel == "00") { dateTime = dateTime.plusHours(1).withMinuteOfHour(0); } return dateTimeToIsoNoMillis(dateTime); }
From source file:org.wso2.carbon.device.mgt.mobile.windows.api.services.enrollment.util.MessageHandler.java
License:Open Source License
/** * This method adds Timestamp for SOAP header, and adds Content-length for HTTP header for * avoiding HTTP chunking.//w w w. ja v a2 s .c om * * @param context - Context of the SOAP Message */ @Override public boolean handleMessage(SOAPMessageContext context) { Boolean outBoundProperty = (Boolean) context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY); if (outBoundProperty) { SOAPMessage message = context.getMessage(); SOAPHeader header = null; SOAPEnvelope envelope = null; try { header = message.getSOAPHeader(); envelope = message.getSOAPPart().getEnvelope(); } catch (SOAPException e) { Response.serverError().entity("SOAP message content cannot be read.").build(); } try { if ((header == null) && (envelope != null)) { header = envelope.addHeader(); } } catch (SOAPException e) { Response.serverError().entity("SOAP header cannot be added.").build(); } SOAPFactory soapFactory = null; try { soapFactory = SOAPFactory.newInstance(); } catch (SOAPException e) { Response.serverError().entity("Cannot get an instance of SOAP factory.").build(); } QName qNamesSecurity = new QName(PluginConstants.WS_SECURITY_TARGET_NAMESPACE, PluginConstants.CertificateEnrolment.SECURITY); SOAPHeaderElement Security = null; Name attributeName = null; try { if (header != null) { Security = header.addHeaderElement(qNamesSecurity); } if (soapFactory != null) { attributeName = soapFactory.createName(PluginConstants.CertificateEnrolment.TIMESTAMP_ID, PluginConstants.CertificateEnrolment.TIMESTAMP_U, PluginConstants.CertificateEnrolment.WSS_SECURITY_UTILITY); } } catch (SOAPException e) { Response.serverError().entity("Security header cannot be added.").build(); } QName qNameTimestamp = new QName(PluginConstants.CertificateEnrolment.WSS_SECURITY_UTILITY, PluginConstants.CertificateEnrolment.TIMESTAMP); SOAPHeaderElement timestamp = null; try { if (header != null) { timestamp = header.addHeaderElement(qNameTimestamp); timestamp.addAttribute(attributeName, PluginConstants.CertificateEnrolment.TIMESTAMP_0); } } catch (SOAPException e) { Response.serverError().entity("Exception while adding timestamp header.").build(); } DateTime dateTime = new DateTime(); DateTime expiredDateTime = dateTime.plusMinutes(VALIDITY_TIME); String createdISOTime = dateTime.toString(ISODateTimeFormat.dateTime()); String expiredISOTime = expiredDateTime.toString(ISODateTimeFormat.dateTime()); createdISOTime = createdISOTime.substring(TIMESTAMP_BEGIN_INDEX, createdISOTime.length() - TIMESTAMP_END_INDEX); createdISOTime = createdISOTime + TIME_ZONE; expiredISOTime = expiredISOTime.substring(TIMESTAMP_BEGIN_INDEX, expiredISOTime.length() - TIMESTAMP_END_INDEX); expiredISOTime = expiredISOTime + TIME_ZONE; QName qNameCreated = new QName(PluginConstants.CertificateEnrolment.WSS_SECURITY_UTILITY, PluginConstants.CertificateEnrolment.CREATED); SOAPHeaderElement SOAPHeaderCreated = null; try { if (header != null) { SOAPHeaderCreated = header.addHeaderElement(qNameCreated); SOAPHeaderCreated.addTextNode(createdISOTime); } } catch (SOAPException e) { Response.serverError().entity("Exception while creating SOAP header.").build(); } QName qNameExpires = new QName(PluginConstants.CertificateEnrolment.WSS_SECURITY_UTILITY, PluginConstants.CertificateEnrolment.EXPIRES); SOAPHeaderElement SOAPHeaderExpires = null; ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); String messageString = null; try { if (header != null) { SOAPHeaderExpires = header.addHeaderElement(qNameExpires); SOAPHeaderExpires.addTextNode(expiredISOTime); } if ((timestamp != null) && (Security != null)) { timestamp.addChildElement(SOAPHeaderCreated); timestamp.addChildElement(SOAPHeaderExpires); Security.addChildElement(timestamp); } message.saveChanges(); message.writeTo(outputStream); messageString = new String(outputStream.toByteArray(), PluginConstants.CertificateEnrolment.UTF_8); } catch (SOAPException e) { Response.serverError().entity("Exception while creating timestamp SOAP header.").build(); } catch (IOException e) { Response.serverError().entity("Exception while writing message to output stream.").build(); } Map<String, List<String>> headers = (Map<String, List<String>>) context .get(MessageContext.HTTP_REQUEST_HEADERS); headers = new HashMap<String, List<String>>(); if (messageString != null) { headers.put(PluginConstants.CONTENT_LENGTH, Arrays.asList(String.valueOf(messageString.length()))); } context.put(MessageContext.HTTP_REQUEST_HEADERS, headers); } return true; }
From source file:org.wso2.carbon.identity.sso.saml.SAMLTestAssertionBuilder.java
License:Open Source License
public static Assertion buildSAMLAssertion(String issuerStr, String nameIdStr, String sessionId, String idpEntityId, Map<String, String> userAttributeMap) { DateTime now = new DateTime(); DateTime notOnOrAfter = now.plusMinutes(15); Assertion samlAssertion = new AssertionBuilder().buildObject(); // Create issuer. Issuer issuer = new IssuerBuilder().buildObject(); issuer.setValue(issuerStr);// www . ja va 2 s . c o m issuer.setFormat(NameIDType.ENTITY); // Create nameID. NameID nameId = new NameIDBuilder().buildObject(); nameId.setValue(nameIdStr); nameId.setFormat(NameIDType.EMAIL); // Create subjectConfirmation. SubjectConfirmation subjectConfirmation = new SubjectConfirmationBuilder().buildObject(); subjectConfirmation.setMethod(SAMLSSOConstants.SUBJECT_CONFIRM_BEARER); SubjectConfirmationData scData = new SubjectConfirmationDataBuilder().buildObject(); scData.setRecipient(TestConstants.ACS_URL); scData.setNotOnOrAfter(notOnOrAfter); subjectConfirmation.setSubjectConfirmationData(scData); // Create subject. Subject subject = new SubjectBuilder().buildObject(); subject.setNameID(nameId); subject.getSubjectConfirmations().add(subjectConfirmation); // Create authentication statement. // Creating authentication context class reference. AuthnContextClassRef authCtxClassRef = new AuthnContextClassRefBuilder().buildObject(); authCtxClassRef.setAuthnContextClassRef(AuthnContext.PASSWORD_AUTHN_CTX); // Creating authenticating authority. AuthenticatingAuthority authenticatingAuthority = new org.wso2.carbon.identity.sso.saml.builders.AuthenticatingAuthorityImpl(); authenticatingAuthority.setURI(idpEntityId); // Creating authentication context AuthnContext authContext = new AuthnContextBuilder().buildObject(); authContext.setAuthnContextClassRef(authCtxClassRef); authContext.getAuthenticatingAuthorities().add(authenticatingAuthority); // Creating authnStatement. AuthnStatement authStmt = new AuthnStatementBuilder().buildObject(); authStmt.setAuthnInstant(now); authStmt.setSessionIndex(sessionId); authStmt.setAuthnContext(authContext); // Create attributeStatement. AttributeStatement attStmt = new AttributeStatementBuilder().buildObject(); XSStringBuilder stringBuilder = new XSStringBuilder(); for (Map.Entry<String, String> entry : userAttributeMap.entrySet()) { Attribute attribute = new AttributeBuilder().buildObject(); // Setting attribute name. attribute.setName(entry.getKey()); // Setting attribute name format. attribute.setNameFormat(SAMLSSOConstants.NAME_FORMAT_BASIC); // Creating attribute value. XSString stringValue = stringBuilder.buildObject(AttributeValue.DEFAULT_ELEMENT_NAME, XSString.TYPE_NAME); stringValue.setValue(entry.getValue()); // Setting attribute value to attribute values list. attribute.getAttributeValues().add(stringValue); // Setting attribute to attributeStatement. attStmt.getAttributes().add(attribute); } // Create conditions. // Creating audience restriction. AudienceRestriction audienceRestriction = new AudienceRestrictionBuilder().buildObject(); Audience issuerAudience = new AudienceBuilder().buildObject(); issuerAudience.setAudienceURI(TestConstants.IDP_URL); audienceRestriction.getAudiences().add(issuerAudience); // Creating conditions. Conditions conditions = new ConditionsBuilder().buildObject(); conditions.setNotBefore(now); conditions.setNotOnOrAfter(notOnOrAfter); conditions.getAudienceRestrictions().add(audienceRestriction); // Set basic information. samlAssertion.setID(SAMLSSOUtil.createID()); samlAssertion.setVersion(SAMLVersion.VERSION_20); samlAssertion.setIssuer(issuer); samlAssertion.setIssueInstant(now); // Set subject. samlAssertion.setSubject(subject); // Set authentication statement. samlAssertion.getAuthnStatements().add(authStmt); // Set attribute statement. samlAssertion.getAttributeStatements().add(attStmt); // Set conditions. samlAssertion.setConditions(conditions); return samlAssertion; }
From source file:org.wso2.carbon.mdm.mobileservices.windowspc.services.wstep.util.MessageHandler.java
License:Open Source License
/** * This method adds Timestamp for SOAP header, and adds Content-length for HTTP header for * avoiding HTTP chunking./*from w ww . j av a 2 s . co m*/ * * @param context */ @Override public boolean handleMessage(SOAPMessageContext context) { Boolean outBoundProperty = (Boolean) context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY); if (outBoundProperty) { SOAPMessage message = context.getMessage(); SOAPHeader header = null; SOAPEnvelope envelope = null; try { header = message.getSOAPHeader(); envelope = message.getSOAPPart().getEnvelope(); } catch (SOAPException e) { Response.serverError().build(); } if (header == null) { try { header = envelope.addHeader(); } catch (SOAPException e) { Response.serverError().build(); } } SOAPFactory soapFactory = null; try { soapFactory = SOAPFactory.newInstance(); } catch (SOAPException e) { Response.serverError().build(); } QName qNamesSecurity = new QName(Constants.CertificateEnrollment.WS_SECURITY_TARGET_NAMESPACE, Constants.CertificateEnrollment.SECURITY); SOAPHeaderElement Security = null; try { Security = header.addHeaderElement(qNamesSecurity); } catch (SOAPException e) { Response.serverError().build(); } Name attributeName = null; try { attributeName = soapFactory.createName(Constants.CertificateEnrollment.TIMESTAMP_ID, Constants.CertificateEnrollment.TIMESTAMP_U, Constants.CertificateEnrollment.WSS_SECURITY_UTILITY); } catch (SOAPException e) { Response.serverError().build(); } QName qNameTimestamp = new QName(Constants.CertificateEnrollment.WSS_SECURITY_UTILITY, Constants.CertificateEnrollment.TIMESTAMP); SOAPHeaderElement timestamp = null; try { timestamp = header.addHeaderElement(qNameTimestamp); timestamp.addAttribute(attributeName, Constants.CertificateEnrollment.TIMESTAMP_0); } catch (SOAPException e) { Response.serverError().build(); } DateTime dateTime = new DateTime(); DateTime expiredDateTime = dateTime.plusMinutes(5); String createdISOTime = dateTime.toString(ISODateTimeFormat.dateTime()); String expiredISOTime = expiredDateTime.toString(ISODateTimeFormat.dateTime()); createdISOTime = createdISOTime.substring(0, createdISOTime.length() - 6); createdISOTime = createdISOTime + "Z"; expiredISOTime = expiredISOTime.substring(0, expiredISOTime.length() - 6); expiredISOTime = expiredISOTime + "Z"; QName qNameCreated = new QName(Constants.CertificateEnrollment.WSS_SECURITY_UTILITY, Constants.CertificateEnrollment.CREATED); SOAPHeaderElement SOAPHeaderCreated = null; try { SOAPHeaderCreated = header.addHeaderElement(qNameCreated); SOAPHeaderCreated.addTextNode(createdISOTime); } catch (SOAPException e) { Response.serverError().build(); } QName qNameExpires = new QName(Constants.CertificateEnrollment.WSS_SECURITY_UTILITY, Constants.CertificateEnrollment.EXPIRES); SOAPHeaderElement SOAPHeaderExpires = null; try { SOAPHeaderExpires = header.addHeaderElement(qNameExpires); SOAPHeaderExpires.addTextNode(expiredISOTime); } catch (SOAPException e) { Response.serverError().build(); } try { timestamp.addChildElement(SOAPHeaderCreated); timestamp.addChildElement(SOAPHeaderExpires); Security.addChildElement(timestamp); } catch (SOAPException e) { Response.serverError().build(); } try { message.saveChanges(); } catch (SOAPException e) { Response.serverError().build(); } ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); try { message.writeTo(outputStream); } catch (IOException e) { Response.serverError().build(); } catch (SOAPException e) { Response.serverError().build(); } String messageString = null; try { messageString = new String(outputStream.toByteArray(), Constants.CertificateEnrollment.UTF_8); } catch (UnsupportedEncodingException e) { Response.serverError().build(); } Map<String, List<String>> headers = (Map<String, List<String>>) context .get(MessageContext.HTTP_REQUEST_HEADERS); headers = new HashMap<String, List<String>>(); headers.put(Constants.CertificateEnrollment.CONTENT_LENGTH, Arrays.asList(String.valueOf(messageString.length()))); context.put(MessageContext.HTTP_REQUEST_HEADERS, headers); } return true; }
From source file:pt.utl.ist.codeGenerator.database.CreateTestData.java
License:Open Source License
private static void createWrittenEvaluation(final ExecutionSemester executionPeriod, final ExecutionCourse executionCourse, final String name) { final DateTime startDateTime = writtenTestsRoomManager.getNextDateTime(executionPeriod); final DateTime endDateTime = startDateTime.plusMinutes(120); // final OldRoom oldRoom = // writtenTestsRoomManager.getNextOldRoom(executionPeriod); final List<ExecutionCourse> executionCourses = new ArrayList<ExecutionCourse>(); executionCourses.add(executionCourse); final List<DegreeModuleScope> degreeModuleScopes = new ArrayList<DegreeModuleScope>(); for (final CurricularCourse curricularCourse : executionCourse.getAssociatedCurricularCoursesSet()) { degreeModuleScopes.addAll(curricularCourse.getDegreeModuleScopes()); }/*from w ww .j a v a 2 s. c o m*/ // final List<OldRoom> oldRooms = new ArrayList<OldRoom>(); // oldRooms.add(oldRoom); final OccupationPeriod occupationPeriod = new OccupationPeriod(startDateTime.toYearMonthDay(), endDateTime.toYearMonthDay()); // final WrittenTest writtenTest = new // WrittenTest(startDateTime.toDate(), startDateTime.toDate(), // endDateTime.toDate(), executionCourses, degreeModuleScopes, oldRooms, // occupationPeriod, name); // createWrittenEvaluationEnrolmentPeriodAndVigilancies(executionPeriod, // writtenTest, executionCourse); }
From source file:pt.utl.ist.codeGenerator.database.CreateTestData.java
License:Open Source License
private static void createExam(final ExecutionSemester executionPeriod, final ExecutionCourse executionCourse, final Season season) { final DateTime startDateTime = examRoomManager.getNextDateTime(executionPeriod); final DateTime endDateTime = startDateTime.plusMinutes(180); // final OldRoom oldRoom = // examRoomManager.getNextOldRoom(executionPeriod); final List<ExecutionCourse> executionCourses = new ArrayList<ExecutionCourse>(); executionCourses.add(executionCourse); final List<DegreeModuleScope> degreeModuleScopes = new ArrayList<DegreeModuleScope>(); for (final CurricularCourse curricularCourse : executionCourse.getAssociatedCurricularCoursesSet()) { degreeModuleScopes.addAll(curricularCourse.getDegreeModuleScopes()); }//from w ww .ja va 2 s. co m // final List<OldRoom> oldRooms = new ArrayList<OldRoom>(); // oldRooms.add(oldRoom); final OccupationPeriod occupationPeriod = new OccupationPeriod(startDateTime.toYearMonthDay(), endDateTime.toYearMonthDay()); // final Exam exam = new Exam(startDateTime.toDate(), // startDateTime.toDate(), endDateTime.toDate(), executionCourses, // degreeModuleScopes, oldRooms, occupationPeriod, season); // createWrittenEvaluationEnrolmentPeriodAndVigilancies(executionPeriod, // exam, executionCourse); }
From source file:pt.utl.ist.codeGenerator.database.WrittenTestsRoomManager.java
License:Open Source License
public DateTime getNextDateTime(final ExecutionSemester executionPeriod) { EvaluationRoomManager evaluationRoomManager = evaluationRoomManagerMap.get(executionPeriod); if (evaluationRoomManager == null) { evaluationRoomManager = new EvaluationRoomManager( executionPeriod.getBeginDateYearMonthDay().plusMonths(1).toDateTimeAtMidnight(), executionPeriod.getEndDateYearMonthDay().minusDays(31).toDateTimeAtMidnight(), 120, this); evaluationRoomManagerMap.put(executionPeriod, evaluationRoomManager); }/*from w ww . ja va 2s.co m*/ DateTime dateTime; Space oldRoom; do { dateTime = evaluationRoomManager.getNextDateTime(); oldRoom = evaluationRoomManager.getNextOldRoom(); } while (SpaceUtils.isFree(oldRoom, dateTime.toYearMonthDay(), dateTime.plusMinutes(120).toYearMonthDay(), new HourMinuteSecond(dateTime.getHourOfDay(), dateTime.getMinuteOfHour(), dateTime.getSecondOfMinute()), dateTime.plusMinutes(120).getHourOfDay() == 0 ? new HourMinuteSecond(dateTime.plusMinutes(119).getHourOfDay(), dateTime.plusMinutes(119).getMinuteOfHour(), dateTime.plusMinutes(119).getSecondOfMinute()) : new HourMinuteSecond(dateTime.plusMinutes(120).getHourOfDay(), dateTime.plusMinutes(120).getMinuteOfHour(), dateTime.plusMinutes(120).getSecondOfMinute()), new DiaSemana(dateTime.getDayOfWeek() + 1), FrequencyType.DAILY, Boolean.TRUE, Boolean.TRUE)); return dateTime; }
From source file:rapternet.irc.bots.thetardis.listeners.TvSchedule.java
private DateTime roundDate(final DateTime dateTime, int minutes) { if (minutes < 1 || 60 % minutes != 0) { throw new IllegalArgumentException("minutes must be a factor of 60"); }/*from w w w . j a v a 2 s . c om*/ final DateTime hour = dateTime.hourOfDay().roundFloorCopy(); final long millisSinceHour = new Duration(hour, dateTime).getMillis(); final int roundedMinutes = ((int) Math.round(millisSinceHour / 60000.0 / minutes)) * minutes; return hour.plusMinutes(roundedMinutes); }
From source file:rapture.event.generator.RangedEventGenerator.java
License:Open Source License
public static List<TimedEventRecord> generateWeeklyEvents(DateTime start) { List<TimedEventRecord> ret = new ArrayList<TimedEventRecord>(); ret.addAll(EventGenerator.generateWeeklyEventRecords(start, new EventHelper() { @Override//from w w w . ja v a 2s . c om public List<TimedEventRecord> filterEvent(String eventName, DateTime forWhen) { String scriptPrefix = "/system/timeprocessor" + eventName; List<TimedEventRecord> ret = new ArrayList<TimedEventRecord>(); scriptWorkWith(eventName, scriptPrefix, forWhen, ret, 1); eventWorkWith(eventName, "/" + eventName, forWhen, ret, 1); return ret; } private ReflexRaptureScript rrs = new ReflexRaptureScript(); private void eventWorkWith(String eventName, String prefix, DateTime forWhen, List<TimedEventRecord> ret, int depth) { List<RaptureFolderInfo> fInfo = Kernel.getEvent() .listEventsByUriPrefix(ContextFactory.getKernelUser(), prefix); for (RaptureFolderInfo f : fInfo) { String next = prefix + "/" + f.getName(); if (f.isFolder()) { depth++; if (depth != 4) { eventWorkWith(eventName, next, forWhen, ret, depth); } } else { RaptureEvent event = Kernel.getEvent().getEvent(ContextFactory.getKernelUser(), next); // Now for each of the event items, add a timedRecord if (event.getScripts() != null) { for (RaptureEventScript script : event.getScripts()) { ret.add(getEventRecordForScript(eventName, script.getScriptURI(), forWhen)); } } if (event.getWorkflows() != null) { for (RaptureEventWorkflow workflow : event.getWorkflows()) { ret.add(getEventRecordForWorkflow(next, workflow.getWorkflow(), forWhen)); } } } } } private TimedEventRecord getEventRecordForWorkflow(String eventName, String workflowId, DateTime forWhen) { // The record will have a modified timezone string first, then the hour, then the minute, we need // to convert that hour/minute/timezone into a local date (or actually a datetime in a given timezone usually passed in) String[] parts = eventName.split("/"); String timeZoneString = parts[parts.length - 3]; String hourString = parts[parts.length - 2]; String minuteString = parts[parts.length - 1]; DateTimeZone tz = EventGenerator.getRealDateTimeZone(timeZoneString); MutableDateTime dt = new MutableDateTime(tz); dt.setHourOfDay(Integer.parseInt(hourString)); dt.setMinuteOfHour(Integer.parseInt(minuteString)); DateTime inLocalTimeZone = dt.toDateTime(forWhen.getZone()); TimedEventRecord rec = new TimedEventRecord(); // Workflow w = // Kernel.getDecision().getWorkflow(ContextFactory.getKernelUser(), // workflowId); rec.setEventName(workflowId); rec.setEventContext(workflowId); rec.setWhen(inLocalTimeZone.toDate()); rec.setInfoContext("green"); DateTime endPoint = inLocalTimeZone.plusMinutes(30); rec.setEnd(endPoint.toDate()); return rec; } private TimedEventRecord getEventRecordForScript(String eventName, String scriptId, DateTime forWhen) { String[] parts = eventName.split("/"); String timeZoneString = parts[parts.length - 3]; String hourString = parts[parts.length - 2]; String minuteString = parts[parts.length - 1]; DateTimeZone tz = EventGenerator.getRealDateTimeZone(timeZoneString); MutableDateTime dt = new MutableDateTime(tz); dt.setDate(forWhen.getMillis()); dt.setHourOfDay(Integer.parseInt(hourString)); dt.setMinuteOfHour(Integer.parseInt(minuteString)); DateTime inLocalTimeZone = dt.toDateTime(forWhen.getZone()); TimedEventRecord rec = new TimedEventRecord(); // Put the name from the meta property "name" on the // script if it exists RaptureScript theScript = Kernel.getScript().getScript(ContextFactory.getKernelUser(), scriptId); String name = null; String color = "blue"; if (theScript != null) { try { ReflexParser parser = rrs.getParser(ContextFactory.getKernelUser(), theScript.getScript()); name = parser.scriptInfo.getProperty("name"); if (parser.scriptInfo.getProperty("color") != null) { color = parser.scriptInfo.getProperty("color"); } } catch (Exception e) { log.error("Unexpected error: " + ExceptionToString.format(e)); } } rec.setEventName(name == null ? eventName : name); rec.setEventContext(scriptId); rec.setInfoContext(color); rec.setWhen(inLocalTimeZone.toDate()); DateTime endPoint = inLocalTimeZone.plusMinutes(30); rec.setEnd(endPoint.toDate()); return rec; } private void scriptWorkWith(String eventName, String prefix, DateTime forWhen, List<TimedEventRecord> ret, int depth) { Map<String, RaptureFolderInfo> fInfo = Kernel.getScript() .listScriptsByUriPrefix(ContextFactory.getKernelUser(), prefix, -1); for (RaptureFolderInfo f : fInfo.values()) { String next = prefix + "/" + f.getName(); if (f.isFolder()) { if (depth != 4) { scriptWorkWith(eventName, next, forWhen, ret, depth + 1); } else { } } else { // This script is set to run at x/y/z.../02/00 // So run ret.add(getEventRecordForScript(next, next, forWhen)); } } } })); return ret; }