Project

General

Profile

« Previous | Next » 

Revision d1ccac39

Added by Patrick Plitzner over 5 years ago

ref #7502 Add property columns for agents, media and references

View differences:

eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/AgentEditorInput.java
49 49
	private static AgentEditorInput instance;
50 50

  
51 51
	private static final String PROPERTY_NOMENCLATURAL_TITLE = "Nomenclatural Title";
52
	private static final String PROPERTY_FAMILY_NAME = "Family Name";
53
	private static final String PROPERTY_OTHER_NAME = "Other Name";
54
	private static final String PROPERTY_INITIALS = "Initials";
52 55

  
53 56
	public static String getID() {
54 57
		return ID;
......
58 61
	protected List<String> getPropertyKeys_internal() {
59 62
	    List<String> propertyKeysInternal = new ArrayList<>();
60 63
	    propertyKeysInternal.add(PROPERTY_NOMENCLATURAL_TITLE);
64
	    propertyKeysInternal.add(PROPERTY_FAMILY_NAME);
65
	    propertyKeysInternal.add(PROPERTY_OTHER_NAME);
66
	    propertyKeysInternal.add(PROPERTY_INITIALS);
61 67
	    return propertyKeysInternal;
62 68
	}
63 69

  
......
66 72
	    if(property.equals(PROPERTY_NOMENCLATURAL_TITLE)){
67 73
	        return cdmBase.getNomenclaturalTitle();
68 74
	    }
75
	    else if(property.equals(PROPERTY_FAMILY_NAME)){
76
	        if(cdmBase.isInstanceOf(Person.class)){
77
	            return HibernateProxyHelper.deproxy(cdmBase, Person.class).getFamilyName();
78
	        }
79
	    }
80
	    else if(property.equals(PROPERTY_OTHER_NAME)){
81
	        if(cdmBase.isInstanceOf(Person.class)){
82
	            return HibernateProxyHelper.deproxy(cdmBase, Person.class).getGivenName();
83
	        }
84
	    }
85
	    else if(property.equals(PROPERTY_INITIALS)){
86
	        if(cdmBase.isInstanceOf(Person.class)){
87
	            return HibernateProxyHelper.deproxy(cdmBase, Person.class).getInitials();
88
	        }
89
	    }
69 90
	    return super.getPropertyValue(cdmBase, property);
70 91
	}
71 92

  
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/MediaEditorInput.java
18 18
import eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator;
19 19
import eu.etaxonomy.cdm.api.service.config.MediaDeletionConfigurator;
20 20
import eu.etaxonomy.cdm.api.service.exception.ReferencedObjectUndeletableException;
21
import eu.etaxonomy.cdm.model.common.Language;
21 22
import eu.etaxonomy.cdm.model.media.Media;
22 23
import eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator;
23 24
import eu.etaxonomy.taxeditor.bulkeditor.IBulkEditorSortProvider;
24 25
import eu.etaxonomy.taxeditor.bulkeditor.input.entitycreator.MediaCreator;
25 26
import eu.etaxonomy.taxeditor.bulkeditor.input.sortprovider.IdentifiableEntitySortProvider;
27
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
26 28
import eu.etaxonomy.taxeditor.store.CdmStore;
27 29

  
28 30
/**
......
35 37

  
36 38
    private static MediaEditorInput instance;
37 39

  
40
    private static final String PROPERTY_TITLE = "Title";
41
    private static final String PROPERTY_DESCRIPTION = "Description";
42

  
43
    private Language globalLanguage = PreferencesUtil.getGlobalLanguage();
44

  
38 45
    public static String getID() {
39 46
        return ID;
40 47
    }
......
49 56
    @Override
50 57
    protected List<String> getPropertyKeys_internal() {
51 58
        List<String> propertyKeysInternal = new ArrayList<>();
59
        propertyKeysInternal.add(PROPERTY_TITLE);
60
        propertyKeysInternal.add(PROPERTY_DESCRIPTION);
52 61
        return propertyKeysInternal;
53 62
    }
54 63

  
55 64
    @Override
65
    public Object getPropertyValue(Media cdmBase, String property) {
66
        if(property.equals(PROPERTY_TITLE)){
67
            return cdmBase.getTitle();
68
        }
69
        else if(property.equals(PROPERTY_DESCRIPTION)){
70
            return cdmBase.getDescription(globalLanguage);
71
        }
72
        return super.getPropertyValue(cdmBase, property);
73
    }
74

  
75
    @Override
56 76
    public String getName() {
57 77
        return BulkEditorInputType.MEDIA.label;
58 78
    }
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/ReferenceEditorInput.java
39 39
	public static final String ID = "bulkeditor.input.reference";
40 40

  
41 41
	private static final String PROPERTY_NOMENCLATURAL_CACHE = "Nomencl. Cache";
42
	private static final String PROPERTY_TITLE = "Title";
43
	private static final String PROPERTY_NOMENCLAT_TITLE = "Nomencl. Title";
42 44

  
43 45
	private static ReferenceEditorInput instance;
44 46

  
......
50 52
    protected List<String> getPropertyKeys_internal() {
51 53
        List<String> propertyKeysInternal = new ArrayList<>();
52 54
        propertyKeysInternal.add(PROPERTY_NOMENCLATURAL_CACHE);
55
        propertyKeysInternal.add(PROPERTY_TITLE);
56
        propertyKeysInternal.add(PROPERTY_NOMENCLAT_TITLE);
53 57
        return propertyKeysInternal;
54 58
    }
55 59

  
......
58 62
        if(property.equals(PROPERTY_NOMENCLATURAL_CACHE)){
59 63
            return cdmBase.getAbbrevTitleCache();
60 64
        }
65
        else if(property.equals(PROPERTY_TITLE)){
66
            return cdmBase.getTitle();
67
        }
68
        else if(property.equals(PROPERTY_NOMENCLAT_TITLE)){
69
            return cdmBase.getAbbrevTitle();
70
        }
61 71
        return super.getPropertyValue(cdmBase, property);
62 72
    }
63 73

  

Also available in: Unified diff