@Override
 protected void process(final ActivityInformation<MissionProcess> activityInformation) {
   final User user = Authenticate.getUser();
   final Person person = user.getPerson();
   final MissionProcess missionProcess = activityInformation.getProcess();
   missionProcess.unAllocateFunds(person);
 }
 @Override
 public boolean isActive(final MissionProcess missionProcess, final User user) {
   return super.isActive(missionProcess, user)
       && missionProcess.hasAnyAllocatedFunds()
       && ((!missionProcess.hasAnyAuthorization() && !missionProcess.hasCommitmentNumber())
           || missionProcess.getIsCanceled().booleanValue())
       && missionProcess.isAccountingEmployee(user.getExpenditurePerson());
 }
예제 #3
0
 @Override
 public boolean isActive(final MissionProcess missionProcess, final User user) {
   return super.isActive(missionProcess, user)
       && missionProcess.isApproved()
       && missionProcess.hasAllAllocatedFunds()
       && missionProcess.areAllParticipantsAuthorized()
       && missionProcess.isPendingAuthorizationBy(user)
   // && missionProcess.hasBeenCheckedByUnderlings()
   ;
 }
예제 #4
0
  @POST
  @Produces(JSON_UTF8)
  @Path("disconnectMissionProcess")
  public Response disconnectMissionProcess(
      @QueryParam("processNumber") String processNumber,
      @QueryParam("hostname") String hostname,
      @QueryParam("remoteProcessNumber") String remoteProcessNumber,
      @QueryParam("username") String username,
      @QueryParam("access_token") String access_token) {

    checkToken(access_token);
    login(User.findByUsername(username));
    try {
      final Mission mission = findMission(remoteProcessNumber);
      if (mission == null) {
        return respondWithError(Status.BAD_REQUEST, "bad.mission.number");
      } else {
        final MissionProcess missionProcess = mission.getMissionProcess();

        final RemoteMissionSystem remoteMissionSystem = RemoteMissionSystem.find(hostname);
        if (remoteMissionSystem == null) {
          return respondWithError(Status.NOT_ACCEPTABLE, "remote.host.not.configured");
        }

        for (final RemoteMissionProcess remoteMissionProcess :
            missionProcess.getRemoteMissionProcessSet()) {
          if (remoteMissionProcess.getRemoteMissionSystem() == remoteMissionSystem
              && remoteMissionProcess.getProcessNumber().equals(processNumber)) {
            final DisassociateMissionProcessActivity activity =
                (DisassociateMissionProcessActivity)
                    missionProcess.getActivity(DisassociateMissionProcessActivity.class);
            final DisassociateMissionProcessActivityInfo information =
                activity.getActivityInformation(missionProcess);
            information.setRemoteMissionProcess(remoteMissionProcess);
            information.setConnect(false);
            activity.execute(information);
          }
        }

        return Response.ok().build();
      }
    } finally {
      logout();
    }
  }
예제 #5
0
  @POST
  @Produces(JSON_UTF8)
  @Path("connectMissionProcess")
  public Response connectMissionProcess(
      @QueryParam("processNumber") String processNumber,
      @QueryParam("externalId") String externalId,
      @QueryParam("hostname") String hostname,
      @QueryParam("remoteProcessNumber") String remoteProcessNumber,
      @QueryParam("username") String username,
      @QueryParam("access_token") String access_token) {

    checkToken(access_token);
    try {
      login(User.findByUsername(username));
      final Mission mission = findMission(remoteProcessNumber);
      if (mission == null) {
        return respondWithError(Status.BAD_REQUEST, "bad.mission.number");
      } else {
        final MissionProcess missionProcess = mission.getMissionProcess();

        final RemoteMissionSystem remoteMissionSystem = RemoteMissionSystem.find(hostname);
        if (remoteMissionSystem == null) {
          return respondWithError(Status.NOT_ACCEPTABLE, "remote.host.not.configured");
        }

        final AssociateMissionProcessActivity activity =
            (AssociateMissionProcessActivity)
                missionProcess.getActivity(AssociateMissionProcessActivity.class);
        final AssociateMissionProcessActivityInfo information =
            activity.getActivityInformation(missionProcess);
        information.setProcessNumber(processNumber);
        information.setExternalId(externalId);
        information.setRemoteMissionSystem(remoteMissionSystem);
        information.setConnect(false);
        activity.execute(information);

        final JsonObject obj = new JsonObject();
        obj.addProperty("processID", missionProcess.getProcessNumber());
        obj.addProperty("externalId", missionProcess.getExternalId());
        return Response.ok().entity(gson.toJson(obj)).build();
      }
    } finally {
      logout();
    }
  }
 private MissionFinancer findMissionFinance(
     final MissionProcess missionProcess, final Financer financer) {
   for (final MissionFinancer missionFinancer : missionProcess.getMission().getFinancerSet()) {
     if (missionFinancer.getUnit() == financer.getUnit()) {
       return missionFinancer;
     }
   }
   return null;
 }
예제 #7
0
 @Override
 protected void process(final ActivityInformation activityInformation) {
   final MissionProcess missionProcess = (MissionProcess) activityInformation.getProcess();
   missionProcess.authorize(Authenticate.getUser());
   // missionProcess.addToProcessParticipantInformationQueues();
 }
 @Override
 public boolean isActive(final MissionProcess missionProcess, final User user) {
   return super.isActive(missionProcess, user) && !missionProcess.isCanceled();
 }