/** * Validates and trims the security role key * * @param securityRoleKey securityRoleKey * * @return security role validated and trimmed */ private String validateSecurityRoleKey(SecurityRoleKey securityRoleKey) { Assert.notNull(securityRoleKey, "A security role key must be specified."); return alternateKeyHelper.validateStringParameter("security role name", securityRoleKey.getSecurityRoleName()); }
@NamespacePermission(fields = "#namespace", permissions = NamespacePermissionEnum.READ) @Override public JobDefinition getJobDefinition(String namespace, String jobName) throws Exception { // Validate the job definition alternate key. String namespaceLocal = alternateKeyHelper.validateStringParameter("namespace", namespace); String jobNameLocal = alternateKeyHelper.validateStringParameter("job name", jobName); // Retrieve and ensure that a job definition exists. JobDefinitionEntity jobDefinitionEntity = jobDefinitionDaoHelper.getJobDefinitionEntity(namespaceLocal, jobNameLocal); // Create and return the job definition object from the persisted entity. return createJobDefinitionFromEntity(jobDefinitionEntity); }
/** * Validates a security role key. This method also trims the key parameters. * * @param securityRoleKey the security role key */ public void validateAndTrimSecurityRoleKey(SecurityRoleKey securityRoleKey) { Assert.notNull(securityRoleKey, "A security role key must be specified."); securityRoleKey.setSecurityRoleName(alternateKeyHelper.validateStringParameter("security role name", securityRoleKey.getSecurityRoleName())); } }
/** * Validates a search index key. This method also trims the key parameters. * * @param key the search index key * * @throws IllegalArgumentException if any validation errors were found */ private void validateSearchIndexKey(SearchIndexKey key) throws IllegalArgumentException { Assert.notNull(key, "A search index key must be specified."); key.setSearchIndexName(alternateKeyHelper.validateStringParameter("Search index name", key.getSearchIndexName())); }
/** * Validates a search index key. This method trims the key parameters and ensures it exists in the database. * * @param searchIndexKey the search index key * * @throws IllegalArgumentException if any activation errors were found */ private void validateSearchIndexKey(SearchIndexKey searchIndexKey) throws IllegalArgumentException { Assert.notNull(searchIndexKey, "A search index key must be specified."); searchIndexKey.setSearchIndexName(alternateKeyHelper.validateStringParameter("Search index name", searchIndexKey.getSearchIndexName())); }
/** * Validates a security function key. This method also trims the key parameters. * * @param securityFunctionKey the security function key */ public void validateAndTrimSecurityFunctionKey(SecurityFunctionKey securityFunctionKey) { Assert.notNull(securityFunctionKey, "A security function key must be specified."); securityFunctionKey .setSecurityFunctionName(alternateKeyHelper.validateStringParameter("security function name", securityFunctionKey.getSecurityFunctionName())); } }
/** * Validates the subject matter expert key. This method also trims the key parameters. * * @param key the subject matter expert key */ private void validateSubjectMatterExpertKey(SubjectMatterExpertKey key) { Assert.notNull(key, "A subject matter expert key must be specified."); key.setUserId(alternateKeyHelper.validateStringParameter("user id", key.getUserId())); } }
/** * Validates the search index create request. This method also trims request parameters. * * @param request the request * * @throws IllegalArgumentException if any validation errors were found */ private void validateSearchIndexCreateRequest(SearchIndexCreateRequest request) throws IllegalArgumentException { Assert.notNull(request, "A search index create request must be specified."); request.setSearchIndexType(alternateKeyHelper.validateStringParameter("Search index type", request.getSearchIndexType())); }
/** * Validates a security role key. This method also trims the key parameters. * * @param securityRoleKey the security role key */ public void validateAndTrimSecurityRoleKey(SecurityRoleKey securityRoleKey) { Assert.notNull(securityRoleKey, "A security role key must be specified."); securityRoleKey.setSecurityRoleName(alternateKeyHelper.validateStringParameter("security role name", securityRoleKey.getSecurityRoleName())); } }
/** * Validates an index search result type key. This method also trims the key parameters. * * @param indexSearchResultTypeKey the specified index search result type key */ private void validateIndexSearchResultTypeKey(IndexSearchResultTypeKey indexSearchResultTypeKey) { indexSearchResultTypeKey.setIndexSearchResultType( alternateKeyHelper.validateStringParameter("An", "index search result type", indexSearchResultTypeKey.getIndexSearchResultType())); }
/** * Validates the namespace create request. This method also trims request parameters. * * @param request the request * * @throws IllegalArgumentException if any validation errors were found */ private void validateNamespaceCreateRequest(NamespaceCreateRequest request) { request.setNamespaceCode(alternateKeyHelper.validateStringParameter("namespace", request.getNamespaceCode())); }
/** * Validates the namespace create request. This method also trims request parameters. * * @param request the request * * @throws IllegalArgumentException if any validation errors were found */ private void validateNamespaceCreateRequest(NamespaceCreateRequest request) { request.setNamespaceCode(alternateKeyHelper.validateStringParameter("namespace", request.getNamespaceCode())); }
/** * Validates an index search result type key. This method also trims the key parameters. * * @param indexSearchResultTypeKey the specified index search result type key */ private void validateIndexSearchResultTypeKey(IndexSearchResultTypeKey indexSearchResultTypeKey) { indexSearchResultTypeKey.setIndexSearchResultType( alternateKeyHelper.validateStringParameter("An", "index search result type", indexSearchResultTypeKey.getIndexSearchResultType())); }
/** * Validates the data provider create request. This method also trims request parameters. * * @param request the request * * @throws IllegalArgumentException if any validation errors were found */ private void validateDataProviderCreateRequest(DataProviderCreateRequest request) throws IllegalArgumentException { request.setDataProviderName(alternateKeyHelper.validateStringParameter("data provider name", request.getDataProviderName())); }
/** * Validates the file type create request. This method also trims request parameters. * * @param request the request * * @throws IllegalArgumentException if any validation errors were found */ void validateFileTypeCreateRequest(FileTypeCreateRequest request) throws IllegalArgumentException { request.setFileTypeCode(alternateKeyHelper.validateStringParameter("file type code", request.getFileTypeCode())); }
/** * Validates the tag type update request. This method also trims the request parameters. * * @param request the tag type update request */ private void validateTagTypeUpdateRequest(TagTypeUpdateRequest request) { Assert.notNull(request, "A tag type update request must be specified."); request.setDisplayName(alternateKeyHelper.validateStringParameter("display name", request.getDisplayName())); Assert.notNull(request.getTagTypeOrder(), "A tag type order must be specified."); } }
/** * Validates storage key. This method also trims storage key parameters. * * @param storageKey the storage key */ private void validateAndTrimStorageKey(StorageKey storageKey) { storageKey.setStorageName(alternateKeyHelper.validateStringParameter("storage name", storageKey.getStorageName())); } }
/** * Validates the tag type create request. This method also trims the request parameters. * * @param request the tag type create request */ private void validateTagTypeCreateRequest(TagTypeCreateRequest request) { Assert.notNull(request, "A tag type create request must be specified."); tagTypeHelper.validateTagTypeKey(request.getTagTypeKey()); request.setDisplayName(alternateKeyHelper.validateStringParameter("display name", request.getDisplayName())); Assert.notNull(request.getTagTypeOrder(), "A tag type order must be specified."); }
@Test public void testCreateFileTypeAlreadyExists() { expectedException.expect(AlreadyExistsException.class); expectedException.expectMessage(String.format("Unable to create file type \"%s\" because it already exists.", FORMAT_FILE_TYPE_CODE)); when(fileTypeMockDao.getFileTypeByCode(FORMAT_FILE_TYPE_CODE)).thenReturn(FILE_TYPE_ENTITY); when(alternateKeyHelper.validateStringParameter(anyString(), anyString())).thenReturn(FORMAT_FILE_TYPE_CODE); fileTypeMockService.createFileType(FILE_TYPE_CREATE_REQUEST); }
@Test public void testDeleteExternalInterface() { when(externalInterfaceDaoHelper.getExternalInterfaceEntity(EXTERNAL_INTERFACE)).thenReturn(EXTERNAL_INTERFACE_ENTITY); when(alternateKeyHelper.validateStringParameter(anyString(), anyString(), anyString())).thenReturn(EXTERNAL_INTERFACE); ExternalInterface externalInterface = externalInterfaceService.deleteExternalInterface(EXTERNAL_INTERFACE_KEY); assertEquals(EXTERNAL_INTERFACE, externalInterface.getExternalInterfaceKey().getExternalInterfaceName()); verify(alternateKeyHelper).validateStringParameter("An", "external interface name", EXTERNAL_INTERFACE); verify(externalInterfaceDaoHelper).getExternalInterfaceEntity(EXTERNAL_INTERFACE); verify(externalInterfaceDao).delete(EXTERNAL_INTERFACE_ENTITY); verifyNoMoreInteractionsHelper(); }