Search in sources :

Example 86 with Property

use of org.olat.properties.Property in project openolat by klemens.

the class ViteroBookingsAdminController method openResource.

protected void openResource(UserRequest ureq, ViteroBooking booking) {
    Property prop = booking.getProperty();
    if (prop != null) {
        String url;
        if (prop.getGrp() != null) {
            url = "[BusinessGroup:" + prop.getGrp().getKey() + "]";
        } else {
            OLATResourceable ores = OresHelper.createOLATResourceableInstance(prop.getResourceTypeName(), prop.getResourceTypeId());
            RepositoryEntry re = RepositoryManager.getInstance().lookupRepositoryEntry(ores, false);
            if (re != null) {
                url = "[RepositoryEntry:" + re.getKey() + "]";
            } else {
                showWarning("resource.dont.exist");
                return;
            }
        }
        BusinessControl bc = BusinessControlFactory.getInstance().createFromString(url);
        WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(bc, getWindowControl());
        NewControllerFactory.getInstance().launch(ureq, bwControl);
    }
}
Also used : OLATResourceable(org.olat.core.id.OLATResourceable) BusinessControl(org.olat.core.id.context.BusinessControl) RepositoryEntry(org.olat.repository.RepositoryEntry) WindowControl(org.olat.core.gui.control.WindowControl) Property(org.olat.properties.Property)

Example 87 with Property

use of org.olat.properties.Property in project openolat by klemens.

the class EPSettingsManager method setSavedFilterSettings.

public void setSavedFilterSettings(Identity ident, List<EPFilterSettings> filterList) {
    Property p = propertyManager.findProperty(ident, null, null, EPORTFOLIO_CATEGORY, EPORTFOLIO_FILTER_SETTINGS);
    if (p == null) {
        p = propertyManager.createUserPropertyInstance(ident, EPORTFOLIO_CATEGORY, EPORTFOLIO_FILTER_SETTINGS, null, null, null, null);
    }
    // don't persist filters without a name
    for (Iterator<EPFilterSettings> iterator = filterList.iterator(); iterator.hasNext(); ) {
        EPFilterSettings epFilterSettings = iterator.next();
        if (!StringHelper.containsNonWhitespace(epFilterSettings.getFilterName())) {
            iterator.remove();
        }
    }
    XStream xStream = XStreamHelper.createXStreamInstance();
    xStream.aliasType("EPFilterSettings", EPFilterSettings.class);
    String filterListXML = xStream.toXML(filterList);
    p.setTextValue(filterListXML);
    propertyManager.saveProperty(p);
}
Also used : EPFilterSettings(org.olat.portfolio.model.EPFilterSettings) XStream(com.thoughtworks.xstream.XStream) Property(org.olat.properties.Property)

Example 88 with Property

use of org.olat.properties.Property in project openolat by klemens.

the class EPSettingsManager method getSavedFilterSettings.

@SuppressWarnings("unchecked")
public List<EPFilterSettings> getSavedFilterSettings(Identity ident) {
    Property p = propertyManager.findProperty(ident, null, null, EPORTFOLIO_CATEGORY, EPORTFOLIO_FILTER_SETTINGS);
    List<EPFilterSettings> result = new ArrayList<EPFilterSettings>();
    if (p == null) {
        result.add(new EPFilterSettings());
    } else {
        XStream xStream = XStreamHelper.createXStreamInstance();
        xStream.aliasType("EPFilterSettings", EPFilterSettings.class);
        try {
            result = (List<EPFilterSettings>) xStream.fromXML(p.getTextValue());
        } catch (Exception e) {
            // it's not a live critical part
            logWarn("Cannot read filter settings", e);
        }
    }
    return result;
}
Also used : EPFilterSettings(org.olat.portfolio.model.EPFilterSettings) XStream(com.thoughtworks.xstream.XStream) ArrayList(java.util.ArrayList) Property(org.olat.properties.Property)

Example 89 with Property

use of org.olat.properties.Property in project openolat by klemens.

the class EPSettingsManager method setArtefactAttributeConfig.

public void setArtefactAttributeConfig(Identity ident, Map<String, Boolean> artAttribConfig) {
    Property p = propertyManager.findProperty(ident, null, null, EPORTFOLIO_CATEGORY, EPORTFOLIO_ARTEFACTS_ATTRIBUTES);
    if (p == null) {
        p = propertyManager.createUserPropertyInstance(ident, EPORTFOLIO_CATEGORY, EPORTFOLIO_ARTEFACTS_ATTRIBUTES, null, null, null, null);
    }
    XStream xStream = XStreamHelper.createXStreamInstance();
    String artAttribXML = xStream.toXML(artAttribConfig);
    p.setTextValue(artAttribXML);
    propertyManager.saveProperty(p);
}
Also used : XStream(com.thoughtworks.xstream.XStream) Property(org.olat.properties.Property)

Example 90 with Property

use of org.olat.properties.Property in project openolat by klemens.

the class EPFrontendManager method deleteGroupDataFor.

@Override
public boolean deleteGroupDataFor(BusinessGroup group) {
    final NarrowedPropertyManager npm = NarrowedPropertyManager.getInstance(group);
    final Property mapKeyProperty = npm.findProperty(null, null, CollaborationTools.PROP_CAT_BG_COLLABTOOLS, CollaborationTools.KEY_PORTFOLIO);
    if (mapKeyProperty != null) {
        final Long mapKey = mapKeyProperty.getLongValue();
        final String version = mapKeyProperty.getStringValue();
        if (!"2".equals(version)) {
            final PortfolioStructure map = loadPortfolioStructureByKey(mapKey);
            if (map != null) {
                deletePortfolioStructure(map);
            }
        }
        return true;
    }
    return false;
}
Also used : PortfolioStructure(org.olat.portfolio.model.structel.PortfolioStructure) NarrowedPropertyManager(org.olat.properties.NarrowedPropertyManager) 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