Editing Pet
The process of editing a pet is similar to the process of creating one.
1. Copy createPet.jsp
a. Select create.jsp.
b. Right-click -> Copy
c. Right-click -> Paste, set new name to editPet.jsp.
d. Open editPet.jsp and replace createBean.create with createBean.edit.
2. Register editPet and make it available on the information page.
a. Add the action to Pet-actions.xml.
<action name="editPet">
<command class="com.ptc.core.components.forms.DefaultEditFormProcessor"
url="netmarkets/jsp/acme/pet/editPet.jsp" windowType="popup"/>
</action>
b. Add a menu to the “info” page.
<model name="pet actions" menufor="com.acme.Pet">
<action name="editPet" type="pet"/>
</model>
3. Add the following to acmeActionResource.java :
@RBEntry("Edit Pet")
public static final String PET_EDIT_PET_TITLE = "pet.editPet.title";
@RBEntry("Edit")
public static final String PET_EDIT_PET_TOOLTIP = "pet.editPet.tooltip";
@RBEntry("Edit")
public static final String PET_EDIT_PET_DESCRIPTION = "pet.editPet.description";
@RBEntry("edit.gif")
public static final String PET_EDIT_PET_ICON = "pet.editPet.icon";
4. Implement a wt.verification.Verifier (non-AccesControlled objects are shielded from inadvertent (or malicious) updates and deletes by a Verifier in lieu of access control)
a. Create PetVerifier with content as follows:
package com.acme;
import wt.fc.Persistable;
import wt.fc.collections.WTCollection;
import wt.util.WTException;import wt.verification.Verifier;
public class PetVerifier implements Verifier {
@Override public boolean verify(Persistable a_object) throws WTException {
return true;
}
@Override
public boolean verify(WTCollection a_objects) throws WTException {
return true;
}}
b. Register PetVerifier as a verifier for Pet by adding the following to site.xconf and propagating with xconfmanager.
<Service context="default" name="wt.verification.Verifier"
targetFile="codebase/service.properties">
<Option cardinality="duplicate" order="1" requestor="com.acme.Pet"
serviceClass="com.acme.PetVerifier" selector="DEFAULT"/>
</Service>
5. Start/restart Windchill
a. Verify that “edit” is available as an action of an “info” page.
b. Verify the edit pop-up.
c. Edit the pet.