/* license-start
*
* Copyright (C) 2008 - 2013 Crispico, <http://www.crispico.com/>.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details, at <http://www.gnu.org/licenses/>.
*
* Contributors:
* Crispico - Initial API and implementation
*
* license-end
*/
package org.flowerplatform.web.explorer;
import java.io.File;
import java.util.List;
import org.flowerplatform.common.CommonPlugin;
import org.flowerplatform.common.util.Pair;
import org.flowerplatform.communication.tree.GenericTreeContext;
import org.flowerplatform.communication.tree.INodeByPathRetriever;
import org.flowerplatform.communication.tree.remote.PathFragment;
/**
* @author Cristian Spiescu
*/
public abstract class AbstractVirtualItemInOrganizationNodeDataProvider extends AbstractVirtualItemNodeDataProvider implements INodeByPathRetriever {
@Override
public Object getNodeByPath(List<PathFragment> fullPath, GenericTreeContext context) {
if (fullPath == null || fullPath.size() != 2 || !Organization_RootChildrenProvider.NODE_TYPE_ORGANIZATION.equals(fullPath.get(0).getType())) {
throw new IllegalArgumentException("We were expecting a path with 2 items (no 0 being an org), but we got: " + fullPath);
}
return new Pair<File, String>(new File(CommonPlugin.getInstance().getWorkspaceRoot(), fullPath.get(0).getName()), fullPath.get(1).getType());
}
}