use of com.agiletec.plugins.jacms.aps.system.services.resource.model.AbstractMultiInstanceResource in project entando-core by entando.
the class ResourceManager method refreshMasterFileNames.
protected void refreshMasterFileNames(String resourceId) {
try {
ResourceInterface resource = this.loadResource(resourceId);
if (resource.isMultiInstance()) {
ResourceInstance instance = ((AbstractMultiInstanceResource) resource).getInstance(0, null);
String filename = instance.getFileName();
int index = filename.lastIndexOf("_d0.");
String masterFileName = filename.substring(0, index) + filename.substring(index + 3);
resource.setMasterFileName(masterFileName);
} else {
ResourceInstance instance = ((AbstractMonoInstanceResource) resource).getInstance();
resource.setMasterFileName(instance.getFileName());
}
this.updateResource(resource);
} catch (Throwable t) {
logger.error("Error reloading master file name of resource {}", resourceId, t);
}
}
Aggregations