use of org.olat.properties.Property in project openolat by klemens.
the class ProjectGroupManagerImpl method saveAccountManagerGroupKey.
@Override
public void saveAccountManagerGroupKey(Long accountManagerGroupKey, CoursePropertyManager cpm, CourseNode courseNode) {
Property accountManagerGroupKeyProperty = cpm.createCourseNodePropertyInstance(courseNode, null, null, ProjectBrokerCourseNode.CONF_ACCOUNTMANAGER_GROUP_KEY, null, accountManagerGroupKey, null, null);
cpm.saveProperty(accountManagerGroupKeyProperty);
log.debug("saveAccountManagerGroupKey accountManagerGroupKey=" + accountManagerGroupKey);
}
use of org.olat.properties.Property in project openolat by klemens.
the class ProjectBrokerMailerImpl method sendProjectDeletedEmailToAccountManagers.
public MailerResult sendProjectDeletedEmailToAccountManagers(Identity changer, Project project, CourseEnvironment courseEnv, CourseNode node, Translator pT) {
Long groupKey = null;
Property accountManagerGroupProperty = courseEnv.getCoursePropertyManager().findCourseNodeProperty(node, null, null, ProjectBrokerCourseNode.CONF_ACCOUNTMANAGER_GROUP_KEY);
// Check if account-manager-group-key-property already exist
if (accountManagerGroupProperty != null) {
groupKey = accountManagerGroupProperty.getLongValue();
}
if (groupKey != null) {
BusinessGroup accountManagerGroup = businessGroupService.loadBusinessGroup(groupKey);
List<Identity> participants = businessGroupService.getMembers(accountManagerGroup, GroupRoles.participant.name());
return sendEmailProjectChanged(participants, changer, project, pT.translate(KEY_PROJECT_DELETED_EMAIL_TO_PARTICIPANT_SUBJECT), pT.translate(KEY_PROJECT_DELETED_EMAIL_TO_PARTICIPANT_BODY), pT.getLocale());
}
return null;
}
use of org.olat.properties.Property in project openolat by klemens.
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 klemens.
the class ViteroManager method deleteAll.
public void deleteAll(BusinessGroup group, OLATResourceable ores, String subIdentifier) {
try {
List<Property> properties = propertyManager.listProperties(null, group, ores, VMS_CATEGORY, null);
for (Property property : properties) {
String bookingStr = property.getTextValue();
ViteroBooking booking = deserializeViteroBooking(bookingStr);
deleteBooking(booking);
}
} catch (VmsNotAvailableException e) {
log.error("", e);
markAsZombie(group, ores, subIdentifier);
}
}
use of org.olat.properties.Property in project openolat by klemens.
the class ViteroManager method getBookingById.
public ViteroBooking getBookingById(BusinessGroup group, OLATResourceable ores, String subIdentifier, int bookingId) throws VmsNotAvailableException {
ViteroBooking booking = null;
List<Property> properties = propertyManager.listProperties(null, group, ores, VMS_CATEGORY, Integer.toString(bookingId));
if (properties.size() > 0) {
Property property = properties.get(0);
String propIdentifier = property.getStringValue();
if ((propIdentifier == null || subIdentifier == null) || (subIdentifier != null && (propIdentifier == null || subIdentifier.equals(propIdentifier)))) {
String bookingStr = property.getTextValue();
booking = deserializeViteroBooking(bookingStr);
Bookingtype bookingType = getVmsBookingById(booking.getBookingId());
if (bookingType != null) {
Booking_Type vmsBooking = bookingType.getBooking();
booking.setProperty(property);
update(booking, vmsBooking);
}
}
}
return booking;
}
Aggregations