* INITIAL POPULATIONS OF THIS REPO
This commit is contained in:
Executable
+45
@@ -0,0 +1,45 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.fourelementscapital</groupId>
|
||||
<artifactId>iexec</artifactId>
|
||||
<version>3.0.0-Beta1</version>
|
||||
<name>iexec</name>
|
||||
<url>http://www.fourelementscapital.com</url>
|
||||
<dependencies>
|
||||
|
||||
<!--Cache system-->
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-jcs-core</artifactId>
|
||||
<version>2.2</version>
|
||||
</dependency>
|
||||
|
||||
<!--JCS's required dependency-->
|
||||
<dependency>
|
||||
<groupId>commons-logging</groupId>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
<version>1.2</version>
|
||||
</dependency>
|
||||
|
||||
<!--4ECAP Libs-->
|
||||
<dependency>
|
||||
<groupId>com.fourelementscapital</groupId>
|
||||
<artifactId>lib-db</artifactId>
|
||||
<version>2.0</version>
|
||||
</dependency>
|
||||
|
||||
<!--Log dependencies-->
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-core</artifactId>
|
||||
<version>2.8.1</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
</project>
|
||||
+74
@@ -0,0 +1,74 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright: Intellectual Property of Four Elements Capital Pte Ltd, Singapore.
|
||||
* All rights reserved.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
package com.fourelementscapital.iexec.common;
|
||||
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Vector;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import com.fourelementscapital.db.IExecDB;
|
||||
import com.fourelementscapital.db.vo.ValueObject;
|
||||
|
||||
|
||||
/**
|
||||
* Use lib-db to generate tree menu on iExec
|
||||
*/
|
||||
|
||||
public class IExecMgmt{
|
||||
|
||||
private HttpServletRequest request=null;
|
||||
private Logger log = LogManager.getLogger(IExecMgmt.class.getName());
|
||||
|
||||
public IExecMgmt() throws Exception {
|
||||
super();
|
||||
|
||||
}
|
||||
|
||||
public Map getTreeViewData() throws Exception {
|
||||
|
||||
IExecDB iedb=IExecDB.getIExcecDB();
|
||||
|
||||
try{
|
||||
HashMap rtn=new HashMap();
|
||||
|
||||
iedb.connectDB();
|
||||
|
||||
List glist=iedb.listGroups();
|
||||
List folders=iedb.listFolders();
|
||||
List strategies=iedb.listStrategies();
|
||||
|
||||
Vector groups=new Vector();
|
||||
HashMap colors=new HashMap();
|
||||
for(Iterator it=glist.iterator();it.hasNext();){
|
||||
Map data=(Map)it.next();
|
||||
|
||||
ValueObject vo=new ValueObject();
|
||||
vo.setKey((String)data.get("group_uid"));
|
||||
vo.setValue((String)data.get("group_name"));
|
||||
groups.add(vo);
|
||||
colors.put(data.get("group_uid"), data.get("color_code"));
|
||||
}
|
||||
rtn.put("folders", folders);
|
||||
rtn.put("groups",groups);
|
||||
rtn.put("group_colors",colors);
|
||||
rtn.put("strategies",strategies);
|
||||
|
||||
return rtn;
|
||||
|
||||
}catch(Exception e){
|
||||
throw e;
|
||||
}finally{
|
||||
iedb.closeDB();
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+78
@@ -0,0 +1,78 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.fourelementscapital</groupId>
|
||||
<artifactId>qLib</artifactId>
|
||||
<version>${revision}${changelist}</version>
|
||||
<packaging>war</packaging>
|
||||
<name>qLib</name>
|
||||
<url>http://www.fourelementscapital.com</url>
|
||||
|
||||
<properties>
|
||||
<revision>3.0.0</revision>
|
||||
<changelist>-Beta1</changelist>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!--4ECAP Libs-->
|
||||
<dependency>
|
||||
<groupId>com.fourelementscapital</groupId>
|
||||
<artifactId>lib-config</artifactId>
|
||||
<version>2.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fourelementscapital</groupId>
|
||||
<artifactId>lib-auth</artifactId>
|
||||
<version>2.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fourelementscapital</groupId>
|
||||
<artifactId>lib-db</artifactId>
|
||||
<version>2.0</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!--Log dependencies-->
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-simple</artifactId>
|
||||
<version>1.7.25</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-core</artifactId>
|
||||
<version>2.8.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-compress</artifactId>
|
||||
<version>1.15</version>
|
||||
</dependency>
|
||||
|
||||
<!--Cache system-->
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-jcs-core</artifactId>
|
||||
<version>2.2</version>
|
||||
</dependency>
|
||||
<!--JCS's required dependency-->
|
||||
<dependency>
|
||||
<groupId>commons-logging</groupId>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
<version>1.2</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Added on 30 March 2018-->
|
||||
<dependency>
|
||||
<groupId>com.fourelementscapital</groupId>
|
||||
<artifactId>lib-client</artifactId>
|
||||
<version>2.0</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
Executable
+305
@@ -0,0 +1,305 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright: Intellectual Property of Four Elements Capital Pte Ltd, Singapore.
|
||||
* All rights reserved.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
package com.fourelementscapital.rfunction.common;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Vector;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import com.fourelementscapital.config.Constant;
|
||||
import com.fourelementscapital.auth.UserThemeAccessPermission;
|
||||
import com.fourelementscapital.db.AbstractTeamOrgDB;
|
||||
import com.fourelementscapital.db.SchedulerDB;
|
||||
import com.fourelementscapital.client.Authenticated;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* This class is abstract and provide basic implementation for all Team Organization related moudles
|
||||
* for example: Themes tag support on scheduler, R function *
|
||||
* @author Administrator
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public abstract class AbstractTeamOrgMgmt extends Authenticated{
|
||||
|
||||
protected static String ACCESS_PRIVILEGE_RWX="RWX";
|
||||
protected static String ACCESS_PRIVILEGE_RX="RX";
|
||||
protected static String ACCESS_PRIVILEGE_R="R";
|
||||
private Logger log = LogManager.getLogger(AbstractTeamOrgMgmt.class.getName());
|
||||
|
||||
|
||||
/**
|
||||
* this constructor to be used only for DWR, manual invoking to get the object using of this constructor will mis-behave
|
||||
* @throws Exception
|
||||
*/
|
||||
public AbstractTeamOrgMgmt() throws Exception {
|
||||
super();
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* this constructor will be used only when JSP or Httprequest request is available.
|
||||
* @param request
|
||||
* @throws Exception
|
||||
*/
|
||||
public AbstractTeamOrgMgmt(HttpServletRequest request) throws Exception {
|
||||
super(request);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* to be used in child class
|
||||
* @param sdb
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
protected Map getThemeAccessData(AbstractTeamOrgDB sdb) throws Exception {
|
||||
|
||||
UserThemeAccessPermission auth=getAuthenticatedUserObj(sdb);
|
||||
HashMap rtn=new HashMap();
|
||||
if(auth!=null){
|
||||
rtn.put("rwx_tags",auth.getRwx());
|
||||
rtn.put("rx_tags",auth.getRx());
|
||||
rtn.put("r_tags",auth.getR());
|
||||
}
|
||||
|
||||
String superuser=(String)getRequest().getSession().getAttribute(Constant.SESSION_LOGGED_SUPERUSER);
|
||||
if(superuser!=null && !superuser.equals("")){
|
||||
rtn.put("superuser",superuser);
|
||||
}
|
||||
return rtn;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param scheduler_id
|
||||
* @param sdb
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
protected String getAccessPrivilege(int scheduler_id, AbstractTeamOrgDB sdb) throws Exception {
|
||||
String rtn="";
|
||||
UserThemeAccessPermission user=getAuthenticatedUserObj(sdb);
|
||||
if(user!=null){
|
||||
List<String> themes=sdb.getThemeTags(scheduler_id);
|
||||
|
||||
log.debug("themes:"+themes);
|
||||
log.debug("user.getRwx():"+user.getRwx());
|
||||
log.debug("user.getRx():"+user.getRx());
|
||||
log.debug("user.getR():"+user.getR());
|
||||
|
||||
for(String ttag:themes){
|
||||
if(user.getRwx().contains(ttag)) rtn=ACCESS_PRIVILEGE_RWX;
|
||||
if(user.getRx().contains(ttag) && (!rtn.equals(ACCESS_PRIVILEGE_RWX) )) rtn=ACCESS_PRIVILEGE_RX;
|
||||
if(user.getR().contains(ttag) && rtn.equals("")) rtn=ACCESS_PRIVILEGE_R;
|
||||
}
|
||||
if(themes.size()==0) rtn=ACCESS_PRIVILEGE_RWX;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
log.debug("user:"+user);
|
||||
log.debug("getAccessPrivilege:rtn:"+rtn);
|
||||
String superuser=(String)getRequest().getSession().getAttribute(Constant.SESSION_LOGGED_SUPERUSER);
|
||||
if(superuser!=null && !superuser.equals("")){
|
||||
rtn=ACCESS_PRIVILEGE_RWX;
|
||||
}
|
||||
if(rtn.equals("")) rtn=null;
|
||||
return rtn;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @param notity_tags
|
||||
* @param sdb
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
protected ArrayList <String> getNotifications(List notity_tags, AbstractTeamOrgDB sdb) throws Exception {
|
||||
|
||||
Map<String,String> priv_data=getThemeHirarchy(notity_tags,sdb);
|
||||
ArrayList <String> user_notification=new ArrayList<String>();
|
||||
|
||||
for(Iterator<String> i=priv_data.keySet().iterator();i.hasNext();){
|
||||
String ky=i.next();
|
||||
if(priv_data.get(ky)!=null && priv_data.get(ky).equalsIgnoreCase("rwx")){
|
||||
user_notification.add(ky);
|
||||
}
|
||||
}
|
||||
return user_notification;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param sdb
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
protected boolean isAuthorizedUser(SchedulerDB sdb) throws Exception {
|
||||
|
||||
String user=getAuthenticatedUser();
|
||||
if(user!=null){
|
||||
Map u=sdb.getSVNUser4WikiUser(user);
|
||||
if(u!=null && u.get("svn_username")!=null && u.get("svn_password")!=null
|
||||
&& !((String)u.get("svn_username")).equals("") && !((String)u.get("svn_password")).equals("")
|
||||
){
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param sdb
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
protected String getAuthorizedUser(SchedulerDB sdb) throws Exception {
|
||||
|
||||
String user=getAuthenticatedUser();
|
||||
log.debug("getAuthorizedUser() user:"+user);
|
||||
if(user!=null){
|
||||
Map u=sdb.getSVNUser4WikiUser(user);
|
||||
if(u!=null && u.get("svn_username")!=null && u.get("svn_password")!=null
|
||||
&& !((String)u.get("svn_username")).equals("") && !((String)u.get("svn_password")).equals("")
|
||||
){
|
||||
return (String)u.get("svn_username");
|
||||
}else{
|
||||
return null;
|
||||
}
|
||||
}else{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param scheduler_id
|
||||
* @param sdb
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
|
||||
protected Map getItemTags2(int scheduler_id,AbstractTeamOrgDB sdb) throws Exception {
|
||||
|
||||
//SchedulerDB sdb=SchedulerDB.getSchedulerDB();
|
||||
|
||||
//try{
|
||||
HashMap h=new HashMap();
|
||||
Vector tagids=sdb.getTagIds4Item(scheduler_id);
|
||||
Vector tags=sdb.getTags();
|
||||
Vector follow_tagids=sdb.getFollowTagIds4Item(scheduler_id);
|
||||
|
||||
ArrayList<String> themes=sdb.getThemeNames4Item(scheduler_id);
|
||||
//Vector followers=sdb.getFollowers(scheduler_id);
|
||||
|
||||
|
||||
Map priv_data=getThemeHirarchy(themes,sdb);
|
||||
if(priv_data.get("theme")!=null){
|
||||
priv_data.remove("theme");
|
||||
}
|
||||
|
||||
List ftags=sdb.getFollowTags4Item(scheduler_id);
|
||||
List user_notifications=ftags.size()>0?getNotifications(ftags,sdb):new ArrayList();
|
||||
ArrayList<String> all=new ArrayList<String>(ftags);
|
||||
all.addAll(themes);
|
||||
|
||||
h.put("tagids", tagids);
|
||||
h.put("user_privileges",priv_data);
|
||||
h.put("user_notifications",user_notifications);
|
||||
h.put("follow_tagids",follow_tagids);
|
||||
h.put("notice_escalated", getThemeHirarchy(all,sdb));
|
||||
h.put("tags", tags);
|
||||
h.putAll(priv_data);
|
||||
return h;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param item_id
|
||||
* @param newtask_tags
|
||||
* @param follow_tags
|
||||
* @param atodb
|
||||
* @param sdb
|
||||
* @param name
|
||||
* @param comment
|
||||
* @param rev
|
||||
* @param diff
|
||||
* @param tempdata
|
||||
* @param templ_file
|
||||
* @throws Exception
|
||||
*/
|
||||
protected void updateAllItemTags(int item_id, List newtask_tags,List follow_tags,AbstractTeamOrgDB atodb,SchedulerDB sdb,String name, String comment,long rev,String diff, Map tempdata, String templ_file) throws Exception {
|
||||
|
||||
ArrayList<Integer> ids=new ArrayList<Integer>();
|
||||
for(Iterator i=newtask_tags.iterator();i.hasNext();){
|
||||
String tid=(String)i.next();
|
||||
ids.add(Integer.parseInt(tid));
|
||||
}
|
||||
atodb.updateItemTagIds(item_id, ids);
|
||||
String owner_tag=null;
|
||||
if(ids.size()>0){
|
||||
owner_tag=atodb.getThemeTagName(ids.get(0));
|
||||
}
|
||||
ArrayList<Integer> fids=new ArrayList<Integer>();
|
||||
for(Iterator i=follow_tags.iterator();i.hasNext();){
|
||||
String tid=(String)i.next();
|
||||
fids.add(Integer.parseInt(tid));
|
||||
}
|
||||
atodb.updateFollwerTagIds(item_id, fids);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
protected Map getItemPrivilegeNotifications(ArrayList<String> themes,ArrayList<String> ftags,AbstractTeamOrgDB sdb) throws Exception {
|
||||
|
||||
|
||||
Map priv_data=getThemeHirarchy(themes,sdb);
|
||||
HashMap h=new HashMap();
|
||||
|
||||
ArrayList<String> all=new ArrayList<String>(ftags);
|
||||
all.addAll(themes);
|
||||
List user_notifications=getNotifications(all,sdb);
|
||||
h.put("user_notifications",user_notifications);
|
||||
h.put("user_privileges",priv_data);
|
||||
h.put("notice_escalated",getThemeHirarchy(all,sdb));
|
||||
|
||||
return h;
|
||||
|
||||
}
|
||||
}
|
||||
+164
@@ -0,0 +1,164 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright: Intellectual Property of Four Elements Capital Pte Ltd, Singapore.
|
||||
* All rights reserved.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
package com.fourelementscapital.rfunction.common;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Vector;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import org.apache.commons.jcs.JCS;
|
||||
import org.apache.commons.jcs.access.CacheAccess;
|
||||
import org.apache.commons.jcs.engine.behavior.IElementAttributes;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import com.fourelementscapital.db.RFunctionDB;
|
||||
import com.fourelementscapital.db.SchedulerDB;
|
||||
import com.fourelementscapital.db.vo.ValueObject;
|
||||
|
||||
|
||||
/**
|
||||
* This class exposes data to R function editor in Ajax call
|
||||
* Remember all methods in the class are required user to be logged in
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public class RFunctionMgmt extends AbstractTeamOrgMgmt {
|
||||
|
||||
private HttpServletRequest request=null;
|
||||
private Logger log = LogManager.getLogger(RFunctionMgmt.class.getName());
|
||||
private static CacheAccess<String, HashMap> lockcache=null;
|
||||
private String cache_packaged_key="packaged_functions";
|
||||
public static String RFUNCTION_FILE_EXTENSION=".r";
|
||||
|
||||
private static String FUNCTION_ID="function_id";
|
||||
private static String LOCK_DURATION="duration";
|
||||
private static String USER="user";
|
||||
|
||||
/**
|
||||
* DWR invocation
|
||||
* @throws Exception
|
||||
*/
|
||||
public RFunctionMgmt() throws Exception {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* JSP or internal invocation
|
||||
* @param request
|
||||
* @throws Exception
|
||||
*/
|
||||
public RFunctionMgmt(HttpServletRequest request) throws Exception {
|
||||
super(request);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* JCS caching for speed data retrival and not necessary to hit the database for every user.
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
private static CacheAccess getLockCache() throws Exception {
|
||||
if(RFunctionMgmt.lockcache==null) RFunctionMgmt.lockcache=JCS.getInstance("lock-cache");
|
||||
return RFunctionMgmt.lockcache;
|
||||
}
|
||||
|
||||
/**
|
||||
* Locking r function while a user is editing
|
||||
* @param function_id
|
||||
* @param seconds
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public boolean lockFunction(int function_id, long seconds) throws Exception {
|
||||
SchedulerDB sdb=SchedulerDB.getSchedulerDB();
|
||||
RFunctionDB rfdb=RFunctionDB .getRFunctionDB();
|
||||
try{
|
||||
sdb.connectDB();
|
||||
rfdb.connectDB();
|
||||
String usr=new SchedulerMgmt(getRequest()).getAuthorizedUser(sdb);
|
||||
if(seconds>0){
|
||||
refreshCache(function_id, seconds,usr);
|
||||
}else{
|
||||
rfdb.updateLock(function_id, usr);
|
||||
}
|
||||
return true;
|
||||
}catch(Exception e){
|
||||
|
||||
throw e;
|
||||
}finally{
|
||||
sdb.closeDB();
|
||||
rfdb.closeDB();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void removeLockFromCache(int function_id, String usr ) throws Exception {
|
||||
//String ky=usr+"_"+function_id;
|
||||
String ky=usr+function_id;
|
||||
if(getLockCache().get(ky)!=null)getLockCache().remove(ky);
|
||||
}
|
||||
|
||||
private void refreshCache(int function_id, long seconds, String usr ) throws Exception {
|
||||
|
||||
//String ky=usr+"_"+function_id;
|
||||
String ky=usr+function_id;
|
||||
HashMap h=new HashMap();
|
||||
h.put(RFunctionMgmt.FUNCTION_ID, function_id);
|
||||
h.put(RFunctionMgmt.LOCK_DURATION, seconds);
|
||||
h.put(RFunctionMgmt.USER, usr);
|
||||
|
||||
IElementAttributes att= getLockCache().getDefaultElementAttributes();
|
||||
att.setMaxLife(seconds);
|
||||
if(getLockCache().get(ky)!=null)getLockCache().remove(ky);
|
||||
getLockCache().put(ky,h,att);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* return data for folder generation.
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public Map getFolderTree() throws Exception {
|
||||
|
||||
RFunctionDB rfdb=RFunctionDB.getRFunctionDB();
|
||||
|
||||
try{
|
||||
HashMap rtn=new HashMap();
|
||||
|
||||
rfdb.connectDB();
|
||||
List glist=rfdb.listFunctionGroups();
|
||||
List folders=rfdb.listOfFolders();
|
||||
|
||||
//TreeMap groups=new TreeMap();
|
||||
Vector groups=new Vector();
|
||||
|
||||
for(Iterator it=glist.iterator();it.hasNext();){
|
||||
Map data=(Map)it.next();
|
||||
//groups.put(data.get("group_uid"),data.get("group_name"));
|
||||
|
||||
ValueObject vo=new ValueObject();
|
||||
vo.setKey((String)data.get("group_uid"));
|
||||
vo.setValue((String)data.get("group_name"));
|
||||
groups.add(vo);
|
||||
}
|
||||
rtn.put("folders", folders);
|
||||
rtn.put("groups",groups);
|
||||
|
||||
return rtn;
|
||||
|
||||
|
||||
}catch(Exception e){
|
||||
throw e;
|
||||
}finally{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright: Intellectual Property of Four Elements Capital Pte Ltd, Singapore.
|
||||
* All rights reserved.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
package com.fourelementscapital.rfunction.common;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public class SchedulerMgmt extends AbstractTeamOrgMgmt {
|
||||
|
||||
private Logger log = LogManager.getLogger(SchedulerMgmt.class.getName());
|
||||
private HttpServletRequest request=null;
|
||||
private static String USER="user";
|
||||
|
||||
/**
|
||||
* for DWR invocation
|
||||
* @throws Exception
|
||||
*/
|
||||
public SchedulerMgmt() throws Exception {
|
||||
super();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Invocation only when you have HttpRequest is available,
|
||||
* in JSP or internally.
|
||||
* @param request
|
||||
* @throws Exception
|
||||
*/
|
||||
public SchedulerMgmt(HttpServletRequest request) throws Exception {
|
||||
super(request);
|
||||
|
||||
}
|
||||
|
||||
protected String getPeerIPAddress() throws Exception {
|
||||
String rtn=(String) getRequest().getSession().getAttribute(REMOTE_IP);
|
||||
return rtn;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user