hier mal ein kleines Skript, mit dem du in deinem Generierungsschedule eine Generierung bzw. einen Schedule in einem anderen Projekt starten kannst. (Zumindest bei mir lokal funktioniert das Skript
)
//!Beanshell
/**
* xxx
*
* @author Sandro Osswald - BridgingIT GmbH
* @vendor BridgingIT GmbH
*
* @version 1.0.0
*/
// ### Imports
import de.espirit.firstspirit.access.AdminService;
import de.espirit.firstspirit.access.ScriptContext;
import de.espirit.firstspirit.access.project.Project;
import de.espirit.firstspirit.access.schedule.ScheduleEntry;
import de.espirit.firstspirit.access.schedule.ScheduleEntryControl;
import de.espirit.firstspirit.access.schedule.ScheduleEntryRunningException;
// ### Constants
private final String remoteProjectNameProperty = "remoteProjectName";
private final String remoteScheduleNameProperty = "remoteScheduleName";
// ### Methods
private void printContextInformation() {
String[] properties = context.getProperties();
for (String property : properties) {
context.logInfo("Property: " + property);
context.logInfo("Value: " + context.getProperty(property));
}
}
private ScheduleEntry determineRemoteScheduleTask() {
String remoteProjectName = (String) context.getProperty(remoteProjectNameProperty);
String remoteScheduleName = (String) context.getProperty(remoteScheduleNameProperty);
Project remoteProject = context.getConnection().getProjectByName(remoteProjectName);
AdminService adminService = context.getConnection().getService(AdminService.class);
ScheduleEntry scheduleEntry = adminService.getScheduleStorage().getScheduleEntry(remoteProject, remoteScheduleName);
if (null == scheduleEntry) {
throw new NullPointerException(
"The remote project '" + remoteProjectName + "' does not contain a schedule entry named '" + remoteScheduleName + "'.");
}
return scheduleEntry;
}
private void startScheduleEntry(ScheduleEntry scheduleEntry) {
try {
ScheduleEntryControl scheduleEntryControl = scheduleEntry.execute();
while (!scheduleEntryControl.isRunning()) {
// NOP
scheduleEntryControl.refresh();
}
context.logInfo("RemoteMedia genaration was started. " + scheduleEntryControl.getStartTime());
while (scheduleEntryControl.isRunning()) {
// NOP
scheduleEntryControl.refresh();
}
scheduleEntryControl.refresh();
context.logInfo("RemoteMedia generation was finished. " + scheduleEntryControl.getFinishTime());
} catch (ScheduleEntryRunningException e) {
context.logError("ScheduleEntry is already running on the server.", e);
}
}
// Skript
printContextInformation();
ScheduleEntry scheduleEntry = determineRemoteScheduleTask();
startScheduleEntry(scheduleEntry);
In den Properties dieses Tasks können die Werte für das Remote-Projekt und den darin enthaltenen Schedule konfiguriert werden.