use of org.olat.properties.Property in project openolat by klemens.
the class UserAdminController method event.
/**
* @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest, org.olat.core.gui.control.Controller, org.olat.core.gui.control.Event)
*/
@Override
public void event(UserRequest ureq, Controller source, Event event) {
if (source == propertiesCtr) {
if (event.getCommand().equals("PropFound")) {
PropFoundEvent foundEvent = (PropFoundEvent) event;
Property myfoundProperty = foundEvent.getProperty();
showInfo(NLS_FOUND_PROPERTY, myfoundProperty.getKey().toString());
}
} else if (source == pwdCtr) {
if (event == Event.DONE_EVENT) {
// rebuild authentication tab, could be wrong now
if (authenticationsCtr != null) {
authenticationsCtr.rebuildAuthenticationsTableDataModel();
}
}
} else if (source == userProfileCtr) {
if (event == Event.DONE_EVENT) {
// reload profile data on top
myIdentity = (Identity) DBFactory.getInstance().loadObject(myIdentity);
exposeUserDataToVC(ureq, myIdentity);
userProfileCtr.resetForm(ureq);
}
}
}
use of org.olat.properties.Property in project openolat by klemens.
the class QuotaManagerImpl method setCustomQuotaKB.
/**
* Sets or updates the quota (in KB) for this path. Important: Must provide a
* path with a valid base.
*
* @param quota
*/
@Override
public void setCustomQuotaKB(Quota quota) {
if (defaultQuotas == null) {
throw new OLATRuntimeException(QuotaManagerImpl.class, "Quota manager has not been initialized properly! Must call init() first.", null);
}
PropertyManager pm = PropertyManager.getInstance();
Property p = pm.findProperty(null, null, quotaResource, QUOTA_CATEGORY, quota.getPath());
if (p == null) {
// create new entry
p = pm.createPropertyInstance(null, null, quotaResource, QUOTA_CATEGORY, quota.getPath(), null, null, assembleQuota(quota), null);
pm.saveProperty(p);
} else {
p.setStringValue(assembleQuota(quota));
pm.updateProperty(p);
}
// if the quota is a default quota, rebuild the default quota list
if (quota.getPath().startsWith(QuotaConstants.IDENTIFIER_DEFAULT)) {
initDefaultQuotas();
}
}
use of org.olat.properties.Property in project openolat by klemens.
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;
}
use of org.olat.properties.Property in project openolat by klemens.
the class AdvancedPropertiesController method event.
/**
* @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest, org.olat.core.gui.control.Controller, org.olat.core.gui.control.Event)
*/
public void event(UserRequest ureq, Controller source, Event event) {
if (source == searchForm && event == Event.DONE_EVENT) {
String resourceTypeName = searchForm.getResourceTypeName();
String resourceTypeId = searchForm.getResourceTypeId();
Long resTypeId = null;
if (resourceTypeId != null && !resourceTypeId.equals(""))
resTypeId = Long.valueOf(resourceTypeId);
String category = searchForm.getCategory();
if (category != null && category.equals(""))
category = null;
String propertyName = searchForm.getPropertyName();
if (propertyName != null && propertyName.equals(""))
propertyName = null;
List<Property> entries = PropertyManager.getInstance().listProperties(searchForm.getIdentity(), null, resourceTypeName, resTypeId, category, propertyName);
PropertiesTableDataModel ptdm = new PropertiesTableDataModel(entries, isAdministrativeUser);
TableGuiConfiguration tableConfig = new TableGuiConfiguration();
removeAsListenerAndDispose(tableCtr);
tableCtr = new TableController(tableConfig, ureq, getWindowControl(), getTranslator());
// use null as listener argument because we are using listenTo(..) from basiccontroller
tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.userName", 0, null, getLocale()));
tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.resourceTypeName", 1, null, getLocale()));
tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.resourceTypeId", 2, null, getLocale(), ColumnDescriptor.ALIGNMENT_RIGHT));
tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.category", 3, null, getLocale()));
tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.name", 4, null, getLocale()));
tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.floatValue", 5, null, getLocale(), ColumnDescriptor.ALIGNMENT_RIGHT));
tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.stringValue", 6, null, getLocale()));
tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.longValue", 10, null, getLocale()));
tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.textValue", 7, null, getLocale()));
tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.creationdate", 8, null, getLocale()));
tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.lastmodified", 9, null, getLocale()));
tableCtr.setTableDataModel(ptdm);
listenTo(tableCtr);
myPanel.setContent(tableCtr.getInitialComponent());
}
}
use of org.olat.properties.Property 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);
}
Aggregations