Changeset 8053
- Timestamp:
- Aug 2, 2022, 1:15:28 PM (10 months ago)
- Location:
- branches/3.19-stable/src/core
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.19-stable/src/core/common-queries.xml
r7997 r8053 2752 2752 <query id="DBLOG_GET_ANNOTATIONTYPE_INFO" type="HQL"> 2753 2753 <sql> 2754 SELECT at.name, at.valueType, at.disableLogOfValues 2754 SELECT at.name, at.valueType, at.disableLogOfValues, at.projectAnnotations 2755 2755 FROM AnnotationTypeData at 2756 2756 WHERE at.id = :annotationTypeId 2757 2757 </sql> 2758 2758 <description> 2759 An HQL query that loads the 'name', 'valueType' and 'disableLogOfValues' flag2760 for an annotation type given the ID.2759 An HQL query that loads the 'name', 'valueType', 'disableLogOfValues' and 2760 the 'projectAnnotations' flag for an annotation type given the ID. 2761 2761 </description> 2762 2762 </query> -
branches/3.19-stable/src/core/net/sf/basedb/core/AnnotationBatcher.java
r7522 r8053 1068 1068 1069 1069 /** 1070 Get the id of the project this annotation belong to. 1071 Only relevant if the annotation type is using project-specific 1072 annotations. 1073 @since 3.19.4 1074 */ 1075 public int getProjectId() 1076 { 1077 return projectId; 1078 } 1079 1080 /** 1070 1081 Get the ID of the unit this annotation is using. 1071 1082 */ -
branches/3.19-stable/src/core/net/sf/basedb/core/log/TransactionDetails.java
r7950 r8053 23 23 24 24 import java.util.Date; 25 import java.util.HashMap; 26 import java.util.Map; 25 27 26 28 import org.hibernate.query.Query; … … 52 54 private String pluginName; 53 55 private String jobName; 56 private Map<Integer, String> projectNames; 54 57 55 58 /** … … 179 182 180 183 /** 184 Get the name of the project with the given id. 185 Special cases: 0 = default 186 */ 187 public String getProjectName(int projectId) 188 { 189 String name = null; 190 if (projectId > 0) 191 { 192 if (projectNames == null) 193 { 194 projectNames = new HashMap<>(); 195 } 196 else 197 { 198 name = projectNames.get(projectId); 199 } 200 if (name == null) 201 { 202 Query<String> query = logControl.createHqlQuery("select prj.name from ProjectData prj where prj.id = " + projectId, String.class); 203 name = query.uniqueResult(); 204 projectNames.put(projectId, name); 205 } 206 } 207 else 208 { 209 name = "default"; 210 } 211 return name; 212 } 213 214 /** 181 215 Utility method for loading the name of the currently executing plugin. 182 216 The first call to this method will lookup the name in the database -
branches/3.19-stable/src/core/net/sf/basedb/core/log/db/AnnotationLogger.java
r7381 r8053 83 83 Integer parentId = null; 84 84 Integer parentType = null; 85 Integer projectId = null; 85 86 Annotation.Source source = null; 86 87 List<?> newValues = null; … … 105 106 newValues = info.getNewValues(); 106 107 } 108 if (at.getProjectAnnotations()) projectId = info.getProjectId(); 107 109 } 108 110 else if (entity instanceof AnnotationData) … … 120 122 valueType = Type.fromValue((Integer)tmp[1]); 121 123 if ((Boolean)tmp[2]) logOldPropertyValues = false; 124 if ((Boolean)tmp[3]) projectId = annotation.getProjectId(); 122 125 } 123 126 else … … 125 128 annotationType = at.getName(); 126 129 valueType = Type.fromValue(at.getValueType()); 130 if (at.getProjectAnnotations()) projectId = annotation.getProjectId(); 127 131 if (at.getDisableLogOfValues()) logOldPropertyValues = false; 128 132 } … … 190 194 change.setItemType(parentType); 191 195 196 String projectInfo = ""; 197 if (projectId != null) 198 { 199 String projectName = logControl.getTransactionDetails().getProjectName(projectId); 200 if (projectName != null) projectInfo = " ("+projectName+")"; 201 } 192 202 if (source == Annotation.Source.CLONED) 193 203 { 194 change.setChangeInfo("ClonedAnnotation["+annotationType+ "]");204 change.setChangeInfo("ClonedAnnotation["+annotationType+projectInfo+"]"); 195 205 } 196 206 else if (source == Annotation.Source.INHERITED) 197 207 { 198 change.setChangeInfo("InheritedAnnotation["+annotationType+ "]");208 change.setChangeInfo("InheritedAnnotation["+annotationType+projectInfo+"]"); 199 209 } 200 210 else 201 211 { 202 change.setChangeInfo("Annotation["+annotationType+ "]");212 change.setChangeInfo("Annotation["+annotationType+projectInfo+"]"); 203 213 } 204 214 if (logOldPropertyValues)
Note: See TracChangeset
for help on using the changeset viewer.