/** * Persists this object to the database by storing its data as XML blobs. * * @throws PropertyException when the operations fails. */ public void persist() throws PropertyException { try { // first check if we have to create/update the property defintion or merely // have to add an PropertyLookup entry for it. if (!existingPropertyDef) { // we are dealing with a property definition that was defined in this // uol. So create/up the definition and optionally add the property lookup try { // try to find find the property definition pdf = new PropertyDefFacade(uolId, propId); // update this definition pdf.setDto(dto); } catch (FinderException ex) { // no PropertyDef was found, so create a new PropertyDef pdf = new PropertyDefFacade(dto); // set the values for this definitions dto = pdf.getDto(); // create an entry for this PropertyDefEntity the PropertyLookUp new PropertyLookUpFacade(uolId, propId, dto.getPropDefPK(), dto.getDataType()); } } else { // The definition was created outside this uol so only the lookup table needs to be altered. PropertyLookUpFacade plf; // check if the lookup already exists try { plf = new PropertyLookUpFacade(uolId, propId); // found, remove the lookup record plf.remove(); } catch (FinderException ex1) { // nothing needs to happen } // not found or removed, create an new entry for this existing PropertyDefEntity new PropertyLookUpFacade(uolId, propId, dto.getPropDefPK(), dto.getDataType()); } } catch (CreateException ex) { throw new PropertyException(ex); } catch (RemoveException ex) { throw new PropertyException(ex); } }
/** * Returns the data type of this property. Allowed data types are: activity-structure, * activity-tree, act, environment, environment-tree, expression, learning-activity, * learning-object, monitor, play, rolepart, roles-tree, send-mail, support-activity, * unit-of-learning, integer, real, string, text, datetime, duration, file, boolean and uri. * * @return String representing the data type of this PropertyDefinition */ public String getDataType() { return dto.getDataType(); }