use of org.olat.properties.NarrowedPropertyManager in project OpenOLAT by OpenOLAT.
the class CollaborationTools method getForum.
public Forum getForum() {
final ForumManager fom = ForumManager.getInstance();
final NarrowedPropertyManager npm = NarrowedPropertyManager.getInstance(ores);
Property forumProperty = npm.findProperty(null, null, PROP_CAT_BG_COLLABTOOLS, KEY_FORUM);
Forum forum;
if (forumProperty != null) {
forum = fom.loadForum(forumProperty.getLongValue());
} else {
forum = coordinatorManager.getCoordinator().getSyncer().doInSync(ores, new SyncerCallback<Forum>() {
@Override
public Forum execute() {
Forum aforum;
Long forumKey;
Property forumKeyProperty = npm.findProperty(null, null, PROP_CAT_BG_COLLABTOOLS, KEY_FORUM);
if (forumKeyProperty == null) {
// First call of forum, create new forum and save
aforum = fom.addAForum();
forumKey = aforum.getKey();
if (log.isDebug()) {
log.debug("created new forum in collab tools: foid::" + forumKey.longValue() + " for ores::" + ores.getResourceableTypeName() + "/" + ores.getResourceableId());
}
forumKeyProperty = npm.createPropertyInstance(null, null, PROP_CAT_BG_COLLABTOOLS, KEY_FORUM, null, forumKey, null, null);
npm.saveProperty(forumKeyProperty);
} else {
// Forum does already exist, load forum with key from properties
forumKey = forumKeyProperty.getLongValue();
aforum = fom.loadForum(forumKey);
if (aforum == null) {
throw new AssertException("Unable to load forum with key " + forumKey.longValue() + " for ores " + ores.getResourceableTypeName() + " with key " + ores.getResourceableId());
}
if (log.isDebug()) {
log.debug("loading forum in collab tools from properties: foid::" + forumKey.longValue() + " for ores::" + ores.getResourceableTypeName() + "/" + ores.getResourceableId());
}
}
return aforum;
}
});
}
return forum;
}
use of org.olat.properties.NarrowedPropertyManager in project OpenOLAT by OpenOLAT.
the class CollaborationTools method saveFolderAccess.
public void saveFolderAccess(Long folderrAccess) {
NarrowedPropertyManager npm = NarrowedPropertyManager.getInstance(ores);
Property property = npm.findProperty(null, null, PROP_CAT_BG_COLLABTOOLS, KEY_FOLDER_ACCESS);
if (property == null) {
// create a new one
Property nP = npm.createPropertyInstance(null, null, PROP_CAT_BG_COLLABTOOLS, KEY_FOLDER_ACCESS, null, folderrAccess, null, null);
npm.saveProperty(nP);
} else {
// modify the existing one
property.setLongValue(folderrAccess);
npm.updateProperty(property);
}
}
use of org.olat.properties.NarrowedPropertyManager in project OpenOLAT by OpenOLAT.
the class CollaborationTools method getNewsAccessProperty.
/**
* @return Gets the news access property
*/
public String getNewsAccessProperty() {
NarrowedPropertyManager npm = NarrowedPropertyManager.getInstance(ores);
Property property = npm.findProperty(null, null, PROP_CAT_BG_COLLABTOOLS, KEY_NEWS_ACCESS);
if (property == null) {
// no entry
return null;
}
// read the text value of the existing property
String text = property.getStringValue();
return text;
}
use of org.olat.properties.NarrowedPropertyManager in project OpenOLAT by OpenOLAT.
the class CollaborationTools method saveNewsAccessProperty.
/**
* @param Save news access property.
*/
public void saveNewsAccessProperty(String access) {
NarrowedPropertyManager npm = NarrowedPropertyManager.getInstance(ores);
Property property = npm.findProperty(null, null, PROP_CAT_BG_COLLABTOOLS, KEY_NEWS_ACCESS);
if (property == null) {
// create a new one
Property nP = npm.createPropertyInstance(null, null, PROP_CAT_BG_COLLABTOOLS, KEY_NEWS_ACCESS, null, null, access, null);
npm.saveProperty(nP);
} else {
// modify the existing one
property.setStringValue(access);
npm.updateProperty(property);
}
}
use of org.olat.properties.NarrowedPropertyManager in project OpenOLAT by OpenOLAT.
the class CollaborationTools method saveNews.
/**
* @param news
*/
public void saveNews(String news) {
NarrowedPropertyManager npm = NarrowedPropertyManager.getInstance(ores);
Property property = npm.findProperty(null, null, PROP_CAT_BG_COLLABTOOLS, KEY_NEWS);
if (property == null) {
// create a new one
Property nP = npm.createPropertyInstance(null, null, PROP_CAT_BG_COLLABTOOLS, KEY_NEWS, null, null, null, news);
npm.saveProperty(nP);
} else {
// modify the existing one
property.setTextValue(news);
npm.updateProperty(property);
}
}
Aggregations