Package net.datacrow.core.modules

Examples of net.datacrow.core.modules.ModuleJar


                        data.put(name.substring(0, name.toLowerCase().indexOf(".xml")), file);
                    } else if (name.toLowerCase().endsWith(".jar")) {
                        // check if the custom module does not already exist
                        if (DcModules.get(name.substring(0, name.indexOf(".jar"))) == null) {
                            writeToFile(bis, new File(DataCrow.moduleDir, name));
                            ModuleJar moduleJar = new ModuleJar(name);
                            moduleJar.load();
                            modules.add(moduleJar);
                        }
                    }
                    client.notifyProcessed();
                    bis.close();
View Full Code Here


            throw new ModuleUpgradeException(exp);
        }
    }

    private void save(XmlModule module, String filename) throws Exception {
        ModuleJar mj = new ModuleJar(module);
        mj.setFilename(filename);
        mj.save();
    }
View Full Code Here

            String jarfile = XMLParser.getString(module, "module-jar");
            int index = XMLParser.getInt(module, "module-index");
           
            if (!new File(DataCrow.moduleDir + jarfile).exists()) continue;
           
            ModuleJar jar = new ModuleJar(jarfile);
            jar.load();
           
            // get the fields to add
            XmlModule xmlModule = jar.getModule();
           
            for (XmlField field :  getFields(module, index)) {
                if (getField(field.getIndex(), xmlModule.getFields()) == null) {
                    xmlModule.getFields().add(field);
                    logger.info(DcResources.getText("msgUpgradedModuleXAdded",
View Full Code Here

            String jarfile = XMLParser.getString(module, "module-jar");
            int index = XMLParser.getInt(module, "module-index");
           
            if (!new File(DataCrow.moduleDir + jarfile).exists()) continue;
           
            ModuleJar jar = new ModuleJar(jarfile);
            jar.load();
           
            // get the fields to add
            XmlModule xmlModule = jar.getModule();
           
            for (XmlField fieldNew :  getFields(module, index)) {
                XmlField fieldOrg = getField(fieldNew.getIndex(), xmlModule.getFields());
               
                if (fieldOrg == null) continue;
View Full Code Here

            String jarfile = XMLParser.getString(module, "module-jar");
            int index = XMLParser.getInt(module, "module-index");
           
            if (!new File(DataCrow.moduleDir + jarfile).exists()) continue;
           
            ModuleJar jar = new ModuleJar(jarfile);
            jar.load();
           
            // get the fields to add
            XmlModule xmlModule = jar.getModule();
           
            for (XmlField field :  getFields(module, index)) {
                XmlField fieldOrg = getField(field.getIndex(), xmlModule.getFields());
                if (fieldOrg != null) {
                    xmlModule.getFields().remove(fieldOrg);
View Full Code Here

    @Override
    public void finish() throws WizardException {
        XmlModule parentModule = (XmlModule) getCurrent().apply();

        try {
            ModuleJar mjParent = new ModuleJar(parentModule);
            mjParent.save();
           
            XmlModule childModule = DcModules.get(parentModule.getChildIndex()).getXmlModule();
            childModule.setParentIndex(parentModule.getIndex());
           
            if (childModule.getModuleClass().equals(DcMediaModule.class))
                childModule.setModuleClass(DcMediaChildModule.class);
            else
                childModule.setModuleClass(DcChildModule.class);
           
            Collection<XmlField> fields = childModule.getFields();
            XmlField field = new XmlField();
            field.setColumn(StringUtils.normalize(parentModule.getObjectName()).replaceAll(" ", "") + "ID");
            field.setName(parentModule.getObjectName());
            field.setFieldType(ComponentFactory._SHORTTEXTFIELD);
            field.setMaximumLength(50);
            field.setModuleReference(parentModule.getIndex());
            field.setReadonly(true);
            field.setEnabled(false);
            field.setSearchable(false);
            field.setUiOnly(false);
            field.setOverwritable(false);
            field.setValueType(DcRepository.ValueTypes._DCPARENTREFERENCE);
            fields.add(field);
            childModule.setFields(fields);
           
            ModuleJar mjChild = new ModuleJar(childModule);
            mjChild.save();
           
            close();
        } catch (Exception e) {
            throw new WizardException(DcResources.getText("msgCouldNotWriteModuleFile", e.getMessage()));
        }
View Full Code Here

    @Override
    public void finish() throws WizardException {
        XmlModule module = (XmlModule) getCurrent().apply();

        try {
            ModuleJar mj = new ModuleJar(module);
            mj.save();
           
            for (XmlField field : module.getFields()) {
                if (field.getModuleReference() != module.getIndex() && field.getModuleReference() != 0) {
                    DcModule m = DcModules.get(field.getModuleReference()) == null ?
                                 DcModules.get(field.getModuleReference() + module.getIndex()) :
                                 DcModules.get(field.getModuleReference());
                   
                    if (m != null && m.getXmlModule() != null)
                        new ModuleJar(m.getXmlModule()).save();
                }
            }

            close();
           
View Full Code Here

        try {
            if (module.getModuleClass().equals(DcPropertyModule.class))
                module.setServingMultipleModules(true);
           
            new ModuleJar(module).save();
           
            for (XmlField field : module.getFields()) {
               
                field.setModule(module.getIndex());
               
                if (field.getModuleReference() !=  0 && field.getModuleReference() != module.getIndex()) {
                    DcModule m = DcModules.get(field.getModuleReference()) == null ?
                                 DcModules.get(field.getModuleReference() + module.getIndex()) :
                                 DcModules.get(field.getModuleReference());
                   
                    if (m != null && m.getXmlModule() != null)
                        new ModuleJar(m.getXmlModule()).save();
                else {
                    field.setModuleReference(module.getIndex());
                }
            }
           
View Full Code Here

                    for (XmlField field : reference.getXmlModule().getFields()){
                        if (reference.getField(field.getIndex()).getSourceModuleIdx() == xmlModule.getIndex())
                            remove.add(field);
                    }
                    reference.getXmlModule().getFields().removeAll(remove);
                    new ModuleJar(reference.getXmlModule()).save();
                }
            }
           
            // parent child relation should be undone
            undoParentChildRelation(module.getParent() != null ? module.getParent() : module.getChild());
           
            // make sure the 'hasDependingModules' property is corrected for modules holding
            // a referencing to this module
            for (DcField field : module.getFields()) {
                if (field.getValueType() == DcRepository.ValueTypes._DCOBJECTREFERENCE) {
                    DcModule reference = DcModules.getReferencedModule(field);
                   
                    if (reference.getXmlModule() == null) continue;

                    if (reference.hasDependingModules() && DcModules.getReferencingModules(reference.getIndex()).size() == 1)
                        reference.getXmlModule().setHasDependingModules(false);
                   
                    new ModuleJar(reference.getXmlModule()).save();
                }
            }
           
            // not needed for property base modules
            if (DcModules.get(xmlModule.getIndex()) != null) {
View Full Code Here

        }
       
        module.getXmlModule().setChildIndex(-1);
        module.getXmlModule().setParentIndex(-1);
       
        new ModuleJar(module.getXmlModule()).save();
    }
View Full Code Here

TOP

Related Classes of net.datacrow.core.modules.ModuleJar

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.