use of com.enonic.xp.data.PropertySet in project xp by enonic.
the class ScheduleAuditLogSupportImpl method doCreate.
private void doCreate(final CreateScheduledJobParams params, final ScheduledJob job, final Context rootContext) {
final PropertyTree data = new PropertyTree();
final PropertySet paramsSet = data.addSet("params");
final PropertySet resultSet = data.addSet("result");
addParams(paramsSet, params);
addResult(resultSet, job);
log("system.job.create", data, job.getName(), rootContext);
}
use of com.enonic.xp.data.PropertySet in project xp by enonic.
the class ScheduleAuditLogSupportImpl method doDelete.
private void doDelete(final ScheduledJobName name, final boolean result, final Context rootContext) {
final PropertyTree data = new PropertyTree();
final PropertySet paramsSet = data.addSet("params");
final PropertySet resultSet = data.addSet("result");
paramsSet.addString("name", name.getValue());
resultSet.addString("name", name.getValue());
resultSet.addBoolean("value", result);
log("system.job.delete", data, name, rootContext);
}
use of com.enonic.xp.data.PropertySet in project xp by enonic.
the class SchedulerServiceActivatorTest method mockNode.
private void mockNode(final CreateScheduledJobParams params) {
final PropertyTree jobData = new PropertyTree();
final PropertySet calendar = new PropertySet();
calendar.addString(ScheduledJobPropertyNames.CALENDAR_TYPE, params.getCalendar().getType().name());
calendar.addString(ScheduledJobPropertyNames.CALENDAR_VALUE, ((CronCalendar) params.getCalendar()).getCronValue());
calendar.addString(ScheduledJobPropertyNames.CALENDAR_TIMEZONE, ((CronCalendar) params.getCalendar()).getTimeZone().getID());
jobData.addString(ScheduledJobPropertyNames.DESCRIPTOR, params.getDescriptor().toString());
jobData.addBoolean(ScheduledJobPropertyNames.ENABLED, params.isEnabled());
jobData.addSet(ScheduledJobPropertyNames.CALENDAR, calendar);
jobData.addSet(ScheduledJobPropertyNames.CONFIG, params.getConfig().getRoot().copy(jobData));
jobData.setString(ScheduledJobPropertyNames.CREATOR, "user:system:creator");
jobData.setString(ScheduledJobPropertyNames.MODIFIER, "user:system:creator");
jobData.setString(ScheduledJobPropertyNames.CREATED_TIME, "2016-11-02T10:36:00Z");
jobData.setString(ScheduledJobPropertyNames.MODIFIED_TIME, "2016-11-02T10:36:00Z");
final Node job = Node.create().id(NodeId.from("abc")).name(params.getName().getValue()).parentPath(NodePath.ROOT).data(jobData).build();
when(nodeService.create(isA(CreateNodeParams.class))).thenReturn(job);
}
use of com.enonic.xp.data.PropertySet in project xp by enonic.
the class UpdateLastRunCommandTest method mockNode.
private Node mockNode() {
final PropertyTree jobData = new PropertyTree();
final PropertySet calendar = new PropertySet();
calendar.addString(ScheduledJobPropertyNames.CALENDAR_TYPE, "ONE_TIME");
calendar.addString(ScheduledJobPropertyNames.CALENDAR_VALUE, "2021-02-25T10:44:33.170079900Z");
jobData.addString(ScheduledJobPropertyNames.DESCRIPTOR, "app:key");
jobData.addBoolean(ScheduledJobPropertyNames.ENABLED, true);
jobData.addSet(ScheduledJobPropertyNames.CALENDAR, calendar);
jobData.addSet(ScheduledJobPropertyNames.CONFIG, new PropertySet());
jobData.setString(ScheduledJobPropertyNames.CREATOR, "user:system:creator");
jobData.setString(ScheduledJobPropertyNames.MODIFIER, "user:system:modifier");
jobData.setString(ScheduledJobPropertyNames.CREATED_TIME, "2021-02-26T10:44:33.170079900Z");
jobData.setString(ScheduledJobPropertyNames.MODIFIED_TIME, "2021-03-26T10:44:33.170079900Z");
return Node.create().id(NodeId.from("abc")).name("test").parentPath(NodePath.ROOT).data(jobData).build();
}
use of com.enonic.xp.data.PropertySet in project xp by enonic.
the class ScheduleAuditLogSupportImpl method addCalendar.
private void addCalendar(final PropertySet targetSet, final ScheduleCalendar calendar) {
final PropertySet calendarSet = new PropertySet();
switch(calendar.getType()) {
case CRON:
final CronCalendar cronCalendar = ((CronCalendar) calendar);
calendarSet.setString(ScheduledJobPropertyNames.CALENDAR_VALUE, cronCalendar.getCronValue());
calendarSet.setString(ScheduledJobPropertyNames.CALENDAR_TIMEZONE, cronCalendar.getTimeZone().getID());
calendarSet.setString(ScheduledJobPropertyNames.CALENDAR_TYPE, ScheduleCalendarType.CRON.name());
break;
case ONE_TIME:
final OneTimeCalendar oneTimeCalendar = ((OneTimeCalendar) calendar);
calendarSet.setString(ScheduledJobPropertyNames.CALENDAR_VALUE, oneTimeCalendar.getValue().toString());
calendarSet.setString(ScheduledJobPropertyNames.CALENDAR_TYPE, ScheduleCalendarType.ONE_TIME.name());
break;
default:
throw new IllegalStateException(String.format("invalid calendar type: '%s'", calendar.getType()));
}
targetSet.setSet(ScheduledJobPropertyNames.CALENDAR, calendarSet);
}
Aggregations