code: public void moveToState(State state) throws RepositoryBackendException, RepositoryResourceException {
          if (getState() == null) {
              return;
          }
          int counter = 0;
          while (getState() != state) {
              counter++;
              StateAction nextAction = getState().getNextAction(state);
              performLifeCycle(nextAction);
              if (counter >= 10) {
                  throw new RepositoryResourceLifecycleException("Unable to move to state " + state +
                                                                 " after 10 state transistion attempts. Resource left in state " + getState(), getId(), getState(), nextAction);
              }
          }
      }
docs: Moves the resource to the desired state
  
  @param resource
  @param state
  @throws RepositoryBackendException
  @throws RepositoryResourceException