Package plugins.Freetalk.tasks.WoT

Examples of plugins.Freetalk.tasks.WoT.IntroduceIdentityTask


      addFreetalkContext(newIdentity);
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
     
    PersistentTask introductionTask = new IntroduceIdentityTask((WoTOwnIdentity)newIdentity);
    mFreetalk.getTaskManager().storeTaskWithoutCommit(introductionTask);
   
    doNewOwnIdentityCallbacks(newIdentity);
    onShouldFetchStateChanged(newIdentity, false, true);
  }
View Full Code Here


    super(myWebInterface, viewer, request, _baseL10n);
   
    mIdentityManager = (WoTIdentityManager)mFreetalk.getIdentityManager();
   
    synchronized(mFreetalk.getTaskManager()) {
      IntroduceIdentityTask myTask;
     
      try {
        myTask = (IntroduceIdentityTask)mFreetalk.getTaskManager().getTask(mTaskID);
      } catch(NoSuchTaskException e) {
        throw new IllegalArgumentException(e);
      }
     
      if(request.isPartSet("Postpone")) {
        myTask.onHideForSomeTime();
        mNumberOfPuzzles = 0;
        mWasPostponed = true;
        return;
      } else
        mWasPostponed = false;
     
      if(!request.isPartSet("SolvePuzzles")) {
        // We received an invalid request
        mNumberOfPuzzles = 0;
        return;
      }

      int idx = 0;

      while(request.isPartSet("PuzzleID" + idx)) {
        String id = request.getPartAsString("PuzzleID" + idx, 128);
        String solution = request.getPartAsString("Solution" + id, 32); /* TODO: replace "32" with the maximal solution length */

        if(!solution.trim().equals("")) {

          try {
            mIdentityManager.solveIntroductionPuzzle((WoTOwnIdentity)mOwnIdentity, id, solution);

            myTask.onPuzzleSolved();
          }
          catch(Exception e) {
            /* The identity or the puzzle might have been deleted here */
            Logger.error(this, "solveIntroductionPuzzle() failed", e);
          }
        }
        ++idx;
      }
     
      mNumberOfPuzzles = myTask.getNumberOfPuzzlesToSolve();
    }
  }
View Full Code Here

TOP

Related Classes of plugins.Freetalk.tasks.WoT.IntroduceIdentityTask

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.