Untitled
unknown
json
2 years ago
8.6 kB
6
Indexable
{ "identifier": "manageKalturaMediaEntries", "parameters": { "view": "EntityView", "search": "Search", "data": "Map<String, Object>" }, "return_type": "Object", "repo": "pashamustsfa/jenkins", "path": "src/main/java/org/sakaiproject/kaltura/logic/entity/KalturaEntityProvider.java", "language": "Java", "stars_count": null, "issues_count": null, "forks_count": null, "license": [ "ECL-2.0" ], "hexsha": "f6be641e407aba92edc67dc30a79726c0b613fa7", "ext": "java", "size": 43813, "code": "@EntityCustomAction(action=\"kme\", viewKey=\"\")\n public Object manageKalturaMediaEntries(EntityView view, Search search, Map<String, Object> data) {\n // GET /kaltura/kme\n // GET /kaltura/kme/keid\n // PUT /kaltura/kme/keid\n // DEL /kaltura/kme/keid\n Object result = null;\n String keid = view.getPathSegment(2);\n if ( StringUtils.isBlank(keid) ) {\n if (EntityView.Method.GET.name().equals(view.getMethod())) {\n // get all kaltura items\n String query = \"\";\n String qstr = (String) search.getRestrictionValueByProperties(new String[] {\"search\"});\n if (qstr != null) {\n query = qstr;\n }\n String[] keids = null;\n String keidsStr = (String) search.getRestrictionValueByProperties(new String[] {\"keids\"});\n if (keidsStr != null) {\n keids = StringUtils.split(keidsStr, \", \"); // WARNING: will split on space OR comma\n }\n result = kalturaAPIService.getKalturaItems(query, keids, (int) search.getStart(), (int) search.getLimit());\n } else {\n throw new EntityException(\"Only GET is supported for retrieving the list of KMEs\", view.getEntityURL(), HttpServletResponse.SC_METHOD_NOT_ALLOWED);\n }\n } else {\n // get the kaltura entry\n KalturaMediaEntry kme = kalturaAPIService.getKalturaItem(keid);\n if (kme == null) {\n throw new EntityNotFoundException(\"No kme with the given id: \"+keid, view.getEntityURL());\n }\n if (EntityView.Method.GET.name().equals(view.getMethod())) {\n // return a single kme\n result = kme;\n } else if (EntityView.Method.DELETE.name().equals(view.getMethod())) {\n // remove this kme\n result = kalturaAPIService.removeKalturaItem(keid);\n } else {\n // update the kme\n developerHelperService.copyBean(data, kme, 0, null, true);\n result = kalturaAPIService.updateKalturaItem(kme);\n }\n }\n return result;\n }", "code_tokens": [ "@", "EntityCustomAction", "(", "action", "=", "\"kme\"", ",", "viewKey", "=", "\"\"", ")", "public", "Object", "manageKalturaMediaEntries", "(", "EntityView", "view", ",", "Search", "search", ",", "Map", "<", "String", ",", "Object", ">", "data", ")", "{", "Object", "result", "=", "null", ";", "String", "keid", "=", "view", ".", "getPathSegment", "(", "2", ")", ";", "if", "(", "StringUtils", ".", "isBlank", "(", "keid", ")", ")", "{", "if", "(", "EntityView", ".", "Method", ".", "GET", ".", "name", "(", ")", ".", "equals", "(", "view", ".", "getMethod", "(", ")", ")", ")", "{", "String", "query", "=", "\"\"", ";", "String", "qstr", "=", "(", "String", ")", "search", ".", "getRestrictionValueByProperties", "(", "new", "String", "[", "]", "{", "\"search\"", "}", ")", ";", "if", "(", "qstr", "!=", "null", ")", "{", "query", "=", "qstr", ";", "}", "String", "[", "]", "keids", "=", "null", ";", "String", "keidsStr", "=", "(", "String", ")", "search", ".", "getRestrictionValueByProperties", "(", "new", "String", "[", "]", "{", "\"keids\"", "}", ")", ";", "if", "(", "keidsStr", "!=", "null", ")", "{", "keids", "=", "StringUtils", ".", "split", "(", "keidsStr", ",", "\", \"", ")", ";", "}", "result", "=", "kalturaAPIService", ".", "getKalturaItems", "(", "query", ",", "keids", ",", "(", "int", ")", "search", ".", "getStart", "(", ")", ",", "(", "int", ")", "search", ".", "getLimit", "(", ")", ")", ";", "}", "else", "{", "throw", "new", "EntityException", "(", "\"Only GET is supported for retrieving the list of KMEs\"", ",", "view", ".", "getEntityURL", "(", ")", ",", "HttpServletResponse", ".", "SC_METHOD_NOT_ALLOWED", ")", ";", "}", "}", "else", "{", "KalturaMediaEntry", "kme", "=", "kalturaAPIService", ".", "getKalturaItem", "(", "keid", ")", ";", "if", "(", "kme", "==", "null", ")", "{", "throw", "new", "EntityNotFoundException", "(", "\"No kme with the given id: \"", "+", "keid", ",", "view", ".", "getEntityURL", "(", ")", ")", ";", "}", "if", "(", "EntityView", ".", "Method", ".", "GET", ".", "name", "(", ")", ".", "equals", "(", "view", ".", "getMethod", "(", ")", ")", ")", "{", "result", "=", "kme", ";", "}", "else", "if", "(", "EntityView", ".", "Method", ".", "DELETE", ".", "name", "(", ")", ".", "equals", "(", "view", ".", "getMethod", "(", ")", ")", ")", "{", "result", "=", "kalturaAPIService", ".", "removeKalturaItem", "(", "keid", ")", ";", "}", "else", "{", "developerHelperService", ".", "copyBean", "(", "data", ",", "kme", ",", "0", ",", "null", ",", "true", ")", ";", "result", "=", "kalturaAPIService", ".", "updateKalturaItem", "(", "kme", ")", ";", "}", "}", "return", "result", ";", "}" ], "original_docstring": "/**\n * Allows use to get the various kaltura media entries for a user directly and to manage them as well\n */", "comment": [ "// GET /kaltura/kme", "// GET /kaltura/kme/keid", "// PUT /kaltura/kme/keid", "// DEL /kaltura/kme/keid", "// get all kaltura items", "// WARNING: will split on space OR comma", "// get the kaltura entry", "// return a single kme", "// remove this kme", "// update the kme" ], "docstring_tokens": [ "Allows", "use", "to", "get", "the", "various", "kaltura", "media", "entries", "for", "a", "user", "directly", "and", "to", "manage", "them", "as", "well" ], "docstring": "Allows use to get the various kaltura media entries for a user directly and to manage them as well", "docstring_params": { "returns": [], "raises": [], "params": [ { "identifier": "view", "docstring": null, "type": "EntityView", "docstring_tokens": [] }, { "identifier": "search", "docstring": null, "type": "Search", "docstring_tokens": [] }, { "identifier": "data", "docstring": null, "type": "Map<String, Object>", "docstring_tokens": [] } ], "outlier_params": [], "others": [] }, "short_docstring": "Allows use to get the various kaltura media entries for a user directly and to manage them as well", "short_docstring_tokens": [ "Allows", "use", "to", "get", "the", "various", "kaltura", "media", "entries", "for", "a", "user", "directly", "and", "to", "manage", "them", "as", "well" ] }
Editor is loading...