当前位置: 首页>>代码示例>>Java>>正文


Java DataType.getDataTypeFromClassName方法代码示例

本文整理汇总了Java中framework.commons.DataType.getDataTypeFromClassName方法的典型用法代码示例。如果您正苦于以下问题:Java DataType.getDataTypeFromClassName方法的具体用法?Java DataType.getDataTypeFromClassName怎么用?Java DataType.getDataTypeFromClassName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在framework.commons.DataType的用法示例。


在下文中一共展示了DataType.getDataTypeFromClassName方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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));
}
 
开发者ID:theAgileFactory,项目名称:maf-desktop-app,代码行数:28,代码来源:ConfigurationCustomAttributeController.java

示例2: deleteGroup

import framework.commons.DataType; //导入方法依赖的package包/类
/**
 * Delete a {@link CustomAttributeGroup}
 *
 * Deleting a group is not possible if some {@link CustomAttributeDefinition} still belong to that group <br />
 * or if it is the last group of its type.
 *
 * @param id the id of the custom attribute group
 */
public Result deleteGroup(Long id) {

    CustomAttributeGroup group = CustomAttributeGroup.getById(id);
    List<CustomAttributeGroup> groups = CustomAttributeGroup.getOrderedCustomAttributeGroupsByObjectType(group.objectType);
    DataType dataType = DataType.getDataTypeFromClassName(group.objectType);

    if (!group.customAttributeDefinitions.isEmpty()) {
        Utilities.sendErrorFlashMessage(Msg.get("admin.configuration.custom_attribute.group.delete.error.group_not_empty"));
    } else if (groups.size() == 1) {
        Utilities.sendErrorFlashMessage(Msg.get("admin.configuration.custom_attribute.group.delete.error.last_group"));
    } else {
        group.doDelete();
        Utilities.sendSuccessFlashMessage(Msg.get("admin.configuration.custom_attribute.group.delete.successful"));
    }

    this.getTableProvider().flushFilterConfig();
    this.getTableProvider().flushTables();

    return redirect(routes.ConfigurationCustomAttributeController.groups(dataType != null ? dataType.getDataName() : null));
}
 
开发者ID:theAgileFactory,项目名称:maf-desktop-app,代码行数:29,代码来源:ConfigurationCustomAttributeController.java

示例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;

}
 
开发者ID:theAgileFactory,项目名称:app-framework,代码行数:32,代码来源:CustomAttributeDefinition.java

示例4: 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;
}
 
开发者ID:theAgileFactory,项目名称:maf-desktop-app,代码行数:8,代码来源:CustomAttributeGroupListView.java

示例5: 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()));

}
 
开发者ID:theAgileFactory,项目名称:maf-desktop-app,代码行数:44,代码来源:ConfigurationCustomAttributeController.java

示例6: 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());
    }

}
 
开发者ID:theAgileFactory,项目名称:maf-desktop-app,代码行数:42,代码来源:ConfigurationCustomAttributeController.java

示例7: getSelectableValuesListForObjectClass

import framework.commons.DataType; //导入方法依赖的package包/类
/**
 * Return the values which can be "selected" in the picker for the field
 * objectClass.
 * 
 * @param currentObjectClass
 *            the class name of the current object
 * @param auditLoggerService
 *            the audit logger service
 */
public static ISelectableValueHolderCollection<String> getSelectableValuesListForObjectClass(String currentObjectClass,
        IAuditLoggerService auditLoggerService) {

    // Get all the selectable entities from the configuration
    ISelectableValueHolderCollection<String> selectableObjects = new DefaultSelectableValueHolderCollection<String>();

    DataType.getAllAuditableDataTypes()
            .stream()
            .filter(
                    // Filter out the previously selected entities
                    dataType -> auditLoggerService.getAllActiveAuditable()
                            .stream()
                            .map(auditable -> auditable.objectClass)
                            .anyMatch(auditable -> auditable.equals(dataType.getDataTypeClassName()))
            )
            .map(dataType -> new DefaultSelectableValueHolder<>(dataType.getDataTypeClassName(), Msg.get(dataType.getLabel())))
            .forEach(selectableObjects::add);

    // Add the current value if any (so that it could be displayed and
    // selected again)
    if (currentObjectClass != null && !StringUtils.isBlank(currentObjectClass)) {
        DataType dataTypeFromClassName = DataType.getDataTypeFromClassName(currentObjectClass);
        selectableObjects.add(
                new DefaultSelectableValueHolder<>(currentObjectClass, Msg.get(dataTypeFromClassName != null ? dataTypeFromClassName.getLabel() : "")));
    }
    return selectableObjects;
}
 
开发者ID:theAgileFactory,项目名称:maf-desktop-app,代码行数:37,代码来源:AuditableController.java

示例8: getConditionalRuleFieldIdForManagingForm

import framework.commons.DataType; //导入方法依赖的package包/类
/**
 * Get the conditional rule field id for a managing form (because it doesn't
 * exactly correspond to the field id when it is a depending custom
 * attribute).
 * 
 * Return null if there is no conditional rule or if the rule is not well
 * formated.
 */
public String getConditionalRuleFieldIdForManagingForm() {
    String fieldId = this.getConditionalRuleFieldId();
    if (fieldId != null) {
        DataType dataType = DataType.getDataTypeFromClassName(this.objectType);
        if (dataType.getConditionalRuleAuthorizedFields().containsKey(fieldId)) {
            return fieldId;
        } else {
            return ICustomAttributeManagerService.CUSTOM_ATTRIBUTE_FORM_FIELD_NAME_EXTENSION + fieldId;
        }
    }
    return null;
}
 
开发者ID:theAgileFactory,项目名称:app-framework,代码行数:21,代码来源:CustomAttributeDefinition.java

示例9: getDistinctAttachmentsObjectTypes

import framework.commons.DataType; //导入方法依赖的package包/类
/**
 * Returns the list of distinct object types linked to the attachments.
 * The returned value is a {@link ISelectableValueHolderCollection} which:
 * <ul>
 * <li>value = the object type name</li>
 * <li>name = the corresponding label taken from the {@link DataType}</li>
 * </ul>
 */
public static ISelectableValueHolderCollection<String> getDistinctAttachmentsObjectTypes() {
    DefaultSelectableValueHolderCollection<String> collection = new DefaultSelectableValueHolderCollection<>();

    List<Attachment> attachments = new Finder<>(Attachment.class).select("objectType").setDistinct(true).findList();
    for (Attachment attachment : attachments) {
    	DataType dt=DataType.getDataTypeFromClassName(attachment.objectType);
    	if(dt!=null){
    		collection.add(new DefaultSelectableValueHolder<>(attachment.objectType, dt.getLabel()));
    	}
    }

    return collection;
}
 
开发者ID:theAgileFactory,项目名称:app-framework,代码行数:22,代码来源:Attachment.java

示例10: postInsert

import framework.commons.DataType; //导入方法依赖的package包/类
@Override
public void postInsert(Object bean) {
    if (log.isDebugEnabled()) {
        log.debug("post Insert for " + bean);
    }
    if (bean != null) {
        DataType dataType = DataType.getDataTypeFromClassName(bean.getClass().getName());
        long id = getIdFromBean(bean);
        if (dataType != null && id != -1) {
            postOutMessage(new EventMessage(getIdFromBean(bean), dataType, MessageType.OBJECT_CREATED));
        }
    }
}
 
开发者ID:theAgileFactory,项目名称:app-framework,代码行数:14,代码来源:PluginManagerServiceImpl.java

示例11: postDelete

import framework.commons.DataType; //导入方法依赖的package包/类
@Override
public void postDelete(Object bean) {
    if (log.isDebugEnabled()) {
        log.debug("post Delete for " + bean);
    }
    if (bean != null) {
        DataType dataType = DataType.getDataTypeFromClassName(bean.getClass().getName());
        long id = getIdFromBean(bean);
        if (dataType != null && id != -1) {
            postOutMessage(new EventMessage(getIdFromBean(bean), dataType, MessageType.OBJECT_DELETED));
        }
    }
}
 
开发者ID:theAgileFactory,项目名称:app-framework,代码行数:14,代码来源:PluginManagerServiceImpl.java

示例12: delete

import framework.commons.DataType; //导入方法依赖的package包/类
/**
 * Delete a custom attribute.
 * 
 * @param id
 *            the custom attribute definition id
 */
public Result delete(Long id) {

    CustomAttributeDefinition customAttribute = CustomAttributeDefinition.getCustomAttributeDefinitionFromId(id);

    // check attribute type is authorized
    if (unauthorizedAttributeTypes.contains(customAttribute.attributeType)) {
        return forbidden(views.html.error.access_forbidden.render(""));
    }

    customAttribute.doDelete();

    Utilities.sendSuccessFlashMessage(Msg.get("admin.configuration.custom_attribute.delete.successful"));

    this.getTableProvider().flushFilterConfig();
    this.getTableProvider().flushTables();

    DataType dataType = DataType.getDataTypeFromClassName(customAttribute.objectType);

    return redirect(controllers.admin.routes.ConfigurationCustomAttributeController.list(dataType.getDataName()));
}
 
开发者ID:theAgileFactory,项目名称:maf-desktop-app,代码行数:27,代码来源:ConfigurationCustomAttributeController.java

示例13: changeDataType

import framework.commons.DataType; //导入方法依赖的package包/类
/**
 * Switch to another data type for the custom attributes' list.
 */
public Result changeDataType() {

    Form<DataTypeForm> boundForm = dataTypeFormTemplate.bindFromRequest();

    DataTypeForm dataTypeForm = boundForm.get();

    DataType dataType = DataType.getDataTypeFromClassName(dataTypeForm.dataTypeClassName);

    return redirect(controllers.admin.routes.ConfigurationCustomAttributeController.list(dataType.getDataName()));
}
 
开发者ID:theAgileFactory,项目名称:maf-desktop-app,代码行数:14,代码来源:ConfigurationCustomAttributeController.java

示例14: processManageGroup

import framework.commons.DataType; //导入方法依赖的package包/类
/**
 * Process the form for creating or editing a group
 */
public Result processManageGroup() {

    Form<CustomAttributeGroupFormData> form = groupFormTemplate.bindFromRequest();
    CustomAttributeGroupFormData formData = form.get();

    DataType dataType = DataType.getDataTypeFromClassName(formData.objectType);

    if (form.hasErrors()) {
        return ok(views.html.admin.config.customattribute.group_manage.render(dataType, form));
    }


    CustomAttributeGroup group;

    if (formData.id == null) {
        group = new CustomAttributeGroup();
        group.order = CustomAttributeGroup.getLastOrder(formData.objectType) + 1;
        formData.fill(group);
        group.save();

        Utilities.sendSuccessFlashMessage(Msg.get("admin.configuration.custom_attribute.group.add.successful"));
    } else {

        group = CustomAttributeGroup.getById(formData.id);

        formData.fill(group);
        group.update();

        Utilities.sendSuccessFlashMessage(Msg.get("admin.configuration.custom_attribute.group.edit.successful"));
    }

    formData.label.persist(getI18nMessagesPlugin());

    this.getTableProvider().flushFilterConfig();
    this.getTableProvider().flushTables();

    return redirect(routes.ConfigurationCustomAttributeController.groups(dataType != null ? dataType.getDataName() : null));
}
 
开发者ID:theAgileFactory,项目名称:maf-desktop-app,代码行数:42,代码来源:ConfigurationCustomAttributeController.java


注:本文中的framework.commons.DataType.getDataTypeFromClassName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。