use of org.olat.properties.PropertyManager in project openolat by klemens.
the class InfoMessageManager method setInfoMessageNodeOnly.
/**
* set info message on node level only, no need to sync
* @param message
*/
public void setInfoMessageNodeOnly(String message) {
PropertyManager pm = PropertyManager.getInstance();
Property p = pm.findProperty(null, null, null, "_o3_", INFO_MSG_NODE_ONLY + nodeId);
if (p == null) {
p = pm.createPropertyInstance(null, null, null, "_o3_", INFO_MSG_NODE_ONLY + nodeId, null, null, null, "");
pm.saveProperty(p);
}
p.setTextValue(message);
// set Message in RAM
InfoMessageManager.infoMessageNodeOnly = message;
pm.updateProperty(p);
}
use of org.olat.properties.PropertyManager in project OpenOLAT by OpenOLAT.
the class DBPersistentLockManager method aquirePersistentLock.
/**
* @see org.olat.core.util.locks.PersistentLockManager#aquirePersistentLock(org.olat.core.id.OLATResourceable,
* org.olat.core.id.Identity, java.lang.String)
*/
@Override
public LockResult aquirePersistentLock(OLATResourceable ores, Identity ident, String locksubkey) {
// synchronisation is solved in the LockManager
LockResult lres;
PropertyManager pm = PropertyManager.getInstance();
String derivedLockString = OresHelper.createStringRepresenting(ores, locksubkey);
long aqTime;
Identity lockOwner;
boolean success;
Property p;
p = pm.findProperty(null, null, null, CATEGORY_PERSISTENTLOCK, derivedLockString);
if (p == null) {
// no persistent lock acquired yet
// save a property: cat = o_lock, key = derivedLockString, Longvalue = key
// of identity acquiring the lock
Property newp = pm.createPropertyInstance(null, null, null, CATEGORY_PERSISTENTLOCK, derivedLockString, null, ident.getKey(), null, null);
pm.saveProperty(newp);
aqTime = System.currentTimeMillis();
lockOwner = ident;
success = true;
} else {
// already acquired, but check on reaquiring
aqTime = p.getLastModified().getTime();
Long lockOwnerKey = p.getLongValue();
if (ident.getKey().equals(lockOwnerKey)) {
// reaquire ok
success = true;
} else {
// already locked by an other person
success = false;
}
// FIXME:fj:c find a better way to retrieve information about the
// lock-holder
lockOwner = BaseSecurityManager.getInstance().loadIdentityByKey(lockOwnerKey);
}
LockEntry le = new LockEntry(derivedLockString, aqTime, lockOwner);
lres = new LockResultImpl(success, le);
return lres;
}
use of org.olat.properties.PropertyManager in project OpenOLAT by OpenOLAT.
the class CourseNodePasswordManagerImpl method deleteAllPasswordsFor.
/**
* @see de.bps.course.nodes.CourseNodePasswordManager#deleteAllPasswordsFor(java.lang.Long)
*/
public void deleteAllPasswordsFor(OLATResourceable ores) {
PropertyManager pm = PropertyManager.getInstance();
List<Property> properties = pm.listProperties(null, null, AdditionalConditionAnswerContainer.RESOURCE_NAME, null, null, AdditionalConditionAnswerContainer.RESOURCE_NAME, ores.getResourceableId(), null);
for (Property p : properties) {
Long nodeId = p.getResourceTypeId();
Long courseId = p.getLongValue();
removeAnswers(nodeId, courseId);
pm.deleteProperty(p);
}
}
use of org.olat.properties.PropertyManager in project OpenOLAT by OpenOLAT.
the class InfoMessageManager method setInfoMessageNodeOnly.
/**
* set info message on node level only, no need to sync
* @param message
*/
public void setInfoMessageNodeOnly(String message) {
PropertyManager pm = PropertyManager.getInstance();
Property p = pm.findProperty(null, null, null, "_o3_", INFO_MSG_NODE_ONLY + nodeId);
if (p == null) {
p = pm.createPropertyInstance(null, null, null, "_o3_", INFO_MSG_NODE_ONLY + nodeId, null, null, null, "");
pm.saveProperty(p);
}
p.setTextValue(message);
// set Message in RAM
InfoMessageManager.infoMessageNodeOnly = message;
pm.updateProperty(p);
}
use of org.olat.properties.PropertyManager in project OpenOLAT by OpenOLAT.
the class QuotaManagerImpl method deleteCustomQuota.
/**
* @param quota to be deleted
* @return true if quota successfully deleted or no such quota, false if quota
* not deleted because it was a default quota that can not be deleted
*/
@Override
public boolean deleteCustomQuota(Quota quota) {
if (defaultQuotas == null) {
throw new OLATRuntimeException(QuotaManagerImpl.class, "Quota manager has not been initialized properly! Must call init() first.", null);
}
// do not allow to delete default quotas!
if (quota.getPath().startsWith(QuotaConstants.IDENTIFIER_DEFAULT)) {
return false;
}
PropertyManager pm = PropertyManager.getInstance();
Property p = pm.findProperty(null, null, quotaResource, QUOTA_CATEGORY, quota.getPath());
if (p != null)
pm.deleteProperty(p);
return true;
}
Aggregations