public void updateModelAndNotify() { // create a Condition given the current values Condition cond = new Condition(); cond.setProperty(s_fieldArray[m_fieldBox.getSelectedIndex()]); cond.setOperator(ComparisonOperator .fromValue(s_operatorActuals[m_operatorBox .getSelectedIndex()])); cond.setValue(m_valueField.getText()); // if rowNum is -1, add it if (m_rowNum == -1) { // if it wasn't there before, add it m_model.getConditions().add(cond); } else { // else replace existing condition m_model.getConditions().set(m_rowNum, cond); } m_model.fireTableDataChanged(); }
/** * Convert a local {@link Condition} into a WSDL-style * {@link org.fcrepo.server.types.gen.Condition Condition}. */ public static org.fcrepo.server.types.gen.Condition convertConditionToGenCondition(Condition condition) { String opAbbr = condition.getOperator().getAbbreviation(); ComparisonOperator compOperator; try { compOperator = ComparisonOperator.fromValue(opAbbr); } catch (IllegalArgumentException e) { throw new IllegalArgumentException("unrecognized comparison operator string: '" + opAbbr + "'"); } org.fcrepo.server.types.gen.Condition cond = new org.fcrepo.server.types.gen.Condition(); cond.setProperty(condition.getProperty()); cond.setOperator(compOperator); cond.setValue(condition.getValue()); return cond; }
/** * Get the indicated fields of the indicated object from the repository. */ public static ObjectFields getObjectFields(String pid, String[] fields) throws IOException { FieldSearchQuery query = new FieldSearchQuery(); Condition condition = new Condition(); condition.setProperty("pid"); condition.setOperator(ComparisonOperator.fromValue("eq")); condition.setValue(pid); FieldSearchQuery.Conditions conds = new FieldSearchQuery.Conditions(); conds.getCondition().add(condition); ObjectFactory factory = new ObjectFactory(); query.setConditions(factory.createFieldSearchQueryConditions(conds)); FieldSearchResult result = Administrator.APIA .findObjects(TypeUtility.convertStringtoAOS(fields), new BigInteger("1"), query); ResultList resultList = result.getResultList(); if (resultList == null || resultList.getObjectFields() == null && resultList.getObjectFields().size() == 0) { throw new IOException("Object not found in repository"); } return resultList.getObjectFields().get(0); }
Condition c = new Condition(); c.setProperty("pid"); c.setOperator(ComparisonOperator.fromValue("eq")); c.setValue(tri.getAttributeValue("value")); conds.getCondition().add(c);
new org.fcrepo.server.types.gen.Condition(); cond.setProperty("pid"); cond.setOperator(ComparisonOperator.fromValue("has")); condi.getCondition().add(cond); org.fcrepo.server.types.gen.ObjectFactory factory =