Package com.webobjects.monitor.rest

Source Code of com.webobjects.monitor.rest.MHostRestDelegate

package com.webobjects.monitor.rest;

import com.webobjects.eocontrol.EOClassDescription;
import com.webobjects.foundation.NSArray;
import com.webobjects.monitor._private.MHost;

import er.extensions.eof.ERXQ;
import er.rest.ERXRestContext;

public class MHostRestDelegate extends JavaMonitorRestDelegate {
    public Object createObjectOfEntityWithID(EOClassDescription entity, Object id, ERXRestContext context) {
    return new MHost(siteConfig(), (String)id, MHost.MAC_HOST_TYPE);
  }
   
    public Object objectOfEntityWithID(EOClassDescription entity, Object id, ERXRestContext context) {
    return (siteConfig().hostWithName((String)id));
  }
   
    public Object primaryKeyForObject(Object obj, ERXRestContext context) {
    NSArray<MHost> objects = ERXQ.filtered(siteConfig().hostArray(), ERXQ.is("name", obj));
    return objects.size() == 0 ? null : objects.objectAtIndex(0);
  }

}
TOP

Related Classes of com.webobjects.monitor.rest.MHostRestDelegate

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.