本文整理汇总了Java中com.raizlabs.android.dbflow.sql.builder.Condition类的典型用法代码示例。如果您正苦于以下问题:Java Condition类的具体用法?Java Condition怎么用?Java Condition使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Condition类属于com.raizlabs.android.dbflow.sql.builder包,在下文中一共展示了Condition类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getModelsOfType
import com.raizlabs.android.dbflow.sql.builder.Condition; //导入依赖的package包/类
private List<EpisodeBaseModel> getModelsOfType(Class<?> model, String type, List<EpisodeBaseModel> existing, boolean uniqueSeries) {
FlowCursorList<EpisodeBaseModel> cursor = new FlowCursorList<>(false, EpisodeBaseModel.class,
Condition.column(EpisodeBaseModel$Table.DATA_TYPE).eq(type));
Map<String, EpisodeBaseModel> all = new HashMap<>();
for (int i = 0, k = cursor.getCount(); i < k; i++) {
EpisodeBaseModel ep = (EpisodeBaseModel) createInstanceOf(model);
if (ep != null) {
int index = existing.indexOf(ep);
if (index > -1) {
ep = existing.get(index);
} else {
EpisodeBaseModel item = cursor.getItem(i);
item.unserialize();
ep.merge(item);
}
if (uniqueSeries) {
all.put(ep.getSeriesTitle(), ep);
} else {
all.put(ep.getHref(), ep);
}
}
}
cursor.close();
return new ArrayList<>(all.values());
}
示例2: findProgramStageSection
import com.raizlabs.android.dbflow.sql.builder.Condition; //导入依赖的package包/类
/**
* Find the associated programStageSection (tab)UID given a dataelement UID
*
* @return
*/
public String findProgramStageSection() {
List<ProgramStageSection> programStageSections = new Select().from(ProgramStageSection.class).as("pss")
.join(ProgramStageDataElement.class, Join.JoinType.LEFT).as("psde")
.on(Condition.column(ColumnAlias.columnWithTable("pss", ProgramStageSection$Table.ID))
.eq(ColumnAlias.columnWithTable("psde", ProgramStageDataElement$Table.PROGRAMSTAGESECTION)))
.where(Condition.column(ColumnAlias.columnWithTable("psde", ProgramStageDataElement$Table.DATAELEMENT)).eq(getDataElement().getUid()))
.queryList();
if (programStageSections == null) {
return null;
}
for(ProgramStageSection programStageSection:programStageSections){
if(MetaDataController.getProgramStage(programStageSection.getProgramStage()).getProgram().getUid().equals(programUid))
return programStageSection.getUid();
}
return null;
}
示例3: findProgramStageDataElementByDataElementExtended
import com.raizlabs.android.dbflow.sql.builder.Condition; //导入依赖的package包/类
/**
* Find the associated ProgramStageDataElement (tab) given a DataElementExtended
*
* @param dataElementExtended
* @return
*/
public static ProgramStageDataElement findProgramStageDataElementByDataElementExtended(DataElementExtended dataElementExtended) {
String dataElementUID=dataElementExtended.getDataElement().getUid();
String programUID=dataElementExtended.getProgramUid();
//Find the right 'uid' of the dataelement program
List <ProgramStageDataElement> programDES = new Select().from(ProgramStageDataElement.class).as("psde")
.where(Condition.column(ColumnAlias.columnWithTable("psde", ProgramStageDataElement$Table.DATAELEMENT)).eq(dataElementUID))
.queryList();
if (programDES == null) {
return null;
}
for(ProgramStageDataElement programStageDataElement:programDES){
if(MetaDataController.getProgramStage(programStageDataElement.getProgramStage()).getProgram().getUid().equals(programUID))
return programStageDataElement;
}
return null;
}
示例4: findOrganisationUnitAttributeValueByCode
import com.raizlabs.android.dbflow.sql.builder.Condition; //导入依赖的package包/类
/**
* Finds the value of an attribute with the given code in a dataElement
* @param code
* @return
*/
public String findOrganisationUnitAttributeValueByCode(String code){
OrganisationUnitAttributeValue organisationUnitAttributeValue = new Select().from(OrganisationUnitAttributeValue.class).as("o")
.join(Attribute.class, Join.JoinType.LEFT).as("a")
.on(Condition.column(ColumnAlias.columnWithTable("o", OrganisationUnitAttributeValue$Table.ATTRIBUTEID))
.eq(ColumnAlias.columnWithTable("a", Attribute$Table.ID)))
.where(Condition.column(ColumnAlias.columnWithTable("a", Attribute$Table.CODE))
.eq(code))
.and(Condition.column(ColumnAlias.columnWithTable("o", OrganisationUnitAttributeValue$Table.ORGANISATIONUNIT)).is(this.getOrgUnit().getId()))
.querySingle();
if(organisationUnitAttributeValue==null){
return "";
}
return organisationUnitAttributeValue.getValue();
}
示例5: getProductivityPosition
import com.raizlabs.android.dbflow.sql.builder.Condition; //导入依赖的package包/类
public Integer getProductivityPosition() {
ProgramAttributeValue programAttributeValue = new Select().from(ProgramAttributeValue.class).as("p")
.join(Attribute.class, Join.JoinType.LEFT).as("a")
.on(Condition.column(ColumnAlias.columnWithTable("p", ProgramAttributeValue$Table.ATTRIBUTEID))
.eq(ColumnAlias.columnWithTable("a", Attribute$Table.ID)))
.where(Condition.column(ColumnAlias.columnWithTable("a", Attribute$Table.CODE))
.eq(PROGRAM_PRODUCTIVITY_POSITION_ATTRIBUTE_CODE))
.and(Condition.column(ColumnAlias.columnWithTable("p", ProgramAttributeValue$Table.PROGRAM)).is(this.getProgram().getUid()))
.querySingle();
if(programAttributeValue==null){
return null;
}
try {
return Integer.parseInt(programAttributeValue.getValue());
}catch(Exception ex){
Log.e(TAG, String.format("getProductivityPosition(%s) -> %s", this.getProgram().getUid(), ex.getMessage()));
return null;
}
}
示例6: getProductivity
import com.raizlabs.android.dbflow.sql.builder.Condition; //导入依赖的package包/类
/**
* Helper method to get the productivity for a given survey.
* If its orgunit + program combination does NOT have a productivity value then returns 0
* @param survey
* @return
*/
public static Integer getProductivity(Survey survey){
if(survey==null){
return DEFAULT_PRODUCTIVITY;
}
OrgUnit orgUnit = survey.getOrgUnit();
if(orgUnit==null){
return DEFAULT_PRODUCTIVITY;
}
Program program = survey.getProgram();
if(program==null){
return DEFAULT_PRODUCTIVITY;
}
OrgUnitProgramRelation orgUnitProgramRelation = new Select().from(OrgUnitProgramRelation.class)
.where(Condition.column(OrgUnitProgramRelation$Table.ID_ORG_UNIT).eq(orgUnit.getId_org_unit()))
.and(Condition.column(OrgUnitProgramRelation$Table.ID_PROGRAM).eq(program.getId_program())).querySingle();
if(orgUnitProgramRelation==null){
return DEFAULT_PRODUCTIVITY;
}
return orgUnitProgramRelation.getProductivity();
}
示例7: listAllByTabsWithoutCs
import com.raizlabs.android.dbflow.sql.builder.Condition; //导入依赖的package包/类
public static List<Question> listAllByTabsWithoutCs(List<Tab> tabs) {
if (tabs == null || tabs.size() == 0) {
return new ArrayList();
}
Iterator<Tab> iterator = tabs.iterator();
In in = Condition.column(ColumnAlias.columnWithTable("t", Tab$Table.ID_TAB)).in(Long.toString(iterator.next().getId_tab()));
while (iterator.hasNext()) {
in.and(Long.toString(iterator.next().getId_tab()));
}
return new Select().from(Question.class).as("q")
.join(Header.class, Join.JoinType.LEFT).as("h")
.on(Condition.column(ColumnAlias.columnWithTable("q", Question$Table.ID_HEADER))
.eq(ColumnAlias.columnWithTable("h", Header$Table.ID_HEADER)))
.join(Tab.class, Join.JoinType.LEFT).as("t")
.on(Condition.column(ColumnAlias.columnWithTable("h", Header$Table.ID_TAB))
.eq(ColumnAlias.columnWithTable("t", Tab$Table.ID_TAB)))
.where(in)
.and(Condition.column(Question$Table.ID_COMPOSITE_SCORE).isNull())
.orderBy(Tab$Table.ORDER_POS)
.orderBy(Question$Table.ORDER_POS).queryList();
}
示例8: listAllByTabs
import com.raizlabs.android.dbflow.sql.builder.Condition; //导入依赖的package包/类
public static List<Question> listAllByTabs(List<Tab> tabs) {
if (tabs == null || tabs.size() == 0) {
return new ArrayList();
}
Iterator<Tab> iterator = tabs.iterator();
In in = Condition.column(ColumnAlias.columnWithTable("t", Tab$Table.ID_TAB)).in(Long.toString(iterator.next().getId_tab()));
while (iterator.hasNext()) {
in.and(Long.toString(iterator.next().getId_tab()));
}
return new Select().from(Question.class).as("q")
.join(Header.class, Join.JoinType.LEFT).as("h")
.on(Condition.column(ColumnAlias.columnWithTable("q", Question$Table.ID_HEADER))
.eq(ColumnAlias.columnWithTable("h", Header$Table.ID_HEADER)))
.join(Tab.class, Join.JoinType.LEFT).as("t")
.on(Condition.column(ColumnAlias.columnWithTable("h", Header$Table.ID_TAB))
.eq(ColumnAlias.columnWithTable("t", Tab$Table.ID_TAB)))
.where(in)
.orderBy(Tab$Table.ORDER_POS)
.orderBy(Question$Table.ORDER_POS).queryList();
}
示例9: listByProgram
import com.raizlabs.android.dbflow.sql.builder.Condition; //导入依赖的package包/类
/**
* Returns all the questions that belongs to a program
*
* @param program
* @return
*/
public static List<Question> listByProgram(Program program) {
if (program == null || program.getId_program() == null) {
return new ArrayList();
}
//return Question.findWithQuery(Question.class, LIST_ALL_BY_PROGRAM, program.getId().toString());
return new Select().all().from(Question.class).as("q")
.join(Header.class, Join.JoinType.LEFT).as("h")
.on(Condition.column(ColumnAlias.columnWithTable("q", Question$Table.ID_HEADER))
.eq(ColumnAlias.columnWithTable("h", Header$Table.ID_HEADER)))
.join(Tab.class, Join.JoinType.LEFT).as("t")
.on(Condition.column(ColumnAlias.columnWithTable("h", Header$Table.ID_TAB))
.eq(ColumnAlias.columnWithTable("t", Tab$Table.ID_TAB)))
.where(Condition.column(ColumnAlias.columnWithTable("t", Tab$Table.ID_PROGRAM))
.eq(program.getId_program()))
.orderBy(Tab$Table.ORDER_POS)
.orderBy(Question$Table.ORDER_POS).queryList();
}
示例10: parentSavedValues
import com.raizlabs.android.dbflow.sql.builder.Condition; //导入依赖的package包/类
public List<Value> parentSavedValues(Float idSurvey){
List<Value> values = new Select().from(Value.class).as("v")
.join(QuestionOption.class, Join.JoinType.LEFT).as("qo")
.on(
Condition.column(ColumnAlias.columnWithTable("v", Value$Table.ID_QUESTION))
.eq(ColumnAlias.columnWithTable("qo", QuestionOption$Table.ID_QUESTION)),
Condition.column(ColumnAlias.columnWithTable("v", Value$Table.ID_OPTION))
.eq(ColumnAlias.columnWithTable("qo", QuestionOption$Table.ID_OPTION)))
.join(Match.class, Join.JoinType.LEFT).as("m")
.on(
Condition.column(ColumnAlias.columnWithTable("qo", QuestionOption$Table.ID_MATCH))
.eq(ColumnAlias.columnWithTable("m", Match$Table.ID_MATCH)))
.join(QuestionRelation.class, Join.JoinType.LEFT).as("qr")
.on(
Condition.column(ColumnAlias.columnWithTable("m", Match$Table.ID_QUESTION_RELATION))
.eq(ColumnAlias.columnWithTable("qr", QuestionRelation$Table.ID_QUESTION_RELATION)))
//Parent child relationship
.where(Condition.column(ColumnAlias.columnWithTable("qr", QuestionRelation$Table.OPERATION)).eq(1))
//For the given survey
.and(Condition.column(ColumnAlias.columnWithTable("v", Value$Table.ID_SURVEY)).eq(idSurvey))
//The child question in the relationship is 'this'
.and(Condition.column(ColumnAlias.columnWithTable("qr", QuestionRelation$Table.ID_QUESTION)).eq(this.getId_question()))
.queryList();
return values;
}
示例11: getCollections
import com.raizlabs.android.dbflow.sql.builder.Condition; //导入依赖的package包/类
private LinkedHashMap<String, List<EpisodeBaseModel>> getCollections(Class<?> model, List<EpisodeBaseModel> existing) {
LinkedHashMap<String, List<EpisodeBaseModel>> collections = new LinkedHashMap<>();
FlowCursorList<EpisodeBaseModel> cursor = new FlowCursorList<>(false,
(new Select()).from(EpisodeBaseModel.class)
.where(Condition.column(EpisodeBaseModel$Table.DATA_TYPE).eq(TYPE_COLLECTIONS))
.orderBy(true, EpisodeBaseModel$Table.DATA_COLLECTION_INDEX));
for (int i = 0, k = cursor.getCount(); i < k; i++) {
EpisodeBaseModel item = cursor.getItem(i);
item.unserialize();
int index = existing.indexOf(item);
EpisodeBaseModel ep;
if (index > -1) {
ep = existing.get(index);
} else {
ep = (EpisodeBaseModel) createInstanceOf(model);
if (ep != null) {
ep.merge(item);
}
}
if (ep != null) {
if (!collections.containsKey(item.DATA_COLLECTION_KEY)) {
collections.put(item.DATA_COLLECTION_KEY, new ArrayList<EpisodeBaseModel>());
}
collections.get(item.DATA_COLLECTION_KEY).add(ep);
}
}
for (Map.Entry<String, List<EpisodeBaseModel>> collection : collections.entrySet()) {
Log.d(TAG, "Loaded collection: " + collection.getKey() + " => " + collection.getValue().size());
}
return collections;
}
示例12: hasConflict
import com.raizlabs.android.dbflow.sql.builder.Condition; //导入依赖的package包/类
/**
* Checks whether the given event contains errors in SDK FailedItem table or has been successful.
* If not return null, it is becouse this item had a conflict.
* @param localId
* @return
*/
private FailedItem hasConflict(long localId){
return new Select()
.from(FailedItem.class)
.where(Condition.column(FailedItem$Table.ITEMID)
.is(localId)).querySingle();
}
示例13: getValues
import com.raizlabs.android.dbflow.sql.builder.Condition; //导入依赖的package包/类
@OneToMany(methods = {OneToMany.Method.SAVE, OneToMany.Method.DELETE}, variableName = "values")
public List<Value> getValues() {
if(values==null){
values = new Select()
.from(Value.class)
.where(Condition.column(Value$Table.ID_QUESTION)
.eq(this.getId_question())).queryList();
}
return values;
}
示例14: getCompositeScoreChildren
import com.raizlabs.android.dbflow.sql.builder.Condition; //导入依赖的package包/类
public List<CompositeScore> getCompositeScoreChildren() {
if (this.compositeScoreChildren == null){
this.compositeScoreChildren = new Select()
.from(CompositeScore.class)
.where(Condition.column(CompositeScore$Table.ID_PARENT).eq(this.getId_composite_score()))
.orderBy(CompositeScore$Table.ORDER_POS)
.queryList();
}
return this.compositeScoreChildren;
}
示例15: findProgramStageSectionUIDByDataElementUID
import com.raizlabs.android.dbflow.sql.builder.Condition; //导入依赖的package包/类
/**
* Find the associated programStageSection (tab)UID given a dataelement UID
*
* @param dataElementUID
* @return
*/
public static String findProgramStageSectionUIDByDataElementUID(String dataElementUID) {
//Find the right 'uid' of the dataelement program
ProgramStageSection programSS = new Select().from(ProgramStageSection.class).as("pss")
.join(ProgramStageDataElement.class, Join.JoinType.LEFT).as("psde")
.on(Condition.column(ColumnAlias.columnWithTable("pss", ProgramStageSection$Table.ID))
.eq(ColumnAlias.columnWithTable("psde", ProgramStageDataElement$Table.PROGRAMSTAGESECTION)))
.where(Condition.column(ColumnAlias.columnWithTable("psde", ProgramStageDataElement$Table.DATAELEMENT)).eq(dataElementUID))
.querySingle();
if (programSS == null) {
return null;
}
return programSS.getUid();
}