use of com.creditease.uav.exception.ApphubException in project uavstack by uavorg.
the class GUISSOClientFactory method createGUISSOClient.
private static GUISSOClient createGUISSOClient(HttpServletRequest request) {
String ClientImplClassName = request.getServletContext().getInitParameter("uav.apphub.sso.implclass");
if (StringHelper.isEmpty(ClientImplClassName)) {
ClientImplClassName = "com.creditease.uav.apphub.sso.GUISSOLdapClient";
}
GUISSOClient GUISSOClientImpl = null;
try {
Class<?> cls = request.getClass().getClassLoader().loadClass(ClientImplClassName);
GUISSOClientImpl = (GUISSOClient) cls.getDeclaredConstructor(HttpServletRequest.class).newInstance(request);
} catch (Exception e) {
throw new ApphubException(e);
}
return GUISSOClientImpl;
}
use of com.creditease.uav.exception.ApphubException in project uavstack by uavorg.
the class GUISSOLdapClient method formatEmailInfo.
@SuppressWarnings("rawtypes")
private String formatEmailInfo(Attribute attr) {
if (null == attr) {
return "";
}
StringBuilder values = new StringBuilder();
boolean isFormat = false;
try {
String formatS = "=";
String attrId = attr.getID();
String groupKey = ldapConfig.get("groupKey");
String groupTag = ldapConfig.get("groupTag");
for (NamingEnumeration vals = attr.getAll(); vals.hasMore(); ) {
String strValue = vals.next().toString();
if (groupKey.equals(attrId) && strValue.indexOf(groupTag) >= 0) {
values.append(",");
isFormat = true;
if (strValue.indexOf(formatS) == -1) {
values.append(strValue);
continue;
}
int begin = strValue.indexOf(formatS) + formatS.length();
int end = strValue.indexOf(",");
values.append(strValue.substring(begin, end));
}
}
} catch (Exception e) {
loggerError("formatEmailInfo 555", "", e);
throw new ApphubException(e);
}
/**
* 去除第一个逗号
*/
String result = "";
if (isFormat) {
result = values.toString().substring(1);
}
return result;
}
use of com.creditease.uav.exception.ApphubException in project uavstack by uavorg.
the class AppHubInit method initApp.
private void initApp(final String id, final String appName) {
try {
Map<String, Object> modify = new HashMap<String, Object>();
Map<String, Object> where = new HashMap<String, Object>();
where.put("appid", id);
modify.put("where", where);
byte[] modifyData = getRequestData(manageTypeApp, createHttpMapRequest(bussinessTypeModify, modify));
run(manageTypeApp, modifyData, new ManageTestCallback() {
@Override
public void completed(HttpClientCallbackResult result) {
logger.info(this, "AppHubInit ADD APP:uavapp_" + appName);
Map<String, Object> app1 = new HashMap<String, Object>();
String appUrlStr = appName;
app1.put("appid", id);
app1.put("appurl", appUrlStr);
app1.put("state", 1);
app1.put("createtime", ctime);
app1.put("operationtime", ctime);
app1.put("operationuser", operationuser);
byte[] addData = getRequestData(manageTypeApp, createHttpMapRequest(bussinessTypeCreate, app1));
run(manageTypeApp, addData, new ManageTestCallback());
}
});
} catch (Exception e) {
logger.err(this, e.getMessage(), e);
throw new ApphubException(e);
}
}
use of com.creditease.uav.exception.ApphubException in project uavstack by uavorg.
the class AppHubInit method initGroup.
/**
* @param groupid
* @param appids
* @param isAdd
* 多个用,号隔开
* @throws Exception
*/
protected void initGroup(final String groupid, final String appids, final boolean isAdd) {
try {
Map<String, Object> modify = new HashMap<String, Object>();
Map<String, Object> where = new HashMap<String, Object>();
where.put("groupid", groupid);
modify.put("where", where);
byte[] modifyData = getRequestData(manageTypeGroup, createHttpMapRequest(bussinessTypeModify, modify));
GroupCallBack groupGb = new GroupCallBack();
groupGb.setAdd(isAdd);
groupGb.setAppids(appids);
groupGb.setGroupid(groupid);
run(manageTypeGroup, modifyData, groupGb);
} catch (Exception e) {
logger.err(this, e.getMessage(), e);
throw new ApphubException(e);
}
}
Aggregations