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


Java MdsEntity类代码示例

本文整理汇总了Java中org.motechproject.mds.domain.MdsEntity的典型用法代码示例。如果您正苦于以下问题:Java MdsEntity类的具体用法?Java MdsEntity怎么用?Java MdsEntity使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MdsEntity类属于org.motechproject.mds.domain包,在下文中一共展示了MdsEntity类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isClassPersistable

import org.motechproject.mds.domain.MdsEntity; //导入依赖的package包/类
@Override
protected AnnotationObject isClassPersistable(Class cls) {
    AnnotationObject annotationObject = super.isClassPersistable(cls);

    // if super does not recognize this object as PC, then try looking for the Entity annotation
    // only when FileMetadata has been already loaded
    if (annotationObject == null && ReflectionsUtil.hasAnnotation(cls, Entity.class) &&
             !ArrayUtils.isEmpty(mgr.getFileMetaData())) {
        // default params
        HashMap<String, Object> annotationParams = new HashMap<>();
        annotationParams.put("identityType", IdentityType.DATASTORE);

        Class superClass = cls.getSuperclass();
        while (superClass != null) {
            if (superClass == MdsEntity.class || superClass == MdsVersionedEntity.class) {
                annotationParams.put("identityType", IdentityType.APPLICATION);
            }
            superClass = superClass.getSuperclass();
        }

        annotationParams.put("detachable", Constants.Util.TRUE);

        // we fake a persistence capable annotation
        annotationObject = new AnnotationObject(PersistenceCapable.class.getName(), annotationParams);
    }

    return annotationObject;
}
 
开发者ID:motech,项目名称:motech,代码行数:29,代码来源:MdsJdoAnnotationReader.java

示例2: createEntity

import org.motechproject.mds.domain.MdsEntity; //导入依赖的package包/类
@Override
@Transactional
public EntityDto createEntity(EntityDto entityDto) {
    String packageName = ClassName.getPackage(entityDto.getClassName());
    boolean fromUI = StringUtils.isEmpty(packageName);
    String username = getUsername();

    if (fromUI) {
        String className;
        if (entityDto.getName().contains(" ")) {
            entityDto.setName(entityDto.getName().trim());
            StringBuilder stringBuilder = new StringBuilder();
            String[] nameParts = entityDto.getName().split(" ");
            for (String part : nameParts) {
                if (part.length() > 0) {
                    stringBuilder.append(Character.toUpperCase(part.charAt(0)));
                    if (part.length() > 1) {
                        stringBuilder.append(part.substring(1));
                    }
                }
            }
            className = String.format("%s.%s", Constants.PackagesGenerated.ENTITY, stringBuilder.toString());
        } else {
            // in this situation entity.getName() returns a simple name of class
            className = String.format("%s.%s", Constants.PackagesGenerated.ENTITY, entityDto.getName());
        }
        entityDto.setClassName(className);
    }

    if (allEntities.contains(entityDto.getClassName())) {
        throw new EntityAlreadyExistException(entityDto.getName());
    }

    Entity entity = allEntities.create(entityDto);

    LOGGER.debug("Adding default fields to the entity, since it doesn't extend MdsEntity or MdsVersionedEntity");
    if (!MdsEntity.class.getName().equalsIgnoreCase(entityDto.getSuperClass())
            && !MdsVersionedEntity.class.getName().equalsIgnoreCase(entityDto.getSuperClass())) {
        EntityHelper.addDefaultFields(entity, allTypes);
    }

    if (username != null) {
        allEntityAudits.createAudit(entity, username);
    }

    return entity.toDto();
}
 
开发者ID:motech,项目名称:motech,代码行数:48,代码来源:EntityServiceImpl.java

示例3: addDefaultFields

import org.motechproject.mds.domain.MdsEntity; //导入依赖的package包/类
private void addDefaultFields(EntityDto entity, Collection<FieldDto> fields) {
    if (!MdsEntity.class.getName().equalsIgnoreCase(entity.getSuperClass()) &&
            !MdsVersionedEntity.class.getName().equalsIgnoreCase(entity.getSuperClass())) {
        fields.addAll(EntityDefaultFieldsHelper.defaultFields(getSchemaHolder()));
    }
}
 
开发者ID:motech,项目名称:motech,代码行数:7,代码来源:EntityProcessor.java


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