Search in sources :

Example 1 with TaxonomyLevelTypeRef

use of org.olat.modules.taxonomy.TaxonomyLevelTypeRef in project OpenOLAT by OpenOLAT.

the class EditTaxonomyLevelController method formOK.

@Override
protected void formOK(UserRequest ureq) {
    if (level == null) {
        TaxonomyLevel selectedParentLevel = null;
        if (parentLevel == null) {
            if (pathEl != null && pathEl.isEnabled() && pathEl.isOneSelected() && !"-".equals(pathEl.getSelectedKey())) {
                TaxonomyLevelRef ref = new TaxonomyLevelRefImpl(new Long(pathEl.getSelectedKey()));
                selectedParentLevel = taxonomyService.getTaxonomyLevel(ref);
            }
        } else {
            selectedParentLevel = parentLevel;
        }
        level = taxonomyService.createTaxonomyLevel(identifierEl.getValue(), displayNameEl.getValue(), descriptionEl.getValue(), null, null, selectedParentLevel, taxonomy);
    } else {
        level = taxonomyService.getTaxonomyLevel(level);
        level.setIdentifier(identifierEl.getValue());
        level.setDisplayName(displayNameEl.getValue());
        level.setDescription(descriptionEl.getValue());
    }
    String selectedTypeKey = taxonomyLevelTypeEl.getSelectedKey();
    if (StringHelper.containsNonWhitespace(selectedTypeKey)) {
        TaxonomyLevelTypeRef typeRef = new TaxonomyLevelTypeRefImpl(new Long(selectedTypeKey));
        TaxonomyLevelType type = taxonomyService.getTaxonomyLevelType(typeRef);
        level.setType(type);
    } else {
        level.setType(null);
    }
    if (StringHelper.isLong(sortOrderEl.getValue())) {
        level.setSortOrder(new Integer(sortOrderEl.getValue()));
    } else {
        level.setSortOrder(null);
    }
    level = taxonomyService.updateTaxonomyLevel(level);
    fireEvent(ureq, Event.DONE_EVENT);
}
Also used : TaxonomyLevel(org.olat.modules.taxonomy.TaxonomyLevel) TaxonomyLevelType(org.olat.modules.taxonomy.TaxonomyLevelType) TaxonomyLevelRefImpl(org.olat.modules.taxonomy.model.TaxonomyLevelRefImpl) TaxonomyLevelTypeRef(org.olat.modules.taxonomy.TaxonomyLevelTypeRef) TaxonomyLevelTypeRefImpl(org.olat.modules.taxonomy.model.TaxonomyLevelTypeRefImpl) TaxonomyLevelRef(org.olat.modules.taxonomy.TaxonomyLevelRef)

Example 2 with TaxonomyLevelTypeRef

use of org.olat.modules.taxonomy.TaxonomyLevelTypeRef in project openolat by klemens.

the class EditTaxonomyLevelController method formOK.

@Override
protected void formOK(UserRequest ureq) {
    if (level == null) {
        TaxonomyLevel selectedParentLevel = null;
        if (parentLevel == null) {
            if (pathEl != null && pathEl.isEnabled() && pathEl.isOneSelected() && !"-".equals(pathEl.getSelectedKey())) {
                TaxonomyLevelRef ref = new TaxonomyLevelRefImpl(new Long(pathEl.getSelectedKey()));
                selectedParentLevel = taxonomyService.getTaxonomyLevel(ref);
            }
        } else {
            selectedParentLevel = parentLevel;
        }
        level = taxonomyService.createTaxonomyLevel(identifierEl.getValue(), displayNameEl.getValue(), descriptionEl.getValue(), null, null, selectedParentLevel, taxonomy);
    } else {
        level = taxonomyService.getTaxonomyLevel(level);
        level.setIdentifier(identifierEl.getValue());
        level.setDisplayName(displayNameEl.getValue());
        level.setDescription(descriptionEl.getValue());
    }
    String selectedTypeKey = taxonomyLevelTypeEl.getSelectedKey();
    if (StringHelper.containsNonWhitespace(selectedTypeKey)) {
        TaxonomyLevelTypeRef typeRef = new TaxonomyLevelTypeRefImpl(new Long(selectedTypeKey));
        TaxonomyLevelType type = taxonomyService.getTaxonomyLevelType(typeRef);
        level.setType(type);
    } else {
        level.setType(null);
    }
    if (StringHelper.isLong(sortOrderEl.getValue())) {
        level.setSortOrder(new Integer(sortOrderEl.getValue()));
    } else {
        level.setSortOrder(null);
    }
    level = taxonomyService.updateTaxonomyLevel(level);
    fireEvent(ureq, Event.DONE_EVENT);
}
Also used : TaxonomyLevel(org.olat.modules.taxonomy.TaxonomyLevel) TaxonomyLevelType(org.olat.modules.taxonomy.TaxonomyLevelType) TaxonomyLevelRefImpl(org.olat.modules.taxonomy.model.TaxonomyLevelRefImpl) TaxonomyLevelTypeRef(org.olat.modules.taxonomy.TaxonomyLevelTypeRef) TaxonomyLevelTypeRefImpl(org.olat.modules.taxonomy.model.TaxonomyLevelTypeRefImpl) TaxonomyLevelRef(org.olat.modules.taxonomy.TaxonomyLevelRef)

Aggregations

TaxonomyLevel (org.olat.modules.taxonomy.TaxonomyLevel)2 TaxonomyLevelRef (org.olat.modules.taxonomy.TaxonomyLevelRef)2 TaxonomyLevelType (org.olat.modules.taxonomy.TaxonomyLevelType)2 TaxonomyLevelTypeRef (org.olat.modules.taxonomy.TaxonomyLevelTypeRef)2 TaxonomyLevelRefImpl (org.olat.modules.taxonomy.model.TaxonomyLevelRefImpl)2 TaxonomyLevelTypeRefImpl (org.olat.modules.taxonomy.model.TaxonomyLevelTypeRefImpl)2