Examples of DcModule


Examples of net.datacrow.core.modules.DcModule

        client.notifyStarted(data.size());
       
        client.notifyMessage(DcResources.getText("msgProcessingModuleItems"));
       
        for (String key : data.keySet()) {
            DcModule module = DcModules.get(key);
           
            client.notifyMessage(DcResources.getText("msgProcessingItemsForX", key));
           
                // for existing module data has to be loaded manually.
                // new modules can use the demo data / default data functionality.
            if (module != null) {
               
                client.notifyMessage(DcResources.getText("msgModuleExistsMergingItems"));
               
                // place the images in the correct folder
                storeImages(key, icons.get(key), true);
                // start the import process
                loadItems(data.get(key), module.getIndex());
               
               
            } else {
                try {
                    client.notifyMessage(DcResources.getText("msgModuleIsNewCreatingItems"));
View Full Code Here

Examples of net.datacrow.core.modules.DcModule

public class AdministrationMenu extends DcMenu {
   
    public AdministrationMenu(DcModule module) {
        super(DcResources.getText("lblAdministration"));
       
        DcModule child = module.getChild();
       
        for (DcPropertyModule pm : DcModules.getPropertyModules(module)) {
            int sourceIdx = pm.isServingMultipleModules() ? pm.getIndex() : pm.getIndex() - module.getIndex();
            if (child != null && child.hasReferenceTo(sourceIdx) && !pm.isServingMultipleModules()) {
                add(pm, module.getObjectName() + " " + pm.getObjectNamePlural());
                add((DcPropertyModule) DcModules.get(sourceIdx + child.getIndex()),
                    child.getObjectName() + " " + DcModules.get(sourceIdx + child.getIndex()).getObjectNamePlural());
            } else {
                add(pm, pm.getObjectNamePlural());
            }
        }

        // add references to property modules for the child
        if (child != null) {
            for (DcPropertyModule pm : DcModules.getPropertyModules(child)) {
                int sourceIdx = pm.isServingMultipleModules() ? pm.getIndex() : pm.getIndex() - child.getIndex();
                if (!module.hasReferenceTo(sourceIdx) && !pm.isServingMultipleModules())
                    add(pm, child.getObjectName() + " " + pm.getObjectNamePlural());
            }
        }
       
        if (module.isTopModule() &&  module.getTemplateModule() != null) {
          addSeparator();
View Full Code Here

Examples of net.datacrow.core.modules.DcModule

    private static DcField getField(String s) {
        try {
            int mod = Integer.parseInt(s.substring(0, s.indexOf("/&/")));
            String columnName = s.substring(s.indexOf("/&/") + 3, s.length());
           
            DcModule module = DcModules.get(mod);
            for (DcField field : module.getFields()) {
                if (field.getDatabaseFieldName().equalsIgnoreCase(columnName))
                    return field;
            }
        } catch (Exception exp) {
            logger.error("Could not find valid field information in " + s);
View Full Code Here

Examples of net.datacrow.core.modules.DcModule

   
    @Override
    public Object apply(DcField field, Object value) {
        Object result = value;
       
        DcModule module = DcModules.get(field.getModule());
        int counter = 0;
       
        try {
            if (!fillGaps) {
                String query = "SELECT MAX(" + field.getDatabaseFieldName() + ") AS COUNTMAXIMUM FROM " +
                               module.getTableName();
                ResultSet rs = DatabaseManager.executeSQL(query);
                int maximum = 0;
                while (rs.next()) {
                    maximum = rs.getInt("COUNTMAXIMUM");
                }
               
                result = Long.valueOf(maximum + getStep());
                rs.close();
            } else {
                counter = counter + getStep();
               
                String qryCurrent = "SELECT " + field.getDatabaseFieldName() + " FROM " + module.getTableName() +
                " WHERE " + field.getDatabaseFieldName() + " IS NOT NULL AND " +
                field.getDatabaseFieldName() + " > 0 " +
                "ORDER BY 1";           
               
                Collection<Integer> currentValues = new ArrayList<Integer>();
View Full Code Here

Examples of net.datacrow.core.modules.DcModule

   
    public ViewPopupMenu(DcObject dco, int viewType, int viewIdx) {
       
        this.dco = dco;
       
        DcModule current = DcModules.getCurrent();
       
        DcModule module = dco.getModule();
        if (viewType == View._TYPE_SEARCH &&
            !module.isChildModule() &&
            !(current.getIndex() == DcModules._CONTAINER &&
              dco.getModule().getIndex() != DcModules._CONTAINER)) {

            if (module.isAbstract())
                PluginHelper.add(this, "SaveSelected");
           
            PluginHelper.add(this, "OpenItem");
           
            if (module.getIndex() != DcModules._USER)
                PluginHelper.add(this, "EditAsNew", null, dco, null, -1, module.getIndex());
        }
       
        String filename = dco.getFilename();
        File file = !Utilities.isEmpty(filename) ? new File(filename) : null;
       
        if (viewType == View._TYPE_SEARCH) {
            if (dco.getModule().getParent() != null) {
                // in case a child is selected, make sure its the child which is going to be deleted
                // and not the parent (via the DcModules.getCurrent(), which returns the parent).
                PluginHelper.add(this, "Delete", module.getIndex());
            } else if ((current.getIndex() == DcModules._CONTAINER && dco.getModule().getIndex() != DcModules._CONTAINER)) {
                PluginHelper.add(this, "Delete", DcModules._ITEM);               
            } else {
                // make sure the actual SELECTED module is used for deleting the item. otherwise, if
                // the media module is selected, the item from the, for example, software module view
                // is deleted.
                PluginHelper.add(this, "Delete", DcModules.getCurrent().getIndex());
            }
           
            if (file != null && SecurityCentre.getInstance().getUser().isAdmin() && dco.getModule().isFileBacked()) {
               
                JMenu menuFile = ComponentFactory.getMenu(IconLibrary._icoDriveManager, DcResources.getText("lblFile"));
               
                JMenuItem miDelete = ComponentFactory.getMenuItem(IconLibrary._icoDelete, DcResources.getText("lblDeleteFile"));
                miDelete.addActionListener(this);
                miDelete.setActionCommand("deleteFile");
                miDelete.setEnabled(file.exists());

                JMenuItem miMove = ComponentFactory.getMenuItem(DcResources.getText("lblMoveFile"));
                miMove.addActionListener(this);
                miMove.setActionCommand("moveFile");
                miMove.setEnabled(file.exists());

                JMenuItem miLocateHP = ComponentFactory.getMenuItem(IconLibrary._icoDriveScanner, DcResources.getText("lblLocateFile", DcResources.getText("lblMatchOnHashAndSize")));
                miLocateHP.addActionListener(this);
                miLocateHP.setActionCommand("locateFileHP");
                miLocateHP.setEnabled(!file.exists() && dco.isFilled(DcObject._SYS_FILEHASH) && dco.isFilled(DcObject._SYS_FILESIZE));
               
                JMenuItem miLocateMP = ComponentFactory.getMenuItem(IconLibrary._icoDriveScanner, DcResources.getText("lblLocateFile", DcResources.getText("lblMatchOnFilenameAndSize")));
                miLocateMP.addActionListener(this);
                miLocateMP.setActionCommand("locateFileMP");
                miLocateMP.setEnabled(!file.exists() && dco.isFilled(DcObject._SYS_FILESIZE));           

                JMenuItem miLocateLP = ComponentFactory.getMenuItem(IconLibrary._icoDriveScanner, DcResources.getText("lblLocateFile", DcResources.getText("lblMatchOnFilename")));
                miLocateLP.addActionListener(this);
                miLocateLP.setActionCommand("locateFileLP");
                miLocateLP.setEnabled(!file.exists());       
               
                menuFile.add(miDelete);
                menuFile.add(miMove);
                menuFile.add(miLocateHP);
                menuFile.add(miLocateMP);
                menuFile.add(miLocateLP);
               
                addSeparator();
                add(menuFile);
            }           
           
        } else {
            PluginHelper.add(this, "RemoveRow", DcModules.getCurrent().getIndex());
            PluginHelper.add(this, "AddRow", DcModules.getCurrent().getIndex());
        }  
       
        if (viewType == View._TYPE_SEARCH &&
            module.getIndex() == DcModules._USER &&
            SecurityCentre.getInstance().getUser().isAuthorized("SetPassword")) {

            addSeparator();
            PluginHelper.add(this, "SetPassword", "", dco, null, viewType, DcModules.getCurrent().getIndex());
        }

        if (!DcModules.getCurrent().isAbstract()) {
            addSeparator();
            PluginHelper.add(this, "ItemExporterWizard", "", dco, null, viewIdx, dco.getModule().getIndex());
        }
       
        if (viewType == View._TYPE_SEARCH && DcModules.getCurrent().hasReports()) {
            PluginHelper.add(this, "Report", "", dco, null, viewIdx, DcModules.getCurrent().getIndex());
        }
       
        addSeparator();
        PluginHelper.add(this, "Sort");
       
        if viewType == View._TYPE_SEARCH &&
            module.canBeLend() &&
            SecurityCentre.getInstance().getUser().isAuthorized("Loan")) {
         
            addSeparator();
            PluginHelper.add(this, "Loan");
        }

        addSeparator();

        JMenu menuAdmin = ComponentFactory.getMenu(IconLibrary._icoModuleTypeProperty16, DcResources.getText("lblAdministration"));
       
        Collection<DcPropertyModule> modules = new ArrayList<DcPropertyModule>();
        for (DcFieldDefinition definition : module.getFieldDefinitions().getDefinitions()) {
            DcField field = module.getField(definition.getIndex());
            DcPropertyModule pm = DcModules.getPropertyModule(field);
           
            if (pm != null && !modules.contains(pm))
                modules.add(pm);
        }

        for (DcModule pm : modules) {
            try {
                Plugin plugin = Plugins.getInstance().get("ManageItem", dco, null, viewIdx,  pm.getIndex());
                if (    plugin != null &&SecurityCentre.getInstance().getUser().isAuthorized(plugin) &&
                        UserMode.isCorrectXpLevel(plugin.getXpLevel())) {
                   
                    JMenuItem item = ComponentFactory.getMenuItem(plugin);
                    item.setEnabled(plugin.isEnabled());
                    item.setIcon(plugin.getIcon());
                   
                    menuAdmin.add(item);
                }
            } catch (InvalidPluginException e) {
                logger.error(e, e);
            }
        }
       
        if (menuAdmin.getItemCount() > 0)
            add(menuAdmin);
       
        addSeparator();
        PluginHelper.add(this, "ViewSettings");
       
        if (viewType == View._TYPE_SEARCH) {
            FileImporter importer = module.getImporter();
            if (importer != null && importer.allowReparsing() && module.getFileField() != null) {
                addSeparator();
                PluginHelper.add(this, "AttachFileInfo");
            }
        }
       
        addSeparator();
       
        if (current.getIndex() != DcModules._ITEM) {
            PluginHelper.add(this, "UpdateAll", module.getIndex());
            PluginHelper.add(this, "FindReplace", module.getIndex());
        }
       
        if (file != null && dco.getModule().isFileBacked())
            PluginHelper.add(this, "FileLauncher", module.getIndex());
       
        Collection<Plugin> plugins = Plugins.getInstance().getUserPlugins(dco, viewType, module.getIndex());
        for (Plugin plugin : plugins) {
            if (plugin.isShowInPopupMenu()) {
                addSeparator();
                add(ComponentFactory.getMenuItem(plugin));
            }
View Full Code Here

Examples of net.datacrow.core.modules.DcModule

        List<DcReference> references = new ArrayList<DcReference>();
        if (getDcField().getFieldType() == ComponentFactory._RATINGCOMBOBOX) {
            for (int rating = -1; rating < 11; rating++)
                references.add(new DcReference(Rating.getLabel(rating), String.valueOf(rating)));
        } else {
            DcModule module = DcModules.getReferencedModule(getDcField());
            for (DcSimpleValue value : DataManager.getSimpleValues(module.getIndex(), false))
                references.add(new DcReference(value.getName(), value.getID()));
        }
        return references;
    }
View Full Code Here

Examples of net.datacrow.core.modules.DcModule

            df = new DataFilter(moduleIdx);
           
            setFields(moduleIdx);
            modules.add(new DcWebModule(moduleIdx, DcModules.get(moduleIdx).getLabel()));
           
            DcModule child = DcModules.get(moduleIdx).getChild();
            if (child != null) {
                modules.add(new DcWebModule(child.getIndex(), DcModules.get(child.getIndex()).getLabel()));
                setFields(child.getIndex());
            }
        }
       
        setFieldIdx(fields.get(moduleIdx).get(0).getIndex(), moduleIdx);
    }
View Full Code Here

Examples of net.datacrow.core.modules.DcModule

        if (tab == 4 && !isPictureTabVisible())
            tab = 0;
    }

    public void loadChildren() {
        DcModule childModule = DcModules.get(getModule()).getChild();
       
        List<List<?>> woChildren = new ArrayList<List<?>>();
        List<DcWebField> woFields = new ArrayList<DcWebField>();
        getDcObject().setChildren(new ArrayList<DcObject>());
        getDcObject().loadChildren(null);
        if (getDcObject().getModule().getChild() != null) {
            for (DcObject child : getDcObject().getChildren()) {
                List<Object> values = new ArrayList<Object>();

                for (WebFieldDefinition def : childModule.getWebFieldDefinitions().getDefinitions()) {
                    DcField field = child.getModule().getField(def.getField());
                    if (def.isOverview() && getUser().isAuthorized(field) && field.isEnabled()) {
                        String s = child.getDisplayString(field.getIndex());
                       
                        if (def.getMaxTextLength() != 0 && field.getValueType() != DcRepository.ValueTypes._PICTURE)
                            s = StringUtils.concatUserFriendly(s, def.getMaxTextLength());

                        values.add(s);
                    }
                }
                values.add(child.getID());
                woChildren.add(values);
            }
           
            for (WebFieldDefinition def : DcModules.get(DcModules.get(getModule()).getChild().getIndex()).getWebFieldDefinitions().getDefinitions()) {
                DcField field = childModule.getField(def.getField());
                if (def.isOverview() && getUser().isAuthorized(field) && field.isEnabled()) {
                    DcWebField wf = new DcWebField(field);
                    wf.setWidth(def.getWidth());
                    wf.setLinkToDetails(def.isLink());
                    wf.setMaxTextLength(def.getMaxTextLength());
View Full Code Here

Examples of net.datacrow.core.modules.DcModule

                    module.getIndex() != DcModules._USER) {
               
                modules.add(new DcWebModule(module.getIndex(), module.getLabel()));
               
                for (DcField field : module.getFields()) {
                    DcModule referencedMod = DcModules.getReferencedModule(field);
                    if (    getUser().isAuthorized(module) &&
                            referencedMod.isEnabled() &&
                            referencedMod.getIndex() != module.getIndex() &&
                          !(referencedMod instanceof DcPropertyModule) &&
                            referencedMod.getIndex() != DcModules._CONTACTPERSON &&
                            referencedMod.getIndex() != DcModules._CONTAINER) {
                       
                        modules.add(new DcWebModule(referencedMod.getIndex(), referencedMod.getLabel()));
                    }
                }
            }
        }
    }
View Full Code Here

Examples of net.datacrow.core.modules.DcModule

    public static void refresh() {
        templates.clear();
       
        for (DcModule module : DcModules.getAllModules()) {
            if (module.getTemplateModule() != null) {
                DcModule templateModule = module.getTemplateModule();

                try {
                  for (DcObject dco : DataManager.get(templateModule.getIndex(), null))
                    templates.add((DcTemplate) dco);
                } catch (Exception e) {
                    logger.error("Could not refresh the taemplate list for " + module, e);

                }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.