prompt stringlengths 69 97 | response stringlengths 47 175 |
|---|---|
### Instruction:
Retrieve the current logged-in user in Windchill.
### Response:
| WTPrincipal currentPrincipal = SessionHelper.manager.getPrincipal(); |
### Instruction:
Disable access enforcement in Windchill temporarily.
### Response:
| boolean accessEnforced = SessionServerHelper.manager.setAccessEnforced(false); |
### Instruction:
Retrieve a WTPart object from Windchill using its OID.
### Response:
| ReferenceFactory rf = new ReferenceFactory();
WTPart part = (WTPart) rf.getReference(oid).getObject(); |
### Instruction:
Fetch a WTPart object by its number using QuerySpec.
### Response:
| QuerySpec qs = new QuerySpec(WTPart.class);
qs.appendWhere(new SearchCondition(WTPart.class, WTPart.NUMBER, SearchCondition.EQUAL, partNumber), new int[] { 0 }); |
### Instruction:
Get the latest version of a WTPart from QueryResult.
### Response:
| QueryResult qr1 = new LatestConfigSpec().process(qr);
WTPart latestPart = (WTPart) qr1.nextElement(); |
### Instruction:
Get a WTOrganization object by name.
### Response:
| WTOrganization wtOrg = OrganizationUtil.getWTOrganization(orgName); |
### Instruction:
Retrieve WTContainerRef from WTOrganization.
### Response:
| WTContainerRef orgContainerRef = WTContainerHelper.service.getOrgContainerRef(wtOrg); |
### Instruction:
Find organization admins in Windchill.
### Response:
| List orgAdmins = UserUtil.findOrgAdmins(wtOrg); |
### Instruction:
Set Windchill session to administrator if no org admin found.
### Response:
| if (orgAdmins == null || orgAdmins.isEmpty()) {
SessionHelper.manager.setAdministrator();
} |
### Instruction:
Set Windchill session to first organization admin.
### Response:
| WTUser admin = (WTUser) orgAdmins.get(0);
SessionHelper.manager.setAuthenticatedPrincipal(admin.getAuthenticationName()); |
### Instruction:
Create a new PDMLinkProduct container.
### Response:
| PDMLinkProduct prod = PDMLinkProduct.newPDMLinkProduct();
prod.setName(name);
prod.setDescription(Desc); |
### Instruction:
Assign container references and owner to a PDMLinkProduct.
### Response:
| prod.setContainerReference(orgContainerRef);
prod.setContainerTemplateReference(containerTemplateRef);
prod.setCreator(user);
prod.setOwner(user); |
### Instruction:
Create PDMLinkProduct using WTContainerHelper.
### Response:
| prod = (PDMLinkProduct) WTContainerHelper.service.create(prod); |
### Instruction:
Invoke a method remotely in Windchill using RemoteMethodServer.
### Response:
| if (!RemoteMethodServer.ServerFlag) {
return (List) RemoteMethodServer.getDefault().invoke("methodName", ClassName.class.getName(), null, new Class[]{}, new Object[]{});
} |
### Instruction:
Create a QuerySpec to find WTDocuments by number.
### Response:
| SearchCondition sc = new SearchCondition(WTDocument.class, "master>number", SearchCondition.EQUAL, number);
querySpec.appendWhere(sc, new int[] { 0 }); |
### Instruction:
Create a QuerySpec to find WTDocuments by state.
### Response:
| SearchCondition sc = new SearchCondition(WTDocument.class, "state.state", SearchCondition.EQUAL, state);
querySpec.appendWhere(sc, new int[] { 0 }); |
### Instruction:
Apply LatestConfigSpec on a QueryResult to get latest documents.
### Response:
| QueryResult qr = new LatestConfigSpec().process(qr); |
### Instruction:
Fetch baseline items from a PromotionNotice.
### Response:
| MaturityBaseline baseline = promotionNotice.getConfiguration();
QueryResult qr = BaselineHelper.service.getBaselineItems(baseline); |
### Instruction:
Check and update non-latest items in a baseline.
### Response:
| if (!VersionControlHelper.isLatestIteration(itd)) {
staleSet.add(itd);
itd = VersionControlHelper.getLatestIteration(itd, false);
latestSet.add(itd);
} |
### Instruction:
Replace outdated items in a baseline with latest ones.
### Response:
| BaselineHelper.service.removeFromBaseline(baseline, staleSet);
BaselineHelper.service.addToBaseline(latestSet, baseline); |
### Instruction:
Get promotion seeds from a PromotionNotice.
### Response:
| QueryResult qr2 = MaturityHelper.getService().getPromotionSeeds(promotionNotice); |
### Instruction:
Update promotion seeds to their latest iteration.
### Response:
| MaturityHelper.getService().deletePromotionSeeds(promotionNotice, staleSet);
MaturityHelper.getService().savePromotionSeeds(promotionNotice, latestSet); |
### Instruction:
Get promotion targets from a PromotionNotice.
### Response:
| QueryResult qr3 = MaturityHelper.getService().getPromotionTargets(promotionNotice); |
### Instruction:
Update promotion targets to latest iterations.
### Response:
| MaturityHelper.getService().deletePromotionTargets(promotionNotice, staleSet);
MaturityHelper.getService().savePromotionTargets(promotionNotice, latestSet); |
### Instruction:
Add WTDocuments to result list from QueryResult.
### Response:
| while (qr.hasMoreElements()) {
WTDocument doc = (WTDocument) qr.nextElement();
list.add(doc);
} |
README.md exists but content is empty.
- Downloads last month
- 5