use of com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException in project otter by alibaba.
the class DataMediaPairAction method doAdd.
/**
* 添加DataMediaPair
*
* @param channelInfo
* @param channelParameterInfo
* @throws Exception
*/
public void doAdd(@Param("submitKey") String submitKey, @FormGroup("dataMediaPairInfo") Group dataMediaPairInfo, @FormField(name = "formDataMediaPairError", group = "dataMediaPairInfo") CustomErrors err, Navigator nav) throws Exception {
DataMediaPair dataMediaPair = new DataMediaPair();
DataMedia sourceDataMedia = new DataMedia();
DataMedia targetDataMedia = new DataMedia();
dataMediaPairInfo.setProperties(dataMediaPair);
// filter解析
ExtensionDataType filterType = ExtensionDataType.valueOf(dataMediaPairInfo.getField("filterType").getStringValue());
ExtensionData filterData = new ExtensionData();
filterData.setExtensionDataType(filterType);
if (filterType.isClazz()) {
filterData.setClazzPath(dataMediaPairInfo.getField("filterText").getStringValue());
} else if (filterType.isSource()) {
filterData.setSourceText(dataMediaPairInfo.getField("filterText").getStringValue());
}
dataMediaPair.setFilterData(filterData);
// fileresovler解析
ExtensionDataType resolverType = ExtensionDataType.valueOf(dataMediaPairInfo.getField("resolverType").getStringValue());
ExtensionData resolverData = new ExtensionData();
resolverData.setExtensionDataType(resolverType);
if (resolverType.isClazz()) {
resolverData.setClazzPath(dataMediaPairInfo.getField("resolverText").getStringValue());
} else if (resolverType.isSource()) {
resolverData.setSourceText(dataMediaPairInfo.getField("resolverText").getStringValue());
}
dataMediaPair.setResolverData(resolverData);
sourceDataMedia.setId(dataMediaPairInfo.getField("sourceDataMediaId").getLongValue());
dataMediaPair.setSource(sourceDataMedia);
targetDataMedia.setId(dataMediaPairInfo.getField("targetDataMediaId").getLongValue());
dataMediaPair.setTarget(targetDataMedia);
Long id = 0L;
try {
id = dataMediaPairService.createAndReturnId(dataMediaPair);
} catch (RepeatConfigureException rce) {
err.setMessage("invalidDataMediaPair");
return;
}
if (submitKey.equals("保存")) {
nav.redirectToLocation("dataMediaPairList.htm?pipelineId=" + dataMediaPair.getPipelineId());
} else if (submitKey.equals("下一步")) {
nav.redirectToLocation("addColumnPair.htm?dataMediaPairId=" + id + "&pipelineId=" + dataMediaPair.getPipelineId() + "&dataMediaPairId=" + id + "&sourceMediaId=" + sourceDataMedia.getId() + "&targetMediaId=" + targetDataMedia.getId());
}
}
use of com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException in project otter by alibaba.
the class NodeAction method doEdit.
/**
* 修改Node
*/
public void doEdit(@FormGroup("nodeInfo") Group nodeInfo, @FormGroup("nodeParameterInfo") Group nodeParameterInfo, @Param("pageIndex") int pageIndex, @Param("searchKey") String searchKey, @FormField(name = "formNodeError", group = "nodeInfo") CustomErrors err, Navigator nav) throws Exception {
Node node = new Node();
NodeParameter parameter = new NodeParameter();
nodeInfo.setProperties(node);
nodeParameterInfo.setProperties(parameter);
if (parameter.getDownloadPort() == null || parameter.getDownloadPort() == 0) {
parameter.setDownloadPort(node.getPort().intValue() + 1);
}
if (parameter.getMbeanPort() == null || parameter.getMbeanPort() == 0) {
parameter.setMbeanPort(node.getPort().intValue() + 2);
}
Long autoKeeperclusterId = nodeParameterInfo.getField("autoKeeperclusterId").getLongValue();
if (autoKeeperclusterId != null && autoKeeperclusterId > 0) {
AutoKeeperCluster autoKeeperCluster = autoKeeperClusterService.findAutoKeeperClusterById(autoKeeperclusterId);
parameter.setZkCluster(autoKeeperCluster);
}
node.setParameters(parameter);
try {
nodeService.modify(node);
} catch (RepeatConfigureException rce) {
err.setMessage("invalidNode");
return;
}
nav.redirectToLocation("nodeList.htm?pageIndex=" + pageIndex + "&searchKey=" + urlEncode(searchKey));
}
use of com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException in project otter by alibaba.
the class NodeAction method doAdd.
public void doAdd(@FormGroup("nodeInfo") Group nodeInfo, @FormGroup("nodeParameterInfo") Group nodeParameterInfo, @FormField(name = "formNodeError", group = "nodeInfo") CustomErrors err, Navigator nav) throws Exception {
Node node = new Node();
NodeParameter parameter = new NodeParameter();
nodeInfo.setProperties(node);
nodeParameterInfo.setProperties(parameter);
if (parameter.getDownloadPort() == null || parameter.getDownloadPort() == 0) {
parameter.setDownloadPort(node.getPort().intValue() + 1);
}
if (parameter.getMbeanPort() == null || parameter.getMbeanPort() == 0) {
parameter.setMbeanPort(node.getPort().intValue() + 2);
}
Long autoKeeperclusterId = nodeParameterInfo.getField("autoKeeperclusterId").getLongValue();
if (autoKeeperclusterId != null && autoKeeperclusterId > 0) {
AutoKeeperCluster autoKeeperCluster = autoKeeperClusterService.findAutoKeeperClusterById(autoKeeperclusterId);
parameter.setZkCluster(autoKeeperCluster);
}
node.setParameters(parameter);
try {
nodeService.create(node);
} catch (RepeatConfigureException rce) {
err.setMessage("invalidNode");
return;
}
nav.redirectTo(WebConstant.NODE_LIST_LINK);
}
use of com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException in project otter by alibaba.
the class PipelineAction method doAdd.
public void doAdd(@FormGroup("pipelineInfo") Group pipelineInfo, @FormGroup("pipelineParameterInfo") Group pipelineParameterInfo, @FormField(name = "formPipelineError", group = "pipelineInfo") CustomErrors err, HttpSession session, Navigator nav) throws Exception {
Pipeline pipeline = new Pipeline();
PipelineParameter parameters = new PipelineParameter();
pipelineInfo.setProperties(pipeline);
pipelineParameterInfo.setProperties(parameters);
// if (parameters.getLoadPoolSize() < 1) {
// parameters.setLoadPoolSize(PipelineParameter.DEFAULT_LOAD_POOL_SIZE);
// }
List<Long> selectNodeIds = Arrays.asList(ArrayUtils.toObject(pipelineInfo.getField("selectNodeIds").getLongValues()));
List<Node> selectNodes = new ArrayList<Node>();
for (Long selectNodeId : selectNodeIds) {
Node node = new Node();
node.setId(selectNodeId);
selectNodes.add(node);
}
// select/extract节点普遍配置为同一个节点
List<Long> extractNodeIds = Arrays.asList(ArrayUtils.toObject(pipelineInfo.getField("selectNodeIds").getLongValues()));
// List<Long> extractNodeIds =
// Arrays.asList(ArrayUtils.toObject(pipelineInfo.getField("extractNodeIds").getLongValues()));
List<Node> extractNodes = new ArrayList<Node>();
for (Long extractNodeId : extractNodeIds) {
Node node = new Node();
node.setId(extractNodeId);
extractNodes.add(node);
}
List<Long> loadNodeIds = Arrays.asList(ArrayUtils.toObject(pipelineInfo.getField("loadNodeIds").getLongValues()));
List<Node> loadNodes = new ArrayList<Node>();
for (Long loadNodeId : loadNodeIds) {
Node node = new Node();
node.setId(loadNodeId);
loadNodes.add(node);
}
pipeline.setSelectNodes(selectNodes);
pipeline.setExtractNodes(extractNodes);
pipeline.setLoadNodes(loadNodes);
pipeline.setParameters(parameters);
List<Pipeline> values = pipelineService.listByDestinationWithoutOther(pipeline.getParameters().getDestinationName());
if (!values.isEmpty()) {
err.setMessage("invalidDestinationName");
return;
}
try {
pipelineService.create(pipeline);
} catch (RepeatConfigureException rce) {
err.setMessage("invalidPipelineName");
return;
}
nav.redirectToLocation("pipelineList.htm?channelId=" + pipeline.getChannelId());
}
use of com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException in project otter by alibaba.
the class UserAction method doAdd.
public void doAdd(@FormGroup("addUserInfo") Group userInfo, Navigator nav, @FormField(name = "formUserError", group = "addUserInfo") CustomErrors err) {
User user = new User();
userInfo.setProperties(user);
user.setPassword(SecurityUtils.getPassword(user.getPassword()));
try {
userService.createUser(user);
} catch (RepeatConfigureException rce) {
err.setMessage("invalidUser");
return;
}
nav.redirectTo(WebConstant.USER_MANAGER_LINK);
}
Aggregations