Checkout - modify record fails

Hi all,
I am facing a strange problem with Java API SP06.
I am checking out the main table records and I am setting field values for a record. When i execute modifyrecords command for the checkedout maintable record, I am getting a server exception...
"The records is protected"
The user session is same for all the operation.
I cannot figure out the problem.
Cant we do modification on checked out records?
Best regards,
Arun prabhu S

Hi Walter,
Thanks for the reply.
I was using modifyrecordCommand. i was getting "record is protected" exception.
Now i have changed my approach.
I am using modifyrecordscommand. Here i am supplying the records which i have modified. But the modification does not affects the checked out records.
BTW...Where do i supply the record ids? From my knowledge modifyrecordsbyID is not supported in SP06.
Kindly clarify.
Thanks and best regards,
Arun prabhu S

Similar Messages

  • Data Loader - Only imports first record; remaining records fail

    I'm trying to use Data Loader to import a group of opportunities. Everytime I run the Data Loader it only imports the first record. All the other records fail with the message "An unexpected error occurred during the import of the following row: 'External Unique Id: xxxxxxx'". After running the Data Loader, I can modify the Data file and remove the first record that was imported. By running the Data Loader again, the first row (previously the second row) will import successfully.
    Any idea what could be causing this behavior?

    W need a LOT more information, starting with the OS, and the version of ID, including any applied patches.
    Next we need to know if you are doing a single record per page or multiple records, whether the placeholders are on the master page, how many pages are in the document and if they all have fields on them (some screen captures might be useful -- embed them using the camera icon on the editing toolbar on the webpage rather than attaching, if it works [there seem to be some issues at the moment, though only for some people]).
    What else is on the page? Are you really telling it to merge all the records, or just one?
    You get the idea... Full description of what youhave, what you are doing, and what you get instead of what you expect.

  • [ADF-UIX] if Create record fails, it goes to Edit record, WHY????

    I must be doing something wrong, because I cant imagine that ADF reacts the way it does within my application.
    I have 2 datapages, browseDP and editDP
    I have 1 data action, createDA, I dragged the create method from my viewobject here
    The flow is as follows:
    browseDP(create button) --> createDA --> editDP
    browseDP(edit button) --> editDP
    This works fine
    But when a user presses the create button and the creation of a new record fails, the user
    will edit the record where the DB cursor is atm. But the user thinks he's adding a new record.
    You can understand that this leads to unwanted situations!
    There is no error message given to the user if the creation of a new record fails, it also doesnt
    return to the browse screen with an error message. Is this default behavoure of ADF? should I implement
    my own error checking mechanism when creation fails???
    Is there also a default flow option if a data action fails? I know success is default.
    Does anybody have some tips for me, I want to avoid the explained situation.
    kind regards
    a very frustrated developer
    Ido

    We've found solution to that problem, maybe someone will save few hours thanks to following trick:
    1. create UIX page with read-only table showing all the rows from details table
    2. Below the table put form that will let user edit currently selected row
    3. Insert "Create" submitButton in tableActions of the read-only table
    4. Button "Commit" and "Rollback" might be put below input form to save or cancel entered changes
    5. Now the tricky thing: instead of using submitButton that is binded to 'Delete' binding, do the following:
    a) created binding that deletes current row in detail table
    b) put button (not submitButton) and set it's destination property to "?event=mydelete"
    3) create event in UIX page that is called 'mydelete' and runs binding 'Delete'
    That's all - using that approach, when using clicks 'Add' and then 'Delete' he will not see JBO's saying that he didn't filled in required fields. It's a little bit obscure, but for me it's acceptable :-)
    Leszek Deska

  • QT Pro - "Recording Failed"

    I'm running QT Pro 7.3 under leopard on my MacBook Pro.
    Each time I try to record a new audio or a new video, the recorder window comes up fine . But, when I press the red 'record' button, I get a message "Recording Failed. Recording failed to create a movie." I get the same message whether using audio or video recording. It doesn't matter if I manually select internal mic or USB in preferences.
    Any advice on how to track this down? I can record in Garage Band, Amadeus Pro and Ubercaster, but QT is best and easiest for my needs.
    Thanks.

    I figured out the problem - when I transferred the setting from old Mac to my new Mac, the default location for saving recorded files was the desktop. Apparently there is a different file location for 'desktop' in Leopard than in Tiger. So, when I re-pointed the default directory in preferences to 'Desktop' again, that solved the problem.

  • Quicktime Pro 7.1.5 on MacBook Pro 17inch (Recording failed to create movie

    I went into Preferences and changed the camera from the built-in iSight to a USB camera (that works fine with iChat).
    When I tried to create a new movie I get the error:
    Recording failed.
    Recording failer to create a movie
    behind the error box I can see a black QT screen.
    suggestions? I could have sworn I switched cameras before in QT.
    Thanks, --bill
    MPB 17in - 3GB Ram - 200 GB Mac OS X (10.4.8) I also have a G5

    No really this is an Intel only bug. Hopefully someone at Apple reads this.
    I have a USB Logitech QuickCam Pro 5000.
    On my G5 this will happily record movies in Quicktime, provide images in IChat and work with Photobooth.
    On a February 2006 Macbook Pro, IChat works, Photobooth defaults back to the built in iSight (is there any way of changing this??), it even works with Windows on Parallels, but Quicktime fails as described above with the 'Recording failed to create a movie' message.
    Both computers are running MacOS X 10.4.9 patched right up to date.
    USB cameras must be supported on current systems - the built in iSight is USB connected!!!
    Bill

  • Workflow Action on Before modified record saved

    Hi,
    When creating a new update action on a workflow for "Before modified record saved", why can I not select a field from the "field to update" pick list that I have renamed?
    If I do not rename the field, select it for the field to be updated with my fomula, then go into Admin > App Cust > Record Type > Field Steup and then rename the field and make it appear on the page layout, this works, but if I want to edit the formula for the workflow action, I cannot then select it as per my original issue!
    Is this a bug or just the way the system works?
    Thanks for any help/advice on this

    Ok - further to this, if I use the Indexed Short Text 1 or 2 field and re-name it, then re-name it back to the original field name it does not appear in the list of Fields to be selected for the action when it was listed there originally before I renamed it.
    Ideas anyone?

  • Merging local records with device records failed

    Hi,
    I have a macbook with OS X 10.4.11 (Intel procesor)  I did install the latest Pockect mac for blackberry version (the current one in the Blackberry's page), i use to use the old one, since I did the updated I can't get that both, device and Mac SYNC any item, no contacts, no calendar... 
    The message I got last time was: 
    06:06:57:140 merging local records with device records failed. 
    Could some one with me a light on this bug?
    Thanks 

    Hi rguardia,
    Can you try synching one PIM database at a time, e.g. just Contacts by itself, so we can determine which database is experiencing the problem?  The error you are receiving is likely being caused by one specific database.
    Once you have identified the database that is causing problems, can you perform the steps listed below:
    1 - Run Data Purge on the affected database.  Data purge can be found in the following location: 
    Mac HD/users/<Home User>/Library/Application Support/PocketMacSyncManager/Additional Tools. 
    ***Please note this utility will delete all information stored in the selected database on your BlackBerry however once the information has been deleted from your device you can reimport the data to your BlackBerry from the application on your Mac.
    2 - Run Sync Clean, which can be found in the same folder as Data Purge. 
    3 - Disconnect the BB from the Mac, remove the battery from the back of the device, wait 10 seconds then reinsert it
    4 - Reboot the Mac
    5 - Reconnect your BlackBerry to your Mac
    6 - Open PocketMac and select Reset All Devices to First Sync State from the Devices menu
    7 - Configure synchronization settings for the affected PIM database, choosing the option to Overwrite Device.  If the data is successfully transferred to the device, reconfigure PocketMac back to doing a two-way sync.
    If you are still running into the same problem after performing the steps above, try synching one category of the affected database at a time. To do this, click on the tab of the database you are trying to sync, click on Advanced Preferences next to the selected application, and choose the option to sync only selected categories. Try synching with only one category selected at a time, just to see if the issue is related to data within a specific category.
    Let us know how you make out!

  • Records fail to import

    Hi All,
    When i perform import through import manger.
    I get a message that the some records failed to import because they are used in WF.
    I understand the reason of failure..However when the Import log pops up on failure of import.
    This import log does not seem to give  any particular info of which records have failed.
    No unique Id of the record.How will i be able to find out ,if i have imported 50000 records and some records fail while importing.
    How will i find out which records have failed.?
    Thanks
    AJ

    Hi Amruta
    ENABLING TRACING AND AUDIT TRAILS IN THE IMPORT LOG
    The Verbose parameter in the mdis.ini file controls how much
    information is included in the Import log (see u201CMDIS Configurationu201D on
    page 396 for more information about the mdis.ini file).
    Settings for the Verbose parameter in are described in Table 91.
    Table 91. Verbose Parameter Settings
    Setting Hexadecimal Description
    Verbose OFF 0x0000 Turns off all verbose settings
    Verbose ON 0xFFFF Turns on all verbose settings
    FI Verbose 0x0001 Adds verbose field information
    XML Verbose 0x0002 Adds verbose XML processing information
    MAP Verbose 0x0004 Adds verbose field mapping information
    THRD Verbose 0x0008 Turns on STRUCTX, VALUEX, and IMPORTX settings
    PARSER Verbose 0x0010 Adds XML/text parser audit trail
    STRUCTX Verbose 0x0020 Adds structural exception thread audit trail
    VALUEX Verbose 0x0040 Adds value exception thread audit trail
    IMPORTX Verbose 0x0080 Adds import exception thread audit trail
    CHUNK Verbose 0x0100 Adds chunk processing audit trail
    VxR Verbose 0x0020 Adds virtual extended record audit trail
    Last option may help you. Also the logs can be accessed via the Server/MDIS/Logs where you can see the Import logs.
    best regards
    Ravi

  • Sync error: Uploading records failed: "client issue: request body too large"

    1328917629619 Sync.Engine.AdblockPlus DEBUG Uploading records failed: "client issue: request body too large"
    This happens from 2 Win 7 computer and 1 Win XP computer sync'd. Without the Add Block Plus being sync'd everything works.

    Hi!
    That's a problem with the Add Block Plus sync engine. It seems that they have issues on their servers.
    Try to ask the same question in their forum: https://adblockplus.org/forum/
    Good luck!

  • Trying to update my hotmail password, and I get "Modifying Endpoint Failed" message.  any help appreciated.

    trying to update my hotmail password, and I get "Modifying Endpoint Failed" message.  any help appreciated.

        Thanks for the details, !!!!!!!!!!!!!!!! When using the Droid RAZR M and default email client, Hotmail passwords can be updated more efficiently by completely removing http://vz.to/1FgwQ3a readding http://vz.to/1FgwQ3m the email account. Here are the steps to do so . Please keep us posted on how this works.
    TanishaS1_VZW
    Follow us on Twitter @VZWSupport

  • Audio recording "failed," need to rescue the AIFF file

    I recorded a rather long audio file from the analog audio-in port of my Dual G5 in AIFF format (stereo, 16 bits) using the QuickTime Player. Upon clicking the "Stop Recording" button I got a message dialog "Recording Failed". I copied the file with the Finder before clicking OK, suspecting that QuickTime would delete the file upon clicking OK, which it did do. The copied file is 10.28 GB and contains 11 hr, 35 min, 2 sec of recorded material. Quicktime refuses to open the file, giving me the following message: Alert: QuickTime cannot open the file: "Audio 2 copy.mov" the movie contains an incorrect duration (-2014).
    Note that VLC opens the file, knows the exact duration of the audio tracks, and plays it back perfectly fine. I can even jump to different time points to continue playing.
    Is there a utility I can use to "repair" the file, so that QuickTime can open it? I hate to discard this file, since it is mostly intact.
    Dual 1.8 GHz PowerPC G5   Mac OS X (10.4.6)   3.5 GB DDR SDRAM

    Is this dotmac.info bob?
    MPEG Streamclip (free) may be able to repair the broken time code.
    You could also re-record the file using WireTap. Record while playing the file in VLC. Note: This is "live" recording so it would take a long time. Maybe record in smaller "chunks".

  • Video Camera Recording Failed

    I was trying to take a video with my phone today and every time I pressed the record button a notice would come up saying recording failed.  I tried closing the camera and then bringing it back up but it still says recording failed.  Anyone have this problem and know how to fix it?

    droidcharge1996 wrote:
    I was trying to take a video with my phone today and every time I pressed the record button a notice would come up saying recording failed.  I tried closing the camera and then bringing it back up but it still says recording failed.  Anyone have this problem and know how to fix it?
    Hi droidcharge1996,
    First troubleshooting step will be to reset your phone's camcorder to default settings. From the home screen touch Applications>Camera>Mode(switch to camcorder)>Options>Settings>Reset. Once your settings are reset try using your camcorder.
    Additionally, a corrupted SD memory card may be causing the error. Format your SD card. Keep in mind that formatting erases all content from the memory card and prepares it for use with your phone.
    1. From the Home screen, press the Menu Key>Settings>SD card & phone storage.
    2. Touch Unmount SD card.
    3. After unmounting the SD card, touchFormat SD card, then follow the prompts to confirm the formatting of the card.
    I trust that the above steps will resolve your phone's camcorder concerns.

  • Query to check modified records

    Hi,
    I have a situation, one of my user was running dataload on production database and somehow dataload failed its sequence and opened screens and it was not supposed to. Today, we discovered that some BOM master records were modified and diagnosing the issue from Last_updated_by column and username is pointing to a session of the same user. The conclusion is that dataload might have changed other records too.
    To solve this issue, I need to code a SQL that will give me a list of all tables / records in the database that were changed by this user on an particular date.
    Can someone please tell me am I safe to get the table name from all_tables or does things work different in APPS 11i?
    Thanks
    Aali
    Edited by: aali on 09-May-2011 01:41

    You may be overcautious.
    Typically (but not always), when data load goes out of sync, it is rare that it will affect unrelated entities (unless you had ALT key in the dataload file).
    Which screens were you performing data load on? Were they bom screens?
    You can use the following
    SELECT    'select count(1) '
           || table_name
           || ' from '
           || owner
           || '.'
           || table_name
           || ' where last_update_date > sysdate - 1 and last_updated_by = 11531;'
      FROM all_tables AT
    WHERE EXISTS (
              SELECT 1
                FROM all_tab_columns atc
               WHERE atc.table_name = AT.table_name
                 AND atc.owner = AT.owner
                 AND atc.column_name = 'LAST_UPDATED_BY')
       AND EXISTS (
              SELECT 1
                FROM all_tab_columns atc
               WHERE atc.table_name = AT.table_name
                 AND atc.owner = AT.owner
                 AND atc.column_name = 'LAST_UPDATE_DATE')
       --AND owner IN ('AP','GL','AR','FND')Add code to narrow down the list above otherwise it will return too many records.
    Hope this helps,
    Sandeep Gandhi

  • Modify Record Number in a Random Access File

    Hi Does anyone know if I can modify the record number in the random access file hardware.dat for each hardware record each time and update it in hardware.dat to display it? Also why does it say "Record does not exist" if I modify the record number for a hardware and try to update it but could not find that record?
    Here is the code below:
    // Exercise 14.11: HardwareRecord.java
    package org.egan; // packaged for reuse
    public class HardwareRecord
      private int recordNumber;
      private String toolName;
      private int quantity;
      private double cost;
      // no-argument constructor calls other constructor with default values
      public HardwareRecord()
        this(0,"",0,0.0); // call four-argument constructor
      } // end no-argument HardwareRecord constructor
      // initialize a record
      public HardwareRecord(int number, String tool, int amount, double price)
        setRecordNumber(number);
        setToolName(tool);
        setQuantity(amount);
        setCost(price);
      } // end four-argument HardwareRecord constructor
      // set record number
      public void setRecordNumber(int number)
        recordNumber = number;
      } // end method setRecordNumber
      // get record number
      public int getRecordNumber()
        return recordNumber;
      } // end method getRecordNumber
      // set tool name
      public void setToolName(String tool)
        toolName = tool;
      } // end method setToolName
      // get tool name
      public String getToolName()
        return toolName;
      } // end method getToolName
      // set quantity
      public void setQuantity(int amount)
        quantity = amount;
      } // end method setQuantity
      // get quantity
      public int getQuantity()
        return quantity;
      } // end method getQuantity
      // set cost
      public void setCost(double price)
        cost = price;
      } // end method setCost
      // get cost
      public double getCost()
        return cost;
      } // end method getCost
    } // end class HardwareRecord-------------------------------------------------------------------------------------------------
    // Exercise 14.11: RandomAccessHardwareRecord.java
    // Subclass of HardwareRecord for random-access file programs.
    package org.egan; // package for reuse
    import java.io.RandomAccessFile;
    import java.io.IOException;
    public class RandomAccessHardwareRecord extends HardwareRecord
      public static final int SIZE = 46;
      // no-argument constructor calls other constructor with default values
      public RandomAccessHardwareRecord()
        this(0,"",0,0.0);
      } // end no-argument RandomAccessHardwareRecord constructor
      // initialize a RandomAccessHardwareRecord
      public RandomAccessHardwareRecord(int number, String tool, int amount, double price)
        super(number,tool,amount,price);
      } // end four-argument RandomAccessHardwareRecord constructor
      // read a record from a specified RandomAccessFile
      public void read(RandomAccessFile file) throws IOException
        setRecordNumber(file.readInt());
        setToolName(readName(file));
        setQuantity(file.readInt());
        setCost(file.readDouble());
      } // end method read
      // ensure that name is proper length
      private String readName(RandomAccessFile file) throws IOException
        char name[] = new char[15], temp;
        for(int count = 0; count < name.length; count++)
          temp = file.readChar();
          name[count] = temp;
        } // end for
        return new String(name).replace('\0',' ');
      } // end method readName
      // write a record to specified RandomAccessFile
      public void write(RandomAccessFile file) throws IOException
        file.writeInt(getRecordNumber());
        writeName(file, getToolName());
        file.writeInt(getQuantity());
        file.writeDouble(getCost());
      } // end method write
      // write a name to file; maximum of 15 characters
      private void writeName(RandomAccessFile file, String name) throws IOException
        StringBuffer buffer = null;
        if (name != null)
          buffer = new StringBuffer(name);
        else
          buffer = new StringBuffer(15);
        buffer.setLength(15);
        file.writeChars(buffer.toString());
      } // end method writeName
    } // end RandomAccessHardwareRecord-------------------------------------------------------------------------------------------------
    // Exercise 14.11: CreateRandomFile.java
    // creates random-access file by writing 100 empty records to disk.
    import java.io.IOException;
    import java.io.RandomAccessFile;
    import org.egan.RandomAccessHardwareRecord;
    public class CreateRandomFile
      private static final int NUMBER_RECORDS = 100;
      // enable user to select file to open
      public void createFile()
        RandomAccessFile file = null;
        try  // open file for reading and writing
          file = new RandomAccessFile("hardware.dat","rw");
          RandomAccessHardwareRecord blankRecord = new RandomAccessHardwareRecord();
          // write 100 blank records
          for (int count = 0; count < NUMBER_RECORDS; count++)
            blankRecord.write(file);
          // display message that file was created
          System.out.println("Created file hardware.dat.");
          System.exit(0);  // terminate program
        } // end try
        catch (IOException ioException)
          System.err.println("Error processing file.");
          System.exit(1);
        } // end catch
        finally
          try
            if (file != null)
              file.close();  // close file
          } // end try
          catch (IOException ioException)
            System.err.println("Error closing file.");
            System.exit(1);
          } // end catch
        } // end finally
      } // end method createFile
    } // end class CreateRandomFile-------------------------------------------------------------------------------------------------
    // Exercise 14.11: CreateRandomFileTest.java
    // Testing class CreateRandomFile
    public class CreateRandomFileTest
       // main method begins program execution
       public static void main( String args[] )
         CreateRandomFile application = new CreateRandomFile();
         application.createFile();
       } // end main
    } // end class CreateRandomFileTest-------------------------------------------------------------------------------------------------
    // Exercise 14.11: MenuOption.java
    // Defines an enum type for the hardware credit inquiry program's options.
    public enum MenuOption
      // declare contents of enum type
      PRINT(1),
      UPDATE(2),
      NEW(3),
      DELETE(4),
      END(5);
      private final int value; // current menu option
      MenuOption(int valueOption)
        value = valueOption;
      } // end MenuOptions enum constructor
      public int getValue()
        return value;
      } // end method getValue
    } // end enum MenuOption-------------------------------------------------------------------------------------------------
    // Exercise 14.11: FileEditor.java
    // This class declares methods that manipulate hardware account records
    // in a random access file.
    import java.io.EOFException;
    import java.io.File;
    import java.io.IOException;
    import java.io.RandomAccessFile;
    import java.util.Scanner;
    import org.egan.RandomAccessHardwareRecord;
    public class FileEditor
      RandomAccessFile file; // reference to the file
      Scanner input = new Scanner(System.in);
      // open the file
      public FileEditor(String fileName) throws IOException
        file = new RandomAccessFile(fileName, "rw");
      } // end FileEditor constructor
      // close the file
      public void closeFile() throws IOException
        if (file != null)
          file.close();
      } // end method closeFile
      // get a record from the file
      public RandomAccessHardwareRecord getRecord(int recordNumber)
         throws IllegalArgumentException, NumberFormatException, IOException
        RandomAccessHardwareRecord record = new RandomAccessHardwareRecord();
        if (recordNumber < 1 || recordNumber > 100)
          throw new IllegalArgumentException("Out of range");
        // seek appropriate record in a file
        file.seek((recordNumber - 1) * RandomAccessHardwareRecord.SIZE);
        record.read(file);
        return record;
      } // end method getRecord
      // update record tool name in file
      public void updateRecordToolName(int recordNumber, String newToolName)
         throws IllegalArgumentException, IOException
        RandomAccessHardwareRecord record = getRecord(recordNumber);
        if (record.getRecordNumber() == 0)
          throw new IllegalArgumentException("Record does not exist");
        // seek appropriate record in file
        file.seek((recordNumber - 1) * RandomAccessHardwareRecord.SIZE);
        record.setToolName(newToolName);
        record = new RandomAccessHardwareRecord(
           record.getRecordNumber(), record.getToolName(), record.getQuantity(), record.getCost());
        record.write(file); // write updated record to file
      } // end method updateRecordToolName
      // update record in file
      public void updateRecordQuantity(int recordNumber, int newQuantity)
         throws IllegalArgumentException, IOException
        RandomAccessHardwareRecord record = getRecord(recordNumber);
        if (record.getRecordNumber() == 0)
          throw new IllegalArgumentException("Record does not exist");
        // seek appropriate record in file
        file.seek((recordNumber - 1) * RandomAccessHardwareRecord.SIZE);
        record.setQuantity(newQuantity);
        record = new RandomAccessHardwareRecord(
           record.getRecordNumber(), record.getToolName(), record.getQuantity(), record.getCost());
        record.write(file); // write updated record to file
      } // end method updateRecordQuantity
      // update record in file
      public void updateRecordCost(int recordNumber, double newCost)
         throws IllegalArgumentException, IOException
        RandomAccessHardwareRecord record = getRecord(recordNumber);
        if (record.getRecordNumber() == 0)
          throw new IllegalArgumentException("Record does not exist");
        // seek appropriate record in file
        file.seek((recordNumber - 1) * RandomAccessHardwareRecord.SIZE);
        record.setCost(newCost);
        record = new RandomAccessHardwareRecord(
           record.getRecordNumber(), record.getToolName(), record.getQuantity(), record.getCost());
        record.write(file); // write updated record to file
      } // end method updateRecordCost
      // add record to file
      public void newRecord(int recordNumber, String toolName, int quantity, double cost)
         throws IllegalArgumentException, IOException
        RandomAccessHardwareRecord record = getRecord(recordNumber);
        if (record.getRecordNumber() != 0)
          throw new IllegalArgumentException("Record already exists");
        // seek appropriate record in file
        file.seek((recordNumber - 1) * RandomAccessHardwareRecord.SIZE);
        record = new RandomAccessHardwareRecord(recordNumber, toolName, quantity, cost);
        record.write(file); // write record to file
      } // end method newRecord
      // delete record from file
      public void deleteRecord(int recordNumber) throws IllegalArgumentException, IOException
        RandomAccessHardwareRecord record = getRecord(recordNumber);
        if (record.getRecordNumber() == 0)
          throw new IllegalArgumentException("Account does not exist");
        // seek appropriate record in file
        file.seek((recordNumber - 1) * RandomAccessHardwareRecord.SIZE);
        // create a blank record to write to the file
        record = new RandomAccessHardwareRecord();
        record.write(file);
      } // end method deleteRecord
      // read and display records
      public void readRecords()
        RandomAccessHardwareRecord record = new RandomAccessHardwareRecord();
        System.out.printf("%-10s%-15s%-15s%10s\n","Record","Tool Name","Quantity","Cost");
        try  // read a record and display
          file.seek(0);
          while (true)
            do
              record.read(file);
            while (record.getRecordNumber() == 0);
            // display record contents
            System.out.printf("%-10d%-15s%-15d%10.2f\n",record.getRecordNumber(),
               record.getToolName(), record.getQuantity(), record.getCost());
          } // end while
        } // end try
        catch (EOFException eofException)  // close file
          return;  // end of file was reached
        } // end catch
        catch (IOException ioException)
          System.err.println("Error reading file.");
          System.exit(1);
        } // end catch
      } // end method readRecords
    } // end class FileEditor-------------------------------------------------------------------------------------------------
    // Exercise 14.11: TransactionProcessor.java
    // A transaction processing program using random-access files.
    import java.io.IOException;
    import java.util.NoSuchElementException;
    import java.util.Scanner;
    import org.egan.RandomAccessHardwareRecord;
    public class TransactionProcessor
      private FileEditor dataFile;
      private RandomAccessHardwareRecord record;
      private MenuOption choices[] = {MenuOption.PRINT, MenuOption.UPDATE, MenuOption.NEW,
              MenuOption.DELETE, MenuOption.END};
      private Scanner input = new Scanner(System.in);
      // get the file name and open the file
      private boolean openFile()
        try // attempt to open file
          // call the helper method to open the file
          dataFile = new FileEditor("hardware.dat");
        } // end try
        catch (IOException ioException)
          System.err.println("Error opening file.");
          return false;
        } // end catch
        return true;
      } // end method openFile
      // close file and terminate application
      private void closeFile()
        try // close file
          dataFile.closeFile();
        } // end try
        catch (IOException ioException)
          System.err.println("Error closing file.");
          System.exit(1);
        } // end catch
      } // end method closeFile
      // create, update or delete the record
      private void performAction(MenuOption action)
        int recordNumber = 0;  // record number of record
        String toolName;       // tool name of the hardware instrument
        int quantity;          // total amount of items
        double cost;           // hareware tool price
        int choice;            // choose an update option   
        int newRecordNumber;   // the updated record number
        String newToolName;    // the updated tool name
        int newQuantity;       // the updated quantity
        double newCost;        // the updated cost
        try // attempt to manipulate files based on option selected
          switch(action) // switch based on option selected
            case PRINT:
              System.out.println();
              dataFile.readRecords();
              break;
            case NEW:
              System.out.printf("\n%s%s\n%s\n%s","Enter record number,",
                "tool name, quantity, and cost.","(Record number must be 1 - 100)","? ");
              recordNumber = input.nextInt();  // read record number       
              toolName = input.next();         // read tool name
              quantity = input.nextInt();      // read quantity
              cost = input.nextDouble();       // read cost
              dataFile.newRecord(recordNumber, toolName, quantity, cost); // create new record
              break;
            case UPDATE:
              System.out.print("\nEnter record number to update (1 - 100): ");
              recordNumber = input.nextInt();
              record = dataFile.getRecord(recordNumber);
              if (record.getRecordNumber() == 0)
                System.out.println("Record does not exist.");
              else
                // display record contents
                System.out.printf("%-10d%-12s%-12d%10.2f\n\n", record.getRecordNumber(),
                   record.getToolName(), record.getQuantity(), record.getCost());
                System.out.printf("%s%s","\nEnter 1 to update tool name, ",
                  "2 to update quantity, or 3 to update cost : ");
                choice = input.nextInt();
                if (choice == 1)
                  System.out.print("Enter new record tool name : ");
                  newToolName = input.next();
                  dataFile.updateRecordToolName(recordNumber,newToolName); // update record
                                                                           // tool name            
                  // retrieve updated record
                  record = dataFile.getRecord(recordNumber);
                  // display updated record
                  System.out.printf("%-10d%-12s%-12d%10.2f\n", record.getRecordNumber(),
                     record.getToolName(), record.getQuantity(), record.getCost());
                else if (choice == 2)
                  System.out.print("Enter new record quantity : ");
                  newQuantity = input.nextInt();
                  dataFile.updateRecordQuantity(recordNumber,newQuantity); // update record
                                                                           // quantity             
                  // retrieve updated record
                  record = dataFile.getRecord(recordNumber);
                  // display updated record
                  System.out.printf("%-10d%-12s%-12d%10.2f\n", record.getRecordNumber(),
                     record.getToolName(), record.getQuantity(), record.getCost());
                else if (choice == 3)
                  System.out.print("Enter new record cost : ");
                  newCost = input.nextDouble();
                  dataFile.updateRecordCost(recordNumber,newCost); // update record cost            
                  // retrieve updated record
                  record = dataFile.getRecord(recordNumber);
                  // display updated record
                  System.out.printf("%-10d%-12s%-12d%10.2f\n", record.getRecordNumber(),
                     record.getToolName(), record.getQuantity(), record.getCost());
              } // end else     
              break;
            case DELETE:
              System.out.print("\nEnter an account to delete ( 1 - 100): ");
              recordNumber = input.nextInt();
              dataFile.deleteRecord(recordNumber);  // delete record
              break;
            default:
              System.out.println("Invalid action.");
              break;
          } // end switch
        } // end try
        catch (NumberFormatException format)
          System.err.println("Bad input.");
        } // end catch
        catch (IllegalArgumentException badRecord)
          System.err.println(badRecord.getMessage());
        } // end catch
        catch (IOException ioException)
          System.err.println("Error writing to the file.");
        } // end catch
        catch (NoSuchElementException elementException)
          System.err.println("Invalid input. Please try again.");
          input.nextLine();
        } // end catch
      } // end method performAction
      // enable user to input menu choice
      private MenuOption enterChoice()
        int menuChoice = 1;
        // display available options
        System.out.printf("\n%s\n%s\n%s\n%s\n%s\n%s","Enter your choice",
         "1 - List hardware records", "2 - Update a hardware record",
         "3 - Add a new hardware record", "4 - Delete a hardware record", "5 - End program\n?");
        try
          menuChoice = input.nextInt();
        catch (NoSuchElementException elementException)
          System.err.println("Invalid input.");
          System.exit(1);
        } // end catch
        return choices[menuChoice - 1];  // return choice from user
      } // end enterChoice
      public void processRequests()
        openFile();
        // get user's request
        MenuOption choice = enterChoice();
        while (choice != MenuOption.END)
          performAction(choice);
          choice = enterChoice();
        } // end while
        closeFile();
      } // end method processRequests
    } // end class TransactionProcessor-------------------------------------------------------------------------------------------------
    // Exercise 14.11: TransactionProcessorTest.java
    // Testing the transaction processor.
    public class TransactionProcessorTest
      public static void main(String args[])
         TransactionProcessor application = new TransactionProcessor();
         application.processRequests();
      } // end main
    } // end class TransactionProcessorTest-------------------------------------------------------------------------------------------------
    Below is the sample data to be entered into the random input file hardware.dat :
    Record                     Tool                        Quantity                Cost
    Number                   Name                
       3                      Sander                    18                         35.99
      19                      Hammer                128                      10.00
      26                      Jigsaw                   16                        14.25
      39                      Mower                    10                        79.50
      56                      Saw                        8                          89.99
      76                      Screwdriver            236                      4.99
      81                      Sledgehammer       32                        19.75
      88                      Wrench                      65                        6.48Message was edited by:
    egan128
    Message was edited by:
    egan128
    Message was edited by:
    egan128

    Hi Does anyone know if I can modify the record number
    in the random access file hardware.dat for each
    hardware record each time and update it in
    hardware.dat to display it?If the "record number" is data that is stored in the file, then you can modify it. More precisely: it is possible to modify it.
    The rest of the question had too many incompatible verbs for me to understand it.
    Also why does it say
    "Record does not exist" if I modify the record number
    for a hardware and try to update it but could not
    find that record?"Record does not exist" is a fairly reasonable error message for the situation where a program looks for a record but cannot find it. Are you asking why that particular lump of code actually does that?
    (One thousand lines of code removed)

  • How can I modify Recorded (in MTM) UI tests? Can I modify execution script

    Hi,
    Introduction:
    I have some TestCases in Microsoft Test Manager. I Record the acrions for some test (Test tab > Run test). And Save it (I can re run this test and it do all actions automatically)
    Now I want to edit actions associated with Steps. Add checks, refactor them. How Can I do this? In result I need to Open this TestCase Run all its Steps and they should executes using my changes and set result of Steps accordance my checks.
    P.S. I know that I can create CodedUI tests from this recordings and change everithings I want but How can I associate this testwith TestCase. Mean Run this TestCase in MTM and see my changes maden in CodedUI Test?
    Maybe someone know the place where MTM stores his recordings for TestCases?
    The Critical whant is to have ability to change coed which associated with Steps in MTM in any way
    Thanks

    Hi Roman,
    As far as I know, we can’t edit the actions of steps in the MTM, we just can delete the action in the test runner during recording.
    As you said that we could modify it through the Coded UI test, for this way, we can associate the modified Coded UI test to the test case and do automated test, we can’t associate it with test case’s steps.
    # Associate an Automated Test with a Test Case
    https://msdn.microsoft.com/en-us/library/dd380741(v=vs.110).aspx
    The recorded actions are stored in TFS database, I don’t think it is easy or good to modify the database directly.
    I suggest that you could recode the actions again or do automated test.
    Regards
    Starain
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

Maybe you are looking for

  • Data loading error

    hi there, i having a problem, i'm not able to load data from 3rd party to bw, it is given an error, Error in ABAP application program. The current ABAP program "SAPMSYST" had to be terminated because one of the statements could not be executed. This

  • Multi query reports and BI Publisher?

    I have to create a report that gathers data from DB using several SQL queries - text mixed with data tables. I was not able to find anything like that in Apex 3.0 or BI Publisher. Am I missing something? As a solution I was trying to pass more comple

  • My iPad 3 doesn't transfer pictures thru photo stream to iPhone 4 but does on iPhone 4 to iPad.

    ...

  • My iPod got wet...

    I was a moron and accidentally left my ipod video outside one night, and it happened to rain that night. It was then left outside half of the next day in 95 degree weather and when i found it, my ipod was too hot to touch. It won't turn on normally (

  • After Effects CS5 ACE Certification ?

    Hello. Not sure if this is the right forum to talk about, but can someone provide accurate information on when will be ready the CS5 Certification or Re-Certification, for After Effects and Premiere? Right know there are only a few products with avai