public static ArrayList<TimeSlotType> getConstraintTimeSlotTypes(
     Session session, ConstraintType constraintType) throws BasicException {
   ArrayList<TimeSlotType> results = new ArrayList<TimeSlotType>();
   EntityDataLogic entityDataLogic = new EntityDataLogic(session);
   HashMap<Integer, HashMap<String, Object>> data =
       entityDataLogic.getContraintTimeSlotTypes(constraintType.toString());
   for (int i = 0; i < data.size(); i++) {
     HashMap<String, Object> tokens = data.get(i);
     TimeSlotType timeSlotType = valueOf((Integer) tokens.get("ID"), (String) tokens.get("name"));
     results.add(timeSlotType);
   }
   return results;
 }
  private <A extends Annotation, T> MetaConstraint<?> createMetaConstraint(
      ConstraintType constraint, Class<T> beanClass, Member member, String defaultPackage) {
    @SuppressWarnings("unchecked")
    Class<A> annotationClass = (Class<A>) getClass(constraint.getAnnotation(), defaultPackage);
    AnnotationDescriptor<A> annotationDescriptor = new AnnotationDescriptor<A>(annotationClass);

    if (constraint.getMessage() != null) {
      annotationDescriptor.setValue(MESSAGE_PARAM, constraint.getMessage());
    }
    annotationDescriptor.setValue(GROUPS_PARAM, getGroups(constraint.getGroups(), defaultPackage));
    annotationDescriptor.setValue(
        PAYLOAD_PARAM, getPayload(constraint.getPayload(), defaultPackage));

    for (ElementType elementType : constraint.getElement()) {
      String name = elementType.getName();
      checkNameIsValid(name);
      Class<?> returnType = getAnnotationParameterType(annotationClass, name);
      Object elementValue = getElementValue(elementType, returnType);
      annotationDescriptor.setValue(name, elementValue);
    }

    A annotation;
    try {
      annotation = AnnotationFactory.create(annotationDescriptor);
    } catch (RuntimeException e) {
      throw log.getUnableToCreateAnnotationForConfiguredConstraintException(e);
    }

    java.lang.annotation.ElementType type = java.lang.annotation.ElementType.TYPE;
    if (member instanceof Method) {
      type = java.lang.annotation.ElementType.METHOD;
    } else if (member instanceof Field) {
      type = java.lang.annotation.ElementType.FIELD;
    }

    // we set initially ConstraintOrigin.DEFINED_LOCALLY for all xml configured constraints
    // later we will make copies of this constraint descriptor when needed and adjust the
    // ConstraintOrigin
    ConstraintDescriptorImpl<A> constraintDescriptor =
        new ConstraintDescriptorImpl<A>(
            annotation, constraintHelper, type, ConstraintOrigin.DEFINED_LOCALLY);

    return new MetaConstraint<A>(
        constraintDescriptor, new BeanConstraintLocation(beanClass, member));
  }