Пример #1
0
  /** {@inheritDoc} */
  @Override
  @MethodLog
  public void addSensorTypeToMethod(long methodSensorTypeId, long methodId) {
    MethodIdentToSensorType methodIdentToSensorType =
        methodIdentToSensorTypeDao.find(methodId, methodSensorTypeId);
    if (null == methodIdentToSensorType) {
      MethodIdent methodIdent = methodIdentDao.load(methodId);
      MethodSensorTypeIdent methodSensorTypeIdent =
          methodSensorTypeIdentDao.load(methodSensorTypeId);
      methodIdentToSensorType =
          new MethodIdentToSensorType(methodIdent, methodSensorTypeIdent, null);
    }

    // always update the timestamp
    methodIdentToSensorType.setTimestamp(
        new Timestamp(GregorianCalendar.getInstance().getTimeInMillis()));

    methodIdentToSensorTypeDao.saveOrUpdate(methodIdentToSensorType);
  }