@@ -0,0 +1,2723 @@
+/**%0A * JBoss, Home of Professional Open Source%0A * Copyright Red Hat, Inc., and individual contributors.%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A * %09http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage org.jboss.aerogear.connectivity.rest.user;%0A%0A%0Aimport org.jboss.aerogear.connectivity.users.Developer;%0Aimport org.jboss.aerogear.security.authz.IdentityManagement;%0Aimport org.jboss.aerogear.security.authz.Secure;%0Aimport org.picketlink.idm.IdentityManager;%0Aimport org.picketlink.idm.model.SimpleUser;%0Aimport org.picketlink.idm.query.IdentityQuery;%0A%0Aimport javax.ejb.Stateless;%0Aimport javax.ejb.TransactionAttribute;%0Aimport javax.inject.Inject;%0Aimport javax.persistence.TypedQuery;%0Aimport javax.ws.rs.*;%0Aimport javax.ws.rs.core.Response;%0Aimport javax.ws.rs.core.Response.Status;%0Aimport java.util.List;%0A%0A@Stateless%0A@TransactionAttribute%0A@Path(%22/users%22)%0A@Secure(%22admin%22)%0Apublic class UserEndpoint %7B%0A    @Inject%0A    private IdentityManagement identityManagement;%0A%0A    @Inject%0A    private IdentityManager identityManager;%0A%0A    @GET%0A    @Path(%22/%7Bid%7D%22)%0A    @Produces(%22application/json%22)%0A    public Response findById(@PathParam(%22id%22) String id)%0A    %7B%0A        SimpleUser developer = (SimpleUser) identityManager.lookupIdentityById(SimpleUser.class,id);%0A        if (developer == null)%0A        %7B%0A            return Response.status(Status.NOT_FOUND).build();%0A        %7D%0A        return Response.ok(developer).build();%0A    %7D%0A%0A    @GET%0A    @Produces(%22application/json%22)%0A    public List%3CSimpleUser%3E listAll()%0A    %7B%0A        IdentityQuery%3CSimpleUser%3E  identityQuery = identityManager.createIdentityQuery(SimpleUser.class);%0A        return identityQuery.getResultList();%0A    %7D%0A%0A    @PUT%0A    @Path(%22/%7Bid%7D%22)%0A    @Consumes(%22application/json%22)%0A    public Response update(@PathParam(%22id%22) String id, SimpleUser developer)%0A    %7B%0A        //Developer developer = (Developer) identityManagement.findById(id);%0A        identityManager.update(developer);%0A        return Response.noContent().build();%0A    %7D%0A%0A    @DELETE%0A    @Path(%22/%7Bid%7D%22)%0A    public Response deleteById(@PathParam(%22id%22) String id) %7B%0A        SimpleUser simpleUser = identityManager.lookupIdentityById(SimpleUser.class,id);%0A        identityManager.remove(simpleUser);%0A        return Response.noContent().build();%0A    %7D%0A%0A%0A%0A%7D%0A

add crud for user