gcube-ckan-datacatalog/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/shared/ManageProductResponse.java

110 lines
2.0 KiB
Java

package org.gcube.portlets.gcubeckan.gcubeckandatacatalog.shared;
import java.io.Serializable;
/**
* The Class ManageProductResponse.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Jun 15, 2021
*/
public class ManageProductResponse implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
private boolean isManageEnabled;
private String scope;
/**
* Instantiates a new manage product response.
*/
public ManageProductResponse() {
}
/**
* Instantiates a new manage product response.
*
* @param isManageEnabled the is manage enabled
* @param scope the scope
*/
public ManageProductResponse(boolean isManageEnabled, String scope) {
this.isManageEnabled = isManageEnabled;
this.scope = scope;
}
/**
* Checks if is manage enabled.
*
* @return true, if is manage enabled
*/
public boolean isManageEnabled() {
return isManageEnabled;
}
/**
* Gets the scope.
*
* @return the scope
*/
public String getScope() {
return scope;
}
/**
* Sets the manage enabled.
*
* @param isManageEnabled the new manage enabled
*/
public void setManageEnabled(boolean isManageEnabled) {
this.isManageEnabled = isManageEnabled;
}
/**
* Sets the scope.
*
* @param scope the new scope
*/
public void setScope(String scope) {
this.scope = scope;
}
public boolean isGRSFScope() {
if (this.scope != null) {
if (this.scope.toLowerCase().contains("grsf")) {
return true;
}
}
return false;
}
public boolean isGRSFManageEnabled() {
if (isGRSFScope() && isManageEnabled)
return true;
return false;
}
/**
* To string.
*
* @return the string
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("ManageProductResponse [isManageEnabled=");
builder.append(isManageEnabled);
builder.append(", scope=");
builder.append(scope);
builder.append("]");
return builder.toString();
}
}