use of org.olat.properties.Property in project OpenOLAT by OpenOLAT.
the class CollaborationTools method lookupFolderAccess.
public Long lookupFolderAccess() {
NarrowedPropertyManager npm = NarrowedPropertyManager.getInstance(ores);
Property property = npm.findProperty(null, null, PROP_CAT_BG_COLLABTOOLS, KEY_FOLDER_ACCESS);
if (property == null) {
// no entry
return null;
}
// read the long value of the existing property
return property.getLongValue();
}
use of org.olat.properties.Property in project OpenOLAT by OpenOLAT.
the class CollaborationTools method getPropertyOf.
Property getPropertyOf(String selectedTool) {
PropertyManager pm = PropertyManager.getInstance();
Property property = pm.findProperty(null, null, ores, PROP_CAT_BG_COLLABTOOLS, selectedTool);
Boolean res;
if (property == null) {
// meaning false
res = Boolean.FALSE;
} else {
String val = property.getStringValue();
res = val.equals(TRUE) ? Boolean.TRUE : Boolean.FALSE;
}
cacheToolStates.put(selectedTool, res);
return property;
}
use of org.olat.properties.Property in project OpenOLAT by OpenOLAT.
the class CollaborationTools method deleteTools.
/**
* delete all CollaborationTools stuff from the database, which is related to
* the calling OLATResourceable.
*/
public void deleteTools(BusinessGroup businessGroupTodelete) {
NarrowedPropertyManager npm = NarrowedPropertyManager.getInstance(ores);
/*
* delete the forum, if existing
*/
ForumManager fom = ForumManager.getInstance();
Property forumKeyProperty = npm.findProperty(null, null, PROP_CAT_BG_COLLABTOOLS, KEY_FORUM);
if (forumKeyProperty != null) {
// if there was a forum, delete it
Long forumKey = forumKeyProperty.getLongValue();
if (forumKey == null)
throw new AssertException("property had no longValue, prop:" + forumKeyProperty);
fom.deleteForum(forumKey);
}
/*
* delete the folder, if existing
*/
OlatRootFolderImpl vfsContainer = new OlatRootFolderImpl(getFolderRelPath(), null);
File fFolderRoot = vfsContainer.getBasefile();
if (fFolderRoot.exists()) {
FileUtils.deleteDirsAndFiles(fFolderRoot, true, true);
}
/*
* delete the wiki if existing
*/
VFSContainer rootContainer = WikiManager.getInstance().getWikiRootContainer(ores);
if (rootContainer != null)
rootContainer.delete();
/*
* Delete calendar if exists
*/
if (businessGroupTodelete != null) {
CoreSpringFactory.getImpl(ImportToCalendarManager.class).deleteGroupImportedCalendars(businessGroupTodelete);
CoreSpringFactory.getImpl(CalendarManager.class).deleteGroupCalendar(businessGroupTodelete);
}
/*
* delete chatRoom
*/
// no cleanup needed, automatically done when last user exits the room
/*
* delete all Properties defining enabled/disabled CollabTool XY and the
* news content
*/
npm.deleteProperties(null, null, PROP_CAT_BG_COLLABTOOLS, null);
/*
* Delete OpenMeetings room
*/
OpenMeetingsModule omModule = CoreSpringFactory.getImpl(OpenMeetingsModule.class);
if (omModule.isEnabled()) {
OpenMeetingsManager omManager = CoreSpringFactory.getImpl(OpenMeetingsManager.class);
try {
omManager.deleteAll(ores, null, null);
} catch (OpenMeetingsException e) {
log.error("A room could not be deleted for group: " + ores, e);
}
}
/*
* and last but not least the cache is reseted
*/
cacheToolStates.clear();
this.dirty = true;
}
use of org.olat.properties.Property in project openolat by klemens.
the class DbStorage method updatePreferencesFor.
@Override
public void updatePreferencesFor(Preferences prefs, Identity identity) {
String props = xstream.toXML(prefs);
Property property = getPreferencesProperty(identity);
if (property == null) {
property = PropertyManager.getInstance().createPropertyInstance(identity, null, null, null, DbStorage.USER_PROPERTY_KEY, null, null, null, props);
// also save the properties to db, here (strentini)
// fixes the "non-present gui preferences" for new users, or where guiproperties were manually deleted
PropertyManager.getInstance().saveProperty(property);
} else {
property.setTextValue(props);
PropertyManager.getInstance().updateProperty(property);
}
}
use of org.olat.properties.Property in project openolat by klemens.
the class GetInitialEnrollmentDateFunction method call.
/**
* @see com.neemsoft.jmep.FunctionCB#call(java.lang.Object[])
*/
public Object call(Object[] inStack) {
/*
* argument check
*/
if (inStack.length > 1) {
return handleException(new ArgumentParseException(ArgumentParseException.NEEDS_FEWER_ARGUMENTS, name, "", "error.fewerargs", "solution.provideone.nodereference"));
} else if (inStack.length < 1) {
return handleException(new ArgumentParseException(ArgumentParseException.NEEDS_MORE_ARGUMENTS, name, "", "error.moreargs", "solution.provideone.nodereference"));
}
/*
* argument type check
*/
if (!(inStack[0] instanceof String))
return handleException(new ArgumentParseException(ArgumentParseException.WRONG_ARGUMENT_FORMAT, name, "", "error.argtype.coursnodeidexpeted", "solution.example.node.infunction"));
String nodeId = (String) inStack[0];
/*
* check reference integrity
*/
CourseEditorEnv cev = getUserCourseEnv().getCourseEditorEnv();
if (cev != null) {
if (!cev.existsNode(nodeId)) {
return handleException(new ArgumentParseException(ArgumentParseException.REFERENCE_NOT_FOUND, name, nodeId, "error.notfound.coursenodeid", "solution.copypastenodeid"));
}
if (!cev.isEnrollmentNode(nodeId)) {
return handleException(new ArgumentParseException(ArgumentParseException.REFERENCE_NOT_FOUND, name, nodeId, "error.notenrollment.coursenodeid", "solution.chooseenrollment"));
}
// Allow self-referencing but do not allow dependencies to parents as they create cycles.
if (!nodeId.equals(cev.getCurrentCourseNodeId())) {
cev.addSoftReference("courseNodeId", nodeId, false);
}
// return a valid value to continue with condition evaluation test
return defaultValue();
}
/*
* the real function evaluation which is used during run time
*/
CourseNode node = getUserCourseEnv().getCourseEnvironment().getRunStructure().getNode(nodeId);
// invalid node id's return still a valid double
// TODO fg: check with editor tree model DONE: the above checks ensure only
// valid node references
// if (node == null) return new Double(Double.NEGATIVE_INFINITY);
CoursePropertyManager pm = getUserCourseEnv().getCourseEnvironment().getCoursePropertyManager();
Identity identity = getUserCourseEnv().getIdentityEnvironment().getIdentity();
Property firstTime = pm.findCourseNodeProperty(node, identity, null, ENCourseNode.PROPERTY_INITIAL_ENROLLMENT_DATE);
if (firstTime != null) {
String firstTimeMillis = firstTime.getStringValue();
return Double.valueOf(firstTimeMillis);
} else {
// what to do in case of no date available??? -> return date in the future
return new Double(Double.POSITIVE_INFINITY);
}
}
Aggregations