Search in sources :

Example 6 with LicenseType

use of org.eclipse.sw360.datahandler.thrift.licenses.LicenseType in project sw360portal by sw360.

the class LicenseDatabaseHandler method fillLicenseForOrganisation.

private void fillLicenseForOrganisation(String organisation, License license) {
    if (license.isSetTodoDatabaseIds()) {
        license.setTodos(getTodosByIds(license.todoDatabaseIds));
    }
    if (license.isSetTodos()) {
        for (Todo todo : license.getTodos()) {
            // remove other organisations from whitelist of todo
            todo.setWhitelist(SW360Utils.filterBUSet(organisation, todo.whitelist));
            if (todo.isSetObligationDatabaseIds()) {
                todo.setObligations(getObligationsByIds(todo.obligationDatabaseIds));
            }
        }
    }
    if (license.isSetLicenseTypeDatabaseId()) {
        final LicenseType licenseType = licenseTypeRepository.get(license.getLicenseTypeDatabaseId());
        license.setLicenseType(licenseType);
    }
    if (license.isSetRiskDatabaseIds()) {
        license.setRisks(getRisksByIds(license.riskDatabaseIds));
        license.unsetRiskDatabaseIds();
    }
    license.setShortname(license.getId());
}
Also used : CommonUtils.isTemporaryTodo(org.eclipse.sw360.datahandler.common.CommonUtils.isTemporaryTodo)

Aggregations

CSVRecord (org.apache.commons.csv.CSVRecord)2 TException (org.apache.thrift.TException)2 Ternary (org.eclipse.sw360.datahandler.thrift.Ternary)2 User (org.eclipse.sw360.datahandler.thrift.users.User)2 Function (com.google.common.base.Function)1 Strings (com.google.common.base.Strings)1 com.google.common.collect (com.google.common.collect)1 Gson (com.google.gson.Gson)1 GsonBuilder (com.google.gson.GsonBuilder)1 TypeToken (com.google.gson.reflect.TypeToken)1 java.util (java.util)1 Logger (org.apache.log4j.Logger)1 CommonUtils (org.eclipse.sw360.datahandler.common.CommonUtils)1 CommonUtils.isNullEmptyOrWhitespace (org.eclipse.sw360.datahandler.common.CommonUtils.isNullEmptyOrWhitespace)1 CommonUtils.isTemporaryTodo (org.eclipse.sw360.datahandler.common.CommonUtils.isTemporaryTodo)1 ThriftEnumUtils (org.eclipse.sw360.datahandler.common.ThriftEnumUtils)1 DatabaseConnector (org.eclipse.sw360.datahandler.couchdb.DatabaseConnector)1 SW360Exception (org.eclipse.sw360.datahandler.thrift.SW360Exception)1 org.eclipse.sw360.datahandler.thrift.licenses (org.eclipse.sw360.datahandler.thrift.licenses)1 LicenseType (org.eclipse.sw360.datahandler.thrift.licenses.LicenseType)1