本文整理汇总了Java中framework.commons.DataType类的典型用法代码示例。如果您正苦于以下问题:Java DataType类的具体用法?Java DataType怎么用?Java DataType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DataType类属于framework.commons包,在下文中一共展示了DataType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: changeGroupOrder
import framework.commons.DataType; //导入依赖的package包/类
/**
* Changes the display order of the group
*
* @param id the id of the group
* @param isDecrement true if the order is to be decremented, false instead
*/
public Result changeGroupOrder(Long id, Boolean isDecrement) {
CustomAttributeGroup group = CustomAttributeGroup.getById(id);
CustomAttributeGroup groupToReverse = isDecrement ? group.previous() : group.next();
if (groupToReverse != null) {
Integer newOrder = groupToReverse.order;
groupToReverse.order = group.order;
groupToReverse.save();
group.order = newOrder;
group.save();
}
this.getTableProvider().flushFilterConfig();
this.getTableProvider().flushTables();
DataType dataType = DataType.getDataTypeFromClassName(group.objectType);
return redirect(controllers.admin.routes.ConfigurationCustomAttributeController.groups(dataType != null ? dataType.getDataName() : null));
}
示例2: savePluginLog
import framework.commons.DataType; //导入依赖的package包/类
/**
* Creates a plugin log on a specific event associated with the plugin
*
* @param transactionId
* the unique Id for the transaction
* @param pluginConfigurationId
* the unique identifier for the plugin configuration
* @param isError
* true if the log is an error
* @param event
* the type of event
* @param logMessage
* the error message
* @param dataType
* an internal BizDock data type
* @param internalId
* the Id of internal BizDock object to which the transaction is
* associated
* @param externalId
* the Id of the external (third party system) plugin to which
* the transaction is associated
*/
private static void savePluginLog(String transactionId, Long pluginConfigurationId, boolean isError, String event, String logMessage, DataType dataType,
Long internalId, String externalId) {
try {
String sql = "insert into plugin_log (transaction_id, plugin_configuration_id, "
+ "event, is_error, log_message, last_update, data_type, internal_id, external_id)"
+ " values(:transaction_id,:pluginConfigurationId,:event,:is_error,"
+ ":log_message, :last_update, :data_type, :internal_id, :external_id)";
SqlUpdate update = Ebean.createSqlUpdate(sql);
update.setParameter("transaction_id", transactionId);
update.setParameter("pluginConfigurationId", pluginConfigurationId);
update.setParameter("event", event);
update.setParameter("is_error", isError);
update.setParameter("log_message", logMessage != null ? logMessage.replace("\n", "<br/>") : null);
update.setParameter("last_update", new Date());
update.setParameter("data_type", dataType != null ? dataType.getDataTypeClassName() : null);
update.setParameter("internal_id", internalId);
update.setParameter("external_id", externalId);
update.execute();
} catch (Exception e) {
log.warn("Unexpected exception", e);
}
}
示例3: getConditionalRuleAuthorizedFields
import framework.commons.DataType; //导入依赖的package包/类
/**
* Get all authorized fields for conditional rules depending of an object
* type.
*
* @param objectType
* the object type
* @param currentUuid
* the uuid of the custom attribute wished to add a conditional
* rule (in order to exclude it from the list)
*/
public static Map<String, String> getConditionalRuleAuthorizedFields(Class<?> objectType, String currentUuid) {
DataType dataType = DataType.getDataTypeFromClassName(objectType.getName());
Map<String, String> authorizedFields = new LinkedHashMap<>();
for (Map.Entry<String, String> entry : dataType.getConditionalRuleAuthorizedFields().entrySet()) {
authorizedFields.put(entry.getKey(), entry.getValue());
}
List<CustomAttributeDefinition> customAttributeDefinitions = CustomAttributeDefinition.getOrderedCustomAttributeDefinitions(objectType);
for (CustomAttributeDefinition customAttributeDefinition : customAttributeDefinitions) {
if ((currentUuid == null || !customAttributeDefinition.uuid.equals(currentUuid))
&& customAttributeDefinition.isAuthorizedAttributeTypeForDependingFieldInConditionalRule()) {
authorizedFields.put(customAttributeDefinition.uuid, customAttributeDefinition.name);
}
}
return authorizedFields;
}
示例4: resync
import framework.commons.DataType; //导入依赖的package包/类
@Override
public void resync(String uid) throws AccountManagementException {
invalidateUserAccountCache(uid);
// Check that the user exists
if (!isUserIdExists(uid)) {
String message = String.format("Unable to resync user %s, this one does not exists in the user database", uid);
log.error(message);
throw new AccountManagementException(message);
}
Principal principal = findPrincipalFromUid(uid);
// Notify the MAF modules for resync
UserEventMessage eventMessage = new UserEventMessage(principal.id, DataType.getDataType(IFrameworkConstants.User),
UserEventMessage.MessageType.RESYNC);
postToPlugginManagerService(eventMessage);
}
示例5: updateBasicUserData
import framework.commons.DataType; //导入依赖的package包/类
@Override
public void updateBasicUserData(String uid, String firstName, String lastName) throws AccountManagementException {
if (log.isDebugEnabled()) {
log.debug("Updating the user basic data for account uid " + uid + " with " + firstName + " " + lastName);
}
invalidateUserAccountCache(uid);
getAuthenticationAccountWriterPlugin().updateUserProfile(uid, firstName, lastName, null);
Principal principal = findPrincipalFromUid(uid);
// Notify the MAF modules
UserEventMessage eventMessage = new UserEventMessage(principal.id, DataType.getDataType(IFrameworkConstants.User),
UserEventMessage.MessageType.OBJECT_UPDATED);
postToPlugginManagerService(eventMessage);
log.info(String.format("User basic data updated with uid %s", uid));
}
示例6: updatePreferredLanguage
import framework.commons.DataType; //导入依赖的package包/类
@Override
public void updatePreferredLanguage(String uid, String preferredLanguage) throws AccountManagementException {
if (log.isDebugEnabled()) {
log.debug("Changing the user preferred language for account uid " + uid + " with " + preferredLanguage);
}
invalidateUserAccountCache(uid);
Principal userPrincipal = findPrincipalAndCheckForAuthenticationBackEndConsistency(uid);
userPrincipal.preferredLanguage = preferredLanguage;
userPrincipal.save();
// Notify the MAF modules
UserEventMessage eventMessage = new UserEventMessage(userPrincipal.id, DataType.getDataType(IFrameworkConstants.User),
UserEventMessage.MessageType.OBJECT_UPDATED);
postToPlugginManagerService(eventMessage);
log.info(String.format("User preferred language updated with uid %s and preferred language %s", uid, preferredLanguage));
}
示例7: updateUserAccountType
import framework.commons.DataType; //导入依赖的package包/类
@Override
public void updateUserAccountType(String uid, AccountType accountType) throws AccountManagementException {
if (log.isDebugEnabled()) {
log.debug("Changing the user account type for account uid " + uid + " with account type " + accountType);
}
invalidateUserAccountCache(uid);
Principal userPrincipal = findPrincipalAndCheckForAuthenticationBackEndConsistency(uid);
userPrincipal.accountType = accountType.name();
userPrincipal.removeAllSystemLevelRoles();
addingRolesToPrincipalForAccountType(userPrincipal, accountType, null);
userPrincipal.save();
// Notify the MAF modules
UserEventMessage eventMessage = new UserEventMessage(userPrincipal.id, DataType.getDataType(IFrameworkConstants.User),
UserEventMessage.MessageType.OBJECT_UPDATED);
postToPlugginManagerService(eventMessage);
log.info(String.format("User account type updated with uid %s and account type %s", uid, accountType.name()));
}
示例8: updateMail
import framework.commons.DataType; //导入依赖的package包/类
@Override
public void updateMail(String uid, String mail) throws AccountManagementException {
if (log.isDebugEnabled()) {
log.debug("Changing the mail for account uid " + uid + " with mail " + mail);
}
invalidateUserAccountCache(uid);
getAuthenticationAccountWriterPlugin().updateUserProfile(uid, null, null, mail);
if (log.isDebugEnabled()) {
log.debug("User profile in backend updated for " + uid + " with mail " + mail);
}
// Notify the MAF modules
Principal principal = findPrincipalFromUid(uid);
UserEventMessage eventMessage = new UserEventMessage(principal.id, DataType.getDataType(IFrameworkConstants.User),
UserEventMessage.MessageType.OBJECT_UPDATED);
postToPlugginManagerService(eventMessage);
log.info(String.format("User mail updated for user %s with %s", uid, mail));
}
示例9: addSystemLevelRoleType
import framework.commons.DataType; //导入依赖的package包/类
@Override
public void addSystemLevelRoleType(String uid, String systemLevelRoleTypeName) throws AccountManagementException {
if (log.isDebugEnabled()) {
log.debug("Adding role " + systemLevelRoleTypeName + " for user account with uid " + uid);
}
invalidateUserAccountCache(uid);
Principal userPrincipal = findPrincipalAndCheckForAuthenticationBackEndConsistency(uid);
if (!userPrincipal.getAccountTypeAsObject().isRolesEditable())
return;
userPrincipal.addSystemLevelRole(getAllRoles().get(systemLevelRoleTypeName));
// Notify the MAF modules
UserEventMessage eventMessage = new UserEventMessage(userPrincipal.id, DataType.getDataType(IFrameworkConstants.User),
UserEventMessage.MessageType.OBJECT_UPDATED);
postToPlugginManagerService(eventMessage);
log.info(String.format("Group %s added for uid %s", systemLevelRoleTypeName, uid));
}
示例10: removeSystemLevelRoleType
import framework.commons.DataType; //导入依赖的package包/类
@Override
public void removeSystemLevelRoleType(String uid, String systemLevelRoleTypeName) throws AccountManagementException {
if (log.isDebugEnabled()) {
log.debug("Removing role " + systemLevelRoleTypeName + " for user account with uid " + uid);
}
invalidateUserAccountCache(uid);
Principal userPrincipal = findPrincipalAndCheckForAuthenticationBackEndConsistency(uid);
if (!userPrincipal.getAccountTypeAsObject().isRolesEditable())
return;
userPrincipal.removeSystemLevelRole(getAllRoles().get(systemLevelRoleTypeName));
// Notify the MAF modules
UserEventMessage eventMessage = new UserEventMessage(userPrincipal.id, DataType.getDataType(IFrameworkConstants.User),
UserEventMessage.MessageType.OBJECT_UPDATED);
postToPlugginManagerService(eventMessage);
log.info(String.format("Group %s removed for uid %s", systemLevelRoleTypeName, uid));
}
示例11: CustomAttributeGroupListView
import framework.commons.DataType; //导入依赖的package包/类
public CustomAttributeGroupListView(CustomAttributeGroup group) {
this.id = group.id;
this.name = group.getName();
this.label = group.label;
DataType dataType = DataType.getDataTypeFromClassName(group.objectType);
this.dataTypeName = dataType != null ? dataType.getDataName() : null;
}
示例12: list
import framework.commons.DataType; //导入依赖的package包/类
/**
* Display the list of custom attributes for a data type. It's possible to
* switch to another data type.
*
* @param dataTypeName
* the name of the selected data type
*/
public Result list(String dataTypeName) {
DataType dataType = DataType.getDataType(dataTypeName);
if (dataType == null || !dataType.isCustomAttribute()) {
return forbidden(views.html.error.access_forbidden.render(""));
}
// construct the form to switch the data type
Form<DataTypeForm> dataTypeForm = dataTypeFormTemplate.fill(new DataTypeForm(dataType));
// construct the table
List<CustomAttributeDefinition> customAttributeDefinitions = null;
try {
customAttributeDefinitions = CustomAttributeDefinition.getOrderedCustomAttributeDefinitions(Class.forName(dataType.getDataTypeClassName()));
} catch (Exception e) {
return ControllersUtils.logAndReturnUnexpectedError(e, log, getConfiguration(), getI18nMessagesPlugin());
}
List<CustomAttributeListView> customAttributeListView = new ArrayList<CustomAttributeListView>();
for (CustomAttributeDefinition customAttributeDefinition : customAttributeDefinitions) {
customAttributeListView.add(new CustomAttributeListView(customAttributeDefinition));
}
Table<CustomAttributeListView> customAttributesTable = this.getTableProvider().get().customAttribute.templateTable.fill(customAttributeListView);
return ok(views.html.admin.config.customattribute.list.render(dataType, dataTypeForm, customAttributesTable));
}
示例13: getRegistrationConfiguration
import framework.commons.DataType; //导入依赖的package包/类
@Override
public byte[] getRegistrationConfiguration(DataType dataType, Long objectId) {
PluginRegistration pluginRegistration = PluginRegistration.getPluginRegistration(getPluginConfigurationId(), dataType, objectId);
if (pluginRegistration == null) {
return null;
}
return pluginRegistration.configurationProperties;
}
示例14: changeOrder
import framework.commons.DataType; //导入依赖的package包/类
/**
* Change the order of a custom attribute (for an object type).
*
* @param id
* the custom attribute definition id
* @param isDecrement
* if true then we decrement the order, else we increment it.
*/
public Result changeOrder(Long id, Boolean isDecrement) {
CustomAttributeDefinition customAttribute = CustomAttributeDefinition.getCustomAttributeDefinitionFromId(id);
CustomAttributeDefinition customAttributeToReverse = null;
try {
if (isDecrement) {
customAttributeToReverse = CustomAttributeDefinition.getPrevious(Class.forName(customAttribute.objectType), customAttribute.order);
} else {
customAttributeToReverse = CustomAttributeDefinition.getNext(Class.forName(customAttribute.objectType), customAttribute.order);
}
} catch (Exception e) {
return ControllersUtils.logAndReturnUnexpectedError(e, log, getConfiguration(), getI18nMessagesPlugin());
}
if (customAttributeToReverse != null) {
Integer newOrder = customAttributeToReverse.order;
customAttributeToReverse.order = customAttribute.order;
customAttributeToReverse.save();
customAttribute.order = newOrder;
customAttribute.save();
}
this.getTableProvider().flushFilterConfig();
this.getTableProvider().flushTables();
DataType dataType = DataType.getDataTypeFromClassName(customAttribute.objectType);
return redirect(controllers.admin.routes.ConfigurationCustomAttributeController.list(dataType.getDataName()));
}
示例15: manage
import framework.commons.DataType; //导入依赖的package包/类
/**
* Form to create/edit a custom attribute.
*
* @param objectType
* the object type (full qualified class name)
* @param id
* the custom attribute definition id (0 for create case)
*/
public Result manage(String objectType, Long id) {
DataType dataType = DataType.getDataTypeFromClassName(objectType);
if (dataType == null || !dataType.isCustomAttribute()) {
return forbidden(views.html.error.access_forbidden.render(""));
}
Form<CustomAttributeDefinitionFormData> customAttributeForm;
String uuid = null;
boolean canAddConditionalRule = true;
// edit case: inject values
if (!id.equals(0L)) {
CustomAttributeDefinition customAttribute = CustomAttributeDefinition.getCustomAttributeDefinitionFromId(id);
uuid = customAttribute.uuid;
canAddConditionalRule = customAttribute.isAuthorizedAttributeTypeForConditionalRule();
customAttributeForm = customAttributeFormTemplate.fill(new CustomAttributeDefinitionFormData(customAttribute, getI18nMessagesPlugin()));
} else {
customAttributeForm = customAttributeFormTemplate.fill(new CustomAttributeDefinitionFormData(objectType));
}
try {
return ok(views.html.admin.config.customattribute.manage.render(dataType, customAttributeForm, canAddConditionalRule,
CustomAttributeDefinition.getConditionalRuleAuthorizedFields(Class.forName(objectType), uuid)));
} catch (ClassNotFoundException e) {
return ControllersUtils.logAndReturnUnexpectedError(e, log, getConfiguration(), getI18nMessagesPlugin());
}
}