當前位置: 首頁>>代碼示例>>Java>>正文


Java UsersService類代碼示例

本文整理匯總了Java中slender.services.core.users.UsersService的典型用法代碼示例。如果您正苦於以下問題:Java UsersService類的具體用法?Java UsersService怎麽用?Java UsersService使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


UsersService類屬於slender.services.core.users包,在下文中一共展示了UsersService類的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: addAdminUser

import slender.services.core.users.UsersService; //導入依賴的package包/類
@POST
@Path("addAdminUser")
@Override
public Response addAdminUser(
        @FormParam("firstName") String firstName, 
        @FormParam("lastName") String lastName, 
        @FormParam("username") String username, 
        @FormParam("email") String email,
        @FormParam("password") String password, 
        @FormParam("roleId") Integer roleId, 
        @FormParam("companyId") Integer companyId) {
    
    UsersFactory fact = new UsersFactory();
    Users user = fact.getUsers(firstName, lastName, username, email, password, roleId, companyId);
    user.setLastSeen(new Date());
    
    UsersService service =  new UsersServiceImpl();
    Users newUser = service.addAdminUser(user);
    
    String sessionId = UserSessions.getNewSessions(newUser.getUsername());
    
    return Response.ok(new SessionResponse(true, "Success", sessionId)).build();
}
 
開發者ID:Slenderware,項目名稱:SlenderRestAPI-Maven,代碼行數:24,代碼來源:UsersRestImpl.java

示例2: addUser

import slender.services.core.users.UsersService; //導入依賴的package包/類
@POST
@Path("addUser")
@Override
public Response addUser(
        @FormParam("firstName") String firstName, 
        @FormParam("lastName") String lastName, 
        @FormParam("username") String username, 
        @FormParam("email") String email,
        @FormParam("password") String password, 
        @FormParam("roleId") Integer roleId, 
        @FormParam("companyId") Integer companyId) {
    
    UsersFactory fact = new UsersFactory();
    Users user = fact.getUsers(firstName, lastName, username, email, password, roleId, companyId);
    user.setLastSeen(new Date());
    
    UsersService service =  new UsersServiceImpl();
    Users newUser = service.addUser(user);
    
    return Response.ok(new UserResponse(newUser)).build();
}
 
開發者ID:Slenderware,項目名稱:SlenderRestAPI-Maven,代碼行數:22,代碼來源:UsersRestImpl.java

示例3: getResponseEntity

import slender.services.core.users.UsersService; //導入依賴的package包/類
public static GenericEntity<List<CommentResponse>> getResponseEntity(List<Comment> comments) {
    List<CommentResponse> responses = new ArrayList<CommentResponse>();
    
    UsersService service = new UsersServiceImpl();
    Users user;
    for(Comment c : comments) {
        user = service.getUser(c.getUserId());
        responses.add(new CommentResponse(c, user.getUsername()));
    }
    
    return new GenericEntity<List<CommentResponse>>(responses) {};
}
 
開發者ID:Slenderware,項目名稱:SlenderRestAPI-Maven,代碼行數:13,代碼來源:CommentResponse.java

示例4: addProject

import slender.services.core.users.UsersService; //導入依賴的package包/類
@POST
@Path("addProject")
@Override
public Response addProject(
        @FormParam("projectCreator")Integer creator, 
        @FormParam("projectManager")Integer manager, 
        @FormParam("projectName")String name, 
        @FormParam("projectDescription")String desc,
        @FormParam("startDate")String startDate, 
        @FormParam("endDate")String endDate) {
    
    ProjectFactory factory = new ProjectFactory();
    Project project = factory.getProject(creator, manager, name, desc, DateParam.valueOf(startDate).getDate(), DateParam.valueOf(endDate).getDate());
    
    try {
        ProjectsService service = new ProjectsServiceImpl();
        Project rtrn = service.addProject(project);

        UsersService userService = new UsersServiceImpl();
        userService.addUserToProject(creator, rtrn.getId());
        return Response.ok(new SuccessResponse(true, "Successful")).build();
    }
    catch(Exception e) {
        e.printStackTrace();
    }
    
    return Response.ok(new SuccessResponse(false, "Failed")).build();
}
 
開發者ID:Slenderware,項目名稱:SlenderRestAPI-Maven,代碼行數:29,代碼來源:ProjectsRestImpl.java

示例5: getUserBySession

import slender.services.core.users.UsersService; //導入依賴的package包/類
@POST
@Path("getUserBySession")
@Override
public Response getUserBySession(@FormParam("sessionId") String sessionId) {
    UsersService service = new UsersServiceImpl();
    Users user = service.getUserBySession(sessionId);
    
    return Response.ok(new UserResponse(user)).build();
}
 
開發者ID:Slenderware,項目名稱:SlenderRestAPI-Maven,代碼行數:10,代碼來源:UsersRestImpl.java

示例6: addUserToProject

import slender.services.core.users.UsersService; //導入依賴的package包/類
@POST
@Path("assignUserToProject")
@Override
 public Response addUserToProject(@FormParam("userId") Integer userId, @FormParam("projectId") Integer projId) {
     UsersService service =  new UsersServiceImpl();
     boolean rtrn = service.addUserToProject(userId, projId);
     
     if(rtrn)
        return Response.ok(new SuccessResponse(true, "Successfull")).build();
     
     return Response.ok(new SuccessResponse(false, "User does not exist")).build();
 }
 
開發者ID:Slenderware,項目名稱:SlenderRestAPI-Maven,代碼行數:13,代碼來源:UsersRestImpl.java

示例7: addUserToTask

import slender.services.core.users.UsersService; //導入依賴的package包/類
@POST
@Path("assignUserToTask")
@Override
public Response addUserToTask(@FormParam("userId") Integer userId, @FormParam("taskId") Integer taskId) {
    UsersService service =  new UsersServiceImpl();
     boolean rtrn = service.addUserToTask(userId, taskId);
     
     if(rtrn)
        return Response.ok(new SuccessResponse(true, "Successfull")).build();
     
     return Response.ok(new SuccessResponse(false, "User does not exist")).build();
}
 
開發者ID:Slenderware,項目名稱:SlenderRestAPI-Maven,代碼行數:13,代碼來源:UsersRestImpl.java

示例8: addAdditional

import slender.services.core.users.UsersService; //導入依賴的package包/類
@Test(dependsOnMethods = {"addMainEntities"})
public void addAdditional() {
    TasksProgressService service = new TasksProgressServiceImpl();
    service.addProgress(TestVal.taskID, TestVal.user1ID, 4);
    service.addProgress(TestVal.taskID, TestVal.user2ID, 2);
    
    UsersService userService = new UsersServiceImpl();
    userService.addUserToProject(TestVal.user1ID, TestVal.projectID);
    userService.addUserToProject(TestVal.user2ID, TestVal.projectID);
    
    userService.addUserToTask(TestVal.user1ID, TestVal.taskID);
    userService.addUserToTask(TestVal.user2ID, TestVal.taskID);
}
 
開發者ID:Slenderware,項目名稱:SlenderRestAPI-Maven,代碼行數:14,代碼來源:PersistServicesTest.java

示例9: testUserBySession

import slender.services.core.users.UsersService; //導入依賴的package包/類
@Test
public void testUserBySession() {
    UsersService service = new UsersServiceImpl();
    Users user = service.getUserBySession(session);
    
    Assert.assertEquals(user.getUsername().contains(TestVal.fString), true, "getUserBySession");
}
 
開發者ID:Slenderware,項目名稱:SlenderRestAPI-Maven,代碼行數:8,代碼來源:UsersServiceTest.java


注:本文中的slender.services.core.users.UsersService類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。