@Override
  public void create(
      final Package pkg, final String baseFileName, final NewResourcePresenter presenter) {
    busyIndicatorView.showBusyIndicator(ScoreCardXLSEditorConstants.INSTANCE.Uploading());

    final Path path = pkg.getPackageMainResourcesPath();
    final String fileName = buildFileName(resourceType, baseFileName);
    final Path newPath =
        PathFactory.newPath(
            path.getFileSystem(), fileName, URL.encode(path.toURI() + "/" + fileName));

    uploadWidget.submit(
        path,
        fileName,
        URLHelper.getServletUrl(),
        new Command() {

          @Override
          public void execute() {
            busyIndicatorView.hideBusyIndicator();
            presenter.complete();
            notifySuccess();
            final PlaceRequest place = new PathPlaceRequest(newPath);
            placeManager.goTo(place);
          }
        },
        new Command() {

          @Override
          public void execute() {
            busyIndicatorView.hideBusyIndicator();
          }
        });
  }
Пример #2
0
 @Override
 public Path copy(final Path path, final String newName, final String comment) {
   System.out.println(
       "USER:"******" COPYING asset ["
           + path.getFileName()
           + "] to ["
           + newName
           + "]");
   String targetName =
       path.getFileName().substring(0, path.getFileName().lastIndexOf("/") + 1) + newName;
   String targetURI = path.toURI().substring(0, path.toURI().lastIndexOf("/") + 1) + newName;
   Path targetPath = PathFactory.newPath(path.getFileSystem(), targetName, targetURI);
   ioService.copy(
       paths.convert(path),
       paths.convert(targetPath),
       new CommentedOption(identity.getName(), comment));
   return targetPath;
 }