Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyan D. Brooks2017-08-04 15:51:01 -0400
committerRyan D. Brooks2017-08-15 14:43:34 -0400
commitcdf0550c45774d849c129375ee2742abc6de6485 (patch)
treecced78e970226c9323f61f3f2d6801b93909ebc0
parent5e7fe61d8b641a0c2868af0b1292bd43f11bc367 (diff)
downloadorg.eclipse.osee-cdf0550c45774d849c129375ee2742abc6de6485.tar.gz
org.eclipse.osee-cdf0550c45774d849c129375ee2742abc6de6485.tar.xz
org.eclipse.osee-cdf0550c45774d849c129375ee2742abc6de6485.zip
refinement: Improve performance of activity log
-rw-r--r--plugins/org.eclipse.osee.activity.api/META-INF/MANIFEST.MF5
-rw-r--r--plugins/org.eclipse.osee.activity.api/src/org/eclipse/osee/activity/api/Activity.java66
-rw-r--r--plugins/org.eclipse.osee.activity.api/src/org/eclipse/osee/activity/api/ActivityLog.java45
-rw-r--r--plugins/org.eclipse.osee.activity.api/src/org/eclipse/osee/activity/api/ActivityLogEndpoint.java56
-rw-r--r--plugins/org.eclipse.osee.activity.api/src/org/eclipse/osee/activity/api/ActivityType.java26
-rw-r--r--plugins/org.eclipse.osee.activity.api/src/org/eclipse/osee/activity/api/DefaultActivityType.java67
-rw-r--r--plugins/org.eclipse.osee.activity/META-INF/MANIFEST.MF1
-rw-r--r--plugins/org.eclipse.osee.activity/src/org/eclipse/osee/activity/ActivityStorage.java28
-rw-r--r--plugins/org.eclipse.osee.activity/src/org/eclipse/osee/activity/internal/ActivityLogImpl.java243
-rw-r--r--plugins/org.eclipse.osee.activity/src/org/eclipse/osee/activity/internal/DatabaseActivityStorage.java159
-rw-r--r--plugins/org.eclipse.osee.activity/src/org/eclipse/osee/activity/internal/jaxrs/ActivityLogRequestFilter.java5
-rw-r--r--plugins/org.eclipse.osee.activity/src/org/eclipse/osee/activity/internal/jaxrs/ActivityLogResource.java110
-rw-r--r--plugins/org.eclipse.osee.activity/src/org/eclipse/osee/activity/internal/jaxrs/ActivityLogResponseFilter.java11
-rw-r--r--plugins/org.eclipse.osee.activity/src/org/eclipse/osee/activity/internal/migration/V0.21.0_2015_02_26_0950__Activity.sql1
-rw-r--r--plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/util/AtsActivity.java58
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/config/AtsDatabaseConfig.java6
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/navigate/AtsNavigateComposite.java6
-rw-r--r--plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/ActivityTypeId.java34
-rw-r--r--plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/ActivityTypeToken.java63
-rw-r--r--plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/CoreActivityTypes.java53
-rw-r--r--plugins/org.eclipse.osee.framework.server.ide/src/org/eclipse/osee/framework/server/ide/internal/SessionEndpointImpl.java6
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/OseeEventManager.java6
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/PurgeTransactionOperationWithListener.java6
-rw-r--r--plugins/org.eclipse.osee.framework.ui.plugin/src/org/eclipse/osee/framework/ui/plugin/xnavigate/XNavigateComposite.java8
-rw-r--r--plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/BranchEndpointImpl.java36
-rw-r--r--plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/DatastoreEndpointImpl.java1
-rw-r--r--plugins/org.eclipse.osee.orcs/META-INF/MANIFEST.MF1
27 files changed, 402 insertions, 705 deletions
diff --git a/plugins/org.eclipse.osee.activity.api/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.activity.api/META-INF/MANIFEST.MF
index 18da632a7f..3f2716061e 100644
--- a/plugins/org.eclipse.osee.activity.api/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.activity.api/META-INF/MANIFEST.MF
@@ -5,7 +5,8 @@ Bundle-SymbolicName: org.eclipse.osee.activity.api
Bundle-Version: 0.26.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Export-Package: org.eclipse.osee.activity.api
-Import-Package: javax.ws.rs;version="2.0.0",
- javax.ws.rs.core;version="2.0.0",
+Import-Package: javax.ws.rs,
+ javax.ws.rs.core,
+ org.eclipse.osee.framework.core.data,
org.eclipse.osee.framework.jdk.core.type
Bundle-Vendor: Eclipse Open System Engineering Environment
diff --git a/plugins/org.eclipse.osee.activity.api/src/org/eclipse/osee/activity/api/Activity.java b/plugins/org.eclipse.osee.activity.api/src/org/eclipse/osee/activity/api/Activity.java
deleted file mode 100644
index eb8458297e..0000000000
--- a/plugins/org.eclipse.osee.activity.api/src/org/eclipse/osee/activity/api/Activity.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2014 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.activity.api;
-
-import static java.util.logging.Level.INFO;
-import static java.util.logging.Level.SEVERE;
-import java.util.logging.Level;
-
-/**
- * @author Ryan D. Brooks
- */
-public enum Activity implements ActivityType {
- JAXRS_METHOD_CALL(880479734L, INFO, "org.eclipse.osee.activity.jaxrs"),
- JAXRS_METHOD_CALL_FILTER_ERROR(23133964208285L, SEVERE, "org.eclipse.osee.activity.jaxrs"),
- SRS_TRACE(80349535402L, INFO, "org.eclipse.osee.define.report.SrsTraceReport"),
- MSG_CONTINUATION(29566294587L, INFO, "org.eclipse.osee.activity"),
- IDE(88L, INFO, "osee.ide.client"),
- XNAVIGATEITEM(45L, INFO, "osee.framework.XNavigateItem", "XNavigateItem [%s]"),
- ACCESS_CONTROL_MODIFIED(99L, INFO, "osee.framework.access", "Access Control Modified [%s]"),
- BRANCH_OPERATION(61L, INFO, "org.eclipse.osee.orcs.rest.internal.branch"),
- PURGE_TRANSACTION(4455L, INFO, "org.eclipse.osee.orcs.rest.purge.transaction");
-
- private final Long typeId;
- private final Long logLevel;
- private final String module;
- private String messageFormat;
-
- Activity(Long typeId, Level logLevel, String module, String messageFormat) {
- this.typeId = typeId;
- this.messageFormat = messageFormat;
- this.logLevel = new Long(logLevel.intValue());
- this.module = module;
- }
-
- Activity(Long typeId, Level logLevel, String module) {
- this(typeId, logLevel, module, "");
- }
-
- @Override
- public Long getTypeId() {
- return typeId;
- }
-
- @Override
- public Long getLogLevel() {
- return logLevel;
- }
-
- @Override
- public String getModule() {
- return module;
- }
-
- @Override
- public String getMessageFormat() {
- return messageFormat;
- }
-}
diff --git a/plugins/org.eclipse.osee.activity.api/src/org/eclipse/osee/activity/api/ActivityLog.java b/plugins/org.eclipse.osee.activity.api/src/org/eclipse/osee/activity/api/ActivityLog.java
index e0c22706b1..3d358ce3b9 100644
--- a/plugins/org.eclipse.osee.activity.api/src/org/eclipse/osee/activity/api/ActivityLog.java
+++ b/plugins/org.eclipse.osee.activity.api/src/org/eclipse/osee/activity/api/ActivityLog.java
@@ -10,36 +10,30 @@
*******************************************************************************/
package org.eclipse.osee.activity.api;
+import org.eclipse.osee.framework.core.data.ActivityTypeId;
+import org.eclipse.osee.framework.core.data.ActivityTypeToken;
+
/**
* @author Ryan D. Brooks
*/
public interface ActivityLog {
-
- public static interface ActivityDataHandler {
- void onData(Long entryId, Long parentId, Long typeId, Long accountId, Long serverId, Long clientId, Long startTime, Long duration, Integer status, String messageArgs);
- }
-
- public static interface ActivityTypeDataHandler {
- void onData(Long typeId, Long logLevel, String module, String messageFormat);
- }
-
Integer INITIAL_STATUS = 100;
Integer COMPLETE_STATUS = 100;
Integer ABNORMALLY_ENDED_STATUS = 500;
- void queryEntry(Long entryId, ActivityDataHandler handler);
+ ActivityEntry getEntry(ActivityEntryId entryId);
- Long createEntry(Long typeId, Integer status, Object... messageArgs);
+ Long createEntry(ActivityTypeToken type, Integer status, Object... messageArgs);
- Long createEntry(Long typeId, Long parentId, Integer status, Object... messageArgs);
+ Long createUpdateableEntry(ActivityTypeToken type, Object... messageArgs);
- Long createUpdateableEntry(ActivityType type, Object... messageArgs);
+ Long createEntry(ActivityTypeToken type, Object... messageArgs);
- Long createEntry(ActivityType type, Object... messageArgs);
+ Long createEntry(ActivityTypeToken type, Long parentId, Integer status, Object... messageArgs);
- Long createEntry(ActivityType type, Long parentId, Integer status, Object... messageArgs);
+ Long createEntry(Long accountId, Long clientId, ActivityTypeToken typeId, Long parentId, Integer status, String... messageArgs);
- Long createThrowableEntry(ActivityType type, Throwable throwable);
+ Long createThrowableEntry(ActivityTypeToken type, Throwable throwable);
boolean updateEntry(Long entryId, Integer status);
@@ -55,26 +49,15 @@ public interface ActivityLog {
void endEntryAbnormally(Long entryId, Integer status);
- Long createActivityThread(ActivityType type, Long accountId, Long serverId, Long clientId, Object... messageArgs);
-
- Long createActivityThread(Long parentId, ActivityType type, Long accountId, Long serverId, Long clientId, Object... messageArgs);
+ Long createActivityThread(ActivityTypeToken type, Long accountId, Long serverId, Long clientId, Object... messageArgs);
- void createActivityTypes(ActivityType... types);
+ Long createActivityThread(Long parentId, ActivityTypeToken type, Long accountId, Long serverId, Long clientId, Object... messageArgs);
- void queryActivityTypes(ActivityTypeDataHandler handler);
-
- void queryActivityType(Long typeId, ActivityTypeDataHandler handler);
-
- boolean activityTypeExists(Long typeId);
-
- Long createEntry(Long accountId, Long clientId, Long typeId, Long parentId, Integer status, String... messageArgs);
+ ActivityTypeToken getActivityType(ActivityTypeId typeId);
boolean isEnabled();
void setEnabled(boolean enabled);
- /**
- * Sets the ActivityLog as un-initialized. Next call to create will re-initialize
- */
- void unInitialize();
+ ActivityTypeToken createIfAbsent(ActivityTypeToken type);
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.activity.api/src/org/eclipse/osee/activity/api/ActivityLogEndpoint.java b/plugins/org.eclipse.osee.activity.api/src/org/eclipse/osee/activity/api/ActivityLogEndpoint.java
index 56d74fa8f8..236c1b1de0 100644
--- a/plugins/org.eclipse.osee.activity.api/src/org/eclipse/osee/activity/api/ActivityLogEndpoint.java
+++ b/plugins/org.eclipse.osee.activity.api/src/org/eclipse/osee/activity/api/ActivityLogEndpoint.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.osee.activity.api;
+import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
@@ -19,6 +20,8 @@ import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
+import org.eclipse.osee.framework.core.data.ActivityTypeId;
+import org.eclipse.osee.framework.core.data.ActivityTypeToken;
/**
* @author Ryan D. Brooks
@@ -35,34 +38,12 @@ public interface ActivityLogEndpoint {
@GET
@Path("/entry/{entry-id}")
@Produces({MediaType.APPLICATION_JSON})
- ActivityEntry getEntry(@PathParam("entry-id") Long entryId);
-
- /**
- * Get all activity types
- *
- * @param typeId activity typeId id
- * @return activityType
- */
- @GET
- @Path("/type")
- @Produces({MediaType.APPLICATION_JSON})
- DefaultActivityType[] getActivityTypes();
-
- /**
- * Get activity type data
- *
- * @param typeId activity typeId id
- * @return activityType
- */
- @GET
- @Path("/type/{type-id}")
- @Produces({MediaType.APPLICATION_JSON})
- DefaultActivityType getActivityType(@PathParam("type-id") Long typeId);
+ ActivityEntry getEntry(@PathParam("entry-id") ActivityEntryId entryId);
/**
* Create a new activity entry
*
- * @param typeId activity type id
+ * @param type activity type id
* @param parentId of the parent activity
* @param status of the activity
* @param message to log for the activity
@@ -71,34 +52,17 @@ public interface ActivityLogEndpoint {
@POST
@Path("/entry")
@Produces({MediaType.APPLICATION_JSON})
- ActivityEntryId createEntry(@QueryParam("typeId") Long typeId, @QueryParam("parentId") Long parentId, @QueryParam("status") Integer status, @QueryParam("message") String message);
-
- /**
- * Create a new activity type
- *
- * @param typeId activity type id to use
- * @param logLevel of activity type
- * @param module this activity comes from
- * @param messageFormat for activity type
- * @return activityType
- */
- @POST
- @Path("/type/{type-id}")
- @Produces({MediaType.APPLICATION_JSON})
- DefaultActivityType createActivityType(@PathParam("type-id") Long typeId, @QueryParam("level") Long logLevel, @QueryParam("module") String module, @QueryParam("messageFormat") String messageFormat);
+ ActivityEntryId createEntry(@QueryParam("type") ActivityTypeId type, @QueryParam("parentId") Long parentId, @QueryParam("status") Integer status, @QueryParam("message") String message);
/**
- * Create a new activity type (will generate a new type id)
- *
- * @param logLevel of activity type
- * @param module this activity comes from
- * @param messageFormat for activity type
- * @return activityType
+ * Create a new activity type with the given token fields. If id is not valid then a new one will be generated and
+ * used.
*/
@POST
@Path("/type")
@Produces({MediaType.APPLICATION_JSON})
- DefaultActivityType createActivityType(@QueryParam("level") Long logLevel, @QueryParam("module") String module, @QueryParam("messageFormat") String messageFormat);
+ @Consumes({MediaType.APPLICATION_JSON})
+ ActivityTypeToken createIfAbsent(ActivityTypeToken activityType);
/**
* Modify an entries status
diff --git a/plugins/org.eclipse.osee.activity.api/src/org/eclipse/osee/activity/api/ActivityType.java b/plugins/org.eclipse.osee.activity.api/src/org/eclipse/osee/activity/api/ActivityType.java
deleted file mode 100644
index 5e8b8aac59..0000000000
--- a/plugins/org.eclipse.osee.activity.api/src/org/eclipse/osee/activity/api/ActivityType.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2014 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.activity.api;
-
-/**
- * @author Ryan D. Brooks
- */
-public interface ActivityType {
-
- Long getTypeId();
-
- Long getLogLevel();
-
- String getModule();
-
- String getMessageFormat();
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.activity.api/src/org/eclipse/osee/activity/api/DefaultActivityType.java b/plugins/org.eclipse.osee.activity.api/src/org/eclipse/osee/activity/api/DefaultActivityType.java
deleted file mode 100644
index e123293110..0000000000
--- a/plugins/org.eclipse.osee.activity.api/src/org/eclipse/osee/activity/api/DefaultActivityType.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2014 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.activity.api;
-
-import javax.xml.bind.annotation.XmlRootElement;
-
-/**
- * @author Ryan D. Brooks
- */
-@XmlRootElement
-public class DefaultActivityType implements ActivityType {
-
- private Long typeId;
- private Long logLevel;
- private String module;
- private String messageFormat;
-
- @Override
- public Long getTypeId() {
- return typeId;
- }
-
- @Override
- public Long getLogLevel() {
- return logLevel;
- }
-
- @Override
- public String getModule() {
- return module;
- }
-
- @Override
- public String getMessageFormat() {
- return messageFormat;
- }
-
- public void setTypeId(Long typeId) {
- this.typeId = typeId;
- }
-
- public void setLogLevel(Long logLevel) {
- this.logLevel = logLevel;
- }
-
- public void setModule(String module) {
- this.module = module;
- }
-
- public void setMessageFormat(String messageFormat) {
- this.messageFormat = messageFormat;
- }
-
- @Override
- public String toString() {
- return "DefaultActivityType [typeId=" + typeId + ", logLevel=" + logLevel + ", module=" + module + ", messageFormat=" + messageFormat + "]";
- }
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.activity/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.activity/META-INF/MANIFEST.MF
index 99ad5beef0..90ff8428d3 100644
--- a/plugins/org.eclipse.osee.activity/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.activity/META-INF/MANIFEST.MF
@@ -14,6 +14,7 @@ Import-Package: javax.annotation;version="1.2.0",
javax.ws.rs.ext;version="2.0.0",
org.eclipse.osee.activity.api,
org.eclipse.osee.executor.admin,
+ org.eclipse.osee.framework.core.data,
org.eclipse.osee.framework.core.exception,
org.eclipse.osee.framework.jdk.core.type,
org.eclipse.osee.framework.jdk.core.util,
diff --git a/plugins/org.eclipse.osee.activity/src/org/eclipse/osee/activity/ActivityStorage.java b/plugins/org.eclipse.osee.activity/src/org/eclipse/osee/activity/ActivityStorage.java
index 051576faba..31d470af1c 100644
--- a/plugins/org.eclipse.osee.activity/src/org/eclipse/osee/activity/ActivityStorage.java
+++ b/plugins/org.eclipse.osee.activity/src/org/eclipse/osee/activity/ActivityStorage.java
@@ -10,31 +10,35 @@
*******************************************************************************/
package org.eclipse.osee.activity;
-import org.eclipse.osee.activity.api.ActivityLog.ActivityDataHandler;
-import org.eclipse.osee.activity.api.ActivityLog.ActivityTypeDataHandler;
-import org.eclipse.osee.activity.api.ActivityType;
+import org.eclipse.osee.activity.api.ActivityEntry;
+import org.eclipse.osee.activity.api.ActivityEntryId;
+import org.eclipse.osee.framework.core.data.ActivityTypeId;
+import org.eclipse.osee.framework.core.data.ActivityTypeToken;
/**
* @author Ryan D. Brooks
*/
public interface ActivityStorage {
- void selectEntry(Long entryId, ActivityDataHandler handler);
+ ActivityEntry getEntry(ActivityEntryId entryId);
int addEntries(Iterable<Object[]> newEntries);
int updateEntries(Iterable<Object[]> updatedEntries);
- void addActivityTypes(ActivityType... types);
+ ActivityTypeToken getActivityType(ActivityTypeId typeId);
- void addActivityTypes(Iterable<ActivityType> types);
-
- void selectTypes(ActivityTypeDataHandler handler);
-
- void selectType(Long typeId, ActivityTypeDataHandler handler);
+ void cleanEntries(int daysToKeep);
- boolean typeExists(Long typeId);
+ /**
+ * Stores the activity type if not already in the data store. If the type token has an invalid id, a new id is
+ * generated and included in the returned token
+ *
+ * @param type
+ * @return
+ */
+ ActivityTypeToken createIfAbsent(ActivityTypeToken type);
- void cleanEntries(int daysToKeep);
+ void createIfAbsent(Iterable<ActivityTypeToken> types);
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.activity/src/org/eclipse/osee/activity/internal/ActivityLogImpl.java b/plugins/org.eclipse.osee.activity/src/org/eclipse/osee/activity/internal/ActivityLogImpl.java
index 3c6f4e698e..cc611f0e41 100644
--- a/plugins/org.eclipse.osee.activity/src/org/eclipse/osee/activity/internal/ActivityLogImpl.java
+++ b/plugins/org.eclipse.osee.activity/src/org/eclipse/osee/activity/internal/ActivityLogImpl.java
@@ -24,20 +24,22 @@ import static org.eclipse.osee.activity.ActivityConstants.DEFAULT_ACTIVITY_LOGGE
import static org.eclipse.osee.activity.internal.ActivityUtil.captureStackTrace;
import static org.eclipse.osee.activity.internal.ActivityUtil.get;
import java.util.Calendar;
-import java.util.HashMap;
import java.util.Map;
import java.util.Random;
import java.util.concurrent.Callable;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicBoolean;
import org.eclipse.osee.activity.ActivityConstants;
import org.eclipse.osee.activity.ActivityStorage;
-import org.eclipse.osee.activity.api.Activity;
+import org.eclipse.osee.activity.api.ActivityEntry;
+import org.eclipse.osee.activity.api.ActivityEntryId;
import org.eclipse.osee.activity.api.ActivityLog;
-import org.eclipse.osee.activity.api.ActivityType;
import org.eclipse.osee.executor.admin.ExecutorAdmin;
+import org.eclipse.osee.framework.core.data.ActivityTypeId;
+import org.eclipse.osee.framework.core.data.ActivityTypeToken;
+import org.eclipse.osee.framework.core.data.CoreActivityTypes;
import org.eclipse.osee.framework.jdk.core.type.DrainingIterator;
+import org.eclipse.osee.framework.jdk.core.type.Id;
import org.eclipse.osee.framework.jdk.core.type.OseeArgumentException;
import org.eclipse.osee.framework.jdk.core.util.Collections;
import org.eclipse.osee.framework.jdk.core.util.Lib;
@@ -62,26 +64,28 @@ public class ActivityLogImpl implements ActivityLog, Callable<Void> {
STATUS,
MESSAGE_ARGS;
- public static final Long SENTINAL = -1L;
+ public static final Long SENTINEL = -1L;
Long from(Object[] entry) {
Object obj = entry[ordinal()];
if (obj instanceof Long) {
- return (Long) entry[ordinal()];
+ return (Long) obj;
}
- throw new OseeArgumentException("LogEntryIndex.from may only be used with values of type Long");
+ if (obj instanceof Id) {
+ return ((Id) obj).getId();
+ }
+ throw new OseeArgumentException(
+ "LogEntryIndex.from called with agrgument of unsupported type " + obj.getClass());
}
};
+ private final ConcurrentHashMap<Long, ActivityTypeToken> types = new ConcurrentHashMap<>(30);
private final ConcurrentHashMap<Long, Object[]> newEntities = new ConcurrentHashMap<>();
private final ConcurrentHashMap<Long, Object[]> updatedEntities = new ConcurrentHashMap<>();
- private static final Object[] EMPTY_ARRAY = new Object[0];
-
private Log logger;
private ExecutorAdmin executorAdmin;
private ActivityStorage storage;
- private final AtomicBoolean initialized = new AtomicBoolean(false);
private ActivityMonitorImpl activityMonitor;
private volatile long freshnessMillis;
private volatile int exceptionLineCount;
@@ -103,6 +107,9 @@ public class ActivityLogImpl implements ActivityLog, Callable<Void> {
}
public void start(Map<String, Object> properties) throws Exception {
+ for (ActivityTypeToken type : CoreActivityTypes.getTypes()) {
+ types.put(type.getId(), type);
+ }
activityMonitor = new ActivityMonitorImpl();
update(properties);
}
@@ -117,8 +124,8 @@ public class ActivityLogImpl implements ActivityLog, Callable<Void> {
}
@Override
- public void queryEntry(Long entryId, ActivityDataHandler handler) {
- storage.selectEntry(entryId, handler);
+ public ActivityEntry getEntry(ActivityEntryId entryId) {
+ return storage.getEntry(entryId);
}
public void update(Map<String, Object> properties) {
@@ -182,39 +189,34 @@ public class ActivityLogImpl implements ActivityLog, Callable<Void> {
}
@Override
- public Long createEntry(ActivityType type, Object... messageArgs) {
- return createEntry(type.getTypeId(), COMPLETE_STATUS, messageArgs);
+ public Long createEntry(ActivityTypeToken type, Object... messageArgs) {
+ return createEntry(type, COMPLETE_STATUS, messageArgs);
}
@Override
- public Long createUpdateableEntry(ActivityType type, Object... messageArgs) {
- return createEntry(type.getTypeId(), INITIAL_STATUS, messageArgs);
+ public Long createUpdateableEntry(ActivityTypeToken type, Object... messageArgs) {
+ return createEntry(type, INITIAL_STATUS, messageArgs);
}
@Override
- public Long createEntry(ActivityType type, Long parentId, Integer status, Object... messageArgs) {
- return createEntry(type.getTypeId(), parentId, status, messageArgs);
- }
-
- @Override
- public Long createEntry(Long typeId, Integer status, Object... messageArgs) {
+ public Long createEntry(ActivityTypeToken type, Integer status, Object... messageArgs) {
if (enabled) {
Object[] threadRootEntry = activityMonitor.getThreadRootEntry();
- // Should never have a null rootEntry, but still want to log message with sentinals
- Long entryId = threadRootEntry == null ? LogEntry.SENTINAL : LogEntry.ENTRY_ID.from(threadRootEntry);
- return createEntry(typeId, entryId, status, messageArgs);
+ // Should never have a null rootEntry, but still want to log message with sentinel
+ Long entryId = threadRootEntry == null ? LogEntry.SENTINEL : LogEntry.ENTRY_ID.from(threadRootEntry);
+ return createEntry(type, entryId, status, messageArgs);
}
return 0L;
}
@Override
- public Long createEntry(Long typeId, Long parentId, Integer status, Object... messageArgs) {
+ public Long createEntry(ActivityTypeToken typeId, Long parentId, Integer status, Object... messageArgs) {
if (enabled) {
Object[] rootEntry = activityMonitor.getThreadRootEntry();
- // Should never have a null rootEntry, but still want to log message with sentinals
- Long accountId = rootEntry == null ? LogEntry.SENTINAL : LogEntry.ACCOUNT_ID.from(rootEntry);
- Long serverId = rootEntry == null ? LogEntry.SENTINAL : LogEntry.SERVER_ID.from(rootEntry);
- Long clientId = rootEntry == null ? LogEntry.SENTINAL : LogEntry.CLIENT_ID.from(rootEntry);
+ // Should never have a null rootEntry, but still want to log message with sentinels
+ Long accountId = rootEntry == null ? LogEntry.SENTINEL : LogEntry.ACCOUNT_ID.from(rootEntry);
+ Long serverId = rootEntry == null ? LogEntry.SENTINEL : LogEntry.SERVER_ID.from(rootEntry);
+ Long clientId = rootEntry == null ? LogEntry.SENTINEL : LogEntry.CLIENT_ID.from(rootEntry);
Object[] entry =
createEntry(parentId, typeId, accountId, serverId, clientId, computeDuration(), status, messageArgs);
return LogEntry.ENTRY_ID.from(entry);
@@ -223,7 +225,7 @@ public class ActivityLogImpl implements ActivityLog, Callable<Void> {
}
@Override
- public Long createEntry(Long accountId, Long clientId, Long typeId, Long parentId, Integer status, String... messageArgs) {
+ public Long createEntry(Long accountId, Long clientId, ActivityTypeToken typeId, Long parentId, Integer status, String... messageArgs) {
Object[] rootEntry = activityMonitor.getThreadRootEntry();
Long serverId = LogEntry.SERVER_ID.from(rootEntry);
Object[] entry = createEntry(parentId, typeId, accountId, serverId, clientId, computeDuration(), status,
@@ -231,96 +233,63 @@ public class ActivityLogImpl implements ActivityLog, Callable<Void> {
return LogEntry.ENTRY_ID.from(entry);
}
- private Object[] createEntry(Long parentId, Long typeId, Long accountId, Long serverId, Long clientId, Long duration, Integer status, Object... messageArgs) {
- Object[] entry = EMPTY_ARRAY;
- if (enabled) {
- try {
- Long entryId = Lib.generateUuid();
- Long startTime = System.currentTimeMillis();
- String fullMsg = null;
-
- String messageFormat = getTypeMessageFormat(typeId);
- if (Strings.isValid(messageFormat)) {
- fullMsg = String.format(messageFormat, messageArgs);
- } else {
- fullMsg = Collections.toString("\n", messageArgs);
- }
+ private Object[] createEntry(Long parentId, ActivityTypeToken type, Long accountId, Long serverId, Long clientId, Long duration, Integer status, Object... messageArgs) {
+ Object[] entry;
+ Long entryId = Lib.generateUuid();
+ Long startTime = System.currentTimeMillis();
+
+ String msg;
+ String fullMsg = null;
+ try {
+ String messageFormat = type.getMessageFormat();
+ if (Strings.isValid(messageFormat)) {
+ fullMsg = String.format(messageFormat, messageArgs);
+ } else {
+ fullMsg = Collections.toString("\n", messageArgs);
+ }
+
+ msg = fullMsg.substring(0, Math.min(fullMsg.length(), JdbcConstants.JDBC__MAX_VARCHAR_LENGTH));
+ } catch (Throwable th) {
+ msg = th.toString();
+ logger.error(th, "Error ActivityLog.createEntry");
+ }
- String msg = fullMsg.substring(0, Math.min(fullMsg.length(), JdbcConstants.JDBC__MAX_VARCHAR_LENGTH));
- // this is the parent entry so it must be inserted first (because the entry writing is asynchronous
- entry = new Object[] {
- entryId,
- parentId,
- typeId,
+ // this is the parent entry so it must be inserted first (because the entry writing is asynchronous
+ entry = new Object[] {entryId, parentId, type, accountId, serverId, clientId, startTime, duration, status, msg};
+ newEntities.put(entryId, entry);
+
+ if (fullMsg != null && fullMsg.length() > JdbcConstants.JDBC__MAX_VARCHAR_LENGTH) {
+ Long parentCursor = entryId;
+ for (int i = JdbcConstants.JDBC__MAX_VARCHAR_LENGTH; i < fullMsg.length(); i +=
+ JdbcConstants.JDBC__MAX_VARCHAR_LENGTH) {
+ Long continueEntryId = Lib.generateUuid();
+ Object[] continueEntry = new Object[] {
+ continueEntryId,
+ parentCursor,
+ CoreActivityTypes.MSG_CONTINUATION,
accountId,
serverId,
clientId,
startTime,
duration,
status,
- msg};
- newEntities.put(entryId, entry);
-
- if (fullMsg.length() > JdbcConstants.JDBC__MAX_VARCHAR_LENGTH) {
- Long parentCursor = entryId;
- for (int i = JdbcConstants.JDBC__MAX_VARCHAR_LENGTH; i < fullMsg.length(); i +=
- JdbcConstants.JDBC__MAX_VARCHAR_LENGTH) {
- Long continueEntryId = Lib.generateUuid();
- Object[] continueEntry = new Object[] {
- continueEntryId,
- parentCursor,
- Activity.MSG_CONTINUATION.getTypeId(),
- accountId,
- serverId,
- clientId,
- startTime,
- duration,
- status,
- fullMsg.substring(i, Math.min(fullMsg.length(), i + JdbcConstants.JDBC__MAX_VARCHAR_LENGTH))};
- newEntities.put(continueEntryId, continueEntry);
- parentCursor = continueEntryId;
- }
- }
- flush(false);
- } catch (Throwable th) {
- logger.error(th, "Error ActivityLog.createEntry");
+ fullMsg.substring(i, Math.min(fullMsg.length(), i + JdbcConstants.JDBC__MAX_VARCHAR_LENGTH))};
+ newEntities.put(continueEntryId, continueEntry);
+ parentCursor = continueEntryId;
}
}
- return entry;
- }
-
- private class ActivityTypeMessageRetriever implements ActivityTypeDataHandler {
-
- private final Long typeId;
- private String messageFormat = null;
-
- public ActivityTypeMessageRetriever(Long typeId) {
- this.typeId = typeId;
- }
-
- @Override
- public void onData(Long typeId, Long logLevel, String module, String messageFormat) {
- this.messageFormat = messageFormat;
- }
+ flush(false);
- public String get() {
- queryActivityType(typeId, this);
- return messageFormat;
- }
-
- }
-
- private String getTypeMessageFormat(Long typeId) {
- return new ActivityTypeMessageRetriever(typeId).get();
+ return entry;
}
@Override
- public Long createThrowableEntry(ActivityType type, Throwable throwable) {
+ public Long createThrowableEntry(ActivityTypeToken type, Throwable throwable) {
Long entryId = -1L;
if (enabled) {
try {
String message = captureStackTrace(throwable, exceptionLineCount);
- entryId = createEntry(type.getTypeId(), ABNORMALLY_ENDED_STATUS, message);
+ entryId = createEntry(type, ABNORMALLY_ENDED_STATUS, message);
} catch (Throwable th) {
logger.error(th, "logging failed in ActivityLogImpl.createThrowableEntry");
}
@@ -359,7 +328,7 @@ public class ActivityLogImpl implements ActivityLog, Callable<Void> {
private Long computeDuration() {
long timeOfUpdate = System.currentTimeMillis();
Object[] rootEntry = activityMonitor.getThreadRootEntry();
- return timeOfUpdate = rootEntry == null ? LogEntry.SENTINAL : timeOfUpdate - LogEntry.START_TIME.from(rootEntry);
+ return timeOfUpdate = rootEntry == null ? LogEntry.SENTINEL : timeOfUpdate - LogEntry.START_TIME.from(rootEntry);
}
/**
@@ -380,9 +349,6 @@ public class ActivityLogImpl implements ActivityLog, Callable<Void> {
@Override
public Void call() {
if (enabled) {
- if (!initialized.getAndSet(true)) {
- initialize();
- }
if (!newEntities.isEmpty()) {
try {
storage.addEntries(new DrainingIterator<Object[]>(newEntities.values().iterator()));
@@ -417,28 +383,6 @@ public class ActivityLogImpl implements ActivityLog, Callable<Void> {
}
}
- private void initialize() {
- try {
- final Map<Long, ActivityType> types = new HashMap<>(4);
- for (Activity type : Activity.values()) {
- types.put(type.getTypeId(), type);
- }
- storage.selectTypes(new ActivityTypeDataHandler() {
-
- @Override
- public void onData(Long typeId, Long logLevel, String module, String messageFormat) {
- types.remove(typeId);
- }
- });
- if (!types.isEmpty()) {
- storage.addActivityTypes(types.values());
- }
- } catch (Throwable ex) {
- this.initialized.set(false);
- logger.error(ex, "Exception while initializing activity types");
- }
- }
-
@Override
public void completeEntry(Long entryId) {
updateEntry(entryId, COMPLETE_STATUS);
@@ -459,35 +403,25 @@ public class ActivityLogImpl implements ActivityLog, Callable<Void> {
}
@Override
- public Long createActivityThread(ActivityType type, Long accountId, Long serverId, Long clientId, Object... messageArgs) {
+ public Long createActivityThread(ActivityTypeToken type, Long accountId, Long serverId, Long clientId, Object... messageArgs) {
return createActivityThread(ActivityConstants.ROOT_ENTRY_ID, type, accountId, serverId, clientId, messageArgs);
}
@Override
- public Long createActivityThread(Long parentId, ActivityType type, Long accountId, Long serverId, Long clientId, Object... messageArgs) {
- Object[] entry = createEntry(parentId, type.getTypeId(), accountId, serverId, clientId, 0L, 0, messageArgs);
+ public Long createActivityThread(Long parentId, ActivityTypeToken type, Long accountId, Long serverId, Long clientId, Object... messageArgs) {
+ Object[] entry = createEntry(parentId, type, accountId, serverId, clientId, 0L, 0, messageArgs);
activityMonitor.addActivityThread(entry);
return LogEntry.ENTRY_ID.from(entry);
}
@Override
- public void createActivityTypes(ActivityType... types) {
- storage.addActivityTypes(types);
- }
-
- @Override
- public void queryActivityType(Long typeId, ActivityTypeDataHandler handler) {
- storage.selectType(typeId, handler);
- }
-
- @Override
- public boolean activityTypeExists(Long typeId) {
- return storage.typeExists(typeId);
- }
-
- @Override
- public void queryActivityTypes(ActivityTypeDataHandler handler) {
- storage.selectTypes(handler);
+ public ActivityTypeToken getActivityType(ActivityTypeId typeId) {
+ ActivityTypeToken type = types.get(typeId);
+ if (type == null) {
+ type = storage.getActivityType(typeId);
+ types.put(type.getId(), type);
+ }
+ return type;
}
@Override
@@ -501,7 +435,12 @@ public class ActivityLogImpl implements ActivityLog, Callable<Void> {
}
@Override
- public void unInitialize() {
- this.initialized.set(false);
+ public ActivityTypeToken createIfAbsent(ActivityTypeToken token) {
+ ActivityTypeToken type = types.get(token);
+ if (type == null) {
+ type = storage.createIfAbsent(token);
+ types.put(type.getId(), type);
+ }
+ return type;
}
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.activity/src/org/eclipse/osee/activity/internal/DatabaseActivityStorage.java b/plugins/org.eclipse.osee.activity/src/org/eclipse/osee/activity/internal/DatabaseActivityStorage.java
index d9575015e5..560d37ecde 100644
--- a/plugins/org.eclipse.osee.activity/src/org/eclipse/osee/activity/internal/DatabaseActivityStorage.java
+++ b/plugins/org.eclipse.osee.activity/src/org/eclipse/osee/activity/internal/DatabaseActivityStorage.java
@@ -10,13 +10,17 @@
*******************************************************************************/
package org.eclipse.osee.activity.internal;
-import java.util.Arrays;
import java.util.Calendar;
import java.util.function.Consumer;
+import java.util.logging.Level;
import org.eclipse.osee.activity.ActivityStorage;
-import org.eclipse.osee.activity.api.ActivityLog.ActivityDataHandler;
-import org.eclipse.osee.activity.api.ActivityLog.ActivityTypeDataHandler;
-import org.eclipse.osee.activity.api.ActivityType;
+import org.eclipse.osee.activity.api.ActivityEntry;
+import org.eclipse.osee.activity.api.ActivityEntryId;
+import org.eclipse.osee.framework.core.data.ActivityTypeId;
+import org.eclipse.osee.framework.core.data.ActivityTypeToken;
+import org.eclipse.osee.framework.core.exception.OseeNotFoundException;
+import org.eclipse.osee.framework.jdk.core.type.MutableBoolean;
+import org.eclipse.osee.framework.jdk.core.util.Lib;
import org.eclipse.osee.jdbc.JdbcClient;
import org.eclipse.osee.jdbc.JdbcService;
import org.eclipse.osee.jdbc.JdbcStatement;
@@ -33,120 +37,67 @@ public class DatabaseActivityStorage implements ActivityStorage {
private static final String UPDATE_ENTRIES = "UPDATE osee_activity set status = ?, duration = ? where entry_id = ?";
- private static final String SELECT_ALL_TYPES = "SELECT * FROM osee_activity_type";
-
private static final String SELECT_TYPE = "SELECT * FROM osee_activity_type WHERE type_id = ?";
private static final String INSERT_TYPE =
- "INSERT INTO osee_activity_type (type_id, log_level, module, msg_format) VALUES (?,?,?,?)";
-
- private static final String COUNT_TYPE = "SELECT count(1) FROM osee_activity_type WHERE type_id = ?";
+ "INSERT INTO osee_activity_type (type_id, log_level, module, msg_format) SELECT (?,?,?,?) where NOT EXISTS (SELECT 1 from osee_activity_type where type_id = ?)";
private static final String DELETE_ENTRIES = "DELETE FROM osee_activity WHERE start_time <= ?";
- private static class ActivityEntryProcessor implements Consumer<JdbcStatement> {
-
- private final ActivityDataHandler handler;
-
- public ActivityEntryProcessor(ActivityDataHandler handler) {
- super();
- this.handler = handler;
- }
-
- @Override
- public void accept(JdbcStatement chStmt) {
- Long entryId = chStmt.getLong("entry_id");
- Long parentId = chStmt.getLong("parent_id");
- Long typeId = chStmt.getLong("type_id");
- Long accountId = chStmt.getLong("account_id");
- Long serverId = chStmt.getLong("server_id");
- Long clientId = chStmt.getLong("client_id");
- Long startTime = chStmt.getLong("start_time");
- Long duration = chStmt.getLong("duration");
- Integer status = chStmt.getInt("status");
- String messageArgs = chStmt.getString("msg_args");
- handler.onData(entryId, parentId, typeId, accountId, serverId, clientId, startTime, duration, status,
- messageArgs);
- }
- }
-
- private static class ActivityTypeProcessor implements Consumer<JdbcStatement> {
-
- private final ActivityTypeDataHandler handler;
-
- public ActivityTypeProcessor(ActivityTypeDataHandler handler) {
- super();
- this.handler = handler;
- }
-
- @Override
- public void accept(JdbcStatement chStmt) {
- Long typeId = chStmt.getLong("type_id");
- Long logLevel = chStmt.getLong("log_level");
- String module = chStmt.getString("module");
- String messageFormat = chStmt.getString("msg_format");
- handler.onData(typeId, logLevel, module, messageFormat);
- }
- }
-
- private JdbcService jdbcService;
+ private JdbcClient jdbcClient;
public void setJdbcService(JdbcService jdbcService) {
- this.jdbcService = jdbcService;
- }
-
- private JdbcClient getJdbcClient() {
- return jdbcService.getClient();
+ this.jdbcClient = jdbcService.getClient();
}
@Override
- public void selectEntry(Long entryId, final ActivityDataHandler handler) {
- getJdbcClient().runQuery(new ActivityEntryProcessor(handler), SELECT_ENTRY, entryId);
+ public ActivityEntry getEntry(ActivityEntryId entryId) {
+ final ActivityEntry entry = new ActivityEntry(entryId.getId());
+ final MutableBoolean found = new MutableBoolean(false);
+
+ Consumer<JdbcStatement> consumer = stmt -> {
+ entry.setAccountId(stmt.getLong("account_id"));
+ entry.setClientId(stmt.getLong("client_id"));
+ entry.setDuration(stmt.getLong("duration"));
+ entry.setMessageArgs(stmt.getString("msg_args"));
+ entry.setParentId(stmt.getLong("parent_id"));
+ entry.setServerId(stmt.getLong("server_id"));
+ entry.setStartTime(stmt.getLong("start_time"));
+ entry.setStatus(stmt.getInt("status"));
+ entry.setTypeId(stmt.getLong("type_id"));
+ found.setValue(true);
+ };
+
+ jdbcClient.runQuery(consumer, SELECT_ENTRY, entryId);
+ if (!found.getValue()) {
+ throw new OseeNotFoundException("Activity Log entry [%s] not found", entryId.getIdString());
+ }
+ return entry;
}
@Override
public int addEntries(Iterable<Object[]> newEntries) {
- return getJdbcClient().runBatchUpdate(INSERT_ENTRIES, newEntries);
+ return jdbcClient.runBatchUpdate(INSERT_ENTRIES, newEntries);
}
@Override
public int updateEntries(Iterable<Object[]> updatedEntries) {
- return getJdbcClient().runBatchUpdate(UPDATE_ENTRIES, updatedEntries);
- }
-
- private void addLogType(ActivityType type) {
- Long typeId = type.getTypeId();
- Long logLevel = type.getLogLevel();
- String module = type.getModule();
- String messageFormat = type.getMessageFormat();
- getJdbcClient().runPreparedUpdate(INSERT_TYPE, typeId, logLevel, module, messageFormat);
+ return jdbcClient.runBatchUpdate(UPDATE_ENTRIES, updatedEntries);
}
@Override
- public void addActivityTypes(ActivityType... types) {
- addActivityTypes(Arrays.asList(types));
- }
-
- @Override
- public void addActivityTypes(Iterable<ActivityType> types) {
- for (ActivityType type : types) {
- addLogType(type);
+ public ActivityTypeToken getActivityType(ActivityTypeId typeId) {
+ ActivityTypeToken[] token = new ActivityTypeToken[1];
+ Consumer<JdbcStatement> consumer = stmt -> {
+ token[0] = ActivityTypeToken.valueOf(stmt.getLong("type_id"), Level.parse(stmt.getString("log_level")),
+ stmt.getString("module"), stmt.getString("msg_format"));
+ };
+
+ jdbcClient.runQuery(consumer, SELECT_TYPE, typeId);
+ if (token[0] == null) {
+ throw new OseeNotFoundException("Activity type [%s] not found", typeId.getIdString());
}
- }
-
- @Override
- public void selectTypes(final ActivityTypeDataHandler handler) {
- getJdbcClient().runQuery(new ActivityTypeProcessor(handler), SELECT_ALL_TYPES);
- }
-
- @Override
- public void selectType(Long typeId, final ActivityTypeDataHandler handler) {
- getJdbcClient().runQuery(new ActivityTypeProcessor(handler), SELECT_TYPE, typeId);
- }
-
- @Override
- public boolean typeExists(Long typeId) {
- return getJdbcClient().fetch(-1L, COUNT_TYPE, typeId) > 0;
+ return token[0];
}
@Override
@@ -156,7 +107,23 @@ public class DatabaseActivityStorage implements ActivityStorage {
daysToKeep = -daysToKeep;
}
cal.add(Calendar.DATE, daysToKeep);
- getJdbcClient().runPreparedUpdate(DELETE_ENTRIES, cal.getTimeInMillis());
+ jdbcClient.runPreparedUpdate(DELETE_ENTRIES, cal.getTimeInMillis());
+ }
+
+ @Override
+ public ActivityTypeToken createIfAbsent(ActivityTypeToken type) {
+ if (type.isInvalid()) {
+ type = ActivityTypeToken.valueOf(Lib.generateUuid(), type.getLogLevel(), type.getModule(),
+ type.getMessageFormat());
+ }
+ jdbcClient.runPreparedUpdate(INSERT_TYPE, type, type.getLogLevel(), type.getModule(), type.getMessageFormat());
+ return type;
}
+ @Override
+ public void createIfAbsent(Iterable<ActivityTypeToken> types) {
+ for (ActivityTypeToken type : types) {
+ createIfAbsent(type);
+ }
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.activity/src/org/eclipse/osee/activity/internal/jaxrs/ActivityLogRequestFilter.java b/plugins/org.eclipse.osee.activity/src/org/eclipse/osee/activity/internal/jaxrs/ActivityLogRequestFilter.java
index 54d41c0213..ebbd7e6959 100644
--- a/plugins/org.eclipse.osee.activity/src/org/eclipse/osee/activity/internal/jaxrs/ActivityLogRequestFilter.java
+++ b/plugins/org.eclipse.osee.activity/src/org/eclipse/osee/activity/internal/jaxrs/ActivityLogRequestFilter.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.osee.activity.internal.jaxrs;
+import static org.eclipse.osee.framework.core.data.CoreActivityTypes.JAXRS_METHOD_CALL;
import javax.annotation.Priority;
import javax.ws.rs.Priorities;
import javax.ws.rs.container.ContainerRequestContext;
@@ -17,7 +18,6 @@ import javax.ws.rs.container.ContainerRequestFilter;
import javax.ws.rs.container.PreMatching;
import javax.ws.rs.ext.Provider;
import org.eclipse.osee.activity.ActivityConstants;
-import org.eclipse.osee.activity.api.Activity;
import org.eclipse.osee.activity.api.ActivityLog;
import org.eclipse.osee.framework.jdk.core.util.Strings;
import org.eclipse.osee.logger.Log;
@@ -59,8 +59,7 @@ public class ActivityLogRequestFilter implements ContainerRequestFilter {
if (Strings.isNumeric(context.getHeaders().getFirst("osee.account.id"))) {
accountId = Long.valueOf(context.getHeaders().getFirst("osee.account.id"));
}
- Long entryId =
- activityLog.createActivityThread(Activity.JAXRS_METHOD_CALL, accountId, serverId, clientId, message);
+ Long entryId = activityLog.createActivityThread(JAXRS_METHOD_CALL, accountId, serverId, clientId, message);
context.setProperty(ActivityConstants.HTTP_HEADER__ACTIVITY_ENTRY_ID, entryId);
} catch (Throwable th) {
diff --git a/plugins/org.eclipse.osee.activity/src/org/eclipse/osee/activity/internal/jaxrs/ActivityLogResource.java b/plugins/org.eclipse.osee.activity/src/org/eclipse/osee/activity/internal/jaxrs/ActivityLogResource.java
index cd658fff91..0f6bde797a 100644
--- a/plugins/org.eclipse.osee.activity/src/org/eclipse/osee/activity/internal/jaxrs/ActivityLogResource.java
+++ b/plugins/org.eclipse.osee.activity/src/org/eclipse/osee/activity/internal/jaxrs/ActivityLogResource.java
@@ -1,4 +1,5 @@
/*******************************************************************************
+ *
* Copyright (c) 2014 Boeing.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -10,20 +11,14 @@
*******************************************************************************/
package org.eclipse.osee.activity.internal.jaxrs;
-import java.util.ArrayList;
-import java.util.List;
-import javax.ws.rs.NotFoundException;
import javax.ws.rs.core.Response;
import org.eclipse.osee.activity.api.ActivityEntry;
import org.eclipse.osee.activity.api.ActivityEntryId;
import org.eclipse.osee.activity.api.ActivityLog;
-import org.eclipse.osee.activity.api.ActivityLog.ActivityDataHandler;
-import org.eclipse.osee.activity.api.ActivityLog.ActivityTypeDataHandler;
import org.eclipse.osee.activity.api.ActivityLogEndpoint;
-import org.eclipse.osee.activity.api.DefaultActivityType;
-import org.eclipse.osee.framework.jdk.core.type.MutableBoolean;
+import org.eclipse.osee.framework.core.data.ActivityTypeId;
+import org.eclipse.osee.framework.core.data.ActivityTypeToken;
import org.eclipse.osee.framework.jdk.core.util.Conditions;
-import org.eclipse.osee.framework.jdk.core.util.Lib;
/**
* @author Ryan D. Brooks
@@ -37,37 +32,15 @@ public final class ActivityLogResource implements ActivityLogEndpoint {
}
@Override
- public ActivityEntry getEntry(Long entryId) {
+ public ActivityEntry getEntry(ActivityEntryId entryId) {
Conditions.checkNotNull(entryId, "activity entry id");
- final ActivityEntry entry = new ActivityEntry(entryId);
- final MutableBoolean found = new MutableBoolean(false);
- activityLog.queryEntry(entryId, new ActivityDataHandler() {
-
- @Override
- public void onData(Long entryId, Long parentId, Long typeId, Long accountId, Long serverId, Long clientId, Long startTime, Long duration, Integer status, String messageArgs) {
- found.setValue(true);
- entry.setAccountId(accountId);
- entry.setClientId(clientId);
- entry.setDuration(duration);
- entry.setMessageArgs(messageArgs);
- entry.setParentId(parentId);
- entry.setServerId(serverId);
- entry.setStartTime(startTime);
- entry.setStatus(status);
- entry.setTypeId(typeId);
- }
- });
- if (!found.getValue()) {
- throw new NotFoundException("Activity Entry for entry id [" + entryId + "] was not found");
- }
- return entry;
+ return activityLog.getEntry(entryId);
}
@Override
- public ActivityEntryId createEntry(Long typeId, Long parentId, Integer status, String message) {
- Long entryId = activityLog.createEntry(typeId, parentId, status, message);
- ActivityEntryId entity = new ActivityEntryId(entryId);
- return entity;
+ public ActivityEntryId createEntry(ActivityTypeId type, Long parentId, Integer status, String message) {
+ Long entryId = activityLog.createEntry(activityLog.getActivityType(type), parentId, status, message);
+ return new ActivityEntryId(entryId);
}
@Override
@@ -77,68 +50,7 @@ public final class ActivityLogResource implements ActivityLogEndpoint {
}
@Override
- public DefaultActivityType[] getActivityTypes() {
- final List<DefaultActivityType> types = new ArrayList<>();
- activityLog.queryActivityTypes(new ActivityTypeDataHandler() {
-
- @Override
- public void onData(Long typeId, Long logLevel, String module, String messageFormat) {
- DefaultActivityType type = new DefaultActivityType();
- type.setTypeId(typeId);
- type.setLogLevel(logLevel);
- type.setModule(module);
- type.setMessageFormat(messageFormat);
- types.add(type);
- }
- });
- return types.toArray(new DefaultActivityType[0]);
- }
-
- @Override
- public DefaultActivityType getActivityType(Long typeId) {
- Conditions.checkNotNull(typeId, "activity type id");
- final MutableBoolean found = new MutableBoolean(false);
- final DefaultActivityType type = new DefaultActivityType();
- activityLog.queryActivityType(typeId, new ActivityTypeDataHandler() {
-
- @Override
- public void onData(Long typeId, Long logLevel, String module, String messageFormat) {
- found.setValue(true);
- type.setTypeId(typeId);
- type.setLogLevel(logLevel);
- type.setModule(module);
- type.setMessageFormat(messageFormat);
- }
- });
- if (!found.getValue()) {
- throw new NotFoundException("Activity Type for type id [" + typeId + "] was not found");
- }
- return type;
- }
-
- @Override
- public DefaultActivityType createActivityType(Long typeId, Long logLevel, String module, String messageFormat) {
- if (!activityLog.activityTypeExists(typeId)) {
- return newActivityHelper(typeId, logLevel, module, messageFormat);
- } else {
- return getActivityType(typeId);
- }
- }
-
- @Override
- public DefaultActivityType createActivityType(Long logLevel, String module, String messageFormat) {
- Long typeId = Lib.generateUuid();
- return newActivityHelper(typeId, logLevel, module, messageFormat);
- }
-
- private DefaultActivityType newActivityHelper(Long typeId, Long logLevel, String module, String messageFormat) {
- DefaultActivityType type = new DefaultActivityType();
- type.setTypeId(typeId);
- type.setLogLevel(logLevel);
- type.setModule(module);
- type.setMessageFormat(messageFormat);
- activityLog.createActivityTypes(type);
- return type;
+ public ActivityTypeToken createIfAbsent(ActivityTypeToken activityType) {
+ return activityLog.createIfAbsent(activityType);
}
-
-}
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.activity/src/org/eclipse/osee/activity/internal/jaxrs/ActivityLogResponseFilter.java b/plugins/org.eclipse.osee.activity/src/org/eclipse/osee/activity/internal/jaxrs/ActivityLogResponseFilter.java
index 95e679b674..929f7b2ec3 100644
--- a/plugins/org.eclipse.osee.activity/src/org/eclipse/osee/activity/internal/jaxrs/ActivityLogResponseFilter.java
+++ b/plugins/org.eclipse.osee.activity/src/org/eclipse/osee/activity/internal/jaxrs/ActivityLogResponseFilter.java
@@ -10,6 +10,11 @@
*******************************************************************************/
package org.eclipse.osee.activity.internal.jaxrs;
+import static org.eclipse.osee.activity.ActivityConstants.DEFAULT_ACCOUNT_ID;
+import static org.eclipse.osee.activity.ActivityConstants.DEFAULT_CLIENT_ID;
+import static org.eclipse.osee.activity.ActivityConstants.DEFAULT_SERVER_ID;
+import static org.eclipse.osee.activity.ActivityConstants.ERROR_MSG__MISSING_ACTIVITY_HEADER;
+import static org.eclipse.osee.framework.core.data.CoreActivityTypes.JAXRS_METHOD_CALL_FILTER_ERROR;
import javax.ws.rs.container.ContainerRequestContext;
import javax.ws.rs.container.ContainerResponseContext;
import javax.ws.rs.container.ContainerResponseFilter;
@@ -17,7 +22,6 @@ import javax.ws.rs.core.Response.Status;
import javax.ws.rs.core.Response.StatusType;
import javax.ws.rs.ext.Provider;
import org.eclipse.osee.activity.ActivityConstants;
-import org.eclipse.osee.activity.api.Activity;
import org.eclipse.osee.activity.api.ActivityLog;
import org.eclipse.osee.logger.Log;
@@ -55,9 +59,8 @@ public class ActivityLogResponseFilter implements ContainerResponseFilter {
}
} else {
// Response was called without a matching request
- activityLog.createActivityThread(Activity.JAXRS_METHOD_CALL_FILTER_ERROR,
- ActivityConstants.DEFAULT_ACCOUNT_ID, ActivityConstants.DEFAULT_SERVER_ID,
- ActivityConstants.DEFAULT_CLIENT_ID, ActivityConstants.ERROR_MSG__MISSING_ACTIVITY_HEADER);
+ activityLog.createActivityThread(JAXRS_METHOD_CALL_FILTER_ERROR, DEFAULT_ACCOUNT_ID, DEFAULT_SERVER_ID,
+ DEFAULT_CLIENT_ID, ERROR_MSG__MISSING_ACTIVITY_HEADER);
}
} catch (Throwable th) {
logger.error(th, "Error during ActivityContainerResponseFilter");
diff --git a/plugins/org.eclipse.osee.activity/src/org/eclipse/osee/activity/internal/migration/V0.21.0_2015_02_26_0950__Activity.sql b/plugins/org.eclipse.osee.activity/src/org/eclipse/osee/activity/internal/migration/V0.21.0_2015_02_26_0950__Activity.sql
index f8f730963c..062adc6d53 100644
--- a/plugins/org.eclipse.osee.activity/src/org/eclipse/osee/activity/internal/migration/V0.21.0_2015_02_26_0950__Activity.sql
+++ b/plugins/org.eclipse.osee.activity/src/org/eclipse/osee/activity/internal/migration/V0.21.0_2015_02_26_0950__Activity.sql
@@ -21,7 +21,6 @@ CREATE TABLE OSEE_ACTIVITY (
PARENT_ID ${db.bigint} NOT NULL,
DURATION ${db.bigint} NOT NULL,
CONSTRAINT OSEE_ACTIVITY__ENTRY_ID_PK PRIMARY KEY(ENTRY_ID),
- CONSTRAINT OSEE_ACTIVITY__TYPE_ID_FK FOREIGN KEY(TYPE_ID) REFERENCES OSEE_ACTIVITY_TYPE(TYPE_ID)
);
CREATE INDEX OSEE_ACTIVITY__P_E_IDX ON OSEE_ACTIVITY(PARENT_ID,ENTRY_ID);
diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/util/AtsActivity.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/util/AtsActivity.java
deleted file mode 100644
index d7cb5a2ece..0000000000
--- a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/util/AtsActivity.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2014 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.ats.api.util;
-
-import static java.util.logging.Level.INFO;
-import java.util.logging.Level;
-import org.eclipse.osee.activity.api.ActivityType;
-
-/**
- * @author Donald G. Dunne
- */
-public enum AtsActivity implements ActivityType {
- ATSNAVIGATEITEM(45L, INFO, "osee.ats.XNavigateItem", "ATS XNavigateItem [%s]");
-
- private final Long typeId;
- private final Long logLevel;
- private final String module;
- private final String messageFormat;
-
- AtsActivity(Long typeId, Level logLevel, String module, String messageFormat) {
- this.typeId = typeId;
- this.messageFormat = messageFormat;
- this.logLevel = new Long(logLevel.intValue());
- this.module = module;
- }
-
- AtsActivity(Long typeId, Level logLevel, String module) {
- this(typeId, logLevel, module, "");
- }
-
- @Override
- public Long getTypeId() {
- return typeId;
- }
-
- @Override
- public Long getLogLevel() {
- return logLevel;
- }
-
- @Override
- public String getModule() {
- return module;
- }
-
- @Override
- public String getMessageFormat() {
- return messageFormat;
- }
-}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/config/AtsDatabaseConfig.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/config/AtsDatabaseConfig.java
index d311832a98..737281627a 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/config/AtsDatabaseConfig.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/config/AtsDatabaseConfig.java
@@ -16,13 +16,11 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import javax.ws.rs.core.Response;
-import org.eclipse.osee.activity.api.ActivityType;
import org.eclipse.osee.ats.api.ai.IAtsActionableItem;
import org.eclipse.osee.ats.api.data.AtsArtifactToken;
import org.eclipse.osee.ats.api.data.AtsArtifactTypes;
import org.eclipse.osee.ats.api.data.AtsAttributeTypes;
import org.eclipse.osee.ats.api.team.IAtsTeamDefinition;
-import org.eclipse.osee.ats.api.util.AtsActivity;
import org.eclipse.osee.ats.api.util.IAtsChangeSet;
import org.eclipse.osee.ats.api.workdef.IAtsWorkDefinitionService;
import org.eclipse.osee.ats.core.client.util.AtsGroup;
@@ -79,10 +77,6 @@ public class AtsDatabaseConfig implements IDbInitializationTask {
AtsGroup.AtsAdmin.getArtifact().persist(getClass().getSimpleName());
AtsGroup.AtsTempAdmin.getArtifact().persist(getClass().getSimpleName());
- ActivityType type = AtsActivity.ATSNAVIGATEITEM;
- AtsClientService.get().getOseeClient().getActivityLogEndpoint().createActivityType(type.getTypeId(),
- type.getLogLevel(), type.getModule(), type.getMessageFormat());
-
createUserCreationDisabledConfig();
createSafetyConfig();
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/navigate/AtsNavigateComposite.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/navigate/AtsNavigateComposite.java
index 85be0c79ef..b2d0da1b84 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/navigate/AtsNavigateComposite.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/navigate/AtsNavigateComposite.java
@@ -15,9 +15,9 @@ import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.osee.activity.api.ActivityEntryId;
import org.eclipse.osee.activity.api.ActivityLog;
import org.eclipse.osee.activity.api.ActivityLogEndpoint;
-import org.eclipse.osee.ats.api.util.AtsActivity;
import org.eclipse.osee.ats.internal.Activator;
import org.eclipse.osee.ats.internal.AtsClientService;
+import org.eclipse.osee.framework.core.data.CoreActivityTypes;
import org.eclipse.osee.framework.core.exception.OseeWrappedException;
import org.eclipse.osee.framework.core.util.Result;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
@@ -63,8 +63,8 @@ public class AtsNavigateComposite extends XNavigateComposite {
ActivityLogEndpoint activityEp = AtsClientService.get().getOseeClient().getActivityLogEndpoint();
ActivityEntryId activityId = null;
try {
- activityId = activityEp.createEntry(AtsActivity.ATSNAVIGATEITEM.getTypeId(), 0L, ActivityLog.INITIAL_STATUS,
- item.getName());
+ activityId =
+ activityEp.createEntry(CoreActivityTypes.XNAVIGATEITEM, 0L, ActivityLog.INITIAL_STATUS, item.getName());
} catch (Exception ex) {
OseeLog.log(Activator.class, Level.SEVERE, "Eror creating activity log entry", ex);
}
diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/ActivityTypeId.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/ActivityTypeId.java
new file mode 100644
index 0000000000..bf597a8707
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/ActivityTypeId.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.core.data;
+
+import org.eclipse.osee.framework.jdk.core.type.BaseId;
+import org.eclipse.osee.framework.jdk.core.type.Id;
+
+/**
+ * @author Ryan D. Brooks
+ */
+public interface ActivityTypeId extends Id {
+ ActivityTypeId SENTINEL = valueOf(Id.SENTINEL);
+
+ public static ActivityTypeId valueOf(Long id) {
+ final class ActivityTypeIdImpl extends BaseId implements ActivityTypeId {
+ public ActivityTypeIdImpl(Long id) {
+ super(id);
+ }
+ }
+ return new ActivityTypeIdImpl(id);
+ }
+
+ public static ActivityTypeId valueOf(String id) {
+ return valueOf(Long.valueOf(id));
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/ActivityTypeToken.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/ActivityTypeToken.java
new file mode 100644
index 0000000000..9a62acead1
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/ActivityTypeToken.java
@@ -0,0 +1,63 @@
+package org.eclipse.osee.framework.core.data;
+/*******************************************************************************
+ * Copyright (c) 2017 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+
+import java.util.logging.Level;
+import org.eclipse.osee.framework.jdk.core.type.BaseId;
+import org.eclipse.osee.framework.jdk.core.type.Id;
+
+/**
+ * @author Ryan D. Brooks
+ */
+public interface ActivityTypeToken extends ActivityTypeId {
+ ActivityTypeToken SENTINEL = valueOf(Id.SENTINEL, Level.ALL, "org.eclipse.osee.activity.api", "");
+
+ public Level getLogLevel();
+
+ public String getModule();
+
+ public String getMessageFormat();
+
+ public static ActivityTypeToken valueOf(Long id, Level logLevel, String module) {
+ return valueOf(id, logLevel, module, "");
+ }
+
+ public static ActivityTypeToken valueOf(Long id, Level logLevel, String module, String messageFormat) {
+ final class ArtifactTypeIdImpl extends BaseId implements ActivityTypeToken {
+ private final Level logLevel;
+ private final String module;
+ private final String messageFormat;
+
+ public ArtifactTypeIdImpl(Long id, Level logLevel, String module, String messageFormat) {
+ super(id);
+ this.logLevel = logLevel;
+ this.module = module;
+ this.messageFormat = messageFormat;
+ }
+
+ @Override
+ public Level getLogLevel() {
+ return logLevel;
+ }
+
+ @Override
+ public String getModule() {
+ return module;
+ }
+
+ @Override
+ public String getMessageFormat() {
+ return messageFormat;
+ }
+ }
+ return new ArtifactTypeIdImpl(id, logLevel, module, messageFormat);
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/CoreActivityTypes.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/CoreActivityTypes.java
new file mode 100644
index 0000000000..b8bd037fd3
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/CoreActivityTypes.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2016 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.core.data;
+
+import static java.util.logging.Level.INFO;
+import static java.util.logging.Level.SEVERE;
+import java.util.ArrayList;
+import java.util.logging.Level;
+
+/**
+ * @author Ryan D. Brooks
+ */
+public final class CoreActivityTypes {
+ private static final ArrayList<ActivityTypeToken> types = new ArrayList<>();
+
+ // @formatter:off
+ public static final ActivityTypeToken JAXRS_METHOD_CALL = create(880479734L, INFO, "org.eclipse.osee.activity.jaxrs");
+ public static final ActivityTypeToken JAXRS_METHOD_CALL_FILTER_ERROR = create(23133964208285L, SEVERE, "org.eclipse.osee.activity.jaxrs");
+ public static final ActivityTypeToken SRS_TRACE = create(80349535402L, INFO, "org.eclipse.osee.define.report.SrsTraceReport");
+ public static final ActivityTypeToken MSG_CONTINUATION = create(29566294587L, INFO, "org.eclipse.osee.activity");
+ public static final ActivityTypeToken IDE = create(88L, INFO, "osee.ide.client");
+ public static final ActivityTypeToken XNAVIGATEITEM = create(45L, INFO, "osee.framework.XNavigateItem", "XNavigateItem [%s]");
+ public static final ActivityTypeToken ACCESS_CONTROL_MODIFIED = create(99L, INFO, "osee.framework.access", "Access Control Modified [%s]");
+ public static final ActivityTypeToken BRANCH_OPERATION = create(61L, INFO, "org.eclipse.osee.orcs.rest.internal.branch");
+ public static final ActivityTypeToken PURGE_TRANSACTION = create(4455L, INFO, "org.eclipse.osee.orcs.rest.purge.transaction");
+ // @formatter:on
+
+ private CoreActivityTypes() {
+ // Constants
+ }
+
+ private static ActivityTypeToken create(Long id, Level logLevel, String module) {
+ return create(id, logLevel, module, "");
+ }
+
+ private static ActivityTypeToken create(Long id, Level logLevel, String module, String messageFormat) {
+ ActivityTypeToken type = ActivityTypeToken.valueOf(id, logLevel, module, messageFormat);
+ types.add(type);
+ return type;
+ }
+
+ public static ArrayList<ActivityTypeToken> getTypes() {
+ return types;
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.server.ide/src/org/eclipse/osee/framework/server/ide/internal/SessionEndpointImpl.java b/plugins/org.eclipse.osee.framework.server.ide/src/org/eclipse/osee/framework/server/ide/internal/SessionEndpointImpl.java
index 408b0ea249..935c6d6254 100644
--- a/plugins/org.eclipse.osee.framework.server.ide/src/org/eclipse/osee/framework/server/ide/internal/SessionEndpointImpl.java
+++ b/plugins/org.eclipse.osee.framework.server.ide/src/org/eclipse/osee/framework/server/ide/internal/SessionEndpointImpl.java
@@ -25,8 +25,8 @@ import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import javax.ws.rs.core.UriInfo;
-import org.eclipse.osee.activity.api.Activity;
import org.eclipse.osee.activity.api.ActivityLog;
+import org.eclipse.osee.framework.core.data.CoreActivityTypes;
import org.eclipse.osee.framework.core.data.OseeCredential;
import org.eclipse.osee.framework.core.data.OseeSessionGrant;
import org.eclipse.osee.framework.core.server.IAuthenticationManager;
@@ -99,7 +99,7 @@ public class SessionEndpointImpl implements SessionEndpoint {
private void logSessionCreation(OseeCredential credential, OseeSessionGrant oseeSessionGrant) {
try {
- activityLog.createEntry(Activity.IDE.getTypeId(), ActivityLog.COMPLETE_STATUS,
+ activityLog.createEntry(CoreActivityTypes.IDE, ActivityLog.COMPLETE_STATUS,
String.format(
"IDE Client Session Created " //
+ "{" //
@@ -124,7 +124,7 @@ public class SessionEndpointImpl implements SessionEndpoint {
ISession session = sessionManager.getSessionById(sessionId);
String duration = getDuration(session);
String userId = session != null ? session.getUserId() : "unknown";
- activityLog.createEntry(Activity.IDE.getTypeId(), ActivityLog.COMPLETE_STATUS,
+ activityLog.createEntry(CoreActivityTypes.IDE, ActivityLog.COMPLETE_STATUS,
String.format(
"IDE Client Session Released " //
+ "{" //
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/OseeEventManager.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/OseeEventManager.java
index 92bec771de..3f4c5b8fa3 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/OseeEventManager.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/OseeEventManager.java
@@ -15,10 +15,10 @@ import java.util.Collection;
import java.util.List;
import java.util.logging.Level;
import org.eclipse.core.runtime.Assert;
-import org.eclipse.osee.activity.api.Activity;
import org.eclipse.osee.activity.api.ActivityLog;
import org.eclipse.osee.framework.core.data.ArtifactToken;
import org.eclipse.osee.framework.core.data.BranchId;
+import org.eclipse.osee.framework.core.data.CoreActivityTypes;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.util.Strings;
import org.eclipse.osee.framework.logging.OseeLog;
@@ -136,8 +136,8 @@ public final class OseeEventManager {
if (accesstopicEvent != AccessTopicEvent.USER_AUTHENTICATED) {
String message = String.format("USER_AUTHENTICATED [%s] Payload [%s]", UserManager.getUser().getUserId(),
EventUtil.getEventJacksonMapper().writeValueAsString(payload));
- ServiceUtil.getOseeClient().getActivityLogEndpoint().createEntry(
- Activity.ACCESS_CONTROL_MODIFIED.getTypeId(), 0L, ActivityLog.COMPLETE_STATUS, message);
+ ServiceUtil.getOseeClient().getActivityLogEndpoint().createEntry(CoreActivityTypes.ACCESS_CONTROL_MODIFIED,
+ 0L, ActivityLog.COMPLETE_STATUS, message);
}
} catch (Exception ex) {
OseeLog.logf(OseeEventManager.class, Level.SEVERE, ex, "Error logging activity event [%s][%s]",
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/PurgeTransactionOperationWithListener.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/PurgeTransactionOperationWithListener.java
index 393c7766c3..b55a429bb2 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/PurgeTransactionOperationWithListener.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/PurgeTransactionOperationWithListener.java
@@ -16,8 +16,8 @@ import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
-import org.eclipse.osee.activity.api.Activity;
import org.eclipse.osee.activity.api.ActivityLog;
+import org.eclipse.osee.framework.core.data.CoreActivityTypes;
import org.eclipse.osee.framework.core.data.TransactionId;
import org.eclipse.osee.framework.core.model.TransactionRecord;
import org.eclipse.osee.framework.core.operation.IOperation;
@@ -69,8 +69,8 @@ public class PurgeTransactionOperationWithListener {
try {
String message = String.format("Purge Transaction [%s] - Guid to Id Map [%s]",
transEventAndIds.getFirst().toString(), transEventAndIds.getSecond().toString());
- ServiceUtil.getOseeClient().getActivityLogEndpoint().createEntry(Activity.PURGE_TRANSACTION.getTypeId(),
- 0L, ActivityLog.COMPLETE_STATUS, message);
+ ServiceUtil.getOseeClient().getActivityLogEndpoint().createEntry(CoreActivityTypes.PURGE_TRANSACTION, 0L,
+ ActivityLog.COMPLETE_STATUS, message);
} catch (OseeCoreException ex) {
OseeLog.log(Activator.class, Level.SEVERE, "Error activity logging purge transaction", ex);
}
diff --git a/plugins/org.eclipse.osee.framework.ui.plugin/src/org/eclipse/osee/framework/ui/plugin/xnavigate/XNavigateComposite.java b/plugins/org.eclipse.osee.framework.ui.plugin/src/org/eclipse/osee/framework/ui/plugin/xnavigate/XNavigateComposite.java
index a4280cd936..8ec8eb5657 100644
--- a/plugins/org.eclipse.osee.framework.ui.plugin/src/org/eclipse/osee/framework/ui/plugin/xnavigate/XNavigateComposite.java
+++ b/plugins/org.eclipse.osee.framework.ui.plugin/src/org/eclipse/osee/framework/ui/plugin/xnavigate/XNavigateComposite.java
@@ -11,6 +11,7 @@
package org.eclipse.osee.framework.ui.plugin.xnavigate;
+import static org.eclipse.osee.framework.core.data.CoreActivityTypes.XNAVIGATEITEM;
import java.util.List;
import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
@@ -20,7 +21,6 @@ import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.osee.activity.api.Activity;
import org.eclipse.osee.activity.api.ActivityLog;
import org.eclipse.osee.activity.api.ActivityLogEndpoint;
import org.eclipse.osee.framework.core.util.OsgiUtil;
@@ -188,11 +188,9 @@ public class XNavigateComposite extends Composite {
try {
long uuid = Lib.generateUuid();
ActivityLogEndpoint activityEp = OsgiUtil.getService(getClass(), OseeClient.class).getActivityLogEndpoint();
- activityEp.createEntry(Activity.XNAVIGATEITEM.getTypeId(), uuid, ActivityLog.INITIAL_STATUS,
- item.getName());
+ activityEp.createEntry(XNAVIGATEITEM, uuid, ActivityLog.INITIAL_STATUS, item.getName());
item.run(tableLoadOptions);
- activityEp.createEntry(Activity.XNAVIGATEITEM.getTypeId(), uuid, ActivityLog.COMPLETE_STATUS,
- item.getName());
+ activityEp.createEntry(XNAVIGATEITEM, uuid, ActivityLog.COMPLETE_STATUS, item.getName());
} catch (Exception ex) {
OseeLog.log(UiPluginConstants.class, OseeLevel.SEVERE_POPUP, ex);
}
diff --git a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/BranchEndpointImpl.java b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/BranchEndpointImpl.java
index 541f696d77..fb6c6d6ac0 100644
--- a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/BranchEndpointImpl.java
+++ b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/BranchEndpointImpl.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.osee.orcs.rest.internal;
+import static org.eclipse.osee.framework.core.data.CoreActivityTypes.BRANCH_OPERATION;
import static org.eclipse.osee.framework.jdk.core.util.Compare.isDifferent;
import static org.eclipse.osee.orcs.rest.internal.OrcsRestUtil.asBranch;
import static org.eclipse.osee.orcs.rest.internal.OrcsRestUtil.asBranches;
@@ -29,7 +30,6 @@ import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import javax.ws.rs.core.UriBuilder;
import javax.ws.rs.core.UriInfo;
-import org.eclipse.osee.activity.api.Activity;
import org.eclipse.osee.activity.api.ActivityLog;
import org.eclipse.osee.framework.core.data.ArtifactId;
import org.eclipse.osee.framework.core.data.BranchId;
@@ -251,7 +251,7 @@ public class BranchEndpointImpl implements BranchEndpoint {
CompareResults data = new CompareResults();
data.setChanges(changes);
try {
- activityLog.createEntry(Activity.BRANCH_OPERATION, ActivityLog.INITIAL_STATUS,
+ activityLog.createEntry(BRANCH_OPERATION, ActivityLog.INITIAL_STATUS,
String.format("Branch Operation Compare Branches {sourceTx: %s, destTx: %s}", sourceTx.toString(),
destinationTx.toString()));
} catch (OseeCoreException ex) {
@@ -298,7 +298,7 @@ public class BranchEndpointImpl implements BranchEndpoint {
URI uri = getBranchLocation(uriInfo, result);
try {
- activityLog.createEntry(Activity.BRANCH_OPERATION, ActivityLog.INITIAL_STATUS,
+ activityLog.createEntry(BRANCH_OPERATION, ActivityLog.INITIAL_STATUS,
String.format(
"Branch Operation Create Branch {branchUUID: %s, branchName: %s accountId: %s serverId: %s clientId: %s}",
createData.getBranch(), data.getBranchName(), RestUtil.getAccountId(httpHeaders),
@@ -350,7 +350,7 @@ public class BranchEndpointImpl implements BranchEndpoint {
UriInfo uriInfo = getUriInfo();
URI location = getTxLocation(uriInfo, tx);
try {
- activityLog.createEntry(Activity.BRANCH_OPERATION, ActivityLog.INITIAL_STATUS,
+ activityLog.createEntry(BRANCH_OPERATION, ActivityLog.INITIAL_STATUS,
String.format(
"Branch Operation Commit Branch {branchId: %s srcBranch: %s destBranch: %s accountId: %s serverId: %s clientId: %s}",
branch, srcBranch, destBranch, RestUtil.getAccountId(httpHeaders), RestUtil.getServerId(httpHeaders),
@@ -378,7 +378,7 @@ public class BranchEndpointImpl implements BranchEndpoint {
executeCallable(op);
modified = true;
try {
- activityLog.createEntry(Activity.BRANCH_OPERATION, ActivityLog.INITIAL_STATUS,
+ activityLog.createEntry(BRANCH_OPERATION, ActivityLog.INITIAL_STATUS,
String.format("Branch Operation Archive Branch {branchId: %s accountId: %s serverId: %s clientId: %s}",
branchId, RestUtil.getAccountId(httpHeaders), RestUtil.getServerId(httpHeaders),
RestUtil.getClientId(httpHeaders)));
@@ -430,7 +430,7 @@ public class BranchEndpointImpl implements BranchEndpoint {
switch (deleteResult) {
case IResourceManager.OK:
try {
- activityLog.createEntry(Activity.BRANCH_OPERATION, ActivityLog.INITIAL_STATUS,
+ activityLog.createEntry(BRANCH_OPERATION, ActivityLog.INITIAL_STATUS,
String.format("Branch Operation Delete Branch Exachange Resource {resource: %s, locator %s}", path,
locator.getLocation()));
} catch (OseeCoreException ex) {
@@ -465,7 +465,7 @@ public class BranchEndpointImpl implements BranchEndpoint {
UriInfo uriInfo = getUriInfo();
URI location = getExchangeExportUri(uriInfo, exportURI, options.isCompress());
try {
- activityLog.createEntry(Activity.BRANCH_OPERATION, ActivityLog.INITIAL_STATUS, String.format(
+ activityLog.createEntry(BRANCH_OPERATION, ActivityLog.INITIAL_STATUS, String.format(
"Branch Operation Export Branches {branchUUID(s): %s accountId: %s serverId: %s, clientId: %s}", branches,
RestUtil.getAccountId(httpHeaders), RestUtil.getServerId(httpHeaders), RestUtil.getClientId(httpHeaders)));
} catch (OseeCoreException ex) {
@@ -508,7 +508,7 @@ public class BranchEndpointImpl implements BranchEndpoint {
}
try {
- activityLog.createEntry(Activity.BRANCH_OPERATION, ActivityLog.INITIAL_STATUS, String.format(
+ activityLog.createEntry(BRANCH_OPERATION, ActivityLog.INITIAL_STATUS, String.format(
"Branch Operation Import Branches {branchUUID(s): %s accountId: %s serverId: %s clientId: %s}", branches,
RestUtil.getAccountId(httpHeaders), RestUtil.getServerId(httpHeaders), RestUtil.getClientId(httpHeaders)));
} catch (OseeCoreException ex) {
@@ -574,7 +574,7 @@ public class BranchEndpointImpl implements BranchEndpoint {
executeCallable(op);
modified = true;
try {
- activityLog.createEntry(Activity.BRANCH_OPERATION, ActivityLog.INITIAL_STATUS,
+ activityLog.createEntry(BRANCH_OPERATION, ActivityLog.INITIAL_STATUS,
String.format(
"Branch Operation Set Branch Name {branchId: %s prevName: %s newName: %s accountId: %s serverId: %s clientId: %s}",
branchId, branch.getName(), newName, RestUtil.getAccountId(httpHeaders),
@@ -592,7 +592,7 @@ public class BranchEndpointImpl implements BranchEndpoint {
boolean modified = false;
if (isDifferent(branch.getBranchType(), newType)) {
try {
- activityLog.createEntry(Activity.BRANCH_OPERATION, ActivityLog.INITIAL_STATUS,
+ activityLog.createEntry(BRANCH_OPERATION, ActivityLog.INITIAL_STATUS,
String.format(
"Branch Operation Set Branch Type {branchUUID: %s prevType: %s newType: %s accountId: %s serverId: %s clientId: %s}",
branchId, branch.getBranchType(), newType, RestUtil.getAccountId(httpHeaders),
@@ -617,7 +617,7 @@ public class BranchEndpointImpl implements BranchEndpoint {
modified = true;
try {
- activityLog.createEntry(Activity.BRANCH_OPERATION, ActivityLog.INITIAL_STATUS,
+ activityLog.createEntry(BRANCH_OPERATION, ActivityLog.INITIAL_STATUS,
String.format(
"Branch Operation Branch State Changed {branchId: %s prevState: %s newState: %s accountId: %s serverId: %s clientId: %s}",
branchId, branch.getBranchType(), newState, RestUtil.getAccountId(httpHeaders),
@@ -635,7 +635,7 @@ public class BranchEndpointImpl implements BranchEndpoint {
boolean modified = false;
if (isDifferent(branch.getAssociatedArtifact(), artifact)) {
try {
- activityLog.createEntry(Activity.BRANCH_OPERATION, ActivityLog.INITIAL_STATUS,
+ activityLog.createEntry(BRANCH_OPERATION, ActivityLog.INITIAL_STATUS,
String.format(
"Branch Operation Associate Branch to Artifact {branchId: %s prevArt: %s newArt: %s accountId: %s serverId: %s clientId: %s}",
branchId, branch.getAssociatedArtifact(), artifact, RestUtil.getAccountId(httpHeaders),
@@ -656,7 +656,7 @@ public class BranchEndpointImpl implements BranchEndpoint {
boolean modified = false;
if (Compare.isDifferent(tx.getComment(), comment)) {
try {
- activityLog.createEntry(Activity.BRANCH_OPERATION, ActivityLog.INITIAL_STATUS,
+ activityLog.createEntry(BRANCH_OPERATION, ActivityLog.INITIAL_STATUS,
String.format(
"Branch Operation Set Tx Comment {branchId: %s prevComment: %s newComment: %s accountId: %s serverId: %s clientId: %s}",
branch, tx.getComment(), comment, RestUtil.getAccountId(httpHeaders),
@@ -682,7 +682,7 @@ public class BranchEndpointImpl implements BranchEndpoint {
}
try {
- activityLog.createEntry(Activity.BRANCH_OPERATION, ActivityLog.INITIAL_STATUS,
+ activityLog.createEntry(BRANCH_OPERATION, ActivityLog.INITIAL_STATUS,
String.format("Branch Operation Purge Branch {branchId: %s, accountId: %s serverId: %s clientId: %s}",
branchId, RestUtil.getAccountId(httpHeaders), RestUtil.getServerId(httpHeaders),
RestUtil.getClientId(httpHeaders)));
@@ -703,7 +703,7 @@ public class BranchEndpointImpl implements BranchEndpoint {
executeCallable(op);
modified = true;
try {
- activityLog.createEntry(Activity.BRANCH_OPERATION, ActivityLog.INITIAL_STATUS,
+ activityLog.createEntry(BRANCH_OPERATION, ActivityLog.INITIAL_STATUS,
String.format("Branch Operation Unarchive Branch {branchId: %s accountId: %s serverId: %s clientId: %s}",
branchId, RestUtil.getAccountId(httpHeaders), RestUtil.getServerId(httpHeaders),
RestUtil.getClientId(httpHeaders)));
@@ -728,7 +728,7 @@ public class BranchEndpointImpl implements BranchEndpoint {
executeCallable(op);
modified = true;
try {
- activityLog.createEntry(Activity.BRANCH_OPERATION, ActivityLog.INITIAL_STATUS,
+ activityLog.createEntry(BRANCH_OPERATION, ActivityLog.INITIAL_STATUS,
String.format(
"Branch Operation Unassociate Branch {branchId: %s, accountId: %s serverId: %s clientId: %s}",
branchId, RestUtil.getAccountId(httpHeaders), RestUtil.getServerId(httpHeaders),
@@ -754,7 +754,7 @@ public class BranchEndpointImpl implements BranchEndpoint {
modified = true;
try {
- activityLog.createEntry(Activity.BRANCH_OPERATION, ActivityLog.INITIAL_STATUS,
+ activityLog.createEntry(BRANCH_OPERATION, ActivityLog.INITIAL_STATUS,
String.format(
"Branch Operation Purge Txs {branchId: %s, txsToDelete: %s accountId: %s serverId: %s clientId: %s}",
branch, txIds, RestUtil.getAccountId(httpHeaders), RestUtil.getServerId(httpHeaders),
@@ -834,7 +834,7 @@ public class BranchEndpointImpl implements BranchEndpoint {
comment += String.format(" accountId: %s serverId: %s clientId: %s", RestUtil.getAccountId(httpHeaders),
RestUtil.getServerId(httpHeaders), RestUtil.getClientId(httpHeaders));
- activityLog.createEntry(Activity.BRANCH_OPERATION, ActivityLog.INITIAL_STATUS, comment);
+ activityLog.createEntry(BRANCH_OPERATION, ActivityLog.INITIAL_STATUS, comment);
} catch (OseeCoreException ex) {
OseeLog.log(ActivityLog.class, OseeLevel.SEVERE_POPUP, ex);
}
diff --git a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/DatastoreEndpointImpl.java b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/DatastoreEndpointImpl.java
index 873ba3fa4f..4e633d63dd 100644
--- a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/DatastoreEndpointImpl.java
+++ b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/DatastoreEndpointImpl.java
@@ -78,7 +78,6 @@ public class DatastoreEndpointImpl implements DatastoreEndpoint {
OrcsMetaData metaData = adminOps.createDatastore(parameters);
activityLog.setEnabled(true);
- activityLog.unInitialize();
UriInfo uriInfo = getUriInfo();
URI location = getDatastoreLocation(uriInfo);
return Response.created(location).entity(asDatastoreInfo(metaData)).build();
diff --git a/plugins/org.eclipse.osee.orcs/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.orcs/META-INF/MANIFEST.MF
index 8f1c61e5ef..8d630fb4e3 100644
--- a/plugins/org.eclipse.osee.orcs/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.orcs/META-INF/MANIFEST.MF
@@ -12,6 +12,7 @@ Import-Package: com.google.gson;version="2.1.0",
org.codehaus.jackson.map.ser;version="1.9.13",
org.codehaus.jackson.map.ser.std;version="1.9.13",
org.eclipse.core.runtime,
+ org.eclipse.osee.activity.api,
org.eclipse.osee.executor.admin,
org.eclipse.osee.framework.core.data,
org.eclipse.osee.framework.core.enums,

Back to the top