mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-17 15:03:18 +00:00
[DS-4522] Refactor LogicalStatement.getResult() type to primitive boolean
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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) {
|
||||
|
@@ -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;
|
||||
|
@@ -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);
|
||||
|
@@ -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);
|
||||
|
||||
|
@@ -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");
|
||||
|
||||
|
@@ -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();
|
||||
|
@@ -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();
|
||||
}
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
|
@@ -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");
|
||||
|
@@ -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;
|
||||
}
|
||||
}
|
||||
|
@@ -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)) {
|
||||
|
@@ -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));
|
||||
}
|
||||
}
|
||||
|
@@ -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));
|
||||
}
|
||||
}
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
|
@@ -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)) {
|
||||
|
Reference in New Issue
Block a user