[DS-4522] Refactor LogicalStatement.getResult() type to primitive boolean

This commit is contained in:
Kim Shepherd
2021-03-23 14:02:25 +13:00
parent a3beda1a05
commit cc1f67734e
19 changed files with 20 additions and 20 deletions

View File

@@ -40,7 +40,7 @@ public class DefaultFilter implements Filter {
* @return boolean
* @throws LogicalStatementException
*/
public Boolean getResult(Context context, Item item) throws LogicalStatementException {
public boolean getResult(Context context, Item item) throws LogicalStatementException {
return this.statement.getResult(context, item);
}
}

View File

@@ -31,5 +31,5 @@ public interface Filter extends LogicalStatement {
* @return boolean
* @throws LogicalStatementException
*/
Boolean getResult(Context context, Item item) throws LogicalStatementException;
boolean getResult(Context context, Item item) throws LogicalStatementException;
}

View File

@@ -27,5 +27,5 @@ public interface LogicalStatement {
* @return boolean result of evaluation
* @throws LogicalStatementException
*/
Boolean getResult(Context context, Item item) throws LogicalStatementException;
boolean getResult(Context context, Item item) throws LogicalStatementException;
}

View File

@@ -110,7 +110,7 @@ public class TestLogicRunner {
DSpaceObject dso = handleService.resolveToObject(c, handle);
if (Constants.typeText[dso.getType()].equals("ITEM")) {
Item item = (Item) dso;
System.out.println(filter.getResult(c, item).toString());
System.out.println(filter.getResult(c, item));
} else {
System.out.println(handle + " is not an ITEM");
}
@@ -127,7 +127,7 @@ public class TestLogicRunner {
System.out.println(
"Testing '" + filter + "' on item " + i.getHandle() + " ('" + i.getName() + "')"
);
System.out.println(filter.getResult(c, i).toString());
System.out.println(filter.getResult(c, i));
}
} catch (SQLException | LogicalStatementException e) {

View File

@@ -73,7 +73,7 @@ public abstract class AbstractCondition implements Condition {
* @throws LogicalStatementException
*/
@Override
public Boolean getResult(Context context, Item item) throws LogicalStatementException {
public boolean getResult(Context context, Item item) throws LogicalStatementException {
if (item == null) {
log.error("Error evaluating item. Passed item is null, returning false");
return false;

View File

@@ -30,7 +30,7 @@ public class BitstreamCountCondition extends AbstractCondition {
* @throws LogicalStatementException
*/
@Override
public Boolean getResult(Context context, Item item) throws LogicalStatementException {
public boolean getResult(Context context, Item item) throws LogicalStatementException {
// This super call just throws some useful exceptions if required objects are null
super.getResult(context, item);

View File

@@ -48,7 +48,7 @@ public interface Condition extends LogicalStatement {
* @return boolean
* @throws LogicalStatementException
*/
Boolean getResult(Context context, Item item) throws LogicalStatementException;
boolean getResult(Context context, Item item) throws LogicalStatementException;
public void setItemService(ItemService itemService);

View File

@@ -37,7 +37,7 @@ public class InCollectionCondition extends AbstractCondition {
* @throws LogicalStatementException
*/
@Override
public Boolean getResult(Context context, Item item) throws LogicalStatementException {
public boolean getResult(Context context, Item item) throws LogicalStatementException {
List<String> collectionHandles = (List<String>)getParameters().get("collections");

View File

@@ -37,7 +37,7 @@ public class InCommunityCondition extends AbstractCondition {
* @throws LogicalStatementException
*/
@Override
public Boolean getResult(Context context, Item item) throws LogicalStatementException {
public boolean getResult(Context context, Item item) throws LogicalStatementException {
List<String> communityHandles = (List<String>)getParameters().get("communities");
List<Collection> itemCollections = item.getCollections();

View File

@@ -30,7 +30,7 @@ public class IsWithdrawnCondition extends AbstractCondition {
* @throws LogicalStatementException
*/
@Override
public Boolean getResult(Context context, Item item) throws LogicalStatementException {
public boolean getResult(Context context, Item item) throws LogicalStatementException {
log.debug("Result of isWithdrawn is " + item.isWithdrawn());
return item.isWithdrawn();
}

View File

@@ -37,7 +37,7 @@ public class MetadataValueMatchCondition extends AbstractCondition {
* @throws LogicalStatementException
*/
@Override
public Boolean getResult(Context context, Item item) throws LogicalStatementException {
public boolean getResult(Context context, Item item) throws LogicalStatementException {
String field = (String)getParameters().get("field");
if (field == null) {
return false;

View File

@@ -37,7 +37,7 @@ public class MetadataValuesMatchCondition extends AbstractCondition {
* @throws LogicalStatementException
*/
@Override
public Boolean getResult(Context context, Item item) throws LogicalStatementException {
public boolean getResult(Context context, Item item) throws LogicalStatementException {
String field = (String)getParameters().get("field");
if (field == null) {
return false;

View File

@@ -40,7 +40,7 @@ public class ReadableByGroupCondition extends AbstractCondition {
* @throws LogicalStatementException
*/
@Override
public Boolean getResult(Context context, Item item) throws LogicalStatementException {
public boolean getResult(Context context, Item item) throws LogicalStatementException {
String group = (String)getParameters().get("group");
String action = (String)getParameters().get("action");

View File

@@ -65,7 +65,7 @@ public abstract class AbstractOperator implements LogicalStatement {
* @throws LogicalStatementException
*/
@Override
public Boolean getResult(Context context, Item item) throws LogicalStatementException {
public boolean getResult(Context context, Item item) throws LogicalStatementException {
return false;
}
}

View File

@@ -47,7 +47,7 @@ public class And extends AbstractOperator {
* @throws LogicalStatementException
*/
@Override
public Boolean getResult(Context context, Item item) throws LogicalStatementException {
public boolean getResult(Context context, Item item) throws LogicalStatementException {
for (LogicalStatement statement : getStatements()) {
if (!statement.getResult(context, item)) {

View File

@@ -46,7 +46,7 @@ public class Nand extends AbstractOperator {
* @throws LogicalStatementException
*/
@Override
public Boolean getResult(Context context, Item item) throws LogicalStatementException {
public boolean getResult(Context context, Item item) throws LogicalStatementException {
return !(new And(getStatements()).getResult(context, item));
}
}

View File

@@ -46,7 +46,7 @@ public class Nor extends AbstractOperator {
* @throws LogicalStatementException
*/
@Override
public Boolean getResult(Context context, Item item) throws LogicalStatementException {
public boolean getResult(Context context, Item item) throws LogicalStatementException {
return !(new Or(getStatements()).getResult(context, item));
}
}

View File

@@ -63,7 +63,7 @@ public class Not implements LogicalStatement {
* @throws LogicalStatementException
*/
@Override
public Boolean getResult(Context context, Item item) throws LogicalStatementException {
public boolean getResult(Context context, Item item) throws LogicalStatementException {
return !statement.getResult(context, item);
}
}

View File

@@ -47,7 +47,7 @@ public class Or extends AbstractOperator {
* @throws LogicalStatementException
*/
@Override
public Boolean getResult(Context context, Item item) throws LogicalStatementException {
public boolean getResult(Context context, Item item) throws LogicalStatementException {
for (LogicalStatement statement : getStatements()) {
if (statement.getResult(context, item)) {