/** {@inheritDoc} */ @Override @MethodLog public long registerMethodIdent( long platformId, String packageName, String className, String methodName, List<String> parameterTypes, String returnType, int modifiers) { MethodIdent methodIdent = new MethodIdent(); methodIdent.setPackageName(packageName); methodIdent.setClassName(className); methodIdent.setMethodName(methodName); if (null == parameterTypes) { parameterTypes = Collections.emptyList(); } methodIdent.setParameters(parameterTypes); methodIdent.setReturnType(returnType); methodIdent.setModifiers(modifiers); List<MethodIdent> methodIdents = methodIdentDao.findForPlatformIdAndExample(platformId, methodIdent); if (1 == methodIdents.size()) { methodIdent = methodIdents.get(0); } else { PlatformIdent platformIdent = platformIdentDao.load(platformId); methodIdent.setPlatformIdent(platformIdent); } // always update the time stamp, no matter if this is an old or new // record. methodIdent.setTimeStamp(new Timestamp(GregorianCalendar.getInstance().getTimeInMillis())); methodIdentDao.saveOrUpdate(methodIdent); return methodIdent.getId(); }
/** {@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); }