/**
   * Removes all property definitions belonging to the specified unit of learning.
   *
   * @param uolId int the id of the unit of learning to remove all property definitions for.
   * @throws FinderException when the specified unit of learning could not be found
   * @throws RemoveException when there is an error removing a property definition
   */
  public static void removeDefinitions(int uolId) throws FinderException, RemoveException {

    // Collect the PropertyEntities matching the criteria of user and run
    Collection propDefPks = getHome().findByUol(uolId);

    // delete each of the properties
    Iterator iter = propDefPks.iterator();
    while (iter.hasNext()) {
      boolean remove = true;

      PropertyDefEntity propDefEntity = (PropertyDefEntity) iter.next();

      // check if we are dealing with a global definition
      if (((PropertyDef.ISLOCAL & propDefEntity.getDto().getScope()) == 0)) {
        // we should check if this definition is used by other uol

        // get all facades using this global def
        Collection plfs = PropertyLookUpFacade.findLookups(propDefEntity.getDto().getPropDefPK());

        // check which property are defined by this UOL
        Iterator iter2 = plfs.iterator();
        while (iter2.hasNext()) {
          PropertyLookUpFacade plf = (PropertyLookUpFacade) iter2.next();

          // if this definition was used by another uol the uolId in the lookup
          // table will differ
          if (plf.getDto().getUolId() != uolId) {
            // another uol is using this definition
            remove = false;
            break;
          }
        }
      }

      // check if we have to remove this propertyDef
      if (remove) {
        propDefEntity.remove();
      }
    }
  }
 /**
  * Sets the values of a PropertyDefEntity via a data transfer object.
  *
  * @param dto PropertyDefDto the new values of this instance
  * @see #getDto
  */
 public void setDto(PropertyDefDto dto) {
   pde.setDto(dto);
 }
 /**
  * Returns the PropertyDto of corresponding PropertyEntity.
  *
  * @return PropertyDto the data transfer object containing the data of this instance
  * @see #setDto
  */
 public PropertyDefDto getDto() {
   return pde.getDto();
 }