Upon executing the above code a new group gets added under the specified group.
package com.Strategy.sdk.standalone;
import com.Strategy.web.beans.BeanFactory;
import com.Strategy.web.beans.UserEntitiesBean;
import com.Strategy.web.beans.UserGroupBean;
import com.Strategy.web.beans.WebBeanException;
import com.Strategy.web.objects.WebIServerSession;
import com.Strategy.web.objects.WebObjectsException;
import com.Strategy.web.objects.WebObjectsFactory;
import com.Strategy.webapi.EnumDSSXMLApplicationType;
public class test {
public static void main(String[] args) throws WebObjectsException, WebBeanException {
WebObjectsFactory factory=WebObjectsFactory.getInstance();
WebIServerSession serverSession=factory.getIServerSession();
serverSession.setServerName("localhost");
serverSession.setServerPort(0);
serverSession.setProjectName("Strategy Tutorial");
serverSession.setLogin("administrator");
serverSession.setPassword("");
serverSession.setApplicationType(EnumDSSXMLApplicationType.DssXmlApplicationCustomApp);
UserGroupBean group = null;
String strUserGroupName = "NewGroup";
//Create a new group
group = newGroup(serverSession, strUserGroupName);
//Get the existing group under which the new user group needs to be added
UserGroupBean parentgroup = (UserGroupBean)BeanFactory.getInstance().newBean("UserGroupBean");
parentgroup.setSessionInfo(serverSession);
parentgroup.setObjectID("C1E141DB11D603A2100086B3A5E8F8A4"); //Existing Web group under Tutorial project "Web Users"
//Get the parent groups for the new group and add the existing group to the collection
UserEntitiesBean entities = group.getParentGroups();
if (entities != null) {
entities.add(parentgroup);
}
group.save();
parentgroup.save();
}
/**
* Creates a new User Group
*