use of org.olat.properties.Property in project OpenOLAT by OpenOLAT.
the class ProjectGroupManagerImpl method getAccountManagerGroupFor.
@Override
public BusinessGroup getAccountManagerGroupFor(CoursePropertyManager cpm, CourseNode courseNode, ICourse course, String groupName, String groupDescription, Identity identity) {
BusinessGroup accountManagerGroup = null;
try {
Long groupKey = null;
Property accountManagerGroupProperty = cpm.findCourseNodeProperty(courseNode, null, null, ProjectBrokerCourseNode.CONF_ACCOUNTMANAGER_GROUP_KEY);
// Check if account-manager-group-key-property already exist
if (accountManagerGroupProperty != null) {
groupKey = accountManagerGroupProperty.getLongValue();
log.debug("accountManagerGroupProperty=" + accountManagerGroupProperty + " groupKey=" + groupKey);
}
log.debug("groupKey=" + groupKey);
if (groupKey != null) {
accountManagerGroup = businessGroupService.loadBusinessGroup(groupKey);
log.debug("load businessgroup=" + accountManagerGroup);
if (accountManagerGroup != null) {
return accountManagerGroup;
} else {
if (accountManagerGroupProperty != null) {
cpm.deleteProperty(accountManagerGroupProperty);
}
groupKey = null;
log.warn("ProjectBroker: Account-manager does no longer exist, create a new one", null);
}
} else {
log.debug("No group for project-broker exist => create a new one");
RepositoryEntry re = course.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
accountManagerGroup = businessGroupService.createBusinessGroup(identity, groupName, groupDescription, -1, -1, false, false, re);
int i = 2;
while (accountManagerGroup == null) {
// group with this name exist already, try another name
accountManagerGroup = businessGroupService.createBusinessGroup(identity, groupName + " _" + i, groupDescription, -1, -1, false, false, re);
i++;
}
log.debug("createAndPersistBusinessGroup businessgroup=" + accountManagerGroup);
if (accountManagerGroupProperty != null) {
accountManagerGroupProperty.setLongValue(accountManagerGroup.getKey());
cpm.updateProperty(accountManagerGroupProperty);
} else {
saveAccountManagerGroupKey(accountManagerGroup.getKey(), cpm, courseNode);
}
log.debug("created account-manager default businessgroup=" + accountManagerGroup);
}
} catch (AssertException e) {
log.error("", e);
if (tryToRepareAccountManagerProperty(cpm, courseNode)) {
accountManagerGroup = getAccountManagerGroupFor(cpm, courseNode, course, groupName, groupDescription, identity);
}
}
return accountManagerGroup;
}
use of org.olat.properties.Property in project OpenOLAT by OpenOLAT.
the class StatisticUpdateManagerImpl method getAndUpdateLastUpdated.
@Override
public long getAndUpdateLastUpdated(long lastUpdated) {
PropertyManager pm = PropertyManager.getInstance();
Property p = pm.findProperty(null, null, null, STATISTICS_PROPERTIES_CATEGORY, LAST_UPDATED_PROPERTY_NAME);
if (p == null) {
Property newp = pm.createPropertyInstance(null, null, null, STATISTICS_PROPERTIES_CATEGORY, LAST_UPDATED_PROPERTY_NAME, null, lastUpdated, null, null);
pm.saveProperty(newp);
return -1;
} else {
final long result = p.getLongValue();
p.setLongValue(lastUpdated);
pm.saveProperty(p);
return result;
}
}
use of org.olat.properties.Property in project OpenOLAT by OpenOLAT.
the class StatisticUpdateManagerImpl method getLastUpdated.
@Override
public long getLastUpdated() {
PropertyManager pm = PropertyManager.getInstance();
Property p = pm.findProperty(null, null, null, STATISTICS_PROPERTIES_CATEGORY, LAST_UPDATED_PROPERTY_NAME);
if (p == null) {
return -1;
} else {
return p.getLongValue();
}
}
use of org.olat.properties.Property in project OpenOLAT by OpenOLAT.
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);
}
use of org.olat.properties.Property in project OpenOLAT by OpenOLAT.
the class PropTableDataModel method getValueAt.
/**
* @see org.olat.core.gui.components.table.TableDataModel#getValueAt(int, int)
*/
public final Object getValueAt(int row, int col) {
Property p = getObject(row);
switch(col) {
case 0:
String cat = p.getCategory();
return (cat == null ? "n/a" : cat);
case 1:
BusinessGroup grp = p.getGrp();
return (grp == null ? "n/a" : grp.getKey().toString());
case 2:
String resType = p.getResourceTypeName();
return (resType == null ? "n/a" : resType);
case 3:
String name = p.getName();
return (name == null ? "n/a" : name);
case 4:
Float floatvalue = p.getFloatValue();
Long longvalue = p.getLongValue();
String stringvalue = p.getStringValue();
String textvalue = p.getTextValue();
String val;
if (floatvalue != null)
val = floatvalue.toString();
else if (longvalue != null)
val = longvalue.toString();
else if (stringvalue != null)
val = stringvalue;
else if (textvalue != null)
val = textvalue;
else
val = "n/a";
return val;
case 5:
Date dateCD = p.getCreationDate();
return (dateCD == null ? new Date() : dateCD);
case 6:
Date dateLM = p.getLastModified();
return (dateLM == null ? new Date() : dateLM);
default:
return "error";
}
}
Aggregations