~berthold-daum/zora/trunk

« back to all changes in this revision

Viewing changes to com.bdaum.zoom.core/src/com/bdaum/zoom/core/internal/db/AssetEnsemble.java

  • Committer: bdaum
  • Date: 2015-12-26 10:21:51 UTC
  • Revision ID: berthold.daum@bdaum.de-20151226102151-44f1j5113167thb9
VersionĀ 2.4.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
import java.util.Date;
29
29
import java.util.GregorianCalendar;
30
30
import java.util.HashMap;
 
31
import java.util.Iterator;
31
32
import java.util.List;
32
33
import java.util.Map;
33
34
import java.util.Map.Entry;
848
849
                if (resetIptc)
849
850
                        deleteStructures(toBeDeleted, toBeStored);
850
851
                if (creatorContact != null) {
851
 
                        List<ContactImpl> set = dbManager.queryByExample(creatorContact);
852
 
                        if (!set.isEmpty())
853
 
                                creatorContact = set.get(0);
 
852
                        Iterator<ContactImpl> it = dbManager.queryByExample(creatorContact).iterator();
 
853
                        if (it.hasNext())
 
854
                                creatorContact = it.next();
854
855
                        else
855
856
                                toBeStored.add(creatorContact);
856
857
                        String id = creatorContact.getStringId();
871
872
                }
872
873
                if (locationCreated != null) {
873
874
                        locationCreated = queryLocation(locationCreated, toBeStored);
874
 
                        List<LocationCreatedImpl> set = dbManager.obtainStruct(
 
875
                        Iterator<LocationCreatedImpl> it = dbManager.obtainStruct(
875
876
                                        LocationCreatedImpl.class, null, false, "location", //$NON-NLS-1$
876
 
                                        locationCreated.getStringId(), false);
877
 
                        if (set.isEmpty()) {
 
877
                                        locationCreated.getStringId(), false).iterator();
 
878
                        if (it.hasNext()) {
 
879
                                LocationCreatedImpl rel = it.next();
 
880
                                if (!rel.getAsset().contains(assetId)) {
 
881
                                        rel.addAsset(assetId);
 
882
                                        toBeStored.add(rel);
 
883
                                }
 
884
                        } else {
878
885
                                LocationCreatedImpl rel = new LocationCreatedImpl(
879
886
                                                locationCreated.getStringId());
880
887
                                rel.addAsset(assetId);
881
888
                                toBeStored.add(rel);
882
 
                        } else {
883
 
                                LocationCreatedImpl rel = set.get(0);
884
 
                                if (!rel.getAsset().contains(assetId)) {
885
 
                                        rel.addAsset(assetId);
886
 
                                        toBeStored.add(rel);
887
 
                                }
888
889
                        }
889
890
                }
890
891
                if (locationsShown != null) {
985
986
                                                                }
986
987
                                                                album = new SmartCollectionImpl(name, true,
987
988
                                                                                true, false, false,
988
 
                                                                                "", 0, null, 0, null); //$NON-NLS-1$
 
989
                                                                                "", 0, null, 0, null, null); //$NON-NLS-1$
989
990
                                                                album.setGroup_rootCollection_parent(Constants.GROUP_ID_PERSONS);
990
991
                                                                album.addCriterion(new CriterionImpl(
991
992
                                                                                Constants.OID, null, album
1058
1059
 
1059
1060
        private LocationImpl queryLocation(LocationImpl location,
1060
1061
                        Collection<Object> toBeStored) {
1061
 
                List<LocationImpl> set = dbManager.findLocation(location);
1062
 
                if (!set.isEmpty())
1063
 
                        return set.get(0);
 
1062
                Iterator<LocationImpl> it = dbManager.findLocation(location).iterator();
 
1063
                if (it.hasNext())
 
1064
                        return it.next();
1064
1065
                Utilities.completeLocation(dbManager, location);
1065
1066
                toBeStored.add(location);
1066
1067
                return location;
1652
1653
                                                                                .entrySet();
1653
1654
                                                                for (Entry<String, Object> e2 : entrySet2) {
1654
1655
                                                                        QueryField qfield3 = QueryField
1655
 
                                                                                        .findExifProperty(e2.getKey());
 
1656
                                                                                        .findRegionProperty(e2.getKey());
1656
1657
                                                                        try {
1657
1658
                                                                                if (qfield3 == QueryField.MWG_REGION_RECTANGLE)
1658
1659
                                                                                        reg.setArea((Map<String, Object>) e2
1663
1664
                                                                                        reg.setValue((String) e2.getValue());
1664
1665
                                                                                else if (qfield3 == QueryField.MWG_REGION_KIND)
1665
1666
                                                                                        reg.setType((String) e2.getValue());
 
1667
                                                                                else if (qfield3 == QueryField.MWG_REGION_DESCRIPTION)
 
1668
                                                                                        reg.setDescription((String) e2.getValue());
1666
1669
                                                                        } catch (NumberFormatException e) {
1667
1670
                                                                                importState.operation
1668
1671
                                                                                                .addError(