本文整理汇总了Java中gov.nih.nci.cadsr.domain.DataElement类的典型用法代码示例。如果您正苦于以下问题:Java DataElement类的具体用法?Java DataElement怎么用?Java DataElement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DataElement类属于gov.nih.nci.cadsr.domain包,在下文中一共展示了DataElement类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: findDEByOCConcept
import gov.nih.nci.cadsr.domain.DataElement; //导入依赖的package包/类
public List<gov.nih.nci.ncicb.cadsr.domain.DataElement> findDEByOCConcept(
gov.nih.nci.ncicb.cadsr.domain.Concept concept) {
try {
DetachedCriteria criteria = DetachedCriteria.forClass(
gov.nih.nci.cadsr.domain.DataElement.class, "de");
criteria.createCriteria("dataElementConcept")
.createCriteria("objectClass")
.createCriteria("conceptDerivationRule")
.createCriteria("componentConceptCollection")
.add(Expression.eq("primaryFlag", "Yes"))
.createCriteria("concept")
.add(Expression.eq("preferredName",
concept.getPreferredName()));
List results = service.query(criteria);
return new ArrayList<gov.nih.nci.ncicb.cadsr.domain.DataElement>(
CadsrTransformer.deListPublicToPrivate(results));
} catch (Exception e) {
throw new RuntimeException(e);
} // end of try-catch
}
开发者ID:NCIP,项目名称:cadsr-semantic-tools,代码行数:25,代码来源:CadsrPublicApiModule.java
示例2: findCADSRQuestionsById
import gov.nih.nci.cadsr.domain.DataElement; //导入依赖的package包/类
/**
* Queries CADSR repository for questions with the given UUIDs.
* @param idList
* @return
*/
@SuppressWarnings("unchecked")
public Map<String,gov.nih.nci.cadsr.domain.DataElement> findCADSRQuestionsById( String idList )
{
try
{
String xmlResults = queryCADSR( idList, CADSRSearchType.MULTIIDSEARCH );
@SuppressWarnings("rawtypes")
List<gov.nih.nci.cadsr.domain.DataElement> results = ( List ) XMLUtils.fromXML( xmlResults );
return transformCADSRResultsToMap(results);
}
catch (Exception ex)
{
ex.printStackTrace();
}
return null;
}
开发者ID:NCIP,项目名称:edct-formbuilder,代码行数:23,代码来源:CADSRManager.java
示例3: getSearchResults
import gov.nih.nci.cadsr.domain.DataElement; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public static List<?> getSearchResults( String questionSearchString, int questionSearchType )
{
List<?> results = new ArrayList<Question>();
try {
CADSRSearchType caDSRSearchType =
( questionSearchType == FormElementSearchCriteria.SEARCH_BY_CADSR_TEXT ? CADSRSearchType.TEXTSEARCH :
questionSearchType == FormElementSearchCriteria.SEARCH_BY_CADSR_CART_USER ? CADSRSearchType.CARTUSERSEARCH :
null );
String xmlResults = queryCADSR( questionSearchString, caDSRSearchType );
results = ( List<DataElement> ) XMLUtils.fromXML( xmlResults );
} catch (Exception ex) {
log.debug("Error occurred during CADSR search");
ex.printStackTrace();
}
return results;
}
开发者ID:NCIP,项目名称:edct-formbuilder,代码行数:18,代码来源:CADSRManager.java
示例4: getAnswerType
import gov.nih.nci.cadsr.domain.DataElement; //导入依赖的package包/类
private static AnswerType getAnswerType( DataElement question ) {
String cadsrDataType = question.getValueDomain().getDatatypeName();
AnswerType dataType = null;
if ( question.getValueDomain() instanceof EnumeratedValueDomain ) {
dataType = AnswerType.RADIO;
}
else if ( StringUtils.equalsIgnoreCase( cadsrDataType, DATE )) {
dataType = AnswerType.DATE;
}
else {
dataType = AnswerType.TEXT;
}
return dataType;
}
开发者ID:NCIP,项目名称:edct-formbuilder,代码行数:18,代码来源:CADSRManager.java
示例5: findDEByOCConcepts
import gov.nih.nci.cadsr.domain.DataElement; //导入依赖的package包/类
public List<gov.nih.nci.ncicb.cadsr.domain.DataElement> findDEByOCConcepts(
gov.nih.nci.ncicb.cadsr.domain.Concept[] concepts) {
try {
int i = 0;
StringBuffer ocNames = new StringBuffer();
for (Concept concept : concepts) {
if (i++ > 0)
ocNames.append(":");
ocNames.append(concept.getPreferredName());
}
DetachedCriteria criteria = DetachedCriteria.forClass(
gov.nih.nci.cadsr.domain.DataElement.class, "de");
criteria.createCriteria("dataElementConcept")
.createCriteria("objectClass")
.createCriteria("conceptDerivationRule")
.add(Expression.eq("name", ocNames.toString()));
List results = service.query(criteria);
return new ArrayList<gov.nih.nci.ncicb.cadsr.domain.DataElement>(
CadsrTransformer.deListPublicToPrivate(results));
} catch (Exception e) {
throw new RuntimeException(e);
} // end of try-catch
}
开发者ID:NCIP,项目名称:cadsr-semantic-tools,代码行数:30,代码来源:CadsrPublicApiModule.java
示例6: transformCADSRResultsToMap
import gov.nih.nci.cadsr.domain.DataElement; //导入依赖的package包/类
private static Map<String,DataElement> transformCADSRResultsToMap( List<DataElement> list){
Map<String,DataElement> results = new HashMap<String,DataElement>();
if ( list != null )
{
for ( Iterator<DataElement> iterator = list.iterator(); iterator.hasNext(); ) {
DataElement dataElement = iterator.next();
if ( dataElement.getId() != null ) results.put( dataElement.getId(), dataElement );
}
}
return results;
}
开发者ID:NCIP,项目名称:edct-formbuilder,代码行数:12,代码来源:CADSRManager.java
示例7: showCADSRFormElementSearchResults
import gov.nih.nci.cadsr.domain.DataElement; //导入依赖的package包/类
/**
* This method returns a list of (non-persisted) FormBuilder Question entities
* that correspond to the CADSR Question elements that match the search criteria
* provided in the given string.
* @author Oawofolu
*/
public List<FormElement> showCADSRFormElementSearchResults( FormElementSearchCriteria searchCriteria )
{
List<?> originalList = CADSRManager.getSearchResults( searchCriteria.getSearchText(), searchCriteria.getSearchType() );
List<FormElement> transformedList = new ArrayList<FormElement>();
for ( Object obj : originalList )
{
gov.nih.nci.cadsr.domain.DataElement question = (gov.nih.nci.cadsr.domain.DataElement) obj;
ExternalQuestionElement transformedQuestion = cadsrManager.transformCADSRQuestion( question );
transformedList.add( transformedQuestion );
}
return transformedList;
}
开发者ID:NCIP,项目名称:edct-formbuilder,代码行数:19,代码来源:QuestionAnswerManager.java
示例8: setUp
import gov.nih.nci.cadsr.domain.DataElement; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
ApplicationService appService = mock(ApplicationService.class);
when(appService.search(any(Class.class), any())).then(new Answer<List<Object>>() {
@Override
public List<Object> answer(InvocationOnMock invocation) throws Throwable {
DataElement de = new DataElement();
EnumeratedValueDomain vd = new EnumeratedValueDomain();
de.setValueDomain(vd);
vd.setDatatypeName("NUMBER");
vd.setLongName("Some Value Domain");
vd.setPublicID(Long.valueOf(2));
vd.setValueDomainPermissibleValueCollection(new HashSet<ValueDomainPermissibleValue>());
ValueDomainPermissibleValue vdpv = new ValueDomainPermissibleValue();
gov.nih.nci.cadsr.domain.PermissibleValue permissibleValue = new gov.nih.nci.cadsr.domain.PermissibleValue();
permissibleValue.setValue("1.0");
vdpv.setPermissibleValue(permissibleValue);
vd.getValueDomainPermissibleValueCollection().add(vdpv);
List<Object> objects = new ArrayList<Object>();
objects.add(de);
return objects;
}
});
CaDSRApplicationServiceFactory appFactory = mock(CaDSRApplicationServiceFactory.class);
when(appFactory.retrieveCaDsrApplicationService(anyString())).thenReturn(appService);
caDSRFacade = new CaDSRFacadeImpl();
caDSRFacade.setSearch(new SearchStub());
caDSRFacade.setCaDsrApplicationServiceFactory(appFactory);
}
开发者ID:NCIP,项目名称:caintegrator,代码行数:32,代码来源:CaDSRFacadeImplTest.java
示例9: findDataElement
import gov.nih.nci.cadsr.domain.DataElement; //导入依赖的package包/类
public Collection<gov.nih.nci.ncicb.cadsr.domain.DataElement> findDataElement(
Map<String, Object> queryFields) throws Exception {
gov.nih.nci.cadsr.domain.DataElement searchDE = new gov.nih.nci.cadsr.domain.DataElement();
gov.nih.nci.cadsr.domain.DataElement deTemp = null;
buildExample(searchDE, queryFields);
// List listResult = new ArrayList(new
// HashSet(service.search(gov.nih.nci.cadsr.domain.DataElement.class,
// searchDE)));
DetachedCriteria detachedCrit = DetachedCriteria
.forClass(DataElement.class)
.add(Property.forName("publicID").eq(searchDE.getPublicID()))
.add(Property.forName("version").eq(searchDE.getVersion()));
detachedCrit.setFetchMode("context", FetchMode.EAGER);
detachedCrit.setFetchMode("valueDomain", FetchMode.EAGER);
detachedCrit.setFetchMode("valueDomain.context", FetchMode.EAGER);
detachedCrit.setFetchMode("valueDomain.conceptualDomain",
FetchMode.EAGER);
detachedCrit.setFetchMode("valueDomain.represention", FetchMode.EAGER);
detachedCrit.setFetchMode("valueDomain.conceptualDomain.context",
FetchMode.EAGER);
detachedCrit.setFetchMode("valueDomain.represention.context",
FetchMode.EAGER);
detachedCrit.setFetchMode("dataElementConcept", FetchMode.EAGER);
detachedCrit
.setFetchMode("dataElementConcept.context", FetchMode.EAGER);
detachedCrit.setFetchMode("dataElementConcept.objectClass",
FetchMode.EAGER);
detachedCrit.setFetchMode("dataElementConcept.property",
FetchMode.EAGER);
detachedCrit.setFetchMode("dataElementConcept.conceptualDomain",
FetchMode.EAGER);
detachedCrit.setFetchMode("dataElementConcept.objectClass.context",
FetchMode.EAGER);
detachedCrit.setFetchMode("dataElementConcept.property.context",
FetchMode.EAGER);
detachedCrit.setFetchMode(
"dataElementConcept.conceptualDomain.context", FetchMode.EAGER);
List<DataElement> results = (List<DataElement>) (List<?>) service
.query(detachedCrit);
return CadsrTransformer.deListPublicToPrivate(results);
}
开发者ID:NCIP,项目名称:cadsr-semantic-tools,代码行数:49,代码来源:CadsrPublicApiModule.java
示例10: findDEByClassifiedAltName
import gov.nih.nci.cadsr.domain.DataElement; //导入依赖的package包/类
public Collection<gov.nih.nci.ncicb.cadsr.domain.DataElement> findDEByClassifiedAltName(
gov.nih.nci.ncicb.cadsr.domain.AlternateName altName,
gov.nih.nci.ncicb.cadsr.domain.ClassSchemeClassSchemeItem csCsi)
throws Exception {
DetachedCriteria detachedCrit = DetachedCriteria.forClass(
gov.nih.nci.cadsr.domain.DataElement.class, "de");
DetachedCriteria subCriteria = detachedCrit
.createCriteria("designationCollection");
subCriteria.add(Expression.eq("name", altName.getName()));
subCriteria.add(Expression.eq("type", altName.getType()));
subCriteria.createCriteria("designationClassSchemeItemCollection")
.createCriteria("classSchemeClassSchemeItem")
.add(Expression.eq("id", csCsi.getId()));
detachedCrit.setFetchMode("context", FetchMode.EAGER);
detachedCrit.setFetchMode("valueDomain", FetchMode.EAGER);
detachedCrit.setFetchMode("valueDomain.context", FetchMode.EAGER);
detachedCrit.setFetchMode("valueDomain.conceptualDomain",
FetchMode.EAGER);
detachedCrit.setFetchMode("valueDomain.represention", FetchMode.EAGER);
detachedCrit.setFetchMode("valueDomain.conceptualDomain.context",
FetchMode.EAGER);
detachedCrit.setFetchMode("valueDomain.represention.context",
FetchMode.EAGER);
detachedCrit.setFetchMode("dataElementConcept", FetchMode.EAGER);
detachedCrit
.setFetchMode("dataElementConcept.context", FetchMode.EAGER);
detachedCrit.setFetchMode("dataElementConcept.objectClass",
FetchMode.EAGER);
detachedCrit.setFetchMode("dataElementConcept.property",
FetchMode.EAGER);
detachedCrit.setFetchMode("dataElementConcept.conceptualDomain",
FetchMode.EAGER);
detachedCrit.setFetchMode("dataElementConcept.objectClass.context",
FetchMode.EAGER);
detachedCrit.setFetchMode("dataElementConcept.property.context",
FetchMode.EAGER);
detachedCrit.setFetchMode(
"dataElementConcept.conceptualDomain.context", FetchMode.EAGER);
List listResult = service.query(detachedCrit,
gov.nih.nci.cadsr.domain.DataElement.class.getName());
if (listResult.size() > 0) {
return CadsrTransformer.deListPublicToPrivate(listResult);
} else
return new ArrayList();
}
开发者ID:NCIP,项目名称:cadsr-semantic-tools,代码行数:53,代码来源:CadsrPublicApiModule.java
示例11: suggestDataElement
import gov.nih.nci.cadsr.domain.DataElement; //导入依赖的package包/类
/**
* Returns a list containing DataElements that are good candidates for the
* given class/attribute names. Currently, it searches for DataElements
* which have "class:attribute" as an alternate name (designation).
*/
public Collection<gov.nih.nci.ncicb.cadsr.domain.DataElement> suggestDataElement(
String className, String attrName) throws Exception {
// for now, just search on this, but we can do more searches in the
// future
final String altName = className + ":" + attrName;
DetachedCriteria detachedCrit = DetachedCriteria.forClass(
gov.nih.nci.cadsr.domain.DataElement.class, "de");
detachedCrit.createCriteria("designationCollection").add(
Expression.eq("name", altName));
detachedCrit.setFetchMode("context", FetchMode.EAGER);
detachedCrit.setFetchMode("valueDomain", FetchMode.EAGER);
detachedCrit.setFetchMode("valueDomain.context", FetchMode.EAGER);
detachedCrit.setFetchMode("valueDomain.conceptualDomain",
FetchMode.EAGER);
detachedCrit.setFetchMode("valueDomain.represention", FetchMode.EAGER);
detachedCrit.setFetchMode("valueDomain.conceptualDomain.context",
FetchMode.EAGER);
detachedCrit.setFetchMode("valueDomain.represention.context",
FetchMode.EAGER);
detachedCrit.setFetchMode("dataElementConcept", FetchMode.EAGER);
detachedCrit
.setFetchMode("dataElementConcept.context", FetchMode.EAGER);
detachedCrit.setFetchMode("dataElementConcept.objectClass",
FetchMode.EAGER);
detachedCrit.setFetchMode("dataElementConcept.property",
FetchMode.EAGER);
detachedCrit.setFetchMode("dataElementConcept.conceptualDomain",
FetchMode.EAGER);
detachedCrit.setFetchMode("dataElementConcept.objectClass.context",
FetchMode.EAGER);
detachedCrit.setFetchMode("dataElementConcept.property.context",
FetchMode.EAGER);
detachedCrit.setFetchMode(
"dataElementConcept.conceptualDomain.context", FetchMode.EAGER);
List results = service.query(detachedCrit);
return CadsrTransformer.deListPublicToPrivate(results);
}
开发者ID:NCIP,项目名称:cadsr-semantic-tools,代码行数:48,代码来源:CadsrPublicApiModule.java
示例12: matchDEToPropertyConcepts
import gov.nih.nci.cadsr.domain.DataElement; //导入依赖的package包/类
public boolean matchDEToPropertyConcepts(
gov.nih.nci.ncicb.cadsr.domain.DataElement de, String[] conceptCodes)
throws Exception {
if (StringUtil.isEmpty(de.getPublicId()))
return false;
gov.nih.nci.cadsr.domain.DataElement searchDE = new gov.nih.nci.cadsr.domain.DataElement();
searchDE.setPublicID(new Long(de.getPublicId()));
searchDE.setVersion(de.getVersion());
// List results = service.search(
// gov.nih.nci.cadsr.domain.DataElement.class.getName(), searchDE);
DetachedCriteria detachedCrit = DetachedCriteria
.forClass(DataElement.class)
.add(Property.forName("publicID").eq(searchDE.getPublicID()))
.add(Property.forName("version").eq(searchDE.getVersion()));
detachedCrit.setFetchMode("context", FetchMode.EAGER);
detachedCrit.setFetchMode("dataElementConcept", FetchMode.EAGER);
detachedCrit.setFetchMode("dataElementConcept.property",
FetchMode.EAGER);
detachedCrit.setFetchMode("dataElementConcept.property.conceptDerivationRule", FetchMode.EAGER);
detachedCrit.setFetchMode("dataElementConcept.property.conceptDerivationRule.componentConceptCollection", FetchMode.EAGER);
detachedCrit.setFetchMode("dataElementConcept.property.conceptDerivationRule.componentConceptCollection.concept", FetchMode.EAGER);
List<DataElement> results = (List<DataElement>) (List<?>) service
.query(detachedCrit);
if (results.size() == 0) {
logger.error("Can't find CDE : " + de.getPublicId() + " v "
+ de.getVersion() + "\\n Please contact support");
return false;
}
gov.nih.nci.cadsr.domain.DataElement resultDE = (gov.nih.nci.cadsr.domain.DataElement) results
.get(0);
gov.nih.nci.cadsr.domain.ConceptDerivationRule conDR = resultDE
.getDataElementConcept().getProperty()
.getConceptDerivationRule();
Collection compConcepts = conDR.getComponentConceptCollection();
ArrayList<gov.nih.nci.cadsr.domain.ComponentConcept> list = new ArrayList<gov.nih.nci.cadsr.domain.ComponentConcept>(compConcepts);
if (compConcepts.size() != conceptCodes.length)
return false;
// Iterator it = compConcepts.iterator();
for(int i=0;i<list.size();i++){
// while (it.hasNext()) {
ComponentConcept comp = (ComponentConcept) list.get(i);
if (!conceptCodes[comp.getDisplayOrder()].equals(comp.getConcept()
.getPreferredName()))
return false;
}
return true;
}
开发者ID:NCIP,项目名称:cadsr-semantic-tools,代码行数:63,代码来源:CadsrPublicApiModule.java
示例13: getXMLForAttributes
import gov.nih.nci.cadsr.domain.DataElement; //导入依赖的package包/类
/**
* Queries the XML for the DataElements associated with the attributes.
* @param attributes
* @return CDE XML for data elements associated with the attributes
*/
public String getXMLForAttributes(Collection<UMLAttributeMetadata> attributes) throws Exception {
XMLGeneratorBean cdeXmlGenerator = new XMLGeneratorBean();
Connection conn = null;
Connection oracleConn = null;
try {
conn = dataSource.getConnection();
//Get the OracleConnection
oracleConn = conn.getMetaData().getConnection();
if (!(oracleConn instanceof oracle.jdbc.driver.OracleConnection)){
log.error("DataElement XML download can work with OracleConnection only.");
throw new Exception("DataElement XML download can work with OracleConnection only.");
}
StringBuffer where = new StringBuffer(attributes.size()*33);
where.append("DE_IDSEQ IN ('-1'");
for(UMLAttributeMetadata attribute:attributes){
DataElement de = attribute.getDataElement();
where.append(",'"+de.getId()+"'");
}
where.append(")");
cdeXmlGenerator.setConnection(oracleConn);
cdeXmlGenerator.setQuery(cdeXMLQuery);
cdeXmlGenerator.setWhereClause(where.toString());
cdeXmlGenerator.setRowsetTag(rowSetTag);
cdeXmlGenerator.setRowTag(rowTag);
cdeXmlGenerator.displayNulls(true);
String xmlString = cdeXmlGenerator.getXMLString();
return xmlString;
}
catch (Exception e) {
log.error("Error getting CDE Xml.",e);
throw e;
}finally{
cdeXmlGenerator.closeResources();
if(conn != null){
conn.close();
}
if(oracleConn != null){
oracleConn.close();
}
}
}
开发者ID:NCIP,项目名称:cadsr-uml-model-browser,代码行数:48,代码来源:CaDSRQueryServiceImpl.java
示例14: retrieveDataElement
import gov.nih.nci.cadsr.domain.DataElement; //导入依赖的package包/类
/**
* @param CDEPublicID PublicID of the CDE to download
* @return the CDE if available or null if cde not available
* @throws Exception
*/
private CDE retrieveDataElement(XMLCDE xmlCDE) throws Exception
{
//Create the dataelement and set the dataEelement properties
DataElement dataElementQuery = new DataElementImpl();
// flag for whether to load the cde using PublicID or not.
boolean loadByPublicID = Boolean.getBoolean(ApplicationProperties.getValue("cde.load.by.publicid"));
if(loadByPublicID)
{
dataElementQuery.setPublicID(new Long(xmlCDE.getPublicId()));
} // loadByPublicID = true
else
{
dataElementQuery.setPreferredName(xmlCDE.getName());
} // else loadByPublicID = false
dataElementQuery.setLatestVersionIndicator(Constants.BOOLEAN_YES );
List resultList = appService.search(DataElement.class, dataElementQuery);
// check if any cde exists with the given public id.
if (resultList!=null && !resultList.isEmpty())
{
//retreive the Data Element for the given search condition
DataElement dataElement = (DataElement) resultList.get(0);
//Mandar : bug1622: Use of parameterised constructor
// create the cde object and set the values.
CDEImpl cdeobj = new CDEImpl(dataElement.getPublicID().toString(),dataElement.getPreferredName(),
dataElement.getLongName(),dataElement.getPreferredDefinition(),
dataElement.getVersion().toString(),dataElement.getDateModified());
Logger.out.debug("CDE Public Id : "+cdeobj.getPublicId());
Logger.out.debug("CDE Def : "+cdeobj.getDefination());
Logger.out.debug("CDE Long Name : "+cdeobj.getLongName());
Logger.out.debug("CDE Version : "+cdeobj.getVersion());
Logger.out.debug("CDE Perferred Name : "+cdeobj.getPreferredName());
Logger.out.debug("CDE Last Modified Date : "+cdeobj.getDateLastModified());
//Access the permissible value.
ValueDomain valueDomain = dataElement.getValueDomain();
Logger.out.debug("valueDomain class : " + valueDomain.getClass());
if(valueDomain instanceof EnumeratedValueDomain)
{
EnumeratedValueDomain enumValueDomain = (EnumeratedValueDomain)valueDomain;
Collection permissibleValueCollection = enumValueDomain.getValueDomainPermissibleValueCollection();
Set permissibleValues = getPermissibleValues(permissibleValueCollection);
cdeobj.setPermissibleValues(permissibleValues);
} // valueDomain instanceof EnumeratedValueDomain
return cdeobj;
} // resultList!=null && !resultList.isEmpty()
else //no Data Element retreived
{
return null;
}
}
开发者ID:NCIP,项目名称:wustl-common-package,代码行数:66,代码来源:CDEDownloader.java
示例15: transformCADSRQuestion
import gov.nih.nci.cadsr.domain.DataElement; //导入依赖的package包/类
public ExternalQuestionElement transformCADSRQuestion(gov.nih.nci.cadsr.domain.DataElement sourceQuestion, AnswerType answerType, Set<String> deletedAnswerValues)
{
// int numAnswers = 1;
ExternalQuestionElement targetElement = new ExternalQuestionElement();
targetElement.setExternalUuid ( sourceQuestion.getId() );
targetElement.setDescription ( getQuestionDescription( sourceQuestion ) );
targetElement.setLearnMore ( sourceQuestion.getPreferredDefinition() );
targetElement.setSourceId(String.valueOf(sourceQuestion.getPublicID()) );
// targetElement.setType ( getQuestionType( sourceQuestion ) );
targetElement.setLink ( QuestionSource.CA_DSR, String.valueOf( sourceQuestion.getPublicID() ) );
targetElement.setExternalVersion( sourceQuestion.getVersion() );
AnswerType finalAnswerType = answerType == null ? getAnswerType(sourceQuestion) : answerType;
//create a question
ExternalQuestion targetQuestion = new ExternalQuestion();
targetQuestion.setShortName ( sourceQuestion.getPreferredName() );
targetQuestion.setType(AnswerType.CHECKBOX.equals(finalAnswerType) ? QuestionType.MULTI_ANSWER : QuestionType.SINGLE_ANSWER);
targetElement.setQuestion(targetQuestion);
// set answers/answer-related properties
Answer answer = new Answer();
answer.setType ( finalAnswerType );
answer.setDescription ( sourceQuestion.getLongName() );
targetElement.setAnswerType(answer.getType());
if ( sourceQuestion.getValueDomain() instanceof EnumeratedValueDomain )
{
// Set the answer values
Collection<ValueDomainPermissibleValue> coll =
((EnumeratedValueDomain)sourceQuestion.getValueDomain()).getValueDomainPermissibleValueCollection();
int numAnswerValues = 0;
for ( ValueDomainPermissibleValue val : coll )
{
AnswerValue answerValue = new AnswerValue();
PermissibleValue permissibleValue = val.getPermissibleValue();
if(deletedAnswerValues != null && deletedAnswerValues.contains(permissibleValue.getId())) {
continue;
}
answerValue.setExternalId ( permissibleValue.getId() );
answerValue.setValue ( permissibleValue.getValue() );
answerValue.setDescription ( permissibleValue.getValue() );
answerValue.setName ( permissibleValue.getValue() );
answerValue.setCadsrPublicId ( permissibleValue.getValueMeaning() == null ?
null :
permissibleValue.getValueMeaning().getPublicID() );
answerValue.setOrd ( ++numAnswerValues );
answer.addAnswerValues ( answerValue );
}
}
// If there were no answer values, then
// add a dummy value to prevent the AnswerPresenter custom tag from crashing
if ( CollectionUtils.isEmpty( answer.getAnswerValues()) )
{
answer.addDefaultAnswerValue();
}
targetQuestion.setAnswer( answer );
return targetElement;
}
开发者ID:NCIP,项目名称:edct-formbuilder,代码行数:65,代码来源:CADSRManager.java
示例16: getQuestionDescription
import gov.nih.nci.cadsr.domain.DataElement; //导入依赖的package包/类
private static String getQuestionDescription( DataElement question ) {
String description = null;
Iterator<gov.nih.nci.cadsr.domain.ReferenceDocument> iterator = question.getReferenceDocumentCollection().iterator();
if ( iterator.hasNext() ) description = iterator.next().getDoctext();
return description;
}
开发者ID:NCIP,项目名称:edct-formbuilder,代码行数:7,代码来源:CADSRManager.java
示例17: buildNewQuestions
import gov.nih.nci.cadsr.domain.DataElement; //导入依赖的package包/类
@Transactional
public List<FormElement> buildNewQuestions( String[][] questionSet, int searchCriteria ) {
List<FormElement> newElements = new ArrayList<FormElement>();
Map<String,DataElement> dataElements = new HashMap<String,DataElement>();
int numElements = questionSet.length;
String[] questionIdList = new String[ numElements ];
String[] answerTypeList = new String[ numElements ];
String[] deletedAnswerValuesList = new String[ numElements ];
for ( int i = 0; i < numElements; ++i )
{
questionIdList[i] = questionSet[i][0];
answerTypeList[i] = questionSet[i][1];
if ( questionSet[i].length > 2 )
deletedAnswerValuesList[i] = questionSet[i][2];
}
for ( int i = 0; i < numElements; ++i ) {
String uuid = questionIdList[ i ];
// The following 2 variables are not used. I am leaving them in case the accessors are used
// to load lazy collections - LK
String answerType = answerTypeList[ i ];
HashSet<String> deletedAnswerValues = new HashSet<String>();
if(StringUtils.isNotBlank(deletedAnswerValuesList[ i ])) {
deletedAnswerValues.addAll(Arrays.asList(deletedAnswerValuesList[ i ].split("\\s*,\\s*")));
}
if ( searchCriteria == FormElementSearchCriteria.SEARCH_BY_CADSR_TEXT // CADSR Text Search
|| searchCriteria == FormElementSearchCriteria.SEARCH_BY_CADSR_CART_USER ) // CADSR Cart User Search
{
if ( i== 0 ) dataElements = cadsrManager.findCADSRQuestionsById( StringUtils.join( questionIdList, SPLITTER ) );
DataElement dataElement = dataElements.get( uuid );
if ( dataElement != null ) {
FormElement newElement;
AnswerType answerTypeEnumEntry = AnswerType.valueOf(answerType);
newElement = cadsrManager.transformCADSRQuestion(dataElement, answerTypeEnumEntry, deletedAnswerValues);
newElements.add( newElement );
}
}
else // local
{
LinkElement linkElement = new LinkElement();
FormElement source = linkDao.getLinkSource(uuid);
linkElement.setLearnMore(source.getLearnMore());
linkElement.setVisible(source.isVisible());
linkElement.setRequired(source.isRequired());
linkElement.setReadonly(source.isReadonly());
linkElement.setDescription(source.getDescription());
linkElement.setSource(source);
newElements.add( linkElement );
}
}
modifyShortNames(newElements);
return newElements;
}
开发者ID:NCIP,项目名称:edct-formbuilder,代码行数:57,代码来源:QuestionAnswerManager.java
示例18: getDataElement
import gov.nih.nci.cadsr.domain.DataElement; //导入依赖的package包/类
/**
* Retreives the value of dataElement attribue
* @return dataElement
**/
public DataElement getDataElement(){
return dataElement;
}
开发者ID:NCIP,项目名称:cagrid2,代码行数:9,代码来源:UMLAttributeMetadata.java
示例19: setDataElement
import gov.nih.nci.cadsr.domain.DataElement; //导入依赖的package包/类
/**
* Sets the value of dataElement attribue
**/
public void setDataElement(DataElement dataElement){
this.dataElement = dataElement;
}
开发者ID:NCIP,项目名称:cagrid2,代码行数:8,代码来源:UMLAttributeMetadata.java
注:本文中的gov.nih.nci.cadsr.domain.DataElement类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论