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


Java ObjectSpecification类代码示例

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


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

示例1: updateColumnMemberGroups

import org.apache.isis.core.metamodel.spec.ObjectSpecification; //导入依赖的package包/类
private static void updateColumnMemberGroups(final ObjectSpecification objectSpec, final MemberGroupLayoutHint hint, final ColumnRepr columnRepr) {
    final List<ObjectAssociation> objectAssociations = propertiesOf(objectSpec);
    final Map<String, List<ObjectAssociation>> associationsByGroup = ObjectAssociation.Util.groupByMemberOrderName(objectAssociations);
    
    final List<String> groupNames = ObjectSpecifications.orderByMemberGroups(objectSpec, associationsByGroup.keySet(), hint);
    
    columnRepr.memberGroups = Maps.newLinkedHashMap();
    for (final String groupName : groupNames) {
        final MemberGroupRepr memberGroupRepr = new MemberGroupRepr();
        columnRepr.memberGroups.put(groupName, memberGroupRepr);
        final List<ObjectAssociation> associationsInGroup = associationsByGroup.get(groupName);
        memberGroupRepr.members = Maps.newLinkedHashMap();
        if(associationsInGroup == null) {
            continue;
        }
        for (final ObjectAssociation assoc : associationsInGroup) {
            final MemberRepr memberRepr = newMemberRepr(assoc);
            memberGroupRepr.members.put(assoc.getId(), memberRepr);
        }
    }
}
 
开发者ID:isisaddons-legacy,项目名称:isis-module-devutils,代码行数:22,代码来源:LayoutJsonExporter.java

示例2: getCellValue

import org.apache.isis.core.metamodel.spec.ObjectSpecification; //导入依赖的package包/类
Object getCellValue(final Cell cell, final OneToOneAssociation otoa) {

        final int cellType = cell.getCellType();

        if(cellType == HSSFCell.CELL_TYPE_BLANK) {
            return null;
        }

        final ObjectSpecification propertySpec = otoa.getSpecification();
        Class<?> requiredType = propertySpec.getCorrespondingClass();
        
        // value types
        if(propertySpec.isValue()) {
            return getCellValue(cell, requiredType);
        }
        
        // reference types
        if(!propertySpec.isParentedOrFreeCollection()) {
            return getCellComment(cell, requiredType);
        }
        
        return null;
    }
 
开发者ID:isisaddons-legacy,项目名称:isis-module-excel,代码行数:24,代码来源:CellMarshaller.java

示例3: appliesTo

import org.apache.isis.core.metamodel.spec.ObjectSpecification; //导入依赖的package包/类
@Override
public ApplicationAdvice appliesTo(IModel<?> model) {
    
    if(!internetReachable()) {
        return ApplicationAdvice.DOES_NOT_APPLY;
    }
    
    if (!(model instanceof EntityCollectionModel)) {
        return ApplicationAdvice.DOES_NOT_APPLY;
    }

    EntityCollectionModel entityCollectionModel = (EntityCollectionModel) model;

    ObjectSpecification typeOfSpec = entityCollectionModel.getTypeOfSpecification();
    ObjectSpecification locatableSpec = getSpecificationLoader().loadSpecification(Locatable.class);
    return appliesIf(typeOfSpec.isOfType(locatableSpec));
}
 
开发者ID:IUSISProyecto,项目名称:IUSIS,代码行数:18,代码来源:CollectionOfEntitiesAsLocatablesFactory.java

示例4: appliesTo

import org.apache.isis.core.metamodel.spec.ObjectSpecification; //导入依赖的package包/类
@Override
public ApplicationAdvice appliesTo(final IModel<?> model) {
    
    if (!(model instanceof ValueModel)) {
        return ApplicationAdvice.DOES_NOT_APPLY;
    }
    final ValueModel valueModel = (ValueModel) model;
    if(model.getObject() == null) {
        return ApplicationAdvice.DOES_NOT_APPLY;
    }
    
    final ObjectSpecification chartOptionsSpec = getSpecificationLoader().loadSpecification(WickedChart.class);
    final ObjectSpecification scalarSpec = valueModel.getObject().getSpecification();
    
    return appliesExclusivelyIf(scalarSpec.isOfType(chartOptionsSpec));
}
 
开发者ID:isisaddons-legacy,项目名称:isis-wicket-wickedcharts,代码行数:17,代码来源:StandaloneValueAsWickedChartFactory.java

示例5: asJson

import org.apache.isis.core.metamodel.spec.ObjectSpecification; //导入依赖的package包/类
/**
 * not API
 */
public String asJson(final ObjectSpecification objectSpec) {
    final LayoutMetadata metadata = new LayoutMetadata();
    metadata.setColumns(Lists.<ColumnRepr>newArrayList());
    
    final MemberGroupLayoutFacet mglf = objectSpec.getFacet(MemberGroupLayoutFacet.class);
    final ColumnSpans columnSpans = mglf.getColumnSpans();
    
    final Set<String> actionIdsForAssociations = Sets.newTreeSet();
    
    ColumnRepr columnRepr;
    
    columnRepr = addColumnWithSpan(metadata, columnSpans.getLeft());
    updateColumnMemberGroups(objectSpec, MemberGroupLayoutHint.LEFT, columnRepr);
    
    columnRepr = addColumnWithSpan(metadata, columnSpans.getMiddle());
    updateColumnMemberGroups(objectSpec, MemberGroupLayoutHint.MIDDLE, columnRepr);
    
    columnRepr = addColumnWithSpan(metadata, columnSpans.getRight());
    updateColumnMemberGroups(objectSpec, MemberGroupLayoutHint.RIGHT, columnRepr);
    
    columnRepr = addColumnWithSpan(metadata, columnSpans.getCollections());
    updateCollectionColumnRepr(objectSpec, columnRepr);

    addActions(objectSpec, metadata, actionIdsForAssociations);
    
    final Gson gson = new GsonBuilder().setPrettyPrinting().create();
    return gson.toJson(metadata);
}
 
开发者ID:isisaddons-legacy,项目名称:isis-module-devutils,代码行数:32,代码来源:LayoutJsonExporter.java

示例6: updateCollectionColumnRepr

import org.apache.isis.core.metamodel.spec.ObjectSpecification; //导入依赖的package包/类
private static void updateCollectionColumnRepr(final ObjectSpecification objectSpec, final ColumnRepr columnRepr) {
    final List<ObjectAssociation> objectAssociations = collectionsOf(objectSpec);
    columnRepr.collections = Maps.newLinkedHashMap();
    for(final ObjectAssociation assoc: objectAssociations) {
        final MemberRepr memberRepr = newMemberRepr(assoc);
        columnRepr.collections.put(assoc.getId(), memberRepr);
    }
}
 
开发者ID:isisaddons-legacy,项目名称:isis-module-devutils,代码行数:9,代码来源:LayoutJsonExporter.java

示例7: addActions

import org.apache.isis.core.metamodel.spec.ObjectSpecification; //导入依赖的package包/类
private static void addActions(final ObjectSpecification objectSpec, final LayoutMetadata metadata, final Set<String> actionIdsForAssociations) {
    final Map<String, ActionRepr> actions = Maps.newLinkedHashMap();
    final List<ObjectAction> actionsOf = actionsOf(objectSpec, actionIdsForAssociations);
    for(final ObjectAction action: actionsOf) {
        actions.put(action.getId(), newActionRepr(action));
    }
    metadata.setActions(actions);
}
 
开发者ID:isisaddons-legacy,项目名称:isis-module-devutils,代码行数:9,代码来源:LayoutJsonExporter.java

示例8: getClassType

import org.apache.isis.core.metamodel.spec.ObjectSpecification; //导入依赖的package包/类
public String getClassType() {
    boolean service = false;
    for(ObjectSpecification subspecs: spec.subclasses()) {
        service = service || subspecs.isService();
    }
    return service || spec.isService() ?"2 Service":spec.isValue()?"3 Value":spec.isParentedOrFreeCollection()?"4 Collection":"1 Object";
}
 
开发者ID:isisaddons-legacy,项目名称:isis-module-devutils,代码行数:8,代码来源:MetaModelRow.java

示例9: getContributedBy

import org.apache.isis.core.metamodel.spec.ObjectSpecification; //导入依赖的package包/类
public String getContributedBy() {
    if(member instanceof ContributeeMember2) {
        final ObjectSpecification serviceContributedBy = ((ContributeeMember2) member).getServiceContributedBy();
        return serviceContributedBy.getCorrespondingClass().getSimpleName();
    }
    return "";
}
 
开发者ID:isisaddons-legacy,项目名称:isis-module-devutils,代码行数:8,代码来源:MetaModelRow.java

示例10: refreshServices

import org.apache.isis.core.metamodel.spec.ObjectSpecification; //导入依赖的package包/类
@Programmatic
public void refreshServices() {
    final Collection<ObjectSpecification> specifications = Lists.newArrayList(specificationLoader.allSpecifications());
    for (final ObjectSpecification objectSpec : specifications) {
        if(objectSpec.isService()){
            specificationLoader.invalidateCache(objectSpec.getCorrespondingClass());
        }
    }
}
 
开发者ID:isisaddons-legacy,项目名称:isis-module-devutils,代码行数:10,代码来源:DeveloperUtilitiesServiceProgrammatic.java

示例11: downloadLayouts

import org.apache.isis.core.metamodel.spec.ObjectSpecification; //导入依赖的package包/类
@Programmatic
public Blob downloadLayouts() {
    final LayoutJsonExporter exporter = new LayoutJsonExporter();
    final Collection<ObjectSpecification> allSpecs = specificationLoader.allSpecifications();
    final Collection<ObjectSpecification> domainObjectSpecs = Collections2.filter(allSpecs, new Predicate<ObjectSpecification>(){
        @Override
        public boolean apply(final ObjectSpecification input) {
            return  !input.isAbstract() && 
                    !input.isService() && 
                    !input.isValue() && 
                    !input.isParentedOrFreeCollection();
        }});
    try {
        final ByteArrayOutputStream baos = new ByteArrayOutputStream();
        final ZipOutputStream zos = new ZipOutputStream(baos);
        final OutputStreamWriter writer = new OutputStreamWriter(zos);
        for (final ObjectSpecification objectSpec : domainObjectSpecs) {
            zos.putNextEntry(new ZipEntry(zipEntryNameFor(objectSpec)));
            writer.write(exporter.asJson(objectSpec));
            writer.flush();
            zos.closeEntry();
        }
        writer.close();
        return new Blob("layouts.zip", mimeTypeApplicationZip, baos.toByteArray());
    } catch (final IOException ex) {
        throw new FatalException("Unable to create zip of layouts", ex);
    }
}
 
开发者ID:isisaddons-legacy,项目名称:isis-module-devutils,代码行数:29,代码来源:DeveloperUtilitiesServiceProgrammatic.java

示例12: getAssociation

import org.apache.isis.core.metamodel.spec.ObjectSpecification; //导入依赖的package包/类
private static OneToOneAssociation getAssociation(final ObjectSpecification objectSpec, final String propertyNameOrId) {
    final List<ObjectAssociation> associations = objectSpec.getAssociations(Contributed.INCLUDED);
    for (final ObjectAssociation association : associations) {
        if (association instanceof OneToOneAssociation) {
            if (propertyNameOrId.equalsIgnoreCase(association.getName())) {
                return (OneToOneAssociation) association;
            }
            if (propertyNameOrId.equalsIgnoreCase(association.getId())) {
                return (OneToOneAssociation) association;
            }
        }
    }
    return null;
}
 
开发者ID:isisaddons-legacy,项目名称:isis-module-excel,代码行数:15,代码来源:ExcelConverter.java

示例13: setCellValue

import org.apache.isis.core.metamodel.spec.ObjectSpecification; //导入依赖的package包/类
void setCellValue(
        final ObjectAdapter objectAdapter, 
        final OneToOneAssociation otoa, 
        final Cell cell) {
    
    final ObjectAdapter propertyAdapter = otoa.get(objectAdapter);
    
    // null
    if (propertyAdapter == null) {
        cell.setCellType(HSSFCell.CELL_TYPE_BLANK);
        return;
    }
    
    final ObjectSpecification propertySpec = otoa.getSpecification();
    final Object propertyAsObj = propertyAdapter.getObject();
    final String propertyAsTitle = propertyAdapter.titleString(null);
    
    // value types
    if(propertySpec.isValue()) {
        if(setCellValue(cell, propertyAsObj)) {
            return;
        }
    }
    
    // reference types
    if(!propertySpec.isParentedOrFreeCollection()) {
        setCellValueForBookmark(cell, propertyAsObj, propertyAsTitle);
        return;
    }

    // fallback, best effort
    setCellValueForString(cell, propertyAsTitle);
    return;
}
 
开发者ID:isisaddons-legacy,项目名称:isis-module-excel,代码行数:35,代码来源:CellMarshaller.java

示例14: choices0NewDocFragment

import org.apache.isis.core.metamodel.spec.ObjectSpecification; //导入依赖的package包/类
public List<String> choices0NewDocFragment() {
    final Collection<ObjectSpecification> objectSpecifications = specificationLookup.allSpecifications();
    return Lists.newArrayList(
            FluentIterable.from(objectSpecifications)
                    .filter(x -> !(x.isValue() || x.isService() || x.isAbstract() || x.isMixin() || x.isParentedOrFreeCollection()))
            .transform(x -> x.getSpecId().asString())
            .toSortedList(String::compareTo)
    );
}
 
开发者ID:estatio,项目名称:estatio,代码行数:10,代码来源:DocFragmentMenu.java

示例15: choices0CreateDocFragment

import org.apache.isis.core.metamodel.spec.ObjectSpecification; //导入依赖的package包/类
public List<String> choices0CreateDocFragment() {
    final Collection<ObjectSpecification> objectSpecifications = specificationLookup.allSpecifications();
    return Lists.newArrayList(
            FluentIterable.from(objectSpecifications)
            .transform(x -> x.getSpecId().asString())
            .toSortedList(String::compareTo)
    );
}
 
开发者ID:estatio,项目名称:estatio,代码行数:9,代码来源:DocFragmentMenu.java


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