Beispiel #1
0
def search_layer():
	user_name = request.GET.get('userName')
	start = int(request.GET.get('start'))
	limit = int(request.GET.get('limit'))
	pattern = request.GET.get('pattern')
	position = request.GET.get('position')
	type = request.GET.get('type')

	nodes = repo.User(db_session).read(user_name).nodes
	layers = map(lambda n: n.layer,filter(lambda n: n.leaf, nodes))

	#filter type
	if(type != '%'):
		layers = filter(lambda l: l.type == type, layers)
	
	#filter title
	layers = util.collection_filter(position, pattern, 'title', layers)

	#sort
	layers = sorted(layers, key=lambda l: l.title)
	
	total = len(layers)
	limit = start + limit

	o = map(lambda l: vo.layer(l), layers[start:limit])
	return vo.collection(o, total)
Beispiel #2
0
def search_workspace():
	user_name = request.GET.get('userName')
	start = int(request.GET.get('start'))
	limit = int(request.GET.get('limit'))
	name_pattern = request.GET.get('namePattern')
	name_position = request.GET.get('namePosition')
	user_pattern = request.GET.get('userPattern')
	user_position = request.GET.get('userPosition')
	
	workspaces = repo.User(db_session).read(user_name).workspaces
	
	#filter owner
	workspaces = util.collection_filter(user_position, user_pattern, 'user_name', workspaces)
	
	#filter name
	workspaces = util.collection_filter(name_position, name_pattern, 'name', workspaces)

	#sort
	workspaces = sorted(workspaces, key=lambda l: l.name)
	
	total = len(workspaces)
	limit = start + limit
	
	o = map(lambda ws: vo.workspace(ws), workspaces[start:limit])
	return vo.collection(o, total)
Beispiel #3
0
def search():
	
	user_name_pattern = request.GET.get('userNamePattern')
	user_name_position = request.GET.get('userNamePosition')
	name_pattern = request.GET.get('namePattern')
	name_position = request.GET.get('namePosition')
	last_name_pattern = request.GET.get('lastNamePattern')
	last_name_position = request.GET.get('lastNamePosition')
	group_id = int(request.GET.get('groupId'))
	role_id = int(request.GET.get('roleId'))
	
	start = int(request.GET.get('start'))
	limit = int(request.GET.get('limit'))
	
	repo_user = repo.User(db_session)
	
	user_name = util.like_filter(user_name_position, user_name_pattern)
	name  = util.like_filter(name_position, name_pattern)
	last_name  = util.like_filter(last_name_position, last_name_pattern)
	
	total = int(repo_user.search_count(user_name, name, last_name, group_id, role_id))
	users = repo_user.search(user_name, name, last_name, group_id, role_id, start, limit)

	o = map(lambda u: vo.user_base(u), users)
	return vo.collection(o, total)
Beispiel #4
0
def get_layer():
	user_name = request.GET.get('userName')
	nodes = repo.User(db_session).read(user_name).nodes
	layers = map(lambda n: n.layer,filter(lambda n: n.leaf, nodes))
	
	#sort
	layers = sorted(layers, key=lambda l: l.title)
	o = map(lambda l: vo.layer(l), layers)
	return vo.collection(o, len(o))
Beispiel #5
0
def get_locations():
	layer_name = request.GET.get('layerName')
	start = int(request.GET.get('start'))
	limit = int(request.GET.get('limit'))

	files = repo.Layer(db_session).read(layer_name).files

	#paging by code (discrete values)
	total = len(files)
	limit = start + limit

	o = map(lambda f: vo.file(f), files[start:limit])
	return vo.collection(o, total)
Beispiel #6
0
def get_users():
	id = int(request.GET.get('id'))
	start = int(request.GET.get('start'))
	limit = int(request.GET.get('limit'))

	workspace = repo.Workspace(db_session).read(id)
	users = workspace.users
	
	#paging by code (discrete values)
	total = len(users)
	limit = start + limit

	o = map(lambda u: vo.user(u), users[start:limit])
	return vo.collection(o, total)
Beispiel #7
0
def get_by_owner():
	user_name = request.GET.get('userName')
	start = int(request.GET.get('start'))
	limit = int(request.GET.get('limit'))
	
	workspaces = repo.Workspace(db_session).get_by_owner(user_name)
	#paging by code (discrete values)
	total = len(workspaces)
	limit = start + limit
	
	#order by date
	sort_ws = sorted(workspaces, key=lambda n: n.date, reverse=True)
	
	o = map(lambda ws: vo.workspace(ws), sort_ws[start:limit])
	return vo.collection(o, total)
Beispiel #8
0
def get_locations():
	user_name = request.GET.get('userName')
	start = int(request.GET.get('start'))
	limit = int(request.GET.get('limit'))

	locations = repo.User(db_session).read(user_name).locations

	#paging by code (discrete values)
	total = len(locations)
	limit = start + limit

	#order by date
	sort_l = sorted(locations, key=lambda n: n.date, reverse=True)

	o = map(lambda l: vo.location(l), sort_l[start:limit])
	return vo.collection(o, total)
Beispiel #9
0
def all():
    locations = repo.Location(db_session).all()
    o = map(lambda l: vo.location(l), locations)
    return vo.collection(o, len(o))
Beispiel #10
0
def all():
	users = repo.User(db_session).all()
	o = map(lambda u: vo.user_base(u), users)
	return vo.collection(o, len(o))
Beispiel #11
0
def get_rasters():
	user_name = request.GET.get('userName')
	rasters = repo.User(db_session).read(user_name).rasters
	rasters = sorted(rasters, key=lambda r:r.order)
	o = map(lambda r: vo.raster(r), rasters)
	return vo.collection(o, len(o))
Beispiel #12
0
def get_favlocations():
	user_name = request.GET.get('userName')
	locations = repo.User(db_session).read(user_name).locations
	locations = filter(lambda l: l.favorite, locations)
	o = map(lambda l: vo.location(l), locations)
	return vo.collection(o, len(o))
Beispiel #13
0
def all():
	layers = repo.Layer(db_session).all()
	o = map(lambda l: vo.layer(l), layers)
	return vo.collection(o, len(o))
Beispiel #14
0
def all():
	roles = repo.Role(db_session).all()
	o = map(lambda r: vo.role(r), roles)
	return vo.collection(o, len(o))
Beispiel #15
0
def all():
    groups = repo.Group(db_session).all()
    o = map(lambda r: vo.group(r), groups)
    return vo.collection(o, len(o))