Approach 2: Create a Lightweight Entity Type Representation from Another Domain and Add a Navigation to that Lightweight Entity Type
1. Extend ProdMgmt to add a lightweight Change Notice representation. This lightweight entity representation may have canonical links to the full entity representation in the ChangeMgmt domain.
2. Extend Part to add the navigation to the lightweight Change Notice.
Create PartsExt.json
{
"extends":"Part",
"navigations":[
{
"name":"RelatedChangeNotices",
"target":"LightweightCNs",
"type":"PTC.ProdMgmt.LightweightCN",
"isCollection":true
}
]
}
Add LightweightCN.json
{
"name": "LightweightCN",
"collectionName": "LightweightCNs",
"includeInServiceDocument": false,
"type": "wcType",
"wcType": "wt.change2.WTChangeOrder2",
"description": "Lightweight Change Notice",
"operations": "READ",
"parent": {
"name": "WindchillEntities"
},
"generateDomainSpecificLinks": [
{
"domain": "ChangeMgmt",
"entitySet": "ChangeNotices"
}
],
"attributes":[
{
"name": "Name",
"internalName": "name",
"type": "String",
"required": true,
"dataUtilityId": "odata.ChangeItemPropertyName"
}, {
"name": "Number",
"internalName": "number",
"type": "String",
"dataUtilityId": "odata.ChangeItemPropertyNumber"
}, {
"name": "Identity",
"internalName": "displayIdentity",
"type": "String",
"readOnly": true,
"rbInfoForDisplayName": "com.ptc.cat.catTableRB|IDENTITY"
},{
"name":"State",
"internalName":"state.state",
"type":"PTC.EnumType",
"readOnly":true,
"dataUtilityId": "odata.ChangeItemPropertyState"
}
]
}
Request
GET /Windchill/servlet/odata/ProdMgmt/Parts(‘<oid>')?$select=Identity&$expand=RelatedChangeNotices
Accept: application/json;odata.metadata=full
Response
{
"@odata.context": “<Windchill_URL>/v6/ProdMgmt/$metadata#Parts(ID,Identity)/$entity",
"@odata.type": "#PTC.ProdMgmt.Part",
"@odata.id": “<Windchill_URL>/v6/ProdMgmt/Parts('OR:wt.part.WTPart:749554')",
"ID": "OR:wt.part.WTPart:749554",
"Identity": "Part - 0000000921, Test part for change, Demo Organization, A.1 (Design)",
"@PTC.AppliedContainerContext.LocalTimeZone": "America/St_Johns",
"RelatedChangeNotices": [
{
"@odata.type": "#PTC.ProdMgmt.LightweightCN",
"@odata.id": “<Windchill_URL>/v6/ProdMgmt/Parts('OR:wt.part.WTPart:749554')/RelatedChangeNotices('OR%3Awt.change2.WTChangeOrder2%3A749586')",
"CreatedOn@odata.type": "#DateTimeOffset",
"CreatedOn": "2023-05-12T10:34:31-02:30",
"ID": "OR:wt.change2.WTChangeOrder2:749586",
"LastModified@odata.type": "#DateTimeOffset",
"LastModified": "2023-05-12T10:34:31-02:30",
"CreatedBy": "Site, Administrator",
"Identity": "Change Notice - 00041",
"ModifiedBy": "Site, Administrator",
"Name": "CN",
"Number": "00041",
"State": {
"@odata.type": "#PTC.EnumType",
"Value": "OPEN",
"Display": "Open"
},
"@Core.Links": [
{
"rel@odata.type": "#String",
"rel": "ChangeMgmt/ChangeNotices",
"href@odata.type": "#String",
"href": “<Windchill_URL>/v7/ChangeMgmt/ChangeNotices('OR:wt.change2.WTChangeOrder2:749586')"
}
]
}
],
"RelatedChangeNotices@odata.navigationLink": “Windchill_URL/v6/ProdMgmt/Parts('OR:wt.part.WTPart:749554')/LightweightCNs"
}
 
Follow the Core.Links, to navigate to the ChangeNotice.
這是否有幫助?