Ejemplo n.º 1
0
 public void delete() throws ModelException {
   try {
     log.info(MessageFormat.format(Local.getString("message.deleting_attribute"), this.getName()));
     HibernateHelper.delete(this);
   } catch (HelperException e) {
     throw new ModelException(e.getMessage(), e);
   }
 }
Ejemplo n.º 2
0
 public static Set<Attribute> getAll(Dimension dimension) throws ModelException {
   try {
     return HibernateHelper.get(
         "from Attribute a where a.dimension = ?",
         new Object[] {dimension},
         new Type[] {Hibernate.entity(Dimension.class)});
   } catch (HelperException e) {
     throw new ModelException(e.getMessage(), e);
   }
 }
Ejemplo n.º 3
0
  public static Attribute getStandard(Dimension dimension, int level) throws ModelException {
    Set<Attribute> attributes = null;
    try {
      attributes =
          HibernateHelper.get(
              "from Attribute a where a.dimension = ? and a.standard = ? and a.level = ?",
              new Object[] {dimension, true, level},
              new Type[] {Hibernate.entity(Dimension.class), Hibernate.BOOLEAN, Hibernate.INTEGER});
    } catch (HelperException e) {
      throw new ModelException(e.getMessage(), e);
    }

    return attributes.size() > 0 ? attributes.iterator().next() : null;
  }
Ejemplo n.º 4
0
 public void persist() throws ModelException {
   try {
     if (id == -1) {
       log.info(
           MessageFormat.format(Local.getString("message.creating_attribute"), this.getName()));
       HibernateHelper.save(this);
     } else {
       log.info(
           MessageFormat.format(Local.getString("message.updating_attribute"), this.getName()));
       HibernateHelper.update(this);
     }
   } catch (HelperException e) {
     throw new ModelException(e.getMessage(), e);
   }
 }