Search in sources :

Example 81 with Property

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

Example 82 with Property

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;
}
Also used : BusinessGroup(org.olat.group.BusinessGroup) Identity(org.olat.core.id.Identity) Property(org.olat.properties.Property)

Example 83 with Property

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;
}
Also used : AssertException(org.olat.core.logging.AssertException) BusinessGroup(org.olat.group.BusinessGroup) RepositoryEntry(org.olat.repository.RepositoryEntry) Property(org.olat.properties.Property)

Example 84 with Property

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

Example 85 with Property

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;
}
Also used : ViteroBooking(org.olat.modules.vitero.model.ViteroBooking) Booking_Type(de.vitero.schema.booking.Booking_Type) Property(org.olat.properties.Property) Bookingtype(de.vitero.schema.booking.Bookingtype)

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