当前位置: 首页>>代码示例>>Java>>正文


Java User类代码示例

本文整理汇总了Java中org.ndexbio.model.object.User的典型用法代码示例。如果您正苦于以下问题:Java User类的具体用法?Java User怎么用?Java User使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


User类属于org.ndexbio.model.object包,在下文中一共展示了User类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getNewUser

import org.ndexbio.model.object.User; //导入依赖的package包/类
public static User getNewUser(String accountName,
		                         String accountPassword, String description, String email,
		                         String firstName, String lastName, String image, String webSite) {
        
       User user = new User();

       user.setUserName(accountName);
       user.setPassword(accountPassword);
       user.setDescription(description);
       user.setEmailAddress(email);
       user.setFirstName(firstName);
       user.setLastName(lastName);
       user.setImage(image);
       user.setWebsite(webSite);
       
	return user;
}
 
开发者ID:ndexbio,项目名称:ndex-java-client,代码行数:18,代码来源:UserUtils.java

示例2: compareObjectsContents

import org.ndexbio.model.object.User; //导入依赖的package包/类
public static void compareObjectsContents(User user1, User user2) {
	
       assertEquals("account names do not match: ",   user1.getUserName(),  user2.getUserName());
       assertEquals("descriptions do not match: ",    user1.getDescription(),  user2.getDescription());
       assertEquals("disk quotas do not match: ",     user1.getDiskQuota(),    user2.getDiskQuota());
       assertEquals("disk used do not match: ",       user1.getDiskUsed(),     user2.getDiskUsed());
       assertEquals("email addresses do not match: ", user1.getEmailAddress(), user2.getEmailAddress());
       assertEquals("external IDs do not match: ",    user1.getExternalId(),   user2.getExternalId());        
       assertEquals("first names do not match: ",     user1.getFirstName(),    user2.getFirstName());
       assertEquals("last names do not match: ",      user1.getLastName(),     user2.getLastName());
 //      assertEquals("types do not match: ",           user1.getType(),         user2.getType());
       assertEquals("image URLs do not match: ",      user1.getImage(),        user2.getImage());
       assertEquals("web sites do not match: ",       user1.getWebsite(),      user2.getWebsite());
       
       return;
}
 
开发者ID:ndexbio,项目名称:ndex-java-client,代码行数:17,代码来源:UserUtils.java

示例3: getUsersByUUIDs

import org.ndexbio.model.object.User; //导入依赖的package包/类
@SuppressWarnings("static-method")
@POST
@PermitAll
@AuthenticationNotRequired
@Path("/user")
@Produces("application/json")
@ApiDoc("Return the user corresponding to user's UUID. Error if no such user is found.")
public List<User> getUsersByUUIDs(
		List<String> userIdStrs)
		throws IllegalArgumentException, NdexException, JsonParseException, JsonMappingException, SQLException, IOException {

	if ( userIdStrs == null )
		throw new ForbiddenOperationException("A user id list is required.");
	
	accLogger.info("[data]\t[uuidcounts:" +userIdStrs.size() + "]" );

	try (UserDAO dao = new UserDAO() ){
		List<User> users = new LinkedList<>();
		for ( String uuidStr : userIdStrs) {
			User user = dao.getUserById(UUID.fromString(uuidStr),true, false);
			users.add(user);
		}
		return users;	
	} 
	
}
 
开发者ID:ndexbio,项目名称:ndex-rest,代码行数:27,代码来源:BatchServiceV2.java

示例4: getUserByUUID

import org.ndexbio.model.object.User; //导入依赖的package包/类
/**************************************************************************
	 * Gets a user by UUID  
	 * 
	 * @param userId
	 *            The UUID of the user.

	 **************************************************************************/
	@GET
	@PermitAll
	@Path("/{userid}")
	@Produces("application/json")
	@ApiDoc("Return the user corresponding to user's UUID. Error if no such user is found.")
	public User getUserByUUID(@PathParam("userid") final String userIdStr)
			throws IllegalArgumentException, NdexException, JsonParseException, JsonMappingException, SQLException, IOException {

//		logger.info("[start: Getting user from UUID {}]", userId);
		
		UUID userUUID = UUID.fromString(userIdStr);
		if ( getLoggedInUserId() != null && getLoggedInUserId().equals(userUUID))
			return getLoggedInUser();
		
		try (UserDAO dao = new UserDAO() ){
			final User user = dao.getUserById(userUUID,true,false);
//			logger.info("[end: User object returned for user uuid {}]", userId);
			return user;	
		} 
		
	}
 
开发者ID:ndexbio,项目名称:ndex-rest,代码行数:29,代码来源:UserServiceV2.java

示例5: setProvenance

import org.ndexbio.model.object.User; //导入依赖的package包/类
/**************************************************************************
   * Updates network provenance.
    * @throws Exception
   *
   **************************************************************************/
   @PUT
@Path("/{networkid}/provenance")
@Produces("application/json")
   @ApiDoc("Updates the 'provenance' field of the network specified by 'networkId' to be the " +
           "ProvenanceEntity object in the PUT data. The ProvenanceEntity object is expected to represent " +
           "the current state of the network and to contain a tree-structure of ProvenanceEvent and " +
           "ProvenanceEntity objects that describe the networks provenance history.")
   public void setProvenance(@PathParam("networkid")final String networkIdStr, final ProvenanceEntity provenance)
   		throws Exception {

   	logger.info("[start: Updating provenance of network {}]", networkIdStr);
   
	User user = getLoggedInUser();

	setProvenance_aux(networkIdStr, provenance, user);
   }
 
开发者ID:ndexbio,项目名称:ndex-rest,代码行数:22,代码来源:NetworkServiceV2.java

示例6: getUserByAccountName

import org.ndexbio.model.object.User; //导入依赖的package包/类
/**************************************************************************
 * Gets a user by accountName. 
 * 
 * @param accountName
 *            The accountName of the user.
 * @throws IllegalArgumentException
 *             Bad input.
 * @throws NdexException
 *             Failed to change the password in the database.
 * @throws SQLException 
 * @throws IOException 
 * @throws JsonMappingException 
 * @throws JsonParseException 
 **************************************************************************/
@GET
@PermitAll
@Path("/account/{username}")
@Produces("application/json")
@ApiDoc("Return the user corresponding to the given user account name. Error if this account is not found.")
public User getUserByAccountName(@PathParam("username") @Encoded final String accountName)
		throws IllegalArgumentException, NdexException, SQLException, JsonParseException, JsonMappingException, IOException {

	logger.info("[start: Getting user by account name {}]", accountName);
	try (UserDAO dao = new UserDAO()){
		
		final User user = dao.getUserByAccountName(accountName.toLowerCase(),true,false);
		logger.info("[end: User object returned for user account {}]", accountName);
		return user;
	} 
	
}
 
开发者ID:ndexbio,项目名称:ndex-rest,代码行数:32,代码来源:UserService.java

示例7: getUserByUUID

import org.ndexbio.model.object.User; //导入依赖的package包/类
/**************************************************************************
 * Gets a user by UUID  
 * 
 * @param userId
 *            The UUID of the user.
 * @throws IllegalArgumentException
 *             Bad input.
 * @throws NdexException
 *             Failed to change the password in the database.
 * @throws IOException 
 * @throws SQLException 
 * @throws JsonMappingException 
 * @throws JsonParseException 
 **************************************************************************/
@SuppressWarnings("static-method")
@GET
@PermitAll
@Path("/uuid/{userid}")
@Produces("application/json")
@ApiDoc("Return the user corresponding to user's UUID. Error if no such user is found.")
public User getUserByUUID(@PathParam("userid") @Encoded final String userId)
		throws IllegalArgumentException, NdexException, JsonParseException, JsonMappingException, SQLException, IOException {

	logger.info("[start: Getting user from UUID {}]", userId);
	
	try (UserDAO dao = new UserDAO() ){
		final User user = dao.getUserById(UUID.fromString(userId),true,false);
		logger.info("[end: User object returned for user uuid {}]", userId);
		return user;	
	} 
	
}
 
开发者ID:ndexbio,项目名称:ndex-rest,代码行数:33,代码来源:UserService.java

示例8: authenticateUser

import org.ndexbio.model.object.User; //导入依赖的package包/类
/**************************************************************************
 * Authenticates a user trying to login.
 * 
 * @param username
 *            The AccountName.
 * @param password
 *            The password.
 * @throws SecurityException
 *             Invalid accountName or password.
 * @throws NdexException
 *             Can't authenticate users against the database.
 * @return The authenticated user's information.
 **************************************************************************/
@GET
@PermitAll
@NdexOpenFunction
@Path("/authenticate")
@Produces("application/json")
@ApiDoc("Authenticates the combination of accountName and password supplied in the Auth header, returns the authenticated user if successful.")
public UserV1 authenticateUser()
		throws UnauthorizedOperationException {
	
	logger.info("[start: Authenticate user from Auth header]");
      
	User u = this.getLoggedInUser(); 
	if ( u == null ) {
		logger.error("[end: Unauthorized user. Throwing UnauthorizedOperationException...]");
		throw new UnauthorizedOperationException("Unauthorized user.");
	}	
	
	logger.info("[end: user {} autenticated from Auth header]",  u.getUserName());
	return new UserV1(this.getLoggedInUser());
}
 
开发者ID:ndexbio,项目名称:ndex-rest,代码行数:34,代码来源:UserService.java

示例9: findUsers

import org.ndexbio.model.object.User; //导入依赖的package包/类
/**************************************************************************
 * Finds users based on the search parameters.
 * 
 * @param searchParameters
 *            The search parameters.
 * @throws Exception 
 **************************************************************************/
@POST
@PermitAll
@Path("/search/{start}/{size}")
@Produces("application/json")
@ApiDoc("Returns a list of users based on the range [skipBlocks, blockSize] and the POST data searchParameters. "
		+ "The searchParameters must contain a 'searchString' parameter. ")
public SolrSearchResult<User> findUsers(SimpleQuery simpleUserQuery, 
		@PathParam("start") final int skipBlocks, 
		@PathParam("size") final int blockSize)
		throws Exception {

	logger.info("[start: Searching user \"{}\"]", simpleUserQuery.getSearchString());
	
	try (UserDAO dao = new UserDAO ()){

		final SolrSearchResult<User> users = dao.findUsers(simpleUserQuery, skipBlocks, blockSize);
		
		logger.info("[end: Returning {} users from search]", users.getNumFound());			
		return users;
	} 
	
}
 
开发者ID:ndexbio,项目名称:ndex-rest,代码行数:30,代码来源:UserService.java

示例10: setProvenance

import org.ndexbio.model.object.User; //导入依赖的package包/类
/**************************************************************************
   * Updates network provenance.
    * @throws Exception
   *
   **************************************************************************/
   @PUT
@Path("/{networkid}/provenance")
@Produces("application/json")
   @ApiDoc("Updates the 'provenance' field of the network specified by 'networkId' to be the " +
           "ProvenanceEntity object in the PUT data. The ProvenanceEntity object is expected to represent " +
           "the current state of the network and to contain a tree-structure of ProvenanceEvent and " +
           "ProvenanceEntity objects that describe the networks provenance history.")
   public ProvenanceEntity setProvenance(@PathParam("networkid")final String networkIdStr, final ProvenanceEntity provenance)
   		throws Exception {

   	logger.info("[start: Updating provenance of network {}]", networkIdStr);
   
	User user = getLoggedInUser();
   	NetworkServiceV2.setProvenance_aux(networkIdStr, provenance, user);
   	return provenance;
	
   }
 
开发者ID:ndexbio,项目名称:ndex-rest,代码行数:23,代码来源:NetworkService.java

示例11: authenticateUser

import org.ndexbio.model.object.User; //导入依赖的package包/类
/**************************************************************************
	 * Authenticates a user trying to login.
	 * 
	 * @param accountName
	 *            The accountName.
	 * @param password
	 *            The password.
	 * @throws SecurityException
	 *             Invalid accountName or password.
	 * @return The user, from NDEx Object Model.
	 * @throws Exception 
	 **************************************************************************/
	public User authenticateUser(String accountName, String password)
			throws Exception {

		if (Strings.isNullOrEmpty(accountName)
				|| Strings.isNullOrEmpty(password))
			throw new UnauthorizedOperationException("No accountName or password entered.");

		if (!Security.authenticateUser(password, getUserPasswordByAccountName(accountName))) {
				throw new UnauthorizedOperationException("Invalid accountName or password.");
		}
	
		User user = getUserByAccountName(accountName, true, true);
//		user.setPassword("");
		return user;
		
	}
 
开发者ID:ndexbio,项目名称:ndex-rest,代码行数:29,代码来源:UserDAO.java

示例12: getUserByEmail

import org.ndexbio.model.object.User; //导入依赖的package包/类
public User getUserByEmail(String email, boolean fullRecord) throws NdexException,
IllegalArgumentException, ObjectNotFoundException, SQLException, JsonParseException, JsonMappingException, IOException {

		String sqlStr = "SELECT * FROM " + NdexClasses.User + " where email_addr = ? and is_deleted = false";

		try (PreparedStatement st = db.prepareStatement(sqlStr)) {
			st.setString(1, email);
			try (ResultSet rs = st.executeQuery() ) {
				if (rs.next()) {
					// populate the user object;
					User result = new User();

					populateUserFromResultSet(result, rs, fullRecord);

					return result;
				} 
				throw new ObjectNotFoundException("User with email " + email + " doesn't exist.");

			}
		}

}
 
开发者ID:ndexbio,项目名称:ndex-rest,代码行数:23,代码来源:UserDAO.java

示例13: getUUIDByEmail

import org.ndexbio.model.object.User; //导入依赖的package包/类
public UUID getUUIDByEmail(String email) throws NdexException,
	IllegalArgumentException, ObjectNotFoundException, SQLException {


	String sqlStr = "SELECT \"UUID\" FROM " + NdexClasses.User + " where  email_addr = ? and is_deleted=false";

	try (PreparedStatement st = db.prepareStatement(sqlStr)) {
		st.setString(1, email);
		try (ResultSet rs = st.executeQuery() ) {
			if (rs.next()) 
				return (UUID)rs.getObject(1);
		}
	} 
	throw new ObjectNotFoundException("User with email " + email.toString() + " doesn't exist.");

}
 
开发者ID:ndexbio,项目名称:ndex-rest,代码行数:17,代码来源:UserDAO.java

示例14: populateUserFromResultSet

import org.ndexbio.model.object.User; //导入依赖的package包/类
private static void populateUserFromResultSet(User user, ResultSet rs, boolean fullRecord) throws JsonParseException, JsonMappingException, SQLException, IOException {
	Helper.populateAccountFromResultSet (user, rs, fullRecord);

	user.setFirstName(rs.getString(NdexClasses.User_firstName));
	user.setLastName(rs.getString(NdexClasses.User_lastName));
	user.setDisplayName(rs.getString(NdexClasses.User_displayName));
	user.setIsIndividual(rs.getBoolean(NdexClasses.User_isIndividual));
	user.setEmailAddress(rs.getString(NdexClasses.User_emailAddress));
//	user.setPassword(rs.getString(NdexClasses.User_password));
	user.setIsVerified(rs.getBoolean(NdexClasses.User_isVerified));
	user.setUserName(rs.getString("user_name"));
	if ( fullRecord) {
		long limit = rs.getLong("disk_limit");
		if ( limit == 0)
			user.setDiskQuota(Long.valueOf(default_disk_quota));
		else
			user.setDiskQuota(limit);
		
		long used = rs.getLong("storage_usage");
		user.setDiskUsed(Long.valueOf(used));
	}
}
 
开发者ID:ndexbio,项目名称:ndex-rest,代码行数:23,代码来源:UserDAO.java

示例15: getUserPasswordByAccountName

import org.ndexbio.model.object.User; //导入依赖的package包/类
public String getUserPasswordByAccountName(String userName) throws NdexException,
	IllegalArgumentException, ObjectNotFoundException, SQLException {

	String queryStr = "SELECT password FROM " + NdexClasses.User + " where " + NdexClasses.User_userName + " = ? and is_deleted=false";

	try (PreparedStatement st = db.prepareStatement(queryStr))  {
		st.setString(1, userName);

		try (ResultSet rs = st.executeQuery() ) {
			if (rs.next()) {
				// populate the user object;
				return rs.getString(1);
	
		
			} 
			throw new ObjectNotFoundException("User " + userName + " doesn't exist.");
		}
	}

}
 
开发者ID:ndexbio,项目名称:ndex-rest,代码行数:21,代码来源:UserDAO.java


注:本文中的org.ndexbio.model.object.User类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。