Package net.datacrow.core.objects

Examples of net.datacrow.core.objects.DcObject


        }
    }
   
    private boolean exactSearch(DcObject dco) {
        try {
            DcObject dcoNew = dco.getModule().getOnlineServices().query(dco);
            if (dcoNew != null) {
                dco.copy(dcoNew, true, false);
                return true;
            }
        } catch (Exception e) {
View Full Code Here


           
            MusicFile musicFile = new MusicFile(filename);

            dco.setValue(MusicAlbum._A_TITLE, musicFile.getAlbum());
           
            DcObject artist  = DataManager.createReference(dco, MusicAlbum._F_ARTISTS, musicFile.getArtist());
           
            setValue(child, MusicTrack._K_QUALITY, Long.valueOf(musicFile.getBitrate()));
            setValue(child, MusicTrack._J_PLAYLENGTH, Long.valueOf(musicFile.getLength()));
            setValue(child, MusicTrack._L_ENCODING, musicFile.getEncodingType());
            setValue(child, MusicTrack._A_TITLE, musicFile.getTitle());
View Full Code Here

     * The online search helper is used to query additional data when needed.
     */
    protected void merge(DcObject target, DcObject source, OnlineSearchHelper osh) {
        if (source == null) return;
       
        DcObject queried = osh != null ? osh.query(source) : source;
        for (int field : queried.getFieldIndices())
            setValue(target, field, queried.getValue(field));
    }
View Full Code Here

        if (allowed) {
            if ((dco.isFilled(field) && overwrite) || !dco.isFilled(field)) {
                if (value instanceof Collection) {
                    dco.setValue(field, null);
                    for (Iterator iter = ((Collection) value).iterator(); iter.hasNext(); ) {
                        DcObject o = (DcObject) iter.next();
                        if (o instanceof DcMapping) {
                            Collection c = (Collection) dco.getValue(field);
                            c = c == null ? new ArrayList<DcMapping>() : c;
                            DataManager.createReference(dco, field, ((DcMapping) o).getReferencedObject());
                        } else {
View Full Code Here

        try {
            String text = (String) (clipboard.getContents(this).getTransferData(DataFlavor.stringFlavor));
            StringTokenizer rowTokenizer = new StringTokenizer(text, "\n");
            for (int i = 0; rowTokenizer.hasMoreTokens(); i++) {
                String values = rowTokenizer.nextToken();
                DcObject dco = module.getItem();

                int fldCounter = 0;
                int index = values.indexOf("\t");
                while (index > -1) {
                    String value = values.substring(0, index);
                    if (fldCounter <= fields.length) {
                        DcField field = dco.getField(fields[fldCounter]);
                        if (field.getValueType() == DcRepository.ValueTypes._LONG) {
                            try {
                                dco.setValue(fields[fldCounter], Long.valueOf(value.trim()));
                            } catch (Exception e) {
                                logger.warn("Could not set " + value + " for field " + fields[fldCounter], e);
                            }
                        } else {
                            dco.setValue(fields[fldCounter], value);
                        }
                    }

                    fldCounter++;
                    values = values.substring(index + 1, values.length());
                    index = values.indexOf("\t");
                }
                dco.setValue(fields[fldCounter], values);
                vc.update(dco.getID(), dco);
            }
        }
        catch (Exception exp) {
            logger.error("An error occurred while pasting data into the table", exp);
        }
View Full Code Here

    private void copy(IViewComponent vc) {
        StringBuffer sb = new StringBuffer();
       
        int[] fields = (int[]) vc.getModule().getSetting(DcRepository.ModuleSettings.stTableColumnOrder);
        for (int index : vc.getSelectedIndices()) {
            DcObject dco = vc.getItemAt(index);
            int fieldCount = 0;
           
            for (int field : fields) {
                if (fieldCount > 0)
                    sb.append("\t");

                Object o = dco.getValue(field);
                String value = o == null ||
                    dco.getField(field).getValueType() == DcRepository.ValueTypes._PICTURE ? "" : o.toString();
                sb.append(value);
                fieldCount++;
            }
            sb.append("\n");
        }
View Full Code Here

           
            counter = 0;
           
            for (String item : items) {
             
              DcObject dco = DataManager.getItem(getModule().getIndex(), item);
               
                if (isCanceled()) break;
               
                client.notifyMessage(DcResources.getText("msgExportingX", dco.toString()));
                int fieldCounter = 0;
                Object o;
                String s = "";
                for (int fieldIdx : getFields()) {
                    if (isCanceled()) break;

                    DcField field = DcModules.get(moduleIdx).getField(fieldIdx);
                   
                    if (isCanceled()) break;

                    o = dco.getValue(field.getIndex());
                   
                    if (field != null) {
                        s = "";
                       
                        if (field.getFieldType() == ComponentFactory._PICTUREFIELD) {
                            if (o != null && o.toString().length() >= 10)
                               s = utilities.getImageURL((Picture) dco.getValue(field.getIndex()));
                       
                        } else if (o instanceof Collection &&
                                   DcModules.get(field.getReferenceIdx()).getType() == DcModule._TYPE_ASSOCIATE_MODULE) {
                           
                           for (DcObject subDco : (Collection<DcObject>) o) {
                                if (subDco instanceof DcMapping)
                                    subDco = ((DcMapping) subDco).getReferencedObject();

                                if (subDco != null) {
                                    s += (s.length() > 0 ? ", " : "");
                                    s += ((DcAssociate) subDco).getNameNormal();
                                }
                            }
                        } else {
                            s = dco.getDisplayString(field.getIndex());
                        }
                       
                        writeBytes(s, fieldCounter != 0);
                        fieldCounter++;
                    }
View Full Code Here

        StringBuffer sb = new StringBuffer(prefix);
       
        if (field.getIndex() == dco.getParentReferenceFieldIndex()) {
            String parentID = (String) dco.getValue(field.getIndex());
            int parentModIdx = dco.getModule().getParent().getIndex();
            DcObject parent = DataManager.getItem(parentModIdx, parentID);
            sb.append(normalize(parent.toString()));
                
        } else if (field.getIndex() == DcObject._SYS_FILENAME) {
            String filename = dco.getFilename();
            int idx = filename.lastIndexOf("\\") > -1 ? filename.lastIndexOf("\\") :
                      filename.lastIndexOf("/");
View Full Code Here

    public List<DcObject> getSelectedItems() {
        int[] indices = getSelectedIndices();
        List<DcObject> objects = new ArrayList<DcObject>();

        DcObjectListElement element;
        DcObject dco;
        for (int i = 0; i < indices.length; i++) {
            element = (DcObjectListElement) getDcModel().getElementAt(indices[i]);
            dco = element.getDcObject();
            objects.add(dco);
        }
View Full Code Here

    @Override
    public DcObject getSelectedItem() {
        DcObjectListElement element = (DcObjectListElement) getSelectedValue();
       
        DcObject dco = null;
        if (element != null)
            dco = element.getDcObject();
       
        return dco;
    }
View Full Code Here

TOP

Related Classes of net.datacrow.core.objects.DcObject

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.