Search in sources :

Example 56 with Property

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);
        }
    }
}
Also used : PropFoundEvent(org.olat.user.PropFoundEvent) Property(org.olat.properties.Property)

Example 57 with Property

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();
    }
}
Also used : OLATRuntimeException(org.olat.core.logging.OLATRuntimeException) PropertyManager(org.olat.properties.PropertyManager) Property(org.olat.properties.Property)

Example 58 with Property

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;
}
Also used : OLATRuntimeException(org.olat.core.logging.OLATRuntimeException) PropertyManager(org.olat.properties.PropertyManager) Property(org.olat.properties.Property)

Example 59 with Property

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());
    }
}
Also used : TableController(org.olat.core.gui.components.table.TableController) TableGuiConfiguration(org.olat.core.gui.components.table.TableGuiConfiguration) Property(org.olat.properties.Property) DefaultColumnDescriptor(org.olat.core.gui.components.table.DefaultColumnDescriptor)

Example 60 with Property

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);
}
Also used : PropertyManager(org.olat.properties.PropertyManager) Property(org.olat.properties.Property)

Aggregations

Property (org.olat.properties.Property)270 CoursePropertyManager (org.olat.course.properties.CoursePropertyManager)62 PropertyManager (org.olat.properties.PropertyManager)48 Identity (org.olat.core.id.Identity)36 NarrowedPropertyManager (org.olat.properties.NarrowedPropertyManager)36 ArrayList (java.util.ArrayList)24 PersistingCoursePropertyManager (org.olat.course.properties.PersistingCoursePropertyManager)22 BusinessGroup (org.olat.group.BusinessGroup)18 File (java.io.File)16 ICourse (org.olat.course.ICourse)16 Translator (org.olat.core.gui.translator.Translator)14 AssertException (org.olat.core.logging.AssertException)14 CourseNode (org.olat.course.nodes.CourseNode)14 Forum (org.olat.modules.fo.Forum)14 ForumManager (org.olat.modules.fo.manager.ForumManager)14 Test (org.junit.Test)12 SyncerExecutor (org.olat.core.util.coordinate.SyncerExecutor)12 XStream (com.thoughtworks.xstream.XStream)10 HashMap (java.util.HashMap)10 List (java.util.List)10