use of com.agiletec.plugins.jacms.aps.system.services.resource.model.ResourceInterface in project entando-core by entando.
the class ResourceAction method checkDeleteResource.
protected String checkDeleteResource() throws Throwable {
String resourceId = this.getResourceId();
ResourceInterface resource = this.loadResource(resourceId);
if (resource == null) {
this.addActionError(this.getText("error.resource.delete.invalid"));
return INPUT;
}
Map<String, List> references = this.getResourceActionHelper().getReferencingObjects(resource, this.getRequest());
this.setReferences(references);
if (references.size() > 0) {
return "references";
}
return null;
}
use of com.agiletec.plugins.jacms.aps.system.services.resource.model.ResourceInterface in project entando-core by entando.
the class ExtendedResourceAction method save.
@Override
public String save() {
try {
if (ApsAdminSystemConstants.ADD == this.getStrutsAction()) {
ResourceInterface resource = this.getResourceManager().addResource(this);
this.buildEntryContentAnchorDest();
ResourceAttributeActionHelper.joinResource(resource, this.getRequest());
}
} catch (Throwable t) {
_logger.error("error in save", t);
return FAILURE;
}
return SUCCESS;
}
use of com.agiletec.plugins.jacms.aps.system.services.resource.model.ResourceInterface in project entando-core by entando.
the class ExtendedResourceFinderAction method joinResource.
/**
* Aggiunge una risorsa ad un Attributo.
* @return SUCCESS se รจ andato a buon fine, FAILURE in caso contrario
*/
public String joinResource() {
try {
String resourceId = this.getResourceId();
ResourceInterface resource = this.getResourceManager().loadResource(resourceId);
this.buildEntryContentAnchorDest();
ResourceAttributeActionHelper.joinResource(resource, this.getRequest());
} catch (Throwable t) {
_logger.error("error in joinResource", t);
return FAILURE;
}
return SUCCESS;
}
use of com.agiletec.plugins.jacms.aps.system.services.resource.model.ResourceInterface in project entando-core by entando.
the class ApiResourceInterface method deleteResource.
/**
* Delete a Resource. The method can be called by Entando API Engine.
* @param properties The properties of the DELETE method call.
* @throws Throwable Il case of error.
*/
public StringApiResponse deleteResource(Properties properties) throws Throwable {
StringApiResponse response = null;
try {
String id = properties.getProperty("id");
ResourceInterface resource = this.getResourceManager().loadResource(id);
response = this.deleteResource(properties, resource);
} catch (Throwable t) {
_logger.error("Error deleting resource", t);
// ApsSystemUtils.logThrowable(t, this, "deleteResource");
throw new ApsSystemException("Error deleting resource", t);
}
return response;
}
use of com.agiletec.plugins.jacms.aps.system.services.resource.model.ResourceInterface in project entando-core by entando.
the class ApiResourceInterface method deleteResource.
private StringApiResponse deleteResource(Properties properties, String expectedTypeCode) throws ApiException, Throwable {
StringApiResponse response = null;
try {
String id = properties.getProperty("id");
ResourceInterface resource = this.getResourceManager().loadResource(id);
if (null != resource && !resource.getType().equals(expectedTypeCode)) {
throw new ApiException(IApiErrorCodes.API_VALIDATION_ERROR, "Invalid resource type - '" + resource.getType() + "'", Response.Status.CONFLICT);
}
properties.setProperty(RESOURCE_TYPE_CODE_PARAM, expectedTypeCode);
response = this.deleteResource(properties, resource);
} catch (ApiException ae) {
throw ae;
} catch (Throwable t) {
_logger.error("Error deleting resource", t);
// ApsSystemUtils.logThrowable(t, this, "deleteResource");
throw new ApsSystemException("Error deleting resource", t);
}
return response;
}
Aggregations