use of org.jaffa.security.businessfunctionsdomain.BusinessFunction in project jaffa-framework by jaffa-projects.
the class BusinessFunctionXmlLoadTest method testGetBusinessFunctionRegistration.
/**
* Verifies that we can register and unregister specific business functions provided by the client.
*/
@Test
public void testGetBusinessFunctionRegistration() {
BusinessFunctionManager businessFunctionManager = xmlLoaderConfig.getBean(BusinessFunctionManager.class);
assertNull(businessFunctionManager.getBusinessFunction("Jaffa.WebServices.Test"));
BusinessFunction businessFunction = new BusinessFunction();
ContextKey key = new ContextKey("Jaffa.WebServices.Test", "business-functions.xml", VariationContext.NULL_VARIATION, "100-Highest");
businessFunctionManager.registerBusinessFunction(key, businessFunction);
assertNotNull(businessFunctionManager.getBusinessFunction("Jaffa.WebServices.Test"));
businessFunctionManager.unregisterBusinessFunction(key);
assertNull(businessFunctionManager.getBusinessFunction("Jaffa.WebServices.Test"));
}
use of org.jaffa.security.businessfunctionsdomain.BusinessFunction in project jaffa-framework by jaffa-projects.
the class BusinessFunctionManager method unregisterResource.
/**
* unregisterResource - Unregisters the roles from the business function repository using a business-functions.xml file.
* @param resource the object that contains the xml config file.
* @param context key with which config file to be registered.
* @throws JAXBException
* @throws SAXException
* @throws IOException
*/
@Override
public void unregisterResource(Resource resource, String context, String variation) throws JAXBException, SAXException, IOException {
BusinessFunctions businessFunctions = JAXBHelper.unmarshalConfigFile(BusinessFunctions.class, resource, CONFIGURATION_SCHEMA_FILE);
if (businessFunctions.getBusinessFunction() != null) {
for (final BusinessFunction businessFunction : businessFunctions.getBusinessFunction()) {
ContextKey contextKey = new ContextKey(businessFunction.getName(), resource.getURI().toString(), variation, context);
unregisterBusinessFunction(contextKey);
}
}
}
use of org.jaffa.security.businessfunctionsdomain.BusinessFunction in project jaffa-framework by jaffa-projects.
the class BusinessFunctionManager method registerResource.
/**
* registerResource - Registers the roles into the business function repository from a business-functions.xml file.
* @param resource the object that contains the xml config file.
* @param context key with which config file to be registered.
* @throws JAXBException
* @throws SAXException
* @throws IOException
*/
@Override
public void registerResource(Resource resource, String context, String variation) throws JAXBException, SAXException, IOException {
BusinessFunctions businessFunctions = JAXBHelper.unmarshalConfigFile(BusinessFunctions.class, resource, CONFIGURATION_SCHEMA_FILE);
if (businessFunctions.getBusinessFunction() != null) {
for (final BusinessFunction businessFunction : businessFunctions.getBusinessFunction()) {
ContextKey contextKey = new ContextKey(businessFunction.getName(), resource.getURI().toString(), variation, context);
registerBusinessFunction(contextKey, businessFunction);
}
}
}
use of org.jaffa.security.businessfunctionsdomain.BusinessFunction in project jaffa-framework by jaffa-projects.
the class BusinessFunctionManager method getAllBusinessFunctionsStrings.
/**
* getAllBusinessFunctionsStrings - Returns a list of all business functions as a list of strings.
* @return all business functions as Strings
*/
public List<String> getAllBusinessFunctionsStrings() {
List<BusinessFunction> businessFunctions = getAllBusinessFunctions();
List<String> businessFunctionStrings = new ArrayList<>();
for (BusinessFunction businessFunction : businessFunctions) {
businessFunctionStrings.add(businessFunction.getName());
}
return businessFunctionStrings;
}
Aggregations