Beispiel #1
0
 /**
  * Perform the work of getting a Job object and manipulating it.
  *
  * @param argArray the input arg array
  * @return what's left of the arg array
  */
 public ArgArray job(ArgArray argArray) {
   FUNCTIONS function = FUNCTIONS.INSTANCE;
   Tuple pplTuple = null;
   PrintParameterList instancePPL = null;
   int attributeId;
   String stringVal;
   Integer intVal;
   Float floatVal;
   Object getResult = null;
   while (argArray.hasDashCommand()) {
     String dashCommand = argArray.parseDashCommand();
     switch (dashCommand) {
       case "-to":
         setDataDestfromArgArray(argArray);
         break;
         //                case "-from":
         //                    String srcName = argArray.next();
         //                    setDataSrc(DataSink.fromSinkName(srcName));
         //                    break;
       case "-getint":
         function = FUNCTIONS.GETINT;
         attributeId = argArray.nextIntMaybeQuotationTuplePopString();
         getResult = getInt(pplTuple, attributeId);
         break;
       case "-getfloat":
         function = FUNCTIONS.GETFLOAT;
         attributeId = argArray.nextIntMaybeQuotationTuplePopString();
         getResult = getFloat(pplTuple, attributeId);
         break;
       case "-getstring":
         function = FUNCTIONS.GETSTRING;
         attributeId = argArray.nextIntMaybeQuotationTuplePopString();
         getResult = getString(pplTuple, attributeId);
         break;
       case "-new":
       case "-instance":
         function = FUNCTIONS.INSTANCE;
         instancePPL = new PrintParameterList();
         break;
       case "--":
       case "-ppl":
         pplTuple = argArray.nextTupleOrPop();
         break;
       case "-setint":
         function = FUNCTIONS.SETINT;
         attributeId = argArray.nextIntMaybeQuotationTuplePopString();
         intVal = argArray.nextIntMaybeQuotationTuplePopString();
         setInt(pplTuple, attributeId, intVal);
         break;
       case "-setfloat":
         function = FUNCTIONS.SETFLOAT;
         attributeId = argArray.nextIntMaybeQuotationTuplePopString();
         floatVal = Float.parseFloat(argArray.nextMaybeQuotationTuplePopString());
         setFloat(pplTuple, attributeId, floatVal);
         break;
       case "-setstring":
         function = FUNCTIONS.SETSTRING;
         attributeId = argArray.nextIntMaybeQuotationTuplePopString();
         stringVal = argArray.nextMaybeQuotationTuplePopString();
         setString(pplTuple, attributeId, stringVal);
         break;
       default:
         unknownDashCommand(dashCommand);
     }
   }
   if (havingUnknownDashCommand()) {
     setCommandResult(COMMANDRESULT.FAILURE);
   } else if (getCommandResult() != COMMANDRESULT.FAILURE) {
     switch (function) {
       case INSTANCE:
         try {
           put(instancePPL);
         } catch (SQLException
             | IOException
             | AS400SecurityException
             | ErrorCompletingRequestException
             | InterruptedException
             | ObjectDoesNotExistException
             | RequestNotSupportedException ex) {
           getLogger()
               .log(
                   Level.SEVERE,
                   "Error putting PrintParameterList in " + getNameAndDescription(),
                   ex);
           setCommandResult(COMMANDRESULT.FAILURE);
         }
         break;
       case SETFLOAT:
       case SETINT:
       case SETSTRING:
         try {
           if (pplTuple != null) {
             put(pplTuple.getValue());
           } else {
             put(null);
           }
         } catch (SQLException
             | IOException
             | AS400SecurityException
             | ErrorCompletingRequestException
             | InterruptedException
             | ObjectDoesNotExistException
             | RequestNotSupportedException ex) {
           getLogger()
               .log(
                   Level.SEVERE,
                   "Error putting PrintParameterList in " + getNameAndDescription(),
                   ex);
           setCommandResult(COMMANDRESULT.FAILURE);
         }
         break;
       case GETFLOAT:
       case GETINT:
       case GETSTRING:
         try {
           put(getResult);
         } catch (SQLException
             | IOException
             | AS400SecurityException
             | ErrorCompletingRequestException
             | InterruptedException
             | ObjectDoesNotExistException
             | RequestNotSupportedException ex) {
           getLogger()
               .log(
                   Level.SEVERE,
                   "Error putting PrintParameterList value in " + getNameAndDescription(),
                   ex);
           setCommandResult(COMMANDRESULT.FAILURE);
         }
         break;
     }
   }
   return argArray;
 }