file_name
stringlengths 6
86
| file_path
stringlengths 45
249
| content
stringlengths 47
6.26M
| file_size
int64 47
6.26M
| language
stringclasses 1
value | extension
stringclasses 1
value | repo_name
stringclasses 767
values | repo_stars
int64 8
14.4k
| repo_forks
int64 0
1.17k
| repo_open_issues
int64 0
788
| repo_created_at
stringclasses 767
values | repo_pushed_at
stringclasses 767
values |
---|---|---|---|---|---|---|---|---|---|---|---|
WebConfig.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/infrastructure/infrastructure-security/src/main/java/io/qifan/chatgpt/infrastructure/security/WebConfig.java | package io.qifan.chatgpt.infrastructure.security;
import cn.dev33.satoken.interceptor.SaInterceptor;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
@EnableConfigurationProperties(SecurityProperties.class)
public class WebConfig implements WebMvcConfigurer {
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(new SaInterceptor()).addPathPatterns("/**");
}
}
| 761 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
AuthErrorCode.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/infrastructure/infrastructure-security/src/main/java/io/qifan/chatgpt/infrastructure/security/AuthErrorCode.java | package io.qifan.chatgpt.infrastructure.security;
import io.qifan.infrastructure.common.constants.BaseEnum;
import java.util.Arrays;
public enum AuthErrorCode implements BaseEnum {
USER_LOGIN(1001001, "登录错误"),
USER_LOGIN_NOT_EXIST(1001002, "用户不存在"),
USER_LOGIN_EXIST(1001003, "用户已存在"),
USER_LOGIN_PASSWORD_ERROR(1001004, "密码错误"),
USER_LOGIN_WECHAT_EXIST(1001005, "微信用户已存在"),
USER_PERMISSION(1001006, "访问权限异常"),
USER_PERMISSION_UNAUTHENTICATED(1001007, "请登录"),
USER_PERMISSION_EXPIRED(1001008, "请重新登录"),
USER_PERMISSION_UNAUTHORIZED(1001009, "权限不足"),
;
private final Integer code;
private final String name;
AuthErrorCode(Integer code, String name) {
this.code = code;
this.name = name;
}
public static AuthErrorCode nameOf(String name) {
return Arrays.stream(AuthErrorCode.values()).filter(type -> type.getName().equals(name))
.findFirst()
.orElseThrow(() -> new RuntimeException("枚举不存在"));
}
public static AuthErrorCode codeOf(Integer code) {
return Arrays.stream(AuthErrorCode.values()).filter(type -> type.getCode().equals(code))
.findFirst()
.orElseThrow(() -> new RuntimeException("枚举不存在"));
}
@Override
public Integer getCode() {
return this.code;
}
@Override
public String getName() {
return this.name;
}
} | 1,559 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
BaseEntity.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/infrastructure/infrastructure-common/src/main/java/io/qifan/infrastructure/common/entity/BaseEntity.java | package io.qifan.infrastructure.common.entity;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.util.ProxyUtils;
import java.time.LocalDateTime;
import java.util.Objects;
@Getter
@Setter
@ToString
@RequiredArgsConstructor
@Document
public class BaseEntity {
private String id;
@CreatedDate
private LocalDateTime createdAt;
@LastModifiedDate
private LocalDateTime updatedAt;
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || ProxyUtils.getUserClass(
this) != ProxyUtils.getUserClass(o)) return false;
BaseEntity that = (BaseEntity) o;
return getId() != null && Objects.equals(getId(), that.getId());
}
@Override
public int hashCode() {
return getClass().hashCode();
}
}
| 1,083 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
ResultCode.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/infrastructure/infrastructure-common/src/main/java/io/qifan/infrastructure/common/constants/ResultCode.java | package io.qifan.infrastructure.common.constants;
import java.util.Arrays;
import java.util.Optional;
public enum ResultCode implements BaseEnum {
Success(1, "操作成功"),
Fail(0, "操作失败"),
NotFindError(10001, "未查询到信息"),
SaveError(10002, "保存信息失败"),
UpdateError(10003, "更新信息失败"),
ValidateError(10004, "数据检验失败"),
StatusHasValid(10005, "状态已经被启用"),
StatusHasInvalid(10006, "状态已经被禁用"),
SystemError(10007, "系统异常"),
BusinessError(10008, "业务异常"),
ParamSetIllegal(10009, "参数设置非法"),
TransferStatusError(10010, "当前状态不正确,请勿重复提交"),
NotGrant(10011, "没有操作该功能的权限,请联系管理员");
/**
* code的取值规则,xx代表模块,xxx代表功能异常 例如:基础模块(10)的查询异常(001)
*/
private final Integer code;
/**
* 异常信息
*/
private final String name;
ResultCode(Integer code, String name) {
this.code = code;
this.name = name;
}
public static Optional<ResultCode> of(Integer code) {
return Arrays.stream(ResultCode.values()).filter(resultCode -> resultCode.getCode().equals(code)).findFirst();
}
@Override
public Integer getCode() {
return this.code;
}
@Override
public String getName() {
return this.name;
}
}
| 1,470 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
BaseEnum.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/infrastructure/infrastructure-common/src/main/java/io/qifan/infrastructure/common/constants/BaseEnum.java | package io.qifan.infrastructure.common.constants;
public interface BaseEnum {
Integer getCode();
String getName();
} | 129 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
SystemException.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/infrastructure/infrastructure-common/src/main/java/io/qifan/infrastructure/common/exception/SystemException.java | package io.qifan.infrastructure.common.exception;
public class SystemException extends RuntimeException {
public SystemException(String msg) {
super(msg);
}
}
| 177 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
BusinessException.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/infrastructure/infrastructure-common/src/main/java/io/qifan/infrastructure/common/exception/BusinessException.java | package io.qifan.infrastructure.common.exception;
import io.qifan.infrastructure.common.constants.BaseEnum;
import lombok.Data;
@Data
public class BusinessException extends RuntimeException {
BaseEnum resultCode;
public BusinessException(BaseEnum resultCode) {
super(resultCode.getName());
this.resultCode = resultCode;
}
public BusinessException(BaseEnum resultCode, String msg) {
super(msg);
this.resultCode = resultCode;
}
}
| 484 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
ValidStatus.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/infrastructure/infrastructure-common/src/main/java/io/qifan/infrastructure/common/mongo/ValidStatus.java | package io.qifan.infrastructure.common.mongo;
import io.qifan.infrastructure.common.constants.BaseEnum;
import java.util.Arrays;
public enum ValidStatus implements BaseEnum {
/**
* 有效
*/
VALID(1, "valid"),
/**
* 无效
*/
INVALID(0, "invalid");
private final Integer code;
private final String name;
ValidStatus(Integer code, String msg) {
this.code = code;
this.name = msg;
}
public static ValidStatus nameOf(String name) {
return Arrays.stream(ValidStatus.values()).filter(type -> type.getName().equals(name))
.findFirst()
.orElseThrow(() -> new RuntimeException("枚举不存在"));
}
public static ValidStatus codeOf(Integer code) {
return Arrays.stream(ValidStatus.values()).filter(type -> type.getCode().equals(code))
.findFirst()
.orElseThrow(() -> new RuntimeException("枚举不存在"));
}
@Override
public Integer getCode() {
return code;
}
@Override
public String getName() {
return name;
}
} | 1,142 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
BaseRepository.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/infrastructure/infrastructure-common/src/main/java/io/qifan/infrastructure/common/mongo/BaseRepository.java | package io.qifan.infrastructure.common.mongo;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.data.repository.NoRepositoryBean;
@NoRepositoryBean
public interface BaseRepository<T> extends MongoRepository<T, String> {
} | 268 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
EntityOperations.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/infrastructure/infrastructure-common/src/main/java/io/qifan/infrastructure/common/mongo/functional/EntityOperations.java | package io.qifan.infrastructure.common.mongo.functional;
import org.springframework.data.repository.CrudRepository;
/**
* @author qifan
*/
public abstract class EntityOperations {
public static <T, ID> EntityUpdater<T, ID> doUpdate(CrudRepository<T, ID> repository) {
return new EntityUpdater<>(repository);
}
public static <T, ID> EntityCreator<T, ID> doCreate(CrudRepository<T, ID> repository) {
return new EntityCreator<>(repository);
}
}
| 482 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
EntityUpdater.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/infrastructure/infrastructure-common/src/main/java/io/qifan/infrastructure/common/mongo/functional/EntityUpdater.java | package io.qifan.infrastructure.common.mongo.functional;
import io.qifan.infrastructure.common.constants.ResultCode;
import io.qifan.infrastructure.common.exception.BusinessException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.repository.CrudRepository;
import org.springframework.util.Assert;
import java.util.Optional;
import java.util.function.Consumer;
import java.util.function.Supplier;
@Slf4j
public class EntityUpdater<T, ID> implements Loader<T, ID>, UpdateHandler<T>, Executor<T> {
private final CrudRepository<T, ID> repository;
private T entity;
private Consumer<T> successHook = t -> log.info("update success");
private Consumer<? super Throwable> errorHook = e -> e.printStackTrace();
public EntityUpdater(CrudRepository<T, ID> repository) {
this.repository = repository;
}
@Override
public Optional<T> execute() {
T save = repository.save(entity);
successHook.accept(save);
return Optional.of(save);
}
@Override
public UpdateHandler<T> loadById(ID id) {
Assert.notNull(id, "id不能为空");
Optional<T> loadEntity = repository.findById(id);
this.entity = loadEntity.orElseThrow(() -> new BusinessException(ResultCode.NotFindError));
return this;
}
@Override
public UpdateHandler<T> load(Supplier<T> t) {
this.entity = t.get();
Assert.notNull(entity, "id不能为空");
return this;
}
@Override
public Executor<T> update(Consumer<T> consumer) {
Assert.notNull(entity, "entity不能为空");
consumer.accept(this.entity);
return this;
}
@Override
public Executor<T> successHook(Consumer<T> consumer) {
this.successHook = consumer;
return this;
}
@Override
public Executor<T> errorHook(Consumer<? super Throwable> consumer) {
this.errorHook = consumer;
return this;
}
} | 1,959 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
UpdateHandler.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/infrastructure/infrastructure-common/src/main/java/io/qifan/infrastructure/common/mongo/functional/UpdateHandler.java | package io.qifan.infrastructure.common.mongo.functional;
import java.util.function.Consumer;
public interface UpdateHandler<T> {
Executor<T> update(Consumer<T> consumer);
}
| 182 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
EntityCreator.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/infrastructure/infrastructure-common/src/main/java/io/qifan/infrastructure/common/mongo/functional/EntityCreator.java | package io.qifan.infrastructure.common.mongo.functional;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.repository.CrudRepository;
import java.util.Optional;
import java.util.function.Consumer;
import java.util.function.Supplier;
/**
* @author qifan
*/
@Slf4j
public class EntityCreator<T, ID> implements Create<T>, UpdateHandler<T>, Executor<T> {
private final CrudRepository<T, ID> repository;
private T entity;
private Consumer<T> successHook = t -> log.info("save success");
private Consumer<? super Throwable> errorHook = e -> e.printStackTrace();
public EntityCreator(CrudRepository<T, ID> repository) {
this.repository = repository;
}
@Override
public Executor<T> errorHook(Consumer<? super Throwable> consumer) {
this.errorHook = consumer;
return this;
}
@Override
public UpdateHandler<T> create(Supplier<T> supplier) {
this.entity = supplier.get();
return this;
}
@Override
public Executor<T> update(Consumer<T> consumer) {
consumer.accept(this.entity);
return this;
}
@Override
public Optional<T> execute() {
T save = repository.save(entity);
successHook.accept(entity);
return Optional.of(save);
}
@Override
public Executor<T> successHook(Consumer<T> consumer) {
this.successHook = consumer;
return this;
}
}
| 1,435 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
Executor.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/infrastructure/infrastructure-common/src/main/java/io/qifan/infrastructure/common/mongo/functional/Executor.java | package io.qifan.infrastructure.common.mongo.functional;
import java.util.Optional;
import java.util.function.Consumer;
public interface Executor<T> {
Optional<T> execute();
Executor<T> successHook(Consumer<T> consumer);
Executor<T> errorHook(Consumer<? super Throwable> consumer);
}
| 303 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
Loader.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/infrastructure/infrastructure-common/src/main/java/io/qifan/infrastructure/common/mongo/functional/Loader.java | package io.qifan.infrastructure.common.mongo.functional;
import java.util.function.Supplier;
public interface Loader<T, ID> {
UpdateHandler<T> loadById(ID id);
UpdateHandler<T> load(Supplier<T> t);
}
| 214 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
Create.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/infrastructure/infrastructure-common/src/main/java/io/qifan/infrastructure/common/mongo/functional/Create.java | package io.qifan.infrastructure.common.mongo.functional;
import java.util.function.Supplier;
public interface Create<T> {
UpdateHandler<T> create(Supplier<T> supplier);
}
| 180 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
BaseRequest.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/infrastructure/infrastructure-common/src/main/java/io/qifan/infrastructure/common/model/BaseRequest.java | package io.qifan.infrastructure.common.model;
import lombok.Data;
import java.time.LocalDateTime;
@Data
public class BaseRequest implements Request {
private String id;
private LocalDateTime createdAt;
private LocalDateTime updatedAt;
private Integer version;
}
| 284 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
PageResult.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/infrastructure/infrastructure-common/src/main/java/io/qifan/infrastructure/common/model/PageResult.java | package io.qifan.infrastructure.common.model;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.List;
@Data
@Accessors(chain = true)
public class PageResult<T> {
private Integer total;
private Integer totalPages;
private Integer pageSize;
private Integer pageNum;
private List<T> list;
public PageResult(List<T> list, Long total, Integer pageSize, Integer pageNum) {
this.list = list;
this.total = total.intValue();
this.pageSize = pageSize;
this.pageNum = pageNum;
}
public static <T> PageResult<T> of(List<T> list, Long total, Integer pageSize, Integer pageNumber) {
return new PageResult<>(list, total, pageSize, pageNumber);
}
}
| 741 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
Response.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/infrastructure/infrastructure-common/src/main/java/io/qifan/infrastructure/common/model/Response.java | package io.qifan.infrastructure.common.model;
import java.io.Serializable;
public interface Response extends Serializable {
}
| 128 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
Request.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/infrastructure/infrastructure-common/src/main/java/io/qifan/infrastructure/common/model/Request.java | package io.qifan.infrastructure.common.model;
import java.io.Serializable;
public interface Request extends Serializable {
}
| 127 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
QueryRequest.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/infrastructure/infrastructure-common/src/main/java/io/qifan/infrastructure/common/model/QueryRequest.java | package io.qifan.infrastructure.common.model;
import lombok.Data;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import java.util.Map;
@Data
public class QueryRequest<T> implements Request {
// 动态的查询条件
private T query;
// 分页大小
private Integer pageSize;
// 页数
private Integer pageNum;
// 排序字段
private Map<String, String> sorts;
/**
* 将QueryRequest对象转成pageable对象
*
* @return 分页对象
*/
public Pageable toPageable() {
return PageRequest.of(getPageNum() - 1,
getPageSize(),
Sort.by(Sort.Direction.DESC, "createdAt"));
}
/**
* 将QueryRequest对象转成pageable对象,支持自定义排序
*
* @param orders 动态的查询条件
* @return 分页对象
*/
public Pageable toPageable(Sort.Order... orders) {
return PageRequest.of(getPageNum() - 1,
getPageSize(),
Sort.by(orders));
}
}
| 1,177 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
R.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/infrastructure/infrastructure-common/src/main/java/io/qifan/infrastructure/common/model/R.java | package io.qifan.infrastructure.common.model;
import io.qifan.infrastructure.common.constants.BaseEnum;
import io.qifan.infrastructure.common.constants.ResultCode;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
import java.util.Objects;
@Data
public class R<T> implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
private Integer code;
private String msg;
private T result;
public R() {
}
private R(T result, Integer code, String msg) {
this.result = result;
this.code = code;
this.msg = msg;
}
private R(T result, BaseEnum resultCode) {
this.result = result;
this.msg = resultCode.getName();
this.code = resultCode.getCode();
}
public static R<String> ok() {
return new R<>("", ResultCode.Success);
}
public static <T> R<T> ok(T data) {
return new R<>(data, ResultCode.Success);
}
public static R<String> fail(BaseEnum resultCode) {
return new R<>("", resultCode);
}
public static R<String> fail(BaseEnum resultCode, String msg) {
return new R<>("", resultCode.getCode(), msg);
}
public boolean isSuccess() {
return Objects.equals(ResultCode.Success.getCode(), this.getCode());
}
}
| 1,327 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
BaseResponse.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/infrastructure/infrastructure-common/src/main/java/io/qifan/infrastructure/common/model/BaseResponse.java | package io.qifan.infrastructure.common.model;
import lombok.Data;
import java.time.LocalDateTime;
@Data
public class BaseResponse implements Response {
private String id;
private LocalDateTime createdAt;
private LocalDateTime updatedAt;
private Integer version;
}
| 287 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
ApplicationTest.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/chatgpt-assistant-server/src/test/java/io/qifan/chatgpt/assistant/ApplicationTest.java | package io.qifan.chatgpt.assistant;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.theokanning.openai.OpenAiApi;
import com.theokanning.openai.completion.chat.ChatCompletionChunk;
import com.theokanning.openai.completion.chat.ChatCompletionRequest;
import com.theokanning.openai.completion.chat.ChatMessage;
import com.theokanning.openai.service.OpenAiService;
import io.qifan.chatgpt.assistant.gpt.session.ChatSession;
import io.qifan.chatgpt.assistant.infrastructure.gpt.GPTProperty;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import okhttp3.OkHttpClient;
import org.junit.jupiter.api.Test;
import org.reactivestreams.Subscriber;
import org.reactivestreams.Subscription;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.mongodb.core.MongoTemplate;
import retrofit2.Retrofit;
import java.net.InetSocketAddress;
import java.net.Proxy;
import java.time.Duration;
import java.util.List;
import java.util.concurrent.CountDownLatch;
import static com.theokanning.openai.service.OpenAiService.*;
@SpringBootTest
@Slf4j
public class ApplicationTest {
@Autowired
GPTProperty property;
@Autowired
MongoTemplate mongoTemplate;
@Test
void findById() {
List<ChatSession> all = mongoTemplate.findAll(ChatSession.class);
all.forEach(chatSession -> log.info(chatSession.toString()));
}
@SneakyThrows
@Test
void chatTest() {
ObjectMapper mapper = defaultObjectMapper();
Proxy proxy = new Proxy(Proxy.Type.HTTP,
new InetSocketAddress(property.getProxy().getHost(), property.getProxy().getPort()));
OkHttpClient client = defaultClient("",
Duration.ofMinutes(1))
.newBuilder()
.proxy(proxy)
.build();
Retrofit retrofit = defaultRetrofit(client, mapper);
OpenAiApi api = retrofit.create(OpenAiApi.class);
OpenAiService service = new OpenAiService(api);
ChatCompletionRequest chatCompletionRequest = ChatCompletionRequest.builder()
.messages(List.of(new ChatMessage("user",
"你好")))
.model("gpt-3.5-turbo")
// .model(chatConfig.getModel().getName())
// .presencePenalty(chatConfig.getPresencePenalty())
// .temperature(chatConfig.getTemperature())
// .maxTokens(chatConfig.getMaxTokens())
.stream(true)
.build();
CountDownLatch countDownLatch = new CountDownLatch(1);
service.streamChatCompletion(chatCompletionRequest).subscribe(new Subscriber<>() {
private Subscription subscription;
private io.qifan.chatgpt.assistant.gpt.message.ChatMessage responseChatMessage;
@Override
public void onSubscribe(Subscription subscription) {
this.subscription = subscription;
subscription.request(1);
responseChatMessage = new io.qifan.chatgpt.assistant.gpt.message.ChatMessage().setContent("");
log.info("订阅");
}
@Override
public void onNext(ChatCompletionChunk chatCompletionChunk) {
com.theokanning.openai.completion.chat.ChatMessage chatMessage = chatCompletionChunk.getChoices().get(0)
.getMessage();
if (chatMessage.getContent() != null) {
log.info("收到响应消息:{}", chatMessage);
responseChatMessage.setContent(responseChatMessage.getContent() + chatMessage.getContent());
responseChatMessage.setRole(chatMessage.getRole());
}
subscription.request(1);
}
@Override
public void onError(Throwable throwable) {
throwable.printStackTrace();
}
@Override
public void onComplete() {
log.info("请求结束");
countDownLatch.countDown();
}
});
countDownLatch.await();
}
}
| 4,889 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
Application.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/chatgpt-assistant-server/src/main/java/io/qifan/chatgpt/assistant/Application.java | package io.qifan.chatgpt.assistant;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
| 317 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
CustomMapper.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/chatgpt-assistant-server/src/main/java/io/qifan/chatgpt/assistant/infrastructure/mapper/CustomMapper.java | package io.qifan.chatgpt.assistant.infrastructure.mapper;
import io.qifan.chatgpt.assistant.gpt.config.ChatConfig;
import org.mapstruct.Mapper;
import org.mapstruct.MappingConstants;
import org.mapstruct.NullValueCheckStrategy;
@Mapper(
nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS,
componentModel = MappingConstants.ComponentModel.SPRING
)
public class CustomMapper {
public Integer GptModel2Int(ChatConfig.GPTModel chatConfigGptModel) {
return chatConfigGptModel.getCode();
}
public ChatConfig.GPTModel int2GPTModel(Integer integer) {
return ChatConfig.GPTModel.codeOf(integer);
}
}
| 647 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
OSSConfiguration.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/chatgpt-assistant-server/src/main/java/io/qifan/chatgpt/assistant/infrastructure/oss/OSSConfiguration.java | package io.qifan.chatgpt.assistant.infrastructure.oss;
import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class OSSConfiguration {
@Autowired
OSSInfo ossInfo;
@Bean
public OSS getOSSClient() {
return new OSSClientBuilder().build(ossInfo.getEndpoint(),
ossInfo.getAccessKeyId(),
ossInfo.getAccessKeySecret());
}
}
| 646 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
OSSInfo.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/chatgpt-assistant-server/src/main/java/io/qifan/chatgpt/assistant/infrastructure/oss/OSSInfo.java | package io.qifan.chatgpt.assistant.infrastructure.oss;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
@Data
@ConfigurationProperties(prefix = "oss")
@Component
public class OSSInfo {
private String endpoint;
private String bucketName;
private String accessKeyId;
private String accessKeySecret;
}
| 413 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
OSSUtils.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/chatgpt-assistant-server/src/main/java/io/qifan/chatgpt/assistant/infrastructure/oss/OSSUtils.java | package io.qifan.chatgpt.assistant.infrastructure.oss;
import com.aliyun.oss.OSS;
import com.aliyun.oss.internal.OSSHeaders;
import com.aliyun.oss.model.CannedAccessControlList;
import com.aliyun.oss.model.ObjectMetadata;
import com.aliyun.oss.model.PutObjectRequest;
import com.aliyun.oss.model.StorageClass;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.io.InputStream;
@Component
public class OSSUtils {
@Autowired
OSSInfo ossInfo;
@Autowired
OSS oss;
public String basicUpload(String objectName, InputStream inputStream) {
PutObjectRequest putObjectRequest = new PutObjectRequest(ossInfo.getBucketName(), objectName, inputStream);
ObjectMetadata metadata = new ObjectMetadata();
metadata.setHeader(OSSHeaders.OSS_STORAGE_CLASS, StorageClass.Standard.toString());
metadata.setObjectAcl(CannedAccessControlList.PublicRead);
putObjectRequest.setMetadata(metadata);
oss.putObject(putObjectRequest);
String url = "https://" + ossInfo.getBucketName() + "." +
ossInfo.getEndpoint().replace("https://", "") +
"/" + objectName;
return url;
}
}
| 1,242 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
GPTProperty.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/chatgpt-assistant-server/src/main/java/io/qifan/chatgpt/assistant/infrastructure/gpt/GPTProperty.java | package io.qifan.chatgpt.assistant.infrastructure.gpt;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
@ConfigurationProperties(prefix = "gpt")
@Component
@Data
public class GPTProperty {
Proxy proxy;
@Data
public static class Proxy {
private String host;
private Integer port;
}
} | 413 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
MongoAuditingConfig.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/chatgpt-assistant-server/src/main/java/io/qifan/chatgpt/assistant/infrastructure/config/MongoAuditingConfig.java | package io.qifan.chatgpt.assistant.infrastructure.config;
import cn.dev33.satoken.stp.StpUtil;
import io.qifan.chatgpt.assistant.user.User;
import io.qifan.chatgpt.assistant.user.repository.UserRepository;
import lombok.AllArgsConstructor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.domain.AuditorAware;
import org.springframework.data.mongodb.config.EnableMongoAuditing;
import org.springframework.web.context.request.RequestContextHolder;
import java.util.Optional;
@Configuration
@EnableMongoAuditing
@AllArgsConstructor
public class MongoAuditingConfig {
private final UserRepository userRepository;
@Bean
public AuditorAware<User> auditorAware() {
return () -> {
if (RequestContextHolder.getRequestAttributes() == null) return Optional.empty();
Object loginIdDefaultNull = StpUtil.getLoginIdDefaultNull();
if (loginIdDefaultNull != null) {
return userRepository.findById(StpUtil.getLoginIdAsString());
}
return Optional.empty();
};
}
}
| 1,157 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
PageableConvert.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/chatgpt-assistant-server/src/main/java/io/qifan/chatgpt/assistant/infrastructure/config/PageableConvert.java | package io.qifan.chatgpt.assistant.infrastructure.config;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import io.qifan.infrastructure.common.model.PageResult;
import org.springframework.boot.jackson.JsonComponent;
import org.springframework.data.domain.Page;
import java.io.IOException;
@JsonComponent
public class PageableConvert {
public static class Serializer extends JsonSerializer<Page<?>> {
@Override
public void serialize(Page<?> page, JsonGenerator jsonGenerator,
SerializerProvider serializerProvider) throws IOException {
PageResult<?> pageResult = PageResult.of(page.getContent(), page.getTotalElements(),
page.getSize(), page.getNumber());
jsonGenerator.writeObject(pageResult);
}
}
public static class Deserializer extends JsonDeserializer<Page<?>> {
@Override
public Page<?> deserialize(JsonParser jsonParser,
DeserializationContext deserializationContext) throws IOException {
return jsonParser.readValueAs(Page.class);
}
}
}
| 1,448 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
ResponseInterceptor.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/chatgpt-assistant-server/src/main/java/io/qifan/chatgpt/assistant/infrastructure/config/ResponseInterceptor.java | package io.qifan.chatgpt.assistant.infrastructure.config;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.qifan.infrastructure.common.model.R;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.springframework.core.MethodParameter;
import org.springframework.http.MediaType;
import org.springframework.http.server.ServerHttpRequest;
import org.springframework.http.server.ServerHttpResponse;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice;
@RestControllerAdvice(basePackages = "io.qifan.chatgpt.assistant")
@Slf4j
public class ResponseInterceptor implements ResponseBodyAdvice<Object> {
private final ObjectMapper objectMapper;
public ResponseInterceptor(ObjectMapper objectMapper) {
this.objectMapper = objectMapper;
}
@Override
public boolean supports(MethodParameter returnType, Class converterType) {
return true;
}
@SneakyThrows
@Override
public Object beforeBodyWrite(Object body, MethodParameter returnType,
MediaType selectedContentType, Class selectedConverterType,
ServerHttpRequest request, ServerHttpResponse response) {
if (body instanceof R) {
return body;
}
if (body instanceof String) {
response.getHeaders().setContentType(MediaType.APPLICATION_JSON);
return objectMapper.writeValueAsString(R.ok(body));
}
log.debug("响应结果:{}", body);
return R.ok(body);
}
}
| 1,635 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
LocalDateTimeConvert.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/chatgpt-assistant-server/src/main/java/io/qifan/chatgpt/assistant/infrastructure/config/LocalDateTimeConvert.java | package io.qifan.chatgpt.assistant.infrastructure.config;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.jackson.JsonComponent;
import java.io.IOException;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
@JsonComponent
@Slf4j
public class LocalDateTimeConvert {
public static class Serializer extends JsonSerializer<LocalDateTime> {
@Override
public void serialize(LocalDateTime localDateTime, JsonGenerator jsonGenerator,
SerializerProvider serializerProvider) throws IOException {
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern(
"yyyy-MM-dd HH:mm:ss");
String format = dateTimeFormatter.format(localDateTime);
jsonGenerator.writeString(format);
}
}
public static class Deserializer extends JsonDeserializer<LocalDateTime> {
@Override
public LocalDateTime deserialize(JsonParser jsonParser,
DeserializationContext deserializationContext) throws IOException {
String text = jsonParser.getText();
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern(
"yyyy-MM-dd HH:mm:ss");
return LocalDateTime.parse(text, dateTimeFormatter);
}
}
}
| 1,691 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
RedisConfig.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/chatgpt-assistant-server/src/main/java/io/qifan/chatgpt/assistant/infrastructure/config/RedisConfig.java | package io.qifan.chatgpt.assistant.infrastructure.config;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
@AutoConfigureAfter(RedisAutoConfiguration.class)
@Configuration
public class RedisConfig {
// redis-start会自动创建LettuceConnectionFactory ,也可以手动创建JedisConnectionFactory
@Bean
public RedisTemplate<String, Object> stringObjectRedisTemplate(RedisConnectionFactory redisConnectionFactory) {
RedisTemplate<String, Object> stringObjectRedisTemplate = new RedisTemplate<>();
stringObjectRedisTemplate.setConnectionFactory(redisConnectionFactory);
// 使用FastJson序列化object
stringObjectRedisTemplate.setDefaultSerializer(new Jackson2JsonRedisSerializer<>(Object.class));
return stringObjectRedisTemplate;
}
} | 1,216 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
GlobalExceptionAdvice.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/chatgpt-assistant-server/src/main/java/io/qifan/chatgpt/assistant/infrastructure/config/GlobalExceptionAdvice.java | package io.qifan.chatgpt.assistant.infrastructure.config;
import cn.dev33.satoken.exception.NotLoginException;
import io.qifan.chatgpt.infrastructure.security.AuthErrorCode;
import io.qifan.infrastructure.common.constants.ResultCode;
import io.qifan.infrastructure.common.exception.BusinessException;
import io.qifan.infrastructure.common.exception.SystemException;
import io.qifan.infrastructure.common.model.R;
import jakarta.validation.ConstraintViolation;
import jakarta.validation.ConstraintViolationException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import java.util.ArrayList;
/**
* @author qifan
*/
@RestControllerAdvice
@Slf4j
public class GlobalExceptionAdvice {
@ExceptionHandler(BusinessException.class)
public ResponseEntity<R<String>> handleBusinessException(BusinessException e) {
log.error("业务异常", e);
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(R.fail(e.getResultCode(), e.getMessage()));
}
@ExceptionHandler(SystemException.class)
public ResponseEntity<R<String>> handleSystemException(SystemException e) {
log.error("系统异常", e);
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(R.fail(ResultCode.SystemError));
}
@ExceptionHandler(Exception.class)
public ResponseEntity<R<String>> handleException(Exception e) {
log.error("系统异常", e);
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(R.fail(ResultCode.SystemError));
}
@ExceptionHandler(ConstraintViolationException.class)
public ResponseEntity<R<String>> handleValidateException(ConstraintViolationException e) {
log.warn("校验异常", e);
// 不合格的字段,可能有多个,只需要返回其中一个提示用户就行
// 比如密码为空
ArrayList<ConstraintViolation<?>> constraintViolations = new ArrayList<>(
e.getConstraintViolations());
return ResponseEntity.status(HttpStatus.BAD_REQUEST)
.body(R.fail(ResultCode.ValidateError,
constraintViolations.get(0).getMessage()));
}
@ExceptionHandler(MethodArgumentNotValidException.class)
public ResponseEntity<R<String>> handleValidateExceptionForSpring(
MethodArgumentNotValidException e) {
log.warn("校验异常", e);
return ResponseEntity.status(HttpStatus.BAD_REQUEST)
.body(R.fail(ResultCode.ValidateError,
e.getBindingResult().getAllErrors().get(0)
.getDefaultMessage()));
}
@ExceptionHandler(NotLoginException.class)
public ResponseEntity<R<String>> handleNotLogin(NotLoginException e) {
e.printStackTrace();
return ResponseEntity.status(HttpStatus.BAD_REQUEST)
.body(R.fail(AuthErrorCode.USER_PERMISSION_UNAUTHENTICATED));
}
}
| 3,261 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
UserHandshakeHandler.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/chatgpt-assistant-server/src/main/java/io/qifan/chatgpt/assistant/infrastructure/websocket/UserHandshakeHandler.java | package io.qifan.chatgpt.assistant.infrastructure.websocket;
import cn.dev33.satoken.stp.StpUtil;
import com.sun.security.auth.UserPrincipal;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.server.ServerHttpRequest;
import org.springframework.web.socket.WebSocketHandler;
import org.springframework.web.socket.server.support.DefaultHandshakeHandler;
import java.security.Principal;
import java.util.Map;
@Slf4j
public class UserHandshakeHandler extends DefaultHandshakeHandler {
@Override
protected Principal determineUser(ServerHttpRequest request, WebSocketHandler wsHandler,
Map<String, Object> attributes) {
log.info("当前登录用户id:{}", StpUtil.getLoginIdAsString());
return new UserPrincipal(StpUtil.getLoginIdAsString());
}
}
| 829 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
WebSocketConfig.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/chatgpt-assistant-server/src/main/java/io/qifan/chatgpt/assistant/infrastructure/websocket/WebSocketConfig.java | package io.qifan.chatgpt.assistant.infrastructure.websocket;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Lazy;
import org.springframework.messaging.simp.config.MessageBrokerRegistry;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker;
import org.springframework.web.socket.config.annotation.StompEndpointRegistry;
import org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer;
@EnableWebSocketMessageBroker
@Configuration
public class WebSocketConfig implements WebSocketMessageBrokerConfigurer {
private TaskScheduler messageBrokerTaskScheduler;
@Autowired
public void setMessageBrokerTaskScheduler(@Lazy TaskScheduler taskScheduler) {
this.messageBrokerTaskScheduler = taskScheduler;
}
@Override
public void registerStompEndpoints(StompEndpointRegistry registry) {
registry.addEndpoint("handshake")
.setAllowedOrigins("*")
.setHandshakeHandler(new UserHandshakeHandler());
}
@Override
public void configureMessageBroker(MessageBrokerRegistry registry) {
registry.setApplicationDestinationPrefixes("/socket")
.setUserDestinationPrefix("/user")
.enableSimpleBroker("/topic", "/queue")
.setHeartbeatValue(new long[]{10000, 20000})
.setTaskScheduler(this.messageBrokerTaskScheduler);
}
}
| 1,591 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
ChatConfig.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/chatgpt-assistant-server/src/main/java/io/qifan/chatgpt/assistant/gpt/config/ChatConfig.java | package io.qifan.chatgpt.assistant.gpt.config;
import io.qifan.chatgpt.assistant.user.User;
import io.qifan.infrastructure.common.constants.BaseEnum;
import io.qifan.infrastructure.common.entity.BaseEntity;
import io.qifan.infrastructure.common.mongo.ValidStatus;
import io.qifan.infrastructure.generator.core.GenEntity;
import io.qifan.infrastructure.generator.core.GenField;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.mongodb.core.mapping.DBRef;
import org.springframework.data.mongodb.core.mapping.Document;
import java.util.Arrays;
@GenEntity
@Document
@Accessors(chain = true)
@Data
public class ChatConfig extends BaseEntity {
private GPTModel model;
private Double temperature;
private Integer maxTokens;
private Double presencePenalty;
private String apiKey;
@GenField(association = true, ignoreRequest = true)
@CreatedBy
@DBRef
private User createdBy;
@GenField(ignoreRequest = true)
private ValidStatus validStatus;
public void valid() {
setValidStatus(ValidStatus.VALID);
}
public void invalid() {
setValidStatus(ValidStatus.INVALID);
}
public enum GPTModel implements BaseEnum {
GPT_35_TURBO(0, "gpt-3.5-turbo"),
GPT_4(1, "gpt-4"),
GPT_4_TURBO(2, "gpt-4-1106-preview");
private final Integer code;
private final String name;
GPTModel(Integer code, String name) {
this.code = code;
this.name = name;
}
public static GPTModel nameOf(String name) {
return Arrays.stream(GPTModel.values()).filter(type -> type.getName().equals(name))
.findFirst()
.orElseThrow(() -> new RuntimeException("枚举不存在"));
}
public static GPTModel codeOf(Integer code) {
return Arrays.stream(GPTModel.values()).filter(type -> type.getCode().equals(code))
.findFirst()
.orElseThrow(() -> new RuntimeException("枚举不存在"));
}
@Override
public Integer getCode() {
return this.code;
}
@Override
public String getName() {
return this.name;
}
}
}
| 2,427 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
ChatConfigMapper.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/chatgpt-assistant-server/src/main/java/io/qifan/chatgpt/assistant/gpt/config/mapper/ChatConfigMapper.java | package io.qifan.chatgpt.assistant.gpt.config.mapper;
import io.qifan.chatgpt.assistant.gpt.config.ChatConfig;
import io.qifan.chatgpt.assistant.gpt.config.dto.request.ChatConfigCreateRequest;
import io.qifan.chatgpt.assistant.gpt.config.dto.request.ChatConfigQueryRequest;
import io.qifan.chatgpt.assistant.gpt.config.dto.request.ChatConfigUpdateRequest;
import io.qifan.chatgpt.assistant.gpt.config.dto.response.ChatConfigCommonResponse;
import io.qifan.chatgpt.assistant.infrastructure.mapper.CustomMapper;
import org.mapstruct.*;
@Mapper(
uses = {CustomMapper.class},
nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS,
nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE,
componentModel = MappingConstants.ComponentModel.SPRING
)
public interface ChatConfigMapper {
ChatConfig createRequest2Entity(ChatConfigCreateRequest request);
ChatConfig queryRequest2Entity(ChatConfigQueryRequest request);
@Mapping(target = "apiKey", conditionQualifiedByName = "ApiKeyCheck")
ChatConfig updateEntityFromUpdateRequest(ChatConfigUpdateRequest request, @MappingTarget ChatConfig entity);
@Mapping(target = "createdBy", ignore = true)
@Mapping(target = "apiKey", qualifiedByName = "ApiKeyMap")
ChatConfigCommonResponse entity2Response(ChatConfig entity);
@Condition
@Named("ApiKeyCheck")
default boolean apiKeyCheck(String apiKey) {
return !apiKey.equals("**********");
}
@Named("ApiKeyMap")
default String apiKeyMap(String apiKey) {
return apiKey == null ? null : "**********";
}
} | 1,612 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
ChatConfigCreateRequest.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/chatgpt-assistant-server/src/main/java/io/qifan/chatgpt/assistant/gpt/config/dto/request/ChatConfigCreateRequest.java | package io.qifan.chatgpt.assistant.gpt.config.dto.request;
import io.qifan.chatgpt.assistant.gpt.config.ChatConfig.GPTModel;
import io.qifan.infrastructure.common.model.BaseRequest;
import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.Min;
import lombok.Data;
@Data
public class ChatConfigCreateRequest extends BaseRequest {
private Integer model = GPTModel.GPT_35_TURBO.getCode();
@Min(value = 0, message = "随机性不能小于0")
@Max(value = 1, message = "随机性不能大于0")
private Double temperature = 0.;
private Integer maxTokens = 2000;
@Min(value = -2, message = "话题新鲜度不能小于-2")
@Max(value = 2, message = "话题新鲜度不能大于2")
private Double presencePenalty = 0.;
private String apiKey;
} | 799 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
ChatConfigUpdateRequest.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/chatgpt-assistant-server/src/main/java/io/qifan/chatgpt/assistant/gpt/config/dto/request/ChatConfigUpdateRequest.java | package io.qifan.chatgpt.assistant.gpt.config.dto.request;
import io.qifan.infrastructure.common.model.BaseRequest;
import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.Min;
import lombok.Data;
@Data
public class ChatConfigUpdateRequest extends BaseRequest {
private Integer model;
@Min(value = 0, message = "随机性不能小于0")
@Max(value = 1, message = "随机性不能大于0")
private Double temperature;
private Integer maxTokens;
@Min(value = -2, message = "话题新鲜度不能小于-2")
@Max(value = 2, message = "话题新鲜度不能大于2")
private Double presencePenalty;
private String apiKey;
} | 682 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
ChatConfigQueryRequest.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/chatgpt-assistant-server/src/main/java/io/qifan/chatgpt/assistant/gpt/config/dto/request/ChatConfigQueryRequest.java | package io.qifan.chatgpt.assistant.gpt.config.dto.request;
import io.qifan.infrastructure.common.model.BaseRequest;
import lombok.Data;
@Data
public class ChatConfigQueryRequest extends BaseRequest {
private Integer model;
private Double temperature;
private Integer maxTokens;
private Double presencePenalty;
private String apiKey;
} | 357 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
ChatConfigCommonResponse.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/chatgpt-assistant-server/src/main/java/io/qifan/chatgpt/assistant/gpt/config/dto/response/ChatConfigCommonResponse.java | package io.qifan.chatgpt.assistant.gpt.config.dto.response;
import io.qifan.chatgpt.assistant.user.dto.response.UserCommonResponse;
import io.qifan.infrastructure.common.model.BaseResponse;
import io.qifan.infrastructure.common.mongo.ValidStatus;
import lombok.Data;
@Data
public class ChatConfigCommonResponse extends BaseResponse {
private Integer model;
private Double temperature;
private Integer maxTokens;
private Double presencePenalty;
private String apiKey;
private UserCommonResponse createdBy;
private ValidStatus validStatus;
} | 570 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
ChatConfigRepository.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/chatgpt-assistant-server/src/main/java/io/qifan/chatgpt/assistant/gpt/config/repository/ChatConfigRepository.java | package io.qifan.chatgpt.assistant.gpt.config.repository;
import io.qifan.chatgpt.assistant.gpt.config.ChatConfig;
import io.qifan.infrastructure.common.mongo.BaseRepository;
public interface ChatConfigRepository extends BaseRepository<ChatConfig> {
}
| 254 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
ChatConfigController.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/chatgpt-assistant-server/src/main/java/io/qifan/chatgpt/assistant/gpt/config/controller/ChatConfigController.java | package io.qifan.chatgpt.assistant.gpt.config.controller;
import io.qifan.chatgpt.assistant.gpt.config.dto.request.ChatConfigCreateRequest;
import io.qifan.chatgpt.assistant.gpt.config.dto.request.ChatConfigQueryRequest;
import io.qifan.chatgpt.assistant.gpt.config.dto.request.ChatConfigUpdateRequest;
import io.qifan.chatgpt.assistant.gpt.config.dto.response.ChatConfigCommonResponse;
import io.qifan.chatgpt.assistant.gpt.config.service.ChatConfigService;
import io.qifan.infrastructure.common.model.QueryRequest;
import jakarta.validation.Valid;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@Slf4j
@AllArgsConstructor
@RequestMapping("chatConfig")
public class ChatConfigController {
private final ChatConfigService chatConfigService;
@GetMapping("{id}")
public ChatConfigCommonResponse findById(@PathVariable String id) {
return chatConfigService.findById(id);
}
@PostMapping("create")
public String createChatConfig(@RequestBody @Valid ChatConfigCreateRequest createRequest) {
return chatConfigService.createChatConfig(createRequest);
}
@PostMapping("{id}/update")
public Boolean updateChatConfig(@RequestBody @Valid ChatConfigUpdateRequest updateRequest,
@PathVariable String id) {
chatConfigService.updateChatConfig(updateRequest, id);
return true;
}
@PostMapping("{id}/valid")
public Boolean validChatConfig(@PathVariable String id) {
chatConfigService.validChatConfig(id);
return true;
}
@PostMapping("{id}/invalid")
public Boolean invalidChatConfig(@PathVariable String id) {
chatConfigService.invalidChatConfig(id);
return true;
}
@PostMapping("query")
public Page<ChatConfigCommonResponse> queryChatConfig(
@RequestBody QueryRequest<ChatConfigQueryRequest> queryRequest) {
return chatConfigService.queryChatConfig(queryRequest);
}
@PostMapping("delete")
public Boolean deleteChatConfig(@RequestBody List<String> ids) {
return chatConfigService.deleteChatConfig(ids);
}
@GetMapping("user")
public ChatConfigCommonResponse getUserChatConfig() {
return chatConfigService.getUserChatConfig();
}
} | 2,409 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
ChatConfigService.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/chatgpt-assistant-server/src/main/java/io/qifan/chatgpt/assistant/gpt/config/service/ChatConfigService.java | package io.qifan.chatgpt.assistant.gpt.config.service;
import cn.dev33.satoken.stp.StpUtil;
import io.qifan.chatgpt.assistant.gpt.config.ChatConfig;
import io.qifan.chatgpt.assistant.gpt.config.dto.request.ChatConfigCreateRequest;
import io.qifan.chatgpt.assistant.gpt.config.dto.request.ChatConfigQueryRequest;
import io.qifan.chatgpt.assistant.gpt.config.dto.request.ChatConfigUpdateRequest;
import io.qifan.chatgpt.assistant.gpt.config.dto.response.ChatConfigCommonResponse;
import io.qifan.chatgpt.assistant.gpt.config.mapper.ChatConfigMapper;
import io.qifan.chatgpt.assistant.gpt.config.repository.ChatConfigRepository;
import io.qifan.infrastructure.common.constants.ResultCode;
import io.qifan.infrastructure.common.exception.BusinessException;
import io.qifan.infrastructure.common.model.QueryRequest;
import io.qifan.infrastructure.common.mongo.functional.EntityOperations;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.domain.Example;
import org.springframework.data.domain.ExampleMatcher;
import org.springframework.data.domain.Page;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Optional;
@Slf4j
@Service
@Transactional
@AllArgsConstructor
public class ChatConfigService {
private final ChatConfigRepository chatConfigRepository;
private final ChatConfigMapper chatConfigMapper;
private final MongoTemplate mongoTemplate;
public ChatConfigCommonResponse findById(String id) {
return chatConfigMapper.entity2Response(chatConfigRepository
.findById(id)
.orElseThrow(() -> new BusinessException(
ResultCode.NotFindError)));
}
public void updateChatConfig(ChatConfigUpdateRequest request, String id) {
EntityOperations.doUpdate(chatConfigRepository)
.loadById(id)
.update(e -> {
chatConfigMapper.updateEntityFromUpdateRequest(request, e);
e.valid();
})
.successHook(e -> log.info("更新ChatConfig:{}", e))
.execute();
}
public String createChatConfig(ChatConfigCreateRequest request) {
Optional<ChatConfig> chatConfig = EntityOperations.doCreate(chatConfigRepository)
.create(() -> {
Optional.ofNullable(mongoTemplate.findOne(Query.query(Criteria.where("createdBy.id").is(StpUtil.getLoginIdAsString())), ChatConfig.class)).ifPresent(config -> {
throw new BusinessException(ResultCode.SaveError, "已存在配置,请刷新页面");
});
return chatConfigMapper.createRequest2Entity(
request);
})
.update(ChatConfig::valid)
.successHook(e -> {
log.info("创建ChatConfig:{}", e);
})
.execute();
return chatConfig.map(ChatConfig::getId).orElse(null);
}
public void validChatConfig(String id) {
EntityOperations.doUpdate(chatConfigRepository)
.loadById(id)
.update(ChatConfig::valid)
.successHook(e -> log.info("生效ChatConfig:{}", e))
.execute();
}
public void invalidChatConfig(String id) {
EntityOperations.doUpdate(chatConfigRepository)
.loadById(id)
.update(ChatConfig::invalid)
.successHook(e -> log.info("失效ChatConfig:{}", e))
.execute();
}
public Page<ChatConfigCommonResponse> queryChatConfig(QueryRequest<ChatConfigQueryRequest> request) {
ExampleMatcher matcher = ExampleMatcher.matchingAll();
Example<ChatConfig> example = Example.of(chatConfigMapper.queryRequest2Entity(request.getQuery()), matcher);
Page<ChatConfig> page = chatConfigRepository.findAll(example, request.toPageable());
return page.map(chatConfigMapper::entity2Response);
}
public Boolean deleteChatConfig(List<String> ids) {
chatConfigRepository.deleteAllById(ids);
return true;
}
public ChatConfigCommonResponse getUserChatConfig() {
return Optional.ofNullable(mongoTemplate.findOne(Query.query(Criteria.where("createdBy.id")
.is(StpUtil.getLoginIdAsString())),
ChatConfig.class))
.map(chatConfigMapper::entity2Response)
.orElse(null);
}
} | 5,334 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
ChatMessage.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/chatgpt-assistant-server/src/main/java/io/qifan/chatgpt/assistant/gpt/message/ChatMessage.java | package io.qifan.chatgpt.assistant.gpt.message;
import io.qifan.chatgpt.assistant.gpt.session.ChatSession;
import io.qifan.infrastructure.common.entity.BaseEntity;
import io.qifan.infrastructure.common.mongo.ValidStatus;
import io.qifan.infrastructure.generator.core.GenEntity;
import io.qifan.infrastructure.generator.core.GenField;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.data.mongodb.core.mapping.DBRef;
import org.springframework.data.mongodb.core.mapping.Document;
@GenEntity
@Document
@Accessors(chain = true)
@Data
public class ChatMessage extends BaseEntity {
private String content;
private String role;
@DBRef
@GenField(association = true)
private ChatSession session;
@GenField(ignoreRequest = true)
private ValidStatus validStatus;
public void valid() {
setValidStatus(ValidStatus.VALID);
}
public void invalid() {
setValidStatus(ValidStatus.INVALID);
}
} | 977 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
ChatMessageMapper.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/chatgpt-assistant-server/src/main/java/io/qifan/chatgpt/assistant/gpt/message/mapper/ChatMessageMapper.java | package io.qifan.chatgpt.assistant.gpt.message.mapper;
import io.qifan.chatgpt.assistant.gpt.message.ChatMessage;
import io.qifan.chatgpt.assistant.gpt.message.dto.request.ChatMessageCreateRequest;
import io.qifan.chatgpt.assistant.gpt.message.dto.request.ChatMessageQueryRequest;
import io.qifan.chatgpt.assistant.gpt.message.dto.request.ChatMessageUpdateRequest;
import io.qifan.chatgpt.assistant.gpt.message.dto.response.ChatMessageCommonResponse;
import io.qifan.chatgpt.assistant.infrastructure.mapper.CustomMapper;
import org.mapstruct.*;
@Mapper(
uses = {CustomMapper.class},
nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS,
nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE,
componentModel = MappingConstants.ComponentModel.SPRING
)
public interface ChatMessageMapper {
ChatMessage createRequest2Entity(ChatMessageCreateRequest request);
ChatMessage queryRequest2Entity(ChatMessageQueryRequest request);
ChatMessage updateEntityFromUpdateRequest(ChatMessageUpdateRequest request, @MappingTarget ChatMessage entity);
ChatMessageCommonResponse entity2Response(ChatMessage entity);
com.theokanning.openai.completion.chat.ChatMessage entityToMessage(ChatMessage entity);
} | 1,267 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
ChatMessageUpdateRequest.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/chatgpt-assistant-server/src/main/java/io/qifan/chatgpt/assistant/gpt/message/dto/request/ChatMessageUpdateRequest.java | package io.qifan.chatgpt.assistant.gpt.message.dto.request;
import io.qifan.chatgpt.assistant.gpt.session.dto.request.ChatSessionUpdateRequest;
import io.qifan.infrastructure.common.model.BaseRequest;
import lombok.Data;
@Data
public class ChatMessageUpdateRequest extends BaseRequest {
private String content;
private String role;
private ChatSessionUpdateRequest session;
} | 390 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
ChatMessageQueryRequest.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/chatgpt-assistant-server/src/main/java/io/qifan/chatgpt/assistant/gpt/message/dto/request/ChatMessageQueryRequest.java | package io.qifan.chatgpt.assistant.gpt.message.dto.request;
import io.qifan.chatgpt.assistant.gpt.session.dto.request.ChatSessionQueryRequest;
import io.qifan.infrastructure.common.model.BaseRequest;
import lombok.Data;
@Data
public class ChatMessageQueryRequest extends BaseRequest {
private String content;
private String role;
private ChatSessionQueryRequest session;
} | 387 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
ChatMessageCreateRequest.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/chatgpt-assistant-server/src/main/java/io/qifan/chatgpt/assistant/gpt/message/dto/request/ChatMessageCreateRequest.java | package io.qifan.chatgpt.assistant.gpt.message.dto.request;
import io.qifan.chatgpt.assistant.gpt.session.dto.request.ChatSessionCreateRequest;
import io.qifan.infrastructure.common.model.BaseRequest;
import lombok.Data;
@Data
public class ChatMessageCreateRequest extends BaseRequest {
private String content;
private String role;
private ChatSessionCreateRequest session;
} | 390 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
ChatMessageCommonResponse.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/chatgpt-assistant-server/src/main/java/io/qifan/chatgpt/assistant/gpt/message/dto/response/ChatMessageCommonResponse.java | package io.qifan.chatgpt.assistant.gpt.message.dto.response;
import io.qifan.chatgpt.assistant.gpt.session.dto.response.ChatSessionCommonResponse;
import io.qifan.infrastructure.common.model.BaseResponse;
import io.qifan.infrastructure.common.mongo.ValidStatus;
import lombok.Data;
@Data
public class ChatMessageCommonResponse extends BaseResponse {
private String content;
private String role;
private ChatSessionCommonResponse session;
private ValidStatus validStatus;
} | 491 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
ChatMessageRepository.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/chatgpt-assistant-server/src/main/java/io/qifan/chatgpt/assistant/gpt/message/repository/ChatMessageRepository.java | package io.qifan.chatgpt.assistant.gpt.message.repository;
import io.qifan.chatgpt.assistant.gpt.message.ChatMessage;
import io.qifan.infrastructure.common.mongo.BaseRepository;
public interface ChatMessageRepository extends BaseRepository<ChatMessage> {
}
| 259 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
ChatMessageController.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/chatgpt-assistant-server/src/main/java/io/qifan/chatgpt/assistant/gpt/message/controller/ChatMessageController.java | package io.qifan.chatgpt.assistant.gpt.message.controller;
import io.qifan.chatgpt.assistant.gpt.message.dto.request.ChatMessageCreateRequest;
import io.qifan.chatgpt.assistant.gpt.message.dto.request.ChatMessageQueryRequest;
import io.qifan.chatgpt.assistant.gpt.message.dto.request.ChatMessageUpdateRequest;
import io.qifan.chatgpt.assistant.gpt.message.dto.response.ChatMessageCommonResponse;
import io.qifan.chatgpt.assistant.gpt.message.service.ChatMessageService;
import io.qifan.infrastructure.common.model.QueryRequest;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@Slf4j
@AllArgsConstructor
@RequestMapping("chatMessage")
public class ChatMessageController {
private final ChatMessageService chatMessageService;
@GetMapping("{id}")
public ChatMessageCommonResponse findById(@PathVariable String id) {
return chatMessageService.findById(id);
}
@PostMapping("create")
public String createChatMessage(@RequestBody ChatMessageCreateRequest createRequest) {
return chatMessageService.createChatMessage(createRequest);
}
@PostMapping("{id}/update")
public Boolean updateChatMessage(@RequestBody ChatMessageUpdateRequest updateRequest, @PathVariable String id) {
chatMessageService.updateChatMessage(updateRequest, id);
return true;
}
@PostMapping("{id}/valid")
public Boolean validChatMessage(@PathVariable String id) {
chatMessageService.validChatMessage(id);
return true;
}
@PostMapping("{id}/invalid")
public Boolean invalidChatMessage(@PathVariable String id) {
chatMessageService.invalidChatMessage(id);
return true;
}
@PostMapping("query")
public Page<ChatMessageCommonResponse> queryChatMessage(
@RequestBody QueryRequest<ChatMessageQueryRequest> queryRequest) {
return chatMessageService.queryChatMessage(queryRequest);
}
@PostMapping("delete")
public Boolean deleteChatMessage(@RequestBody List<String> ids) {
return chatMessageService.deleteChatMessage(ids);
}
} | 2,222 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
WebsocketChatMessageController.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/chatgpt-assistant-server/src/main/java/io/qifan/chatgpt/assistant/gpt/message/controller/WebsocketChatMessageController.java | package io.qifan.chatgpt.assistant.gpt.message.controller;
import io.qifan.chatgpt.assistant.gpt.message.dto.request.ChatMessageCreateRequest;
import io.qifan.chatgpt.assistant.gpt.message.service.ChatMessageService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.messaging.handler.annotation.MessageMapping;
import org.springframework.messaging.handler.annotation.Payload;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import java.security.Principal;
@Controller
@AllArgsConstructor
@Slf4j
public class WebsocketChatMessageController {
private final ChatMessageService chatMessageService;
@MessageMapping("/chatMessage/send")
public void chat(@Payload ChatMessageCreateRequest requestMessage, Principal principal) {
chatMessageService.sendMessage(requestMessage, principal);
}
}
| 921 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
ChatMessageService.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/chatgpt-assistant-server/src/main/java/io/qifan/chatgpt/assistant/gpt/message/service/ChatMessageService.java | package io.qifan.chatgpt.assistant.gpt.message.service;
import com.theokanning.openai.completion.chat.ChatCompletionRequest;
import com.theokanning.openai.service.OpenAiService;
import io.qifan.chatgpt.assistant.gpt.config.ChatConfig;
import io.qifan.chatgpt.assistant.gpt.message.ChatMessage;
import io.qifan.chatgpt.assistant.gpt.message.dto.request.ChatMessageCreateRequest;
import io.qifan.chatgpt.assistant.gpt.message.dto.request.ChatMessageQueryRequest;
import io.qifan.chatgpt.assistant.gpt.message.dto.request.ChatMessageUpdateRequest;
import io.qifan.chatgpt.assistant.gpt.message.dto.response.ChatMessageCommonResponse;
import io.qifan.chatgpt.assistant.gpt.message.mapper.ChatMessageMapper;
import io.qifan.chatgpt.assistant.gpt.message.repository.ChatMessageRepository;
import io.qifan.chatgpt.assistant.gpt.message.service.domainservice.SendMessageService;
import io.qifan.chatgpt.assistant.gpt.session.ChatSession;
import io.qifan.chatgpt.assistant.gpt.session.repository.ChatSessionRepository;
import io.qifan.infrastructure.common.constants.ResultCode;
import io.qifan.infrastructure.common.exception.BusinessException;
import io.qifan.infrastructure.common.model.QueryRequest;
import io.qifan.infrastructure.common.mongo.functional.EntityOperations;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.domain.Example;
import org.springframework.data.domain.ExampleMatcher;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.security.Principal;
import java.util.List;
import java.util.Optional;
@Slf4j
@Service
@Transactional
@AllArgsConstructor
public class ChatMessageService {
private final ChatSessionRepository chatSessionRepository;
private final ChatMessageRepository chatMessageRepository;
private final ChatMessageMapper chatMessageMapper;
private final SendMessageService sendMessageService;
public ChatMessageCommonResponse findById(String id) {
return chatMessageMapper.entity2Response(chatMessageRepository
.findById(id)
.orElseThrow(() -> new BusinessException(
ResultCode.NotFindError)));
}
public void updateChatMessage(ChatMessageUpdateRequest request, String id) {
EntityOperations.doUpdate(chatMessageRepository)
.loadById(id)
.update(e -> {
chatMessageMapper.updateEntityFromUpdateRequest(request, e);
e.valid();
})
.successHook(e -> log.info("更新ChatMessage:{}", e))
.execute();
}
public String createChatMessage(ChatMessageCreateRequest request) {
Optional<ChatMessage> chatMessage = EntityOperations.doCreate(chatMessageRepository)
.create(() -> chatMessageMapper.createRequest2Entity(
request))
.update(ChatMessage::valid)
.successHook(e -> {
log.info("创建ChatMessage:{}", e);
})
.execute();
return chatMessage.map(ChatMessage::getId).orElse(null);
}
public void validChatMessage(String id) {
EntityOperations.doUpdate(chatMessageRepository)
.loadById(id)
.update(ChatMessage::valid)
.successHook(e -> log.info("生效ChatMessage:{}", e))
.execute();
}
public void invalidChatMessage(String id) {
EntityOperations.doUpdate(chatMessageRepository)
.loadById(id)
.update(ChatMessage::invalid)
.successHook(e -> log.info("失效ChatMessage:{}", e))
.execute();
}
public Page<ChatMessageCommonResponse> queryChatMessage(QueryRequest<ChatMessageQueryRequest> request) {
ExampleMatcher matcher = ExampleMatcher.matchingAll();
Example<ChatMessage> example = Example.of(chatMessageMapper.queryRequest2Entity(request.getQuery()), matcher);
Page<ChatMessage> page = chatMessageRepository.findAll(example, request.toPageable());
return page.map(chatMessageMapper::entity2Response);
}
public Boolean deleteChatMessage(List<String> ids) {
chatMessageRepository.deleteAllById(ids);
return true;
}
public void sendMessage(ChatMessageCreateRequest requestMessage, Principal principal) {
ChatSession chatSession = chatSessionRepository.findById(requestMessage.getSession().getId())
.orElseThrow(() -> new BusinessException(ResultCode.NotFindError));
ChatMessage chatMessage = chatMessageMapper.createRequest2Entity(requestMessage);
ChatConfig chatConfig = sendMessageService.checkConfig(principal);
OpenAiService openAIService = sendMessageService.createOpenAIService(chatConfig);
ChatCompletionRequest chatRequest = sendMessageService.createChatRequest(chatMessage, chatConfig);
sendMessageService.sendMessage(openAIService, chatRequest, chatMessage, chatSession, principal);
}
} | 5,753 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
SendMessageService.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/chatgpt-assistant-server/src/main/java/io/qifan/chatgpt/assistant/gpt/message/service/domainservice/SendMessageService.java | package io.qifan.chatgpt.assistant.gpt.message.service.domainservice;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.theokanning.openai.OpenAiApi;
import com.theokanning.openai.completion.chat.ChatCompletionRequest;
import com.theokanning.openai.service.OpenAiService;
import io.qifan.chatgpt.assistant.gpt.config.ChatConfig;
import io.qifan.chatgpt.assistant.gpt.message.ChatMessage;
import io.qifan.chatgpt.assistant.gpt.message.mapper.ChatMessageMapper;
import io.qifan.chatgpt.assistant.gpt.message.repository.ChatMessageRepository;
import io.qifan.chatgpt.assistant.gpt.session.ChatSession;
import io.qifan.chatgpt.assistant.gpt.session.repository.ChatSessionRepository;
import io.qifan.chatgpt.assistant.infrastructure.gpt.GPTProperty;
import io.qifan.infrastructure.common.constants.ResultCode;
import io.qifan.infrastructure.common.exception.BusinessException;
import lombok.AllArgsConstructor;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import okhttp3.OkHttpClient;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.messaging.simp.SimpMessagingTemplate;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import retrofit2.Retrofit;
import java.net.InetSocketAddress;
import java.net.Proxy;
import java.security.Principal;
import java.time.Duration;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import static com.theokanning.openai.service.OpenAiService.*;
@Service
@AllArgsConstructor
@Slf4j
public class SendMessageService {
private final ChatSessionRepository chatSessionRepository;
private final ChatMessageRepository chatMessageRepository;
private final MongoTemplate mongoTemplate;
private final GPTProperty gptProperty;
private final SimpMessagingTemplate messagingTemplate;
private final ChatMessageMapper chatMessageMapper;
/**
* 校验用户是否存在GPT配置以及GPT配置中是否已经配置了API Key
*
* @param principal 握手阶段得到的用户信息
* @return 该用户的GPT配置
*/
public ChatConfig checkConfig(Principal principal) {
log.info("GPT配置校验,当前用户:{}", principal);
ChatConfig chatConfig = Optional.ofNullable(mongoTemplate.findOne(Query.query(Criteria.where("createdBy.id")
.is(principal.getName())),
ChatConfig.class))
.orElseThrow(() -> new BusinessException(ResultCode.NotFindError,
"请配置API Key"));
if (!StringUtils.hasText(chatConfig.getApiKey())) {
throw new BusinessException(ResultCode.ValidateError, "请配置API Key");
}
log.info("GPT配置校验通过,配置内容:{}", chatConfig);
return chatConfig;
}
/**
* @param chatConfig 用户的GPT配置
* @return OpenAIService用于调用OpenAI接口
*/
public OpenAiService createOpenAIService(ChatConfig chatConfig) {
log.info("开始创建OpenAIService");
ObjectMapper mapper = defaultObjectMapper();
Proxy proxy = new Proxy(Proxy.Type.HTTP,
new InetSocketAddress(gptProperty.getProxy().getHost(),
gptProperty.getProxy().getPort()));
OkHttpClient client = defaultClient(chatConfig.getApiKey(), Duration.ofMinutes(1))
.newBuilder()
.proxy(proxy)
.build();
Retrofit retrofit = defaultRetrofit(client, mapper);
OpenAiApi api = retrofit.create(OpenAiApi.class);
return new OpenAiService(api);
}
/**
* 构造ChatGPT请求参数
*
* @param chatMessage 用户的发送内容
* @param chatConfig 用户的GPT配置信息
* @return 返回包含用户发送内容+配置信息的ChatGPT请求参数。
*/
public ChatCompletionRequest createChatRequest(ChatMessage chatMessage, ChatConfig chatConfig) {
List<ChatMessage> chatMessageList = mongoTemplate.find(Query.query(Criteria.where("session.id")
.is(chatMessage.getSession()
.getId())),
ChatMessage.class);
chatMessageList.add(chatMessage);
ChatCompletionRequest chatCompletionRequest = ChatCompletionRequest.builder()
.messages(chatMessageList.stream()
.map(chatMessageMapper::entityToMessage)
.collect(
Collectors.toList()))
.model(chatConfig.getModel().getName())
.presencePenalty(
chatConfig.getPresencePenalty())
.temperature(chatConfig.getTemperature())
.maxTokens(chatConfig.getMaxTokens())
.stream(true)
.build();
log.info("请求体:{}", chatCompletionRequest);
return chatCompletionRequest;
}
/**
* 向OpenAI发起ChatGPT请求,并将响应的结果推送给前端。
* @param openAiService 封装好的OpenAI的服务,调用就可以发起请求。
* @param chatCompletionRequest ChatGPT请求参数
* @param chatMessage 用户发送的消息内容
* @param chatSession 消息归属的会话
* @param principal 当前用户信息
*/
@SneakyThrows
public void sendMessage(OpenAiService openAiService,
ChatCompletionRequest chatCompletionRequest,
ChatMessage chatMessage,
ChatSession chatSession,
Principal principal) {
ChatSession.Statistic statistic = chatSession.getStatistic()
.plusChar(chatMessage.getContent().length())
.plusToken(chatMessage.getContent().length());
ChatMessage responseMessage = new ChatMessage().setContent("")
.setRole("assistant")
.setSession(chatSession);
openAiService.streamChatCompletion(chatCompletionRequest)
.doOnError(Throwable::printStackTrace)
.blockingForEach(chunk -> {
log.info(chunk.toString());
String text = chunk.getChoices().get(0).getMessage().getContent();
if (text == null) {
return;
}
statistic.plusToken(1)
.plusChar(text.length());
messagingTemplate.convertAndSendToUser(principal.getName(),
"/queue/chatMessage/receive",
text);
responseMessage.setContent(responseMessage.getContent() + text);
});
chatMessageRepository.save(chatMessage);
chatMessageRepository.save(responseMessage);
chatSessionRepository.save(chatSession);
}
}
| 8,399 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
ChatSession.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/chatgpt-assistant-server/src/main/java/io/qifan/chatgpt/assistant/gpt/session/ChatSession.java | package io.qifan.chatgpt.assistant.gpt.session;
import io.qifan.chatgpt.assistant.gpt.message.ChatMessage;
import io.qifan.chatgpt.assistant.user.User;
import io.qifan.infrastructure.common.entity.BaseEntity;
import io.qifan.infrastructure.common.mongo.ValidStatus;
import io.qifan.infrastructure.generator.core.GenEntity;
import io.qifan.infrastructure.generator.core.GenField;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.ReadOnlyProperty;
import org.springframework.data.mongodb.core.mapping.DBRef;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.DocumentReference;
import java.util.List;
@GenEntity
@Document
@Accessors(chain = true)
@Data
public class ChatSession extends BaseEntity {
private String topic;
private Statistic statistic;
@ReadOnlyProperty
@DocumentReference(lookup = "{'session.$id': ?#{#self._id}}")
@GenField(association = true, ignoreRequest = true)
private List<ChatMessage> messages;
@GenField(association = true, ignoreRequest = true)
@DBRef
@CreatedBy
private User createdBy;
@GenField(ignoreRequest = true)
private ValidStatus validStatus;
public void valid() {
setValidStatus(ValidStatus.VALID);
}
public void invalid() {
setValidStatus(ValidStatus.INVALID);
}
@Data
@AllArgsConstructor
@NoArgsConstructor
public static class Statistic {
private Integer charCount;
private Integer tokenCount;
public Statistic plusChar(Integer charCount) {
this.charCount += charCount;
return this;
}
public Statistic plusToken(Integer tokenCount) {
this.tokenCount += tokenCount;
return this;
}
}
} | 1,962 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
ChatSessionMapper.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/chatgpt-assistant-server/src/main/java/io/qifan/chatgpt/assistant/gpt/session/mapper/ChatSessionMapper.java | package io.qifan.chatgpt.assistant.gpt.session.mapper;
import io.qifan.chatgpt.assistant.gpt.message.ChatMessage;
import io.qifan.chatgpt.assistant.gpt.message.dto.response.ChatMessageCommonResponse;
import io.qifan.chatgpt.assistant.gpt.session.ChatSession;
import io.qifan.chatgpt.assistant.gpt.session.dto.request.ChatSessionCreateRequest;
import io.qifan.chatgpt.assistant.gpt.session.dto.request.ChatSessionQueryRequest;
import io.qifan.chatgpt.assistant.gpt.session.dto.request.ChatSessionUpdateRequest;
import io.qifan.chatgpt.assistant.gpt.session.dto.response.ChatSessionCommonResponse;
import io.qifan.chatgpt.assistant.infrastructure.mapper.CustomMapper;
import org.mapstruct.*;
@Mapper(
uses = {CustomMapper.class},
nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS,
nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE,
componentModel = MappingConstants.ComponentModel.SPRING
)
public interface ChatSessionMapper {
ChatSession createRequest2Entity(ChatSessionCreateRequest request);
ChatSession queryRequest2Entity(ChatSessionQueryRequest request);
ChatSession updateEntityFromUpdateRequest(ChatSessionUpdateRequest request, @MappingTarget ChatSession entity);
@Mapping(target = "messages", nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.SET_TO_DEFAULT)
ChatSessionCommonResponse entity2Response(ChatSession entity);
@Mapping(target = "session", ignore = true)
ChatMessageCommonResponse entityToResponse(ChatMessage chatMessage);
} | 1,559 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
ChatSessionUpdateRequest.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/chatgpt-assistant-server/src/main/java/io/qifan/chatgpt/assistant/gpt/session/dto/request/ChatSessionUpdateRequest.java | package io.qifan.chatgpt.assistant.gpt.session.dto.request;
import io.qifan.chatgpt.assistant.gpt.session.ChatSession.Statistic;
import io.qifan.infrastructure.common.model.BaseRequest;
import lombok.Data;
@Data
public class ChatSessionUpdateRequest extends BaseRequest {
private String topic;
private Statistic statistic;
} | 335 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
ChatSessionQueryRequest.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/chatgpt-assistant-server/src/main/java/io/qifan/chatgpt/assistant/gpt/session/dto/request/ChatSessionQueryRequest.java | package io.qifan.chatgpt.assistant.gpt.session.dto.request;
import io.qifan.chatgpt.assistant.gpt.session.ChatSession.Statistic;
import io.qifan.infrastructure.common.model.BaseRequest;
import lombok.Data;
@Data
public class ChatSessionQueryRequest extends BaseRequest {
private String topic;
private Statistic statistic;
} | 334 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
ChatSessionCreateRequest.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/chatgpt-assistant-server/src/main/java/io/qifan/chatgpt/assistant/gpt/session/dto/request/ChatSessionCreateRequest.java | package io.qifan.chatgpt.assistant.gpt.session.dto.request;
import io.qifan.chatgpt.assistant.gpt.session.ChatSession.Statistic;
import io.qifan.infrastructure.common.model.BaseRequest;
import lombok.Data;
@Data
public class ChatSessionCreateRequest extends BaseRequest {
private String topic;
private Statistic statistic;
} | 335 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
ChatSessionCommonResponse.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/chatgpt-assistant-server/src/main/java/io/qifan/chatgpt/assistant/gpt/session/dto/response/ChatSessionCommonResponse.java | package io.qifan.chatgpt.assistant.gpt.session.dto.response;
import io.qifan.chatgpt.assistant.gpt.message.dto.response.ChatMessageCommonResponse;
import io.qifan.chatgpt.assistant.gpt.session.ChatSession.Statistic;
import io.qifan.chatgpt.assistant.user.dto.response.UserCommonResponse;
import io.qifan.infrastructure.common.model.BaseResponse;
import io.qifan.infrastructure.common.mongo.ValidStatus;
import lombok.Data;
import java.util.List;
@Data
public class ChatSessionCommonResponse extends BaseResponse {
private String topic;
private Statistic statistic;
private List<ChatMessageCommonResponse> messages;
private UserCommonResponse createdBy;
private ValidStatus validStatus;
} | 711 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
ChatSessionRepository.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/chatgpt-assistant-server/src/main/java/io/qifan/chatgpt/assistant/gpt/session/repository/ChatSessionRepository.java | package io.qifan.chatgpt.assistant.gpt.session.repository;
import io.qifan.chatgpt.assistant.gpt.session.ChatSession;
import io.qifan.infrastructure.common.mongo.BaseRepository;
public interface ChatSessionRepository extends BaseRepository<ChatSession> {
}
| 259 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
ChatSessionController.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/chatgpt-assistant-server/src/main/java/io/qifan/chatgpt/assistant/gpt/session/controller/ChatSessionController.java | package io.qifan.chatgpt.assistant.gpt.session.controller;
import cn.dev33.satoken.annotation.SaCheckLogin;
import io.qifan.chatgpt.assistant.gpt.session.dto.request.ChatSessionCreateRequest;
import io.qifan.chatgpt.assistant.gpt.session.dto.request.ChatSessionQueryRequest;
import io.qifan.chatgpt.assistant.gpt.session.dto.request.ChatSessionUpdateRequest;
import io.qifan.chatgpt.assistant.gpt.session.dto.response.ChatSessionCommonResponse;
import io.qifan.chatgpt.assistant.gpt.session.service.ChatSessionService;
import io.qifan.infrastructure.common.model.QueryRequest;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@Slf4j
@AllArgsConstructor
@RequestMapping("chatSession")
@SaCheckLogin
public class ChatSessionController {
private final ChatSessionService chatSessionService;
@GetMapping("{id}")
public ChatSessionCommonResponse findById(@PathVariable String id) {
return chatSessionService.findById(id);
}
@PostMapping("create")
public String createChatSession(@RequestBody ChatSessionCreateRequest createRequest) {
return chatSessionService.createChatSession(createRequest);
}
@PostMapping("{id}/update")
public Boolean updateChatSession(@RequestBody ChatSessionUpdateRequest updateRequest, @PathVariable String id) {
chatSessionService.updateChatSession(updateRequest, id);
return true;
}
@PostMapping("{id}/valid")
public Boolean validChatSession(@PathVariable String id) {
chatSessionService.validChatSession(id);
return true;
}
@PostMapping("{id}/invalid")
public Boolean invalidChatSession(@PathVariable String id) {
chatSessionService.invalidChatSession(id);
return true;
}
@PostMapping("query")
public Page<ChatSessionCommonResponse> queryChatSession(
@RequestBody QueryRequest<ChatSessionQueryRequest> queryRequest) {
return chatSessionService.queryChatSession(queryRequest);
}
@PostMapping("delete")
public Boolean deleteChatSession(@RequestBody List<String> ids) {
return chatSessionService.deleteChatSession(ids);
}
} | 2,285 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
ChatSessionService.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/chatgpt-assistant-server/src/main/java/io/qifan/chatgpt/assistant/gpt/session/service/ChatSessionService.java | package io.qifan.chatgpt.assistant.gpt.session.service;
import cn.dev33.satoken.stp.StpUtil;
import io.qifan.chatgpt.assistant.gpt.session.ChatSession;
import io.qifan.chatgpt.assistant.gpt.session.dto.request.ChatSessionCreateRequest;
import io.qifan.chatgpt.assistant.gpt.session.dto.request.ChatSessionQueryRequest;
import io.qifan.chatgpt.assistant.gpt.session.dto.request.ChatSessionUpdateRequest;
import io.qifan.chatgpt.assistant.gpt.session.dto.response.ChatSessionCommonResponse;
import io.qifan.chatgpt.assistant.gpt.session.mapper.ChatSessionMapper;
import io.qifan.chatgpt.assistant.gpt.session.repository.ChatSessionRepository;
import io.qifan.chatgpt.assistant.user.User;
import io.qifan.infrastructure.common.constants.ResultCode;
import io.qifan.infrastructure.common.exception.BusinessException;
import io.qifan.infrastructure.common.model.QueryRequest;
import io.qifan.infrastructure.common.mongo.functional.EntityOperations;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.domain.Example;
import org.springframework.data.domain.ExampleMatcher;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Optional;
@Slf4j
@Service
@Transactional
@AllArgsConstructor
public class ChatSessionService {
private final ChatSessionRepository chatSessionRepository;
private final ChatSessionMapper chatSessionMapper;
public ChatSessionCommonResponse findById(String id) {
return chatSessionMapper.entity2Response(chatSessionRepository
.findById(id)
.orElseThrow(() -> new BusinessException(
ResultCode.NotFindError)));
}
public void updateChatSession(ChatSessionUpdateRequest request, String id) {
EntityOperations.doUpdate(chatSessionRepository)
.loadById(id)
.update(e -> {
chatSessionMapper.updateEntityFromUpdateRequest(request, e);
e.valid();
})
.successHook(e -> log.info("更新ChatSession:{}", e))
.execute();
}
public String createChatSession(ChatSessionCreateRequest request) {
Optional<ChatSession> chatSession = EntityOperations.doCreate(chatSessionRepository)
.create(() -> {
ChatSession request2Entity = chatSessionMapper.createRequest2Entity(
request);
request2Entity.setTopic("新的聊天");
request2Entity.setStatistic(new ChatSession.Statistic(0,
0));
return request2Entity;
})
.update(ChatSession::valid)
.successHook(e -> {
log.info("创建ChatSession:{}", e);
})
.execute();
return chatSession.map(ChatSession::getId).orElse(null);
}
public void validChatSession(String id) {
EntityOperations.doUpdate(chatSessionRepository)
.loadById(id)
.update(ChatSession::valid)
.successHook(e -> log.info("生效ChatSession:{}", e))
.execute();
}
public void invalidChatSession(String id) {
EntityOperations.doUpdate(chatSessionRepository)
.loadById(id)
.update(ChatSession::invalid)
.successHook(e -> log.info("失效ChatSession:{}", e))
.execute();
}
public Page<ChatSessionCommonResponse> queryChatSession(QueryRequest<ChatSessionQueryRequest> request) {
ExampleMatcher matcher = ExampleMatcher.matchingAll();
ChatSession chatSession = chatSessionMapper.queryRequest2Entity(request.getQuery());
User user = new User();
user.setId(StpUtil.getLoginIdAsString());
chatSession.setCreatedBy(user);
Example<ChatSession> example = Example.of(chatSession, matcher);
Page<ChatSession> page = chatSessionRepository.findAll(example, request.toPageable());
return page.map(chatSessionMapper::entity2Response);
}
public Boolean deleteChatSession(List<String> ids) {
chatSessionRepository.deleteAllById(ids);
return true;
}
} | 5,253 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
OSSUploadServiceImpl.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/chatgpt-assistant-server/src/main/java/io/qifan/chatgpt/assistant/upload/OSSUploadServiceImpl.java | package io.qifan.chatgpt.assistant.upload;
import io.qifan.chatgpt.assistant.infrastructure.oss.OSSUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
@Service
public class OSSUploadServiceImpl implements UploadService {
@Autowired
OSSUtils ossUtils;
@Override
public String upload(MultipartFile multipartFile) throws IOException {
String filename = multipartFile.getOriginalFilename();
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
String objectName = sdf.format(new Date()) + filename;
return ossUtils.basicUpload("my-community/" + objectName, multipartFile.getInputStream());
}
@Override
public String uploadByPath(MultipartFile multipartFile, String path) throws IOException {
String filename = multipartFile.getOriginalFilename();
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
String objectName = path + "/" + sdf.format(new Date()) + filename;
return ossUtils.basicUpload(objectName, multipartFile.getInputStream());
}
@Override
public boolean delete(String url) {
return true;
}
// @Override
// public int delete(String url) {
// url = url.replace("/resource/", "");
// String[] splits = url.split("/");
// StringBuilder filename1 = new StringBuilder();
// for (int i = 0; i <= splits.length - 1; i++) {
// filename1.append("/").append(splits[i]);
// }
// String filename2 = filename1.substring(1, filename1.length());
// oss.deleteObject(ossInfo.getBucketName(), filename2);
// return 1;
// }
}
| 1,846 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
UploadService.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/chatgpt-assistant-server/src/main/java/io/qifan/chatgpt/assistant/upload/UploadService.java | package io.qifan.chatgpt.assistant.upload;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
public interface UploadService {
String upload(MultipartFile multipartFile) throws IOException;
String uploadByPath(MultipartFile multipartFile, String path) throws IOException;
boolean delete(String url);
} | 351 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
UploadController.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/chatgpt-assistant-server/src/main/java/io/qifan/chatgpt/assistant/upload/UploadController.java | package io.qifan.chatgpt.assistant.upload;
import io.qifan.infrastructure.common.constants.ResultCode;
import io.qifan.infrastructure.common.exception.BusinessException;
import io.qifan.infrastructure.common.model.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping("/upload")
@Slf4j
public class UploadController {
@Autowired
OSSUploadServiceImpl uploadService;
/**
* 上传图片到阿里云oss得到url返回给前端
*/
@PostMapping("/upload")
public R<Map<String, String>> uploadImg(@RequestParam Map<String, MultipartFile> files, String path) {
List<String> arrayList = new ArrayList<>();
files.forEach((String key, MultipartFile file) -> {
try {
log.info(key);
String url = uploadService.upload(file);
arrayList.add(url);
} catch (Exception e) {
throw new BusinessException(ResultCode.TransferStatusError, "上传失败");
}
});
String join = String.join(";", arrayList);
Map<String, String> urlMap = new HashMap<>();
urlMap.put("url", join);
return R.ok(urlMap);
}
}
| 1,654 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
User.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/chatgpt-assistant-server/src/main/java/io/qifan/chatgpt/assistant/user/User.java | package io.qifan.chatgpt.assistant.user;
import io.qifan.infrastructure.common.entity.BaseEntity;
import io.qifan.infrastructure.common.mongo.ValidStatus;
import io.qifan.infrastructure.generator.core.GenEntity;
import io.qifan.infrastructure.generator.core.GenField;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.data.mongodb.core.mapping.Document;
@EqualsAndHashCode(callSuper = true)
@GenEntity
@Document
@Accessors(chain = true)
@Data
public class User extends BaseEntity {
private String avatar;
private String nickname;
private String username;
private String password;
@GenField(ignoreRequest = true)
private ValidStatus validStatus;
public void valid() {
setValidStatus(ValidStatus.VALID);
}
public void invalid() {
setValidStatus(ValidStatus.INVALID);
}
} | 897 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
UserMapper.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/chatgpt-assistant-server/src/main/java/io/qifan/chatgpt/assistant/user/mapper/UserMapper.java | package io.qifan.chatgpt.assistant.user.mapper;
import io.qifan.chatgpt.assistant.infrastructure.mapper.CustomMapper;
import io.qifan.chatgpt.assistant.user.User;
import io.qifan.chatgpt.assistant.user.dto.request.UserCreateRequest;
import io.qifan.chatgpt.assistant.user.dto.request.UserQueryRequest;
import io.qifan.chatgpt.assistant.user.dto.request.UserUpdateRequest;
import io.qifan.chatgpt.assistant.user.dto.response.UserCommonResponse;
import org.mapstruct.*;
@Mapper(
uses = {CustomMapper.class},
nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS,
nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE,
componentModel = MappingConstants.ComponentModel.SPRING
)
public interface UserMapper {
User createRequest2Entity(UserCreateRequest request);
User queryRequest2Entity(UserQueryRequest request);
User updateEntityFromUpdateRequest(UserUpdateRequest request, @MappingTarget User entity);
UserCommonResponse entity2Response(User entity);
} | 1,027 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
UserCreateRequest.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/chatgpt-assistant-server/src/main/java/io/qifan/chatgpt/assistant/user/dto/request/UserCreateRequest.java | package io.qifan.chatgpt.assistant.user.dto.request;
import io.qifan.infrastructure.common.model.BaseRequest;
import lombok.Data;
@Data
public class UserCreateRequest extends BaseRequest {
private String avatar;
private String nickname;
private String username;
private String password;
} | 306 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
UserUpdateRequest.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/chatgpt-assistant-server/src/main/java/io/qifan/chatgpt/assistant/user/dto/request/UserUpdateRequest.java | package io.qifan.chatgpt.assistant.user.dto.request;
import io.qifan.infrastructure.common.model.BaseRequest;
import lombok.Data;
@Data
public class UserUpdateRequest extends BaseRequest {
private String avatar;
private String nickname;
} | 248 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
UserQueryRequest.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/chatgpt-assistant-server/src/main/java/io/qifan/chatgpt/assistant/user/dto/request/UserQueryRequest.java | package io.qifan.chatgpt.assistant.user.dto.request;
import io.qifan.infrastructure.common.model.BaseRequest;
import lombok.Data;
@Data
public class UserQueryRequest extends BaseRequest {
private String avatar;
private String nickname;
private String username;
private String password;
} | 305 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
UserCommonResponse.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/chatgpt-assistant-server/src/main/java/io/qifan/chatgpt/assistant/user/dto/response/UserCommonResponse.java | package io.qifan.chatgpt.assistant.user.dto.response;
import io.qifan.infrastructure.common.model.BaseResponse;
import io.qifan.infrastructure.common.mongo.ValidStatus;
import lombok.Data;
@Data
public class UserCommonResponse extends BaseResponse {
private String avatar;
private String nickname;
private String username;
private String password;
private ValidStatus validStatus;
} | 405 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
UserRepository.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/chatgpt-assistant-server/src/main/java/io/qifan/chatgpt/assistant/user/repository/UserRepository.java | package io.qifan.chatgpt.assistant.user.repository;
import io.qifan.chatgpt.assistant.user.User;
import io.qifan.infrastructure.common.mongo.BaseRepository;
public interface UserRepository extends BaseRepository<User> {
}
| 224 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
UserController.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/chatgpt-assistant-server/src/main/java/io/qifan/chatgpt/assistant/user/controller/UserController.java | package io.qifan.chatgpt.assistant.user.controller;
import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.dev33.satoken.stp.SaTokenInfo;
import io.qifan.chatgpt.assistant.user.dto.request.UserCreateRequest;
import io.qifan.chatgpt.assistant.user.dto.request.UserQueryRequest;
import io.qifan.chatgpt.assistant.user.dto.request.UserUpdateRequest;
import io.qifan.chatgpt.assistant.user.dto.response.UserCommonResponse;
import io.qifan.chatgpt.assistant.user.service.UserService;
import io.qifan.infrastructure.common.model.QueryRequest;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@Slf4j
@AllArgsConstructor
@RequestMapping("user")
public class UserController {
private final UserService userService;
@SaCheckLogin
@GetMapping("{id}")
public UserCommonResponse findById(@PathVariable String id) {
return userService.findById(id);
}
@PostMapping("create")
public String createUser(@RequestBody UserCreateRequest createRequest) {
return userService.createUser(createRequest);
}
@PostMapping("{id}/update")
public Boolean updateUser(@RequestBody UserUpdateRequest updateRequest, @PathVariable String id) {
userService.updateUser(updateRequest, id);
return true;
}
@PostMapping("{id}/valid")
public Boolean validUser(@PathVariable String id) {
userService.validUser(id);
return true;
}
@PostMapping("{id}/invalid")
public Boolean invalidUser(@PathVariable String id) {
userService.invalidUser(id);
return true;
}
@PostMapping("query")
public Page<UserCommonResponse> queryUser(
@RequestBody QueryRequest<UserQueryRequest> queryRequest) {
return userService.queryUser(queryRequest);
}
@PostMapping("delete")
public Boolean deleteUser(@RequestBody List<String> ids) {
return userService.deleteUser(ids);
}
@PostMapping("login")
public SaTokenInfo login(@RequestBody UserCreateRequest request) {
return userService.login(request);
}
@GetMapping("info")
@SaCheckLogin
public UserCommonResponse userInfo() {
return userService.getUserInfo();
}
} | 2,338 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
UserService.java | /FileExtraction/Java_unseen/qifan777_chatgpt-assistant/chatgpt-assistant-server/src/main/java/io/qifan/chatgpt/assistant/user/service/UserService.java | package io.qifan.chatgpt.assistant.user.service;
import cn.dev33.satoken.secure.BCrypt;
import cn.dev33.satoken.stp.SaTokenInfo;
import cn.dev33.satoken.stp.StpUtil;
import io.qifan.chatgpt.assistant.user.User;
import io.qifan.chatgpt.assistant.user.dto.request.UserCreateRequest;
import io.qifan.chatgpt.assistant.user.dto.request.UserQueryRequest;
import io.qifan.chatgpt.assistant.user.dto.request.UserUpdateRequest;
import io.qifan.chatgpt.assistant.user.dto.response.UserCommonResponse;
import io.qifan.chatgpt.assistant.user.mapper.UserMapper;
import io.qifan.chatgpt.assistant.user.repository.UserRepository;
import io.qifan.infrastructure.common.constants.ResultCode;
import io.qifan.infrastructure.common.exception.BusinessException;
import io.qifan.infrastructure.common.model.QueryRequest;
import io.qifan.infrastructure.common.mongo.functional.EntityOperations;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.domain.Example;
import org.springframework.data.domain.ExampleMatcher;
import org.springframework.data.domain.Page;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Optional;
@Slf4j
@Service
@Transactional
@AllArgsConstructor
public class UserService {
private final UserRepository userRepository;
private final UserMapper userMapper;
private final MongoTemplate mongoTemplate;
public UserCommonResponse findById(String id) {
return userMapper.entity2Response(userRepository
.findById(id)
.orElseThrow(() -> new BusinessException(
ResultCode.NotFindError)));
}
public void updateUser(UserUpdateRequest request, String id) {
EntityOperations.doUpdate(userRepository)
.loadById(id)
.update(e -> {
userMapper.updateEntityFromUpdateRequest(request, e);
e.valid();
})
.successHook(e -> log.info("更新User:{}", e))
.execute();
}
public String createUser(UserCreateRequest request) {
Optional<User> user = EntityOperations.doCreate(userRepository)
.create(() -> userMapper.createRequest2Entity(
request))
.update(User::valid)
.successHook(e -> {
log.info("创建User:{}", e);
})
.execute();
return user.map(User::getId).orElse(null);
}
public void validUser(String id) {
EntityOperations.doUpdate(userRepository)
.loadById(id)
.update(User::valid)
.successHook(e -> log.info("生效User:{}", e))
.execute();
}
public void invalidUser(String id) {
EntityOperations.doUpdate(userRepository)
.loadById(id)
.update(User::invalid)
.successHook(e -> log.info("失效User:{}", e))
.execute();
}
public Page<UserCommonResponse> queryUser(QueryRequest<UserQueryRequest> request) {
ExampleMatcher matcher = ExampleMatcher.matchingAll();
Example<User> example = Example.of(userMapper.queryRequest2Entity(request.getQuery()), matcher);
Page<User> page = userRepository.findAll(example, request.toPageable());
return page.map(userMapper::entity2Response);
}
public Boolean deleteUser(List<String> ids) {
userRepository.deleteAllById(ids);
return true;
}
public SaTokenInfo login(UserCreateRequest request) {
// 用户可能存在
Optional<User> optionalUser = Optional.ofNullable(mongoTemplate.findOne(Query.query(Criteria.where("username")
.is(request.getUsername())),
User.class));
// 现在得到的user一定存在,因为不存在已经走了这个创建的流程。
User user = optionalUser.orElseGet(() -> {
User request2Entity = userMapper.createRequest2Entity(request);
request2Entity.setPassword(BCrypt.hashpw(request.getPassword()));
return userRepository.save(request2Entity);
});
if (!BCrypt.checkpw(request.getPassword(), user.getPassword())) {
throw new BusinessException(ResultCode.ValidateError, "密码校验失败");
}
StpUtil.login(user.getId());
return StpUtil.getTokenInfo();
}
public UserCommonResponse getUserInfo() {
return userRepository.findById(StpUtil.getLoginIdAsString())
.map(userMapper::entity2Response)
.orElseThrow(() -> new BusinessException(ResultCode.NotFindError,
"用户不存在"));
}
} | 5,664 | Java | .java | qifan777/chatgpt-assistant | 39 | 8 | 0 | 2023-05-31T05:33:12Z | 2024-03-19T14:14:35Z |
Options.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/org/rtv/Options.java | package org.rtv;
import java.awt.*;
import java.util.HashMap;
import java.util.LinkedHashMap;
public class Options {
private static Options opt = null;
private static LinkedHashMap<String, Color> seriesMainOracle;
private static LinkedHashMap<String, Color> seriesMainPg;
private static HashMap<String, Color> seriesNameColorAll;
/** Oracle */
public static final String LBL_CPU = "CPU used";
public static final String LBL_SCHEDULER = "Scheduler";
public static final String LBL_USERIO = "User I/O";
public static final String LBL_SYSTEMIO = "System I/O";
public static final String LBL_CONCURRENCY = "Concurrency";
public static final String LBL_APPLICATION = "Application";
public static final String LBL_COMMIT = "Commit";
public static final String LBL_CONFIGURATION = "Configuration";
public static final String LBL_ADMINISTRATIVE = "Administrative";
public static final String LBL_NETWORK = "Network";
public static final String LBL_QUEUEING = "Queueing";
public static final String LBL_CLUSTER = "Cluster";
public static final String LBL_OTHER = "Other";
public static final String LBL_IDLE = "Idle";
/** Oracle */
/** PG */
public static final String LBL_PG_CPU = "CPU";
public static final String LBL_PG_IO = "IO";
public static final String LBL_PG_LOCK = "Lock";
public static final String LBL_PG_LWLOCK = "LWLock";
public static final String LBL_PG_BUFFERPIN = "BufferPin";
public static final String LBL_PG_ACTIVITY = "Acitvity";
public static final String LBL_PG_EXTENSION = "Extension";
public static final String LBL_PG_CLIENT = "Client";
public static final String LBL_PG_IPC = "IPC";
public static final String LBL_PG_TIMEOUT = "Timeout";
/** PG */
public static Options getInstance() {
if (opt==null) {
opt = new Options();
seriesMainOracle = new LinkedHashMap<>();
seriesMainPg = new LinkedHashMap<>();
loadTopActivityColorOracle();
loadTopActivityColorPG();
seriesNameColorAll = new HashMap<>();
loadTopActivityDetailColor();
}
return opt;
}
/** Oracle main color */
public static LinkedHashMap<String, Color> getOracleMainColor() { return seriesMainOracle; }
/** PG main color */
public static LinkedHashMap<String, Color> getPgMainColor(){ return seriesMainPg; }
/** Contains all main and detail colors (oracle, pg too)*/
public static Color getColor(String eventName){
return seriesNameColorAll.containsKey(eventName) ? seriesNameColorAll.get(eventName) : new Color(100,100,100);
}
protected static void loadTopActivityColorOracle(){
seriesMainOracle.put(LBL_CPU,new Color(0,179,0));
seriesMainOracle.put(LBL_SCHEDULER, new Color(133,255,133));
seriesMainOracle.put(LBL_USERIO, new Color(0,46,230));
seriesMainOracle.put(LBL_SYSTEMIO, new Color(0,161,230));
seriesMainOracle.put(LBL_CONCURRENCY, new Color(153,51,51));
seriesMainOracle.put(LBL_APPLICATION, new Color(194,71,71));
seriesMainOracle.put(LBL_COMMIT, new Color(194,133,71));
seriesMainOracle.put(LBL_CONFIGURATION, new Color(84,56,28));
seriesMainOracle.put(LBL_ADMINISTRATIVE, new Color(84,84,29));
seriesMainOracle.put(LBL_NETWORK, new Color(156,157,108));
seriesMainOracle.put(LBL_QUEUEING, new Color(117,117,117));//cluster
seriesMainOracle.put(LBL_CLUSTER, new Color(232,232,232));//que
seriesMainOracle.put(LBL_OTHER, new Color(255,87,143));
seriesMainOracle.put(LBL_IDLE, new Color(100,100,100));
}
protected static void loadTopActivityColorPG(){
seriesMainPg.put(LBL_PG_CPU,new Color(0,204,0));
seriesMainPg.put(LBL_PG_IO,new Color(0,74,231));
seriesMainPg.put(LBL_PG_LOCK,new Color(192,40,0));
seriesMainPg.put(LBL_PG_LWLOCK,new Color(139,26,0));
seriesMainPg.put(LBL_PG_BUFFERPIN,new Color(0,161,230));
seriesMainPg.put(LBL_PG_ACTIVITY,new Color(255,165,0));
seriesMainPg.put(LBL_PG_EXTENSION,new Color(0,123,20));
seriesMainPg.put(LBL_PG_CLIENT,new Color(159,147,113));
seriesMainPg.put(LBL_PG_IPC,new Color(240,110,170));
seriesMainPg.put(LBL_PG_TIMEOUT,new Color(84,56,28));
}
protected static void loadTopActivityDetailColor(){
try {
/** Loading */
// Queueing
seriesNameColorAll.put("Streams AQ: enqueue blocked on low memory",new Color(227,38,54));
seriesNameColorAll.put("Streams capture: resolve low memory condition",new Color(55,191,0));
seriesNameColorAll.put("Streams capture: waiting for subscribers to catch up",new Color(153,102,204));
seriesNameColorAll.put("Streams AQ: enqueue blocked due to flow control",new Color(123,160,91));
// User I/O
seriesNameColorAll.put("Shared IO Pool IO Completion",new Color(0,255,255));
seriesNameColorAll.put("local write wait",new Color(127,255,212));
seriesNameColorAll.put("buffer read retry",new Color(0,127,255));
seriesNameColorAll.put("read by other session",new Color(0,149,182));
seriesNameColorAll.put("db file sequential read",new Color(181,166,66));
seriesNameColorAll.put("db file scattered read",new Color(204,85,0));
seriesNameColorAll.put("db file single write",new Color(102,255,0));
seriesNameColorAll.put("db file parallel read",new Color(0,0,255));
seriesNameColorAll.put("direct path read",new Color(205,0,50));
seriesNameColorAll.put("direct path read temp",new Color(205,0,100));
seriesNameColorAll.put("direct path write",new Color(0,220,50));
seriesNameColorAll.put("direct path write temp",new Color(0,255,100));
seriesNameColorAll.put("Intelligent Storage OSS I/O completion",new Color(204,85,0));
seriesNameColorAll.put("securefile direct-read completion",new Color(233,116,81));
seriesNameColorAll.put("securefile direct-write completion",new Color(138,51,36));
seriesNameColorAll.put("BFILE read",new Color(120,134,107));
seriesNameColorAll.put("dbverify reads",new Color(196,30,58));
seriesNameColorAll.put("Log file init write",new Color(150,0,24));
seriesNameColorAll.put("Data file init write",new Color(237,145,33));
seriesNameColorAll.put("DG Broker configuration file I/O",new Color(172,225,175));
seriesNameColorAll.put("Datapump dump file I/O",new Color(222,49,99));
seriesNameColorAll.put("dbms_file_transfer I/O",new Color(0,123,167));
// Other
seriesNameColorAll.put("null event",new Color(22,82,190));
seriesNameColorAll.put("events in waitclass Other",new Color(127,255,0));
seriesNameColorAll.put("enq: WM - WLM Plan activation",new Color(205,92,92));
seriesNameColorAll.put("latch free",new Color(210,105,30));
seriesNameColorAll.put("unspecified wait event",new Color(123,63,0));
seriesNameColorAll.put("latch activity",new Color(0,71,171));
seriesNameColorAll.put("wait list latch activity",new Color(184,115,51));
seriesNameColorAll.put("wait list latch free",new Color(255,127,80));
seriesNameColorAll.put("kslwait unit test event 1",new Color(251,236,93));
seriesNameColorAll.put("kslwait unit test event 2",new Color(100,149,237));
seriesNameColorAll.put("kslwait unit test event 3",new Color(255,253,208));
seriesNameColorAll.put("global enqueue expand wait",new Color(220,20,60));
seriesNameColorAll.put("free process state object",new Color(0,255,255));
seriesNameColorAll.put("inactive session",new Color(101,67,33));
seriesNameColorAll.put("process terminate",new Color(8,69,126));
seriesNameColorAll.put("latch: session allocation",new Color(152,105,96));
seriesNameColorAll.put("check CPU wait times",new Color(205,91,69));
seriesNameColorAll.put("enq: CI - contention",new Color(184,134,11));
seriesNameColorAll.put("enq: PR - contention",new Color(1,50,32));
seriesNameColorAll.put("ksim generic wait event",new Color(49,0,98));
seriesNameColorAll.put("debugger command",new Color(189,183,107));
seriesNameColorAll.put("ksdxexeother",new Color(85,104,50));
seriesNameColorAll.put("ksdxexeotherwait",new Color(3,192,60));
seriesNameColorAll.put("enq: PE - contention",new Color(255,218,185));
seriesNameColorAll.put("enq: PG - contention",new Color(231,84,128));
seriesNameColorAll.put("ksbsrv",new Color(233,150,122));
seriesNameColorAll.put("ksbcic",new Color(86,3,25));
seriesNameColorAll.put("process startup",new Color(47,79,79));
seriesNameColorAll.put("process shutdown",new Color(23,114,69));
seriesNameColorAll.put("prior spawner clean up",new Color(145,129,81));
seriesNameColorAll.put("latch: messages",new Color(255,168,18));
seriesNameColorAll.put("rdbms ipc message block",new Color(186,219,173));
seriesNameColorAll.put("rdbms ipc reply",new Color(17,96,98));
seriesNameColorAll.put("latch: enqueue hash chains",new Color(66,49,137));
seriesNameColorAll.put("enq: FP - global fob contention",new Color(21,96,189));
seriesNameColorAll.put("enq: RE - block repair contention",new Color(30,144,255));
seriesNameColorAll.put("imm op",new Color(80,200,120));
seriesNameColorAll.put("slave exit",new Color(153,0,102));
seriesNameColorAll.put("enq: KM - contention",new Color(79,121,66));
seriesNameColorAll.put("enq: KT - contention",new Color(238,220,130));
seriesNameColorAll.put("enq: CA - contention",new Color(255,0,255));
seriesNameColorAll.put("reliable message",new Color(228,155,15));
seriesNameColorAll.put("broadcast mesg queue transition",new Color(255,215,0));
seriesNameColorAll.put("broadcast mesg recovery queue transition",new Color(218,165,32));
seriesNameColorAll.put("master exit",new Color(70,89,69));
seriesNameColorAll.put("ksv slave avail wait",new Color(202,218,186));
seriesNameColorAll.put("enq: PV - syncstart",new Color(0,255,0));
seriesNameColorAll.put("enq: PV - syncshut",new Color(173,255,47));
seriesNameColorAll.put("IPC send completion sync",new Color(0,125,255));
seriesNameColorAll.put("OSD IPC library",new Color(223,115,255));
seriesNameColorAll.put("IPC wait for name service busy",new Color(252,15,192));
seriesNameColorAll.put("IPC busy async request",new Color(75,0,130));
seriesNameColorAll.put("IPC waiting for OSD resources",new Color(255,79,0));
seriesNameColorAll.put("ksxr poll remote instances",new Color(0,168,107));
seriesNameColorAll.put("ksxr wait for mount shared",new Color(195,176,145));
seriesNameColorAll.put("DBMS_LDAP: LDAP operation ",new Color(58,117,196));
seriesNameColorAll.put("wait for FMON to come up",new Color(230,230,250));
seriesNameColorAll.put("enq: FM - contention",new Color(255,240,245));
seriesNameColorAll.put("enq: XY - contention",new Color(253,233,16));
seriesNameColorAll.put("set director factor wait",new Color(255,250,205));
seriesNameColorAll.put("enq: AS - service activation",new Color(205,133,63));
seriesNameColorAll.put("enq: PD - contention",new Color(200,162,200));
seriesNameColorAll.put("cleanup of aborted process",new Color(204,255,0));
seriesNameColorAll.put("enq: RU - contention",new Color(250,240,230));
seriesNameColorAll.put("enq: RU - waiting",new Color(255,0,255));
seriesNameColorAll.put("rolling migration: cluster quiesce",new Color(11,218,81));
seriesNameColorAll.put("LMON global data update",new Color(128,0,0));
seriesNameColorAll.put("enq: MX - sync storage server info",new Color(153,51,102));
seriesNameColorAll.put("storage device registration",new Color(0,51,102));
seriesNameColorAll.put("latch: ges resource hash list",new Color(152,255,152));
seriesNameColorAll.put("DFS lock handle",new Color(173,223,173));
seriesNameColorAll.put("ges LMD to shutdown",new Color(153,122,141));
seriesNameColorAll.put("ges global resource directory to be frozen",new Color(255,219,88));
seriesNameColorAll.put("ges resource directory to be unfrozen",new Color(255,222,173));
seriesNameColorAll.put("gcs resource directory to be unfrozen",new Color(0,0,128));
seriesNameColorAll.put("ges LMD to inherit communication channels",new Color(204,119,34));
seriesNameColorAll.put("ges wait for lmon to be ready",new Color(207,181,59));
seriesNameColorAll.put("ges cgs registration",new Color(128,128,0));
seriesNameColorAll.put("wait for master scn",new Color(107,142,35));
seriesNameColorAll.put("ges reconfiguration to start",new Color(255,165,0));
seriesNameColorAll.put("ges2 proc latch in rm latch get 1",new Color(218,112,214));
seriesNameColorAll.put("ges2 proc latch in rm latch get 2",new Color(175,238,238));
seriesNameColorAll.put("ges lmd/lmses to freeze in rcfg - mrcvr",new Color(152,118,84));
seriesNameColorAll.put("ges lmd/lmses to unfreeze in rcfg - mrcvr",new Color(175,64,53));
seriesNameColorAll.put("ges LMON to join CGS group",new Color(221,173,175));
seriesNameColorAll.put("ges pmon to exit",new Color(171,205,239));
seriesNameColorAll.put("ges lmd and pmon to attach",new Color(249,132,229));
seriesNameColorAll.put("gcs drm freeze begin",new Color(153,102,102));
seriesNameColorAll.put("gcs remastering wait for write latch",new Color(250,218,221));
seriesNameColorAll.put("gcs remastering wait for read latch",new Color(219,112,147));
seriesNameColorAll.put("ges cached resource cleanup",new Color(218,189,171));
seriesNameColorAll.put("ges generic event",new Color(199,252,236));
seriesNameColorAll.put("ges retry query node",new Color(255,239,213));
seriesNameColorAll.put("ges process with outstanding i/o",new Color(119,221,119));
seriesNameColorAll.put("ges user error",new Color(255,209,220));
seriesNameColorAll.put("ges enter server mode",new Color(255,229,180));
seriesNameColorAll.put("gcs enter server mode",new Color(255,204,153));
seriesNameColorAll.put("gcs drm freeze in enter server mode",new Color(250,223,173));
seriesNameColorAll.put("gcs ddet enter server mode",new Color(209,226,49));
seriesNameColorAll.put("ges cancel",new Color(204,204,255));
seriesNameColorAll.put("ges resource cleanout during enqueue open",new Color(102,0,255));
seriesNameColorAll.put("ges resource cleanout during enqueue open-cvt",new Color(1,121,111));
seriesNameColorAll.put("ges master to get established for SCN op",new Color(255,192,203));
seriesNameColorAll.put("ges LMON to get to FTDONE ",new Color(255,153,102));
seriesNameColorAll.put("ges1 LMON to wake up LMD - mrcvr",new Color(102,0,102));
seriesNameColorAll.put("ges2 LMON to wake up LMD - mrcvr",new Color(0,51,153));
seriesNameColorAll.put("ges2 LMON to wake up lms - mrcvr 2",new Color(204,136,153));
seriesNameColorAll.put("ges2 LMON to wake up lms - mrcvr 3",new Color(0,49,83));
seriesNameColorAll.put("ges inquiry response",new Color(255,117,24));
seriesNameColorAll.put("ges reusing os pid",new Color(102,0,153));
seriesNameColorAll.put("ges LMON for send queues",new Color(115,74,18));
seriesNameColorAll.put("ges LMD suspend for testing event",new Color(255,0,0));
seriesNameColorAll.put("ges performance test completion",new Color(199,21,133));
seriesNameColorAll.put("kjbopen wait for recovery domain attach",new Color(0,204,204));
seriesNameColorAll.put("kjudomatt wait for recovery domain attach",new Color(65,105,225));
seriesNameColorAll.put("kjudomdet wait for recovery domain detach",new Color(117,90,87));
seriesNameColorAll.put("kjbdomalc allocate recovery domain - retry",new Color(183,65,14));
seriesNameColorAll.put("kjbdrmcvtq lmon drm quiesce: ping completion",new Color(255,153,0));
seriesNameColorAll.put("ges RMS0 retry add redo log",new Color(244,196,48));
seriesNameColorAll.put("readable standby redo apply remastering",new Color(8,37,103));
seriesNameColorAll.put("KJC: Wait for msg sends to complete",new Color(255,140,105));
seriesNameColorAll.put("kjctssqmg: quick message send wait",new Color(244,164,96));
seriesNameColorAll.put("kjctcisnd: Queue/Send client message",new Color(146,0,10));
seriesNameColorAll.put("gcs domain validation",new Color(255,36,0));
seriesNameColorAll.put("latch: gcs resource hash",new Color(255,216,0));
seriesNameColorAll.put("affinity expansion in replay",new Color(46,139,87));
seriesNameColorAll.put("wait for sync ack",new Color(255,245,238));
seriesNameColorAll.put("wait for verification ack",new Color(255,186,0));
seriesNameColorAll.put("wait for assert messages to be sent",new Color(112,66,20));
seriesNameColorAll.put("wait for scn ack",new Color(192,192,192));
seriesNameColorAll.put("lms flush message acks",new Color(112,128,144));
seriesNameColorAll.put("name-service call wait",new Color(0,255,127));
seriesNameColorAll.put("CGS wait for IPC msg",new Color(70,130,180));
seriesNameColorAll.put("kjxgrtest",new Color(172,183,142));
seriesNameColorAll.put("wait for tmc2 to complete",new Color(210,180,140));
seriesNameColorAll.put("wait for votes",new Color(205,87,0));
seriesNameColorAll.put("wait for rr lock release",new Color(255,204,0));
seriesNameColorAll.put("wait for message ack",new Color(208,240,192));
seriesNameColorAll.put("wait for record update",new Color(0,128,128));
seriesNameColorAll.put("wait for membership synchronization",new Color(216,191,216));
seriesNameColorAll.put("wait for split-brain resolution",new Color(48,213,200));
seriesNameColorAll.put("wait for IMR CSS join retry",new Color(18,10,143));
seriesNameColorAll.put("CGS skgxn join retry",new Color(255,77,0));
seriesNameColorAll.put("gcs to be enabled",new Color(139,0,255));
seriesNameColorAll.put("gcs log flush sync",new Color(153,17,153));
seriesNameColorAll.put("SGA: allocation forcing component growth",new Color(64,130,109));
seriesNameColorAll.put("SGA: sga_target resize",new Color(245,222,179));
seriesNameColorAll.put("control file heartbeat",new Color(201,160,220));
seriesNameColorAll.put("control file diagnostic dump",new Color(255,255,0));
seriesNameColorAll.put("enq: CF - contention",new Color(235,194,175));
seriesNameColorAll.put("enq: SW - contention",new Color(227,38,54));
seriesNameColorAll.put("enq: DS - contention",new Color(255,191,0));
seriesNameColorAll.put("enq: TC - contention",new Color(153,102,204));
seriesNameColorAll.put("enq: TC - contention2",new Color(123,160,91));
seriesNameColorAll.put("buffer exterminate",new Color(0,255,255));
seriesNameColorAll.put("buffer resize",new Color(127,255,212));
seriesNameColorAll.put("latch: cache buffers lru chain",new Color(0,189,255));
seriesNameColorAll.put("enq: PW - perwarm status in dbw0",new Color(245,245,220));
seriesNameColorAll.put("latch: checkpoint queue latch",new Color(61,43,31));
seriesNameColorAll.put("latch: cache buffer handles",new Color(0,0,255));
seriesNameColorAll.put("kcbzps",new Color(0,149,182));
seriesNameColorAll.put("buffer deadlock",new Color(181,166,66));
seriesNameColorAll.put("buffer latch",new Color(102,255,0));
seriesNameColorAll.put("cr request retry",new Color(8,232,222));
seriesNameColorAll.put("writes stopped by instance recovery or database suspension",new Color(205,0,205));
seriesNameColorAll.put("lock escalate retry",new Color(205,127,50));
seriesNameColorAll.put("lock deadlock retry",new Color(150,75,0));
seriesNameColorAll.put("prewarm transfer retry",new Color(240,220,130));
seriesNameColorAll.put("recovery buffer pinned",new Color(128,0,32));
seriesNameColorAll.put("wait for MTTR advisory state object",new Color(204,85,0));
seriesNameColorAll.put("latch: object queue header operation",new Color(233,116,81));
seriesNameColorAll.put("enq: WR - contention",new Color(138,51,36));
seriesNameColorAll.put("log switch/archive",new Color(120,134,107));
seriesNameColorAll.put("ARCH wait on c/f tx acquire 1",new Color(196,30,58));
seriesNameColorAll.put("ARCH wait on c/f tx acquire 2",new Color(150,0,24));
seriesNameColorAll.put("ARCH wait for process start 1",new Color(237,145,33));
seriesNameColorAll.put("ARCH wait for process death 1",new Color(172,225,175));
seriesNameColorAll.put("ARCH wait for process start 2",new Color(222,49,99));
seriesNameColorAll.put("ARCH wait for process death 2",new Color(0,123,167));
seriesNameColorAll.put("ARCH wait for process start 3",new Color(42,82,150));
seriesNameColorAll.put("ARCH wait for process death 3",new Color(127,255,25));
seriesNameColorAll.put("ARCH wait for process start 4",new Color(235,92,92));
seriesNameColorAll.put("ARCH wait for process death 4",new Color(210,150,30));
seriesNameColorAll.put("ARCH wait for process death 5",new Color(150,63,10));
seriesNameColorAll.put("ARCH wait for archivelog lock",new Color(50,50,171));
seriesNameColorAll.put("Wait on stby instance close",new Color(184,115,100));
seriesNameColorAll.put("RFS dispatch",new Color(255,100,120));
seriesNameColorAll.put("RFS attach",new Color(251,250,93));
seriesNameColorAll.put("RFS create",new Color(130,149,237));
seriesNameColorAll.put("RFS close",new Color(255,253,220));
seriesNameColorAll.put("RFS announce",new Color(230,50,60));
seriesNameColorAll.put("RFS register",new Color(50,255,255));
seriesNameColorAll.put("RFS detach",new Color(101,67,50));
seriesNameColorAll.put("RFS ping",new Color(8,99,126));
seriesNameColorAll.put("LGWR simulation latency wait",new Color(152,135,96));
seriesNameColorAll.put("LGWR-LNS wait on channel",new Color(205,101,69));
seriesNameColorAll.put("LGWR wait on full LNS buffer",new Color(184,134,30));
seriesNameColorAll.put("LNS simulation latency wait",new Color(19,50,32));
seriesNameColorAll.put("kcrrrcp",new Color(89,0,98));
seriesNameColorAll.put("LNS wait for LGWR redo",new Color(189,183,127));
seriesNameColorAll.put("Data Guard: process exit",new Color(105,104,50));
seriesNameColorAll.put("Data Guard: process clean up",new Color(3,192,80));
seriesNameColorAll.put("FAL archive wait 1 sec for REOPEN minimum",new Color(255,228,155));
seriesNameColorAll.put("MRP wait on process start",new Color(231,104,128));
seriesNameColorAll.put("MRP wait on process restart",new Color(233,120,122));
seriesNameColorAll.put("MRP wait on startup clear",new Color(106,3,25));
seriesNameColorAll.put("MRP wait on process death",new Color(47,99,79));
seriesNameColorAll.put("MRP wait on state change",new Color(73,114,69));
seriesNameColorAll.put("MRP wait on state n_a",new Color(145,129,101));
seriesNameColorAll.put("MRP wait on state reset",new Color(255,168,38));
seriesNameColorAll.put("MRP wait on archivelog delay",new Color(186,239,173));
seriesNameColorAll.put("MRP wait on archivelog arrival",new Color(37,96,98));
seriesNameColorAll.put("MRP wait on archivelog archival",new Color(86,49,137 ));
seriesNameColorAll.put("LGWR wait for redo copy",new Color(21,96,159));
seriesNameColorAll.put("latch: redo allocation",new Color(30,144,220));
seriesNameColorAll.put("log file switch (clearing log file)",new Color(110,200,120));
seriesNameColorAll.put("enq: WL - contention",new Color(153,30,102));
seriesNameColorAll.put("enq: RN - contention",new Color(99,121,66));
seriesNameColorAll.put("DFS db file lock",new Color(238,230,150));
seriesNameColorAll.put("enq: DF - contention",new Color(255,20,255));
seriesNameColorAll.put("enq: IS - contention",new Color(228,155,45));
seriesNameColorAll.put("enq: FS - contention",new Color(205,215,0));
seriesNameColorAll.put("enq: DM - contention",new Color(218,165,52));
seriesNameColorAll.put("enq: RP - contention",new Color(128,128,158));
seriesNameColorAll.put("latch: gc element",new Color(90,89,69));
seriesNameColorAll.put("enq: RT - contention",new Color(232,218,186));
seriesNameColorAll.put("enq: IR - contention",new Color(0,255,30));
seriesNameColorAll.put("enq: IR - contention2",new Color(173,255,77));
seriesNameColorAll.put("enq: MR - contention",new Color(20,125,255));
seriesNameColorAll.put("parallel recovery coord wait for reply",new Color(203,115,255));
seriesNameColorAll.put("parallel recovery coord send blocked",new Color(232,15,192));
seriesNameColorAll.put("parallel recovery slave wait for change",new Color(75,20,130));
seriesNameColorAll.put("enq: BR - file shrink",new Color(255,79,20));
seriesNameColorAll.put("enq: BR - proxy-copy",new Color(20,168,107));
seriesNameColorAll.put("enq: BR - multi-section restore header",new Color(195,156,145));
seriesNameColorAll.put("enq: BR - multi-section restore section",new Color(78,117,196));
seriesNameColorAll.put("enq: BR - space info datafile hdr update",new Color(230,210,250));
seriesNameColorAll.put("enq: ID - contention",new Color(255,220,245));
seriesNameColorAll.put("LogMiner: waiting for session to become visible",new Color(223,233,16));
seriesNameColorAll.put("LogMiner: waiting for redo from new branch",new Color(255,250,225));
seriesNameColorAll.put("enq: MN - contention",new Color(205,133,83));
seriesNameColorAll.put("enq: PL - contention",new Color(200,162,180));
seriesNameColorAll.put("enq: SB - contention",new Color(204,255,30));
seriesNameColorAll.put("Logical Standby Apply shutdown",new Color(250,240,200));
seriesNameColorAll.put("Logical Standby pin transaction",new Color(255,0,235));
seriesNameColorAll.put("Logical Standby dictionary build",new Color(11,218,51));
seriesNameColorAll.put("Logical Standby Terminal Apply",new Color(128,0,20));
seriesNameColorAll.put("enq: XR - quiesce database",new Color(153,51,122));
seriesNameColorAll.put("enq: XR - database force logging",new Color(0,51,120));
seriesNameColorAll.put("standby query scn advance",new Color(152,255,122));
seriesNameColorAll.put("change tracking file synchronous read",new Color(173,223,125));
seriesNameColorAll.put("change tracking file synchronous write",new Color(153,122,101));
seriesNameColorAll.put("change tracking file parallel write",new Color(255,219,110));
seriesNameColorAll.put("block change tracking buffer space",new Color(255,222,153));
seriesNameColorAll.put("enq: CT - global space management",new Color(0,35,128));
seriesNameColorAll.put("enq: CT - local space management",new Color(204,119,54));
seriesNameColorAll.put("enq: CT - change stream ownership",new Color(207,181,89));
seriesNameColorAll.put("enq: CT - state",new Color(128,128,20));
seriesNameColorAll.put("enq: CT - state change gate 1",new Color(107,142,75));
seriesNameColorAll.put("enq: CT - state change gate 2",new Color(255,165,50));
seriesNameColorAll.put("enq: CT - CTWR process start/stop",new Color(218,112,234));
seriesNameColorAll.put("enq: CT - reading",new Color(175,238,208));
seriesNameColorAll.put("recovery area: computing dropped files",new Color(152,118,44));
seriesNameColorAll.put("recovery area: computing obsolete files",new Color(175,64,93));
seriesNameColorAll.put("recovery area: computing backed up files",new Color(221,173,200));
seriesNameColorAll.put("recovery area: computing applied logs",new Color(171,205,200));
seriesNameColorAll.put("enq: RS - file delete",new Color(249,132,255));
seriesNameColorAll.put("enq: RS - record reuse",new Color(153,132,102));
seriesNameColorAll.put("enq: RS - prevent file delete",new Color(250,180,221));
seriesNameColorAll.put("enq: RS - prevent aging list update",new Color(219,139,147));
seriesNameColorAll.put("enq: RS - persist alert level",new Color(218,140,171));
seriesNameColorAll.put("enq: RS - read alert level",new Color(199,200,236));
seriesNameColorAll.put("enq: RS - write alert level",new Color(255,200,213));
seriesNameColorAll.put("enq: FL - Flashback database log",new Color(119,190,119));
seriesNameColorAll.put("enq: FL - Flashback db command",new Color(255,170,220));
seriesNameColorAll.put("enq: FD - Marker generation",new Color(255,190,180));
seriesNameColorAll.put("enq: FD - Tablespace flashback on/off",new Color(255,170,153));
seriesNameColorAll.put("enq: FD - Flashback coordinator",new Color(250,180,173));
seriesNameColorAll.put("enq: FD - Flashback on/off",new Color(209,180,49));
seriesNameColorAll.put("enq: FD - Restore point create/drop",new Color(204,170,255));
seriesNameColorAll.put("flashback free VI log",new Color(102,30,255));
seriesNameColorAll.put("flashback buf free by RVWR",new Color(10,111,111));
seriesNameColorAll.put("flashback log switch",new Color(255,140,203));
seriesNameColorAll.put("RVWR wait for flashback copy",new Color(255,100,102));
seriesNameColorAll.put("parallel recovery read buffer free",new Color(102,10,132));
seriesNameColorAll.put("parallel recovery change buffer free",new Color(0,51,153));
seriesNameColorAll.put("parallel recovery control message reply",new Color(204,136,153));
seriesNameColorAll.put("parallel recovery slave next change",new Color(0,49,63));
seriesNameColorAll.put("blocking txn id for DDL",new Color(255,147,24));
seriesNameColorAll.put("transaction",new Color(102,30,153));
seriesNameColorAll.put("inactive transaction branch",new Color(115,24,18));
seriesNameColorAll.put("txn to complete",new Color(255,40,0));
seriesNameColorAll.put("PMON to cleanup pseudo-branches at svc stop time",new Color(199,71,133));
seriesNameColorAll.put("test long ops",new Color(0,174,204));
seriesNameColorAll.put("latch: undo global data",new Color(65,135,225));
seriesNameColorAll.put("undo segment recovery",new Color(117,40,87));
seriesNameColorAll.put("unbound tx",new Color(183,105,14));
seriesNameColorAll.put("wait for change",new Color(255,120,0));
seriesNameColorAll.put("wait for another txn - undo rcv abort",new Color(244,150,48));
seriesNameColorAll.put("wait for another txn - txn abort",new Color(8,60,103));
seriesNameColorAll.put("wait for another txn - rollback to savepoint",new Color(255,110,105));
seriesNameColorAll.put("undo_retention publish retry",new Color(244,120,96));
seriesNameColorAll.put("enq: TA - contention",new Color(146,50,10));
seriesNameColorAll.put("enq: TX - contention",new Color(255,80,0));
seriesNameColorAll.put("enq: US - contention",new Color(255,170,0));
seriesNameColorAll.put("wait for stopper event to be increased",new Color(46,100,97));
seriesNameColorAll.put("wait for a undo record",new Color(255,245,208 ));
seriesNameColorAll.put("wait for a paralle reco to abort",new Color(255,156,10));
seriesNameColorAll.put("enq: IM - contention for blr",new Color(112,16,20));
seriesNameColorAll.put("enq: TD - KTF dump entries",new Color(192,192,152 ));
seriesNameColorAll.put("enq: TE - KTF broadcast",new Color(112,128,124));
seriesNameColorAll.put("enq: CN - race with txn",new Color(0,225,127));
seriesNameColorAll.put("enq: CN - race with reg",new Color(70,100,180 ));
seriesNameColorAll.put("enq: CN - race with init",new Color(172,143,142));
seriesNameColorAll.put("latch: Change Notification Hash table latch",new Color(210,150,140));
seriesNameColorAll.put("enq: CO - master slave det",new Color(205,27,0));
seriesNameColorAll.put("enq: FE - contention",new Color(255,200,50));
seriesNameColorAll.put("latch: change notification client cache latch",new Color(208,200,192));
seriesNameColorAll.put("enq: TF - contention",new Color(0,128,158));
seriesNameColorAll.put("latch: lob segment hash table latch",new Color(216,151,216));
seriesNameColorAll.put("latch: lob segment query latch",new Color(98,213,200));
seriesNameColorAll.put("latch: lob segment dispenser latch",new Color(58,10,143));
seriesNameColorAll.put("Wait for shrink lock2",new Color(205,77,0));
seriesNameColorAll.put("Wait for shrink lock",new Color(139,80,245));
seriesNameColorAll.put("L1 validation",new Color(153,77,153));
seriesNameColorAll.put("Wait for TT enqueue",new Color(64,130,69));
seriesNameColorAll.put("kttm2d",new Color(245,200,179));
seriesNameColorAll.put("ktsambl",new Color(255,255,255));
seriesNameColorAll.put("ktfbtgex",new Color(201,150,200));
seriesNameColorAll.put("enq: DT - contention",new Color(255,225,0));
seriesNameColorAll.put("enq: TS - contention",new Color(235,194,125));
seriesNameColorAll.put("enq: FB - contention",new Color(207,68,24));
seriesNameColorAll.put("enq: SK - contention",new Color(65,181,0));
seriesNameColorAll.put("enq: DW - contention",new Color(153,112,214));
seriesNameColorAll.put("enq: SU - contention",new Color(113,150,101));
seriesNameColorAll.put("enq: TT - contention",new Color(0,235,235));
seriesNameColorAll.put("ktm: instance recovery",new Color(117,235,232));
seriesNameColorAll.put("instance state change",new Color(10,147,235));
seriesNameColorAll.put("enq: SJ - Slave Task Cancel",new Color(0,139,172));
seriesNameColorAll.put("Space Manager: slave messages",new Color(151,156,66));
seriesNameColorAll.put("index block split",new Color(184,95,10));
seriesNameColorAll.put("enq: HV - contention",new Color(132,255,0));
seriesNameColorAll.put("kdblil wait before retrying ORA-54",new Color(0,20,255));
seriesNameColorAll.put("dupl. cluster key",new Color(205,117,70));
seriesNameColorAll.put("kdic_do_merge",new Color(160,95,0));
seriesNameColorAll.put("enq: DL - contention",new Color(230,210,120));
seriesNameColorAll.put("enq: HQ - contention",new Color(108,0,42));
seriesNameColorAll.put("enq: HP - contention",new Color(214,55,0));
seriesNameColorAll.put("enq: WG - delete fso",new Color(233,106,71));
seriesNameColorAll.put("enq: SL - get lock",new Color(128,51,36));
seriesNameColorAll.put("enq: SL - escalate lock",new Color(120,104,107));
seriesNameColorAll.put("enq: SL - get lock for undo",new Color(186,50,68));
seriesNameColorAll.put("enq: DV - contention",new Color(140,0,34));
seriesNameColorAll.put("enq: SO - contention",new Color(207,135,43));
seriesNameColorAll.put("enq: RW - MV metadata contention",new Color(162,215,165));
seriesNameColorAll.put("enq: OC - contention",new Color(212,49,59));
seriesNameColorAll.put("enq: OL - contention",new Color(10,103,157));
seriesNameColorAll.put("kkdlgon",new Color(52,72,180));
seriesNameColorAll.put("kkdlsipon",new Color(137,245,0));
seriesNameColorAll.put("kkdlhpon",new Color(215,82,82));
seriesNameColorAll.put("kgltwait",new Color(220,115,39));
seriesNameColorAll.put("kksfbc research",new Color(113,73,10));
seriesNameColorAll.put("kksscl hash split",new Color(0,21,191));
seriesNameColorAll.put("kksfbc child completion",new Color(174,105,61));
seriesNameColorAll.put("enq: CU - contention",new Color(245,137,70));
seriesNameColorAll.put("cursor: pin X",new Color(241,226,83));
seriesNameColorAll.put("cursor: pin S",new Color(110,139,247));
seriesNameColorAll.put("enq: AE - lock",new Color(245,243,218));
seriesNameColorAll.put("enq: PF - contention",new Color(210,10,50));
seriesNameColorAll.put("enq: IL - contention",new Color(0,245,245));
seriesNameColorAll.put("enq: CL - drop label",new Color(111,57,43));
seriesNameColorAll.put("enq: CL - compare labels",new Color(8,59,136));
seriesNameColorAll.put("enq: MK - contention",new Color(142,115,86));
seriesNameColorAll.put("enq: OW - initialization",new Color(225,91,79));
seriesNameColorAll.put("enq: OW - termination",new Color(194,144,19));
seriesNameColorAll.put("enq: AU - audit index file",new Color(1,60,42));
seriesNameColorAll.put("enq: DX - contention",new Color(59,0,78));
seriesNameColorAll.put("enq: DR - contention",new Color(179,173,117));
seriesNameColorAll.put("pending global transaction(s)",new Color(75,114,60));
seriesNameColorAll.put("free global transaction table entry",new Color(13,182,70));
seriesNameColorAll.put("library cache revalidation",new Color(255,228,175));
seriesNameColorAll.put("library cache shutdown",new Color(221,84,138));
seriesNameColorAll.put("BFILE closure",new Color(243,140,132));
seriesNameColorAll.put("BFILE check if exists",new Color(96,9,35));
seriesNameColorAll.put("BFILE check if open",new Color(47,89,89));
seriesNameColorAll.put("BFILE get length",new Color(33,104,79));
seriesNameColorAll.put("BFILE get name object",new Color(135,139,71));
seriesNameColorAll.put("BFILE get path object",new Color(250,158,28));
seriesNameColorAll.put("BFILE open",new Color(176,229,163));
seriesNameColorAll.put("BFILE internal seek",new Color(17,86,88));
seriesNameColorAll.put("waiting to get CAS latch",new Color(60,39,137));
seriesNameColorAll.put("waiting to get RM CAS latch",new Color(21,86,179));
seriesNameColorAll.put("xdb schema cache initialization",new Color(30,124,255));
seriesNameColorAll.put("dispatcher shutdown",new Color(80,200,130));
seriesNameColorAll.put("latch: virtual circuit queues",new Color(133,0,102));
seriesNameColorAll.put("listen endpoint status",new Color(79,121,86));
seriesNameColorAll.put("select wait",new Color(228,230,130));
seriesNameColorAll.put("jobq slave shutdown wait",new Color(245,0,235));
seriesNameColorAll.put("jobq slave TJ process wait",new Color(208,155,15));
seriesNameColorAll.put("job scheduler coordinator slave wait",new Color(205,215,0));
seriesNameColorAll.put("enq: JD - contention",new Color(218,125,32));
seriesNameColorAll.put("enq: JQ - contention",new Color(70,89,99));
seriesNameColorAll.put("enq: OD - Serializing DDLs",new Color(232,218,186));
seriesNameColorAll.put("kkshgnc reloop",new Color(0,235,0));
seriesNameColorAll.put("optimizer stats update retry",new Color(163,245,57));
seriesNameColorAll.put("wait active processes",new Color(0,105,245));
seriesNameColorAll.put("SUPLOG PL wait for inflight pragma-d PL/SQL",new Color(233,115,235));
seriesNameColorAll.put("enq: MD - contention",new Color(252,25,200));
seriesNameColorAll.put("enq: MS - contention",new Color(95,0,140));
seriesNameColorAll.put("wait for kkpo ref-partitioning *TEST EVENT*",new Color(235,99,0));
seriesNameColorAll.put("PX slave connectionMetadata",new Color(0,158,117));
seriesNameColorAll.put("PX slave release",new Color(195,156,145));
seriesNameColorAll.put("PX Send Wait",new Color(58,117,156));
seriesNameColorAll.put("PX qref latch",new Color(200,230,250));
seriesNameColorAll.put("PX server shutdown",new Color(255,210,245));
seriesNameColorAll.put("PX create server",new Color(233,203,16));
seriesNameColorAll.put("PX signal server",new Color(245,240,215));
seriesNameColorAll.put("PX Deq Credit: free buffer",new Color(205,143,83));
seriesNameColorAll.put("PX Deq: Test for msg",new Color(210,152,210));
seriesNameColorAll.put("PX Deq: Test for credit",new Color(224,245,0));
seriesNameColorAll.put("PX Deq: Signal ACK RSG",new Color(240,210,220));
seriesNameColorAll.put("PX Deq: Signal ACK EXT",new Color(250,0,245));
seriesNameColorAll.put("PX Deq: reap credit",new Color(19,208,91));
seriesNameColorAll.put("PX Nsq: PQ descriptor query",new Color(138,0,0));
seriesNameColorAll.put("PX Nsq: PQ load info query",new Color(143,61,102));
seriesNameColorAll.put("PX Deq Credit: Session Stats",new Color(10,61,102));
seriesNameColorAll.put("PX Deq: Slave Session Stats",new Color(142,245,152));
seriesNameColorAll.put("PX Deq: Slave Join Frag",new Color(173,203,173));
seriesNameColorAll.put("enq: PI - contention",new Color(133,102,141));
seriesNameColorAll.put("enq: PS - contention",new Color(245,209,88));
seriesNameColorAll.put("latch: parallel query alloc buffer",new Color(245,212,173));
seriesNameColorAll.put("kxfxse",new Color(0,0,108));
seriesNameColorAll.put("kxfxsp",new Color(224,109,34));
seriesNameColorAll.put("PX Deq: Table Q qref",new Color(217,171,59));
seriesNameColorAll.put("PX Deq: Table Q Get Keys",new Color(118,118,0));
seriesNameColorAll.put("PX Deq: Table Q Close",new Color(137,142,35));
seriesNameColorAll.put("GV$: slave acquisition retry wait time",new Color(245,165,10));
seriesNameColorAll.put("enq: AY - contention",new Color(208,102,214));
seriesNameColorAll.put("enq: TO - contention",new Color(175,208,238));
seriesNameColorAll.put("enq: IT - contention",new Color(142,108,84));
seriesNameColorAll.put("enq: BF - allocation contention",new Color(155,64,53));
seriesNameColorAll.put("enq: BF - PMON Join Filter cleanup",new Color(201,163,175));
seriesNameColorAll.put("kupp process wait",new Color(171,225,239));
seriesNameColorAll.put("Kupp process shutdown",new Color(249,142,209));
seriesNameColorAll.put("enq: KP - contention",new Color(153,112,112));
seriesNameColorAll.put("Replication Dequeue ",new Color(250,248,221));
seriesNameColorAll.put("knpc_acwm_AwaitChangedWaterMark",new Color(239,112,147));
seriesNameColorAll.put("knpc_anq_AwaitNonemptyQueue",new Color(208,179,171));
seriesNameColorAll.put("knpsmai",new Color(189,242,236));
seriesNameColorAll.put("enq: SR - contention",new Color(255,239,233));
seriesNameColorAll.put("Streams capture: waiting for database startup",new Color(139,221,119));
seriesNameColorAll.put("Streams miscellaneous event",new Color(255,229,220));
seriesNameColorAll.put("enq: SI - contention",new Color(245,229,180));
seriesNameColorAll.put("Streams: RAC waiting for inter instance ack",new Color(255,214,143));
seriesNameColorAll.put("enq: IA - contention",new Color(250,213,143));
seriesNameColorAll.put("enq: JI - contention",new Color(219,216,49));
seriesNameColorAll.put("qerex_gdml",new Color(204,214,245));
seriesNameColorAll.put("enq: AT - contention",new Color(122,10,255));
seriesNameColorAll.put("opishd",new Color(1,111,121));
seriesNameColorAll.put("kpodplck wait before retrying ORA-54",new Color(255,192,213));
seriesNameColorAll.put("enq: CQ - contention",new Color(245,163,112));
seriesNameColorAll.put("Streams AQ: emn coordinator waiting for slave to start",new Color(112,5,102));
seriesNameColorAll.put("wait for EMON to spawn",new Color(10,31,153));
seriesNameColorAll.put("EMON termination",new Color(214,126,153));
seriesNameColorAll.put("EMON slave messages",new Color(0,39,73));
seriesNameColorAll.put("enq: SE - contention",new Color(245,127,34));
seriesNameColorAll.put("tsm with timeout",new Color(112,0,153));
seriesNameColorAll.put("Streams AQ: waiting for busy instance for instance_name",new Color(125,79,18));
seriesNameColorAll.put("enq: TQ - TM contention",new Color(255,30,0));
seriesNameColorAll.put("enq: TQ - DDL contention",new Color(189,31,133));
seriesNameColorAll.put("enq: TQ - INI contention",new Color(0,194,194));
seriesNameColorAll.put("enq: TQ - DDL-INI contention",new Color(65,125,225));
seriesNameColorAll.put("AQ propagation connectionMetadata",new Color(107,80,87));
seriesNameColorAll.put("enq: DP - contention",new Color(153,65,14));
seriesNameColorAll.put("enq: MH - contention",new Color(255,173,10));
seriesNameColorAll.put("enq: ML - contention",new Color(234,186,48));
seriesNameColorAll.put("enq: PH - contention",new Color(10,47,123));
seriesNameColorAll.put("enq: SF - contention",new Color(245,130,105));
seriesNameColorAll.put("enq: XH - contention",new Color(234,154,86));
seriesNameColorAll.put("enq: WA - contention",new Color(146,0,30));
seriesNameColorAll.put("Streams AQ: QueueTable kgl locks",new Color(235,36,10));
seriesNameColorAll.put("queue slave messages",new Color(245,226,0));
seriesNameColorAll.put("Streams AQ: qmn coordinator waiting for slave to start",new Color(56,129,87));
seriesNameColorAll.put("XDB SGA initialization",new Color(255,235,228));
seriesNameColorAll.put("NFS read delegation outstanding",new Color(250,196,0));
seriesNameColorAll.put("Data Guard Broker Wait",new Color(102,70,30));
seriesNameColorAll.put("enq: RF - synch: DG Broker metadata",new Color(182,189,192));
seriesNameColorAll.put("enq: RF - atomicity",new Color(112,138,134));
seriesNameColorAll.put("enq: RF - synchronization: aifo master",new Color(30,255,127));
seriesNameColorAll.put("enq: RF - new AI",new Color(70,140,170));
seriesNameColorAll.put("enq: RF - synchronization: critical ai",new Color(162,173,142));
seriesNameColorAll.put("enq: RF - RF - Database Automatic Disable",new Color(200,185,140));
seriesNameColorAll.put("enq: RF - FSFO Observer Heartbeat",new Color(205,87,25));
seriesNameColorAll.put("enq: RF - DG Broker Current File ID",new Color(255,184,0));
seriesNameColorAll.put("PX Deq: OLAP Update Reply",new Color(208,245,182));
seriesNameColorAll.put("PX Deq: OLAP Update Execute",new Color(5,118,118));
seriesNameColorAll.put("PX Deq: OLAP Update Close",new Color(206,191,206));
seriesNameColorAll.put("OLAP Parallel Type Deq",new Color(58,203,200));
seriesNameColorAll.put("OLAP Parallel Temp Grow Request",new Color(28,20,133));
seriesNameColorAll.put("OLAP Parallel Temp Grow Wait",new Color(255,77,0));
seriesNameColorAll.put("OLAP Parallel Temp Grew",new Color(129,0,250));
seriesNameColorAll.put("OLAP Null PQ Reason",new Color(143,27,153));
seriesNameColorAll.put("OLAP Aggregate Master Enq",new Color(54,120,109));
seriesNameColorAll.put("OLAP Aggregate Client Enq",new Color(235,212,169));
seriesNameColorAll.put("OLAP Aggregate Master Deq",new Color(211,150,220));
seriesNameColorAll.put("OLAP Aggregate Client Deq",new Color(245,245,0));
seriesNameColorAll.put("enq: AW - AW$ table lock",new Color(230,184,165));
seriesNameColorAll.put("enq: AW - AW state lock",new Color(237,48,64));
seriesNameColorAll.put("enq: AW - user access for AW",new Color(245,181,10));
seriesNameColorAll.put("enq: AW - AW generation lock",new Color(255,151,0));
seriesNameColorAll.put("enq: AG - contention",new Color(153,102,214));
seriesNameColorAll.put("enq: AO - contention",new Color(123,150,91));
seriesNameColorAll.put("enq: OQ - xsoqhiAlloc",new Color(0,255,235));
seriesNameColorAll.put("enq: OQ - xsoqhiFlush",new Color(107,255,212));
seriesNameColorAll.put("enq: OQ - xsoq*histrecb",new Color(0,137,245));
seriesNameColorAll.put("enq: OQ - xsoqhiClose",new Color(235,235,210));
seriesNameColorAll.put("enq: OQ - xsoqhistrecb",new Color(71,53,41));
seriesNameColorAll.put("enq: AM - client registration",new Color(10,10,255));
seriesNameColorAll.put("enq: AM - shutdown",new Color(10,139,182));
seriesNameColorAll.put("enq: AM - rollback COD reservation",new Color(161,156,66));
seriesNameColorAll.put("enq: AM - background COD reservation",new Color(102,245,10));
seriesNameColorAll.put("enq: AM - ASM cache freeze",new Color(50,232,222));
seriesNameColorAll.put("enq: AM - ASM ACD Relocation",new Color(205,20,205));
seriesNameColorAll.put("ASM internal hang test",new Color(235,127,50));
seriesNameColorAll.put("buffer busy",new Color(130,75,0));
seriesNameColorAll.put("buffer freelistbusy",new Color(230,210,135));
seriesNameColorAll.put("buffer rememberlist busy",new Color(138,10,32));
seriesNameColorAll.put("buffer writeList full",new Color(194,75,0));
seriesNameColorAll.put("no free buffers",new Color(203,106,81));
seriesNameColorAll.put("buffer write wait",new Color(138,41,46));
seriesNameColorAll.put("buffer invalidation wait",new Color(110,124,107));
seriesNameColorAll.put("buffer dirty disabled",new Color(186,40,58));
seriesNameColorAll.put("ASM metadata cache frozen",new Color(140,10,24));
seriesNameColorAll.put("enq: CM - gate",new Color(217,155,43));
seriesNameColorAll.put("enq: CM - instance",new Color(182,215,165));
seriesNameColorAll.put("enq: XQ - recovery",new Color(212,59,89));
seriesNameColorAll.put("enq: XQ - relocation",new Color(0,103,167));
seriesNameColorAll.put("enq: AD - allocate AU",new Color(42,82,130));
seriesNameColorAll.put("enq: AD - deallocate AU",new Color(120,250,20));
seriesNameColorAll.put("enq: AD - relocate AU",new Color(235,82,82));
seriesNameColorAll.put("enq: DO - disk online",new Color(200,160,30));
seriesNameColorAll.put("enq: DO - disk online recovery",new Color(160,53,10));
seriesNameColorAll.put("enq: DO - Staleness Registry create",new Color(60,60,171));
seriesNameColorAll.put("enq: DO - startup of MARK process",new Color(174,125,110));
seriesNameColorAll.put("enq: DO - disk online operation",new Color(245,110,120));
seriesNameColorAll.put("extent map load/unlock",new Color(241,240,93));
seriesNameColorAll.put("enq: XL - fault extent map",new Color(130,149,207));
seriesNameColorAll.put("Sync ASM rebalance",new Color(255,243,200));
seriesNameColorAll.put("enq: DG - contention",new Color(200,60,60));
seriesNameColorAll.put("enq: DD - contention",new Color(59,245,255));
seriesNameColorAll.put("enq: HD - contention",new Color(111,57,50));
seriesNameColorAll.put("enq: DN - contention",new Color(18,89,126));
seriesNameColorAll.put("Cluster stabilization wait",new Color(142,125,96));
seriesNameColorAll.put("Cluster Suspension wait",new Color(215,91,69));
seriesNameColorAll.put("ASM background starting",new Color(184,134,50));
seriesNameColorAll.put("ASM background running",new Color(40,50,32));
seriesNameColorAll.put("ASM db client exists",new Color(80,8,98));
seriesNameColorAll.put("DBFG waiting for reply",new Color(179,173,127));
seriesNameColorAll.put("ASM file metadata operation",new Color(125,114,50));
seriesNameColorAll.put("ASM network foreground exits",new Color(30,192,80));
seriesNameColorAll.put("enq: FA - access file",new Color(245,238,155));
seriesNameColorAll.put("enq: RX - relocate extent",new Color(221,114,128));
seriesNameColorAll.put("log write(odd)",new Color(203,130,122));
seriesNameColorAll.put("log write(even)",new Color(106,30,25));
seriesNameColorAll.put("checkpoint advanced",new Color(67,99,79));
seriesNameColorAll.put("enq: FR - contention",new Color(83,104,69));
seriesNameColorAll.put("enq: FG - serialize ACD relocate",new Color(135,129,91));
seriesNameColorAll.put("enq: FG - FG redo generation enq race",new Color(255,148,38));
seriesNameColorAll.put("enq: FG - LGWR redo generation enq race",new Color(156,239,173));
seriesNameColorAll.put("enq: FT - allow LGWR writes",new Color(37,76,98));
seriesNameColorAll.put("enq: FT - disable LGWR writes",new Color(86,49,107));
seriesNameColorAll.put("enq: FC - open an ACD thread",new Color(41,96,159));
seriesNameColorAll.put("enq: FC - recover an ACD thread",new Color(30,124,220));
seriesNameColorAll.put("enq: FX - issue ACD Xtnt Relocation CIC",new Color(110,210,110));
seriesNameColorAll.put("rollback operations block full",new Color(143,40,102));
seriesNameColorAll.put("rollback operations active",new Color(99,111,76));
seriesNameColorAll.put("enq: RB - contention",new Color(248,210,160));
seriesNameColorAll.put("enq: PT - contention",new Color(255,50,255));
seriesNameColorAll.put("global cache busy",new Color(228,185,45));
seriesNameColorAll.put("lock release pending",new Color(215,205,10));
seriesNameColorAll.put("dma prepare busy",new Color(208,155,52));
seriesNameColorAll.put("GCS lock cancel",new Color(108,128,158));
seriesNameColorAll.put("GCS lock open S",new Color(80,79,69));
seriesNameColorAll.put("GCS lock open X",new Color(232,228,176));
seriesNameColorAll.put("GCS lock open",new Color(10,245,30));
seriesNameColorAll.put("GCS lock cvt S",new Color(153,255,77));
seriesNameColorAll.put("GCS lock cvt X",new Color(0,125,255));
seriesNameColorAll.put("GCS lock esc X",new Color(203,105,255));
seriesNameColorAll.put("GCS lock esc",new Color(232,15,152));
seriesNameColorAll.put("GCS recovery lock open",new Color(70,40,130));
seriesNameColorAll.put("GCS recovery lock convert",new Color(235,79,20));
seriesNameColorAll.put("kfcl: instance recovery",new Color(50,168,107));
seriesNameColorAll.put("no free locks",new Color(195,146,135));
seriesNameColorAll.put("lock close",new Color(78,107,196));
seriesNameColorAll.put("enq: KQ - access ASM attribute",new Color(220,200,250));
seriesNameColorAll.put("ASM Volume Background",new Color(255,230,235));
seriesNameColorAll.put("enq: AV - persistent DG number",new Color(223,213,16));
seriesNameColorAll.put("ASM: OFS Cluster membership update",new Color(245,240,225));
seriesNameColorAll.put("enq: WF - contention",new Color(215,143,83));
seriesNameColorAll.put("enq: WP - contention",new Color(210,152,180));
seriesNameColorAll.put("enq: FU - contention",new Color(224,245,30));
seriesNameColorAll.put("enq: MW - contention",new Color(240,230,200));
seriesNameColorAll.put("AWR Flush",new Color(245,10,225));
seriesNameColorAll.put("AWR Metric Capture",new Color(19,208,51));
seriesNameColorAll.put("enq: TB - SQL Tuning Base Cache Update",new Color(128,30,20));
seriesNameColorAll.put("enq: TB - SQL Tuning Base Cache Load",new Color(153,81,122));
seriesNameColorAll.put("enq: SH - contention",new Color(40,51,120));
seriesNameColorAll.put("enq: AF - task serialization",new Color(132,255,122));
seriesNameColorAll.put("MMON slave messages",new Color(173,203,125));
seriesNameColorAll.put("MMON (Lite) shutdown",new Color(153,122,131));
seriesNameColorAll.put("enq: MO - contention",new Color(255,219,90));
seriesNameColorAll.put("enq: TL - contention",new Color(245,212,153));
seriesNameColorAll.put("enq: TH - metric threshold evaluation",new Color(0,75,128));
seriesNameColorAll.put("enq: TK - Auto Task Serialization",new Color(224,119,54));
seriesNameColorAll.put("enq: TK - Auto Task Slave Lockout",new Color(207,151,89));
seriesNameColorAll.put("enq: RR - contention",new Color(118,118,20));
seriesNameColorAll.put("WCR: RAC message context busy",new Color(87,142,75));
seriesNameColorAll.put("WCR: Sync context busy",new Color(235,175,50));
seriesNameColorAll.put("enq: JS - contention",new Color(218,102,224));
seriesNameColorAll.put("enq: JS - job run lock - synchronize",new Color(175,228,228));
seriesNameColorAll.put("enq: JS - job recov lock",new Color(122,118,44));
seriesNameColorAll.put("enq: JS - queue lock",new Color(155,64,93));
seriesNameColorAll.put("enq: JS - sch locl enqs",new Color(201,163,200));
seriesNameColorAll.put("enq: JS - q mem clnup lck",new Color(171,205,180));
seriesNameColorAll.put("enq: JS - evtsub add",new Color(249,102,255));
seriesNameColorAll.put("enq: JS - evtsub drop",new Color(153,132,122));
seriesNameColorAll.put("enq: JS - wdw op",new Color(230,180,221));
seriesNameColorAll.put("enq: JS - evt notify",new Color(239,139,147));
seriesNameColorAll.put("enq: JS - aq sync",new Color(248,140,171));
seriesNameColorAll.put("secondary event",new Color(199,230,236));
// ** 10g2 ** //
seriesNameColorAll.put("Cluster stablization wait",new Color(227,38,54));
seriesNameColorAll.put("rfm_dmon_timeout_op",new Color(55,191,0));
seriesNameColorAll.put("enq: RF - synchronization: HC master",new Color(153,102,204));
seriesNameColorAll.put("rfrla_lapp4",new Color(123,160,91));
seriesNameColorAll.put("rfrm_rsm_shut",new Color(0,255,255));
seriesNameColorAll.put("rfi_recon1",new Color(127,255,212));
seriesNameColorAll.put("rfrla_lapp1",new Color(0,127,255));
seriesNameColorAll.put("rfrm_dbop",new Color(0,149,182));
seriesNameColorAll.put("rfrdb_dbop",new Color(181,166,66));
seriesNameColorAll.put("rfi_insv_shut",new Color(204,85,0));
seriesNameColorAll.put("enq: RF - RF - FSFO Observed",new Color(102,255,0));
seriesNameColorAll.put("rfrla_lapp2",new Color(205,127,50));
seriesNameColorAll.put("rfrm_rsm_so_attach",new Color(150,75,0));
seriesNameColorAll.put("ksqded",new Color(240,220,130));
seriesNameColorAll.put("rfrxptarcurlog",new Color(128,0,32));
seriesNameColorAll.put("enq: RF - RF - FSFO connectivity",new Color(233,116,81));
seriesNameColorAll.put("rfrm_stall",new Color(138,51,36));
seriesNameColorAll.put("rfm_dmon_pdefer",new Color(120,134,107));
seriesNameColorAll.put("rfrdb_recon1",new Color(196,30,58));
seriesNameColorAll.put("rfi_nsv_md_write",new Color(150,0,24));
seriesNameColorAll.put("rfi_nsv_start",new Color(237,145,33));
seriesNameColorAll.put("rfrpa_mrpup",new Color(172,225,175));
seriesNameColorAll.put("wait for EMON to die",new Color(222,49,99));
seriesNameColorAll.put("recovery area: computing identical files",new Color(0,123,167));
seriesNameColorAll.put("rfi_nsv_postdef",new Color(42,82,190));
seriesNameColorAll.put("rfm_dmon_shut",new Color(127,255,0));
seriesNameColorAll.put("rfrla_lapp3",new Color(205,92,92));
seriesNameColorAll.put("rfi_nsv_deldef",new Color(210,105,30));
seriesNameColorAll.put("rfi_drcx_site_del",new Color(123,63,0));
seriesNameColorAll.put("PX Deq: Signal ACK",new Color(0,71,171));
seriesNameColorAll.put("rfm_pmon_dso_stall",new Color(184,115,51));
seriesNameColorAll.put("rfi_nsv_md_close",new Color(255,127,80));
seriesNameColorAll.put("rfrdb_try235",new Color(251,236,93));
seriesNameColorAll.put("rfm_dmon_last_gasp",new Color(100,149,237));
seriesNameColorAll.put("RF - FSFO Wait for Ack",new Color(255,253,208));
seriesNameColorAll.put("enq: KK - context",new Color(220,20,60));
seriesNameColorAll.put("rfi_recon2",new Color(255,0,255));
seriesNameColorAll.put("rfrxpt_pdl",new Color(101,67,33));
seriesNameColorAll.put("rfi_insv_start",new Color(8,69,126));
seriesNameColorAll.put("enq: RF - RF - FSFO wait",new Color(152,105,96));
seriesNameColorAll.put("rfrdb_recon2",new Color(205,91,69));
seriesNameColorAll.put("enq: RF - synchronization: chief",new Color(184,134,11));
seriesNameColorAll.put("rfrm_dbcl",new Color(1,50,32));
seriesNameColorAll.put("enq: AS - modify service",new Color(49,0,98));
seriesNameColorAll.put("Data Guard broker: single instance",new Color(189,183,107));
seriesNameColorAll.put("rfrla_lapp5",new Color(85,104,50));
seriesNameColorAll.put("rfi_nsv_shut",new Color(3,192,60));
seriesNameColorAll.put("latch: object queue header heap",new Color(255,218,185));
seriesNameColorAll.put("rfrm_zero_sub_count",new Color(231,84,128));
seriesNameColorAll.put("rfrpa_mrpdn",new Color(233,150,122));
seriesNameColorAll.put("Data Guard broker: wait upon ORA-12850 error",new Color(86,3,25));
seriesNameColorAll.put("latch: KCL gc element parent latch",new Color(47,79,79));
seriesNameColorAll.put("enq: RF - RF - FSFO state",new Color(23,114,69));
seriesNameColorAll.put("enq: RF - RF - FSFO synchronization",new Color(145,129,81));
seriesNameColorAll.put("rfrld_rhmrpwait",new Color(255,168,18));
seriesNameColorAll.put("rfrm_nonzero_sub_count",new Color(186,219,173));
seriesNameColorAll.put("rfrm_rsm_start",new Color(17,96,98));
// ** 10g1 ** //
seriesNameColorAll.put("wait for sga_target resize",new Color(127,255,0));
seriesNameColorAll.put("Flow Control Event",new Color(205,92,92));
seriesNameColorAll.put("STREAMS capture process waiting for archive log",new Color(210,105,30));
seriesNameColorAll.put("wait for resize request completion",new Color(123,63,0));
seriesNameColorAll.put("DLM lock open",new Color(0,71,171));
seriesNameColorAll.put("master wait",new Color(184,115,51));
seriesNameColorAll.put("enq: JS - running job cnt lock3",new Color(255,127,80));
seriesNameColorAll.put("enq: JS - job chain evaluate lock",new Color(251,236,93));
seriesNameColorAll.put("DLM recovery lock open",new Color(100,149,237));
seriesNameColorAll.put("knlWaitForStartup",new Color(255,253,208));
seriesNameColorAll.put("DLM lock esc",new Color(220,20,60));
seriesNameColorAll.put("Wait for Dictionary Build to lock all tables",new Color(0,255,255));
seriesNameColorAll.put("SWRF RWM Auto Capture Event",new Color(101,67,33));
seriesNameColorAll.put("ksfd: fib/fob latch",new Color(8,69,126));
seriesNameColorAll.put("SWRF Wait on Flushing",new Color(152,105,96));
seriesNameColorAll.put("rfc_open_retry",new Color(205,91,69));
seriesNameColorAll.put("DLM lock cvt S",new Color(184,134,11));
seriesNameColorAll.put("DLM recovery lock convert",new Color(1,50,32));
seriesNameColorAll.put("enq: JS - running job cnt lock2",new Color(49,0,98));
seriesNameColorAll.put("enq: RF - synch: per-SGA Broker metadata",new Color(189,183,107));
seriesNameColorAll.put("DLM lock cancel",new Color(85,104,50));
seriesNameColorAll.put("foreground creation: wait",new Color(3,192,60));
seriesNameColorAll.put("enq: JS - coord post lock",new Color(255,218,185));
seriesNameColorAll.put("trace unfreeze",new Color(231,84,128));
seriesNameColorAll.put("wait for Logical Standby Apply shutdown",new Color(233,150,122));
seriesNameColorAll.put("Queue Monitor Task Wait",new Color(86,3,25));
seriesNameColorAll.put("enq: JS - global wdw lock",new Color(47,79,79));
seriesNameColorAll.put("enq: JS - running job cnt lock",new Color(23,114,69));
seriesNameColorAll.put("enq: AS - contention",new Color(145,129,81));
seriesNameColorAll.put("knlqdeq",new Color(255,168,18));
seriesNameColorAll.put("enq: JS - slave enq get lock1",new Color(186,219,173));
seriesNameColorAll.put("DLM lock open S",new Color(17,96,98));
seriesNameColorAll.put("enq: JS - slave enq get lock2",new Color(66,49,137));
seriesNameColorAll.put("trace writer flush",new Color(21,96,189));
seriesNameColorAll.put("latch: latch wait list",new Color(30,144,255));
seriesNameColorAll.put("foreground creation: start",new Color(80,200,120));
seriesNameColorAll.put("slave shutdown wait",new Color(153,0,102));
seriesNameColorAll.put("enq: JS - coord rcv lock",new Color(79,121,66));
seriesNameColorAll.put("trace writer I/O",new Color(238,220,130));
seriesNameColorAll.put("trace continue",new Color(255,0,255));
seriesNameColorAll.put("DLM lock cvt X",new Color(228,155,15));
seriesNameColorAll.put("slave TJ process wait",new Color(255,215,0));
seriesNameColorAll.put("DLM lock esc X",new Color(218,165,32));
seriesNameColorAll.put("Streams: Wait for inter instance ack",new Color(70,89,69));
seriesNameColorAll.put("DIAG dummy wait",new Color(202,218,186));
seriesNameColorAll.put("wait for SGA component shrink",new Color(0,255,0));
seriesNameColorAll.put("DLM lock open X",new Color(173,255,47));
seriesNameColorAll.put("wakeup blocked enqueuers",new Color(0,125,255));
// Network
seriesNameColorAll.put("remote db operation",new Color(227,38,54));
seriesNameColorAll.put("TEXT: URL_DATASTORE network wait",new Color(55,191,0));
seriesNameColorAll.put("remote db file write",new Color(153,102,204));
seriesNameColorAll.put("ARCH wait for netserver start",new Color(123,160,91));
seriesNameColorAll.put("ARCH wait for netserver init 1",new Color(0,255,255));
seriesNameColorAll.put("ARCH wait for netserver init 2",new Color(127,255,212));
seriesNameColorAll.put("ARCH wait for flow-control",new Color(0,127,255));
seriesNameColorAll.put("ARCH wait for netserver detach",new Color(0,149,182));
seriesNameColorAll.put("ARCH wait for net re-connect",new Color(181,166,66));
seriesNameColorAll.put("LNS wait on ATTACH",new Color(204,85,0));
seriesNameColorAll.put("LNS wait on SENDREQ",new Color(102,255,0));
seriesNameColorAll.put("LNS wait on DETACH",new Color(0,0,255));
seriesNameColorAll.put("LNS wait on LGWR",new Color(205,127,50));
seriesNameColorAll.put("LGWR wait on ATTACH",new Color(150,75,0));
seriesNameColorAll.put("LGWR wait on SENDREQ",new Color(240,220,130));
seriesNameColorAll.put("LGWR wait on DETACH",new Color(128,0,32));
seriesNameColorAll.put("LGWR wait on LNS",new Color(233,116,81));
seriesNameColorAll.put("ARCH wait on ATTACH",new Color(138,51,36));
seriesNameColorAll.put("ARCH wait on SENDREQ",new Color(120,134,107));
seriesNameColorAll.put("ARCH wait on DETACH",new Color(196,30,58));
seriesNameColorAll.put("TCP Socket (KGAS)",new Color(150,0,24));
seriesNameColorAll.put("dispatcher listen timer",new Color(237,145,33));
seriesNameColorAll.put("dedicated server timer",new Color(172,225,175));
seriesNameColorAll.put("SQL*Net message to client",new Color(222,49,99));
seriesNameColorAll.put("SQL*Net message to dblink",new Color(0,123,167));
seriesNameColorAll.put("SQL*Net more data to client",new Color(42,82,190));
seriesNameColorAll.put("SQL*Net more data to dblink",new Color(127,255,0));
seriesNameColorAll.put("SQL*Net more data from client",new Color(205,92,92));
seriesNameColorAll.put("SQL*Net message from dblink",new Color(210,105,30));
seriesNameColorAll.put("SQL*Net more data from dblink",new Color(123,63,0));
seriesNameColorAll.put("SQL*Net vector data to client",new Color(0,71,171));
seriesNameColorAll.put("SQL*Net vector data from client",new Color(184,115,51));
seriesNameColorAll.put("SQL*Net vector data to dblink",new Color(255,127,80));
seriesNameColorAll.put("SQL*Net vector data from dblink",new Color(251,236,93));
seriesNameColorAll.put("remote db file read",new Color(100,149,237));
// Scheduler
seriesNameColorAll.put("resmgr:cpu quantum",new Color(255,253,208));
seriesNameColorAll.put("resmgr:become active",new Color(220,20,60));
seriesNameColorAll.put("resmgr:I/O prioritization",new Color(0,255,255));
// Configuration
seriesNameColorAll.put("free buffer waits",new Color(101,67,33));
seriesNameColorAll.put("wait for EMON to process ntfns",new Color(8,69,126));
seriesNameColorAll.put("write complete waits",new Color(152,105,96));
seriesNameColorAll.put("latch: redo writing",new Color(205,91,69));
seriesNameColorAll.put("latch: redo copy",new Color(184,134,11));
seriesNameColorAll.put("log buffer space",new Color(1,50,32));
seriesNameColorAll.put("log file switch (checkpoint incomplete)",new Color(49,0,98));
seriesNameColorAll.put("log file switch (private strand flush incomplete)",new Color(189,183,107));
seriesNameColorAll.put("log file switch (archiving needed)",new Color(85,104,50));
seriesNameColorAll.put("log file switch completion",new Color(3,192,60));
seriesNameColorAll.put("enq: ST - contention",new Color(255,218,185));
seriesNameColorAll.put("undo segment extension",new Color(231,84,128));
seriesNameColorAll.put("undo segment tx slot",new Color(233,150,122));
seriesNameColorAll.put("enq: TX - allocate ITL entry",new Color(86,3,25));
seriesNameColorAll.put("statement suspended, wait error to be cleared",new Color(47,79,79));
seriesNameColorAll.put("enq: HW - contention",new Color(23,114,69));
seriesNameColorAll.put("enq: SS - contention",new Color(145,129,81));
seriesNameColorAll.put("sort segment request",new Color(255,168,18));
seriesNameColorAll.put("enq: SQ - contention",new Color(186,219,173));
seriesNameColorAll.put("Global transaction acquire instance locks",new Color(17,96,98));
seriesNameColorAll.put("checkpoint completed",new Color(66,49,137));
// ** 10g1 ** //
seriesNameColorAll.put("AQ Deallocate Wait",new Color(21,96,189));
// Commit
seriesNameColorAll.put("enq: BB - 2PC across RAC instances",new Color(21,96,189));
seriesNameColorAll.put("log file sync",new Color(30,144,255));
// Cluster
seriesNameColorAll.put("ASM PST query : wait for [PM][grp][0] grant",new Color(80,200,120));
seriesNameColorAll.put("gc claim",new Color(153,0,102));
seriesNameColorAll.put("retry contact SCN lock master",new Color(79,121,66));
seriesNameColorAll.put("gc buffer busy acquire",new Color(238,220,130));
seriesNameColorAll.put("gc buffer busy release",new Color(255,0,255));
seriesNameColorAll.put("pi renounce write complete",new Color(228,155,15));
seriesNameColorAll.put("gc current request",new Color(255,215,0));
seriesNameColorAll.put("gc cr request",new Color(218,165,32));
seriesNameColorAll.put("gc cr disk request",new Color(70,89,69));
seriesNameColorAll.put("gc cr multi block request",new Color(202,218,186));
seriesNameColorAll.put("gc current multi block request",new Color(0,255,0));
seriesNameColorAll.put("gc block recovery request",new Color(173,255,47));
seriesNameColorAll.put("gc cr block 2-way",new Color(0,125,255));
seriesNameColorAll.put("gc cr block 3-way",new Color(223,115,255));
seriesNameColorAll.put("gc cr block busy",new Color(252,15,192));
seriesNameColorAll.put("gc cr block congested",new Color(75,0,130));
seriesNameColorAll.put("gc cr failure",new Color(255,79,0));
seriesNameColorAll.put("gc cr block lost",new Color(0,168,107));
seriesNameColorAll.put("gc cr block unknown",new Color(195,176,145));
seriesNameColorAll.put("gc current block 2-way",new Color(58,117,196));
seriesNameColorAll.put("gc current block 3-way",new Color(230,230,250));
seriesNameColorAll.put("gc current block busy",new Color(255,240,245));
seriesNameColorAll.put("gc current block congested",new Color(253,233,16));
seriesNameColorAll.put("gc current retry",new Color(255,250,205));
seriesNameColorAll.put("gc current block lost",new Color(205,133,63));
seriesNameColorAll.put("gc current split",new Color(200,162,200));
seriesNameColorAll.put("gc current block unknown",new Color(204,255,0));
seriesNameColorAll.put("gc cr grant 2-way",new Color(250,240,230));
seriesNameColorAll.put("gc cr grant busy",new Color(255,0,255));
seriesNameColorAll.put("gc cr grant congested",new Color(11,218,81));
seriesNameColorAll.put("gc cr grant unknown",new Color(128,0,0));
seriesNameColorAll.put("gc cr disk read",new Color(153,51,102));
seriesNameColorAll.put("gc current grant 2-way",new Color(0,51,102));
seriesNameColorAll.put("gc current grant busy",new Color(152,255,152));
seriesNameColorAll.put("gc current grant congested",new Color(173,223,173));
seriesNameColorAll.put("gc current grant unknown",new Color(153,122,141));
seriesNameColorAll.put("gc freelist",new Color(255,219,88));
seriesNameColorAll.put("gc remaster",new Color(255,222,173));
seriesNameColorAll.put("gc quiesce",new Color(0,0,128));
seriesNameColorAll.put("gc object scan",new Color(204,119,34));
seriesNameColorAll.put("gc current cancel",new Color(207,181,59));
seriesNameColorAll.put("gc cr cancel",new Color(128,128,0));
seriesNameColorAll.put("gc assume",new Color(107,142,35));
seriesNameColorAll.put("gc domain validation",new Color(255,165,0));
seriesNameColorAll.put("gc recovery free",new Color(218,112,214));
seriesNameColorAll.put("gc recovery quiesce",new Color(175,238,238));
seriesNameColorAll.put("lock remastering",new Color(152,118,84));
// ** 10g2 ** //
seriesNameColorAll.put("gc prepare",new Color(175,64,53));
seriesNameColorAll.put("gc buffer busy",new Color(221,173,175));
// ** 10g1 ** //
seriesNameColorAll.put("contacting SCN server or SCN lock master",new Color(175,64,53));
seriesNameColorAll.put("gc quiesce wait",new Color(221,173,175));
// Concurency
seriesNameColorAll.put("library cache load lock",new Color(175,64,53));
seriesNameColorAll.put("library cache: mutex X",new Color(221,173,175));
seriesNameColorAll.put("library cache: mutex S",new Color(171,205,239));
seriesNameColorAll.put("resmgr:internal state change",new Color(249,132,229));
seriesNameColorAll.put("resmgr:internal state cleanup",new Color(153,102,102));
seriesNameColorAll.put("resmgr:sessions to exit",new Color(250,218,221));
seriesNameColorAll.put("pipe put",new Color(219,112,147));
seriesNameColorAll.put("logout restrictor",new Color(218,189,171));
seriesNameColorAll.put("os thread startup",new Color(199,252,236));
seriesNameColorAll.put("Shared IO Pool Memory",new Color(255,239,213));
seriesNameColorAll.put("latch: cache buffers chains",new Color(119,221,119));
seriesNameColorAll.put("buffer busy waits",new Color(255,209,220));
seriesNameColorAll.put("enq: TX - index contention",new Color(255,229,180));
seriesNameColorAll.put("latch: Undo Hint Latch",new Color(255,204,153));
seriesNameColorAll.put("latch: In memory undo latch",new Color(250,223,173));
seriesNameColorAll.put("latch: MQL Tracking Latch",new Color(209,226,49));
seriesNameColorAll.put("enq: WG - lock fso",new Color(204,204,255));
seriesNameColorAll.put("latch: row cache objects",new Color(255,5,102));
seriesNameColorAll.put("row cache lock",new Color(1,121,111));
seriesNameColorAll.put("row cache read",new Color(255,192,203));
seriesNameColorAll.put("cursor: mutex X",new Color(255,153,102));
seriesNameColorAll.put("cursor: mutex S",new Color(102,0,102));
seriesNameColorAll.put("cursor: pin S wait on X",new Color(0,51,153));
seriesNameColorAll.put("latch: shared pool",new Color(204,136,153));
seriesNameColorAll.put("library cache pin",new Color(0,49,83));
seriesNameColorAll.put("library cache lock",new Color(255,117,24));
// ** 10g2 ** //
seriesNameColorAll.put("latch: library cache pin", new Color(0,49,83));
seriesNameColorAll.put("latch: library cache", new Color(234,234,86));
seriesNameColorAll.put("latch: library cache lock", new Color(255,117,24));
// System I/O
seriesNameColorAll.put("kfk: async disk IO",new Color(102,0,153));
seriesNameColorAll.put("db file parallel write",new Color(115,74,18));
seriesNameColorAll.put("Log archive I/O",new Color(255,0,0));
seriesNameColorAll.put("RMAN backup & recovery I/O",new Color(199,21,133));
seriesNameColorAll.put("Standby redo I/O",new Color(0,204,204));
seriesNameColorAll.put("Network file transfer",new Color(65,105,225));
seriesNameColorAll.put("io done",new Color(117,90,87));
seriesNameColorAll.put("control file sequential read",new Color(183,65,14));
seriesNameColorAll.put("control file single write",new Color(255,153,0));
seriesNameColorAll.put("control file parallel write",new Color(244,196,48));
seriesNameColorAll.put("recovery read",new Color(8,37,103));
seriesNameColorAll.put("LNS ASYNC control file txn",new Color(255,140,105));
seriesNameColorAll.put("LGWR sequential i/o",new Color(244,164,96));
seriesNameColorAll.put("LGWR random i/o",new Color(146,0,10));
seriesNameColorAll.put("RFS sequential i/o",new Color(255,36,0));
seriesNameColorAll.put("RFS random i/o",new Color(255,216,0));
seriesNameColorAll.put("RFS write",new Color(46,139,87));
seriesNameColorAll.put("ARCH sequential i/o",new Color(255,245,238));
seriesNameColorAll.put("ARCH random i/o",new Color(255,186,0));
seriesNameColorAll.put("log file sequential read",new Color(70,130,180));
seriesNameColorAll.put("log file single write",new Color(192,192,192));
seriesNameColorAll.put("log file parallel write",new Color(112,128,144));
seriesNameColorAll.put("ksfd: async disk IO",new Color(0,255,127));
seriesNameColorAll.put("async disk IO",new Color(0,255,0));
// ** 10g2 ** //
seriesNameColorAll.put("ARCH wait for pending I/Os",new Color(70,130,180));
seriesNameColorAll.put("kst: async disk IO",new Color(152,183,142));
// Administrative
seriesNameColorAll.put("alter system set dispatcher",new Color(70,130,180));
seriesNameColorAll.put("connectionMetadata pool wait",new Color(152,183,142));
seriesNameColorAll.put("enq: DB - contention",new Color(210,180,140));
seriesNameColorAll.put("enq: ZG - contention",new Color(205,87,0));
seriesNameColorAll.put("ASM COD rollback operation completion",new Color(255,204,0));
seriesNameColorAll.put("ASM mount : wait for heartbeat",new Color(227,38,54));
seriesNameColorAll.put("JS kgl get object wait",new Color(55,191,0));
seriesNameColorAll.put("JS kill job wait",new Color(153,102,204));
seriesNameColorAll.put("JS coord start wait",new Color(123,160,91));
seriesNameColorAll.put("Backup: sbtinit",new Color(0,255,255));
seriesNameColorAll.put("Backup: sbtopen",new Color(127,255,212));
seriesNameColorAll.put("Backup: sbtread",new Color(0,127,255));
seriesNameColorAll.put("Backup: sbtwrite",new Color(0,149,182));
seriesNameColorAll.put("Backup: sbtclose",new Color(181,166,66));
seriesNameColorAll.put("Backup: sbtinfo",new Color(204,85,0));
seriesNameColorAll.put("Backup: sbtremove",new Color(102,255,0));
seriesNameColorAll.put("Backup: sbtbackup",new Color(0,0,255));
seriesNameColorAll.put("Backup: sbtclose2",new Color(205,127,50));
seriesNameColorAll.put("Backup: sbtcommand",new Color(150,75,0));
seriesNameColorAll.put("Backup: sbtend",new Color(240,220,130));
seriesNameColorAll.put("Backup: sbterror",new Color(128,0,32));
seriesNameColorAll.put("Backup: sbtinfo2",new Color(204,85,0));
seriesNameColorAll.put("Backup: sbtinit2",new Color(233,116,81));
seriesNameColorAll.put("Backup: sbtread2",new Color(138,51,36));
seriesNameColorAll.put("Backup: sbtremove2",new Color(120,134,107));
seriesNameColorAll.put("Backup: sbtrestore",new Color(196,30,58));
seriesNameColorAll.put("Backup: sbtwrite2",new Color(150,0,24));
seriesNameColorAll.put("Backup: sbtpcbackup",new Color(237,145,33));
seriesNameColorAll.put("Backup: sbtpccancel",new Color(172,225,175));
seriesNameColorAll.put("Backup: sbtpccommit",new Color(222,49,99));
seriesNameColorAll.put("Backup: sbtpcend",new Color(0,123,167));
seriesNameColorAll.put("Backup: sbtpcquerybackup",new Color(42,82,190));
seriesNameColorAll.put("Backup: sbtpcqueryrestore",new Color(127,255,0));
seriesNameColorAll.put("Backup: sbtpcrestore",new Color(205,92,92));
seriesNameColorAll.put("Backup: sbtpcstart",new Color(210,105,30));
seriesNameColorAll.put("Backup: sbtpcstatus",new Color(123,63,0));
seriesNameColorAll.put("Backup: sbtpcvalidate",new Color(0,71,171));
seriesNameColorAll.put("Backup: sbtgetbuf",new Color(184,115,51));
seriesNameColorAll.put("Backup: sbtrelbuf",new Color(255,127,80));
seriesNameColorAll.put("Backup: sbtmapbuf",new Color(251,236,93));
seriesNameColorAll.put("Backup: sbtbufinfo",new Color(100,149,237));
seriesNameColorAll.put("multiple dbwriter suspend/resume for file offline",new Color(255,253,208));
seriesNameColorAll.put("buffer pool resize",new Color(220,20,60));
seriesNameColorAll.put("switch logfile command",new Color(0,255,255));
seriesNameColorAll.put("wait for possible quiesce finish",new Color(101,67,33));
seriesNameColorAll.put("switch undo - offline",new Color(8,69,126));
seriesNameColorAll.put("alter rbs offline",new Color(152,105,96));
seriesNameColorAll.put("enq: TW - contention",new Color(205,91,69));
seriesNameColorAll.put("index (re)build online start",new Color(184,134,11));
seriesNameColorAll.put("index (re)build online cleanup",new Color(1,50,32));
seriesNameColorAll.put("index (re)build online merge",new Color(49,0,98));
// ** 10g1 ** //
seriesNameColorAll.put("refresh controlfile command",new Color(189,183,107));
// Application
seriesNameColorAll.put("enq: PW - flush prewarm buffers",new Color(189,183,107));
seriesNameColorAll.put("WCR: replay lock order",new Color(85,104,50));
seriesNameColorAll.put("enq: RO - fast object reuse",new Color(3,192,60));
seriesNameColorAll.put("enq: KO - fast object checkpoint",new Color(231,84,128));
seriesNameColorAll.put("enq: TM - contention",new Color(233,150,122));
seriesNameColorAll.put("enq: TX - row lock contention",new Color(86,3,25));
seriesNameColorAll.put("Wait for Table Lock",new Color(47,79,79));
seriesNameColorAll.put("enq: RC - Result Cache: Contention",new Color(23,114,69));
seriesNameColorAll.put("Streams capture: filter callback waiting for ruleset",new Color(145,129,81));
seriesNameColorAll.put("Streams: apply reader waiting for DDL to apply",new Color(255,168,18));
seriesNameColorAll.put("SQL*Net break/reset to client",new Color(186,219,173));
seriesNameColorAll.put("SQL*Net break/reset to dblink",new Color(17,96,98));
seriesNameColorAll.put("enq: UL - contention",new Color(66,49,137));
seriesNameColorAll.put("OLAP DML Sleep",new Color(21,96,189));
seriesNameColorAll.put("enq: RO - contention",new Color(30,144,255));
// ** 10g1 ** //
seriesNameColorAll.put("STREAMS apply slave waiting for coord message",new Color(227,38,54));
seriesNameColorAll.put("Streams: Wating for DDL to apply",new Color(55,191,0));
// Latches for Oracle 9i
seriesNameColorAll.put("latch: latch wait list", new Color(227,38,54));
seriesNameColorAll.put("latch: event range base latch", new Color(55,191,0));
seriesNameColorAll.put("latch: post/wait queue", new Color(153,102,204));
seriesNameColorAll.put("latch: process allocation", new Color(123,160,91));
seriesNameColorAll.put("latch: session allocation", new Color(152,105,96));
seriesNameColorAll.put("latch: session switching", new Color(127,255,212));
seriesNameColorAll.put("latch: process group creation", new Color(0,127,255));
seriesNameColorAll.put("latch: session idle bit", new Color(0,149,182));
seriesNameColorAll.put("latch: longop free list parent", new Color(181,166,66));
seriesNameColorAll.put("latch: cached attr list", new Color(204,85,0));
seriesNameColorAll.put("latch: object stats modification", new Color(102,255,0));
seriesNameColorAll.put("latch: Testing", new Color(0,0,255));
seriesNameColorAll.put("latch: shared java pool", new Color(205,127,50));
seriesNameColorAll.put("latch: latch for background adjusted parameters", new Color(150,75,0));
seriesNameColorAll.put("latch: event group latch", new Color(240,220,130));
seriesNameColorAll.put("latch: messages", new Color(128,0,32));
seriesNameColorAll.put("latch: enqueues", new Color(204,85,0));
seriesNameColorAll.put("latch: enqueue hash chains", new Color(66,49,137));
seriesNameColorAll.put("latch: instance enqueue", new Color(138,51,36));
seriesNameColorAll.put("latch: trace latch", new Color(120,134,107));
seriesNameColorAll.put("latch: FOB s.o list latch", new Color(196,30,58));
seriesNameColorAll.put("latch: FIB s.o chain latch", new Color(150,0,24));
seriesNameColorAll.put("latch: KSFQ", new Color(237,145,33));
seriesNameColorAll.put("latch: X$KSFQP", new Color(172,225,175));
seriesNameColorAll.put("latch: i/o slave adaptor", new Color(222,49,99));
seriesNameColorAll.put("latch: ksfv messages", new Color(70,130,180));
seriesNameColorAll.put("latch: msg queue latch", new Color(152,183,142));
seriesNameColorAll.put("latch: done queue latch", new Color(210,180,140));
seriesNameColorAll.put("latch: session queue latch", new Color(205,87,0));
seriesNameColorAll.put("latch: direct msg latch", new Color(255,204,0));
seriesNameColorAll.put("latch: vecio buf des", new Color(227,38,54));
seriesNameColorAll.put("latch: ksfv subheap", new Color(55,191,0));
seriesNameColorAll.put("latch: resmgr group change latch", new Color(153,102,204));
seriesNameColorAll.put("latch: channel handle pool latch", new Color(123,160,91));
seriesNameColorAll.put("latch: channel operations parent latch", new Color(0,255,255));
seriesNameColorAll.put("latch: message pool operations parent latch", new Color(127,255,212));
seriesNameColorAll.put("latch: channel anchor", new Color(0,127,255));
seriesNameColorAll.put("latch: dynamic channels", new Color(0,149,182));
seriesNameColorAll.put("latch: first spare latch", new Color(181,166,66));
seriesNameColorAll.put("latch: second spare latch", new Color(204,85,0));
seriesNameColorAll.put("latch: ksxp tid allocation", new Color(102,255,0));
seriesNameColorAll.put("latch: segmented array pool", new Color(0,0,255));
seriesNameColorAll.put("latch: granule operation", new Color(205,127,50));
seriesNameColorAll.put("latch: KSXR large replies", new Color(150,75,0));
seriesNameColorAll.put("latch: SGA mapping latch", new Color(240,220,130));
seriesNameColorAll.put("latch: ges process table freelist", new Color(128,0,32));
seriesNameColorAll.put("latch: ges process parent latch", new Color(204,85,0));
seriesNameColorAll.put("latch: ges process hash list", new Color(233,116,81));
seriesNameColorAll.put("latch: ges resource table freelist", new Color(138,51,36));
seriesNameColorAll.put("latch: ges caches resource lists", new Color(120,134,107));
seriesNameColorAll.put("latch: ges resource hash list", new Color(196,30,58));
seriesNameColorAll.put("latch: ges resource scan list", new Color(150,0,24));
seriesNameColorAll.put("latch: ges s-lock bitvec freelist", new Color(237,145,33));
seriesNameColorAll.put("latch: ges enqueue table freelist", new Color(172,225,175));
seriesNameColorAll.put("latch: ges timeout list", new Color(222,49,99));
seriesNameColorAll.put("latch: ges deadlock list", new Color(0,123,167));
seriesNameColorAll.put("latch: ges statistic table", new Color(42,82,190));
seriesNameColorAll.put("latch: ges synchronous data", new Color(127,255,0));
seriesNameColorAll.put("latch: KJC message pool free list", new Color(205,92,92));
seriesNameColorAll.put("latch: KJC receiver ctx free list", new Color(210,105,30));
seriesNameColorAll.put("latch: KJC snd proxy ctx free list", new Color(123,63,0));
seriesNameColorAll.put("latch: KJC destination ctx free list", new Color(0,71,171));
seriesNameColorAll.put("latch: KJC receiver queue access list", new Color(184,115,51));
seriesNameColorAll.put("latch: KJC snd proxy queue access list", new Color(255,127,80));
seriesNameColorAll.put("latch: KJC global post event buffer", new Color(251,236,93));
seriesNameColorAll.put("latch: KJCT receiver queue access", new Color(100,149,237));
seriesNameColorAll.put("latch: KJCT flow control latch", new Color(255,253,208));
seriesNameColorAll.put("latch: ges domain table", new Color(220,20,60));
seriesNameColorAll.put("latch: ges group table", new Color(0,255,255));
seriesNameColorAll.put("latch: ges group parent", new Color(101,67,33));
seriesNameColorAll.put("latch: gcs resource hash", new Color(8,69,126));
seriesNameColorAll.put("latch: gcs opaque info freelist", new Color(152,105,96));
seriesNameColorAll.put("latch: gcs resource freelist", new Color(205,91,69));
seriesNameColorAll.put("latch: gcs resource scan list", new Color(184,134,11));
seriesNameColorAll.put("latch: gcs shadows freelist", new Color(1,50,32));
seriesNameColorAll.put("latch: name-service entry", new Color(49,0,98));
seriesNameColorAll.put("latch: name-service request queue", new Color(189,183,107));
seriesNameColorAll.put("latch: name-service pending queue", new Color(85,104,50));
seriesNameColorAll.put("latch: name-service namespace bucket", new Color(3,192,60));
seriesNameColorAll.put("latch: name-service memory objects", new Color(231,84,128));
seriesNameColorAll.put("latch: name-service namespace objects", new Color(233,150,122));
seriesNameColorAll.put("latch: name-service request", new Color(86,3,25));
seriesNameColorAll.put("latch: ges struct kjmddp", new Color(47,79,79));
seriesNameColorAll.put("latch: gcs partitioned table hash", new Color(23,114,69));
seriesNameColorAll.put("latch: gcs pcm hashed value bucket hash", new Color(145,129,81));
seriesNameColorAll.put("latch: gcs partitioned freelist", new Color(255,168,18));
seriesNameColorAll.put("latch: gcs remaster request queue", new Color(186,219,173));
seriesNameColorAll.put("latch: file number translation table", new Color(17,96,98));
seriesNameColorAll.put("latch: mostly latch-free SCN", new Color(66,49,137));
seriesNameColorAll.put("latch: lgwr LWN SCN", new Color(21,96,189));
seriesNameColorAll.put("latch: redo on-disk SCN", new Color(30,144,255));
seriesNameColorAll.put("latch: Consistent RBA", new Color(175,64,53));
seriesNameColorAll.put("latch: batching SCNs", new Color(221,173,175));
seriesNameColorAll.put("latch: cache buffers lru chain", new Color(0,189,255));
seriesNameColorAll.put("latch: buffer pool", new Color(249,132,229));
seriesNameColorAll.put("latch: multiple dbwriter suspend", new Color(153,102,102));
seriesNameColorAll.put("latch: active checkpoint queue latch", new Color(61,43,31));
seriesNameColorAll.put("latch: checkpoint queue latch", new Color(219,112,147));
seriesNameColorAll.put("latch: cache buffers chains", new Color(119,221,119));
seriesNameColorAll.put("latch: cache buffer handles", new Color(199,252,236));
seriesNameColorAll.put("latch: multiblock read objects", new Color(255,239,213));
seriesNameColorAll.put("latch: cache protection latch", new Color(119,221,119));
seriesNameColorAll.put("latch: simulator lru latch", new Color(255,209,220));
seriesNameColorAll.put("latch: simulator hash latch", new Color(255,229,180));
seriesNameColorAll.put("latch: sim partition latch", new Color(255,204,153));
seriesNameColorAll.put("latch: state object free list", new Color(250,223,173));
seriesNameColorAll.put("latch: LGWR NS Write", new Color(209,226,49));
seriesNameColorAll.put("latch: archive control", new Color(204,204,255));
seriesNameColorAll.put("latch: archive process latch", new Color(102,0,255));
seriesNameColorAll.put("latch: managed standby latch", new Color(1,121,111));
seriesNameColorAll.put("latch: FAL subheap alocation", new Color(255,192,203));
seriesNameColorAll.put("latch: FAL request queue", new Color(255,153,102));
seriesNameColorAll.put("latch: alert log latch", new Color(102,0,102));
seriesNameColorAll.put("latch: redo writing", new Color(205,91,69));
seriesNameColorAll.put("latch: redo copy", new Color(184,134,11));
seriesNameColorAll.put("latch: redo allocation", new Color(30,144,220));
seriesNameColorAll.put("latch: OS file lock latch", new Color(255,117,24));
seriesNameColorAll.put("latch: KCL instance latch", new Color(102,0,153));
seriesNameColorAll.put("latch: KCL gc element parent latch", new Color(115,74,18));
seriesNameColorAll.put("latch: KCL name table parent latch", new Color(255,0,0));
seriesNameColorAll.put("latch: KCL freelist parent latch", new Color(199,21,133));
seriesNameColorAll.put("latch: KCL bast context freelist latch", new Color(0,204,204));
seriesNameColorAll.put("latch: loader state object freelist", new Color(65,105,225));
seriesNameColorAll.put("latch: begin backup scn array", new Color(117,90,87));
seriesNameColorAll.put("latch: Managed Standby Recovery State", new Color(183,65,14));
seriesNameColorAll.put("latch: TLCR context", new Color(255,153,0));
seriesNameColorAll.put("latch: TLCR meta context", new Color(244,196,48));
seriesNameColorAll.put("latch: logical standby cache", new Color(8,37,103));
seriesNameColorAll.put("latch: Media rcv so alloc latch", new Color(255,140,105));
seriesNameColorAll.put("latch: parallel recoverable recovery", new Color(244,164,96));
seriesNameColorAll.put("latch: block media rcv so alloc latch", new Color(146,0,10));
seriesNameColorAll.put("latch: mapped buffers lru chain", new Color(255,36,0));
seriesNameColorAll.put("latch: dml lock allocation", new Color(255,216,0));
seriesNameColorAll.put("latch: list of block allocation", new Color(46,139,87));
seriesNameColorAll.put("latch: transaction allocation", new Color(255,245,238));
seriesNameColorAll.put("latch: dummy allocation", new Color(255,186,0));
seriesNameColorAll.put("latch: transaction branch allocation", new Color(70,130,180));
seriesNameColorAll.put("latch: commit callback allocation", new Color(192,192,192));
seriesNameColorAll.put("latch: sort extent pool", new Color(112,128,144));
seriesNameColorAll.put("latch: undo global data", new Color(0,255,127));
seriesNameColorAll.put("latch: ktm global data", new Color(112,5,102));
seriesNameColorAll.put("latch: parallel txn reco latch", new Color(10,31,153));
seriesNameColorAll.put("latch: intra txn parallel recovery", new Color(214,126,153));
seriesNameColorAll.put("latch: resumable state object", new Color(0,39,73));
seriesNameColorAll.put("latch: sequence cache", new Color(245,127,34));
seriesNameColorAll.put("latch: temp lob duration state obj allocation", new Color(112,0,153));
seriesNameColorAll.put("latch: row cache enqueue latch", new Color(125,79,18));
seriesNameColorAll.put("latch: row cache objects", new Color(255,5,102));
seriesNameColorAll.put("latch: dictionary lookup", new Color(189,31,133));
seriesNameColorAll.put("latch: cost function", new Color(0,194,194));
seriesNameColorAll.put("latch: user lock", new Color(65,125,225));
seriesNameColorAll.put("latch: global ctx hash table latch", new Color(107,80,87));
seriesNameColorAll.put("latch: comparison bit cache", new Color(153,65,14));
seriesNameColorAll.put("latch: instance information", new Color(255,173,10));
seriesNameColorAll.put("latch: policy information", new Color(234,186,48));
seriesNameColorAll.put("latch: global tx hash mapping", new Color(10,47,123));
seriesNameColorAll.put("latch: shared pool", new Color(0,0,103));
seriesNameColorAll.put("latch: library cache", new Color(234,234,86));
seriesNameColorAll.put("latch: library cache pin", new Color(0,49,83));
seriesNameColorAll.put("latch: library cache pin allocation", new Color(235,36,10));
seriesNameColorAll.put("latch: library cache load lock", new Color(175,64,53));
seriesNameColorAll.put("latch: Token Manager", new Color(56,129,87));
seriesNameColorAll.put("latch: Direct I/O Adaptor", new Color(255,235,228));
seriesNameColorAll.put("latch: cas latch", new Color(0,0,100));
seriesNameColorAll.put("latch: rm cas latch", new Color(102,70,30));
seriesNameColorAll.put("latch: resmgr:runnable lists", new Color(182,189,192));
seriesNameColorAll.put("latch: resmgr:actses change state", new Color(112,138,134));
seriesNameColorAll.put("latch: resmgr:actses change group", new Color(30,255,127));
seriesNameColorAll.put("latch: resmgr:session queuing", new Color(70,140,170));
seriesNameColorAll.put("latch: resmgr:actses active list", new Color(162,173,142));
seriesNameColorAll.put("latch: resmgr:free threads list", new Color(200,185,140));
seriesNameColorAll.put("latch: resmgr:schema config", new Color(205,87,25));
seriesNameColorAll.put("latch: resmgr:gang list", new Color(255,184,0));
seriesNameColorAll.put("latch: resmgr:queued list", new Color(255,50,255));
seriesNameColorAll.put("latch: resmgr:running actses count", new Color(228,185,45));
seriesNameColorAll.put("latch: resmgr:vc list latch", new Color(215,205,10));
seriesNameColorAll.put("latch: resmgr:method mem alloc latch", new Color(208,155,52));
seriesNameColorAll.put("latch: resmgr:plan CPU method", new Color(108,128,158));
seriesNameColorAll.put("latch: resmgr:resource group CPU method", new Color(80,79,69));
seriesNameColorAll.put("latch: QMT", new Color(232,228,176));
seriesNameColorAll.put("latch: dispatcher configuration", new Color(10,245,30));
seriesNameColorAll.put("latch: session timer", new Color(153,255,77));
seriesNameColorAll.put("latch: parameter list", new Color(0,125,255));
seriesNameColorAll.put("latch: presentation list", new Color(203,105,255));
seriesNameColorAll.put("latch: address list", new Color(232,15,152));
seriesNameColorAll.put("latch: end-point list", new Color(70,40,130));
seriesNameColorAll.put("latch: virtual circuit buffers", new Color(235,79,20));
seriesNameColorAll.put("latch: virtual circuit queues", new Color(50,168,107));
seriesNameColorAll.put("latch: virtual circuits", new Color(195,146,135));
seriesNameColorAll.put("latch: kmcptab latch", new Color(78,107,196));
seriesNameColorAll.put("latch: kmcpvec latch", new Color(220,200,250));
seriesNameColorAll.put("latch: JOX SGA heap latch", new Color(255,230,235));
seriesNameColorAll.put("latch: job_queue_processes parameter latch", new Color(223,213,16));
seriesNameColorAll.put("latch: job workq parent latch", new Color(245,240,225));
seriesNameColorAll.put("latch: child cursor hash table", new Color(10,47,123));
seriesNameColorAll.put("latch: query server process", new Color(210,152,180));
seriesNameColorAll.put("latch: query server freelists", new Color(224,245,30));
seriesNameColorAll.put("latch: error message lists", new Color(240,230,200));
seriesNameColorAll.put("latch: process queue", new Color(245,10,225));
seriesNameColorAll.put("latch: process queue reference", new Color(19,208,51));
seriesNameColorAll.put("latch: parallel query stats", new Color(128,30,20));
seriesNameColorAll.put("latch: parallel query alloc buffer", new Color(153,81,122));
seriesNameColorAll.put("latch: hash table modification latch", new Color(40,51,120));
seriesNameColorAll.put("latch: hash table column usage latch", new Color(132,255,122));
seriesNameColorAll.put("latch: constraint object allocation", new Color(173,203,125));
seriesNameColorAll.put("latch: device information", new Color(227,38,54));
seriesNameColorAll.put("latch: temporary table state object allocation", new Color(55,191,0));
seriesNameColorAll.put("latch: internal temp table object number allocation latch", new Color(153,102,204));
seriesNameColorAll.put("latch: SQL memory manager latch", new Color(123,160,91));
seriesNameColorAll.put("latch: SQL memory manager workarea list latch", new Color(0,255,255));
seriesNameColorAll.put("latch: ncodef allocation latch", new Color(127,255,212));
seriesNameColorAll.put("latch: NLS data objects", new Color(0,127,255));
seriesNameColorAll.put("latch: numer of job queues for server notfn", new Color(0,149,182));
seriesNameColorAll.put("latch: message enqueue sync latch", new Color(181,166,66));
seriesNameColorAll.put("latch: bufq subscriber channel", new Color(204,85,0));
seriesNameColorAll.put("latch: non-pers queues instances", new Color(102,255,0));
seriesNameColorAll.put("latch: queue sender's info. latch", new Color(0,0,255));
seriesNameColorAll.put("latch: browsers latch", new Color(205,127,50));
seriesNameColorAll.put("latch: enqueue buffered messages latch", new Color(150,75,0));
seriesNameColorAll.put("latch: dequeue sob latch", new Color(240,220,130));
seriesNameColorAll.put("latch: spilled messages latch", new Color(128,0,32));
seriesNameColorAll.put("latch: spilled msgs queues list latch", new Color(233,116,81));
seriesNameColorAll.put("latch: dynamic channels context latch", new Color(138,51,36));
seriesNameColorAll.put("latch: image handles of buffered messages latch", new Color(120,134,107));
seriesNameColorAll.put("latch: kwqit: protect wakeup time", new Color(196,30,58));
seriesNameColorAll.put("latch: KWQP Prop Status", new Color(150,0,24));
seriesNameColorAll.put("latch: AQ Propagation Scheduling Proc Table", new Color(237,145,33));
seriesNameColorAll.put("latch: AQ Propagation Scheduling System Load", new Color(172,225,175));
seriesNameColorAll.put("latch: process", new Color(222,49,99));
seriesNameColorAll.put("latch: fixed table rows for x$hs_session", new Color(0,123,167));
seriesNameColorAll.put("latch: qm_init_sga", new Color(42,82,190));
seriesNameColorAll.put("latch: XDB unused session pool", new Color(127,255,0));
seriesNameColorAll.put("latch: XDB used session pool", new Color(205,92,92));
seriesNameColorAll.put("latch: XDB Config", new Color(210,105,30));
seriesNameColorAll.put("latch: DMON Process Context Latch", new Color(123,63,0));
seriesNameColorAll.put("latch: DMON Work Queues Latch", new Color(0,71,171));
seriesNameColorAll.put("latch: RSM process latch", new Color(184,115,51));
seriesNameColorAll.put("latch: RSM SQL latch", new Color(255,127,80));
seriesNameColorAll.put("latch: Request id generation latch", new Color(251,236,93));
seriesNameColorAll.put("latch: xscalc freelist", new Color(100,149,237));
seriesNameColorAll.put("latch: xssinfo freelist", new Color(255,253,208));
seriesNameColorAll.put("latch: AW SGA latch", new Color(220,20,60));
/** Enqueues */
seriesNameColorAll.put("enq: TX - contention, req: 0",new Color( 172,225,175));
seriesNameColorAll.put("enq: TX - contention, req: 1",new Color(138,51,36));
seriesNameColorAll.put("enq: TX - contention, req: 2",new Color(120,134,107));
seriesNameColorAll.put("enq: TX - contention, req: 3",new Color(196,30,58));
seriesNameColorAll.put("enq: TX - contention, req: 4",new Color(150,0,24));
seriesNameColorAll.put("enq: TX - contention, req: 5",new Color(237,145,33));
seriesNameColorAll.put("enq: TX - contention, req: 6",new Color(233,116,81));
seriesNameColorAll.put("enq: TM - contention, req: 0",new Color(222,49,99));
seriesNameColorAll.put("enq: TM - contention, req: 1",new Color(0,123,167));
seriesNameColorAll.put("enq: TM - contention, req: 2",new Color(42,82,190));
seriesNameColorAll.put("enq: TM - contention, req: 3",new Color(127,255,0));
seriesNameColorAll.put("enq: TM - contention, req: 4",new Color(205,92,92));
seriesNameColorAll.put("enq: TM - contention, req: 5",new Color(210,105,30));
seriesNameColorAll.put("enq: TM - contention, req: 6",new Color(123,63,0));
seriesNameColorAll.put("enq: BL - Buffer hash table instance lock",new Color(0,71,171));
seriesNameColorAll.put("enq: CF - Control file schema global enqueue lock",new Color(184,115,51));
seriesNameColorAll.put("enq: CI - Cross-instance function invocation instance lock",new Color(255,127,80));
seriesNameColorAll.put("enq: CS - Control file schema global enqueue lock",new Color(250,248,221));
seriesNameColorAll.put("enq: CU - Cursor bind lock",new Color(239,112,147));
seriesNameColorAll.put("enq: DF - Data file instance lock",new Color(208,179,171));
seriesNameColorAll.put("enq: DL - Direct loader parallel index create",new Color(189,242,236));
seriesNameColorAll.put("enq: DM - Mount/startup db primary/secondary instance lock",new Color(255,239,233));
seriesNameColorAll.put("enq: DR - Distributed recovery process lock",new Color(139,221,119));
seriesNameColorAll.put("enq: DX - Distributed transaction entry lock",new Color(255,229,220));
seriesNameColorAll.put("enq: FI - SGA open-file information lock",new Color(245,229,180));
seriesNameColorAll.put("enq: FS - File set lock",new Color(255,214,143));
seriesNameColorAll.put("enq: HW - Space management operations on a specific segment lock",new Color(250,213,143));
seriesNameColorAll.put("enq: IN - Instance number lock",new Color(219,216,49));
seriesNameColorAll.put("enq: IR - Instance recovery serialization global enqueue lock",new Color(204,214,245));
seriesNameColorAll.put("enq: IS - Instance state lock",new Color(122,10,255));
seriesNameColorAll.put("enq: IV - Library cache invalidation instance lock",new Color(1,111,121));
seriesNameColorAll.put("enq: JQ - Job queue lock",new Color(255,192,213));
seriesNameColorAll.put("enq: KK - Thread kick lock",new Color(245,163,112));
seriesNameColorAll.put("enq: MB - Master buffer hash table instance lock",new Color(112,5,102));
seriesNameColorAll.put("enq: MM - Mount definition gloabal enqueue lock",new Color(10,31,153));
seriesNameColorAll.put("enq: MR - Media recovery lock",new Color(214,126,153));
seriesNameColorAll.put("enq: PF - Password file lock",new Color(0,39,73));
seriesNameColorAll.put("enq: PI - Parallel operation lock",new Color(245,127,34));
seriesNameColorAll.put("enq: PR - Process startup lock",new Color(112,0,153));
seriesNameColorAll.put("enq: PS - Parallel operation lock",new Color(125,79,18));
seriesNameColorAll.put("enq: RE - USE_ROW_ENQUEUE enforcement lock",new Color(255,30,0));
seriesNameColorAll.put("enq: RT - Redo thread global enqueue lock",new Color(189,31,133));
seriesNameColorAll.put("enq: RW - Row wait enqueue lock",new Color(0,194,194));
seriesNameColorAll.put("enq: SC - System commit number instance lock",new Color(65,125,225));
seriesNameColorAll.put("enq: SH - System commit number high water mark enqueue lock",new Color(107,80,87));
seriesNameColorAll.put("enq: SM - SMON lock",new Color(153,65,14));
seriesNameColorAll.put("enq: SN - Sequence number instance lock",new Color(255,173,10));
seriesNameColorAll.put("enq: SQ - Sequence number enqueue lock",new Color(234,186,48));
seriesNameColorAll.put("enq: SS - sort segment lock",new Color(10,47,123));
seriesNameColorAll.put("enq: ST - Space transaction enqueue lock",new Color(245,130,105));
seriesNameColorAll.put("enq: SV - Sequence number value lock",new Color(234,154,86));
seriesNameColorAll.put("enq: TA - Generic enqueue lock",new Color(146,0,30));
seriesNameColorAll.put("enq: TD - DDL enqueue lock",new Color(235,36,10));
seriesNameColorAll.put("enq: TE - Extend-segment enqueue lock",new Color(245,226,0));
seriesNameColorAll.put("enq: TO - Temporary Table Object Enqueue",new Color(56,129,87));
seriesNameColorAll.put("enq: TT - Temporary table enqueue lock",new Color(255,235,228));
seriesNameColorAll.put("enq: UL - User supplied lock",new Color(250,196,0));
seriesNameColorAll.put("enq: UN - User name lock",new Color(102,70,30));
seriesNameColorAll.put("enq: US - Undo segment DDL lock",new Color(182,189,192));
seriesNameColorAll.put("enq: WL - Being-written redo log instance lock",new Color(112,138,134));
seriesNameColorAll.put("enq: WS - Write-atomic-log-switch global enqueue lock",new Color(30,255,127));
seriesNameColorAll.put("enq: TS - Temporary segment/New block allocation enqueue lock",new Color(70,140,170));
seriesNameColorAll.put("enq: LA - Library cache lock instance lock (A=namespace)",new Color(162,173,142));
seriesNameColorAll.put("enq: LB - Library cache lock instance lock (B=namespace)",new Color(200,185,140));
seriesNameColorAll.put("enq: LC - Library cache lock instance lock (C=namespace)",new Color(205,87,25));
seriesNameColorAll.put("enq: LD - Library cache lock instance lock (D=namespace)",new Color(255,184,0));
seriesNameColorAll.put("enq: LE - Library cache lock instance lock (E=namespace)",new Color(208,245,182));
seriesNameColorAll.put("enq: LF - Library cache lock instance lock (F=namespace)",new Color(5,118,118));
seriesNameColorAll.put("enq: LG - Library cache lock instance lock (G=namespace)",new Color(206,191,206));
seriesNameColorAll.put("enq: LH - Library cache lock instance lock (H=namespace)",new Color(58,203,200));
seriesNameColorAll.put("enq: LI - Library cache lock instance lock (I=namespace)",new Color(28,20,133));
seriesNameColorAll.put("enq: LJ - Library cache lock instance lock (J=namespace)",new Color(255,77,0));
seriesNameColorAll.put("enq: LK - Library cache lock instance lock (K=namespace)",new Color(129,0,250));
seriesNameColorAll.put("enq: LL - Library cache lock instance lock (L=namespace)",new Color(143,27,153));
seriesNameColorAll.put("enq: LM - Library cache lock instance lock (M=namespace)",new Color(54,120,109));
seriesNameColorAll.put("enq: LN - Library cache lock instance lock (N=namespace)",new Color(235,212,169));
seriesNameColorAll.put("enq: LO - Library cache lock instance lock (O=namespace)",new Color(211,150,220));
seriesNameColorAll.put("enq: LP - Library cache lock instance lock (P=namespace)",new Color(245,245,0));
seriesNameColorAll.put("enq: LS - Log start/log switch enqueue lock",new Color(230,184,165));
seriesNameColorAll.put("enq: PA - Library cache pin instance lock (A=namespace)",new Color(237,48,64));
seriesNameColorAll.put("enq: PB - Library cache pin instance lock (B=namespace)",new Color(245,181,10));
seriesNameColorAll.put("enq: PC - Library cache pin instance lock (C=namespace)",new Color(255,151,0));
seriesNameColorAll.put("enq: PD - Library cache pin instance lock (D=namespace)",new Color(153,102,214));
seriesNameColorAll.put("enq: PE - Library cache pin instance lock (E=namespace)",new Color(123,150,91));
seriesNameColorAll.put("enq: PF - Library cache pin instance lock (F=namespace)",new Color(0,255,235));
seriesNameColorAll.put("enq: PG - Library cache pin instance lock (G=namespace)",new Color(107,255,212));
seriesNameColorAll.put("enq: PH - Library cache pin instance lock (H=namespace)",new Color(0,137,245));
seriesNameColorAll.put("enq: PI - Library cache pin instance lock (I=namespace)",new Color(235,235,210));
seriesNameColorAll.put("enq: PJ - Library cache pin instance lock (J=namespace)",new Color(71,53,41));
seriesNameColorAll.put("enq: PL - Library cache pin instance lock (K=namespace)",new Color(10,10,255));
seriesNameColorAll.put("enq: PK - Library cache pin instance lock (L=namespace)",new Color(10,139,182));
seriesNameColorAll.put("enq: PM - Library cache pin instance lock (M=namespace)",new Color(161,156,66));
seriesNameColorAll.put("enq: PN - Library cache pin instance lock (N=namespace)",new Color(102,245,10));
seriesNameColorAll.put("enq: PO - Library cache pin instance lock (O=namespace)",new Color(50,232,222));
seriesNameColorAll.put("enq: PP - Library cache pin instance lock (P=namespace)",new Color(205,20,205));
seriesNameColorAll.put("enq: PQ - Library cache pin instance lock (Q=namespace)",new Color(235,127,50));
seriesNameColorAll.put("enq: PR - Library cache pin instance lock (R=namespace)",new Color(130,75,0));
seriesNameColorAll.put("enq: PS - Library cache pin instance lock (S=namespace)",new Color(230,210,135));
seriesNameColorAll.put("enq: PT - Library cache pin instance lock (T=namespace)",new Color(138,10,32));
seriesNameColorAll.put("enq: PU - Library cache pin instance lock (U=namespace)",new Color(194,75,0));
seriesNameColorAll.put("enq: PV - Library cache pin instance lock (V=namespace)",new Color(203,106,81));
seriesNameColorAll.put("enq: PW - Library cache pin instance lock (W=namespace)",new Color(138,41,46));
seriesNameColorAll.put("enq: PX - Library cache pin instance lock (X=namespace)",new Color(110,124,107));
seriesNameColorAll.put("enq: PY - Library cache pin instance lock (Y=namespace)",new Color(186,40,58));
seriesNameColorAll.put("enq: PZ - Library cache pin instance lock (Z=namespace)",new Color(140,10,24));
seriesNameColorAll.put("enq: QA - Row cache instance lock (A=cache)",new Color(217,155,43));
seriesNameColorAll.put("enq: QB - Row cache instance lock (B=cache)",new Color(182,215,165));
seriesNameColorAll.put("enq: QC - Row cache instance lock (C=cache)",new Color(212,59,89));
seriesNameColorAll.put("enq: QD - Row cache instance lock (D=cache)",new Color(0,103,167));
seriesNameColorAll.put("enq: QE - Row cache instance lock (E=cache)",new Color(42,82,130));
seriesNameColorAll.put("enq: QF - Row cache instance lock (F=cache)",new Color(120,250,20));
seriesNameColorAll.put("enq: QG - Row cache instance lock (G=cache)",new Color(235,82,82));
seriesNameColorAll.put("enq: QH - Row cache instance lock (H=cache)",new Color(200,160,30));
seriesNameColorAll.put("enq: QI - Row cache instance lock (I=cache)",new Color(160,53,10));
seriesNameColorAll.put("enq: QJ - Row cache instance lock (J=cache)",new Color(60,60,171));
seriesNameColorAll.put("enq: QL - Row cache instance lock (L=cache)",new Color(174,125,110));
seriesNameColorAll.put("enq: QK - Row cache instance lock (K=cache)",new Color(245,110,120));
seriesNameColorAll.put("enq: QM - Row cache instance lock (M=cache)",new Color(241,240,93));
seriesNameColorAll.put("enq: QN - Row cache instance lock (N=cache)",new Color(130,149,207));
seriesNameColorAll.put("enq: QO - Row cache instance lock (O=cache)",new Color(255,243,200));
seriesNameColorAll.put("enq: QP - Row cache instance lock (P=cache)",new Color(200,60,60));
seriesNameColorAll.put("enq: QQ - Row cache instance lock (Q=cache)",new Color(59,245,255));
seriesNameColorAll.put("enq: QR - Row cache instance lock (R=cache)",new Color(111,57,50));
seriesNameColorAll.put("enq: QS - Row cache instance lock (S=cache)",new Color(18,89,126));
seriesNameColorAll.put("enq: QT - Row cache instance lock (T=cache)",new Color(142,125,96));
seriesNameColorAll.put("enq: QU - Row cache instance lock (U=cache)",new Color(215,91,69));
seriesNameColorAll.put("enq: QV - Row cache instance lock (V=cache)",new Color(184,134,50));
seriesNameColorAll.put("enq: QW - Row cache instance lock (W=cache)",new Color(40,50,32));
seriesNameColorAll.put("enq: QX - Row cache instance lock (X=cache)",new Color(80,8,98));
seriesNameColorAll.put("enq: QY - Row cache instance lock (Y=cache)",new Color(179,173,127));
seriesNameColorAll.put("enq: QZ - Row cache instance lock (Z=cache)",new Color(125,114,50));
seriesNameColorAll.put(LBL_CPU,new Color(0,179,0));
seriesNameColorAll.put(LBL_SCHEDULER, new Color(133,255,133));
seriesNameColorAll.put(LBL_USERIO, new Color(0,46,230));
seriesNameColorAll.put(LBL_SYSTEMIO, new Color(0,161,230));
seriesNameColorAll.put(LBL_CONCURRENCY, new Color(153,51,51));
seriesNameColorAll.put(LBL_APPLICATION, new Color(194,71,71));
seriesNameColorAll.put(LBL_COMMIT, new Color(194,133,71));
seriesNameColorAll.put(LBL_CONFIGURATION, new Color(84,56,28));
seriesNameColorAll.put(LBL_ADMINISTRATIVE, new Color(84,84,29));
seriesNameColorAll.put(LBL_NETWORK, new Color(156,157,108));
seriesNameColorAll.put(LBL_QUEUEING, new Color(232,232,232));//que
seriesNameColorAll.put(LBL_CLUSTER, new Color(117,117,117));//cluster
seriesNameColorAll.put(LBL_OTHER, new Color(255,87,143));
seriesNameColorAll.put(LBL_IDLE, new Color(100,100,100));
// Postgres
seriesNameColorAll.put(LBL_PG_CPU,new Color(0,204,0));
seriesNameColorAll.put(LBL_PG_IO,new Color(0,74,231));
seriesNameColorAll.put(LBL_PG_LOCK,new Color(192,40,0));
seriesNameColorAll.put(LBL_PG_LWLOCK,new Color(139,26,0));
seriesNameColorAll.put(LBL_PG_BUFFERPIN,new Color(0,161,230));
seriesNameColorAll.put(LBL_PG_ACTIVITY,new Color(255,165,0));
seriesNameColorAll.put(LBL_PG_EXTENSION,new Color(0,123,20));
seriesNameColorAll.put(LBL_PG_CLIENT,new Color(159,147,113));
seriesNameColorAll.put(LBL_PG_IPC,new Color(240,110,170));
seriesNameColorAll.put(LBL_PG_TIMEOUT,new Color(84,56,28));
// Postgres event
seriesNameColorAll.put("AddinShmemInitLock", new Color(2,253,254));
seriesNameColorAll.put("advisory", new Color(3,252,2));
seriesNameColorAll.put("async", new Color(4,251,253));
seriesNameColorAll.put("AsyncCtlLock", new Color(5,250,3));
seriesNameColorAll.put("AsyncQueueLock", new Color(6,249,252));
seriesNameColorAll.put("AutoFileLock", new Color(7,248,4));
seriesNameColorAll.put("AutovacuumLock", new Color(8,247,251));
seriesNameColorAll.put("AutoVacuumMain", new Color(9,246,5));
seriesNameColorAll.put("AutovacuumScheduleLock", new Color(10,245,250));
seriesNameColorAll.put("BackendRandomLock", new Color(11,244,6));
seriesNameColorAll.put("BackgroundWorkerLock", new Color(12,243,249));
seriesNameColorAll.put("BgWorkerStartup", new Color(13,242,7));
seriesNameColorAll.put("BgWorkerShutdown", new Color(113,142,7));
seriesNameColorAll.put("BgWriterHibernate", new Color(14,241,248));
seriesNameColorAll.put("BgWriterMain", new Color(15,240,8));
seriesNameColorAll.put("BtreePage", new Color(255,112,0));
seriesNameColorAll.put("BtreeVacuumLock", new Color(17,238,9));
seriesNameColorAll.put("buffer_content", new Color(18,237,246));
seriesNameColorAll.put("buffer_io", new Color(19,136,10));
seriesNameColorAll.put("buffer_mapping", new Color(220,35,245));
seriesNameColorAll.put("BufFileWrite", new Color(255,105,0));
seriesNameColorAll.put("BufFileRead", new Color(22,233,44));
seriesNameColorAll.put("CheckpointerCommLock", new Color(23,232,12));
seriesNameColorAll.put("CheckpointerMain", new Color(24,231,243));
seriesNameColorAll.put("CheckpointLock", new Color(25,230,13));
seriesNameColorAll.put("ClientRead", new Color(159,147,113));
seriesNameColorAll.put("ClientWrite", new Color(161,61,61));
seriesNameColorAll.put("clog", new Color(115,105,172));
seriesNameColorAll.put("CLogControlLock", new Color(29,226,15));
seriesNameColorAll.put("ClogGroupUpdate", new Color(129,126,15));
seriesNameColorAll.put("CLogTruncationLock", new Color(30,225,240));
seriesNameColorAll.put("commit_timestamp", new Color(31,224,16));
seriesNameColorAll.put("CommitTsControlLock", new Color(32,223,239));
seriesNameColorAll.put("CommitTsLock", new Color(33,222,17));
seriesNameColorAll.put("ControlFileLock", new Color(34,221,238));
seriesNameColorAll.put("ControlFileRead", new Color(35,220,18));
seriesNameColorAll.put("ControlFileSync", new Color(36,219,237));
seriesNameColorAll.put("ControlFileSyncUpdate", new Color(37,218,19));
seriesNameColorAll.put("ControlFileWrite", new Color(38,217,236));
seriesNameColorAll.put("ControlFileWriteUpdate", new Color(39,216,20));
seriesNameColorAll.put("CopyFileRead", new Color(40,215,235));
seriesNameColorAll.put("CopyFileWrite", new Color(41,214,21));
seriesNameColorAll.put("DataFileExtend", new Color(42,213,234));
seriesNameColorAll.put("DataFileFlush", new Color(43,212,22));
seriesNameColorAll.put("DataFileImmediateSync", new Color(0,79,0));
seriesNameColorAll.put("DataFilePrefetch", new Color(45,210,23));
seriesNameColorAll.put("DataFileRead", new Color(0,74,231));
seriesNameColorAll.put("DataFileSync", new Color(47,208,24));
seriesNameColorAll.put("DataFileTruncate", new Color(48,207,231));
seriesNameColorAll.put("DataFileWrite", new Color(206,49,25));
seriesNameColorAll.put("DSMFillZeroWrite", new Color(50,205,230));
seriesNameColorAll.put("DynamicSharedMemoryControlLock", new Color(51,204,26));
seriesNameColorAll.put("ExecuteGather", new Color(52,203,229));
seriesNameColorAll.put("extend", new Color(53,202,27));
seriesNameColorAll.put("Hash/Batch/Allocating", new Color(11,111,99));
seriesNameColorAll.put("Hash/Batch/Electing", new Color(22,222,88));
seriesNameColorAll.put("Hash/Batch/Loading", new Color(33,111,77));
seriesNameColorAll.put("Hash/Build/Allocating", new Color(44,222,66));
seriesNameColorAll.put("Hash/Build/Electing", new Color(55,111,55));
seriesNameColorAll.put("Hash/Build/HashingInner", new Color(66,222,44));
seriesNameColorAll.put("Hash/Build/HashingOuter", new Color(77,111,33));
seriesNameColorAll.put("Hash/GrowBatches/Allocating", new Color(88,222,22));
seriesNameColorAll.put("Hash/GrowBatches/Deciding", new Color(99,111,11));
seriesNameColorAll.put("Hash/GrowBatches/Electing", new Color(11,222,99));
seriesNameColorAll.put("Hash/GrowBatches/Finishing", new Color(22,111,88));
seriesNameColorAll.put("Hash/GrowBatches/Repartitioning", new Color(33,222,77));
seriesNameColorAll.put("Hash/GrowBuckets/Allocating", new Color(44,111,66));
seriesNameColorAll.put("Hash/GrowBuckets/Electing", new Color(55,222,55));
seriesNameColorAll.put("Hash/GrowBuckets/Reinserting", new Color(66,111,44));
seriesNameColorAll.put("LibPQWalReceiverConnect", new Color(57,198,29));
seriesNameColorAll.put("LibPQWalReceiverReceive", new Color(58,197,226));
seriesNameColorAll.put("LockFileAddToDataDirRead", new Color(60,195,225));
seriesNameColorAll.put("LockFileAddToDataDirSync", new Color(61,194,31));
seriesNameColorAll.put("LockFileAddToDataDirWrite", new Color(62,193,224));
seriesNameColorAll.put("LockFileCreateRead", new Color(63,192,32));
seriesNameColorAll.put("LockFileCreateSync", new Color(64,191,223));
seriesNameColorAll.put("LockFileCreateWrite", new Color(65,190,33));
seriesNameColorAll.put("LockFileReCheckDataDirRead", new Color(66,189,222));
seriesNameColorAll.put("lock_manager", new Color(167,108,34));
seriesNameColorAll.put("LogicalApplyMain", new Color(68,187,221));
seriesNameColorAll.put("LogicalLauncherMain", new Color(69,186,35));
seriesNameColorAll.put("LogicalRepWorkerLock", new Color(70,185,220));
seriesNameColorAll.put("LogicalRewriteCheckpointSync", new Color(71,184,36));
seriesNameColorAll.put("LogicalRewriteMappingSync", new Color(72,183,219));
seriesNameColorAll.put("LogicalRewriteMappingWrite", new Color(73,182,37));
seriesNameColorAll.put("LogicalRewriteSync", new Color(74,181,218));
seriesNameColorAll.put("LogicalRewriteWrite", new Color(75,180,38));
seriesNameColorAll.put("LogicalSyncData", new Color(76,179,217));
seriesNameColorAll.put("LogicalSyncStateChange", new Color(77,178,39));
seriesNameColorAll.put("MessageQueueInternal", new Color(78,177,216));
seriesNameColorAll.put("MessageQueuePutMessage", new Color(79,176,40));
seriesNameColorAll.put("MessageQueueReceive", new Color(80,175,215));
seriesNameColorAll.put("MessageQueueSend", new Color(81,174,41));
seriesNameColorAll.put("MultiXactGenLock", new Color(82,173,214));
seriesNameColorAll.put("multixact_member", new Color(83,172,42));
seriesNameColorAll.put("MultiXactMemberControlLock", new Color(84,171,213));
seriesNameColorAll.put("multixact_offset", new Color(85,170,43));
seriesNameColorAll.put("MultiXactOffsetControlLock", new Color(86,169,212));
seriesNameColorAll.put("MultiXactTruncationLock", new Color(87,168,44));
seriesNameColorAll.put("object", new Color(88,167,211));
seriesNameColorAll.put("OidGenLock", new Color(89,166,45));
seriesNameColorAll.put("oldserxid", new Color(90,165,210));
seriesNameColorAll.put("OldSerXidLock", new Color(91,164,46));
seriesNameColorAll.put("OldSnapshotTimeMapLock", new Color(92,163,209));
seriesNameColorAll.put("page", new Color(93,162,47));
seriesNameColorAll.put("ParallelBitmapScan", new Color(94,161,208));
seriesNameColorAll.put("ParallelCreateIndexScan", new Color(194,61,208));
seriesNameColorAll.put("ParallelFinish", new Color(4,170,18));
seriesNameColorAll.put("parallel_query_dsa", new Color(96,159,207));
seriesNameColorAll.put("parallel_append", new Color(196,159,107));
seriesNameColorAll.put("parallel_hash_join", new Color(96,59,107));
seriesNameColorAll.put("PgSleep", new Color(97,158,49));
seriesNameColorAll.put("PgStatMain", new Color(98,157,206));
seriesNameColorAll.put("predicate_lock_manager", new Color(99,156,50));
seriesNameColorAll.put("proc", new Color(100,155,205));
seriesNameColorAll.put("ProcArrayGroupUpdate", new Color(101,154,51));
seriesNameColorAll.put("ProcArrayLock", new Color(102,153,204));
seriesNameColorAll.put("RecoveryApplyDelay", new Color(103,152,52));
seriesNameColorAll.put("RecoveryWalAll", new Color(104,151,203));
seriesNameColorAll.put("RecoveryWalStream", new Color(105,150,53));
seriesNameColorAll.put("relation", new Color(99,138,215));
seriesNameColorAll.put("RelationMappingLock", new Color(106,149,202));
seriesNameColorAll.put("RelationMapRead", new Color(107,148,54));
seriesNameColorAll.put("RelationMapSync", new Color(108,147,201));
seriesNameColorAll.put("RelationMapWrite", new Color(109,146,55));
seriesNameColorAll.put("RelCacheInitLock", new Color(110,145,200));
seriesNameColorAll.put("ReorderBufferRead", new Color(111,144,56));
seriesNameColorAll.put("ReorderBufferWrite", new Color(112,143,199));
seriesNameColorAll.put("ReorderLogicalMappingRead", new Color(113,142,57));
seriesNameColorAll.put("replication_origin", new Color(114,141,198));
seriesNameColorAll.put("ReplicationOriginDrop", new Color(115,140,58));
seriesNameColorAll.put("ReplicationOriginLock", new Color(116,139,197));
seriesNameColorAll.put("ReplicationSlotAllocationLock", new Color(117,138,59));
seriesNameColorAll.put("ReplicationSlotControlLock", new Color(118,137,196));
seriesNameColorAll.put("ReplicationSlotDrop", new Color(119,136,60));
seriesNameColorAll.put("replication_slot_io", new Color(120,135,195));
seriesNameColorAll.put("ReplicationSlotRead", new Color(121,134,61));
seriesNameColorAll.put("ReplicationSlotRestoreSync", new Color(122,133,194));
seriesNameColorAll.put("ReplicationSlotSync", new Color(123,132,62));
seriesNameColorAll.put("ReplicationSlotWrite", new Color(124,131,193));
seriesNameColorAll.put("SafeSnapshot", new Color(125,130,63));
seriesNameColorAll.put("SerializableFinishedListLock", new Color(126,129,192));
seriesNameColorAll.put("SerializablePredicateLockListLock", new Color(127,128,64));
seriesNameColorAll.put("SerializableXactHashLock", new Color(128,127,191));
seriesNameColorAll.put("ShmemIndexLock", new Color(129,126,65));
seriesNameColorAll.put("SInvalReadLock", new Color(130,125,190));
seriesNameColorAll.put("SInvalWriteLock", new Color(131,124,66));
seriesNameColorAll.put("SLRUFlushSync", new Color(132,123,189));
seriesNameColorAll.put("SLRURead", new Color(133,122,67));
seriesNameColorAll.put("SLRUSync", new Color(134,121,188));
seriesNameColorAll.put("SLRUWrite", new Color(135,120,68));
seriesNameColorAll.put("SnapbuildRead", new Color(136,119,187));
seriesNameColorAll.put("SnapbuildSync", new Color(137,118,69));
seriesNameColorAll.put("SnapbuildWrite", new Color(138,117,186));
seriesNameColorAll.put("speculative", new Color(139,116,70));
seriesNameColorAll.put("SSLOpenServer", new Color(140,115,185));
seriesNameColorAll.put("subtrans", new Color(141,114,71));
seriesNameColorAll.put("SubtransControlLock", new Color(142,113,184));
seriesNameColorAll.put("SyncRep", new Color(143,112,72));
seriesNameColorAll.put("SyncRepLock", new Color(144,111,183));
seriesNameColorAll.put("SyncScanLock", new Color(145,110,73));
seriesNameColorAll.put("SysLoggerMain", new Color(146,109,182));
seriesNameColorAll.put("TablespaceCreateLock", new Color(147,108,74));
seriesNameColorAll.put("tbm", new Color(148,107,181));
seriesNameColorAll.put("TimelineHistoryFileSync", new Color(149,106,75));
seriesNameColorAll.put("TimelineHistoryFileWrite", new Color(150,105,180));
seriesNameColorAll.put("TimelineHistoryRead", new Color(151,104,76));
seriesNameColorAll.put("TimelineHistorySync", new Color(152,103,179));
seriesNameColorAll.put("TimelineHistoryWrite", new Color(153,102,77));
seriesNameColorAll.put("transactionid", new Color(192,40,0));
seriesNameColorAll.put("tuple", new Color(156,99,177));
seriesNameColorAll.put("TwophaseFileRead", new Color(157,98,79));
seriesNameColorAll.put("TwophaseFileSync", new Color(158,97,176));
seriesNameColorAll.put("TwophaseFileWrite", new Color(159,96,80));
seriesNameColorAll.put("TwoPhaseStateLock", new Color(160,95,175));
seriesNameColorAll.put("userlock", new Color(161,94,81));
seriesNameColorAll.put("virtualxid", new Color(208,105,0));
seriesNameColorAll.put("WALBootstrapSync", new Color(163,92,82));
seriesNameColorAll.put("WALBootstrapWrite", new Color(164,91,173));
seriesNameColorAll.put("WALBufMappingLock", new Color(165,90,83));
seriesNameColorAll.put("WALCopyRead", new Color(166,89,172));
seriesNameColorAll.put("WALCopySync", new Color(167,88,84));
seriesNameColorAll.put("WALCopyWrite", new Color(168,87,171));
seriesNameColorAll.put("WALInitSync", new Color(169,86,85));
seriesNameColorAll.put("wal_insert", new Color(140,26,172));
seriesNameColorAll.put("WalReceiverMain", new Color(173,82,87));
seriesNameColorAll.put("WalReceiverWaitStart", new Color(174,81,168));
seriesNameColorAll.put("WalSenderMain", new Color(175,80,88));
seriesNameColorAll.put("WALSenderTimelineHistoryRead", new Color(176,79,167));
seriesNameColorAll.put("WalSenderWaitForWAL", new Color(177,78,89));
seriesNameColorAll.put("WalSenderWriteData", new Color(178,77,166));
seriesNameColorAll.put("WALSyncMethodAssign", new Color(179,76,90));
seriesNameColorAll.put("WALInitWrite", new Color(111,85,170));
seriesNameColorAll.put("WALRead", new Color(128,184,116));
seriesNameColorAll.put("WALWrite", new Color(180,75,165));
seriesNameColorAll.put("WALWriteLock", new Color(139,26,0));
seriesNameColorAll.put("WalWriterMain", new Color(182,73,164));
seriesNameColorAll.put("XidGenLock", new Color(23,72,92));
} catch (Exception e){
e.printStackTrace();
}
}
}
| 144,868 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
GanttComponentUtilities.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/ext/egantt/drawing/GanttComponentUtilities.java | /**
* @(#)GanttComponentUtilities.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package ext.egantt.drawing;
import com.egantt.awt.graphics.GraphicsManager;
import com.egantt.awt.graphics.GraphicsState;
import com.egantt.awt.graphics.manager.BasicGraphicsManager;
import com.egantt.awt.graphics.state.GraphicsState2D;
import com.egantt.drawing.view.manager.LongViewManager;
import com.egantt.model.component.ComponentManager;
import com.egantt.model.drawing.ContextResources;
import com.egantt.model.drawing.DrawingContext;
import com.egantt.model.drawing.axis.AxisInterval;
import com.egantt.model.drawing.axis.AxisView;
import com.egantt.model.drawing.axis.LongAxis;
import com.egantt.model.drawing.axis.interval.LongInterval;
import com.egantt.model.drawing.context.BasicDrawingContext;
import com.egantt.model.scrolling.range.view.BasicViewRange;
import com.egantt.swing.scroll.ScrollManager;
import com.egantt.swing.scroll.manager.BasicScrollManager;
import ext.egantt.component.field.manager.DefaultFieldManager;
import ext.egantt.drawing.module.BasicColorModule;
import ext.egantt.drawing.module.BasicPainterModule;
import ext.egantt.drawing.module.BoundedPainterModule;
import ext.egantt.drawing.module.CalendarDrawingModule;
import ext.egantt.drawing.module.EditorDrawingModule;
import ext.egantt.drawing.module.FilledPainterModule;
import ext.egantt.drawing.module.GanttDrawingModule;
import ext.egantt.drawing.module.GradientColorModule;
import ext.egantt.drawing.module.StandardDrawingModule;
import ext.egantt.model.drawing.ComponentUtilities;
import java.util.List;
public class GanttComponentUtilities implements ComponentUtilities
{
protected GraphicsManager graphics;
protected GraphicsState state;
protected DrawingContext context;
protected ScrollManager managers [] = new ScrollManager[2];
private List eventList = null;
String axises[];
public GanttComponentUtilities(String axises[]) {
this.graphics = new BasicGraphicsManager();
this.state = new GraphicsState2D();
this.axises = axises;
}
public GanttComponentUtilities(String axises[], List eventList)
{
managers = new ScrollManager[2];
graphics = new BasicGraphicsManager();
state = new GraphicsState2D();
this.axises = axises;
this.eventList = eventList;
}
// __________________________________________________________________________
public void setDrawingGraphics(GraphicsManager graphics)
{
this.graphics = graphics;
}
public void setGraphicsState(GraphicsState state)
{
this.state = state;
}
// __________________________________________________________________________
public DrawingContext getContext()
{
return context;
}
// __________________________________________________________________________
public ComponentManager getManager()
{
this.context = createContexts();
AxisInterval intervals [] = createIntervals(axises);
for (int i=0; i < axises.length; i++)
{
LongAxis axis = new LongAxis();
axis.setInterval(intervals[i]);
initialiseContext(axises[i], axis.getView(i % 2), context);
}
return new DefaultFieldManager(state, context);
}
public ScrollManager getScrollManager(int pos)
{
return managers[pos];
}
// __________________________________________________________________________
protected AxisInterval [] createIntervals(String axises [])
{
AxisInterval intervals [] = new AxisInterval[axises.length];
for (int i=0; i < axises.length; i++)
intervals [i] = new LongInterval(0, 100);
return intervals;
}
protected DrawingContext createContexts()
{
BasicDrawingContext context = new BasicDrawingContext();
new BasicColorModule().initialise(context);
new GradientColorModule().initialise(context, eventList);
new BasicPainterModule().initialise(context);
new BoundedPainterModule().initialise(context);
new CalendarDrawingModule().initialise(context);
new FilledPainterModule().initialise(context);
new GanttDrawingModule().initialise(context);
new StandardDrawingModule().initialise(context);
new EditorDrawingModule().initialise(context);
return context;
}
// _________________________________________________________________________
protected void initialiseContext(String key, AxisView view, DrawingContext context)
{
LongViewManager manager = new LongViewManager();
manager.setView(view);
BasicViewRange viewRange = new BasicViewRange();
viewRange.setManager(manager);
BasicScrollManager scrollModel = new BasicScrollManager();
scrollModel.setRangeModel(viewRange);
context.put(key, ContextResources.AXIS_VIEW, view);
context.put(key, ContextResources.SCROLL_MANAGER, scrollModel);
if (managers[0] == null)
managers[0] = scrollModel;
context.put(key, ContextResources.VIEW_MANAGER, manager);
}
} | 4,833 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
DrawingModule.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/ext/egantt/drawing/DrawingModule.java | /*
* @(#)DrawingModule.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package ext.egantt.drawing;
import com.egantt.model.drawing.DrawingContext;
/**
* Shortcut to implementing a high level drawing component
* instead of attempting to understand how the library works many users prefer
* to use one of these trivial plugins
*/
public interface DrawingModule
{
/**
* initialise the module
*/
void initialise(DrawingContext attributes);
/**
* terminate the module
*/
void terminate(DrawingContext attributes);
}
| 607 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
DefaultColorContext.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/ext/egantt/drawing/context/DefaultColorContext.java | package ext.egantt.drawing.context;
import java.awt.Color;
import com.egantt.awt.graphics.GraphicsContext;
import com.egantt.model.drawing.painter.PainterResources;
/**
* <code>DefaultColorContext</code>
*/
public class DefaultColorContext
{
/**
* The color white. In the default sRGB space.
*/
public final static GraphicsContext WHITE = new LocalColorContext(Color.white);
/**
* The color light gray. In the default sRGB space.
*/
public final static GraphicsContext LIGHT_GRAY = new LocalColorContext(Color.lightGray);
/**
* The color gray. In the default sRGB space.
*/
public final static GraphicsContext gray = new LocalColorContext(Color.gray);
/**
* The color gray. In the default sRGB space.
*/
public final static GraphicsContext GRAY = gray;
/**
* The color dark gray. In the default sRGB space.
*/
public final static GraphicsContext darkGray = new LocalColorContext(Color.darkGray);
/**
* The color dark gray. In the default sRGB space.
*/
public final static GraphicsContext DARK_GRAY = darkGray;
/**
* The color black. In the default sRGB space.
*/
public final static GraphicsContext black = new LocalColorContext(Color.black);
/**
* The color black. In the default sRGB space.
*/
public final static GraphicsContext BLACK = black;
/**
* The color red. In the default sRGB space.
*/
public final static GraphicsContext red = new LocalColorContext(Color.red);
/**
* The color red. In the default sRGB space.
*/
public final static GraphicsContext RED = red;
/**
* The color pink. In the default sRGB space.
*/
public final static GraphicsContext pink = new LocalColorContext(Color.pink);
/**
* The color pink. In the default sRGB space.
*/
public final static GraphicsContext PINK = pink;
/**
* The color orange. In the default sRGB space.
*/
public final static GraphicsContext orange = new LocalColorContext(Color.orange);
/**
* The color orange. In the default sRGB space.
*/
public final static GraphicsContext ORANGE = orange;
/**
* The color yellow. In the default sRGB space.
*/
public final static GraphicsContext yellow = new LocalColorContext(Color.yellow);
/**
* The color yellow. In the default sRGB space.
*/
public final static GraphicsContext YELLOW = yellow;
/**
* The color green. In the default sRGB space.
*/
public final static GraphicsContext green = new LocalColorContext(Color.green);
/**
* The color green. In the default sRGB space.
*/
public final static GraphicsContext GREEN = green;
/**
* The color magenta. In the default sRGB space.
*/
public final static GraphicsContext magenta = new LocalColorContext(Color.magenta);
/**
* The color magenta. In the default sRGB space.
*/
public final static GraphicsContext MAGENTA = magenta;
/**
* The color cyan. In the default sRGB space.
*/
public final static GraphicsContext cyan = new LocalColorContext(Color.cyan);
/**
* The color cyan. In the default sRGB space.
*/
public final static GraphicsContext CYAN = cyan;
/**
* The color blue. In the default sRGB space.
*/
public final static GraphicsContext blue = new LocalColorContext(Color.blue);
/**
* The color blue. In the default sRGB space.
*/
public final static GraphicsContext BLUE = blue;
// ________________________________________________________________________
public static final class LocalColorContext implements GraphicsContext {
protected final Color color;
public LocalColorContext(Color color) {
this.color = color;
}
public Object get(Object key, Object type) {
return (PainterResources.PAINT.equals(type))
? color : null;
}
public Color getColor() {
return color;
}
}
} | 4,123 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
GradientColorContext.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/ext/egantt/drawing/context/GradientColorContext.java | package ext.egantt.drawing.context;
import com.egantt.awt.graphics.GraphicsContext;
import com.egantt.awt.paint.VerticalGradientPaint;
import com.egantt.model.drawing.painter.PainterResources;
import java.awt.*;
/**
* <code>GradientColorContext</code>
*/
public class GradientColorContext
{
/**
* The color white. In the default sRGB space.
*/
public final static GraphicsContext WHITE = new LocalColorContext(Color.white);
/**
* The color light gray. In the default sRGB space.
*/
public final static GraphicsContext LIGHT_GRAY = new LocalColorContext(Color.lightGray);
/**
* The color gray. In the default sRGB space.
*/
public final static GraphicsContext gray = new LocalColorContext(Color.gray);
/**
* The color gray. In the default sRGB space.
*/
public final static GraphicsContext GRAY = gray;
/**
* The color dark gray. In the default sRGB space.
*/
public final static GraphicsContext darkGray = new LocalColorContext(Color.darkGray);
/**
* The color dark gray. In the default sRGB space.
*/
public final static GraphicsContext DARK_GRAY = darkGray;
/**
* The color black. In the default sRGB space.
*/
public final static GraphicsContext black = new LocalColorContext(Color.black);
/**
* The color black. In the default sRGB space.
*/
public final static GraphicsContext BLACK = black;
/**
* The color red. In the default sRGB space.
*/
public final static GraphicsContext red = new LocalColorContext(Color.red);
/**
* The color red. In the default sRGB space.
*/
public final static GraphicsContext RED = red;
/**
* The color pink. In the default sRGB space.
*/
public final static GraphicsContext pink = new LocalColorContext(Color.pink);
/**
* The color pink. In the default sRGB space.
*/
public final static GraphicsContext PINK = pink;
/**
* The color orange. In the default sRGB space.
*/
public final static GraphicsContext orange = new LocalColorContext(Color.orange);
/**
* The color orange. In the default sRGB space.
*/
public final static GraphicsContext ORANGE = orange;
/**
* The color yellow. In the default sRGB space.
*/
public final static GraphicsContext yellow = new LocalColorContext(Color.yellow);
/**
* The color yellow. In the default sRGB space.
*/
public final static GraphicsContext YELLOW = yellow;
/**
* The color green. In the default sRGB space.
*/
public final static GraphicsContext green = new LocalColorContext(Color.green);
/**
* The color green. In the default sRGB space.
*/
public final static GraphicsContext GREEN = green;
/**
* The color magenta. In the default sRGB space.
*/
public final static GraphicsContext magenta = new LocalColorContext(Color.magenta);
/**
* The color magenta. In the default sRGB space.
*/
public final static GraphicsContext MAGENTA = magenta;
/**
* The color cyan. In the default sRGB space.
*/
public final static GraphicsContext cyan = new LocalColorContext(Color.cyan);
/**
* The color cyan. In the default sRGB space.
*/
public final static GraphicsContext CYAN = cyan;
/**
* The color blue. In the default sRGB space.
*/
public final static GraphicsContext blue = new LocalColorContext(Color.blue);
/**
* The color blue. In the default sRGB space.
*/
public final static GraphicsContext BLUE = blue;
/**/
// ________________________________________________________________________
public static final class LocalColorContext implements GraphicsContext {
protected final Paint color;
public LocalColorContext(Color color) {
color = color.darker().darker();
this.color = new VerticalGradientPaint(color, color.brighter());
}
public Object get(Object key, Object type) {
return (PainterResources.PAINT.equals(type))
? color : null;
}
public Paint getPaint() {
return color;
}
}
} | 4,262 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
CalendarDrawingState.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/ext/egantt/drawing/state/CalendarDrawingState.java | /**
* @(#)CalendarDrawingState.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package ext.egantt.drawing.state;
import com.egantt.model.drawing.axis.AxisInterval;
import com.egantt.model.drawing.axis.interval.LongInterval;
import com.egantt.model.drawing.part.ListDrawingPart;
import com.egantt.model.drawing.state.BasicDrawingState;
/**
* Used as quick mechanism for the header renderer in the table
*/
public class CalendarDrawingState extends BasicDrawingState
{
public static final String PART_PAINTER = "TimelinePartPainter";
public static String painters[] = new String [2];
static
{
painters[0] = "-line";
painters[1] = "-text";
}
public static String TIMELINE_TOP = "TimelineTop";
public static String TIMELINE_BOTTOM = "TimelineBottom";
public static String LINE_PAINTER = "-line";
public static String TEXT_PAINTER = "-text";
public CalendarDrawingState(String keys [])
{
for (int i=0; i < painters.length; i++)
{
AxisInterval intervals [] = new AxisInterval[2];
intervals[0] = null;
intervals[1] = new LongInterval(5,50);
String key = TIMELINE_TOP + painters[i];
ListDrawingPart drawingPart = new ListDrawingPart(keys, key);
drawingPart.add(new Object(), intervals, key, key, key);
intervals = new AxisInterval[2];
intervals[0] = null;
intervals[1] = new LongInterval(50, 95);
key = TIMELINE_BOTTOM + painters[i];
drawingPart.add(new Object(), intervals, key, key, key);
addDrawingPart(drawingPart);
}
}
}
| 1,559 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
DrawingStateHelper.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/ext/egantt/drawing/state/DrawingStateHelper.java | /**
* @(#)DrawingStateHelper.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package ext.egantt.drawing.state;
import com.egantt.model.drawing.axis.AxisInterval;
import com.egantt.model.drawing.part.ListDrawingPart;
import com.egantt.model.drawing.state.BasicDrawingState;
public class DrawingStateHelper
{
public static final DrawingStateHelper instance = new DrawingStateHelper();
// _________________________________________________________________________
public BasicDrawingState createDrawingState(Object key, String partPainter,
Object axises [], AxisInterval intervals[], String plotter, String state, String context)
{
// add our details into the model
BasicDrawingState drawingState = new BasicDrawingState();
// register the part with the state
ListDrawingPart drawingPart = new ListDrawingPart(axises, partPainter);
drawingState.addDrawingPart(drawingPart);
// populate the drawing part
drawingPart.add(key, intervals, plotter, state, context);
return drawingState;
}
// ________________________________________________________________________
}
| 1,163 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
BasicPainterContext.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/ext/egantt/drawing/painter/context/BasicPainterContext.java | /**
* @(#)BasicPainterContext.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package ext.egantt.drawing.painter.context;
import com.egantt.awt.graphics.GraphicsManager;
import com.egantt.drawing.DrawingPainter;
import com.egantt.awt.graphics.GraphicsState;
import com.egantt.drawing.painter.range.RangeModel;
import com.egantt.model.drawing.DrawingGranularity;
import com.egantt.model.drawing.painter.PainterResources;
import java.awt.Composite;
import java.awt.Insets;
import java.awt.Font;
import java.awt.Paint;
import java.awt.Shape;
import java.awt.Stroke;
import java.awt.geom.AffineTransform;
import java.text.Format;
import javax.swing.border.Border;
/**
* A wrapper around the default implementation of the PainterContext intendend
* to provide an easy to use context for beginners, or for experimentation
* contains a set method for every type contained in the ContextResources
*/
public class BasicPainterContext extends com.egantt.awt.graphics.context.BasicGraphicsContext
{
// __________________________________________________________________________
public void setBorder(Border border)
{
put(PainterResources.BORDER, border);
}
public void setFormat(Format format)
{
put(PainterResources.FORMAT, format);
}
public void setShape(Shape shape)
{
put(PainterResources.SHAPE, shape);
}
public void setFont(Font font)
{
put(PainterResources.FONT, font);
}
public void setComposite(Composite composite)
{
put(PainterResources.COMPOSITE, composite);
}
public void setTransform(AffineTransform transform)
{
put(PainterResources.TRANSFORM, transform);
}
public void setPaint(Paint paint)
{
put(PainterResources.PAINT, paint);
}
public void setStroke(Stroke stroke)
{
put(PainterResources.STROKE, stroke);
}
public void setDrawingGranularity(DrawingGranularity granularity)
{
put(PainterResources.GRANULARITY, granularity);
}
public void setDrawingGraphics(GraphicsManager drawingGraphics)
{
put(PainterResources.DRAWING_GRAPHICS, drawingGraphics);
}
public void setDrawingPainter(DrawingPainter drawingPlotter)
{
put(PainterResources.DRAWING_PAINTER, drawingPlotter);
}
public void setInsets(Insets insets)
{
put(PainterResources.INSETS, insets);
}
public void setGraphicsState(GraphicsState graphicsState)
{
put(PainterResources.GRAPHICS_STATE, graphicsState);
}
public void setRangeModel(RangeModel rangeModel)
{
put(PainterResources.RANGE_MODEL, rangeModel);
}
}
| 2,544 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
BasicCompoundContext.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/ext/egantt/drawing/painter/context/compound/BasicCompoundContext.java | /*
* @(#)BasicCompoundContext.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package ext.egantt.drawing.painter.context.compound;
import com.egantt.awt.graphics.GraphicsManager;
import com.egantt.drawing.DrawingPainter;
import com.egantt.awt.graphics.GraphicsState;
import com.egantt.drawing.painter.range.RangeModel;
import com.egantt.model.drawing.DrawingGranularity;
import com.egantt.model.drawing.painter.PainterResources;
import java.awt.Composite;
import java.awt.Font;
import java.awt.Insets;
import java.awt.Paint;
import java.awt.Shape;
import java.awt.Stroke;
import java.awt.geom.AffineTransform;
import java.text.Format;
/**
*
*/
public class BasicCompoundContext extends
com.egantt.awt.graphics.context.compound.BasicCompoundContext
{
// __________________________________________________________________________
public void setFormat(Object group, Format format)
{
put(PainterResources.FORMAT, group, format);
}
public void setFormat(Format format)
{
put(PainterResources.FORMAT, format);
}
// _________________________________________________________________________
public void setInsets(Object group, Insets insets)
{
put(PainterResources.INSETS, group, insets);
}
public void setInsets(Insets insets)
{
put(PainterResources.INSETS, insets);
}
// __________________________________________________________________________
public void setShape(Object group, Shape shape)
{
put(PainterResources.SHAPE, group, shape);
}
public void setShape(Shape shape)
{
put(PainterResources.SHAPE, shape);
}
// __________________________________________________________________________
public void setFont(Object group, Font font)
{
put(PainterResources.FONT, group, font);
}
public void setFont(Font font)
{
put(PainterResources.FONT, font);
}
// __________________________________________________________________________
public void setComposite(Object group, Composite composite)
{
put(PainterResources.COMPOSITE, group, composite);
}
public void setComposite(Composite composite)
{
put(PainterResources.COMPOSITE, composite);
}
// __________________________________________________________________________
public void setTransform(Object group, AffineTransform transform)
{
put(PainterResources.TRANSFORM, group, transform);
}
public void setTransform(AffineTransform transform)
{
put(PainterResources.TRANSFORM, transform);
}
// __________________________________________________________________________
public void setPaint(Object group, Paint paint)
{
put(PainterResources.PAINT, group, paint);
}
public void setPaint(Paint paint)
{
put(PainterResources.PAINT, paint);
}
// __________________________________________________________________________
public void setStroke(Object group, Stroke stroke)
{
put(PainterResources.STROKE, group, stroke);
}
public void setStroke(Stroke stroke)
{
put(PainterResources.STROKE, stroke);
}
// __________________________________________________________________________
public void setDrawingGranularity(Object group, DrawingGranularity granularity)
{
put(PainterResources.GRANULARITY, group, granularity);
}
public void setDrawingGranularity(DrawingGranularity granularity)
{
put(PainterResources.GRANULARITY, granularity);
}
// __________________________________________________________________________
public void setDrawingGraphics(Object group, GraphicsManager drawingGraphics)
{
put(PainterResources.DRAWING_GRAPHICS, group, drawingGraphics);
}
public void setDrawingGraphics(GraphicsManager drawingGraphics)
{
put(PainterResources.DRAWING_GRAPHICS, drawingGraphics);
}
// __________________________________________________________________________
public void setDrawingPainter(Object group, DrawingPainter drawingPlotter)
{
put(PainterResources.DRAWING_PAINTER, group, drawingPlotter);
}
public void setDrawingPlotter(DrawingPainter drawingPlotter)
{
put(PainterResources.DRAWING_PAINTER, drawingPlotter);
}
// __________________________________________________________________________
public void setGraphicsState(Object group, GraphicsState graphicsState)
{
put(PainterResources.GRAPHICS_STATE, group, graphicsState);
}
public void setGraphicsState(GraphicsState graphicsState)
{
put(PainterResources.GRAPHICS_STATE, graphicsState);
}
// __________________________________________________________________________
public void setRangeModel(Object group, RangeModel rangeModel)
{
put(PainterResources.RANGE_MODEL, group, rangeModel);
}
public void setRangeModel(RangeModel rangeModel)
{
put(PainterResources.RANGE_MODEL, rangeModel);
}
}
| 4,800 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
EditorDrawingModule.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/ext/egantt/drawing/module/EditorDrawingModule.java | package ext.egantt.drawing.module;
import com.egantt.model.drawing.ContextResources;
import com.egantt.model.drawing.DrawingContext;
import com.egantt.swing.cell.editor.state.resize.MoveResizeEditor;
import com.egantt.swing.cell.editor.state.resize.ResizeFinishEditor;
import ext.egantt.drawing.DrawingModule;
public class EditorDrawingModule implements DrawingModule {
public static final String THIS = EditorDrawingModule.class.getName();
public final static String MOVE_RESIZE_EDITOR = THIS + "-MoveResizeEditor";
public final static String FINISH_RESIZE_EDITOR = THIS + "-FinishResizeEditor";
// ________________________________________________________________________
public void initialise(DrawingContext attributes) {
attributes.put(MOVE_RESIZE_EDITOR, ContextResources.STATE_EDITOR, new MoveResizeEditor());
attributes.put(FINISH_RESIZE_EDITOR, ContextResources.STATE_EDITOR, new ResizeFinishEditor());
}
public void terminate(DrawingContext attributes) {
attributes.put(MOVE_RESIZE_EDITOR, ContextResources.STATE_EDITOR, null);
attributes.put(FINISH_RESIZE_EDITOR, ContextResources.STATE_EDITOR, null);
}
} | 1,145 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
CalendarDrawingModule.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/ext/egantt/drawing/module/CalendarDrawingModule.java | /**
* @(#)CalendarDrawingModule.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package ext.egantt.drawing.module;
import java.awt.Graphics;
import java.awt.Rectangle;
import com.egantt.awt.graphics.GraphicsContext;
import com.egantt.awt.graphics.GraphicsManager;
import com.egantt.awt.graphics.manager.BasicGraphicsManager;
import com.egantt.drawing.component.painter.PartPainter;
import com.egantt.drawing.component.painter.part.BasicPartPainter;
import com.egantt.drawing.component.painter.part.PartView;
import com.egantt.drawing.component.painter.part.view.BasicPartView;
import com.egantt.drawing.painter.RangePainter;
import com.egantt.drawing.painter.range.model.GranularityRangeModel;
import com.egantt.model.drawing.ContextResources;
import com.egantt.model.drawing.DrawingContext;
import com.egantt.model.drawing.axis.view.ViewResources;
import ext.egantt.drawing.DrawingModule;
import ext.egantt.drawing.module.LineCalendarModule;
import ext.egantt.drawing.module.TextCalendarModule;
public class CalendarDrawingModule implements DrawingModule
{
public static String TIMELINE_BOTTOM = "TimelineBottom";
public static String TIMELINE_TOP = "TimelineTop";
public static String LINE_PAINTER = "-line";
public static String TEXT_PAINTER = "-text";
protected final int orientation = ViewResources.HORIZONTAL.intValue();
protected final GraphicsManager graphics;
public CalendarDrawingModule()
{
this.graphics = new BasicGraphicsManager();
}
// _________________________________________________________________________
public void initialise(DrawingContext attributes) {
loadTextModule(TIMELINE_TOP, +2, false, attributes);
loadLineModule(TIMELINE_TOP, +2 , true, attributes);
loadTextModule(TIMELINE_BOTTOM, +1, true, attributes);
loadLineModule(TIMELINE_BOTTOM, +1 , true, attributes);
}
public void terminate(DrawingContext attributes) {
}
// _________________________________________________________________________
protected PartPainter createPainter(PartView view, GraphicsManager graphics)
{
BasicPartPainter painter = new BasicPartPainter();
return painter;
}
// _________________________________________________________________________
protected void loadTextModule(String key, int offset, boolean value, DrawingContext attributes)
{
GranularityRangeModel model = new LocalGranularityRangeModel(orientation, offset, attributes);
TextCalendarModule module = new TextCalendarModule(key + TEXT_PAINTER, model, value);
module.setGraphics(graphics);
module.initialise(attributes);
PartView view = new BasicPartView();
attributes.put(key + TEXT_PAINTER, ContextResources.PART_PAINTER,
createPainter(view, graphics));
}
protected void loadLineModule(String key, int offset, boolean value, DrawingContext attributes)
{
GranularityRangeModel model = new LocalGranularityRangeModel(orientation, offset, attributes);
LineCalendarModule module = new LineCalendarModule(key + LINE_PAINTER, model);
module.setGraphics(graphics);
module.initialise(attributes);
PartView view = new BasicPartView();
attributes.put(key + LINE_PAINTER, ContextResources.PART_PAINTER, createPainter(view, graphics));
}
// __________________________________________________________________________
protected final class LocalGranularityRangeModel extends GranularityRangeModel
{
final DrawingContext attributes;
public LocalGranularityRangeModel(int axisKey, int offset, DrawingContext attributes)
{
super (axisKey, offset);
this.attributes = attributes;
}
protected boolean accepts(Object key, Object gran, Graphics g, Rectangle bounds)
{
if (bounds.width == 0)
return false;
RangePainter partPainter = (RangePainter) attributes.get(TIMELINE_TOP + TEXT_PAINTER, ContextResources.DRAWING_PAINTER);
GraphicsContext context = (GraphicsContext) attributes.get(TIMELINE_TOP + TEXT_PAINTER, ContextResources.GRAPHICS_CONTEXT);
long width = partPainter.width(key, gran, g, bounds, context);
return width <= bounds.width;
}
}
} | 4,110 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
BoundedPainterModule.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/ext/egantt/drawing/module/BoundedPainterModule.java | package ext.egantt.drawing.module;
import com.egantt.drawing.painter.bounded.BoundedBoxPainter;
import com.egantt.drawing.painter.bounded.BoundedDiamondPainter;
import com.egantt.drawing.painter.bounded.BoundedOvalPainter;
import com.egantt.model.drawing.ContextResources;
import com.egantt.model.drawing.DrawingContext;
import ext.egantt.drawing.DrawingModule;
public class BoundedPainterModule implements DrawingModule{
private static final String THIS = BoundedPainterModule.class.getName();
public static final String BOUNDED_BOX_PAINTER = THIS + "-BoundedBoxPainter";
public static final String BOUNDED_DIAMOND_PAINTER = THIS + "-BoundedDiamondPainter";
public static final String BOUNDED_OVAL_PAINTER = THIS + "-BoundedOvalPainter";
// ________________________________________________________________________
public void initialise(DrawingContext attributes) {
attributes.put(BOUNDED_BOX_PAINTER, ContextResources.DRAWING_PAINTER, new BoundedBoxPainter());
attributes.put(BOUNDED_DIAMOND_PAINTER, ContextResources.DRAWING_PAINTER, new BoundedDiamondPainter());
attributes.put(BOUNDED_OVAL_PAINTER, ContextResources.DRAWING_PAINTER, new BoundedOvalPainter());
}
public void terminate(DrawingContext attributes) {
attributes.put(BOUNDED_BOX_PAINTER, ContextResources.DRAWING_PAINTER, null);
attributes.put(BOUNDED_DIAMOND_PAINTER, ContextResources.DRAWING_PAINTER, null);
attributes.put(BOUNDED_OVAL_PAINTER, ContextResources.DRAWING_PAINTER, null);
}
}
| 1,491 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
GradientColorModule.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/ext/egantt/drawing/module/GradientColorModule.java | package ext.egantt.drawing.module;
import com.egantt.awt.graphics.GraphicsContext;
import com.egantt.awt.paint.VerticalGradientPaint;
import com.egantt.model.drawing.ContextResources;
import com.egantt.model.drawing.DrawingContext;
import ext.egantt.drawing.DrawingModule;
import ext.egantt.drawing.context.GradientColorContext;
import org.rtv.Options;
import java.awt.*;
import java.util.Iterator;
import java.util.List;
public class GradientColorModule
implements DrawingModule
{
public static final class LocalColorContext
implements GraphicsContext
{
public Object get(Object key, Object type)
{
return "Paint".equals(type) ? color : null;
}
public Paint getPaint()
{
return color;
}
protected final Paint color;
public LocalColorContext(Color color)
{
this.color = new VerticalGradientPaint(color, color);
}
}
public GradientColorModule()
{
}
public void initialise(DrawingContext attributes) {
attributes.put("GradientColorContext.BLACK", ContextResources.GRAPHICS_CONTEXT, GradientColorContext.BLACK);
attributes.put("GradientColorContext.BLUE", ContextResources.GRAPHICS_CONTEXT, GradientColorContext.BLUE);
attributes.put("GradientColorContext.CYAN", ContextResources.GRAPHICS_CONTEXT, GradientColorContext.CYAN);
attributes.put("GradientColorContext.DARK_GRAY", ContextResources.GRAPHICS_CONTEXT, GradientColorContext.DARK_GRAY);
attributes.put("GradientColorContext.GRAY", ContextResources.GRAPHICS_CONTEXT, GradientColorContext.GRAY);
attributes.put("GradientColorContext.GREEN", ContextResources.GRAPHICS_CONTEXT, GradientColorContext.GREEN);
attributes.put("GradientColorContext.LIGHT_GRAY", ContextResources.GRAPHICS_CONTEXT, GradientColorContext.LIGHT_GRAY);
attributes.put("GradientColorContext.MAGENTA", ContextResources.GRAPHICS_CONTEXT, GradientColorContext.MAGENTA);
attributes.put("GradientColorContext.ORANGE", ContextResources.GRAPHICS_CONTEXT, GradientColorContext.ORANGE);
attributes.put("GradientColorContext.PINK", ContextResources.GRAPHICS_CONTEXT, GradientColorContext.PINK);
attributes.put("GradientColorContext.RED", ContextResources.GRAPHICS_CONTEXT, GradientColorContext.RED);
attributes.put("GradientColorContext.WHITE", ContextResources.GRAPHICS_CONTEXT, GradientColorContext.WHITE);
attributes.put("GradientColorContext.YELLOW", ContextResources.GRAPHICS_CONTEXT, GradientColorContext.YELLOW);
attributes.put("GradientColorContext.OTHER0", ContextResources.GRAPHICS_CONTEXT,
new LocalColorContext(Options.getInstance().getColor(Options.LBL_OTHER)));
attributes.put("GradientColorContext.CLUSTER11", ContextResources.GRAPHICS_CONTEXT,
new LocalColorContext(Options.getInstance().getColor(Options.LBL_CLUSTER)));
attributes.put("GradientColorContext.QUEUEING12", ContextResources.GRAPHICS_CONTEXT,
new LocalColorContext(Options.getInstance().getColor(Options.LBL_QUEUEING)));
attributes.put("GradientColorContext.NETWORK7", ContextResources.GRAPHICS_CONTEXT,
new LocalColorContext(Options.getInstance().getColor(Options.LBL_NETWORK)));
attributes.put("GradientColorContext.ADMINISTRATIVE3", ContextResources.GRAPHICS_CONTEXT,
new LocalColorContext(Options.getInstance().getColor(Options.LBL_ADMINISTRATIVE)));
attributes.put("GradientColorContext.CONFIGURATION2", ContextResources.GRAPHICS_CONTEXT,
new LocalColorContext(Options.getInstance().getColor(Options.LBL_CONFIGURATION)));
attributes.put("GradientColorContext.COMMIT5", ContextResources.GRAPHICS_CONTEXT,
new LocalColorContext(Options.getInstance().getColor(Options.LBL_COMMIT)));
attributes.put("GradientColorContext.APPLICATION1", ContextResources.GRAPHICS_CONTEXT,
new LocalColorContext(Options.getInstance().getColor(Options.LBL_APPLICATION)));
attributes.put("GradientColorContext.CONCURRENCY4", ContextResources.GRAPHICS_CONTEXT,
new LocalColorContext(Options.getInstance().getColor(Options.LBL_CONCURRENCY)));
attributes.put("GradientColorContext.SYSTEMIO9", ContextResources.GRAPHICS_CONTEXT,
new LocalColorContext(Options.getInstance().getColor(Options.LBL_SYSTEMIO)));
attributes.put("GradientColorContext.USERIO8", ContextResources.GRAPHICS_CONTEXT,
new LocalColorContext(Options.getInstance().getColor(Options.LBL_USERIO)));
attributes.put("GradientColorContext.SCHEDULER10", ContextResources.GRAPHICS_CONTEXT,
new LocalColorContext(Options.getInstance().getColor(Options.LBL_SCHEDULER)));
attributes.put("GradientColorContext.CPU", ContextResources.GRAPHICS_CONTEXT,
new LocalColorContext(Options.getInstance().getColor(Options.LBL_CPU)));
attributes.put("GradientColorContext.OTHER0", ContextResources.GRAPHICS_CONTEXT,
new LocalColorContext(Options.getInstance().getColor(Options.LBL_PG_ACTIVITY)));
attributes.put("GradientColorContext.CLUSTER11", ContextResources.GRAPHICS_CONTEXT,
new LocalColorContext(Options.getInstance().getColor(Options.LBL_PG_BUFFERPIN)));
attributes.put("GradientColorContext.QUEUEING12", ContextResources.GRAPHICS_CONTEXT,
new LocalColorContext(Options.getInstance().getColor(Options.LBL_PG_CLIENT)));
attributes.put("GradientColorContext.NETWORK7", ContextResources.GRAPHICS_CONTEXT,
new LocalColorContext(Options.getInstance().getColor(Options.LBL_PG_CPU)));
attributes.put("GradientColorContext.ADMINISTRATIVE3", ContextResources.GRAPHICS_CONTEXT,
new LocalColorContext(Options.getInstance().getColor(Options.LBL_PG_EXTENSION)));
attributes.put("GradientColorContext.CONFIGURATION2", ContextResources.GRAPHICS_CONTEXT,
new LocalColorContext(Options.getInstance().getColor(Options.LBL_PG_IO)));
attributes.put("GradientColorContext.COMMIT5", ContextResources.GRAPHICS_CONTEXT,
new LocalColorContext(Options.getInstance().getColor(Options.LBL_PG_IPC)));
attributes.put("GradientColorContext.APPLICATION1", ContextResources.GRAPHICS_CONTEXT,
new LocalColorContext(Options.getInstance().getColor(Options.LBL_PG_LOCK)));
attributes.put("GradientColorContext.CONCURRENCY4", ContextResources.GRAPHICS_CONTEXT,
new LocalColorContext(Options.getInstance().getColor(Options.LBL_PG_LWLOCK)));
attributes.put("GradientColorContext.SYSTEMIO9", ContextResources.GRAPHICS_CONTEXT,
new LocalColorContext(Options.getInstance().getColor(Options.LBL_PG_TIMEOUT)));
}
public void initialise(DrawingContext attributes, List eventList)
{
this.initialise(attributes);
if (eventList != null){
Iterator iterEvent = eventList.iterator();
while (iterEvent.hasNext()) {
String eventName = (String) iterEvent.next();
attributes.put(eventName,
ContextResources.GRAPHICS_CONTEXT,
new LocalColorContext(Options.getInstance().getColor(eventName)));
}
}
}
public void terminate(DrawingContext attributes)
{
attributes.put("GradientColorContext.BLACK", ContextResources.GRAPHICS_CONTEXT, null);
attributes.put("GradientColorContext.BLUE", ContextResources.GRAPHICS_CONTEXT, null);
attributes.put("GradientColorContext.CYAN", ContextResources.GRAPHICS_CONTEXT, null);
attributes.put("GradientColorContext.DARK_GRAY", ContextResources.GRAPHICS_CONTEXT, null);
attributes.put("GradientColorContext.GRAY", ContextResources.GRAPHICS_CONTEXT, null);
attributes.put("GradientColorContext.GREEN", ContextResources.GRAPHICS_CONTEXT, null);
attributes.put("GradientColorContext.LIGHT_GRAY", ContextResources.GRAPHICS_CONTEXT, null);
attributes.put("GradientColorContext.MAGENTA", ContextResources.GRAPHICS_CONTEXT, null);
attributes.put("GradientColorContext.ORANGE", ContextResources.GRAPHICS_CONTEXT, null);
attributes.put("GradientColorContext.PINK", ContextResources.GRAPHICS_CONTEXT, null);
attributes.put("GradientColorContext.RED", ContextResources.GRAPHICS_CONTEXT, null);
attributes.put("GradientColorContext.WHITE", ContextResources.GRAPHICS_CONTEXT, null);
attributes.put("GradientColorContext.YELLOW", ContextResources.GRAPHICS_CONTEXT, null);
attributes.put("GradientColorContext.OTHER0", ContextResources.GRAPHICS_CONTEXT, null);
attributes.put("GradientColorContext.CLUSTER11", ContextResources.GRAPHICS_CONTEXT, null);
attributes.put("GradientColorContext.QUEUEING12", ContextResources.GRAPHICS_CONTEXT, null);
attributes.put("GradientColorContext.NETWORK7", ContextResources.GRAPHICS_CONTEXT, null);
attributes.put("GradientColorContext.ADMINISTRATIVE3", ContextResources.GRAPHICS_CONTEXT, null);
attributes.put("GradientColorContext.CONFIGURATION2", ContextResources.GRAPHICS_CONTEXT, null);
attributes.put("GradientColorContext.COMMIT5", ContextResources.GRAPHICS_CONTEXT, null);
attributes.put("GradientColorContext.APPLICATION1", ContextResources.GRAPHICS_CONTEXT, null);
attributes.put("GradientColorContext.CONCURRENCY4", ContextResources.GRAPHICS_CONTEXT, null);
attributes.put("GradientColorContext.SYSTEMIO9", ContextResources.GRAPHICS_CONTEXT, null);
attributes.put("GradientColorContext.USERIO8", ContextResources.GRAPHICS_CONTEXT, null);
attributes.put("GradientColorContext.SCHEDULER10", ContextResources.GRAPHICS_CONTEXT, null);
attributes.put("GradientColorContext.CPU", ContextResources.GRAPHICS_CONTEXT, null);
}
public static final String BLACK_GRADIENT_CONTEXT = "GradientColorContext.BLACK";
public static final String BLUE_GRADIENT_CONTEXT = "GradientColorContext.BLUE";
public static final String CYAN_GRADIENT_CONTEXT = "GradientColorContext.CYAN";
public static final String DARK_GRAY_GRADIENT_CONTEXT = "GradientColorContext.DARK_GRAY";
public static final String GRAY_GRADIENT_CONTEXT = "GradientColorContext.GRAY";
public static final String GREEN_GRADIENT_CONTEXT = "GradientColorContext.GREEN";
public static final String LIGHT_GRAY_GRADIENT_CONTEXT = "GradientColorContext.LIGHT_GRAY";
public static final String MAGENTA_GRADIENT_CONTEXT = "GradientColorContext.MAGENTA";
public static final String ORANGE_GRADIENT_CONTEXT = "GradientColorContext.ORANGE";
public static final String PINK_GRADIENT_CONTEXT = "GradientColorContext.PINK";
public static final String RED_GRADIENT_CONTEXT = "GradientColorContext.RED";
public static final String WHITE_GRADIENT_CONTEXT = "GradientColorContext.WHITE";
public static final String YELLOW_GRADIENT_CONTEXT = "GradientColorContext.YELLOW";
public static final String OTHER0_GRADIENT_CONTEXT = "GradientColorContext.OTHER0";
public static final String CLUSTER11_GRADIENT_CONTEXT = "GradientColorContext.CLUSTER11";
public static final String QUEUEING12_GRADIENT_CONTEXT = "GradientColorContext.QUEUEING12";
public static final String NETWORK7_GRADIENT_CONTEXT = "GradientColorContext.NETWORK7";
public static final String ADMINISTRATIVE3_GRADIENT_CONTEXT = "GradientColorContext.ADMINISTRATIVE3";
public static final String CONFIGURATION2_GRADIENT_CONTEXT = "GradientColorContext.CONFIGURATION2";
public static final String COMMIT5_GRADIENT_CONTEXT = "GradientColorContext.COMMIT5";
public static final String APPLICATION1_GRADIENT_CONTEXT = "GradientColorContext.APPLICATION1";
public static final String CONCURRENCY4_GRADIENT_CONTEXT = "GradientColorContext.CONCURRENCY4";
public static final String SYSTEMIO9_GRADIENT_CONTEXT = "GradientColorContext.SYSTEMIO9";
public static final String USERIO8_GRADIENT_CONTEXT = "GradientColorContext.USERIO8";
public static final String SCHEDULER10_GRADIENT_CONTEXT = "GradientColorContext.SCHEDULER10";
public static final String CPU_GRADIENT_CONTEXT = "GradientColorContext.CPU";
}
| 11,635 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
BasicPainterModule.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/ext/egantt/drawing/module/BasicPainterModule.java | package ext.egantt.drawing.module;
import com.egantt.drawing.painter.basic.BasicArcPainter;
import com.egantt.drawing.painter.basic.BasicBorderPainter;
import com.egantt.drawing.painter.basic.BasicLinePainter;
import com.egantt.drawing.painter.basic.BasicOvalPainter;
import com.egantt.drawing.painter.basic.BasicStringPainter;
import com.egantt.drawing.painter.filled.FilledArcPainter;
import com.egantt.model.drawing.ContextResources;
import com.egantt.model.drawing.DrawingContext;
import ext.egantt.drawing.DrawingModule;
public class BasicPainterModule implements DrawingModule{
private static final String THIS = BasicPainterModule.class.getName();
public static final Object BASIC_BORDER_PAINTER = THIS + "-BasicBorderPainter";
public static final Object BASIC_LINE_PAINTER = THIS + "-BasicLinePainter";
public static final Object BASIC_OVAL_PAINTER = THIS + "-BasicOvalPainter";
public static final String BASIC_ARC_PAINTER_OPEN = THIS + "-BasicArcPainterOPEN";
public static final String BASIC_ARC_PAINTER_CHORD = THIS + "-BasicArcPainterCHORD";
public static final String BASIC_ARC_PAINTER_PIE = THIS + "-BasicArcPainterPIE";
public static final String BASIC_STRING_PAINTER = THIS + "-BasicStringPainter";
public void initialise(DrawingContext attributes) {
attributes.put(BASIC_ARC_PAINTER_OPEN, ContextResources.DRAWING_PAINTER, new BasicArcPainter(FilledArcPainter.OPEN));
attributes.put(BASIC_ARC_PAINTER_CHORD, ContextResources.DRAWING_PAINTER, new BasicArcPainter(FilledArcPainter.CHORD));
attributes.put(BASIC_ARC_PAINTER_PIE, ContextResources.DRAWING_PAINTER, new BasicArcPainter(FilledArcPainter.PIE));
attributes.put(BASIC_BORDER_PAINTER, ContextResources.DRAWING_PAINTER, new BasicBorderPainter());
// put(BASIC_ICON_PAINTER, ContextResources.DRAWING_PAINTER, new BasicIconPainter());
attributes.put(BASIC_LINE_PAINTER, ContextResources.DRAWING_PAINTER, new BasicLinePainter());
attributes.put(BASIC_OVAL_PAINTER, ContextResources.DRAWING_PAINTER, new BasicOvalPainter());
attributes.put(BASIC_STRING_PAINTER, ContextResources.DRAWING_PAINTER, new BasicStringPainter());
}
public void terminate(DrawingContext attributes) {
attributes.put(BASIC_ARC_PAINTER_OPEN, ContextResources.DRAWING_PAINTER, null);
attributes.put(BASIC_ARC_PAINTER_CHORD, ContextResources.DRAWING_PAINTER, null);
attributes.put(BASIC_ARC_PAINTER_PIE, ContextResources.DRAWING_PAINTER, null);
attributes.put(BASIC_BORDER_PAINTER, ContextResources.DRAWING_PAINTER, null);
// put(BASIC_ICON_PAINTER, ContextResources.DRAWING_PAINTER, new BasicIconPainter());
attributes.put(BASIC_LINE_PAINTER, ContextResources.DRAWING_PAINTER, null);
attributes.put(BASIC_OVAL_PAINTER, ContextResources.DRAWING_PAINTER, null);
attributes.put(BASIC_STRING_PAINTER, ContextResources.DRAWING_PAINTER, null);
}
} | 2,837 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
FilledPainterModule.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/ext/egantt/drawing/module/FilledPainterModule.java | package ext.egantt.drawing.module;
import com.egantt.drawing.painter.filled.FilledArcPainter;
import com.egantt.drawing.painter.filled.FilledOvalPainter;
import com.egantt.drawing.painter.filled.FilledRectanglePainter;
import com.egantt.drawing.painter.filled.FilledShapePainter;
import com.egantt.model.drawing.ContextResources;
import com.egantt.model.drawing.DrawingContext;
import ext.egantt.drawing.DrawingModule;
public class FilledPainterModule implements DrawingModule {
public static final String FILLED_SHAPE_PAINTER = "FilledShapePainter";
public static final String FILLED_RECTANGLE_PAINTER = "FilledRectanglePainter";
public static final String FILLED_ARC_PAINTER_OPEN = "FilledArcPainterOPEN";
public static final String FILLED_ARC_PAINTER_CHORD = "FilledArcPainterCHORD";
public static final String FILLED_ARC_PAINTER_PIE = "FilledArcPainterPIE";
public static final String FILLED_OVAL_PAINTER = "FilledOvalPainter";
// ________________________________________________________________________
public void initialise(DrawingContext attributes) {
// Filled Painters
attributes.put(FILLED_ARC_PAINTER_OPEN, ContextResources.DRAWING_PAINTER, new FilledArcPainter(FilledArcPainter.OPEN));
attributes.put(FILLED_ARC_PAINTER_CHORD, ContextResources.DRAWING_PAINTER, new FilledArcPainter(FilledArcPainter.CHORD));
attributes.put(FILLED_ARC_PAINTER_PIE, ContextResources.DRAWING_PAINTER, new FilledArcPainter(FilledArcPainter.PIE));
attributes.put(FILLED_OVAL_PAINTER, ContextResources.DRAWING_PAINTER, new FilledOvalPainter());
attributes.put(FILLED_RECTANGLE_PAINTER, ContextResources.DRAWING_PAINTER, new FilledRectanglePainter());
attributes.put(FILLED_SHAPE_PAINTER, ContextResources.DRAWING_PAINTER, new FilledShapePainter());
}
public void terminate(DrawingContext attributes) {
attributes.put(FILLED_ARC_PAINTER_OPEN, ContextResources.DRAWING_PAINTER, null);
attributes.put(FILLED_ARC_PAINTER_CHORD, ContextResources.DRAWING_PAINTER, null);
attributes.put(FILLED_ARC_PAINTER_PIE, ContextResources.DRAWING_PAINTER, null);
attributes.put(FILLED_OVAL_PAINTER, ContextResources.DRAWING_PAINTER, null);
attributes.put(FILLED_RECTANGLE_PAINTER, ContextResources.DRAWING_PAINTER, null);
attributes.put(FILLED_SHAPE_PAINTER, ContextResources.DRAWING_PAINTER, null);
}
} | 2,328 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
GanttDrawingModule.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/ext/egantt/drawing/module/GanttDrawingModule.java | package ext.egantt.drawing.module;
import com.egantt.drawing.painter.axis.AxisPercentagePainter;
import com.egantt.drawing.painter.gantt.GanttTaskPainter;
import com.egantt.drawing.painter.gantt.LinkTaskPainter;
import com.egantt.model.drawing.ContextResources;
import com.egantt.model.drawing.DrawingContext;
import ext.egantt.drawing.DrawingModule;
import ext.egantt.swing.GanttTable;
// Bounded Painters
public class GanttDrawingModule implements DrawingModule {
private static final String THIS = GanttDrawingModule.class.getName();
public static final String SHIFT_ENTRY_PLOTTER = THIS + "-ShiftEntryPlotter";
public static final String LINK_ENTRY_PLOTTER = THIS + "-LinkEntryPlotter";
public static final String AXIS_PERCENTAGE_PAINTER = THIS + "-AxisPercentagePainter";
public void initialise(DrawingContext attributes) {
attributes.put(LINK_ENTRY_PLOTTER, ContextResources.DRAWING_PAINTER, new LinkTaskPainter());
attributes.put(SHIFT_ENTRY_PLOTTER, ContextResources.DRAWING_PAINTER,new GanttTaskPainter());
attributes.put(AXIS_PERCENTAGE_PAINTER, ContextResources.DRAWING_PAINTER, new AxisPercentagePainter(GanttTable.PERCENTAGE_AXIS));
}
public void terminate(DrawingContext attributes) {
attributes.put(LINK_ENTRY_PLOTTER, ContextResources.DRAWING_PAINTER, null);
attributes.put(SHIFT_ENTRY_PLOTTER, ContextResources.DRAWING_PAINTER,null);
attributes.put(AXIS_PERCENTAGE_PAINTER, ContextResources.DRAWING_PAINTER, null);
}
} | 1,470 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
LineCalendarModule.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/ext/egantt/drawing/module/LineCalendarModule.java | /*
* @(#)LineCalendarModule.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package ext.egantt.drawing.module;
import com.egantt.awt.graphics.GraphicsContext;
import com.egantt.awt.graphics.GraphicsManager;
import com.egantt.awt.graphics.state.GraphicsState2D;
import com.egantt.drawing.DrawingPainter;
import com.egantt.drawing.painter.RangePainter;
import com.egantt.drawing.painter.basic.BasicRectanglePainter;
import com.egantt.drawing.painter.range.BasicRangePainter;
import com.egantt.drawing.painter.range.model.GranularityRangeModel;
import com.egantt.model.drawing.ContextResources;
import com.egantt.model.drawing.DrawingContext;
import com.egantt.model.drawing.painter.state.BasicPainterState;
import ext.egantt.drawing.DrawingModule;
import ext.egantt.drawing.painter.context.BasicPainterContext;
import ext.egantt.model.drawing.granularity.CachedCalendarGranularity;
import ext.egantt.model.drawing.granularity.CalendarConstants;
import java.awt.BasicStroke;
import java.awt.Color;
public class LineCalendarModule implements DrawingModule
{
protected final CachedCalendarGranularity granularity;
protected final String key;
protected GranularityRangeModel model;
protected GraphicsManager graphics;
public LineCalendarModule(String key, GranularityRangeModel model)
{
this.key = key;
this.model = model;
this.granularity = new CachedCalendarGranularity(1, CalendarConstants.FORMAT_KEYS);
}
// __________________________________________________________________________
public void setGraphics(GraphicsManager graphics)
{
this.graphics = graphics;
}
public void setRangeModel(GranularityRangeModel model)
{
this.model = model;
}
// __________________________________________________________________________
public void initialise(DrawingContext context)
{
context.put(key, ContextResources.GRAPHICS_CONTEXT, createContext());
context.put(key, ContextResources.DRAWING_PAINTER, createPainter());
context.put(key, ContextResources.PAINTER_STATE, new BasicPainterState());
}
public void terminate(DrawingContext context)
{
context.put(key, ContextResources.GRAPHICS_CONTEXT, null);
context.put(key, ContextResources.DRAWING_PAINTER, null);
context.put(key, ContextResources.PAINTER_STATE, null);
}
// __________________________________________________________________________
protected GraphicsContext createContext()
{
BasicPainterContext context = new BasicPainterContext();
context.setDrawingGranularity(granularity);
context.setPaint(Color.black);
context.setStroke(new BasicStroke(0));
return context;
}
protected DrawingPainter createPainter()
{
RangePainter painter = new BasicRangePainter(graphics, true);
painter.setModel(model);
painter.setPainter(new BasicRectanglePainter());
painter.setState(new GraphicsState2D());
return painter;
}
}
| 2,921 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
TextCalendarModule.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/ext/egantt/drawing/module/TextCalendarModule.java | /*
* @(#)TextCalendarModule.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package ext.egantt.drawing.module;
import com.egantt.awt.graphics.GraphicsContext;
import com.egantt.awt.graphics.GraphicsManager;
import com.egantt.awt.graphics.state.GraphicsState2D;
import com.egantt.drawing.DrawingPainter;
import com.egantt.drawing.painter.RangePainter;
import com.egantt.drawing.painter.format.BasicFormatPainter;
import com.egantt.drawing.painter.range.BasicRangePainter;
import com.egantt.drawing.painter.range.model.GranularityRangeModel;
import com.egantt.model.drawing.ContextResources;
import com.egantt.model.drawing.DrawingContext;
import com.egantt.model.drawing.DrawingGranularity;
import com.egantt.model.drawing.painter.state.BasicPainterState;
import ext.egantt.drawing.painter.context.compound.BasicCompoundContext;
import ext.egantt.model.drawing.granularity.CachedCalendarGranularity;
import ext.egantt.model.drawing.granularity.CalendarConstants;
import java.awt.Color;
import java.awt.Font;
import java.text.SimpleDateFormat;
import java.util.Calendar;
public class TextCalendarModule
{
private static final Font font = new Font("SanSerif", Font.PLAIN, 9);
protected final DrawingGranularity granularity;
protected final boolean formatType;
protected final String key;
protected GranularityRangeModel model;
protected GraphicsManager graphics;
public TextCalendarModule(String key, GranularityRangeModel model, boolean formatType)
{
this.formatType = formatType;
this.model = model;
this.key = key;
this.granularity = new CachedCalendarGranularity(1, CalendarConstants.FORMAT_KEYS);
}
// __________________________________________________________________________
public void setGraphics(GraphicsManager graphics)
{
this.graphics = graphics;
}
public void setRangeModel(GranularityRangeModel model)
{
this.model = model;
}
// __________________________________________________________________________
public void initialise(DrawingContext context)
{
context.put(key, ContextResources.GRAPHICS_CONTEXT, createContext());
context.put(key, ContextResources.DRAWING_PAINTER, createPainter());
context.put(key, ContextResources.PAINTER_STATE, new BasicPainterState());
}
public void terminate(DrawingContext context)
{
context.put(key, ContextResources.GRAPHICS_CONTEXT, null);
context.put(key, ContextResources.DRAWING_PAINTER, null);
context.put(key, ContextResources.PAINTER_STATE, null);
}
// __________________________________________________________________________
protected GraphicsContext createContext()
{
BasicCompoundContext context = new BasicCompoundContext();
context.setDrawingGranularity(granularity);
context.setFont(font);
context.setPaint(Color.black);
// hard coded, as this demo code does not have access to bundles
context.setFormat(new Integer(Calendar.SECOND),
new SimpleDateFormat(" hh:mm:ss"));
context.setFormat(new Integer(Calendar.MINUTE),
new SimpleDateFormat(formatType ? " hh:mm:'xx'" : " hh:mm:'xx' dd MMM yyyy"));
context.setFormat(new Integer(Calendar.HOUR),
new SimpleDateFormat(formatType ? " hh:'xx'" : " hh:'xx' dd MMM yyyy"));
context.setFormat(new Integer(Calendar.DAY_OF_MONTH),
new SimpleDateFormat(formatType ? " E dd/m/yy" : " dd MMMM yyyy"));
context.setFormat(new Integer(Calendar.WEEK_OF_MONTH),
new SimpleDateFormat(formatType ? "MMM" : " ww MM/yy"));
context.setFormat(new Integer(Calendar.WEEK_OF_YEAR),
new SimpleDateFormat(formatType ? "M" : "M yyyy"));
context.setFormat(new Integer(Calendar.MONTH),
new SimpleDateFormat(formatType ? " MMM" : " MMMM yyyy"));
context.setFormat(new Integer(Calendar.YEAR),
new SimpleDateFormat(" yyyy"));
return context;
}
protected DrawingPainter createPainter()
{
RangePainter painter = new BasicRangePainter(graphics, false);
painter.setModel(model);
painter.setPainter(new BasicFormatPainter());
painter.setState(new GraphicsState2D());
return painter;
}
}
| 4,080 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
BasicColorModule.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/ext/egantt/drawing/module/BasicColorModule.java | package ext.egantt.drawing.module;
import com.egantt.model.drawing.ContextResources;
import com.egantt.model.drawing.DrawingContext;
import ext.egantt.drawing.DrawingModule;
import ext.egantt.drawing.context.DefaultColorContext;
public class BasicColorModule implements DrawingModule {
private static final String THIS = BasicColorModule.class.getName();
// ________________________________________________________________________
public static final String BLACK_NORMAL_CONTEXT = THIS + "-BLACK";
public static final String BLUE_NORMAL_CONTEXT = THIS + "-BLUE";
public static final String CYAN_NORMAL_CONTEXT = THIS + "-CYAN";
public static final String DARK_GRAY_NORMAL_CONTEXT = THIS + "-DARK_GRAY";
public static final String GRAY_NORMAL_CONTEXT = THIS + "-GRAY";
public static final String GREEN_NORMAL_CONTEXT = THIS + "-GREEN";
public static final String LIGHT_GRAY_NORMAL_CONTEXT = THIS + "-LIGHT_GRAY";
public static final String MAGENTA_NORMAL_CONTEXT = THIS + "-MAGENTA";
public static final String ORANGE_NORMAL_CONTEXT = THIS + "-ORANGE";
public static final String PINK_NORMAL_CONTEXT = THIS + "-PINK";
public static final String RED_NORMAL_CONTEXT = THIS + "-RED";
public static final String WHITE_NORMAL_CONTEXT = THIS + "-WHITE";
public static final String YELLOW_NORMAL_CONTEXT = THIS + "-YELLOW";
// ________________________________________________________________________
public void initialise(DrawingContext attributes) {
attributes.put(BLACK_NORMAL_CONTEXT, ContextResources.GRAPHICS_CONTEXT, DefaultColorContext.BLACK);
attributes.put(BLUE_NORMAL_CONTEXT, ContextResources.GRAPHICS_CONTEXT, DefaultColorContext.BLUE);
attributes.put(CYAN_NORMAL_CONTEXT, ContextResources.GRAPHICS_CONTEXT, DefaultColorContext.CYAN);
attributes.put(DARK_GRAY_NORMAL_CONTEXT, ContextResources.GRAPHICS_CONTEXT, DefaultColorContext.DARK_GRAY);
attributes.put(GRAY_NORMAL_CONTEXT, ContextResources.GRAPHICS_CONTEXT, DefaultColorContext.GRAY);
attributes.put(GREEN_NORMAL_CONTEXT, ContextResources.GRAPHICS_CONTEXT, DefaultColorContext.GREEN);
attributes.put(LIGHT_GRAY_NORMAL_CONTEXT, ContextResources.GRAPHICS_CONTEXT, DefaultColorContext.LIGHT_GRAY);
attributes.put(MAGENTA_NORMAL_CONTEXT, ContextResources.GRAPHICS_CONTEXT, DefaultColorContext.MAGENTA);
attributes.put(ORANGE_NORMAL_CONTEXT, ContextResources.GRAPHICS_CONTEXT, DefaultColorContext.ORANGE);
attributes.put(PINK_NORMAL_CONTEXT, ContextResources.GRAPHICS_CONTEXT, DefaultColorContext.PINK);
attributes.put(RED_NORMAL_CONTEXT, ContextResources.GRAPHICS_CONTEXT, DefaultColorContext.RED);
attributes.put(WHITE_NORMAL_CONTEXT, ContextResources.GRAPHICS_CONTEXT, DefaultColorContext.WHITE);
attributes.put(YELLOW_NORMAL_CONTEXT, ContextResources.GRAPHICS_CONTEXT, DefaultColorContext.YELLOW);
}
public void terminate(DrawingContext attributes) {
attributes.put(BLACK_NORMAL_CONTEXT, ContextResources.GRAPHICS_CONTEXT, null);
attributes.put(BLUE_NORMAL_CONTEXT, ContextResources.GRAPHICS_CONTEXT, null);
attributes.put(CYAN_NORMAL_CONTEXT, ContextResources.GRAPHICS_CONTEXT, null);
attributes.put(DARK_GRAY_NORMAL_CONTEXT, ContextResources.GRAPHICS_CONTEXT, null);
attributes.put(GRAY_NORMAL_CONTEXT, ContextResources.GRAPHICS_CONTEXT, null);
attributes.put(GREEN_NORMAL_CONTEXT, ContextResources.GRAPHICS_CONTEXT, null);
attributes.put(LIGHT_GRAY_NORMAL_CONTEXT, ContextResources.GRAPHICS_CONTEXT, null);
attributes.put(MAGENTA_NORMAL_CONTEXT, ContextResources.GRAPHICS_CONTEXT, null);
attributes.put(ORANGE_NORMAL_CONTEXT, ContextResources.GRAPHICS_CONTEXT, null);
attributes.put(PINK_NORMAL_CONTEXT, ContextResources.GRAPHICS_CONTEXT, null);
attributes.put(RED_NORMAL_CONTEXT, ContextResources.GRAPHICS_CONTEXT, null);
attributes.put(WHITE_NORMAL_CONTEXT, ContextResources.GRAPHICS_CONTEXT, null);
attributes.put(YELLOW_NORMAL_CONTEXT, ContextResources.GRAPHICS_CONTEXT, null);
}
} | 3,934 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
StandardDrawingModule.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/ext/egantt/drawing/module/StandardDrawingModule.java | package ext.egantt.drawing.module;
import com.egantt.drawing.component.painter.part.BasicPartPainter;
import com.egantt.model.drawing.ContextResources;
import com.egantt.model.drawing.DrawingContext;
import com.egantt.model.drawing.painter.state.BasicPainterState;
import ext.egantt.drawing.DrawingModule;
public class StandardDrawingModule implements DrawingModule {
public static final String THIS = StandardDrawingModule.class.getName();
public final static String DEFAULT_PAINTER_STATE = THIS + "-DefaultPainterState";
public final static String DEFAULT_PART_PAINTER = THIS + "-DefaultPartPainter";
// ________________________________________________________________________
public void initialise(DrawingContext attributes) {
attributes.put(DEFAULT_PAINTER_STATE, ContextResources.PAINTER_STATE, new BasicPainterState());
attributes.put(DEFAULT_PART_PAINTER, ContextResources.PART_PAINTER, new BasicPartPainter());
}
public void terminate(DrawingContext attributes) {
attributes.put(DEFAULT_PAINTER_STATE, ContextResources.PAINTER_STATE, null);
attributes.put(DEFAULT_PART_PAINTER, ContextResources.PART_PAINTER, null);
}
} | 1,156 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
DrawingTool.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/ext/egantt/actions/DrawingTool.java | package ext.egantt.actions;
import java.awt.Graphics;
import ext.egantt.swing.GanttTable;
public interface DrawingTool {
public void intialize(GanttTable table);
public void terminate();
// ________________________________________________________________________
public void paintComponent(Graphics g);
} | 318 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |