/** Updates the specified {@code project} with the given {@code commands}. */ private Promise<Void> updateProject(Project project, List<CommandImpl> commands) { MutableProjectConfig config = new MutableProjectConfig(project); Map<String, List<String>> attributes = config.getAttributes(); List<String> attrValue = new ArrayList<>(attributes.size()); for (CommandImpl command : commands) { CommandDto commandDto = dtoFactory .createDto(CommandDto.class) .withName(command.getName()) .withType(command.getType()) .withCommandLine(command.getCommandLine()) .withAttributes(command.getAttributes()); attrValue.add(dtoFactory.toJson(commandDto)); } attributes.put(COMMANDS_ATTRIBUTE_NAME, attrValue); return project.update().withBody(config).send().then((Function<Project, Void>) arg -> null); }
imports.add( startImport(Path.valueOf(projectConfig.getPath()), projectConfig.getSource()) .thenPromise(project -> project.update().withBody(projectConfig).send()));
.getWorkspaceRoot() .importProject() .withBody(importConfig) .send() .then(
.getWorkspaceRoot() .newProject() .withBody(dataObject) .send() .then(onComplete(callback)) .withBody(dataObject) .send() .then( ((Folder) container) .toProject() .withBody(dataObject) .send() .then(onComplete(callback)) .getWorkspaceRoot() .newProject() .withBody(dataObject) .send() .thenPromise(project -> project.update().withBody(dataObject).send()) .then(addCommands(callback)) .catchError(onFailure(callback));
.getWorkspaceRoot() .importProject() .withBody(importConfig) .send() .thenPromise(
.getWorkspaceRoot() .importProject() .withBody(importConfig) .send() .thenPromise(
private void importProject(Project project) { appContext .getWorkspaceRoot() .importProject() .withBody(project) .send() .then( new Operation<Project>() { @Override public void apply(Project project) throws OperationException { Log.info(getClass(), "Project " + project.getName() + " imported."); } }); } }
@Override public Promise<Project> apply(Project project) throws FunctionException { return project.update().withBody(projectConfig).send(); } }));