Search in sources :

Example 1 with DirectFileImportCommand

use of org.structr.web.maintenance.DirectFileImportCommand in project structr by structr.

the class DirectFileImportConsoleCommand method run.

@Override
public void run(final SecurityContext securityContext, final List<String> parameters, final Writable writable) throws FrameworkException, IOException {
    final Principal user = securityContext.getUser(false);
    if (user != null && user.isAdmin()) {
        final DirectFileImportCommand cmd = StructrApp.getInstance(securityContext).command(DirectFileImportCommand.class);
        cmd.setLogBuffer(writable);
        cmd.execute(toMap("source", getParameter(parameters, 1), "target", getParameter(parameters, 2), "mode", getParameter(parameters, 3), "existing", getParameter(parameters, 4), "index", getParameter(parameters, 5)));
    } else {
        writable.println("You must be admin user to use this command.");
    }
}
Also used : DirectFileImportCommand(org.structr.web.maintenance.DirectFileImportCommand) Principal(org.structr.core.entity.Principal)

Aggregations

Principal (org.structr.core.entity.Principal)1 DirectFileImportCommand (org.structr.web.maintenance.DirectFileImportCommand)1