Search in sources :

Example 11 with Collections

use of java.util.Collections in project Gargoyle by callakrsos.

the class DimList method list.

/********************************
	 * 작성일 : 2017. 4. 24. 작성자 : KYJ
	 *
	 * path에 속하는 하위 구성정보 조회
	 *
	 * @param path
	 * @param revision
	 * @param exceptionHandler
	 * @return
	 ********************************/
public <T> List<T> list(String projSpec, String path, String fileName, String revision, Function<ItemRevision, T> convert, Consumer<Exception> exceptionHandler) {
    List<T> collections = Collections.emptyList();
    DimensionsConnection conn = null;
    try {
        conn = getConnection();
        Project projObj = getProject(conn, projSpec);
        RepositoryFolder findRepositoryFolderByPath = projObj.findRepositoryFolderByPath(path);
        Filter filter = new Filter();
        if (ValueUtil.isNotEmpty(fileName))
            filter.criteria().add(new Filter.Criterion(SystemAttributes.ITEMFILE_FILENAME, fileName, Filter.Criterion.EQUALS));
        if (ValueUtil.equals("-1", revision)) {
            filter.criteria().add(new Filter.Criterion(SystemAttributes.IS_LATEST_REV, "Y", 0));
        } else {
            filter.criteria().add(new Filter.Criterion(SystemAttributes.REVISION, revision, Filter.Criterion.EQUALS));
        }
        List allChildFolders = findRepositoryFolderByPath.getAllChildFolders();
        List<DimensionsRelatedObject> childItems = findRepositoryFolderByPath.getChildItems(filter);
        //			Stream.concat(allChildFolders, childItems);
        List<ItemRevision> collect = childItems.stream().map(i -> (ItemRevision) i.getObject()).collect(Collectors.toList());
        collections = collect.stream().map(convert).collect(Collectors.toList());
    } catch (Exception e) {
        exceptionHandler.accept(e);
    } finally {
        manager.close(conn);
    }
    return collections;
}
Also used : Arrays(java.util.Arrays) Properties(java.util.Properties) Logger(org.slf4j.Logger) ScmDirHandler(com.kyj.scm.manager.core.commons.ScmDirHandler) DimensionsConnection(com.serena.dmclient.api.DimensionsConnection) LoggerFactory(org.slf4j.LoggerFactory) ValueUtil(com.kyj.fx.voeditor.visual.util.ValueUtil) Function(java.util.function.Function) Collectors(java.util.stream.Collectors) DimensionsRelatedObject(com.serena.dmclient.api.DimensionsRelatedObject) ArrayList(java.util.ArrayList) Consumer(java.util.function.Consumer) DimensionsObjectFactory(com.serena.dmclient.api.DimensionsObjectFactory) Project(com.serena.dmclient.api.Project) List(java.util.List) IListCommand(com.kyj.scm.manager.core.commons.IListCommand) RepositoryFolder(com.serena.dmclient.api.RepositoryFolder) ItemRevision(com.serena.dmclient.api.ItemRevision) Collections(java.util.Collections) SystemAttributes(com.serena.dmclient.api.SystemAttributes) Filter(com.serena.dmclient.api.Filter) DimensionsRelatedObject(com.serena.dmclient.api.DimensionsRelatedObject) DimensionsConnection(com.serena.dmclient.api.DimensionsConnection) Project(com.serena.dmclient.api.Project) RepositoryFolder(com.serena.dmclient.api.RepositoryFolder) Filter(com.serena.dmclient.api.Filter) ArrayList(java.util.ArrayList) List(java.util.List) ItemRevision(com.serena.dmclient.api.ItemRevision)

Example 12 with Collections

use of java.util.Collections in project coffeenet-starter by coffeenet.

the class CoffeeNetWebServiceImpl method get.

@Override
public CoffeeNetWeb get() {
    CoffeeNetWebUser coffeeNetWebUser = coffeeNetWebExtractor.extractUser().orElse(null);
    Map<String, List<CoffeeNetApp>> apps = coffeeNetWebExtractor.extractApps().orElseGet(Collections::emptyMap);
    String logoutPath = coffeeNetWebExtractor.extractLogoutPath();
    List<CoffeeNetApp> profileApps = apps.get("profile");
    CoffeeNetApp profileApp = null;
    if (profileApps != null && !profileApps.isEmpty()) {
        profileApp = profileApps.get(0);
    }
    List<CoffeeNetApp> coffeeNetApps = apps.get("apps");
    return new CoffeeNetWeb(coffeeNetWebUser, coffeeNetApps, profileApp, logoutPath);
}
Also used : List(java.util.List) CoffeeNetApp(coffee.synyx.autoconfigure.discovery.service.CoffeeNetApp) Collections(java.util.Collections)

Aggregations

Collections (java.util.Collections)12 List (java.util.List)9 IOException (java.io.IOException)6 ArrayList (java.util.ArrayList)6 HashSet (java.util.HashSet)5 Arrays (java.util.Arrays)4 HashMap (java.util.HashMap)4 Map (java.util.Map)4 Set (java.util.Set)4 ListMultimap (com.google.common.collect.ListMultimap)2 Lists (com.google.common.collect.Lists)2 MultimapBuilder (com.google.common.collect.MultimapBuilder)2 Collection (java.util.Collection)2 Optional (java.util.Optional)2 CancellationException (java.util.concurrent.CancellationException)2 Consumer (java.util.function.Consumer)2 Collectors (java.util.stream.Collectors)2 SuppressLint (android.annotation.SuppressLint)1 Bundle (android.os.Bundle)1 NonNull (android.support.annotation.NonNull)1