-
Notifications
You must be signed in to change notification settings - Fork 167
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding info action on mApplication REST service in wotaskd
- Loading branch information
Pascal Robert
committed
Aug 9, 2012
1 parent
2120612
commit fe5447b
Showing
3 changed files
with
75 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
.../wotaskd/Sources/com/webobjects/monitor/wotaskd/rest/delegates/MInstanceRestDelegate.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.webobjects.monitor.wotaskd.rest.delegates; | ||
|
||
import com.webobjects.eocontrol.EOClassDescription; | ||
import com.webobjects.foundation.NSArray; | ||
import com.webobjects.monitor._private.MInstance; | ||
|
||
import er.extensions.eof.ERXQ; | ||
import er.rest.ERXRestContext; | ||
|
||
public class MInstanceRestDelegate extends JavaMonitorRestDelegate { | ||
public Object primaryKeyForObject(Object obj, ERXRestContext context) { | ||
NSArray<MInstance> objects = ERXQ.filtered(siteConfig().instanceArray(), ERXQ.is("applicationName", ((MInstance)obj).applicationName()).and(ERXQ.is("id", ((MInstance)obj).id()))); | ||
return objects.size() == 0 ? null : objects.objectAtIndex(0); | ||
} | ||
|
||
public Object createObjectOfEntityWithID(EOClassDescription entity, Object id, ERXRestContext context) { | ||
return new MInstance(((MInstance)id).dictionaryForArchive(), siteConfig()); | ||
} | ||
|
||
public Object objectOfEntityWithID(EOClassDescription entity, Object id, ERXRestContext context) { | ||
return (siteConfig().instanceWithName(null)); | ||
} | ||
|
||
} |