use of com.serena.dmclient.api.Filter in project Gargoyle by callakrsos.
the class DimDirHandler method accept.
/**
* parent폴더 기준,
* filter처리된 아이템 대상으로 하위 아이템들을 순회하는 코드
*/
@Override
public void accept(RepositoryFolder parent) {
Filter itemFilter = itemFilter();
List<DimensionsRelatedObject> childItems = parent.getChildItems(/*필터 적용*/
itemFilter);
childItems.stream().map(f -> (ItemRevision) f.getObject()).forEach(r -> handle(r));
}
use of com.serena.dmclient.api.Filter in project Gargoyle by callakrsos.
the class DimmensionManager method getRevision.
/**
* 날짜에 매치되는 리비젼 번호를 구함.
*
* 값이 없거나 유효하지않는경우 -1
* @작성자 : KYJ
* @작성일 : 2016. 7. 14.
* @param date
* @return
* @throws Exception
*/
public float getRevision(String projSpec, String path, String fileName) throws Exception {
DimDirHandler handler = new DimDirHandler() {
Object findOne;
@Override
public boolean test(RepositoryFolder entry) {
return entry.getName().equals(path);
}
@Override
public Filter itemFilter() {
Filter filter = new Filter();
filter.criteria().add(new Filter.Criterion(SystemAttributes.IS_LATEST_REV, "Y", 0));
filter.criteria().add(new Filter.Criterion(SystemAttributes.ITEMFILE_FILENAME, fileName, Filter.Criterion.EQUALS));
return filter;
}
@Override
public void handle(ItemRevision r) {
r.queryAttribute(SystemAttributes.REVISION);
findOne = r.getAttribute(SystemAttributes.REVISION);
}
@Override
public Object get() {
return findOne;
}
};
this.listEntry(projSpec, path, handler);
Object object = handler.get();
if (object != null)
return Float.parseFloat(object.toString());
return -1;
}
use of com.serena.dmclient.api.Filter 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;
}
use of com.serena.dmclient.api.Filter in project Gargoyle by callakrsos.
the class DimResource method search.
public <K> K search(RepositoryFolder folder, List<String> linkedList, String revision, Function<List<DimensionsRelatedObject>, K> convert) {
K items = null;
if (linkedList.size() == 0) {
return items;
}
String subPathName = linkedList.get(0);
if (linkedList.size() > 1) {
RepositoryFolder childFolder = folder.getChildFolder(subPathName);
linkedList.remove(0);
return search(childFolder, linkedList, revision, convert);
} else {
Filter filter = new Filter();
/* 파일명과 동일한것만 가져옴 */
filter.criteria().add(new Filter.Criterion(SystemAttributes.ITEMFILE_FILENAME, subPathName, Filter.Criterion.EQUALS));
if ("-1".equals(revision))
//$NON-NLS-1$
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<DimensionsRelatedObject> childItems = folder.getChildItems(filter);
return convert.apply(childItems);
}
}
Aggregations