• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ObjectAdapter类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: route

import org.apache.isis.core.metamodel.adapter.ObjectAdapter; //导入依赖的package包/类
@Override
public Object route(final Object original) {

    if(original != null) {
        return original;
    }

    // ensure that any persisted objects have been deleted.
    container.flush();

    final BreadcrumbModelProvider  wicketSession = (BreadcrumbModelProvider) AuthenticatedWebSession.get();
    final BreadcrumbModel breadcrumbModel = wicketSession.getBreadcrumbModel();

    final List<EntityModel> breadcrumbs = breadcrumbModel.getList();
    final Optional<Object> firstViewModelOrNonDeletedPojoIfAny = breadcrumbs.stream()
            .filter(entityModel -> entityModel != null).map(EntityModel::getObject)
            .filter(objectAdapter -> objectAdapter != null).map(ObjectAdapter::getObject)
            .filter(pojo -> !(pojo instanceof Persistable) || !((Persistable)pojo).dnIsDeleted())
            .findFirst();
    return firstViewModelOrNonDeletedPojoIfAny.orElse(homePage());
}
 
开发者ID:isisaddons,项目名称:isis-app-todoapp,代码行数:22,代码来源:RoutingServiceUsingBreadcrumbs.java


示例2: buildGui

import org.apache.isis.core.metamodel.adapter.ObjectAdapter; //导入依赖的package包/类
private void buildGui() {

        final EntityCollectionModel model = getModel();
        final List<ObjectAdapter> adapterList = model.getObject();

        final GMap map = new GMap(ID_MAP);
        map.setStreetViewControlEnabled(true);
        map.setScaleControlEnabled(true);
        map.setScrollWheelZoomEnabled(true);
        map.setPanControlEnabled(true);
        map.setDoubleClickZoomEnabled(true);

        // centre the map on the first object that has a location.
        for (ObjectAdapter adapter : adapterList) {
            GLatLng latLng = asGLatLng((Locatable)adapterList.get(0).getObject());
            if(latLng != null) {
                map.setCenter(latLng);
                break;
            }
        }
        
        addOrReplace(map);
        applyCssVisibility(map, !adapterList.isEmpty());
        
        addMarkers(map, adapterList);
    }
 
开发者ID:IUSISProyecto,项目名称:IUSIS,代码行数:27,代码来源:CollectionOfEntitiesAsLocatables.java


示例3: buildMarkerOptions

import org.apache.isis.core.metamodel.adapter.ObjectAdapter; //导入依赖的package包/类
private GMarkerOptions buildMarkerOptions(GMap map, ObjectAdapter adapter) {
    
    final Locatable locatable = (Locatable) adapter.getObject();
    
    final ResourceReference imageResource = determineImageResource(adapter);
    final String urlFor = (String)urlFor(imageResource, new PageParameters());
    @SuppressWarnings("unused")
    final GIcon gicon = new GIcon(urlFor);
    
    GLatLng gLatLng = asGLatLng(locatable);
    if(gLatLng == null) {
        return null;
    }
    final GMarkerOptions markerOptions = new GMarkerOptions(
            map, gLatLng, 
            adapter.titleString(null)   ).draggable(false);
    return markerOptions;
}
 
开发者ID:IUSISProyecto,项目名称:IUSIS,代码行数:19,代码来源:CollectionOfEntitiesAsLocatables.java


示例4: objectActions

import org.apache.isis.core.metamodel.adapter.ObjectAdapter; //导入依赖的package包/类
/**
 * Returns the object actions
 */
@GET
@Path("/object/{object}/{id}/actions")
@Produces("application/xml")
public Response objectActions(@PathParam("object") String object, @PathParam("id") String id) {
    Component component = null;
    AuthenticationSession session = new AnonymousSession();
    IsisContext.openSession(session);


    try {
        final ObjectAdapter instance = IsisContext.getPersistenceSession().getAdapterManager().adapterFor(RootOidDefault.deString(id, IsisContext.getOidMarshaller()));

        component = factory.createComponent(Component.MENU);
        component = component.acceptInstance(instance);
    } catch (Exception e) {
        log.error("viewObjectInstance exception", e);
    } finally {
        IsisContext.closeSession();
    }


    return Response.status(200).entity(component).build();


}
 
开发者ID:madytyoo,项目名称:dhtmlx-isis-viewer,代码行数:29,代码来源:ViewerObject.java


示例5: acceptObject

import org.apache.isis.core.metamodel.adapter.ObjectAdapter; //导入依赖的package包/类
public Component acceptObject(ObjectAdapter object, ObjectAdapter result)  {
    final CollectionFacet facet = CollectionFacetUtils.getCollectionFacetFromSpec(result);

    boolean header = false;
    for (final ObjectAdapter rowAdapter : facet.iterable(result)) {
        if(rowAdapter != null) {
            IsisContext.getPersistenceSession().resolveImmediately(rowAdapter);
            // Must fix this
            String label = rowAdapter.titleString() != null ? rowAdapter.titleString() : "";
            String id = rowAdapter.getOid().toString();
            this.addOption( id , label );
            header = true;
        }
    }


    return this;
}
 
开发者ID:madytyoo,项目名称:dhtmlx-isis-viewer,代码行数:19,代码来源:FormSelect.java


示例6: setCellValue

import org.apache.isis.core.metamodel.adapter.ObjectAdapter; //导入依赖的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


示例7: addMarkers

import org.apache.isis.core.metamodel.adapter.ObjectAdapter; //导入依赖的package包/类
private void addMarkers(final GMap map, List<ObjectAdapter> adapterList) {

        List<GLatLng> glatLngsToShow = Lists.newArrayList();
        for (ObjectAdapter adapter : adapterList) {

            final GMarker gMarker = createGMarker(map, adapter);
            if(gMarker != null) {
                map.addOverlay(gMarker);
                addClickListener(gMarker, adapter);
                glatLngsToShow.add(gMarker.getLatLng());
            }
        }

        map.fitMarkers(glatLngsToShow);
    }
 
开发者ID:IUSISProyecto,项目名称:IUSIS,代码行数:16,代码来源:CollectionOfEntitiesAsLocatables.java


示例8: determineImageResource

import org.apache.isis.core.metamodel.adapter.ObjectAdapter; //导入依赖的package包/类
private ResourceReference determineImageResource(ObjectAdapter adapter) {
    ResourceReference imageResource = null;
    if (adapter != null) {
        imageResource = getImageCache().resourceReferenceFor(adapter);
    }
    return imageResource;
}
 
开发者ID:IUSISProyecto,项目名称:IUSIS,代码行数:8,代码来源:CollectionOfEntitiesAsLocatables.java


示例9: addClickListener

import org.apache.isis.core.metamodel.adapter.ObjectAdapter; //导入依赖的package包/类
private void addClickListener(final GMarker gMarker, ObjectAdapter adapter) {
    final Class<? extends Page> pageClass = getPageClassRegistry()
            .getPageClass(PageType.ENTITY);
    final PageParameters pageParameters = EntityModel.createPageParameters(
            adapter);

    gMarker.addListener(GEvent.click, new GEventHandler() {
        private static final long serialVersionUID = 1L;

        @Override
        public void onEvent(AjaxRequestTarget target) {
            setResponsePage(pageClass, pageParameters);
        }
    });
}
 
开发者ID:IUSISProyecto,项目名称:IUSIS,代码行数:16,代码来源:CollectionOfEntitiesAsLocatables.java


示例10: buildGui

import org.apache.isis.core.metamodel.adapter.ObjectAdapter; //导入依赖的package包/类
private void buildGui() {

        final ValueModel model = getModel();
        final ObjectAdapter chartAdapter = model.getObject();
        final Object chartObj = chartAdapter.getObject();
        WickedChart chart = (WickedChart) chartObj;
        Options options = chart.getOptions();
        
        addOrReplace(new Chart("chart", options));
    }
 
开发者ID:isisaddons-legacy,项目名称:isis-wicket-wickedcharts,代码行数:11,代码来源:StandaloneValueAsWickedChart.java


示例11: buildGui

import org.apache.isis.core.metamodel.adapter.ObjectAdapter; //导入依赖的package包/类
private void buildGui() {
    final EntityCollectionModel model = getModel();

    final ObjectSpecification elementSpec = model.getTypeOfSpecification();

    final NotificationPanel feedback = new NotificationPanel(ID_FEEDBACK);
    feedback.setOutputMarkupId(true);
    addOrReplace(feedback);

    final List<ObjectAdapter> adapters = model.getObject();
    final List<String> titles = Lists.newArrayList();
    for (ObjectAdapter adapter: adapters) {
        titles.add(adapter.titleString(null));
    }

    final List<ObjectAssociation> numberAssociations = elementSpec.getAssociations(CollectionContentsAsSummaryChartFactory.OF_TYPE_BIGDECIMAL);
    final List<CollectionContentsAsSummary.Summary> summaries = Lists.newArrayList();
    for (final ObjectAssociation numberAssociation : numberAssociations) {

        final String propertyName = numberAssociation.getName();
        final CollectionContentsAsSummary.Summary summary = new CollectionContentsAsSummary.Summary(propertyName, adapters, numberAssociation);

        summaries.add(summary);
    }

    if(model.isStandalone()) {
        final WickedChart chartValue = createChartValue(titles, summaries);
        final StandaloneValueAsWickedChart wickedChart = new StandaloneValueAsWickedChart(ID_CHART, asValueModel(chartValue));
        addOrReplace(wickedChart);
    } else {
        add(new Label(ID_CHART, ""));
    }
}
 
开发者ID:isisaddons-legacy,项目名称:isis-wicket-wickedcharts,代码行数:34,代码来源:CollectionContentsAsSummaryChart.java


示例12: apply

import org.apache.isis.core.metamodel.adapter.ObjectAdapter; //导入依赖的package包/类
@Override
public String apply(final ObjectAdapter input) {
    final Object domainObject = input.getObject();
    if(domainObject == null || !(domainObject instanceof CalendarEventable)) {
        return null;
    }
    final CalendarEventable calendarEventable = (CalendarEventable) domainObject;
    if(calendarEventable == null) {
        return null;
    }
    return calendarEventable.getCalendarName();
}
 
开发者ID:isisaddons-legacy,项目名称:isis-wicket-fullcalendar2,代码行数:13,代码来源:CalendarEventableEventProvider.java


示例13: createEvents

import org.apache.isis.core.metamodel.adapter.ObjectAdapter; //导入依赖的package包/类
private void createEvents(final EntityCollectionModel model, final String calendarName) {
    final Collection<ObjectAdapter> entityList = model.getObject();
    final Iterable<Event> events = Iterables.filter(
            Iterables.transform(entityList, newEvent(calendarName)), NOT_NULL);
    for (final Event event : events) {
        eventById.put(event.getId(), event);
    }
}
 
开发者ID:isisaddons-legacy,项目名称:isis-wicket-fullcalendar2,代码行数:9,代码来源:EventProviderAbstract.java


示例14: apply

import org.apache.isis.core.metamodel.adapter.ObjectAdapter; //导入依赖的package包/类
@Override
public Iterable<String> apply(final ObjectAdapter input) {
    final Object domainObject = input.getObject();
    if(domainObject == null || !(domainObject instanceof Calendarable)) {
        return null;
    }
    final Calendarable calendarable = (Calendarable) domainObject;
    return calendarable.getCalendarNames();
}
 
开发者ID:isisaddons-legacy,项目名称:isis-wicket-fullcalendar2,代码行数:10,代码来源:CalendarableEventProvider.java


示例15: onEventClicked

import org.apache.isis.core.metamodel.adapter.ObjectAdapter; //导入依赖的package包/类
@Override
protected void onEventClicked(
        final ClickedEvent event,
        final CalendarResponse response) {

    final String oidStr = (String) event.getEvent().getPayload();
    final RootOid oid = RootOid.deString(oidStr);
    final ObjectAdapter adapter = getPersistenceSession().adapterFor(oid);
    final PageParameters params = new EntityModel(adapter).getPageParameters();
    throw new RestartResponseException(EntityPage.class, params);
}
 
开发者ID:isisaddons-legacy,项目名称:isis-wicket-fullcalendar2,代码行数:12,代码来源:FullCalendarWithEventHandling.java


示例16: parseForObjectInstance

import org.apache.isis.core.metamodel.adapter.ObjectAdapter; //导入依赖的package包/类
public Object parseForObjectInstance(String code, ObjectAdapter instance) throws Exception {
    this.mode = INSTANCE;
    this.refPrefix = "dhx/objects/";
    this.objectInstance = instance;
    /* Creates the form from the instance object*/
    this.form = (Form) new Form().acceptInstance(this.objectInstance);


    return this.parse(code);
}
 
开发者ID:madytyoo,项目名称:dhtmlx-isis-viewer,代码行数:11,代码来源:ParserHelper.java


示例17: findService

import org.apache.isis.core.metamodel.adapter.ObjectAdapter; //导入依赖的package包/类
public static ObjectAdapter findService(String object) throws InvalidObjectException {
    final List<ObjectAdapter> serviceAdapters = IsisContext.getPersistenceSession().getServices();
    for (final ObjectAdapter serviceAdapter : serviceAdapters) {
        final Object service = serviceAdapter.getObject();
        if (ServiceUtil.id(service).equals(object.trim())) {
            final ObjectAdapter adapter = IsisContext.getPersistenceSession().getAdapterManager().getAdapterFor(service);
            return adapter;
        }
    }
    throw new InvalidObjectException("Failed to find object " + object);
}
 
开发者ID:madytyoo,项目名称:dhtmlx-isis-viewer,代码行数:12,代码来源:Utils.java


示例18: findObject

import org.apache.isis.core.metamodel.adapter.ObjectAdapter; //导入依赖的package包/类
public static ObjectAdapter findObject(String object) throws InvalidObjectException {
    final List<ObjectAdapter> serviceAdapters = IsisContext.getPersistenceSession().getServices();
    for (final ObjectAdapter serviceAdapter : serviceAdapters) {
        if (serviceAdapter.getSpecification().getSpecId().asString().equals(object))  {
            //final ObjectAdapter adapter = IsisContext.getPersistenceSession().getAdapterManager().getAdapterFor( serviceAdapter );
            //return adapter;
            return serviceAdapter ;
        }
    }
    throw new InvalidObjectException("Failed to find object " + object);
}
 
开发者ID:madytyoo,项目名称:dhtmlx-isis-viewer,代码行数:12,代码来源:Utils.java


示例19: findAction

import org.apache.isis.core.metamodel.adapter.ObjectAdapter; //导入依赖的package包/类
public static ObjectAction findAction(final ObjectAdapter object, final String methodName) throws InvalidActionException {
    if (object == null) {
        throw new InvalidActionException("Object not specified when looking for " + methodName);
    }

    final List<ObjectAction> actions = object.getSpecification().getObjectActions(Arrays.asList(ActionType.USER, ActionType.EXPLORATION, ActionType.PROTOTYPE, ActionType.DEBUG), ObjectActionContainer.Contributed.INCLUDED);
    final ObjectAction action = findAction(actions, methodName);
    if (action == null) {
        throw new InvalidActionException("Failed to find action " + methodName + " on " + object);
    }
    return action;
}
 
开发者ID:madytyoo,项目名称:dhtmlx-isis-viewer,代码行数:13,代码来源:Utils.java


示例20: serviceActionInvoke

import org.apache.isis.core.metamodel.adapter.ObjectAdapter; //导入依赖的package包/类
/**
    * Action invocation
    * @param service
    * @param method
    * @return
    */
   @GET
@Path("/{service}/actions/{action}/invoke")
   @Produces("application/xml")
public Response serviceActionInvoke(@PathParam("service") String service,
                                       @PathParam("action") String method,
                                       @Context UriInfo info) {

       Component component = null;
       AuthenticationSession session = new AnonymousSession();
       IsisContext.openSession(session);

       try {
           final ObjectAdapter object = Utils.findService(service);
           final ObjectAction action = Utils.findAction(object, method);

           final int parameterCount = action.getParameterCount();
           final ObjectAdapter[] parameters = new ObjectAdapter[parameterCount];

           final ObjectAdapter result = action.execute(object, parameters);

           String dhx = info.getQueryParameters().getFirst("dhx");
           dhx = (dhx != null ? dhx : Component.GRID );
           component = factory.createComponent( dhx );

           String columns = info.getQueryParameters().getFirst("columns");
           if( columns != null ) {
               component.setParameter("columns",columns);
           }
           component.acceptObject(object,action, result);

       } catch (Exception e) {
           e.printStackTrace();
       } finally {
             IsisContext.closeSession();
       }


	return Response.status(200).entity(component).build();
}
 
开发者ID:madytyoo,项目名称:dhtmlx-isis-viewer,代码行数:46,代码来源:ViewerServiceDesktop.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Open类代码示例发布时间:2022-05-23
下一篇:
Java ColorMode类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap