コード例 #1
0
  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);
    }
  }
コード例 #2
0
  public String deleteEntity(EntityWeb entityModel, RecordWeb entity) throws Exception {
    log.debug("Received request to delete entity instance record.");

    authenticateCaller();
    String msg = "";
    try {
      RecordManagerService entityInstanceService = Context.getRecordManagerService();
      EntityDefinitionManagerService entityDefService = Context.getEntityDefinitionManagerService();
      Entity entityDef = entityDefService.loadEntity(entityModel.getEntityVersionId());
      org.openhie.openempi.model.Record record =
          ModelTransformer.mapToRecord(entityDef, entity, Record.class);

      entityInstanceService.deleteRecord(entityDef, record);

    } catch (Throwable t) {
      log.error("Failed to delete entry instance: " + t, t);
      msg = t.getMessage();
    }
    return msg;
  }
コード例 #3
0
  public RecordWeb updateEntity(EntityWeb entityModel, RecordWeb entity) throws Exception {
    log.debug("Received request to update entity instance record.");

    authenticateCaller();
    try {
      RecordManagerService entityInstanceService = Context.getRecordManagerService();
      EntityDefinitionManagerService entityDefService = Context.getEntityDefinitionManagerService();
      Entity entityDef = entityDefService.loadEntity(entityModel.getEntityVersionId());
      org.openhie.openempi.model.Record record =
          ModelTransformer.mapToRecord(entityDef, entity, Record.class);

      Record updatedRecord = entityInstanceService.updateRecord(entityDef, record);

      return ModelTransformer.mapToRecord(updatedRecord, RecordWeb.class);

    } catch (Throwable t) {
      log.error("Failed to execute: " + t.getMessage(), t);
      throw new RuntimeException(t);
    }
  }