Search in sources :

Example 1 with Resource

use of org.gluu.oxtrust.model.scim2.Resource in project oxTrust by GluuFederation.

the class BulkWebService method processUserOperation.

private BulkOperation processUserOperation(BulkOperation operation, Map<String, String> processedBulkIds) throws Exception {
    log.info(" Operation is for User ");
    // Intercept bulkId
    User user = null;
    if (operation.getData() != null) {
        // Required in a request when
        // "method" is "POST", "PUT", or
        // "PATCH".
        String serializedData = serialize(operation.getData());
        for (Map.Entry<String, String> entry : processedBulkIds.entrySet()) {
            String key = "bulkId:" + entry.getKey();
            serializedData = serializedData.replaceAll(key, entry.getValue());
        }
        user = deserializeToUser(serializedData);
    }
    String userRootEndpoint = appConfiguration.getBaseEndpoint() + "/scim/v2/Users/";
    if (operation.getMethod().equalsIgnoreCase(HttpMethod.POST)) {
        log.info(" Method is POST ");
        try {
            user = scim2UserService.createUser(user);
            GluuCustomPerson gluuPerson = personService.getPersonByUid(user.getUserName());
            String inum = gluuPerson.getInum();
            // String location = (new
            // StringBuilder()).append(domain).append("/Users/").append(inum).toString();
            String location = userRootEndpoint + inum;
            operation.setLocation(location);
            operation.setStatus(String.valueOf(Response.Status.CREATED.getStatusCode()));
            operation.setResponse(user);
            // Set aside successfully-processed bulkId
            // bulkId is only required in POST
            processedBulkIds.put(operation.getBulkId(), user.getId());
        } catch (DuplicateEntryException ex) {
            log.error("DuplicateEntryException", ex);
            ex.printStackTrace();
            operation.setStatus(String.valueOf(Response.Status.CONFLICT.getStatusCode()));
            operation.setResponse(createErrorResponse(Response.Status.CONFLICT, ErrorScimType.UNIQUENESS, ex.getMessage()));
        } catch (PersonRequiredFieldsException ex) {
            log.error("PersonRequiredFieldsException: ", ex);
            operation.setStatus(String.valueOf(Response.Status.BAD_REQUEST.getStatusCode()));
            operation.setResponse(createErrorResponse(Response.Status.BAD_REQUEST, ErrorScimType.INVALID_VALUE, ex.getMessage()));
        } catch (Exception ex) {
            log.error("Failed to create user", ex);
            ex.printStackTrace();
            operation.setStatus(String.valueOf(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()));
            operation.setResponse(createErrorResponse(Response.Status.INTERNAL_SERVER_ERROR, null, INTERNAL_SERVER_ERROR_MESSAGE));
        }
    } else if (operation.getMethod().equalsIgnoreCase(HttpMethod.PUT)) {
        log.info(" Method is PUT ");
        String path = operation.getPath();
        String id = getId(path);
        for (Map.Entry<String, String> entry : processedBulkIds.entrySet()) {
            String key = "bulkId:" + entry.getKey();
            if (id.equalsIgnoreCase(key)) {
                id = id.replaceAll(key, entry.getValue());
                break;
            }
        }
        try {
            user = scim2UserService.updateUser(id, user);
            // String location = (new
            // StringBuilder()).append(domain).append("/Users/").append(personiD).toString();
            String location = userRootEndpoint + id;
            operation.setLocation(location);
            operation.setStatus(String.valueOf(Response.Status.OK.getStatusCode()));
            operation.setResponse(user);
            // bulkId is only required in POST
            if (operation.getBulkId() != null) {
                processedBulkIds.put(operation.getBulkId(), user.getId());
            }
        } catch (EntryPersistenceException ex) {
            log.error("Failed to update user", ex);
            ex.printStackTrace();
            operation.setStatus(String.valueOf(Response.Status.NOT_FOUND.getStatusCode()));
            operation.setResponse(createErrorResponse(Response.Status.NOT_FOUND, ErrorScimType.INVALID_VALUE, "Resource " + id + " not found"));
        } catch (DuplicateEntryException ex) {
            log.error("DuplicateEntryException", ex);
            ex.printStackTrace();
            operation.setStatus(String.valueOf(Response.Status.CONFLICT.getStatusCode()));
            operation.setResponse(createErrorResponse(Response.Status.CONFLICT, ErrorScimType.UNIQUENESS, ex.getMessage()));
        } catch (Exception ex) {
            log.error("Failed to update user", ex);
            ex.printStackTrace();
            operation.setStatus(String.valueOf(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()));
            operation.setResponse(createErrorResponse(Response.Status.INTERNAL_SERVER_ERROR, null, INTERNAL_SERVER_ERROR_MESSAGE));
        }
    } else if (operation.getMethod().equalsIgnoreCase(HttpMethod.DELETE)) {
        log.info(" Method is DELETE ");
        String path = operation.getPath();
        String id = getId(path);
        for (Map.Entry<String, String> entry : processedBulkIds.entrySet()) {
            String key = "bulkId:" + entry.getKey();
            if (id.equalsIgnoreCase(key)) {
                id = id.replaceAll(key, entry.getValue());
                break;
            }
        }
        try {
            scim2UserService.deleteUser(id);
            // Location may be omitted on DELETE
            operation.setStatus(String.valueOf(Response.Status.OK.getStatusCode()));
            operation.setResponse("User " + id + " deleted");
            // bulkId is only required in POST
            if (operation.getBulkId() != null) {
                processedBulkIds.put(operation.getBulkId(), id);
            }
        } catch (EntryPersistenceException ex) {
            log.error("Failed to delete user", ex);
            ex.printStackTrace();
            operation.setStatus(String.valueOf(Response.Status.NOT_FOUND.getStatusCode()));
            operation.setResponse(createErrorResponse(Response.Status.NOT_FOUND, null, "Resource " + id + " not found"));
        } catch (Exception ex) {
            log.error("Failed to delete user", ex);
            ex.printStackTrace();
            operation.setStatus(String.valueOf(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()));
            operation.setResponse(createErrorResponse(Response.Status.INTERNAL_SERVER_ERROR, null, INTERNAL_SERVER_ERROR_MESSAGE));
        }
    }
    return operation;
}
Also used : GluuCustomPerson(org.gluu.oxtrust.model.GluuCustomPerson) User(org.gluu.oxtrust.model.scim2.User) EntryPersistenceException(org.gluu.site.ldap.persistence.exception.EntryPersistenceException) DuplicateEntryException(org.gluu.site.ldap.exception.DuplicateEntryException) PersonRequiredFieldsException(org.gluu.oxtrust.exception.PersonRequiredFieldsException) Map(java.util.Map) LinkedHashMap(java.util.LinkedHashMap) PersonRequiredFieldsException(org.gluu.oxtrust.exception.PersonRequiredFieldsException) EntryPersistenceException(org.gluu.site.ldap.persistence.exception.EntryPersistenceException) DuplicateEntryException(org.gluu.site.ldap.exception.DuplicateEntryException)

Example 2 with Resource

use of org.gluu.oxtrust.model.scim2.Resource in project oxTrust by GluuFederation.

the class GroupWebService method searchGroupsPost.

@Path("/.search")
@POST
@Produces({ Constants.MEDIA_TYPE_SCIM_JSON, MediaType.APPLICATION_JSON })
@HeaderParam("Accept")
@DefaultValue(Constants.MEDIA_TYPE_SCIM_JSON)
@ApiOperation(value = "Search group POST /.search", notes = "Returns a list of groups (https://tools.ietf.org/html/rfc7644#section-3.4.3)", response = ListResponse.class)
public Response searchGroupsPost(@HeaderParam("Authorization") String authorization, @QueryParam(OxTrustConstants.QUERY_PARAMETER_TEST_MODE_OAUTH2_TOKEN) final String token, @ApiParam(value = "SearchRequest", required = true) SearchRequest searchRequest) throws Exception {
    try {
        log.info("IN GroupWebService.searchGroupsPost()...");
        // Authorization check is done in searchGroups()
        Response response = searchGroups(authorization, token, searchRequest.getFilter(), searchRequest.getStartIndex(), searchRequest.getCount(), searchRequest.getSortBy(), searchRequest.getSortOrder(), searchRequest.getAttributesArray());
        URI location = new URI(appConfiguration.getBaseEndpoint() + "/scim/v2/Groups/.search");
        log.info("LEAVING GroupWebService.searchGroupsPost()...");
        return Response.fromResponse(response).location(location).build();
    } catch (EntryPersistenceException ex) {
        log.error("Error in searchGroupsPost", ex);
        ex.printStackTrace();
        return getErrorResponse(Response.Status.NOT_FOUND, ErrorScimType.INVALID_VALUE, "Resource not found");
    } catch (Exception ex) {
        log.error("Error in searchGroupsPost", ex);
        ex.printStackTrace();
        return getErrorResponse(Response.Status.BAD_REQUEST, ErrorScimType.INVALID_FILTER, INTERNAL_SERVER_ERROR_MESSAGE);
    }
}
Also used : VirtualListViewResponse(org.xdi.ldap.model.VirtualListViewResponse) ListResponse(org.gluu.oxtrust.model.scim2.ListResponse) Response(javax.ws.rs.core.Response) EntryPersistenceException(org.gluu.site.ldap.persistence.exception.EntryPersistenceException) URI(java.net.URI) EntryPersistenceException(org.gluu.site.ldap.persistence.exception.EntryPersistenceException) DuplicateEntryException(org.gluu.site.ldap.exception.DuplicateEntryException) Path(javax.ws.rs.Path) DefaultValue(javax.ws.rs.DefaultValue) HeaderParam(javax.ws.rs.HeaderParam) POST(javax.ws.rs.POST) Produces(javax.ws.rs.Produces) ApiOperation(com.wordnik.swagger.annotations.ApiOperation)

Example 3 with Resource

use of org.gluu.oxtrust.model.scim2.Resource in project oxTrust by GluuFederation.

the class ResourceTypeWS method listResources.

@GET
@Produces(Constants.MEDIA_TYPE_SCIM_JSON + "; charset=utf-8")
@HeaderParam("Accept")
@DefaultValue(Constants.MEDIA_TYPE_SCIM_JSON)
public Response listResources(@HeaderParam("Authorization") String authorization) throws Exception {
    ListResponse listResponse = new ListResponse();
    List<String> schemas = new ArrayList<String>();
    schemas.add(Constants.LIST_RESPONSE_SCHEMA_ID);
    listResponse.setSchemas(schemas);
    // START: User
    ResourceType userResourceType = new ResourceType();
    userResourceType.setDescription(Constants.USER_CORE_SCHEMA_DESCRIPTION);
    userResourceType.setEndpoint("/v2/Users");
    userResourceType.setName(Constants.USER_CORE_SCHEMA_NAME);
    userResourceType.setId(Constants.USER_CORE_SCHEMA_NAME);
    userResourceType.setSchema(Constants.USER_CORE_SCHEMA_ID);
    Meta userMeta = new Meta();
    userMeta.setLocation(appConfiguration.getBaseEndpoint() + "/scim/v2/ResourceTypes/User");
    userMeta.setResourceType("ResourceType");
    userResourceType.setMeta(userMeta);
    List<SchemaExtensionHolder> schemaExtensions = new ArrayList<SchemaExtensionHolder>();
    SchemaExtensionHolder userExtensionSchema = new SchemaExtensionHolder();
    userExtensionSchema.setSchema(Constants.USER_EXT_SCHEMA_ID);
    userExtensionSchema.setRequired(false);
    schemaExtensions.add(userExtensionSchema);
    userResourceType.setSchemaExtensions(schemaExtensions);
    // START: Group
    ResourceType groupResourceType = new ResourceType();
    groupResourceType.setDescription(Constants.GROUP_CORE_SCHEMA_DESCRIPTION);
    groupResourceType.setEndpoint("/v2/Groups");
    groupResourceType.setName(Constants.GROUP_CORE_SCHEMA_NAME);
    groupResourceType.setId(Constants.GROUP_CORE_SCHEMA_NAME);
    groupResourceType.setSchema(Constants.GROUP_CORE_SCHEMA_ID);
    Meta groupMeta = new Meta();
    groupMeta.setLocation(appConfiguration.getBaseEndpoint() + "/scim/v2/ResourceTypes/Group");
    groupMeta.setResourceType("ResourceType");
    groupResourceType.setMeta(groupMeta);
    // START: FidoDevice
    ResourceType fidoDeviceResourceType = new ResourceType();
    fidoDeviceResourceType.setDescription(Constants.FIDO_DEVICES_CORE_SCHEMA_DESCRIPTION);
    fidoDeviceResourceType.setEndpoint("/v2/FidoDevices");
    fidoDeviceResourceType.setName(Constants.FIDO_DEVICES_CORE_SCHEMA_NAME);
    fidoDeviceResourceType.setId(Constants.FIDO_DEVICES_CORE_SCHEMA_NAME);
    fidoDeviceResourceType.setSchema(Constants.FIDO_DEVICES_CORE_SCHEMA_ID);
    Meta fidoDeviceMeta = new Meta();
    fidoDeviceMeta.setLocation(appConfiguration.getBaseEndpoint() + "/scim/v2/ResourceTypes/FidoDevice");
    fidoDeviceMeta.setResourceType("ResourceType");
    fidoDeviceResourceType.setMeta(fidoDeviceMeta);
    // ResourceType[] resourceTypes = new ResourceType[]{userResourceType, groupResourceType};
    List<Resource> resourceTypes = new ArrayList<Resource>();
    resourceTypes.add(userResourceType);
    resourceTypes.add(groupResourceType);
    resourceTypes.add(fidoDeviceResourceType);
    listResponse.setResources(resourceTypes);
    listResponse.setTotalResults(resourceTypes.size());
    listResponse.setItemsPerPage(10);
    listResponse.setStartIndex(1);
    URI location = new URI(appConfiguration.getBaseEndpoint() + "/scim/v2/ResourceTypes");
    // return Response.ok(resourceTypes).location(location).build();
    return Response.ok(listResponse).location(location).build();
}
Also used : Meta(org.gluu.oxtrust.model.scim2.Meta) SchemaExtensionHolder(org.gluu.oxtrust.model.scim2.schema.SchemaExtensionHolder) ListResponse(org.gluu.oxtrust.model.scim2.ListResponse) ArrayList(java.util.ArrayList) Resource(org.gluu.oxtrust.model.scim2.Resource) ResourceType(org.gluu.oxtrust.model.scim2.provider.ResourceType) URI(java.net.URI) DefaultValue(javax.ws.rs.DefaultValue) HeaderParam(javax.ws.rs.HeaderParam) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Example 4 with Resource

use of org.gluu.oxtrust.model.scim2.Resource in project oxTrust by GluuFederation.

the class BulkWebService method processGroupOperation.

private BulkOperation processGroupOperation(BulkOperation operation, Map<String, String> processedBulkIds) throws Exception {
    log.info(" Operation is for Group ");
    // Intercept bulkId
    Group group = null;
    if (operation.getData() != null) {
        // Required in a request when
        // "method" is "POST", "PUT", or
        // "PATCH".
        String serializedData = serialize(operation.getData());
        for (Map.Entry<String, String> entry : processedBulkIds.entrySet()) {
            String key = "bulkId:" + entry.getKey();
            serializedData = serializedData.replaceAll(key, entry.getValue());
        }
        group = deserializeToGroup(serializedData);
    }
    String groupRootEndpoint = appConfiguration.getBaseEndpoint() + "/scim/v2/Groups/";
    if (operation.getMethod().equalsIgnoreCase(HttpMethod.POST)) {
        log.info(" Method is POST ");
        try {
            group = scim2GroupService.createGroup(group);
            GluuGroup gluuGroup = groupService.getGroupByDisplayName(group.getDisplayName());
            String id = gluuGroup.getInum();
            // String location = (new
            // StringBuilder()).append(domain).append("/Groups/").append(id).toString();
            String location = groupRootEndpoint + id;
            operation.setLocation(location);
            operation.setStatus(String.valueOf(Response.Status.CREATED.getStatusCode()));
            operation.setResponse(group);
            // Set aside successfully-processed bulkId
            // bulkId is only required in POST
            processedBulkIds.put(operation.getBulkId(), group.getId());
        } catch (DuplicateEntryException ex) {
            log.error("DuplicateEntryException", ex);
            ex.printStackTrace();
            operation.setStatus(String.valueOf(Response.Status.CONFLICT.getStatusCode()));
            operation.setResponse(createErrorResponse(Response.Status.CONFLICT, ErrorScimType.UNIQUENESS, ex.getMessage()));
        } catch (Exception ex) {
            log.error("Failed to create group", ex);
            ex.printStackTrace();
            operation.setStatus(String.valueOf(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()));
            operation.setResponse(createErrorResponse(Response.Status.INTERNAL_SERVER_ERROR, null, INTERNAL_SERVER_ERROR_MESSAGE));
        }
    } else if (operation.getMethod().equalsIgnoreCase(HttpMethod.PUT)) {
        log.info(" Method is PUT ");
        String path = operation.getPath();
        String id = getId(path);
        for (Map.Entry<String, String> entry : processedBulkIds.entrySet()) {
            String key = "bulkId:" + entry.getKey();
            if (id.equalsIgnoreCase(key)) {
                id = id.replaceAll(key, entry.getValue());
                break;
            }
        }
        try {
            group = scim2GroupService.updateGroup(id, group);
            // String location = (new
            // StringBuilder()).append(domain).append("/Groups/").append(groupiD).toString();
            String location = groupRootEndpoint + id;
            operation.setLocation(location);
            operation.setStatus(String.valueOf(Response.Status.OK.getStatusCode()));
            operation.setResponse(group);
            // bulkId is only required in POST
            if (operation.getBulkId() != null) {
                processedBulkIds.put(operation.getBulkId(), group.getId());
            }
        } catch (EntryPersistenceException ex) {
            log.error("Failed to update group", ex);
            ex.printStackTrace();
            operation.setStatus(String.valueOf(Response.Status.NOT_FOUND.getStatusCode()));
            operation.setResponse(createErrorResponse(Response.Status.NOT_FOUND, ErrorScimType.INVALID_VALUE, "Resource " + id + " not found"));
        } catch (DuplicateEntryException ex) {
            log.error("DuplicateEntryException", ex);
            ex.printStackTrace();
            operation.setStatus(String.valueOf(Response.Status.CONFLICT.getStatusCode()));
            operation.setResponse(createErrorResponse(Response.Status.CONFLICT, ErrorScimType.UNIQUENESS, ex.getMessage()));
        } catch (Exception ex) {
            log.error("Failed to update group", ex);
            ex.printStackTrace();
            operation.setStatus(String.valueOf(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()));
            operation.setResponse(createErrorResponse(Response.Status.INTERNAL_SERVER_ERROR, null, INTERNAL_SERVER_ERROR_MESSAGE));
        }
    } else if (operation.getMethod().equalsIgnoreCase(HttpMethod.DELETE)) {
        log.info(" Method is DELETE ");
        String path = operation.getPath();
        String id = getId(path);
        for (Map.Entry<String, String> entry : processedBulkIds.entrySet()) {
            String key = "bulkId:" + entry.getKey();
            if (id.equalsIgnoreCase(key)) {
                id = id.replaceAll(key, entry.getValue());
                break;
            }
        }
        try {
            scim2GroupService.deleteGroup(id);
            // Location may be omitted on DELETE
            operation.setStatus(String.valueOf(Response.Status.OK.getStatusCode()));
            operation.setResponse("Group " + id + " deleted");
            // bulkId is only required in POST
            if (operation.getBulkId() != null) {
                processedBulkIds.put(operation.getBulkId(), id);
            }
        } catch (EntryPersistenceException ex) {
            log.error("Failed to delete group", ex);
            ex.printStackTrace();
            operation.setStatus(String.valueOf(Response.Status.NOT_FOUND.getStatusCode()));
            operation.setResponse(createErrorResponse(Response.Status.NOT_FOUND, null, "Resource " + id + " not found"));
        } catch (Exception ex) {
            log.error("Failed to delete group", ex);
            ex.printStackTrace();
            operation.setStatus(String.valueOf(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()));
            operation.setResponse(createErrorResponse(Response.Status.INTERNAL_SERVER_ERROR, null, INTERNAL_SERVER_ERROR_MESSAGE));
        }
    }
    return operation;
}
Also used : GluuGroup(org.gluu.oxtrust.model.GluuGroup) Group(org.gluu.oxtrust.model.scim2.Group) EntryPersistenceException(org.gluu.site.ldap.persistence.exception.EntryPersistenceException) DuplicateEntryException(org.gluu.site.ldap.exception.DuplicateEntryException) Map(java.util.Map) LinkedHashMap(java.util.LinkedHashMap) GluuGroup(org.gluu.oxtrust.model.GluuGroup) PersonRequiredFieldsException(org.gluu.oxtrust.exception.PersonRequiredFieldsException) EntryPersistenceException(org.gluu.site.ldap.persistence.exception.EntryPersistenceException) DuplicateEntryException(org.gluu.site.ldap.exception.DuplicateEntryException)

Example 5 with Resource

use of org.gluu.oxtrust.model.scim2.Resource in project oxTrust by GluuFederation.

the class SchemaWebService method listSchemas.

/**
     * Retrieves the complete schema.
     *
     * @param authorization
     * @return
     * @throws Exception
     */
@GET
@Produces(Constants.MEDIA_TYPE_SCIM_JSON + "; charset=utf-8")
@HeaderParam("Accept")
@DefaultValue(Constants.MEDIA_TYPE_SCIM_JSON)
public Response listSchemas(@HeaderParam("Authorization") String authorization) throws Exception {
    log.info(" listSchemas() ");
    ListResponse listResponse = new ListResponse();
    List<String> schemas = new ArrayList<String>();
    schemas.add(Constants.LIST_RESPONSE_SCHEMA_ID);
    listResponse.setSchemas(schemas);
    List<SchemaType> schemaTypes = SchemaTypeMapping.getSchemaInstances();
    List<Resource> resources = new ArrayList<Resource>();
    SchemaTypeLoadingFactory factory = new SchemaTypeLoadingFactory();
    for (SchemaType schemaType : schemaTypes) {
        factory.load(appConfiguration, schemaType);
        resources.add(schemaType);
    }
    listResponse.setResources(resources);
    listResponse.setTotalResults(schemaTypes.size());
    listResponse.setItemsPerPage(10);
    listResponse.setStartIndex(1);
    URI location = new URI(appConfiguration.getBaseEndpoint() + "/scim/v2/Schemas");
    // Serialize to JSON
    String json = serialize(listResponse);
    return Response.ok(json).location(location).build();
}
Also used : ListResponse(org.gluu.oxtrust.model.scim2.ListResponse) SchemaTypeLoadingFactory(org.gluu.oxtrust.service.scim2.schema.SchemaTypeLoadingFactory) ArrayList(java.util.ArrayList) Resource(org.gluu.oxtrust.model.scim2.Resource) URI(java.net.URI) SchemaType(org.gluu.oxtrust.model.scim2.schema.SchemaType) DefaultValue(javax.ws.rs.DefaultValue) HeaderParam(javax.ws.rs.HeaderParam) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Aggregations

EntryPersistenceException (org.gluu.site.ldap.persistence.exception.EntryPersistenceException)18 DuplicateEntryException (org.gluu.site.ldap.exception.DuplicateEntryException)17 DefaultValue (javax.ws.rs.DefaultValue)15 HeaderParam (javax.ws.rs.HeaderParam)15 Produces (javax.ws.rs.Produces)15 ListResponse (org.gluu.oxtrust.model.scim2.ListResponse)15 ApiOperation (com.wordnik.swagger.annotations.ApiOperation)13 Path (javax.ws.rs.Path)13 Response (javax.ws.rs.core.Response)13 VirtualListViewResponse (org.xdi.ldap.model.VirtualListViewResponse)13 URI (java.net.URI)12 PersonRequiredFieldsException (org.gluu.oxtrust.exception.PersonRequiredFieldsException)7 User (org.gluu.oxtrust.model.scim2.User)6 GET (javax.ws.rs.GET)5 Date (java.util.Date)4 Consumes (javax.ws.rs.Consumes)4 PUT (javax.ws.rs.PUT)4 GluuCustomPerson (org.gluu.oxtrust.model.GluuCustomPerson)4 GluuGroup (org.gluu.oxtrust.model.GluuGroup)4 Group (org.gluu.oxtrust.model.scim2.Group)4