Package net.datacrow.core.modules.xml

Examples of net.datacrow.core.modules.xml.XmlModule


        client.notifyFinished();
    }
   
    private void reindexModules(Collection<ModuleJar> modules) {
        for (ModuleJar mj : modules) {
            XmlModule xm = mj.getModule();
           
            // module does not exist
            if (DcModules.get(xm.getName()) == null) continue;

              int oldIdx = xm.getIndex();
              int newIdx = DcModules.getAvailableIdx(xm);
             
              xm.setIndex(newIdx);

              // module does already exist and needs to be renumbered
                // all references must also be updated..
              Collection<ModuleJar> others = new ArrayList<ModuleJar>();
              others.addAll(modules);
              for (ModuleJar other : others) {
                  if (other != mj) {
                      XmlModule xmOther = other.getModule();
                     
                      if (xmOther.getParentIndex() == oldIdx)
                          xmOther.setParentIndex(newIdx);
   
                        if (xmOther.getChildIndex() == oldIdx)
                            xmOther.setChildIndex(newIdx);
                     
                      for (XmlField field : xmOther.getFields()) {
                          if (field.getModuleReference() == oldIdx)
                              field.setModuleReference(newIdx);
                      }
                     
                      try {
View Full Code Here


          if (canceled) break;
         
          // only export custom modules
          // adds the module jar file to the distribution
          if (module.isCustomModule() && module.getXmlModule() != null) {
              XmlModule xmlModule = module.getXmlModule();
            String jarName = xmlModule.getJarFilename();
            byte[] content = Utilities.readFile(new File(DataCrow.moduleDir, jarName));
            zf.addEntry(jarName, content);
          }

          // settings export
View Full Code Here

           
            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",
                                new String[]{xmlModule.getName(), field.getName()}));                   
                }
            }
           
            save(xmlModule, jarfile);
        }
View Full Code Here

           
            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;

                fieldOrg.setColumn(fieldNew.getColumn());
                fieldOrg.setEnabled(fieldNew.isEnabled());
                fieldOrg.setFieldType(fieldNew.getFieldType());
                fieldOrg.setIndex(fieldNew.getIndex());
                fieldOrg.setMaximumLength(fieldNew.getMaximumLength());
                fieldOrg.setModuleReference(fieldNew.getModuleReference());
                fieldOrg.setName(fieldNew.getName());
                fieldOrg.setOverwritable(fieldNew.isOverwritable());
                fieldOrg.setReadonly(fieldNew.isReadonly());
                fieldOrg.setSearchable(fieldNew.isSearchable());
                fieldOrg.setUiOnly(fieldNew.isUiOnly());
                fieldOrg.setValueType(fieldNew.getValueType());
               
                logger.info(DcResources.getText("msgUpgradedModuleXAltered",
                            new String[]{xmlModule.getName(), fieldOrg.getName()}));
            }
           
            save(xmlModule, jarfile);
        }       
    }
View Full Code Here

           
            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);
                    logger.info(DcResources.getText("msgUpgradedModuleXRemoved",
                                 new String[]{xmlModule.getName(), fieldOrg.getName()}));
                }
            }
           
            save(xmlModule, jarfile);
        }       
View Full Code Here

    private Collection<XmlField> getFields(Element element, int module) throws Exception {
        Collection<XmlField> fields = new ArrayList<XmlField>();
        NodeList nodes = element.getElementsByTagName("field");
        for (int i = 0; i < nodes.getLength(); i++) {
            Element el = (Element) nodes.item(i);
            XmlModule xmlModule = new XmlModule();
            xmlModule.setIndex(module);
            fields.add(new XmlField(xmlModule, el));
        }
        return fields;
    }   
View Full Code Here

            }       
           
            // first get the XML file
            for (String filename : content.keySet()) {
                if (filename.toLowerCase().endsWith("xml"))
                    module = new XmlModule(content.get(filename));
            }
           
            byte[] icon16 = content.get(module.getIcon16Filename());
            byte[] icon32 = content.get(module.getIcon32Filename());
           
View Full Code Here

        DcSettings.set(DcRepository.Settings.stModuleWizardFormSize, getSize());
    }

    @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();
View Full Code Here

    }

    @Override
    public void next() {
        try {
            XmlModule module = (XmlModule) getCurrent().apply();

            if (module == null)
                return;
           
            current += 1;
View Full Code Here

        DcSettings.set(DcRepository.Settings.stModuleWizardFormSize, getSize());
    }

    @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();
                }
View Full Code Here

TOP

Related Classes of net.datacrow.core.modules.xml.XmlModule

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.