use of com.agiletec.aps.system.services.category.CategoryUtilizer in project entando-core by entando.
the class TestUtilizer method testGetCategoryUtilizers.
public void testGetCategoryUtilizers() throws Throwable {
String[] names = this.getApplicationContext().getBeanNamesForType(CategoryUtilizer.class);
assertTrue(names.length >= 2);
for (int i = 0; i < names.length; i++) {
CategoryUtilizer service = (CategoryUtilizer) this.getApplicationContext().getBean(names[i]);
List utilizers = service.getCategoryUtilizers("evento");
if (names[i].equals("DataTypeManager")) {
assertTrue(utilizers.size() == 2);
}
}
}
use of com.agiletec.aps.system.services.category.CategoryUtilizer in project entando-core by entando.
the class CategoryActionHelper method getReferencingObjectsForMove.
@Override
public Map getReferencingObjectsForMove(Category category, HttpServletRequest request) throws ApsSystemException {
Map<String, List> references = new HashMap<String, List>();
try {
String[] defNames = ApsWebApplicationUtils.getWebApplicationContext(request).getBeanNamesForType(CategoryUtilizer.class);
for (int i = 0; i < defNames.length; i++) {
Object service = null;
try {
service = ApsWebApplicationUtils.getWebApplicationContext(request).getBean(defNames[i]);
} catch (Throwable t) {
_logger.error("error checking Referencing Objects", t);
service = null;
}
if (service != null) {
CategoryUtilizer categoryUtilizer = (CategoryUtilizer) service;
List utilizers = categoryUtilizer.getCategoryUtilizersForReloadReferences(category.getCode());
if (utilizers != null && !utilizers.isEmpty()) {
references.put(categoryUtilizer.getName() + "Utilizers", utilizers);
}
}
}
} catch (Throwable t) {
throw new ApsSystemException("Error in getReferencingObjectsForMove", t);
}
return references;
}
use of com.agiletec.aps.system.services.category.CategoryUtilizer in project entando-core by entando.
the class CategoryActionHelper method getReferencingObjects.
@Override
public Map getReferencingObjects(Category category, HttpServletRequest request) throws ApsSystemException {
Map<String, List> references = new HashMap<String, List>();
try {
String[] defNames = ApsWebApplicationUtils.getWebApplicationContext(request).getBeanNamesForType(CategoryUtilizer.class);
for (int i = 0; i < defNames.length; i++) {
Object service = null;
try {
service = ApsWebApplicationUtils.getWebApplicationContext(request).getBean(defNames[i]);
} catch (Throwable t) {
_logger.error("error checking Referencing Objects", t);
service = null;
}
if (service != null) {
CategoryUtilizer categoryUtilizer = (CategoryUtilizer) service;
List utilizers = categoryUtilizer.getCategoryUtilizers(category.getCode());
if (utilizers != null && !utilizers.isEmpty()) {
references.put(categoryUtilizer.getName() + "Utilizers", utilizers);
}
}
}
} catch (Throwable t) {
throw new ApsSystemException("Errore in hasReferencingObjects", t);
}
return references;
}
Aggregations