编辑宠物
宠物编辑过程与其创建过程类似。
1. 复制 createPet.jsp
a. 选择 create.jsp
b. 右键单击 -> 复制
c. 右键单击 -> 粘贴,将新名称设置为 editPet.jsp
d. 打开 editPet.jsp,然后将 createBean.create 替换为 createBean.edit
2. 注册 editPet,使其在信息页上可用。
a. 将操作添加到 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. 将菜单添加到“信息”页。
<model name="pet actions" menufor="com.acme.Pet">
<action name="editPet" type="pet"/>
</model>
3. 将以下内容添加到 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. 实现 wt.verification.Verifier (非访问控制对象不会遭到代替访问控制的检验者的无意 (或恶意) 更新和删除)
a. 使用如下所示内容创建 PetVerifier
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. 通过将以下内容添加到 site.xconf 并使用 xconfmanager 进行传播,将 PetVerifier 注册为宠物的检验者。
<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. 启动/重新启动 Windchill
a. 验证 "edit" 是否为“信息”页中的可用操作。
b. 验证编辑弹出窗口。
c. 编辑宠物。
这对您有帮助吗?