Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
protected setup(routeData: PaneRouteData) {
// subscription means may get with no oid
if (!routeData.objectId) {
this.mode = null;
return;
}
this.expiredTransient = false;
const oid = Ro.ObjectIdWrapper.fromObjectId(routeData.objectId, this.configService.config.keySeparator);
if (this.object && !this.object.domainObject.getOid().isSame(oid)) {
// object has changed - clear existing
this.clearCurrentObject();
}
const isChanging = !this.object;
const modeChanging = this.mode !== routeData.interactionMode;
this.mode = routeData.interactionMode;
const wasDirty = this.isDirty(routeData, oid);
this.selectedDialogId = routeData.dialogId;
return () => {
const selfLink = parent.selfLink();
const oid = Ro.ObjectIdWrapper.fromLink(selfLink, this.keySeparator);
this.dirtyList.setDirty(oid);
this.setCurrentObjectsDirty();
clearCacheIfNecessary();
};
}
getActionExtensions(routeData: PaneRouteData): Promise {
return routeData.objectId
? this.context.getActionExtensionsFromObject(routeData.paneId, Ro.ObjectIdWrapper.fromObjectId(routeData.objectId, this.configService.config.keySeparator), routeData.actionId)
: this.context.getActionExtensionsFromMenu(routeData.menuId, routeData.actionId);
}
protected setup(routeData: PaneRouteData) {
const oid = Ro.ObjectIdWrapper.fromObjectId(routeData.objectId, this.configService.config.keySeparator);
this.context.getObject(routeData.paneId, oid, routeData.interactionMode)
.then((object: Ro.DomainObjectRepresentation) => {
const attachmentId = routeData.attachmentId;
const attachment = object.propertyMember(attachmentId);
if (attachment) {
const avm = this.viewModelFactory.attachmentViewModel(attachment, routeData.paneId);
if (avm) {
avm.setImage(this);
}
}
})
.catch((reject: ErrorWrapper) => this.error.handleError(reject));
this.setErrorPreprocessor(reject => {
if (reject.category === ErrorCategory.HttpClientError && reject.httpErrorCode === HttpStatusCode.PreconditionFailed) {
if (reject.originalUrl) {
const oid = Ro.ObjectIdWrapper.fromHref(reject.originalUrl, configService.config.keySeparator);
this.context.setConcurrencyError(oid);
reject.handled = true;
}
}
});
}
isDirty(paneRouteData: PaneRouteData, oid?: Ro.ObjectIdWrapper) {
oid = oid || Ro.ObjectIdWrapper.fromObjectId(paneRouteData.objectId, this.configService.config.keySeparator);
return this.context.getIsDirty(oid);
}
getListFromObject = (routeData: PaneRouteData, page?: number, pageSize?: number) => {
const objectId = routeData.objectId;
const actionId = routeData.actionId;
const parms = routeData.actionParams;
const state = routeData.state;
const oid = Ro.ObjectIdWrapper.fromObjectId(objectId, this.keySeparator);
const paneId = routeData.paneId;
const newPage = page || routeData.page;
const newPageSize = pageSize || routeData.pageSize;
const urlParms = Ro.getPagingParms(newPage, newPageSize);
if (state === CollectionViewState.Table) {
Ro.inlineCollectionItems(true, urlParms);
}
const promise = () => this.getObject(paneId, oid, InteractionMode.View)
.then(object => this.getInvokableAction(object.actionMember(actionId)))
.then(details => this.repLoader.invoke(details, parms, urlParms));
return this.getList(paneId, promise, newPage, newPageSize);
}
private typeFromUrl(url: string): string {
const oid = Ro.ObjectIdWrapper.fromHref(url, this.configService.config.keySeparator);
return oid.domainType;
}
getActionExtensions(routeData: PaneRouteData): Promise {
return routeData.objectId
? this.context.getActionExtensionsFromObject(routeData.paneId, Ro.ObjectIdWrapper.fromObjectId(routeData.objectId, this.configService.config.keySeparator), routeData.actionId)
: this.context.getActionExtensionsFromMenu(routeData.menuId, routeData.actionId);
}