use of org.opencms.db.CmsExportPoint in project opencms-core by alkacon.
the class CmsExportpointsEdit method initModule.
/**
* Initializes the module to work with depending on the dialog state and request parameters.<p>
*/
protected void initModule() {
Object o;
CmsModule module;
if (CmsStringUtil.isEmpty(getParamAction()) || CmsDialog.DIALOG_INITIAL.equals(getParamAction())) {
// this is the initial dialog call
if (CmsStringUtil.isNotEmpty(m_paramModule)) {
// edit an existing module, get it from manager
o = OpenCms.getModuleManager().getModule(m_paramModule);
} else {
// create a new module
o = null;
}
} else {
// this is not the initial call, get module from session
o = getDialogObject();
}
if (!(o instanceof CmsModule)) {
// create a new module
module = new CmsModule();
} else {
// reuse module stored in session
module = (CmsModule) ((CmsModule) o).clone();
}
List exportpoints = module.getExportPoints();
m_exportpoint = new CmsExportPoint();
if ((exportpoints != null) && (exportpoints.size() > 0)) {
Iterator i = exportpoints.iterator();
while (i.hasNext()) {
CmsExportPoint exportpoint = (CmsExportPoint) i.next();
if (exportpoint.getUri().equals(m_paramExportpoint)) {
m_exportpoint = exportpoint;
}
}
}
}
use of org.opencms.db.CmsExportPoint in project opencms-core by alkacon.
the class CmsExportpointsList method getListItems.
/**
* @see org.opencms.workplace.list.A_CmsListDialog#getListItems()
*/
@Override
protected List getListItems() {
List ret = new ArrayList();
String moduleName = getParamModule();
CmsModule module = OpenCms.getModuleManager().getModule(moduleName);
// get exportpoints
List exportpoints = module.getExportPoints();
Iterator i = exportpoints.iterator();
while (i.hasNext()) {
CmsExportPoint exportpoint = (CmsExportPoint) i.next();
CmsListItem item = getList().newItem(exportpoint.getUri());
// name
item.set(LIST_COLUMN_URI, exportpoint.getUri());
// destination
item.set(LIST_COLUMN_DESTINATION, exportpoint.getConfiguredDestination());
// server
item.set(LIST_COLUMN_SERVERDESTINATION, exportpoint.getDestinationPath());
ret.add(item);
}
return ret;
}
use of org.opencms.db.CmsExportPoint in project opencms-core by alkacon.
the class CmsExportpointsList method deleteExportpoint.
/**
* Deletes a module exportpoint from a module.<p>
*
* @param module the module to delete the dependency from
* @param exportpoint the name of the exportpoint to delete
*/
private void deleteExportpoint(CmsModule module, String exportpoint) {
List oldExportpoints = module.getExportPoints();
List newExportpoints = new ArrayList();
Iterator i = oldExportpoints.iterator();
while (i.hasNext()) {
CmsExportPoint exp = (CmsExportPoint) i.next();
if (!exp.getUri().equals(exportpoint)) {
newExportpoints.add(exp);
}
}
module.setExportPoints(newExportpoints);
// update the module information
try {
OpenCms.getModuleManager().updateModule(getCms(), module);
} catch (CmsConfigurationException ce) {
// should never happen
throw new CmsRuntimeException(Messages.get().container(Messages.ERR_ACTION_EXPORTPOINTS_DELETE_2, exportpoint, module.getName()), ce);
} catch (CmsRoleViolationException re) {
throw new CmsRuntimeException(Messages.get().container(Messages.ERR_ACTION_EXPORTPOINTS_DELETE_2, exportpoint, module.getName()), re);
}
}
use of org.opencms.db.CmsExportPoint in project opencms-core by alkacon.
the class CmsExportpointsOverview method initModule.
/**
* Initializes the module to work with depending on the dialog state and request parameters.<p>
*/
protected void initModule() {
Object o;
CmsModule module;
if (CmsStringUtil.isEmpty(getParamAction()) || CmsDialog.DIALOG_INITIAL.equals(getParamAction())) {
// this is the initial dialog call
if (CmsStringUtil.isNotEmpty(m_paramModule)) {
// edit an existing module, get it from manager
o = OpenCms.getModuleManager().getModule(m_paramModule);
} else {
// create a new module
o = null;
}
} else {
// this is not the initial call, get module from session
o = getDialogObject();
}
if (!(o instanceof CmsModule)) {
// create a new module
module = new CmsModule();
} else {
// reuse module stored in session
module = (CmsModule) ((CmsModule) o).clone();
}
List exportpoints = module.getExportPoints();
m_exportpoint = new CmsExportPoint();
if ((exportpoints != null) && (exportpoints.size() > 0)) {
Iterator i = exportpoints.iterator();
while (i.hasNext()) {
CmsExportPoint exportpoint = (CmsExportPoint) i.next();
if (exportpoint.getUri().equals(m_paramExportpoint)) {
m_exportpoint = exportpoint;
}
}
}
}
use of org.opencms.db.CmsExportPoint in project opencms-core by alkacon.
the class CmsModulesEditBase method createModuleFolders.
/**
* Creates all module folders that are selected in the input form.<p>
*
* @param module the module
*
* @return the updated module
*
* @throws CmsException if somehting goes wrong
*/
private CmsModule createModuleFolders(CmsModule module) throws CmsException {
String modulePath = CmsWorkplace.VFS_PATH_MODULES + module.getName() + "/";
List<CmsExportPoint> exportPoints = module.getExportPoints();
List<String> resources = module.getResources();
// set the createModuleFolder flag if any other flag is set
if (module.isCreateClassesFolder() || module.isCreateElementsFolder() || module.isCreateLibFolder() || module.isCreateResourcesFolder() || module.isCreateSchemasFolder() || module.isCreateTemplateFolder() || module.isCreateFormattersFolder()) {
module.setCreateModuleFolder(true);
}
// check if we have to create the module folder
int folderId = CmsResourceTypeFolder.getStaticTypeId();
if (module.isCreateModuleFolder()) {
getCms().createResource(modulePath, folderId);
// add the module folder to the resource list
resources.add(modulePath);
module.setResources(resources);
}
// check if we have to create the template folder
if (module.isCreateTemplateFolder()) {
String path = modulePath + PATH_TEMPLATES;
getCms().createResource(path, folderId);
}
// check if we have to create the elements folder
if (module.isCreateElementsFolder()) {
String path = modulePath + PATH_ELEMENTS;
getCms().createResource(path, folderId);
}
if (module.isCreateFormattersFolder()) {
String path = modulePath + PATH_FORMATTERS;
getCms().createResource(path, folderId);
}
// check if we have to create the schemas folder
if (module.isCreateSchemasFolder()) {
String path = modulePath + PATH_SCHEMAS;
getCms().createResource(path, folderId);
}
// check if we have to create the resources folder
if (module.isCreateResourcesFolder()) {
String path = modulePath + PATH_RESOURCES;
getCms().createResource(path, folderId);
}
// check if we have to create the lib folder
if (module.isCreateLibFolder()) {
String path = modulePath + PATH_LIB;
getCms().createResource(path, folderId);
CmsExportPoint exp = new CmsExportPoint(path, "WEB-INF/lib/");
exportPoints.add(exp);
module.setExportPoints(exportPoints);
}
// check if we have to create the classes folder
if (module.isCreateClassesFolder()) {
String path = modulePath + PATH_CLASSES;
getCms().createResource(path, folderId);
CmsExportPoint exp = new CmsExportPoint(path, "WEB-INF/classes/");
exportPoints.add(exp);
module.setExportPoints(exportPoints);
// now create all subfolders for the package structure
StringTokenizer tok = new StringTokenizer(m_module.getName(), ".");
while (tok.hasMoreTokens()) {
String folder = tok.nextToken();
path += folder + "/";
getCms().createResource(path, folderId);
}
}
return module;
}
Aggregations