Project

General

Profile

Revision 0e7c806f

ID0e7c806fd21353bea9dab12d95422210e1e76534
Parent d1ccac39
Child d9ade402

Added by Patrick Plitzner 8 months ago

ref #7502 Add boolean property columns

View differences:

eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/AbstractBulkEditorInput.java
58 58
    IEntityPersistenceService<T> {
59 59

  
60 60

  
61
    private static final String PROPERTY_PROTECTED_TITLECACHE = "Protect TitleCache";
61 62
    private static final String TYPE_PROPERTY = Messages.BulkEditorE4_TYPE;
62 63
    private static final String ID_PROPERTY = "Id"; //$NON-NLS-1$
63 64
    private static final String UUID_PROPERTY = "Uuid"; //$NON-NLS-1$
......
120 121
    public List<String> getPropertyKeys(){
121 122
        List<String> properties = new ArrayList<>();
122 123
        properties.add(getName());
124
        properties.add(PROPERTY_PROTECTED_TITLECACHE);
123 125
        properties.addAll(getPropertyKeys_internal());
124 126
        properties.add(TYPE_PROPERTY);
125 127
        properties.add(ID_PROPERTY);
......
133 135
    public Object getPropertyValue(T cdmBase, String property){
134 136
        if(property.equals(getName())){
135 137
            return getText(cdmBase);
136
        }else if(property.equals(TYPE_PROPERTY)){
138
        }
139
        else if(property.equals(PROPERTY_PROTECTED_TITLECACHE)
140
                &&cdmBase.isInstanceOf(IdentifiableEntity.class)){
141
            return HibernateProxyHelper.deproxy(cdmBase, IdentifiableEntity.class).isProtectedTitleCache();
142
        }
143
        else if(property.equals(TYPE_PROPERTY)){
137 144
            return getTypeText(cdmBase);
138
        }else if(property.equals(UUID_PROPERTY)){
145
        }
146
        else if(property.equals(UUID_PROPERTY)){
139 147
            return cdmBase.getUuid();
140
        }else if(property.equals(ID_PROPERTY)){
148
        }
149
        else if(property.equals(ID_PROPERTY)){
141 150
            return cdmBase.getId();
142 151
        }
143 152
        return null;
......
384 393
	}
385 394

  
386 395
	public String getText(T entity) {
387
		if(entity instanceof IdentifiableEntity){
388
			IdentifiableEntity identifiableEntity = (IdentifiableEntity) HibernateProxyHelper.deproxy(entity);
396
		if(entity.isInstanceOf(IdentifiableEntity.class)){
397
			IdentifiableEntity identifiableEntity = HibernateProxyHelper.deproxy(entity, IdentifiableEntity.class);
389 398
			String text = identifiableEntity.getTitleCache();
390 399
			return text;
391 400
		}
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/AgentEditorInput.java
20 20
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
21 21
import eu.etaxonomy.cdm.model.agent.AgentBase;
22 22
import eu.etaxonomy.cdm.model.agent.Person;
23
import eu.etaxonomy.cdm.model.agent.Team;
23 24
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
24 25
import eu.etaxonomy.cdm.strategy.merge.DefaultMergeStrategy;
25 26
import eu.etaxonomy.cdm.strategy.merge.IMergable;
......
52 53
	private static final String PROPERTY_FAMILY_NAME = "Family Name";
53 54
	private static final String PROPERTY_OTHER_NAME = "Other Name";
54 55
	private static final String PROPERTY_INITIALS = "Initials";
56
	private static final String PROPERTY_TEAM_HAS_MORE_MEMBERS = "Has More Members";
55 57

  
56 58
	public static String getID() {
57 59
		return ID;
......
64 66
	    propertyKeysInternal.add(PROPERTY_FAMILY_NAME);
65 67
	    propertyKeysInternal.add(PROPERTY_OTHER_NAME);
66 68
	    propertyKeysInternal.add(PROPERTY_INITIALS);
69
	    propertyKeysInternal.add(PROPERTY_TEAM_HAS_MORE_MEMBERS);
67 70
	    return propertyKeysInternal;
68 71
	}
69 72

  
......
72 75
	    if(property.equals(PROPERTY_NOMENCLATURAL_TITLE)){
73 76
	        return cdmBase.getNomenclaturalTitle();
74 77
	    }
75
	    else if(property.equals(PROPERTY_FAMILY_NAME)){
76
	        if(cdmBase.isInstanceOf(Person.class)){
77
	            return HibernateProxyHelper.deproxy(cdmBase, Person.class).getFamilyName();
78
	        }
78
	    else if(property.equals(PROPERTY_FAMILY_NAME)
79
	            && cdmBase.isInstanceOf(Person.class)){
80
	        return HibernateProxyHelper.deproxy(cdmBase, Person.class).getFamilyName();
79 81
	    }
80
	    else if(property.equals(PROPERTY_OTHER_NAME)){
81
	        if(cdmBase.isInstanceOf(Person.class)){
82
	            return HibernateProxyHelper.deproxy(cdmBase, Person.class).getGivenName();
83
	        }
82
	    else if(property.equals(PROPERTY_OTHER_NAME)
83
	            && cdmBase.isInstanceOf(Person.class)){
84
	        return HibernateProxyHelper.deproxy(cdmBase, Person.class).getGivenName();
84 85
	    }
85
	    else if(property.equals(PROPERTY_INITIALS)){
86
	        if(cdmBase.isInstanceOf(Person.class)){
87
	            return HibernateProxyHelper.deproxy(cdmBase, Person.class).getInitials();
88
	        }
86
	    else if(property.equals(PROPERTY_INITIALS)
87
	            && cdmBase.isInstanceOf(Person.class)){
88
	        return HibernateProxyHelper.deproxy(cdmBase, Person.class).getInitials();
89
	    }
90
	    else if(property.equals(PROPERTY_TEAM_HAS_MORE_MEMBERS)
91
	            && cdmBase.isInstanceOf(Team.class)){
92
	        return HibernateProxyHelper.deproxy(cdmBase, Team.class).isHasMoreMembers();
89 93
	    }
90 94
	    return super.getPropertyValue(cdmBase, property);
91 95
	}
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/OccurrenceEditorInput.java
39 39

  
40 40
	public static final String ID = "bulkeditor.input.occurrence"; //$NON-NLS-1$
41 41

  
42
	private static final String PROPERTY_PUBLISH = "Publish";
43

  
42 44
	private static OccurrenceEditorInput instance;
43 45

  
44 46
	public static AbstractBulkEditorInput<SpecimenOrObservationBase> getInstance() {
......
51 53
    @Override
52 54
    protected List<String> getPropertyKeys_internal() {
53 55
        List<String> propertyKeysInternal = new ArrayList<>();
56
        propertyKeysInternal.add(PROPERTY_PUBLISH);
54 57
        return propertyKeysInternal;
55 58
    }
56 59

  
60
    @Override
61
    public Object getPropertyValue(SpecimenOrObservationBase cdmBase, String property) {
62
        if(property.equals(PROPERTY_PUBLISH)){
63
            return cdmBase.isPublish();
64
        }
65
        return super.getPropertyValue(cdmBase, property);
66
    }
67

  
57 68
	@Override
58 69
	protected long countEntities(IIdentifiableEntityServiceConfigurator configurator) {
59 70
	    return CdmStore.getService(IOccurrenceService.class).countByTitle(configurator);
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/TaxonEditorInput.java
29 29

  
30 30
	public static final String ID = "bulkeditor.input.taxon";
31 31

  
32
	private static final String PROPERTY_PUBLISH = "Publish";
33

  
32 34
	private List<TaxonName> saveNameCandidates = new ArrayList<>();
33 35

  
34 36
	public static AbstractBulkEditorInput getInstance() {
......
42 44
    @Override
43 45
    protected List<String> getPropertyKeys_internal() {
44 46
        List<String> propertyKeysInternal = new ArrayList<>();
47
        propertyKeysInternal.add(PROPERTY_PUBLISH);
45 48
        return propertyKeysInternal;
46 49
    }
47 50

  
48 51
    @Override
52
    public Object getPropertyValue(TaxonBase cdmBase, String property) {
53
        if(property.equals(PROPERTY_PUBLISH)){
54
            return cdmBase.isPublish();
55
        }
56
        return super.getPropertyValue(cdmBase, property);
57
    }
58

  
59
    @Override
49 60
	public String getName() {
50 61
		return BulkEditorInputType.TAXON.label;
51 62
	}

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)