finish API 0.8... need to update response messages
This commit is contained in:
parent
42f4acd250
commit
fd8296c183
@ -210,7 +210,7 @@ class ApiController {
|
||||
String role = null;
|
||||
if (meeting.getModeratorPassword().equals(attPW)) {
|
||||
role = ROLE_MODERATOR;
|
||||
} else if (meeting.getAttendeePassword().equals(attPW)) {
|
||||
} else if (meeting.getViewerPassword().equals(attPW)) {
|
||||
role = ROLE_ATTENDEE;
|
||||
}
|
||||
|
||||
@ -688,11 +688,16 @@ class ApiController {
|
||||
errors.missingParamError("checksum");
|
||||
}
|
||||
|
||||
// Do we have a meeting id? If none, complain.
|
||||
// Do we have a recording id? If none, complain.
|
||||
String recordId = params.recordID
|
||||
if (StringUtils.isEmpty(recordId)) {
|
||||
errors.missingParamError("recordID");
|
||||
}
|
||||
// Do we have a publish status? If none, complain.
|
||||
String publish = params.publish
|
||||
if (StringUtils.isEmpty(publish)) {
|
||||
errors.missingParamError("publish");
|
||||
}
|
||||
|
||||
if (errors.hasErrors()) {
|
||||
respondWithErrors(errors)
|
||||
@ -717,8 +722,66 @@ class ApiController {
|
||||
return;
|
||||
}
|
||||
|
||||
meetingService.setPublishRecording(recordIdList, true);
|
||||
meetingService.setPublishRecording(recordIdList,publish.toBoolean());
|
||||
withFormat {
|
||||
xml {
|
||||
render(contentType:"text/xml") {
|
||||
response() {
|
||||
returncode(RESP_CODE_SUCCESS)
|
||||
published(publish)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/******************************************************
|
||||
* DELETE_RECORDINGS API
|
||||
******************************************************/
|
||||
def deleteRecordings = {
|
||||
String API_CALL = "deleteRecordings"
|
||||
log.debug CONTROLLER_NAME + "#${API_CALL}"
|
||||
|
||||
ApiErrors errors = new ApiErrors()
|
||||
|
||||
// Do we have a checksum? If none, complain.
|
||||
if (StringUtils.isEmpty(params.checksum)) {
|
||||
errors.missingParamError("checksum");
|
||||
}
|
||||
|
||||
// Do we have a recording id? If none, complain.
|
||||
String recordId = params.recordID
|
||||
if (StringUtils.isEmpty(recordId)) {
|
||||
errors.missingParamError("recordID");
|
||||
}
|
||||
|
||||
if (errors.hasErrors()) {
|
||||
respondWithErrors(errors)
|
||||
return
|
||||
}
|
||||
|
||||
// Do we agree on the checksum? If not, complain.
|
||||
if (! paramsProcessorUtil.isChecksumSame(API_CALL, params.checksum, request.getQueryString())) {
|
||||
errors.checksumError()
|
||||
respondWithErrors(errors)
|
||||
return
|
||||
}
|
||||
|
||||
ArrayList<String> recordIdList = new ArrayList<String>();
|
||||
if (!StringUtils.isEmpty(recordId)) {
|
||||
recordIdList=paramsProcessorUtil.decodeIds(recordId);
|
||||
}
|
||||
|
||||
meetingService.deleteRecordings(recordIdList);
|
||||
withFormat {
|
||||
xml {
|
||||
render(contentType:"text/xml") {
|
||||
response() {
|
||||
returncode(RESP_CODE_SUCCESS)
|
||||
deleted(true)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def uploadDocuments(conf) {
|
||||
|
@ -52,7 +52,7 @@ public class RecordingServiceHelperImp implements RecordingServiceHelper {
|
||||
}
|
||||
}
|
||||
|
||||
xmlEventFile = new File(path + File.pathSeparatorChar + "metadata.xml")
|
||||
def xmlEventFile = new File(path + File.separatorChar + "metadata.xml")
|
||||
xmlEventFile.write writer.toString()
|
||||
}
|
||||
|
||||
@ -67,7 +67,7 @@ public class RecordingServiceHelperImp implements RecordingServiceHelper {
|
||||
}
|
||||
|
||||
private Recording getInfo(GPathResult rec) {
|
||||
Recording r = new Recording();
|
||||
Recording r = new Recording();
|
||||
r.setId(rec.id.text());
|
||||
r.setState(rec.state.text());
|
||||
r.setPublished(Boolean.parseBoolean(rec.published.text()));
|
||||
@ -82,7 +82,6 @@ public class RecordingServiceHelperImp implements RecordingServiceHelper {
|
||||
meta.put(anode.name().toString(), anode.text().toString());
|
||||
}
|
||||
r.setMetadata(meta);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,12 @@ public class MeetingService {
|
||||
}
|
||||
public void setPublishRecording(ArrayList<String> idList,boolean publish){
|
||||
for(String id:idList){
|
||||
recordingService.publish(id, publish);
|
||||
recordingService.publish(id,publish);
|
||||
}
|
||||
}
|
||||
public void deleteRecordings(ArrayList<String> idList){
|
||||
for(String id:idList){
|
||||
recordingService.delete(id);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -110,28 +110,33 @@ public class RecordingService {
|
||||
}
|
||||
|
||||
public void publish(String recordingId, boolean publish) {
|
||||
publish(publishedDir, recordingId, publish);
|
||||
publish(unpublishedDir, recordingId, publish);
|
||||
if(publish)
|
||||
publish(unpublishedDir, recordingId, publish);
|
||||
else
|
||||
publish(publishedDir, recordingId, publish);
|
||||
}
|
||||
|
||||
private void publish(String path, String recordingId, boolean publish) {
|
||||
String[] format = getPlaybackFormats(path);
|
||||
for (int i = 0; i < format.length; i++) {
|
||||
File[] recordings = getDirectories(path + File.pathSeparatorChar + format[i]);
|
||||
File[] recordings = getDirectories(path + File.separatorChar + format[i]);
|
||||
for (int f = 0; f < recordings.length; f++) {
|
||||
if (recordings[f].getName().equals(recordingId)) {
|
||||
Recording r = getRecordingInfo(recordingId, path, format[i]);
|
||||
if (recordings[f].getName().equalsIgnoreCase(recordingId)) {
|
||||
Recording r = getRecordingInfo(path, recordingId, format[i]);
|
||||
if (r != null) {
|
||||
log.debug("Recording is NOT Null!");
|
||||
File dest;
|
||||
if (publish) {
|
||||
dest = new File(publishedDir);
|
||||
dest = new File(publishedDir+ File.separatorChar + format[i]);
|
||||
} else {
|
||||
dest = new File(unpublishedDir);
|
||||
dest = new File(unpublishedDir+ File.separatorChar + format[i]);
|
||||
}
|
||||
if(!dest.exists()) dest.mkdir();
|
||||
boolean moved = recordings[f].renameTo(new File(dest, recordings[f].getName()));
|
||||
if (moved) {
|
||||
log.debug("Recording successfully moved!");
|
||||
r.setPublished(publish);
|
||||
recordingServiceHelper.writeRecordingInfo(dest.getAbsolutePath() + File.pathSeparatorChar + recordings[f].getName(), r);
|
||||
recordingServiceHelper.writeRecordingInfo(dest.getAbsolutePath() + File.separatorChar + recordings[f].getName(), r);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -147,7 +152,7 @@ public class RecordingService {
|
||||
private void deleteRecording(String id, String path) {
|
||||
String[] format = getPlaybackFormats(path);
|
||||
for (int i = 0; i < format.length; i++) {
|
||||
File[] recordings = getDirectories(path + File.pathSeparatorChar + format[i]);
|
||||
File[] recordings = getDirectories(path + File.separatorChar + format[i]);
|
||||
for (int f = 0; f < recordings.length; f++) {
|
||||
if (recordings[f].getName().equals(id)) {
|
||||
deleteDirectory(recordings[f]);
|
||||
|
Loading…
Reference in New Issue
Block a user