Search in sources :

Example 1 with AbstractRepositoryConfiguration

use of org.apache.archiva.configuration.model.AbstractRepositoryConfiguration in project archiva by apache.

the class ConfigurationRegistryReader method readAbstractRepositoryConfiguration.

private AbstractRepositoryConfiguration readAbstractRepositoryConfiguration(String prefix, Registry registry) {
    AbstractRepositoryConfiguration value = new AbstractRepositoryConfiguration();
    // String id = registry.getString( prefix + "id", value.getId() );
    List<String> idList = registry.getList(prefix + "id");
    String id = value.getId();
    if (idList != null && !idList.isEmpty()) {
        StringBuilder sb = new StringBuilder();
        for (int i = 0, size = idList.size(); i < size; i++) {
            sb.append(idList.get(i));
            if (i < size - 1) {
                sb.append(',');
            }
        }
        id = sb.toString();
    }
    value.setId(id);
    // String type = registry.getString( prefix + "type", value.getType() );
    List<String> typeList = registry.getList(prefix + "type");
    String type = value.getType();
    if (typeList != null && !typeList.isEmpty()) {
        StringBuilder sb = new StringBuilder();
        for (int i = 0, size = typeList.size(); i < size; i++) {
            sb.append(typeList.get(i));
            if (i < size - 1) {
                sb.append(',');
            }
        }
        type = sb.toString();
    }
    value.setType(type);
    // String name = registry.getString( prefix + "name", value.getName() );
    List<String> nameList = registry.getList(prefix + "name");
    String name = value.getName();
    if (nameList != null && !nameList.isEmpty()) {
        StringBuilder sb = new StringBuilder();
        for (int i = 0, size = nameList.size(); i < size; i++) {
            sb.append(nameList.get(i));
            if (i < size - 1) {
                sb.append(',');
            }
        }
        name = sb.toString();
    }
    value.setName(name);
    // String layout = registry.getString( prefix + "layout", value.getLayout() );
    List<String> layoutList = registry.getList(prefix + "layout");
    String layout = value.getLayout();
    if (layoutList != null && !layoutList.isEmpty()) {
        StringBuilder sb = new StringBuilder();
        for (int i = 0, size = layoutList.size(); i < size; i++) {
            sb.append(layoutList.get(i));
            if (i < size - 1) {
                sb.append(',');
            }
        }
        layout = sb.toString();
    }
    value.setLayout(layout);
    // String indexDir = registry.getString( prefix + "indexDir", value.getIndexDir() );
    List<String> indexDirList = registry.getList(prefix + "indexDir");
    String indexDir = value.getIndexDir();
    if (indexDirList != null && !indexDirList.isEmpty()) {
        StringBuilder sb = new StringBuilder();
        for (int i = 0, size = indexDirList.size(); i < size; i++) {
            sb.append(indexDirList.get(i));
            if (i < size - 1) {
                sb.append(',');
            }
        }
        indexDir = sb.toString();
    }
    value.setIndexDir(indexDir);
    // String packedIndexDir = registry.getString( prefix + "packedIndexDir", value.getPackedIndexDir() );
    List<String> packedIndexDirList = registry.getList(prefix + "packedIndexDir");
    String packedIndexDir = value.getPackedIndexDir();
    if (packedIndexDirList != null && !packedIndexDirList.isEmpty()) {
        StringBuilder sb = new StringBuilder();
        for (int i = 0, size = packedIndexDirList.size(); i < size; i++) {
            sb.append(packedIndexDirList.get(i));
            if (i < size - 1) {
                sb.append(',');
            }
        }
        packedIndexDir = sb.toString();
    }
    value.setPackedIndexDir(packedIndexDir);
    // String description = registry.getString( prefix + "description", value.getDescription() );
    List<String> descriptionList = registry.getList(prefix + "description");
    String description = value.getDescription();
    if (descriptionList != null && !descriptionList.isEmpty()) {
        StringBuilder sb = new StringBuilder();
        for (int i = 0, size = descriptionList.size(); i < size; i++) {
            sb.append(descriptionList.get(i));
            if (i < size - 1) {
                sb.append(',');
            }
        }
        description = sb.toString();
    }
    value.setDescription(description);
    return value;
}
Also used : AbstractRepositoryConfiguration(org.apache.archiva.configuration.model.AbstractRepositoryConfiguration)

Aggregations

AbstractRepositoryConfiguration (org.apache.archiva.configuration.model.AbstractRepositoryConfiguration)1