use of org.glassfish.admin.rest.provider.MethodMetaData in project Payara by payara.
the class TemplateExecCommand method optionsLegacyFormat.
@OPTIONS
@Produces({ MediaType.TEXT_HTML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public ActionReportResult optionsLegacyFormat() {
RestActionReporter ar = new RestActionReporter();
ar.setExtraProperties(new Properties());
ar.setActionDescription(commandDisplayName);
OptionsResult optionsResult = new OptionsResult(resourceName);
Map<String, MethodMetaData> mmd = new HashMap<String, MethodMetaData>();
MethodMetaData methodMetaData = ResourceUtil.getMethodMetaData(commandName, getCommandParams(), locatorBridge.getRemoteLocator());
optionsResult.putMethodMetaData(commandMethod, methodMetaData);
mmd.put(commandMethod, methodMetaData);
ResourceUtil.addMethodMetaData(ar, mmd);
ActionReportResult ret = new ActionReportResult(ar, null, optionsResult);
ret.setCommandDisplayName(commandDisplayName);
return ret;
}
use of org.glassfish.admin.rest.provider.MethodMetaData in project Payara by payara.
the class TemplateListOfResource method getMethodMetaData.
private Map<String, MethodMetaData> getMethodMetaData() {
Map<String, MethodMetaData> map = new TreeMap<String, MethodMetaData>();
// GET meta data
map.put("GET", new MethodMetaData());
// POST meta data
String command = getPostCommand();
if (command != null) {
MethodMetaData postMethodMetaData = ResourceUtil.getMethodMetaData(command, locatorBridge.getRemoteLocator());
if (Util.getResourceName(uriInfo).equals("Application")) {
postMethodMetaData.setIsFileUploadOperation(true);
}
map.put("POST", postMethodMetaData);
}
return map;
}
use of org.glassfish.admin.rest.provider.MethodMetaData in project Payara by payara.
the class ResourceUtil method addMethodMetaData.
public static void addMethodMetaData(ActionReport ar, Map<String, MethodMetaData> mmd) {
List<Map> methodMetaData = new ArrayList<Map>();
MethodMetaData getMetaData = mmd.get("GET");
methodMetaData.add(new HashMap() {
{
put("name", "GET");
}
});
if (getMetaData != null) {
// are they extra params for a GET command?
Map<String, Object> getMetaDataMap = new HashMap<String, Object>();
if (getMetaData.sizeParameterMetaData() > 0) {
getMetaDataMap.put(MESSAGE_PARAMETERS, buildMethodMetadataMap(getMetaData));
}
methodMetaData.add(getMetaDataMap);
}
MethodMetaData postMetaData = mmd.get("POST");
Map<String, Object> postMetaDataMap = new HashMap<String, Object>();
if (postMetaData != null) {
postMetaDataMap.put("name", "POST");
// }
if (postMetaData.sizeParameterMetaData() > 0) {
postMetaDataMap.put(MESSAGE_PARAMETERS, buildMethodMetadataMap(postMetaData));
}
methodMetaData.add(postMetaDataMap);
}
MethodMetaData deleteMetaData = mmd.get("DELETE");
if (deleteMetaData != null) {
Map<String, Object> deleteMetaDataMap = new HashMap<String, Object>();
deleteMetaDataMap.put("name", "DELETE");
deleteMetaDataMap.put(MESSAGE_PARAMETERS, buildMethodMetadataMap(deleteMetaData));
methodMetaData.add(deleteMetaDataMap);
}
ar.getExtraProperties().put("methods", methodMetaData);
}
Aggregations