You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openmeetings.apache.org by es...@apache.org on 2012/03/09 13:42:57 UTC
svn commit: r1298811 [2/3] - in
/incubator/openmeetings/branches/confluence-plugin: ./ .settings/ src/
src/main/ src/main/java/ src/main/java/com/ src/main/java/com/openmeetings/
src/main/java/com/openmeetings/confluence/ src/main/java/com/openmeetings...
Added: incubator/openmeetings/branches/confluence-plugin/src/main/java/com/openmeetings/confluence/plugins/ao/omrooms/Room.java
URL: http://svn.apache.org/viewvc/incubator/openmeetings/branches/confluence-plugin/src/main/java/com/openmeetings/confluence/plugins/ao/omrooms/Room.java?rev=1298811&view=auto
==============================================================================
--- incubator/openmeetings/branches/confluence-plugin/src/main/java/com/openmeetings/confluence/plugins/ao/omrooms/Room.java (added)
+++ incubator/openmeetings/branches/confluence-plugin/src/main/java/com/openmeetings/confluence/plugins/ao/omrooms/Room.java Fri Mar 9 12:42:56 2012
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License") + you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.openmeetings.confluence.plugins.ao.omrooms;
+
+import net.java.ao.Entity;
+import net.java.ao.Preload;
+
+@Preload
+public interface Room extends Entity
+{
+ String getName();
+
+ void setName(String name);
+
+ Long getNumberOfParticipent();
+
+ void setNumberOfParticipent(Long numberOfParticipent);
+
+ Long getRoomType();
+
+ void setRoomType(Long roomType);
+
+ boolean getIsModeratedRoom();
+
+ void setIsModeratedRoom(boolean isModeratedRoom);
+
+ boolean getIsAudioOnly();
+
+ void setIsAudioOnly(boolean isAudioOnly);
+
+ boolean getIsAllowedRecording();
+
+ void setIsAllowedRecording(boolean isAllowedRecording);
+
+ boolean getIsDeleted();
+
+ void setIsDeleted(boolean isDeleted);
+
+ Long getRoomId();
+
+ void setRoomId(Long roomId);
+
+ String getCreatedByUserName();
+
+ void setCreatedByUserName(String createdByUserName);
+}
Added: incubator/openmeetings/branches/confluence-plugin/src/main/java/com/openmeetings/confluence/plugins/ao/omrooms/RoomService.java
URL: http://svn.apache.org/viewvc/incubator/openmeetings/branches/confluence-plugin/src/main/java/com/openmeetings/confluence/plugins/ao/omrooms/RoomService.java?rev=1298811&view=auto
==============================================================================
--- incubator/openmeetings/branches/confluence-plugin/src/main/java/com/openmeetings/confluence/plugins/ao/omrooms/RoomService.java (added)
+++ incubator/openmeetings/branches/confluence-plugin/src/main/java/com/openmeetings/confluence/plugins/ao/omrooms/RoomService.java Fri Mar 9 12:42:56 2012
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License") + you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.openmeetings.confluence.plugins.ao.omrooms;
+
+import com.atlassian.activeobjects.tx.Transactional;
+
+import java.util.List;
+
+@Transactional
+public interface RoomService
+{
+ Room add(boolean isAllowedRecording, boolean isAudioOnly, boolean isModeratedRoom,
+ String name, Long numberOfParticipent, Long roomType, Long roomId, String createdByUserName);
+
+ Room update(Integer id, boolean isAllowedRecording, boolean isAudioOnly, boolean isModeratedRoom,
+ String name, Long numberOfParticipent, Long roomType);
+
+ Room delete(Integer id);
+
+ Room getRoom(Integer id);
+
+ List<Room> all();
+
+ List<Room> allNotDeleted();
+
+ List<Room> allNotDeletedByUserName(String userName);
+}
\ No newline at end of file
Added: incubator/openmeetings/branches/confluence-plugin/src/main/java/com/openmeetings/confluence/plugins/ao/omrooms/RoomServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/openmeetings/branches/confluence-plugin/src/main/java/com/openmeetings/confluence/plugins/ao/omrooms/RoomServiceImpl.java?rev=1298811&view=auto
==============================================================================
--- incubator/openmeetings/branches/confluence-plugin/src/main/java/com/openmeetings/confluence/plugins/ao/omrooms/RoomServiceImpl.java (added)
+++ incubator/openmeetings/branches/confluence-plugin/src/main/java/com/openmeetings/confluence/plugins/ao/omrooms/RoomServiceImpl.java Fri Mar 9 12:42:56 2012
@@ -0,0 +1,121 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License") + you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.openmeetings.confluence.plugins.ao.omrooms;
+
+import com.atlassian.activeobjects.external.ActiveObjects;
+import com.openmeetings.confluence.plugins.servlet.RoomsServlet;
+
+import java.util.List;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import net.java.ao.Query;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.collect.Lists.newArrayList;
+
+public final class RoomServiceImpl implements RoomService
+{
+ private final ActiveObjects ao;
+ private static final Logger log = LoggerFactory.getLogger(RoomServiceImpl.class);
+
+ public RoomServiceImpl(ActiveObjects ao)
+ {
+ this.ao = checkNotNull(ao);
+ }
+
+ @Override
+ public Room add(boolean isAllowedRecording, boolean isAudioOnly, boolean isModeratedRoom,
+ String name, Long numberOfParticipent, Long roomType, Long roomId, String createdByUserName)
+ {
+ final Room room = ao.create(Room.class);
+
+ room.setIsAllowedRecording(isAllowedRecording);
+ room.setIsAudioOnly(isAudioOnly);
+ room.setIsModeratedRoom(isModeratedRoom);
+ room.setName(name);
+ room.setNumberOfParticipent(numberOfParticipent);
+ room.setRoomType(roomType);
+ room.setRoomId(roomId);
+ room.setCreatedByUserName(createdByUserName);
+ room.setIsDeleted(false);
+ room.save();
+ return room;
+ }
+
+ @Override
+ public List<Room> all()
+ {
+ return newArrayList(ao.find(Room.class));
+ }
+
+ @Override
+ public List<Room> allNotDeleted()
+ {
+ //return newArrayList(ao.find(Room.class, Query.select().where("IS_DELETED LIKE ?", false)));
+ return newArrayList(ao.find(Room.class, Query.select().where("isdeleted LIKE ?", false)));
+ }
+
+ @Override
+ public List<Room> allNotDeletedByUserName(String userName) {
+
+ return newArrayList(ao.find(Room.class, Query.select().
+ where("IS_DELETED = ? AND CREATED_BY_USER_NAME = ?",false, userName.toString()).limit(1000)));
+
+ //return newArrayList(ao.find(Room.class,"IS_DELETED LIKE ? AND CREATED_BY_USER_NAME = ?", false, userName));
+
+ }
+
+ @Override
+ public Room update(Integer id, boolean isAllowedRecording,
+ boolean isAudioOnly, boolean isModeratedRoom, String name,
+ Long numberOfParticipent, Long roomType) {
+
+ final Room room = ao.get(Room.class, id);
+
+ room.setIsAllowedRecording(isAllowedRecording);
+ room.setIsAudioOnly(isAudioOnly);
+ room.setIsModeratedRoom(isModeratedRoom);
+ room.setName(name);
+ room.setNumberOfParticipent(numberOfParticipent);
+ room.setRoomType(roomType);
+ room.save();
+ return room;
+
+ }
+
+ @Override
+ public Room delete(Integer id) {
+
+ final Room room = ao.get(Room.class, id);
+
+ room.setIsDeleted(true);
+ room.save();
+
+ return room;
+ }
+
+ @Override
+ public Room getRoom(Integer id) {
+
+ final Room room = ao.get(Room.class, id);
+ return room;
+ }
+}
Added: incubator/openmeetings/branches/confluence-plugin/src/main/java/com/openmeetings/confluence/plugins/gateway/OmGateway.java
URL: http://svn.apache.org/viewvc/incubator/openmeetings/branches/confluence-plugin/src/main/java/com/openmeetings/confluence/plugins/gateway/OmGateway.java?rev=1298811&view=auto
==============================================================================
--- incubator/openmeetings/branches/confluence-plugin/src/main/java/com/openmeetings/confluence/plugins/gateway/OmGateway.java (added)
+++ incubator/openmeetings/branches/confluence-plugin/src/main/java/com/openmeetings/confluence/plugins/gateway/OmGateway.java Fri Mar 9 12:42:56 2012
@@ -0,0 +1,191 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License") + you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.openmeetings.confluence.plugins.gateway;
+
+import java.util.LinkedHashMap;
+import org.dom4j.Element;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.openmeetings.confluence.plugins.ao.adminconfiguration.OmPluginSettings;
+
+public class OmGateway {
+
+ private static final Logger log = LoggerFactory.getLogger(OmGateway.class);
+
+ private OmRestService omRestService;
+ private OmPluginSettings omPluginSettings;
+ private String sessionId;
+
+ public OmGateway(OmRestService omRestService,
+ OmPluginSettings omPluginSettings) {
+ this.omRestService = omRestService;
+ this.omPluginSettings = omPluginSettings;
+ }
+
+ public Boolean loginUser() throws Exception{
+
+ LinkedHashMap<String, Element> result=null;
+
+ String url = (String)omPluginSettings.getSomeInfo("url");
+ String port = (String)omPluginSettings.getSomeInfo("port");
+ String userpass = (String)omPluginSettings.getSomeInfo("userpass");
+ String omusername = (String)omPluginSettings.getSomeInfo("username");
+
+ String sessionURL = "http://"+url+":"+port+"/openmeetings/services/UserService/getSession";
+
+ LinkedHashMap<String,Element> elementMap = omRestService.call(sessionURL, null);
+
+ Element item = elementMap.get("return");
+
+ this.setSessionId(item.elementText("session_id"));
+
+ log.info(item.elementText("session_id"));
+
+ result = omRestService.call("http://"+url+":"+port+"/openmeetings/services/UserService/loginUser?SID="+this.getSessionId()+"&username="+omusername+"&userpass="+userpass, null);
+
+
+ if (Integer.valueOf(result.get("return").getStringValue())>0){
+ return true;
+ } else {
+ return false;
+ }
+
+ }
+
+ public Long addRoomWithModerationExternalTypeAndTopBarOption( Boolean isAllowedRecording,
+ Boolean isAudioOnly,
+ Boolean isModeratedRoom,
+ String name,
+ Long numberOfParticipent,
+ Long roomType,
+ String externalRoomType
+ ) throws Exception{
+
+ String url = (String)omPluginSettings.getSomeInfo("url");
+ String port = (String)omPluginSettings.getSomeInfo("port");
+
+ String roomId ="";
+
+ String restURL = "http://"+url+":"+port+"/openmeetings/services/RoomService/addRoomWithModerationExternalTypeAndTopBarOption?" +
+ "SID="+this.getSessionId()+
+ "&name="+name+
+ "&roomtypes_id="+roomType.toString()+
+ "&comment=jira"+
+ "&numberOfPartizipants="+numberOfParticipent.toString()+
+ "&ispublic=false"+
+ "&appointment=false"+
+ "&isDemoRoom=false"+
+ "&demoTime="+
+ "&isModeratedRoom="+isModeratedRoom.toString()+
+ "&externalRoomType="+externalRoomType+
+ "&allowUserQuestions="+
+ "&isAudioOnly="+isAudioOnly.toString()+
+ "&waitForRecording=false"+
+ "&allowRecording="+isAllowedRecording.toString()+
+ "&hideTopBar=false";
+
+ LinkedHashMap<String, Element> result = omRestService.call(restURL, null);
+
+ roomId = result.get("return").getStringValue();
+ return Long.valueOf(roomId);
+ }
+
+ public Long updateRoomWithModerationAndQuestions( Boolean isAllowedRecording,
+ Boolean isAudioOnly,
+ Boolean isModeratedRoom,
+ String roomname,
+ Long numberOfParticipent,
+ Long roomType,
+ Long roomId
+ ) throws Exception{
+
+ String url = (String)omPluginSettings.getSomeInfo("url");
+ String port = (String)omPluginSettings.getSomeInfo("port");
+ String updateRoomId = "";
+
+ String restURL = "http://"+url+":"+port+"/openmeetings/services/RoomService/updateRoomWithModerationAndQuestions?" +
+ "SID="+this.getSessionId()+
+ "&room_id="+roomId.toString()+
+ "&name="+roomname.toString()+
+ "&roomtypes_id="+roomType.toString()+
+ "&comment="+
+ "&numberOfPartizipants="+numberOfParticipent.toString()+
+ "&ispublic=false"+
+ "&appointment=false"+
+ "&isDemoRoom=false"+
+ "&demoTime="+
+ "&isModeratedRoom="+isModeratedRoom.toString()+
+ "&allowUserQuestions=";
+
+ //Is not available for update method
+// "&externalRoomType=jira"+
+// "&isAudioOnly="+isAudioOnly+
+// "&waitForRecording=false"+
+// "&allowRecording="+isAllowedRecording+
+// "&hideTopBar=false";
+
+ LinkedHashMap<String, Element> result = omRestService.call(restURL, null);
+
+ log.info("addRoomWithModerationExternalTypeAndTopBarOption with ID: ",result.get("return").getStringValue());
+
+ updateRoomId = result.get("return").getStringValue();
+
+ return Long.valueOf(updateRoomId);
+ }
+
+ public String setUserObjectAndGenerateRoomHash (String username , String firstname ,
+ String lastname , String profilePictureUrl , String email , Long externalUserId ,
+ String externalUserType , Long room_id , int becomeModeratorAsInt , int showAudioVideoTestAsInt )
+ throws Exception
+ {
+ String url = (String)omPluginSettings.getSomeInfo("url");
+ String port = (String)omPluginSettings.getSomeInfo("port");
+ String roomHash = null;
+
+ String restURL = "http://"+url+":"+port+"/openmeetings/services/UserService/setUserObjectAndGenerateRoomHash?" +
+ "SID="+this.getSessionId()+
+ "&username="+username+
+ "&firstname="+firstname+
+ "&lastname="+lastname+
+ "&profilePictureUrl="+profilePictureUrl+
+ "&email="+email+
+ "&externalUserId="+externalUserId+
+ "&externalUserType="+externalUserType+
+ "&room_id="+room_id+
+ "&becomeModeratorAsInt="+becomeModeratorAsInt+
+ "&showAudioVideoTestAsInt="+showAudioVideoTestAsInt;
+
+
+ LinkedHashMap<String, Element> result = omRestService.call(restURL, null);
+
+ roomHash = result.get("return").getStringValue();
+
+ return roomHash;
+ }
+
+ public String getSessionId() {
+ return sessionId;
+ }
+
+ public void setSessionId(String sessionId) {
+ this.sessionId = sessionId;
+ }
+
+}
Added: incubator/openmeetings/branches/confluence-plugin/src/main/java/com/openmeetings/confluence/plugins/gateway/OmRestService.java
URL: http://svn.apache.org/viewvc/incubator/openmeetings/branches/confluence-plugin/src/main/java/com/openmeetings/confluence/plugins/gateway/OmRestService.java?rev=1298811&view=auto
==============================================================================
--- incubator/openmeetings/branches/confluence-plugin/src/main/java/com/openmeetings/confluence/plugins/gateway/OmRestService.java (added)
+++ incubator/openmeetings/branches/confluence-plugin/src/main/java/com/openmeetings/confluence/plugins/gateway/OmRestService.java Fri Mar 9 12:42:56 2012
@@ -0,0 +1,187 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License") + you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.openmeetings.confluence.plugins.gateway;
+
+import java.io.BufferedReader;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.UnsupportedEncodingException;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URL;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+
+import javax.servlet.ServletException;
+import javax.ws.rs.core.UriBuilder;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.xpath.XPathExpressionException;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.dom4j.Document;
+import org.dom4j.DocumentException;
+import org.dom4j.Element;
+import org.dom4j.io.SAXReader;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.xml.sax.SAXException;
+
+
+public class OmRestService {
+
+ private static final Logger log = LoggerFactory.getLogger(OmRestService.class);
+
+ private URI getURI(String url) {
+ return UriBuilder.fromUri(
+ url).build();
+ }
+
+ private String getEncodetURI(String url) throws MalformedURLException {
+
+ return new URL(url).toString().replaceAll(" ","%20");
+ }
+
+ public LinkedHashMap<String, Element> call(String request, Object param) throws Exception
+ {
+ HttpClient client = new HttpClient();
+ GetMethod method = null;
+
+ try {
+ method = new GetMethod(getEncodetURI(request).toString());
+ } catch (MalformedURLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ int statusCode = 0;
+ try {
+ statusCode = client.executeMethod(method);
+ } catch (HttpException e) {
+ // TODO Auto-generated catch block
+ //e.printStackTrace();
+ throw new Exception("Connection to OpenMeetings refused. Please check your OpenMeetings configuration.");
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ //e.printStackTrace();
+ throw new Exception("Connection to OpenMeetings refused. Please check your OpenMeetings configuration.");
+ }
+
+
+ switch (statusCode) {
+
+ case 200: {
+ //System.out.println("Success connection");
+ break;
+ }
+ case 400: {
+ throw new Exception("Bad request. The parameters passed to the service did not match as expected. The Message should tell you what was missing or incorrect.");
+
+ //System.out.println("Bad request. The parameters passed to the service did not match as expected. The Message should tell you what was missing or incorrect.");
+
+ //break;
+
+ }
+ case 403: {
+ throw new Exception("Forbidden. You do not have permission to access this resource, or are over your rate limit.");
+
+ //System.out.println("Forbidden. You do not have permission to access this resource, or are over your rate limit.");
+
+ //break;
+
+ }
+ case 503: {
+ throw new Exception("Service unavailable. An internal problem prevented us from returning data to you.");
+
+ //System.out.println("Service unavailable. An internal problem prevented us from returning data to you.");
+
+ //break;
+
+ }
+ default:{
+ throw new Exception("Your call to OpenMeetings! Web Services returned an unexpected HTTP status of: " + statusCode);
+
+ //System.out.println("Your call to OpenMeetings! Web Services returned an unexpected HTTP status of: " + statusCode);
+ }
+
+ }
+
+
+ InputStream rstream = null;
+
+ try {
+ rstream = method.getResponseBodyAsStream();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ throw new Exception("No Response Body");
+
+ }
+
+ BufferedReader br = new BufferedReader(new InputStreamReader(rstream));
+
+ SAXReader reader = new SAXReader();
+ String line;
+ Document document = null;
+ try {
+ while ((line = br.readLine()) != null) {
+ document = reader.read(new ByteArrayInputStream(line.getBytes("UTF-8")));
+ //System.out.println("line"+line);
+
+ }
+ } catch (UnsupportedEncodingException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ throw new Exception("UnsupportedEncodingException by SAXReader");
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ throw new Exception("IOException by SAXReader in REST Service");
+ } catch (DocumentException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ throw new Exception("DocumentException by SAXReader in REST Service");
+ }finally{
+ br.close();
+ }
+
+ Element root = document.getRootElement();
+
+ LinkedHashMap<String,Element> elementMap = new LinkedHashMap<String,Element>();
+
+ for ( @SuppressWarnings("unchecked")Iterator<Element> i = root.elementIterator(); i.hasNext(); ) {
+
+
+ Element item = i.next();
+
+ if(item.getNamespacePrefix()=="soapenv"){
+ throw new Exception(item.getData().toString());
+ }else{
+ String nodeVal = item.getName();
+ elementMap.put(nodeVal, item);
+ }
+ }
+
+ return elementMap;
+
+ }
+
+}
Added: incubator/openmeetings/branches/confluence-plugin/src/main/java/com/openmeetings/confluence/plugins/servlet/AdminServlet.java
URL: http://svn.apache.org/viewvc/incubator/openmeetings/branches/confluence-plugin/src/main/java/com/openmeetings/confluence/plugins/servlet/AdminServlet.java?rev=1298811&view=auto
==============================================================================
--- incubator/openmeetings/branches/confluence-plugin/src/main/java/com/openmeetings/confluence/plugins/servlet/AdminServlet.java (added)
+++ incubator/openmeetings/branches/confluence-plugin/src/main/java/com/openmeetings/confluence/plugins/servlet/AdminServlet.java Fri Mar 9 12:42:56 2012
@@ -0,0 +1,162 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License") + you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.openmeetings.confluence.plugins.servlet;
+
+import java.io.IOException;
+import java.net.URI;
+import java.util.Map;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import com.atlassian.crowd.embedded.api.User;
+import com.atlassian.sal.api.auth.LoginUriProvider;
+import com.atlassian.sal.api.user.UserManager;
+import com.atlassian.templaterenderer.TemplateRenderer;
+import com.google.common.collect.Maps;
+import com.openmeetings.confluence.plugins.ao.adminconfiguration.OmPluginSettings;
+
+
+public class AdminServlet extends HttpServlet
+{
+ private static final Logger log = LoggerFactory.getLogger(AdminServlet.class);
+
+ private final UserManager userManager;
+ private TemplateRenderer templateRenderer;
+ private final LoginUriProvider loginUriProvider;
+
+ private OmPluginSettings omPluginSettings;
+
+ private static final String OM_CONFIG_TEMPLATE = "/templates/config/omconfig.vm";
+
+ public AdminServlet( TemplateRenderer templateRenderer,
+ UserManager userManager,
+ OmPluginSettings omPluginSettings,
+ LoginUriProvider loginUriProvider)
+ {
+ this.userManager = userManager;
+ this.templateRenderer = templateRenderer;
+ this.omPluginSettings = omPluginSettings;
+ this.loginUriProvider = loginUriProvider;
+
+
+ }
+
+ @Override
+ public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
+ {
+ String username = userManager.getRemoteUsername(request);
+ if (username != null && !userManager.isSystemAdmin(username))
+ {
+ redirectToLogin(request, response);
+ return;
+ }else if(username == null){
+ redirectToLogin(request, response);
+ return;
+ }
+
+ /////////
+ if ("y".equals(request.getParameter("new"))) {
+ // Renders new.vm template if the "new" parameter is passed
+
+ // Create an empty context map to pass into the render method
+ Map<String, Object> context = Maps.newHashMap();
+ // Make sure to set the contentType otherwise bad things happen
+ response.setContentType("text/html;charset=utf-8");
+ // Render the velocity template (new.vm). Since the new.vm template
+ // doesn't need to render any in dynamic content, we just pass it an empty context
+ //templateRenderer.render(NEW_BROWSER_TEMPLATE, context, response.getWriter());
+ } else if ("y".equals(request.getParameter("edit"))) {
+
+ } else {
+
+ String url;
+ String port;
+ String userpass;
+ String omusername;
+ String key;
+
+ if( omPluginSettings.getSomeInfo("url") == null){
+ url = "localhost";
+ port = "5080";
+ userpass = "admin";
+ omusername = "admin";
+ key = "Jira";
+ }else{
+ url = (String)omPluginSettings.getSomeInfo("url");
+ port = (String)omPluginSettings.getSomeInfo("port");
+ userpass = (String)omPluginSettings.getSomeInfo("userpass");
+ omusername = (String)omPluginSettings.getSomeInfo("username");
+ key = (String)omPluginSettings.getSomeInfo("key");
+ }
+
+ Map<String, Object> context = Maps.newHashMap();
+
+ context.put("url", url);
+ context.put("port", port);
+ context.put("username", omusername);
+ context.put("userpass", userpass);
+ context.put("key", key);
+
+ response.setContentType("text/html;charset=utf-8");
+ // Render the template with the issue inside the context
+ templateRenderer.render(OM_CONFIG_TEMPLATE, context, response.getWriter());
+ }
+
+ }
+
+ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+
+ String url = request.getParameter("url");
+ String port = request.getParameter("port");
+ String userpass = request.getParameter("userpass");
+ String username = request.getParameter("username");
+ String key = request.getParameter("key");
+
+ omPluginSettings.storeSomeInfo("url", url);
+ omPluginSettings.storeSomeInfo("port", port);
+ omPluginSettings.storeSomeInfo("userpass", userpass);
+ omPluginSettings.storeSomeInfo("username", username);
+ omPluginSettings.storeSomeInfo("key", key);
+
+ //response.sendRedirect(request.getContextPath() + "/plugins/servlet/openmeetingsadmin");
+ response.sendRedirect(request.getContextPath() + "/secure/AdminSummary.jspa");
+
+ }
+
+
+ private void redirectToLogin(HttpServletRequest request, HttpServletResponse response) throws IOException
+ {
+ response.sendRedirect(loginUriProvider.getLoginUri(getUri(request)).toASCIIString());
+ }
+
+ private URI getUri(HttpServletRequest request)
+ {
+ StringBuffer builder = request.getRequestURL();
+ if (request.getQueryString() != null)
+ {
+ builder.append("?");
+ builder.append(request.getQueryString());
+ }
+ return URI.create(builder.toString());
+ }
+
+}
Added: incubator/openmeetings/branches/confluence-plugin/src/main/java/com/openmeetings/confluence/plugins/servlet/RoomsServlet.java
URL: http://svn.apache.org/viewvc/incubator/openmeetings/branches/confluence-plugin/src/main/java/com/openmeetings/confluence/plugins/servlet/RoomsServlet.java?rev=1298811&view=auto
==============================================================================
--- incubator/openmeetings/branches/confluence-plugin/src/main/java/com/openmeetings/confluence/plugins/servlet/RoomsServlet.java (added)
+++ incubator/openmeetings/branches/confluence-plugin/src/main/java/com/openmeetings/confluence/plugins/servlet/RoomsServlet.java Fri Mar 9 12:42:56 2012
@@ -0,0 +1,361 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License") + you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.openmeetings.confluence.plugins.servlet;
+
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.io.IOException;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.xpath.XPathExpressionException;
+import org.dom4j.DocumentException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.xml.sax.SAXException;
+
+import com.atlassian.confluence.user.AuthenticatedUserThreadLocal;
+import com.atlassian.crowd.embedded.api.User;
+import com.atlassian.sal.api.user.UserManager;
+import com.atlassian.templaterenderer.TemplateRenderer;
+import com.google.common.collect.Maps;
+import com.openmeetings.confluence.plugins.ao.adminconfiguration.OmPluginSettings;
+import com.openmeetings.confluence.plugins.ao.omrooms.Room;
+import com.openmeetings.confluence.plugins.ao.omrooms.RoomService;
+import com.openmeetings.confluence.plugins.gateway.OmGateway;
+
+
+public final class RoomsServlet extends HttpServlet
+{
+ private static final Logger log = LoggerFactory.getLogger(RoomsServlet.class);
+
+ private final RoomService roomService;
+ private TemplateRenderer templateRenderer;
+ private OmGateway omGateway;
+ private UserManager userManager;
+ //protected final VelocityRequestContextFactory requestContextFactory;
+ private OmPluginSettings omPluginSettings;
+ ///private final AvatarManager avatarManager;
+
+ private ArrayList<Exception> errors = new ArrayList<Exception>();;
+
+
+
+ private static final String LIST_BROWSER_TEMPLATE = "/templates/omrooms/list.vm";
+ private static final String NEW_BROWSER_TEMPLATE = "/templates/omrooms/new.vm";
+ private static final String EDIT_BROWSER_TEMPLATE = "/templates/omrooms/edit.vm";
+ private static final String ENTER_BROWSER_TEMPLATE = "/templates/omrooms/enter.vm";
+
+ public RoomsServlet(OmPluginSettings omPluginSettings, RoomService roomService, TemplateRenderer templateRenderer, OmGateway omGateway, UserManager userManager)
+ {
+ this.roomService = checkNotNull(roomService);
+ this.templateRenderer = templateRenderer;
+ this.omGateway = omGateway;
+ this.userManager = userManager;
+ this.omPluginSettings = omPluginSettings;
+
+ }
+
+ public String getCanonicalBaseUrl() {
+ return "";
+ //return this.requestContextFactory.getJiraVelocityRequestContext().getCanonicalBaseUrl();
+ }
+
+ private User getCurrentUser(HttpServletRequest req) {
+ // To get the current user, we first get the username from the session.
+ // Then we pass that over to the jiraUserManager in order to get an
+ // actual User object.
+ return (User) AuthenticatedUserThreadLocal.getUser();//jiraUserManager.getUserObject(userManager.getRemoteUsername(req));
+ }
+
+
+ @Override
+ protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
+ {
+ User currentUser = getCurrentUser(req);
+ //ArrayList<Exception> errors = new ArrayList<Exception>();
+ String roomURL = "";
+
+ //User currentUser2 = ComponentManager.getInstance().getJiraAuthenticationContext().getLoggedInUser();
+
+ if ("y".equals(req.getParameter("new"))) {
+ // Renders new.vm template if the "new" parameter is passed
+ // Create an empty context map to pass into the render method
+ Map<String, Object> context = Maps.newHashMap();
+ // Make sure to set the contentType otherwise bad things happen
+ res.setContentType("text/html;charset=utf-8");
+ // Render the velocity template (new.vm). Since the new.vm template
+ // doesn't need to render any in dynamic content, we just pass it an empty context
+ templateRenderer.render(NEW_BROWSER_TEMPLATE, context, res.getWriter());
+
+ }else if("y".equals(req.getParameter("edit"))){
+ // Renders edit.vm template if the "edit" parameter is passed
+ Integer id = Integer.valueOf(req.getParameter("key"));
+ Room room = roomService.getRoom(id);
+
+ Map<String, Object> context = Maps.newHashMap();
+ context.put("room", room);
+ res.setContentType("text/html;charset=utf-8");
+ // Render the template with the issue inside the context
+ templateRenderer.render(EDIT_BROWSER_TEMPLATE, context, res.getWriter());
+ }else if("y".equals(req.getParameter("delete"))){
+ Integer id = Integer.valueOf(req.getParameter("key"));
+ roomService.delete(id);
+ res.sendRedirect(req.getContextPath() + "/plugins/servlet/openmeetingsrooms");
+ }else if("y".equals(req.getParameter("enter"))){
+ try {
+ if(omGateway.loginUser()){
+
+ String username = "";
+ String firsname = "";
+ Long userId = 0L;
+ String email = "";
+ int becomeModeratorAsInt = 1;
+ int showAudioVideoTestAsInt = 1;
+
+ String url = (String)omPluginSettings.getSomeInfo("url");
+ String port = (String)omPluginSettings.getSomeInfo("port");
+ String externalUserType = (String)omPluginSettings.getSomeInfo("key");
+
+ if(currentUser == null){
+ firsname = "anonymous";
+ email = "";
+ userId = new Date().getTime();
+ username = "anonymous";
+ becomeModeratorAsInt = 0;
+ showAudioVideoTestAsInt = 1;
+ }else{
+ firsname = currentUser.getDisplayName();
+ email = currentUser.getEmailAddress();
+ userId = new Date().getTime();
+ username = currentUser.getName();
+ becomeModeratorAsInt = 1;
+ showAudioVideoTestAsInt = 1;
+ }
+ String avatarId = "1";//this.avatarManager.getDefaultAvatarId(Avatar.Type.USER).toString();
+ //URI avatarUrl = avatarService.getAvatarURL(currentUser, avatarId, Avatar.Size.SMALL);
+ //String profilePictureUrl = avatarUrl.toString();
+ String profilePictureUrl = this.getCanonicalBaseUrl() + "/secure/projectavatar?avatarId=" + avatarId + "&size=small";
+
+ Long roomId = Long.valueOf(req.getParameter("roomId"));
+
+ String roomHash = omGateway.setUserObjectAndGenerateRoomHash(username, firsname, "", profilePictureUrl,
+ email, userId, externalUserType, roomId,
+ becomeModeratorAsInt,
+ showAudioVideoTestAsInt);
+
+
+ if(!roomHash.isEmpty()){
+
+ roomURL = "http://"+url+":"+port+
+ "/openmeetings/?"+
+ "scopeRoomId=" + roomId +
+ "&secureHash=" +roomHash+
+ "&language=1"+
+ "&lzproxied=solo";
+
+ }
+
+ }else{
+
+ this.errors.add(new Exception("Could not login User to OpenMeetings, check your OpenMeetings plugin configuration"));
+ }
+
+
+ } catch (XPathExpressionException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ this.errors.add(e);
+ } catch (SAXException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ this.errors.add(e);
+ } catch (ParserConfigurationException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ this.errors.add(e);
+ } catch (DocumentException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ this.errors.add(e);
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ this.errors.add(e);
+ }
+
+ Map<String, Object> context = Maps.newHashMap();
+
+ context.put("roomURL", roomURL);
+ context.put("errors", this.errors);
+ res.setContentType("text/html;charset=utf-8");
+ // Pass in the list of rooms as the context
+ templateRenderer.render(ENTER_BROWSER_TEMPLATE, context, res.getWriter());
+ this.errors.clear();
+ }else {
+ // Render the list of issues (list.vm) if no params are passed in
+ //List<Room> rooms = roomService.allNotDeleted();
+ //List<Room> rooms = roomService.all();
+ List<Room> rooms = roomService.allNotDeletedByUserName(currentUser.getName());
+ Map<String, Object> context = Maps.newHashMap();
+ context.put("errors", this.errors);
+ context.put("rooms", rooms);
+ res.setContentType("text/html;charset=utf-8");
+ // Pass in the list of rooms as the context
+ templateRenderer.render(LIST_BROWSER_TEMPLATE, context, res.getWriter());
+ this.errors.clear();
+ }
+
+ }
+
+ @Override
+ protected void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
+ {
+ User currentUser = getCurrentUser(req);
+ //Second variant to get current user object.
+ //User currentUser2 = ComponentManager.getInstance().getJiraAuthenticationContext().getLoggedInUser();
+ //User user2 = (User) ComponentManager.getInstance().getJiraAuthenticationContext().getUser();
+
+ if ("y".equals(req.getParameter("edit"))) {
+
+ Boolean isAllowedRecording = Boolean.valueOf(req.getParameter("isAllowedRecording"));
+ Boolean isAudioOnly = Boolean.valueOf(req.getParameter("isAudioOnly"));
+ Boolean isModeratedRoom = Boolean.valueOf(req.getParameter("isModeratedRoom"));
+ String roomName = req.getParameter("roomname");
+ Long numberOfParticipent = Long.valueOf(req.getParameter("numberOfParticipent"));
+ Long roomType = Long.valueOf(req.getParameter("roomType"));
+ Integer id = Integer.valueOf(req.getParameter("key"));
+ //Long roomId = Long.valueOf(req.getParameter("roomId"));
+
+ //Get RoomId for updating room from DB
+ Room room = roomService.getRoom(id);
+ Long roomId = room.getRoomId();
+
+ try {
+ if(omGateway.loginUser()){
+
+ roomId = omGateway.updateRoomWithModerationAndQuestions(
+ isAllowedRecording,
+ isAudioOnly,
+ isModeratedRoom,
+ roomName,
+ numberOfParticipent,
+ roomType,
+ roomId);
+
+ roomService.update(id, isAllowedRecording, isAudioOnly, isModeratedRoom, roomName, numberOfParticipent, roomType);
+
+ }else{
+ this.errors.add(new Exception("Could not login User to OpenMeetings, check your OpenMeetings plugin configuration"));
+ }
+ } catch (XPathExpressionException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ this.errors.add(e);
+ } catch (SAXException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ this.errors.add(e);
+ } catch (ParserConfigurationException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (DocumentException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ this.errors.add(e);
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ this.errors.add(e);
+ }
+
+
+ res.sendRedirect(req.getContextPath() + "/plugins/servlet/openmeetingsrooms");
+
+ }else if("y".equals(req.getParameter("delete"))){
+ Integer id = Integer.valueOf(req.getParameter("key"));
+ roomService.delete(id);
+ res.sendRedirect(req.getContextPath() + "/plugins/servlet/openmeetingsrooms");
+ }else{
+
+ Boolean isAllowedRecording = Boolean.valueOf(req.getParameter("isAllowedRecording"));
+ Boolean isAudioOnly = Boolean.valueOf(req.getParameter("isAudioOnly"));
+ Boolean isModeratedRoom = Boolean.valueOf(req.getParameter("isModeratedRoom"));
+ String roomName = req.getParameter("roomname");
+ Long numberOfParticipent = Long.valueOf(req.getParameter("numberOfParticipent"));
+ Long roomType = Long.valueOf(req.getParameter("roomType"));
+ String externalRoomType = (String)omPluginSettings.getSomeInfo("key");
+ Long roomId = 0L;
+
+ try {
+ if(omGateway.loginUser()){
+
+ roomId = omGateway.addRoomWithModerationExternalTypeAndTopBarOption(
+ isAllowedRecording,
+ isAudioOnly,
+ isModeratedRoom,
+ roomName,
+ numberOfParticipent,
+ roomType,
+ externalRoomType
+ );
+
+ roomService.add(isAllowedRecording, isAudioOnly, isModeratedRoom, roomName, numberOfParticipent, roomType, roomId, currentUser.getName());
+
+ }else{
+ this.errors.add(new Exception("Could not login User to OpenMeetings, check your OpenMeetings plugin configuration"));
+ }
+ } catch (XPathExpressionException e) {
+ // TODO Auto-generated catch block
+ this.errors.add(e);
+ e.printStackTrace();
+ } catch (SAXException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ this.errors.add(e);
+ } catch (ParserConfigurationException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ this.errors.add(e);
+ } catch (DocumentException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ this.errors.add(e);
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ this.errors.add(e);
+ }
+
+ //roomService.add(description, true, true, true, "name", 4L, 1L);
+
+ res.sendRedirect(req.getContextPath() + "/plugins/servlet/openmeetingsrooms");
+
+ }
+
+ }
+}
\ No newline at end of file
Added: incubator/openmeetings/branches/confluence-plugin/src/main/resources/atlassian-plugin.properties
URL: http://svn.apache.org/viewvc/incubator/openmeetings/branches/confluence-plugin/src/main/resources/atlassian-plugin.properties?rev=1298811&view=auto
==============================================================================
--- incubator/openmeetings/branches/confluence-plugin/src/main/resources/atlassian-plugin.properties (added)
+++ incubator/openmeetings/branches/confluence-plugin/src/main/resources/atlassian-plugin.properties Fri Mar 9 12:42:56 2012
@@ -0,0 +1,55 @@
+#
+#Tue Feb 21 00:25:25 CET 2012
+room-select-list.description=The OpenMeetings Room Select List Plugin
+room-select-list.name=OpenMeetings Room Select List
+my-class.description=The My Class Plugin
+my-class.name=My Class
+
+openmeetings.admin.label=OpenMeetings Admin
+openmeetings.admin.name.label=Name
+openmeetings.admin.save.label=Save
+
+openmeetings.rooms.conference.label=Conference
+openmeetings.rooms.audience.label=Audience
+openmeetings.rooms.restricted.label=Restricted
+openmeetings.rooms.interview.label=Interview
+
+openmeetings.rooms.edit.conference.label=Conference (max 20 Users recommended, Democratic)
+openmeetings.rooms.edit.audience.label=Audience (max 50 Users recommended, Moderated)
+openmeetings.rooms.edit.restricted.label=Restricted (max 150 Users recommended, Moderated)
+openmeetings.rooms.edit.interview.label=Interview (Only 2 Users, no Whiteboard, Record Audio/Video, Moderated)
+
+
+openmeetings.rooms.yes.label=Yes
+openmeetings.rooms.no.label=No
+
+openmeetings.rooms.roomid.label=RoomId
+openmeetings.rooms.roomname.label=Roomname
+openmeetings.rooms.roomtype.label=Roomtype
+openmeetings.rooms.participent.label=Paricipent
+openmeetings.rooms.ismoderated.label=Is Moderated
+openmeetings.rooms.isaudio.label=Is Audio Only
+
+openmeetings.rooms.roomlist.label=Room List
+openmeetings.rooms.edit.label=Edit
+openmeetings.rooms.delete.label=Delete
+openmeetings.rooms.createnewroom.label=Create New Room
+openmeetings.rooms.create.label=Create
+
+openmeetings.rooms.edit.titel.label=Edit Room
+openmeetings.rooms.cancel.label=Cancel
+
+openmeetings.rooms.enter.label=Link to Web-Conferencing
+openmeetings.rooms.enter.titel.label=Link to Web-Conferencing
+
+openmeetings.config.titel.label=Edit OpenMeetings Configuration
+openmeetings.config.titel.h1.label=OpenMeetings Configuration
+openmeetings.config.server.label=Edit Server Configuration
+openmeetings.config.url.label=URL
+openmeetings.config.port.label=Port
+openmeetings.config.username.label=Username
+openmeetings.config.userpass.label=Userpass
+openmeetings.config.key.label=Key
+
+openmeetings.rooms.enter.titel.label=OpenMeetings Room
+
Added: incubator/openmeetings/branches/confluence-plugin/src/main/resources/atlassian-plugin.xml
URL: http://svn.apache.org/viewvc/incubator/openmeetings/branches/confluence-plugin/src/main/resources/atlassian-plugin.xml?rev=1298811&view=auto
==============================================================================
--- incubator/openmeetings/branches/confluence-plugin/src/main/resources/atlassian-plugin.xml (added)
+++ incubator/openmeetings/branches/confluence-plugin/src/main/resources/atlassian-plugin.xml Fri Mar 9 12:42:56 2012
@@ -0,0 +1,92 @@
+<atlassian-plugin key="${project.groupId}.${project.artifactId}" name="${project.name}" plugins-version="2">
+ <plugin-info>
+ <description>${project.description}</description>
+ <version>${project.version}</version>
+ <vendor name="${project.organization.name}" url="${project.organization.url}" />
+ <param name="configure.url">/plugins/servlet/openmeetingsadmin</param>
+ </plugin-info>
+
+ <macro name="openmeetings-room-link" class="com.openmeetings.confluence.plugins.ExampleMacro" key="openmeetings-room-link">
+ <!-- TODO: Add macro description -->
+ <description>Insert Room Link in page</description>
+
+ <!-- Provides help text for the Confluence notation guide. -->
+ <resource type="velocity" name="enter" location="templates/enter.vm">
+ <param name="help-section" value="confluence"/>
+ </resource>
+ <!-- Specifies which macro browser category this macro should display in. -->
+ <category name="confluence-content"/>
+ <!-- Defines the parameters this macro may consume. -->
+ <parameters>
+ <parameter name="greeting" type="string"/>
+ </parameters>
+ </macro>
+
+ <web-item key="om_config" section="system.admin/configuration">
+ <label>OpenMeetings Setup</label>
+ <link linkId="admin_link" absolute="false">/plugins/servlet/openmeetingsadmin</link>
+ <condition class="com.atlassian.confluence.plugin.descriptor.web.conditions.SystemAdministratorCondition"/>
+ </web-item>
+ <web-section key="my_links_section" name="My Links Main Section" location="my_links_link" weight="10">
+ <!--<condition class="com.atlassian.confluence.plugin.webfragment.conditions.UserLoggedInCondition"/>-->
+ </web-section>
+
+ <!--
+ <web-item key="my_links_link" name="Link on My Links Main Section" section="system.dashboard" weight="47">
+ <label>OpenMeetingsRooms</label>
+ <link linkId="my_links_link"/>
+ </web-item>
+ -->
+
+ <web-item key="website_link_space" name="Rooms Web Site Space" section="system.space" weight="100">
+ <label>My OpenMeetings Rooms</label>
+ <link linkId="rooms_link_space" absolute="false">/plugins/servlet/openmeetingsrooms</link>/>
+ </web-item>
+ <web-item key="website_link_browse" name="Rooms Web Site Browse" section="system.browse" weight="100">
+ <label>My OpenMeetings Rooms</label>
+ <link linkId="rooms_link_browse" absolute="false">/plugins/servlet/openmeetingsrooms</link>/>
+ </web-item>
+ <web-item key="website_link_dashboard" name="Rooms Web Site Dashboard" section="system.dashboard" weight="47">
+ <label>My OpenMeetings Rooms</label>
+ <link linkId="rooms_link_dashboard" absolute="false">/plugins/servlet/openmeetingsrooms</link>/>
+ <!--<condition class="com.atlassian.confluence.plugin.webfragment.conditions.UserLoggedInCondition"/>-->
+ </web-item>
+ <web-item key="create_room_link" name="Create Room Web Site" section="system.content.add/space" weight="10">
+ <label>Create Room</label>
+ <link linkId="create_room_link" absolute="false">/plugins/servlet/openmeetingsrooms?new=y</link>/>
+ </web-item>
+
+ <servlet name="Openmeetings admin" i18n-name-key="openmeetings-admin.name" key="openmeetings-admin" class="com.openmeetings.confluence.plugins.servlet.AdminServlet">
+ <description key="openmeetings-admin.description">The Openmeetings Admin Plugin</description>
+ <url-pattern>/openmeetingsadmin</url-pattern>
+ <!--<condition class="com.atlassian.jira.plugin.webfragment.conditions.UserIsAdminCondition"/>-->
+ </servlet>
+ <servlet name="Openmeetings Rooms" i18n-name-key="openmeetings-room.name" key="openmeetings-room" class="com.openmeetings.confluence.plugins.servlet.RoomsServlet">
+ <description key="openmeetings-room.description">The Openmeetings Rooms Plugin</description>
+ <url-pattern>/openmeetingsrooms</url-pattern>
+ </servlet>
+
+ <resource type="i18n" name="i18n" location="atlassian-plugin"/>
+
+ <component-import key="templateRenderer" interface="com.atlassian.templaterenderer.TemplateRenderer"/>
+ <component-import key="userManager" interface="com.atlassian.sal.api.user.UserManager"/>
+
+ <!--AO to persist chosen admin configuration -->
+ <ao key="openmeetings-ao-module">
+ <description>The module configuring the Active Objects service used by CONFLUENCE-OPENMEETINGS plugin</description>
+ <entity>com.openmeetings.confluence.plugins.ao.omrooms.Room</entity>
+ </ao>
+
+ <component-import key="ao" name="Active Objects components" interface="com.atlassian.activeobjects.external.ActiveObjects">
+ <description>Access to the Active Objects service</description>
+ </component-import>
+ <component-import key="loginUriProvider" interface="com.atlassian.sal.api.auth.LoginUriProvider" />
+ <component-import key="pluginSettingsFactory" interface="com.atlassian.sal.api.pluginsettings.PluginSettingsFactory"/>
+ <component key="tx-processor" name="Transactional Annotation Processor" class="com.atlassian.activeobjects.external.TransactionalAnnotationProcessor">
+ <decription>Processes @Transactional annotations.</decription>
+ </component>
+ <component key="room-service" name="Room Service" class="com.openmeetings.confluence.plugins.ao.omrooms.RoomServiceImpl"/>
+ <component key="omPluginSettings" name="OpenMeetings Plugin Settings" class="com.openmeetings.confluence.plugins.ao.adminconfiguration.OmPluginSettings"/>
+ <component key="omRestService" name="OpenMeetings REST Service" class="com.openmeetings.confluence.plugins.gateway.OmRestService"/>
+ <component key="omGateway" name="OpenMeetings Gateway" class="com.openmeetings.confluence.plugins.gateway.OmGateway"/>
+</atlassian-plugin>
Added: incubator/openmeetings/branches/confluence-plugin/src/main/resources/templates/config/omconfig.vm
URL: http://svn.apache.org/viewvc/incubator/openmeetings/branches/confluence-plugin/src/main/resources/templates/config/omconfig.vm?rev=1298811&view=auto
==============================================================================
--- incubator/openmeetings/branches/confluence-plugin/src/main/resources/templates/config/omconfig.vm (added)
+++ incubator/openmeetings/branches/confluence-plugin/src/main/resources/templates/config/omconfig.vm Fri Mar 9 12:42:56 2012
@@ -0,0 +1,76 @@
+<!--
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<html>
+<head>
+ <title>OpenMeetings Admin — </title>
+ <meta name="decorator" content="atl.admin">
+</head>
+<body class="page-type-admin">
+<div class="admin-headers">
+ <h1 id="admin-page-heading">$i18n.getText("openmeetings.config.titel.h1.label")</h1>
+</div>
+<div class="content-container">
+ <div class="content-body">
+ <div class="create-issue-panel">
+ <form method="post" id="h" action="openmeetingsadmin" class="aui">
+ <div class="field-group">
+ <label for="h-furl">
+ $i18n.getText("openmeetings.config.url.label")
+ <span class="aui-icon icon-required"></span>
+ <span class="content">required</span>
+ </label>
+ <input id="h-furl" class="text long-field" type="text" name="url" value="$url"></input>
+ </div>
+ <div class="field-group">
+ <label for="h-fport">
+ $i18n.getText("openmeetings.config.port.label")
+ <span class="aui-icon icon-required"></span>
+ <span class="content">required</span>
+ </label>
+ <input id="h-fport" class="text long-field" type="text" name="port" value=$port>
+ </div>
+ <div class="field-group">
+ <label for="h-fusername">
+ $i18n.getText("openmeetings.config.username.label")
+ <span class="aui-icon icon-required"></span>
+ <span class="content">required</span>
+ </label>
+ <input id="h-fusername" class="text long-field" type="text" name="username" value=$username>
+ </div>
+ <div class="field-group">
+ <label for="h-fuserpass">
+ $i18n.getText("openmeetings.config.userpass.label")
+ <span class="aui-icon icon-required"></span>
+ <span class="content">required</span>
+ </label>
+ <input id="h-fuserpass" class="text long-field" type="password" name="userpass" value=$userpass>
+ </div>
+ <div class="field-group">
+ <label for="h-fkey">
+ $i18n.getText("openmeetings.config.key.label")
+ <span class="aui-icon icon-required"></span>
+ <span class="content">required</span>
+ </label>
+ <input id="h-fkey" class="text long-field" type="text" name="key" value=$key>
+ </div>
+ <div class="buttons">
+ <input class="button" type="submit" value="$i18n.getText("openmeetings.admin.save.label")">
+ <!-- <a href=$requestContext.baseUrl()"/secure/AdminSummary.jspa">$i18n.getText("openmeetings.rooms.cancel.label")</a>-->
+ </div>
+ </form>
+ </div>
+ </div>
+</div>
+</body>
+</html>
\ No newline at end of file
Added: incubator/openmeetings/branches/confluence-plugin/src/main/resources/templates/omrooms/edit.vm
URL: http://svn.apache.org/viewvc/incubator/openmeetings/branches/confluence-plugin/src/main/resources/templates/omrooms/edit.vm?rev=1298811&view=auto
==============================================================================
--- incubator/openmeetings/branches/confluence-plugin/src/main/resources/templates/omrooms/edit.vm (added)
+++ incubator/openmeetings/branches/confluence-plugin/src/main/resources/templates/omrooms/edit.vm Fri Mar 9 12:42:56 2012
@@ -0,0 +1,111 @@
+<!--
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<html>
+<head>
+ <title>$i18n.getText("openmeetings.rooms.edit.titel.label")</title>
+ <meta name="decorator" content="atl.general">
+</head>
+<body class="page-type-admin">
+<div class="content-container">
+
+ <div class="content-body">
+ <h1>$i18n.getText("openmeetings.rooms.edit.titel.label"): $room.getName()</h1>
+
+ #if ($errors.size()>0)
+ <div class="aui-message error shadowed">
+ #foreach($error in $errors)
+ <p class="title">
+ <span class="aui-icon icon-error"></span>
+ <strong>$error</strong>
+ </p>
+ #end
+ </div>
+ <!-- .aui-message -->
+ #end
+ <div class="create-issue-panel">
+
+ <form method="post" id="h" action="openmeetingsrooms" class="aui">
+ <input type="hidden" name="edit" value="y">
+ <input type="hidden" name="key" value=$room.getID()>
+ <div class="field-group">
+ <label for="h-froomname">
+ Roomname
+ <span class="aui-icon icon-required"></span>
+ <span class="content">required</span>
+ </label>
+ <input id="h-froomname" class="text long-field" type="text" name="roomname" value="$room.getName()">
+ </div>
+ <div class="field-group">
+ <label for="h-froomtype">
+ Roomtype
+ </label>
+ <select name="roomType" id="om-roomtype" style="width: 30%;">
+ <option value="1" #if ("$room.getRoomType()" == "2")selected#end>$i18n.getText("openmeetings.rooms.edit.conference.label")</option>
+ <option value="2" #if ("$room.getRoomType()" == "2")selected#end>$i18n.getText("openmeetings.rooms.edit.audience.label")</option>
+ <option value="3" #if ("$room.getRoomType()" == "3")selected#end>$i18n.getText("openmeetings.rooms.edit.restricted.label")</option>
+ <option value="4" #if ("$room.getRoomType()" == "4")selected#end>$i18n.getText("openmeetings.rooms.edit.interview.label")</option>
+ </select>
+ </div>
+ <div class="field-group">
+ <label for="h-fnr-participent">
+ Nr. of Participent
+ </label>
+ <select name="numberOfParticipent" id="om-participent" style="width: 30%;">
+ <option value="5" #if ("$room.getNumberOfParticipent()" == "5")selected#end>5</option>
+ <option value="10" #if ("$room.getNumberOfParticipent()" == "10")selected#end>10</option>
+ <option value="20" #if ("$room.getNumberOfParticipent()" == "20")selected#end>20</option>
+ <option value="30" #if ("$room.getNumberOfParticipent()" == "30")selected#end>30</option>
+ <option value="60" #if ("$room.getNumberOfParticipent()" == "60")selected#end>60</option>
+ <option value="100" #if ("$room.getNumberOfParticipent()" == "100")selected#end>100</option>
+ <option value="150" #if ("$room.getNumberOfParticipent()" == "150")selected#end>150</option>
+ </select>
+ </div>
+ <div class="field-group">
+ <label for="h-fmoderated">
+ Is moderated
+ </label>
+ <select name="isModeratedRoom" id="om-is-moderated" style="width: 30%;">
+ <option value="false" #if ("$room.getIsModeratedRoom()" == "false")selected#end>$i18n.getText("openmeetings.rooms.no.label")</option>
+ <option value="true" #if ("$room.getIsModeratedRoom()" == "true")selected#end>$i18n.getText("openmeetings.rooms.yes.label")</option>
+ </select>
+ </div>
+ <div class="field-group">
+ <label for="h-faudioonly">
+ Is audio only
+ </label>
+ <select name="isAudioOnly" id="om-is-moderated" style="width: 30%;">
+ <option value="false" #if ("$room.getIsAudioOnly()" == "false")selected#end>$i18n.getText("openmeetings.rooms.no.label")</option>
+ <option value="true" #if ("$room.getIsAudioOnly()" == "true")selected#end>$i18n.getText("openmeetings.rooms.yes.label")</option>
+ </select>
+ </div>
+ <div class="field-group">
+ <label for="h-fallow-recording">
+ Allow Recording
+ </label>
+ <select name="isAllowedRecording" id="om-allow-recording" style="width: 30%;">
+ <option value="false" #if ("$room.getIsAllowedRecording()" == "false")selected#end>$i18n.getText("openmeetings.rooms.no.label")</option>
+ <option value="true" #if ("$room.getIsAllowedRecording()" == "true")selected#end>$i18n.getText("openmeetings.rooms.yes.label")</option>
+ </select>
+ </div>
+ <div class="buttons">
+ <input class="button" type="submit" value=$i18n.getText("openmeetings.admin.save.label")>
+ <a href="openmeetingsrooms">Cancel</a>
+ </div>
+ </form>
+ </div>
+ </div>
+
+</div>
+</body>
+</html>
\ No newline at end of file
Added: incubator/openmeetings/branches/confluence-plugin/src/main/resources/templates/omrooms/enter.vm
URL: http://svn.apache.org/viewvc/incubator/openmeetings/branches/confluence-plugin/src/main/resources/templates/omrooms/enter.vm?rev=1298811&view=auto
==============================================================================
--- incubator/openmeetings/branches/confluence-plugin/src/main/resources/templates/omrooms/enter.vm (added)
+++ incubator/openmeetings/branches/confluence-plugin/src/main/resources/templates/omrooms/enter.vm Fri Mar 9 12:42:56 2012
@@ -0,0 +1,32 @@
+<!--
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<html>
+<head>
+ <title>$i18n.getText("openmeetings.rooms.enter.titel.label")</title>
+ <meta name="decorator" content="atl.general">
+</head>
+<body class="page-type-admin">
+ #if ($errors.size()>0)
+ <div class="aui-message error shadowed">
+ #foreach($error in $errors)
+ <p class="title">
+ <span class="aui-icon icon-error"></span>
+ <strong>$error.getMessage()</strong>
+ </p>
+ #end
+ </div>
+ #else
+ <iframe name="IframeName" src=$roomURL width='100%' height='600px'></iframe>
+ #end
+</body>
\ No newline at end of file
Added: incubator/openmeetings/branches/confluence-plugin/src/main/resources/templates/omrooms/list.vm
URL: http://svn.apache.org/viewvc/incubator/openmeetings/branches/confluence-plugin/src/main/resources/templates/omrooms/list.vm?rev=1298811&view=auto
==============================================================================
--- incubator/openmeetings/branches/confluence-plugin/src/main/resources/templates/omrooms/list.vm (added)
+++ incubator/openmeetings/branches/confluence-plugin/src/main/resources/templates/omrooms/list.vm Fri Mar 9 12:42:56 2012
@@ -0,0 +1,118 @@
+<!--
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<html>
+<head>
+ <title>$i18n.getText("openmeetings.rooms.roomlist.label")</title>
+ <meta name="decorator" content="atl.general">
+ <script>
+ AJS.$(document).ready(function() {
+ jQuery('.delete-room').click(function() {
+ console.log('deleting');
+ var self = jQuery(this);
+ jQuery.ajax({
+ type: "delete",
+ url: "openmeetingsrooms?key=" + self.data("key"),
+ success: function(data) {
+ console.log('dom', self, data);
+ self.parent().parent().remove();
+ },
+ error: function() {
+ console.log('error', arguments);
+ }
+ });
+ return false;
+ });
+ });
+ </script>
+</head>
+<body class="page-type-admin">
+<div class="content-container">
+ <div class="content-body">
+ <h1>OpenMeetings #if($rooms.size()==0)<span style="color:red">NO</span>#end Rooms</h1>
+ #if ($errors.size()>0)
+ <div class="aui-message error shadowed">
+ #foreach($error in $errors)
+ <p class="title">
+ <span class="aui-icon icon-error"></span>
+ <strong>$error.getMessage()</strong>
+ </p>
+ #end
+ </div>
+ <!-- .aui-message -->
+ #end
+ #if($rooms.size() > 0)
+ <div class="rooms">
+ <table class="aui">
+ <thead>
+ <tr>
+ ##<th>$i18n.getText("openmeetings.rooms.roomid.label")</th>
+ <th>$i18n.getText("openmeetings.rooms.roomname.label")</th>
+ <th>$i18n.getText("openmeetings.rooms.roomtype.label")</th>
+ <th>$i18n.getText("openmeetings.rooms.participent.label")</th>
+ <th>$i18n.getText("openmeetings.rooms.ismoderated.label")</th>
+ <th>$i18n.getText("openmeetings.rooms.isaudio.label")</th>
+ <th></th>
+ </tr>
+ </thead>
+ <tbody>
+ #foreach( $room in $rooms )
+ <tr>
+ ##<td>$room.getRoomId()</td>
+ <td>$room.getName()</td>
+ <td>
+ #if($room.getRoomType() == 1)
+ $i18n.getText("openmeetings.rooms.conference.label")
+ #elseif($room.getRoomType() == 2)
+ $i18n.getText("openmeetings.rooms.audience.label")
+ #elseif($room.getRoomType() == 3)
+ $i18n.getText("openmeetings.rooms.restricted.label")
+ #elseif($room.getRoomType() == 4)
+ $i18n.getText("openmeetings.rooms.interview.label")
+ #end
+ </td>
+ <td>
+ $room.getNumberOfParticipent()
+ </td>
+ <td>
+ #if($room.getIsModeratedRoom() == true)
+ $i18n.getText("openmeetings.rooms.yes.label")
+ #else
+ $i18n.getText("openmeetings.rooms.no.label")
+ #end
+ </td>
+ <td>
+ #if( $room.getIsAudioOnly() == true)
+ $i18n.getText("openmeetings.rooms.yes.label")
+ #else
+ $i18n.getText("openmeetings.rooms.no.label")
+ #end
+ </td>
+ <td>
+ <a href="openmeetingsrooms?edit=y&key=$room.getID()">$i18n.getText("openmeetings.rooms.edit.label")</a>
+ <a href="openmeetingsrooms?delete=y&key=$room.getID()" class="delete-room" data-key="$room.getID()">$i18n.getText("openmeetings.rooms.delete.label")</a>
+ </td>
+ </tr>
+ #end
+ </tbody>
+ </table>
+ </div>
+ #end
+ <form method="get" action="openmeetingsrooms" class="aui">
+ <input type="hidden" name="new" value="y">
+ <input type="submit" class="button" value="$i18n.getText("openmeetings.rooms.createnewroom.label")">
+ </form>
+ </div>
+</div>
+</body>
+</html>
\ No newline at end of file
Added: incubator/openmeetings/branches/confluence-plugin/src/main/resources/templates/omrooms/new.vm
URL: http://svn.apache.org/viewvc/incubator/openmeetings/branches/confluence-plugin/src/main/resources/templates/omrooms/new.vm?rev=1298811&view=auto
==============================================================================
--- incubator/openmeetings/branches/confluence-plugin/src/main/resources/templates/omrooms/new.vm (added)
+++ incubator/openmeetings/branches/confluence-plugin/src/main/resources/templates/omrooms/new.vm Fri Mar 9 12:42:56 2012
@@ -0,0 +1,97 @@
+<!--
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<html>
+<head>
+ <title>$i18n.getText("openmeetings.rooms.createnewroom.label")</title>
+ <meta name="decorator" content="atl.general">
+</head>
+<body class="page-type-admin">
+<div class="content-container">
+
+ <div class="content-body">
+ <h1>Create Room</h1>
+ <div class="create-issue-panel">
+
+ <form method="post" id="h" action="openmeetingsrooms" class="aui">
+ <div class="field-group">
+ <label for="h-froomname">
+ Roomname
+ <span class="aui-icon icon-required"></span>
+ <span class="content">required</span>
+ </label>
+ <input id="h-froomname" class="text long-field" type="text" name="roomname">
+ </div>
+ <div class="field-group">
+ <label for="h-froomtype">
+ Roomtype
+ </label>
+ <select name="roomType" id="om-roomtype" style="width: 30%;">
+ <option value="1">$i18n.getText("openmeetings.rooms.edit.conference.label")</option>
+ <option value="2">$i18n.getText("openmeetings.rooms.edit.audience.label")</option>
+ <option value="3">$i18n.getText("openmeetings.rooms.edit.restricted.label")</option>
+ <option value="4">$i18n.getText("openmeetings.rooms.edit.interview.label")</option>
+ </select>
+ </div>
+ <div class="field-group">
+ <label for="h-fnr-participent">
+ Nr. of Participent
+ </label>
+ <select name="numberOfParticipent" id="om-participent" style="width: 30%;">
+ <option value="5">5</option>
+ <option value="10">10</option>
+ <option value="20">20</option>
+ <option value="30">30</option>
+ <option value="60">60</option>
+ <option value="100">100</option>
+ <option value="150">150</option>
+ </select>
+ </div>
+ <div class="field-group">
+ <label for="h-fmoderated">
+ Is moderated
+ </label>
+ <select name="isModeratedRoom" id="om-is-moderated" style="width: 30%;">
+ <option value="false">$i18n.getText("openmeetings.rooms.no.label")</option>
+ <option value="true">$i18n.getText("openmeetings.rooms.yes.label")</option>
+ </select>
+ </div>
+ <div class="field-group">
+ <label for="h-faudioonly">
+ Is audio only
+ </label>
+ <select name="isAudioOnly" id="om-is-moderated" style="width: 30%;">
+ <option value="false">$i18n.getText("openmeetings.rooms.no.label")</option>
+ <option value="true">$i18n.getText("openmeetings.rooms.yes.label")</option>
+ </select>
+ </div>
+ <div class="field-group">
+ <label for="h-fallow-recording">
+ Allow Recording
+ </label>
+ <select name="isAllowedRecording" id="om-allow-recording" style="width: 30%;">
+ <option value="false">$i18n.getText("openmeetings.rooms.no.label")</option>
+ <option value="true">$i18n.getText("openmeetings.rooms.yes.label")</option>
+ </select>
+ </div>
+ <div class="buttons">
+ <input class="button" type="submit" value="$i18n.getText("openmeetings.rooms.create.label")">
+ <a href="openmeetingsrooms">$i18n.getText("openmeetings.rooms.cancel.label")</a>
+ </div>
+ </form>
+ </div>
+ </div>
+
+</div>
+</body>
+</html>
\ No newline at end of file
Added: incubator/openmeetings/branches/confluence-plugin/src/test/java/com/openmeetings/confluence/plugins/ExampleMacroTest.java
URL: http://svn.apache.org/viewvc/incubator/openmeetings/branches/confluence-plugin/src/test/java/com/openmeetings/confluence/plugins/ExampleMacroTest.java?rev=1298811&view=auto
==============================================================================
--- incubator/openmeetings/branches/confluence-plugin/src/test/java/com/openmeetings/confluence/plugins/ExampleMacroTest.java (added)
+++ incubator/openmeetings/branches/confluence-plugin/src/test/java/com/openmeetings/confluence/plugins/ExampleMacroTest.java Fri Mar 9 12:42:56 2012
@@ -0,0 +1,15 @@
+package com.openmeetings.confluence.plugins;
+
+import org.junit.Test;
+
+/**
+ * Testing {@link com.openmeetings.confluence.plugins.ExampleMacro}
+ */
+public class ExampleMacroTest
+{
+ @Test
+ public void basic()
+ {
+ // add test here...
+ }
+}
\ No newline at end of file
Added: incubator/openmeetings/branches/confluence-plugin/src/test/java/com/openmeetings/confluence/plugins/ao/omrooms/RoomServiceImplTest.java
URL: http://svn.apache.org/viewvc/incubator/openmeetings/branches/confluence-plugin/src/test/java/com/openmeetings/confluence/plugins/ao/omrooms/RoomServiceImplTest.java?rev=1298811&view=auto
==============================================================================
--- incubator/openmeetings/branches/confluence-plugin/src/test/java/com/openmeetings/confluence/plugins/ao/omrooms/RoomServiceImplTest.java (added)
+++ incubator/openmeetings/branches/confluence-plugin/src/test/java/com/openmeetings/confluence/plugins/ao/omrooms/RoomServiceImplTest.java Fri Mar 9 12:42:56 2012
@@ -0,0 +1,165 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License") + you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.openmeetings.confluence.plugins.ao.omrooms;
+
+import com.atlassian.activeobjects.external.ActiveObjects;
+
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import com.atlassian.activeobjects.test.TestActiveObjects;
+import net.java.ao.EntityManager;
+import net.java.ao.Query;
+import net.java.ao.test.junit.ActiveObjectsJUnitRunner;
+
+import com.atlassian.activeobjects.external.ActiveObjects;
+import com.atlassian.activeobjects.test.TestActiveObjects;
+import net.java.ao.EntityManager;
+import net.java.ao.test.jdbc.Data;
+import net.java.ao.test.jdbc.DatabaseUpdater;
+import net.java.ao.test.junit.ActiveObjectsJUnitRunner;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.collect.Lists.newArrayList;
+import static org.junit.Assert.*;
+
+@RunWith(ActiveObjectsJUnitRunner.class)
+public final class RoomServiceImplTest extends TestCase
+{
+ private EntityManager entityManager;
+
+ private RoomServiceImpl roomServiceImpl;
+
+ private ActiveObjects ao;
+
+
+ @Before
+ public void setUp() throws Exception
+ {
+ assertNotNull(entityManager);
+ ao = new TestActiveObjects(entityManager);
+ roomServiceImpl = new RoomServiceImpl(ao);
+
+ }
+
+ @Test
+ public void testAdd() throws Exception
+ {
+ final String roomname = "This is a room";
+ final Boolean isAllowedRecording = false;
+ final Boolean isAudioOnly = false;
+ final Boolean isModeratedRoom = false;
+ final Long numberOfParticipent = 10L;
+ final Long roomId = 22L;
+ final Long roomType = 2L;
+ final String name = "This is a room";
+ final String createdByUserName = "admin";
+
+ ao.migrate(Room.class);
+
+
+ assertEquals(0, ao.find(Room.class).length);
+
+ final Room add = roomServiceImpl.add(isAllowedRecording,
+ isAudioOnly, isModeratedRoom, name, numberOfParticipent, roomType, roomId, createdByUserName);
+ assertFalse(add.getID() == 0);
+
+ ao.flushAll(); // (3) clear all caches
+
+ final Room[] todos = ao.find(Room.class);
+ assertEquals(1, todos.length);
+ assertEquals(roomname, todos[0].getName());
+ assertEquals(false, todos[0].getIsAllowedRecording());
+ assertEquals(false, todos[0].getIsAudioOnly());
+ assertEquals(false, todos[0].getIsDeleted());
+ assertEquals(false, todos[0].getIsModeratedRoom());
+ assertEquals(roomId, todos[0].getRoomId());
+ assertEquals(roomType, todos[0].getRoomType());
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void testAll() throws Exception
+ {
+ final String roomname = "This is a room";
+ final Boolean isAllowedRecording = false;
+ final Boolean isAudioOnly = false;
+ final Boolean isModeratedRoom = false;
+ final Long numberOfParticipent = 10L;
+ final Long roomId = 22L;
+ final Long roomType = 2L;
+ final String name = "This is a room";
+ final String createdByUserName = "admin";
+
+ ao.migrate(Room.class); // (2)
+
+ assertTrue(roomServiceImpl.all().isEmpty());
+
+ final Room room = ao.create(Room.class);
+ room.setIsAllowedRecording(isAllowedRecording);
+ room.setIsAudioOnly(isAudioOnly);
+ room.setIsModeratedRoom(isModeratedRoom);
+ room.setName(name);
+ room.setNumberOfParticipent(numberOfParticipent);
+ room.setRoomType(roomType);
+ room.setRoomId(roomId);
+ room.setCreatedByUserName(createdByUserName);
+ room.setIsDeleted(false);
+ room.save();
+
+ final Room room2 = ao.create(Room.class);
+ room2.setIsAllowedRecording(isAllowedRecording);
+ room2.setIsAudioOnly(isAudioOnly);
+ room2.setIsModeratedRoom(isModeratedRoom);
+ room2.setName(name);
+ room2.setNumberOfParticipent(numberOfParticipent);
+ room2.setRoomType(roomType);
+ room2.setRoomId(roomId);
+ room2.setCreatedByUserName(createdByUserName);
+ room2.setIsDeleted(false);
+ room2.save();
+
+ //ao.flushAll(); // (3) clear all caches
+
+ // final List<Room> all = roomServiceImpl.all();
+ //final List<Room> all = roomServiceImpl.allNotDeletedByUserName("admin");
+ //final List<Room> all = roomServiceImpl.allNotDeleted();
+ //final List<Room> all = newArrayList(ao.find(Room.class, Query.select().where("isdeleted LIKE ?", false)));
+ //final List<Room> all = newArrayList(ao.find(Room.class, Query.select().where("isdeleted = false")));
+
+ final List<Room> all = newArrayList(ao.find(Room.class, Query.select().
+ where("isdeleted = ? AND createdbyusername = ?",false, "admin").limit(1000)));
+
+
+ System.out.println(all.get(0).getID());
+ System.out.println(all.get(0).getIsDeleted());
+
+ System.out.println(all.get(1).getID());
+ System.out.println(all.get(1).getIsDeleted());
+
+ assertEquals(2, all.size());
+ assertEquals(room.getID(), all.get(0).getID());
+ assertEquals(false, all.get(0).getIsDeleted());
+ }
+
+}