OperationAttributeSimulateManagerImpl.java
package com.mycim.server.ctx.exec.manager.impl;
import com.fa.sesa.threadlocal.LocalContext;
import com.mycim.server.base.manager.NamedObjectManager;
import com.mycim.server.ctx.exec.manager.OperationAttributeSimulateManager;
import com.mycim.server.ctx.manager.ContextValueManager;
import com.mycim.valueobject.ObjectList;
import com.mycim.valueobject.context.dto.QueryContextValueDTO;
import com.mycim.valueobject.prp.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.lang.Override;
@Service
public class OperationAttributeSimulateManagerImpl implements OperationAttributeSimulateManager {
@Autowired
NamedObjectManager namedObjectManager;
@Autowired
ContextValueManager contextValueManager;
@Override
public OperationDESCContextValue simulateOperationDESCContextValue(QueryContextValueDTO queryContextValue) {
OperationDESCContextValue operationDescContextValue = new OperationDESCContextValue();
operationDescContextValue.setContextRrn(namedObjectManager
.getNamedObjectRrn(operationDescContextValue.getContextId(),
LocalContext.getFacilityRrn(),
ObjectList.CONTEXT_KEY));
operationDescContextValue.setProductRrn(queryContextValue.getProductRrn());
operationDescContextValue.setProcessRrn(queryContextValue.getProcessRrn());
operationDescContextValue.setProcessVersion(queryContextValue.getProcessVersion());
operationDescContextValue.setRouteRrn(queryContextValue.getRouteRrn());
operationDescContextValue.setOperationRrn(queryContextValue.getOperationRrn());
ContextValue contextValue = contextValueManager.simulateContextValue(operationDescContextValue);
if (contextValue != null) {
operationDescContextValue.copy(contextValue);
}
return operationDescContextValue;
}
@Override
public ProcessLocationContextValue simulateProcessLocationContextValue(QueryContextValueDTO queryContextValue) {
ProcessLocationContextValue processLocationContextValue = new ProcessLocationContextValue();
processLocationContextValue.setContextRrn(namedObjectManager
.getNamedObjectRrn(processLocationContextValue.getContextId(),
LocalContext.getFacilityRrn(),
ObjectList.CONTEXT_KEY));
processLocationContextValue.setProductRrn(queryContextValue.getProductRrn());
processLocationContextValue.setProcessRrn(queryContextValue.getProcessRrn());
processLocationContextValue.setProcessVersion(queryContextValue.getProcessVersion());
processLocationContextValue.setRouteRrn(queryContextValue.getRouteRrn());
processLocationContextValue.setOperationRrn(queryContextValue.getOperationRrn());
ContextValue contextValue = contextValueManager.simulateContextValue(processLocationContextValue);
if (contextValue != null) {
processLocationContextValue.copy(contextValue);
}
return processLocationContextValue;
}
@Override
public StageContextValue simulateStageContextValue(QueryContextValueDTO queryContextValue) {
StageContextValue stageContextValue = new StageContextValue();
stageContextValue.setContextRrn(namedObjectManager.getNamedObjectRrn(stageContextValue.getContextId(),
LocalContext.getFacilityRrn(),
ObjectList.CONTEXT_KEY));
stageContextValue.setProductRrn(queryContextValue.getProductRrn());
stageContextValue.setProcessRrn(queryContextValue.getProcessRrn());
stageContextValue.setProcessVersion(queryContextValue.getProcessVersion());
stageContextValue.setRouteRrn(queryContextValue.getRouteRrn());
stageContextValue.setOperationRrn(queryContextValue.getOperationRrn());
ContextValue contextValue = contextValueManager.simulateContextValue(stageContextValue);
if (contextValue != null) {
stageContextValue.copy(contextValue);
}
return stageContextValue;
}
@Override
public ProcessOperationDescContextValue simulateProcessOperationDescContextValue(
QueryContextValueDTO queryContextValue) {
ProcessOperationDescContextValue operationDescContextValue = new ProcessOperationDescContextValue();
operationDescContextValue.setContextRrn(namedObjectManager
.getNamedObjectRrn(operationDescContextValue.getContextId(),
LocalContext.getFacilityRrn(),
ObjectList.CONTEXT_KEY));
operationDescContextValue.setProductRrn(queryContextValue.getProductRrn());
operationDescContextValue.setProcessRrn(queryContextValue.getProcessRrn());
operationDescContextValue.setProcessVersion(queryContextValue.getProcessVersion());
operationDescContextValue.setRouteRrn(queryContextValue.getRouteRrn());
operationDescContextValue.setOperationRrn(queryContextValue.getOperationRrn());
ContextValue contextValue = contextValueManager.simulateContextValue(operationDescContextValue);
if (contextValue != null) {
operationDescContextValue.copy(contextValue);
}
return operationDescContextValue;
}
@Override
public ResequenceContextValue simulateResequenceContextValue(QueryContextValueDTO queryContextValue) {
ResequenceContextValue resequenceContextValue = new ResequenceContextValue();
resequenceContextValue.setContextRrn(namedObjectManager.getNamedObjectRrn(resequenceContextValue.getContextId(),
LocalContext.getFacilityRrn(),
ObjectList.CONTEXT_KEY));
resequenceContextValue.setProcessRrn(queryContextValue.getProcessRrn());
resequenceContextValue.setProcessVersion(queryContextValue.getProcessVersion());
resequenceContextValue.setRouteRrn(queryContextValue.getRouteRrn());
resequenceContextValue.setOperationRrn(queryContextValue.getOperationRrn());
ContextValue contextValue = contextValueManager.simulateContextValue(resequenceContextValue);
if (contextValue != null) {
resequenceContextValue.copy(contextValue);
}
return resequenceContextValue;
}
}