Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /*
  *  Copyright (c) 2011 Leibniz Institute of Plant Genetics and Crop Plant Research (IPK), Gatersleben, Germany.
  *  All rights reserved. This program and the accompanying materials
  *  are made available under the terms of the GNU Lesser Public License v2.1
  *  which accompanies this distribution, and is available at
  *  http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  *
  *  Contributors:
  *      Leibniz Institute of Plant Genetics and Crop Plant Research (IPK), Gatersleben, Germany - RMI Client, FileChooser and WebDAV
 */
package de.ipk_gatersleben.bit.bi.edal.rmi.client.util;
A class used to get ClientPrimaryDataEntity object with path and rootDirectory.

Author(s):
Jinbo Chen
Version:
1.0
public class EdalFileHelper {
	public static ClientPrimaryDataEntity getEntity(final String path,final ClientPrimaryDataDirectory rootDirectory)
		final String[] dirs = path.split("\\/");
		ClientPrimaryDataDirectory dir = rootDirectory;
		ClientPrimaryDataEntity entity = dir;
		if (dirs.length > 1) {
			for (int i = 1; i < dirs.lengthi++) {
				if (!dirs[i].isEmpty()) {
					if (dir.exist(dirs[i])) {
						entity = dir.getPrimaryDataEntity(dirs[i]);
						if (entity.isDirectory()) {
							dir = (ClientPrimaryDataDirectoryentity;
else {
							return entity;
						}
					}
				}
			}
			return entity;
else {
			return dir;
		}
	}
New to GrepCode? Check out our FAQ X