use of com.agiletec.aps.system.services.keygenerator.IKeyGeneratorManager in project entando-core by entando.
the class ResourceManager method generateAndSetResourceId.
protected void generateAndSetResourceId(ResourceInterface resource, String id) throws ApsSystemException {
if (null == id || id.trim().length() == 0) {
IKeyGeneratorManager keyGenerator = (IKeyGeneratorManager) this.getBeanFactory().getBean(SystemConstants.KEY_GENERATOR_MANAGER);
int newId = keyGenerator.getUniqueKeyCurrentValue();
resource.setId(String.valueOf(newId));
}
}
use of com.agiletec.aps.system.services.keygenerator.IKeyGeneratorManager in project entando-core by entando.
the class DataObjectManager method addUpdateDataObject.
private void addUpdateDataObject(DataObject dataobject, boolean updateDate) throws ApsSystemException {
try {
dataobject.setLastModified(new Date());
if (updateDate) {
dataobject.incrementVersion(false);
}
String status = dataobject.getStatus();
if (null == status) {
dataobject.setStatus(DataObject.STATUS_DRAFT);
} else if (status.equals(DataObject.STATUS_PUBLIC)) {
dataobject.setStatus(DataObject.STATUS_READY);
}
if (null == dataobject.getId()) {
IKeyGeneratorManager keyGenerator = (IKeyGeneratorManager) this.getService(SystemConstants.KEY_GENERATOR_MANAGER);
int key = keyGenerator.getUniqueKeyCurrentValue();
String id = dataobject.getTypeCode() + key;
dataobject.setId(id);
this.getDataObjectDAO().addEntity(dataobject);
} else {
this.getDataObjectDAO().updateDataObject(dataobject, updateDate);
}
} catch (Throwable t) {
logger.error("Error while saving dataobject", t);
throw new ApsSystemException("Error while saving dataobject", t);
}
}
use of com.agiletec.aps.system.services.keygenerator.IKeyGeneratorManager in project entando-core by entando.
the class ContentManager method addUpdateContent.
private void addUpdateContent(Content content, boolean updateDate) throws ApsSystemException {
try {
content.setLastModified(new Date());
if (updateDate) {
content.incrementVersion(false);
}
String status = content.getStatus();
if (null == status) {
content.setStatus(Content.STATUS_DRAFT);
} else if (status.equals(Content.STATUS_PUBLIC)) {
content.setStatus(Content.STATUS_READY);
}
if (null == content.getId()) {
IKeyGeneratorManager keyGenerator = (IKeyGeneratorManager) this.getService(SystemConstants.KEY_GENERATOR_MANAGER);
int key = keyGenerator.getUniqueKeyCurrentValue();
String id = content.getTypeCode() + key;
content.setId(id);
this.getContentDAO().addEntity(content);
} else {
this.getContentDAO().updateContent(content, updateDate);
}
} catch (Throwable t) {
_logger.error("Error while saving content", t);
throw new ApsSystemException("Error while saving content", t);
}
}
use of com.agiletec.aps.system.services.keygenerator.IKeyGeneratorManager in project entando-core by entando.
the class TestApplicationContext method testGetServices.
public void testGetServices() {
ConfigInterface configManager = (ConfigInterface) this.getService(SystemConstants.BASE_CONFIG_MANAGER);
assertNotNull(configManager);
ICacheInfoManager cacheInfoManager = (ICacheInfoManager) this.getService(SystemConstants.CACHE_INFO_MANAGER);
assertNotNull(cacheInfoManager);
ILangManager langManager = (ILangManager) this.getService(SystemConstants.LANGUAGE_MANAGER);
assertNotNull(langManager);
IWidgetTypeManager showletTypeManager = (IWidgetTypeManager) this.getService(SystemConstants.WIDGET_TYPE_MANAGER);
assertNotNull(showletTypeManager);
IPageModelManager pageModelManager = (IPageModelManager) this.getService(SystemConstants.PAGE_MODEL_MANAGER);
assertNotNull(pageModelManager);
IPageManager pageManager = (IPageManager) this.getService(SystemConstants.PAGE_MANAGER);
assertNotNull(pageManager);
IRoleManager roleManager = (IRoleManager) this.getService(SystemConstants.ROLE_MANAGER);
assertNotNull(roleManager);
IUserManager userManager = (IUserManager) this.getService(SystemConstants.USER_MANAGER);
assertNotNull(userManager);
IURLManager urlManager = (IURLManager) this.getService(SystemConstants.URL_MANAGER);
assertNotNull(urlManager);
II18nManager i18nManager = (II18nManager) this.getService(SystemConstants.I18N_MANAGER);
assertNotNull(i18nManager);
// ControllerManager controller = (ControllerManager) this.getService(SystemConstants.CONTROLLER_MANAGER);
// assertNotNull(controller);
IKeyGeneratorManager keyGeneratorManager = (IKeyGeneratorManager) this.getService(SystemConstants.KEY_GENERATOR_MANAGER);
assertNotNull(keyGeneratorManager);
ICategoryManager categoryManager = (ICategoryManager) this.getService(SystemConstants.CATEGORY_MANAGER);
assertNotNull(categoryManager);
}
Aggregations