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


Java NewUser类代码示例

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


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

示例1: createTestUser

import org.ndexbio.model.object.NewUser; //导入依赖的package包/类
private boolean createTestUser() {
	
	try {
		
		//localConnection.begin();
		final NewUser newUser = new NewUser();
           newUser.setEmailAddress("testUser");
           newUser.setPassword("testUser");
           newUser.setAccountName("testUser");
           newUser.setFirstName("testUser");
           newUser.setLastName("testUser");
		
        testUser = dao.createNewUser(newUser,null);
        //localConnection.commit();
       
       	return true;
       	
	} catch (Throwable e) {
		
		return false;
		
	}
}
 
开发者ID:ndexbio,项目名称:ndex-common,代码行数:24,代码来源:TestUserDAO.java

示例2: compareObjectsContents

import org.ndexbio.model.object.NewUser; //导入依赖的package包/类
public static void compareObjectsContents(User user1, NewUser user2) {
	
       assertEquals("account names do not match: ",   user1.getUserName(),  user2.getAccountName());
       assertEquals("descriptions do not match: ",    user1.getDescription(),  user2.getDescription());
       assertEquals("email addresses do not match: ", user1.getEmailAddress(), user2.getEmailAddress());
       assertEquals("first names do not match: ",     user1.getFirstName(),    user2.getFirstName());
       assertEquals("last names do not match: ",      user1.getLastName(),     user2.getLastName());
       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,代码行数:13,代码来源:UserUtils.java

示例3: updateMembershipAddMember

import org.ndexbio.model.object.NewUser; //导入依赖的package包/类
@Test
public void updateMembershipAddMember() throws ObjectNotFoundException, NdexException {
User member = null;

try {
 
 //localConnection.begin();
  final NewUser newUser = new NewUser();
        newUser.setEmailAddress("member");
        newUser.setPassword("member");
        newUser.setAccountName("member");
        newUser.setFirstName("member");
        newUser.setLastName("member");
	
     member = userDAO.createNewUser(newUser,null);
     //localConnection.commit();
  
  Membership membership = new Membership();
  membership.setMemberAccountName(member.getAccountName());
  membership.setMemberUUID(member.getExternalId());
  membership.setPermissions(Permissions.WRITE);
  membership.setMembershipType(MembershipType.GROUP);
  
  dao.updateMember(membership, testGroup.getExternalId(), testUser.getExternalId());
  
  //localConnection.commit();
 
} catch(Exception e) {
 fail(e.getMessage());
} finally {
  userDAO.deleteUserById(member.getExternalId());
  //localConnection.commit();
}

}
 
开发者ID:ndexbio,项目名称:ndex-common,代码行数:36,代码来源:TestGroupDAO.java

示例4: createUserInvalidAccountName

import org.ndexbio.model.object.NewUser; //导入依赖的package包/类
@Test(expected = IllegalArgumentException.class)
public void createUserInvalidAccountName() throws NdexException, IllegalArgumentException {

		final NewUser newUser = new NewUser();
           newUser.setEmailAddress("test");
           newUser.setPassword("test");
           newUser.setAccountName("");
           newUser.setFirstName("test");
           newUser.setLastName("test");
           
           dao.createNewUser(newUser,null);
           
}
 
开发者ID:ndexbio,项目名称:ndex-common,代码行数:14,代码来源:TestUserDAO.java

示例5: createUserInvalidPassword

import org.ndexbio.model.object.NewUser; //导入依赖的package包/类
@Test(expected = IllegalArgumentException.class)
public void createUserInvalidPassword() throws NdexException, IllegalArgumentException {

		final NewUser newUser = new NewUser();
           newUser.setEmailAddress("test");
           newUser.setPassword("");
           newUser.setAccountName("test");
           newUser.setFirstName("test");
           newUser.setLastName("test");
           
           dao.createNewUser(newUser,null);
           
}
 
开发者ID:ndexbio,项目名称:ndex-common,代码行数:14,代码来源:TestUserDAO.java

示例6: createUserInvalidEmail

import org.ndexbio.model.object.NewUser; //导入依赖的package包/类
@Test(expected = IllegalArgumentException.class)
public void createUserInvalidEmail() throws NdexException, IllegalArgumentException {

		final NewUser newUser = new NewUser();
           newUser.setEmailAddress("");
           newUser.setPassword("test");
           newUser.setAccountName("test");
           newUser.setFirstName("test");
           newUser.setLastName("test");
           
           dao.createNewUser(newUser,null);
           
}
 
开发者ID:ndexbio,项目名称:ndex-common,代码行数:14,代码来源:TestUserDAO.java

示例7: createUserExistingUser

import org.ndexbio.model.object.NewUser; //导入依赖的package包/类
@Test(expected = DuplicateObjectException.class)
public void createUserExistingUser() throws IllegalArgumentException, NdexException, DuplicateObjectException {

			final NewUser newUser = new NewUser();
            newUser.setEmailAddress("test");
            newUser.setPassword("test");
            newUser.setAccountName("test");
            newUser.setFirstName("test");
            newUser.setLastName("test");
			
            dao.createNewUser(newUser,null);
		
}
 
开发者ID:ndexbio,项目名称:ndex-common,代码行数:14,代码来源:TestUserDAO.java

示例8: createNewUser

import org.ndexbio.model.object.NewUser; //导入依赖的package包/类
/**************************************************************************
	 * Create a new user
	 * 
	 * @param newUser
	 *            A User object, from the NDEx Object Model
	 * @throws NdexException
	 *             Attempting to save an ODocument to the database
	 * @throws IllegalArgumentException
	 *             The newUser does not contain proper fields
	 * @throws DuplicateObjectException
	 *             The account name and/or email already exist
	 * @returns User object, from the NDEx Object Model
	 **************************************************************************/
	public User createNewUser(NewUser newUser, String verificationCode ) throws NdexException,
			IllegalArgumentException, DuplicateObjectException {

		Preconditions.checkArgument(null != newUser,
				"A user object is required");
		Preconditions.checkArgument(
				!Strings.isNullOrEmpty(newUser.getAccountName()),
				"A accountName is required");
		
		Preconditions.checkArgument(
				!Strings.isNullOrEmpty(newUser.getPassword()),
				"A user password is required");
		Preconditions.checkArgument(
				!Strings.isNullOrEmpty(newUser.getEmailAddress()),
				"A user email address is required");

		this.checkForExistingUser(newUser);

		try {

			ODocument user = new ODocument(NdexClasses.User).
					fields("description", newUser.getDescription(),
			               "websiteURL", newUser.getWebsite(),
			               "imageURL", newUser.getImage(),
			               "emailAddress", newUser.getEmailAddress(),
			               "firstName", newUser.getFirstName(),
			               "lastName", newUser.getLastName(),
			               //, newUser.getAccountName(),
			               "password", Security.hashText(newUser.getPassword()),
			               NdexClasses.ExternalObj_ID, NdexUUIDFactory.INSTANCE.createNewNDExUUID(),
			               NdexClasses.ExternalObj_cTime, new Date(),
			               NdexClasses.ExternalObj_mTime, new Date()
			               //NdexClasses.ExternalObj_isDeleted, false
					      );

			if ( verificationCode !=null) {

//				String verCode= Security.generatePassword(10);
			
				user.fields(NdexClasses.User_verification_code, verificationCode,
							NdexClasses.ExternalObj_isDeleted, true,
							NdexClasses.account_P_oldAcctName, newUser.getAccountName());
			} else {
				user.fields(NdexClasses.ExternalObj_isDeleted, false,
						NdexClasses.account_P_accountName, newUser.getAccountName());
			}
			
			user = user.save();

			logger.info("A new user with accountName "
					+ newUser.getAccountName() + " has been created");

			User u = UserDocDAO.getUserFromDocument(user);
	//		if ( needEmailVerification)
	//			u.set
			
			return u; 
			
		} catch (Exception e) {
			logger.severe("Could not save new user to the database: " + e.getMessage());
			throw new NdexException(e.getMessage());
		}
	}
 
开发者ID:ndexbio,项目名称:ndex-common,代码行数:77,代码来源:UserDocDAO.java

示例9: createTestUser

import org.ndexbio.model.object.NewUser; //导入依赖的package包/类
private void createTestUser() {
	
	try {
		
		final NewUser newUser = new NewUser();
           newUser.setEmailAddress("testUser");
           newUser.setPassword("testUser");
           newUser.setAccountName("testUser");
           newUser.setFirstName("testUser");
           newUser.setLastName("testUser");
		
        testUser = userDAO.createNewUser(newUser,null);
        //localConnection.commit();
       
       	//return true;
       	
	} catch (Throwable e) {
		
		fail(e.getMessage());
		
	}
}
 
开发者ID:ndexbio,项目名称:ndex-common,代码行数:23,代码来源:TestGroupDAO.java


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