public RecordLinkWeb updateRecordLink(EntityWeb entityModel, RecordLinkWeb linkPair) throws Exception { log.debug("Received request to updaty an entity record link."); authenticateCaller(); try { RecordQueryService entityInstanceService = Context.getRecordQueryService(); RecordManagerService entityInstanceManagerService = Context.getRecordManagerService(); EntityDefinitionManagerService entityDefService = Context.getEntityDefinitionManagerService(); Entity entityDef = entityDefService.loadEntity(entityModel.getEntityVersionId()); RecordLink recordLink = ModelTransformer.mapToRecordLink(linkPair, RecordLink.class); RecordLink record = entityInstanceService.loadRecordLink(entityDef, recordLink.getRecordLinkId()); record.setState(recordLink.getState()); record = entityInstanceManagerService.updateRecordLink(record); RecordLinkWeb recordWeb = ModelTransformer.mapToRecordLink(record, RecordLinkWeb.class, true); return recordWeb; } catch (Throwable t) { log.error("Failed to execute: " + t.getMessage(), t); throw new RuntimeException(t); } }