use of org.talend.core.model.properties.FolderType in project tmdm-studio-se by Talend.
the class RepositoryResourceUtilTest method testIsSystemFolder.
@Test
public void testIsSystemFolder() throws Exception {
String folderName = "system";
FolderType[] folderTypes = { FolderType.FOLDER_LITERAL, FolderType.STABLE_SYSTEM_FOLDER_LITERAL };
ContainerItem mockContainerItem = mock(ContainerItem.class);
when(mockContainerItem.getType()).thenReturn(FolderType.SYSTEM_FOLDER_LITERAL);
boolean result = Whitebox.invokeMethod(RepositoryResourceUtil.class, "isSystemFolder", mockContainerItem, folderName);
assertTrue(result);
for (FolderType folderType : folderTypes) {
when(mockContainerItem.getType()).thenReturn(folderType);
result = Whitebox.invokeMethod(RepositoryResourceUtil.class, "isSystemFolder", mockContainerItem, folderName);
assertFalse(result);
}
Item mockItem = mock(Item.class);
result = Whitebox.invokeMethod(RepositoryResourceUtil.class, "isSystemFolder", mockItem, folderName);
assertFalse(result);
}
use of org.talend.core.model.properties.FolderType in project tmdm-studio-se by Talend.
the class WorkspaceRootItemImpl method setType.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setType(FolderType newType) {
FolderType oldType = type;
type = newType == null ? TYPE_EDEFAULT : newType;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, MdmpropertiesPackage.WORKSPACE_ROOT_ITEM__TYPE, oldType, type));
}
use of org.talend.core.model.properties.FolderType in project tmdm-studio-se by Talend.
the class AbstractContentProvider method getChildren.
public Object[] getChildren(Object element) {
Item item = RepositoryResourceUtil.getItemFromRepViewObj(element);
if (item != null && item instanceof ContainerItem) {
ContainerItem containerItem = (ContainerItem) item;
// recycle
if (RepositoryResourceUtil.isDeletedFolder(item, ((IRepositoryViewObject) element).getRepositoryObjectType())) {
AbstractContentProvider recycleContentProvider = (AbstractContentProvider) RepositoryNodeConfigurationManager.getRecycleBinNodeConfiguration().getContentProvider();
return recycleContentProvider.getChildren(element);
}
//
FolderType containerType = containerItem.getType();
List<IRepositoryViewObject> children = ((FolderRepositoryObject) element).getChildren();
if (containerType == FolderType.SYSTEM_FOLDER_LITERAL) {
List<IRepositoryViewObject> viewObjects = getViewObjFromSystemFolder(containerItem);
if (viewObjects != null) {
children.clear();
children.addAll(viewObjects);
return viewObjects.toArray();
}
}
if (containerType == FolderType.FOLDER_LITERAL || containerType == FolderType.STABLE_SYSTEM_FOLDER_LITERAL) {
List<IRepositoryViewObject> viewObjects = getViewObjFromFolder(containerItem);
if (viewObjects != null) {
children.clear();
children.addAll(viewObjects);
return viewObjects.toArray();
}
}
// if (containerType == FolderType.STABLE_SYSTEM_FOLDER_LITERAL) {
// List<IRepositoryViewObject> children = ((ContainerRepositoryObject) element).getChildren();
// if (children != null) {
// return children.toArray();
// }
// }
}
return new Object[0];
}
Aggregations