use of com.agiletec.aps.system.services.group.GroupUtilizer in project entando-core by entando.
the class GroupService method getReferencesInfo.
public Map<String, Boolean> getReferencesInfo(Group group) {
Map<String, Boolean> references = new HashMap<String, Boolean>();
try {
String[] defNames = applicationContext.getBeanNamesForType(GroupUtilizer.class);
for (int i = 0; i < defNames.length; i++) {
Object service = null;
try {
service = applicationContext.getBean(defNames[i]);
} catch (Throwable t) {
logger.error("error in hasReferencingObjects", t);
service = null;
}
if (service != null) {
GroupUtilizer<?> groupUtilizer = (GroupUtilizer<?>) service;
List<?> utilizers = groupUtilizer.getGroupUtilizers(group.getName());
if (utilizers != null && !utilizers.isEmpty()) {
references.put(groupUtilizer.getName(), true);
} else {
references.put(groupUtilizer.getName(), false);
}
}
}
} catch (ApsSystemException ex) {
logger.error("error loading references for group {}", group.getName(), ex);
throw new RestServerError("error in getReferencingObjects ", ex);
}
return references;
}
use of com.agiletec.aps.system.services.group.GroupUtilizer in project entando-core by entando.
the class TestGroupUtilizer method testGetGroupsUtilizers.
public void testGetGroupsUtilizers() throws Throwable {
String[] names = this.getApplicationContext().getBeanNamesForType(GroupUtilizer.class);
assertTrue(names.length >= 4);
for (int i = 0; i < names.length; i++) {
GroupUtilizer service = (GroupUtilizer) this.getApplicationContext().getBean(names[i]);
List utilizers = service.getGroupUtilizers("coach");
if (names[i].equals(JacmsSystemConstants.CONTENT_MANAGER)) {
assertEquals(6, utilizers.size());
} else if (names[i].equals(JacmsSystemConstants.RESOURCE_MANAGER)) {
assertEquals(0, utilizers.size());
}
}
}
use of com.agiletec.aps.system.services.group.GroupUtilizer in project entando-core by entando.
the class GroupActionHelper method getReferencingObjects.
@Override
public Map<String, List<Object>> getReferencingObjects(Group group, HttpServletRequest request) throws ApsSystemException {
Map<String, List<Object>> references = new HashMap<String, List<Object>>();
try {
String[] defNames = ApsWebApplicationUtils.getWebApplicationContext(request).getBeanNamesForType(GroupUtilizer.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 in hasReferencingObjects", t);
// ApsSystemUtils.logThrowable(t, this, "hasReferencingObjects");
service = null;
}
if (service != null) {
GroupUtilizer groupUtilizer = (GroupUtilizer) service;
List<Object> utilizers = groupUtilizer.getGroupUtilizers(group.getName());
if (utilizers != null && !utilizers.isEmpty()) {
// FIXME UNIFORMARE E STUDIARE CHIAVE IDONEA
references.put(groupUtilizer.getName() + "Utilizers", utilizers);
}
}
}
} catch (Throwable t) {
throw new ApsSystemException("Errore in getReferencingObjects", t);
}
return references;
}
use of com.agiletec.aps.system.services.group.GroupUtilizer in project entando-core by entando.
the class TestUtilizer method testGetGroupsUtilizers.
public void testGetGroupsUtilizers() throws Throwable {
String[] names = this.getApplicationContext().getBeanNamesForType(GroupUtilizer.class);
assertTrue(names.length >= 4);
for (int i = 0; i < names.length; i++) {
GroupUtilizer service = (GroupUtilizer) this.getApplicationContext().getBean(names[i]);
List utilizers = service.getGroupUtilizers("coach");
if (names[i].equals("DataTypeManager")) {
assertEquals(6, utilizers.size());
}
}
}
use of com.agiletec.aps.system.services.group.GroupUtilizer in project entando-core by entando.
the class DataObjectService method getGroupUtilizer.
@Override
public List<DataObjectDto> getGroupUtilizer(String groupCode) {
try {
DataObjectManager entityManager = (DataObjectManager) this.extractEntityManager(this.getManagerName());
List<String> idList = ((GroupUtilizer<String>) entityManager).getGroupUtilizers(groupCode);
return this.buildDtoList(idList, entityManager);
} catch (ApsSystemException ex) {
logger.error("Error loading dataobject references for group {}", groupCode, ex);
throw new RestServerError("Error loading dataobject references for group", ex);
}
}
Aggregations