feat(activitypub): 🧑‍💻 update object model

master
Xeronith 2022-11-03 11:46:59 +03:30
rodzic 7c60829f88
commit a6b03d879f
10 zmienionych plików z 1461 dodań i 99 usunięć

Wyświetl plik

@ -415,6 +415,219 @@ func (x *ActivityPubActivity) GetPublished() string {
return ""
}
type ActivityPubPublicKey struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"`
Owner string `protobuf:"bytes,3,opt,name=owner,proto3" json:"owner,omitempty"`
PublicKeyPem string `protobuf:"bytes,4,opt,name=publicKeyPem,proto3" json:"publicKeyPem,omitempty"`
}
func (x *ActivityPubPublicKey) Reset() {
*x = ActivityPubPublicKey{}
if protoimpl.UnsafeEnabled {
mi := &file_objects_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ActivityPubPublicKey) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ActivityPubPublicKey) ProtoMessage() {}
func (x *ActivityPubPublicKey) ProtoReflect() protoreflect.Message {
mi := &file_objects_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ActivityPubPublicKey.ProtoReflect.Descriptor instead.
func (*ActivityPubPublicKey) Descriptor() ([]byte, []int) {
return file_objects_proto_rawDescGZIP(), []int{5}
}
func (x *ActivityPubPublicKey) GetId() string {
if x != nil {
return x.Id
}
return ""
}
func (x *ActivityPubPublicKey) GetOwner() string {
if x != nil {
return x.Owner
}
return ""
}
func (x *ActivityPubPublicKey) GetPublicKeyPem() string {
if x != nil {
return x.PublicKeyPem
}
return ""
}
type ActivityPubLink struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Href string `protobuf:"bytes,2,opt,name=href,proto3" json:"href,omitempty"`
Rel string `protobuf:"bytes,3,opt,name=rel,proto3" json:"rel,omitempty"`
Type string `protobuf:"bytes,4,opt,name=type,proto3" json:"type,omitempty"`
Template string `protobuf:"bytes,5,opt,name=template,proto3" json:"template,omitempty"`
}
func (x *ActivityPubLink) Reset() {
*x = ActivityPubLink{}
if protoimpl.UnsafeEnabled {
mi := &file_objects_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ActivityPubLink) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ActivityPubLink) ProtoMessage() {}
func (x *ActivityPubLink) ProtoReflect() protoreflect.Message {
mi := &file_objects_proto_msgTypes[6]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ActivityPubLink.ProtoReflect.Descriptor instead.
func (*ActivityPubLink) Descriptor() ([]byte, []int) {
return file_objects_proto_rawDescGZIP(), []int{6}
}
func (x *ActivityPubLink) GetHref() string {
if x != nil {
return x.Href
}
return ""
}
func (x *ActivityPubLink) GetRel() string {
if x != nil {
return x.Rel
}
return ""
}
func (x *ActivityPubLink) GetType() string {
if x != nil {
return x.Type
}
return ""
}
func (x *ActivityPubLink) GetTemplate() string {
if x != nil {
return x.Template
}
return ""
}
type ActivityPubMedia struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
MediaType string `protobuf:"bytes,2,opt,name=mediaType,proto3" json:"mediaType,omitempty"`
Type string `protobuf:"bytes,3,opt,name=type,proto3" json:"type,omitempty"`
Url string `protobuf:"bytes,4,opt,name=url,proto3" json:"url,omitempty"`
Width int32 `protobuf:"varint,5,opt,name=width,proto3" json:"width,omitempty"`
Height int32 `protobuf:"varint,6,opt,name=height,proto3" json:"height,omitempty"`
}
func (x *ActivityPubMedia) Reset() {
*x = ActivityPubMedia{}
if protoimpl.UnsafeEnabled {
mi := &file_objects_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ActivityPubMedia) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ActivityPubMedia) ProtoMessage() {}
func (x *ActivityPubMedia) ProtoReflect() protoreflect.Message {
mi := &file_objects_proto_msgTypes[7]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ActivityPubMedia.ProtoReflect.Descriptor instead.
func (*ActivityPubMedia) Descriptor() ([]byte, []int) {
return file_objects_proto_rawDescGZIP(), []int{7}
}
func (x *ActivityPubMedia) GetMediaType() string {
if x != nil {
return x.MediaType
}
return ""
}
func (x *ActivityPubMedia) GetType() string {
if x != nil {
return x.Type
}
return ""
}
func (x *ActivityPubMedia) GetUrl() string {
if x != nil {
return x.Url
}
return ""
}
func (x *ActivityPubMedia) GetWidth() int32 {
if x != nil {
return x.Width
}
return 0
}
func (x *ActivityPubMedia) GetHeight() int32 {
if x != nil {
return x.Height
}
return 0
}
var File_objects_proto protoreflect.FileDescriptor
var file_objects_proto_rawDesc = []byte{
@ -462,8 +675,29 @@ var file_objects_proto_rawDesc = []byte{
0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07,
0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69,
0x73, 0x68, 0x65, 0x64, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x75, 0x62, 0x6c,
0x69, 0x73, 0x68, 0x65, 0x64, 0x42, 0x04, 0x5a, 0x02, 0x2e, 0x2f, 0x62, 0x06, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x33,
0x69, 0x73, 0x68, 0x65, 0x64, 0x22, 0x60, 0x0a, 0x14, 0x41, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74,
0x79, 0x50, 0x75, 0x62, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x0e, 0x0a,
0x02, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a,
0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6f, 0x77,
0x6e, 0x65, 0x72, 0x12, 0x22, 0x0a, 0x0c, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79,
0x50, 0x65, 0x6d, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x70, 0x75, 0x62, 0x6c, 0x69,
0x63, 0x4b, 0x65, 0x79, 0x50, 0x65, 0x6d, 0x22, 0x67, 0x0a, 0x0f, 0x41, 0x63, 0x74, 0x69, 0x76,
0x69, 0x74, 0x79, 0x50, 0x75, 0x62, 0x4c, 0x69, 0x6e, 0x6b, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x72,
0x65, 0x66, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x72, 0x65, 0x66, 0x12, 0x10,
0x0a, 0x03, 0x72, 0x65, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x72, 0x65, 0x6c,
0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04,
0x74, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65,
0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65,
0x22, 0x84, 0x01, 0x0a, 0x10, 0x41, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x50, 0x75, 0x62,
0x4d, 0x65, 0x64, 0x69, 0x61, 0x12, 0x1c, 0x0a, 0x09, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x54, 0x79,
0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x54,
0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28,
0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x04,
0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x77, 0x69, 0x64,
0x74, 0x68, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x77, 0x69, 0x64, 0x74, 0x68, 0x12,
0x16, 0x0a, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52,
0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x42, 0x04, 0x5a, 0x02, 0x2e, 0x2f, 0x62, 0x06, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@ -478,13 +712,16 @@ func file_objects_proto_rawDescGZIP() []byte {
return file_objects_proto_rawDescData
}
var file_objects_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
var file_objects_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
var file_objects_proto_goTypes = []interface{}{
(*Error)(nil), // 0: protobuf.Error
(*Document)(nil), // 1: protobuf.Document
(*User)(nil), // 2: protobuf.User
(*ActivityPubObject)(nil), // 3: protobuf.ActivityPubObject
(*ActivityPubActivity)(nil), // 4: protobuf.ActivityPubActivity
(*Error)(nil), // 0: protobuf.Error
(*Document)(nil), // 1: protobuf.Document
(*User)(nil), // 2: protobuf.User
(*ActivityPubObject)(nil), // 3: protobuf.ActivityPubObject
(*ActivityPubActivity)(nil), // 4: protobuf.ActivityPubActivity
(*ActivityPubPublicKey)(nil), // 5: protobuf.ActivityPubPublicKey
(*ActivityPubLink)(nil), // 6: protobuf.ActivityPubLink
(*ActivityPubMedia)(nil), // 7: protobuf.ActivityPubMedia
}
var file_objects_proto_depIdxs = []int32{
3, // 0: protobuf.ActivityPubActivity.object:type_name -> protobuf.ActivityPubObject
@ -561,6 +798,42 @@ func file_objects_proto_init() {
return nil
}
}
file_objects_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ActivityPubPublicKey); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_objects_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ActivityPubLink); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_objects_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ActivityPubMedia); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
@ -568,7 +841,7 @@ func file_objects_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_objects_proto_rawDesc,
NumEnums: 0,
NumMessages: 5,
NumMessages: 8,
NumExtensions: 0,
NumServices: 0,
},

Wyświetl plik

@ -43,3 +43,24 @@ message ActivityPubActivity {
string content = 0x0000000A;
string published = 0x0000000B;
}
message ActivityPubPublicKey {
string id = 0x00000002;
string owner = 0x00000003;
string publicKeyPem = 0x00000004;
}
message ActivityPubLink {
string href = 0x00000002;
string rel = 0x00000003;
string type = 0x00000004;
string template = 0x00000005;
}
message ActivityPubMedia {
string mediaType = 0x00000002;
string type = 0x00000003;
string url = 0x00000004;
int32 width = 0x00000005;
int32 height = 0x00000006;
}

Wyświetl plik

@ -8,36 +8,42 @@ const ENABLE_CUSTOM_ERRORS = true
// noinspection GoSnakeCaseUsage
const (
// SYSTEM_ERRORS
ERROR_MESSAGE_INITIALIZE = "ERROR_MESSAGE_INITIALIZE"
ERROR_MESSAGE_NOT_IMPLEMENTED = "ERROR_MESSAGE_NOT_IMPLEMENTED"
ERROR_MESSAGE_OPERATION_FAILED = "ERROR_MESSAGE_OPERATION_FAILED"
ERROR_MESSAGE_OPERATION_NOT_SUPPORTED = "ERROR_MESSAGE_OPERATION_NOT_SUPPORTED"
ERROR_MESSAGE_UNRESOLVED_DEPENDENCIES = "ERROR_MESSAGE_UNRESOLVED_DEPENDENCIES"
ERROR_MESSAGE_SYSTEM_COMPONENT_NOT_FOUND = "ERROR_MESSAGE_SYSTEM_COMPONENT_NOT_FOUND"
ERROR_MESSAGE_DOCUMENT_NOT_FOUND = "ERROR_MESSAGE_DOCUMENT_NOT_FOUND"
ERROR_MESSAGE_SYSTEM_SCHEDULE_NOT_FOUND = "ERROR_MESSAGE_SYSTEM_SCHEDULE_NOT_FOUND"
ERROR_MESSAGE_IDENTITY_NOT_FOUND = "ERROR_MESSAGE_IDENTITY_NOT_FOUND"
ERROR_MESSAGE_ACCESS_CONTROL_NOT_FOUND = "ERROR_MESSAGE_ACCESS_CONTROL_NOT_FOUND"
ERROR_MESSAGE_REMOTE_ACTIVITY_NOT_FOUND = "ERROR_MESSAGE_REMOTE_ACTIVITY_NOT_FOUND"
ERROR_MESSAGE_CATEGORY_TYPE_NOT_FOUND = "ERROR_MESSAGE_CATEGORY_TYPE_NOT_FOUND"
ERROR_MESSAGE_CATEGORY_NOT_FOUND = "ERROR_MESSAGE_CATEGORY_NOT_FOUND"
ERROR_MESSAGE_USER_NOT_FOUND = "ERROR_MESSAGE_USER_NOT_FOUND"
ERROR_MESSAGE_ACTIVITY_PUB_OBJECT_NOT_FOUND = "ERROR_MESSAGE_ACTIVITY_PUB_OBJECT_NOT_FOUND"
ERROR_MESSAGE_ACTIVITY_PUB_ACTIVITY_NOT_FOUND = "ERROR_MESSAGE_ACTIVITY_PUB_ACTIVITY_NOT_FOUND"
ERROR_MESSAGE_SPI_NOT_FOUND = "ERROR_MESSAGE_SPI_NOT_FOUND"
ERROR_MESSAGE_UNKNOWN_DOCUMENT = "ERROR_MESSAGE_UNKNOWN_DOCUMENT"
ERROR_MESSAGE_UNKNOWN_SYSTEM_SCHEDULE = "ERROR_MESSAGE_UNKNOWN_SYSTEM_SCHEDULE"
ERROR_MESSAGE_UNKNOWN_IDENTITY = "ERROR_MESSAGE_UNKNOWN_IDENTITY"
ERROR_MESSAGE_UNKNOWN_ACCESS_CONTROL = "ERROR_MESSAGE_UNKNOWN_ACCESS_CONTROL"
ERROR_MESSAGE_UNKNOWN_REMOTE_ACTIVITY = "ERROR_MESSAGE_UNKNOWN_REMOTE_ACTIVITY"
ERROR_MESSAGE_UNKNOWN_CATEGORY_TYPE = "ERROR_MESSAGE_UNKNOWN_CATEGORY_TYPE"
ERROR_MESSAGE_UNKNOWN_CATEGORY = "ERROR_MESSAGE_UNKNOWN_CATEGORY"
ERROR_MESSAGE_UNKNOWN_USER = "ERROR_MESSAGE_UNKNOWN_USER"
ERROR_MESSAGE_UNKNOWN_ACTIVITY_PUB_OBJECT = "ERROR_MESSAGE_UNKNOWN_ACTIVITY_PUB_OBJECT"
ERROR_MESSAGE_UNKNOWN_ACTIVITY_PUB_ACTIVITY = "ERROR_MESSAGE_UNKNOWN_ACTIVITY_PUB_ACTIVITY"
ERROR_MESSAGE_UNKNOWN_SPI = "ERROR_MESSAGE_UNKNOWN_SPI"
ERROR_MESSAGE_INVALID_ID = "ERROR_MESSAGE_INVALID_ID"
ERROR_MESSAGE_INVALID_PARAMETERS = "ERROR_MESSAGE_INVALID_PARAMETERS"
ERROR_MESSAGE_INITIALIZE = "ERROR_MESSAGE_INITIALIZE"
ERROR_MESSAGE_NOT_IMPLEMENTED = "ERROR_MESSAGE_NOT_IMPLEMENTED"
ERROR_MESSAGE_OPERATION_FAILED = "ERROR_MESSAGE_OPERATION_FAILED"
ERROR_MESSAGE_OPERATION_NOT_SUPPORTED = "ERROR_MESSAGE_OPERATION_NOT_SUPPORTED"
ERROR_MESSAGE_UNRESOLVED_DEPENDENCIES = "ERROR_MESSAGE_UNRESOLVED_DEPENDENCIES"
ERROR_MESSAGE_SYSTEM_COMPONENT_NOT_FOUND = "ERROR_MESSAGE_SYSTEM_COMPONENT_NOT_FOUND"
ERROR_MESSAGE_DOCUMENT_NOT_FOUND = "ERROR_MESSAGE_DOCUMENT_NOT_FOUND"
ERROR_MESSAGE_SYSTEM_SCHEDULE_NOT_FOUND = "ERROR_MESSAGE_SYSTEM_SCHEDULE_NOT_FOUND"
ERROR_MESSAGE_IDENTITY_NOT_FOUND = "ERROR_MESSAGE_IDENTITY_NOT_FOUND"
ERROR_MESSAGE_ACCESS_CONTROL_NOT_FOUND = "ERROR_MESSAGE_ACCESS_CONTROL_NOT_FOUND"
ERROR_MESSAGE_REMOTE_ACTIVITY_NOT_FOUND = "ERROR_MESSAGE_REMOTE_ACTIVITY_NOT_FOUND"
ERROR_MESSAGE_CATEGORY_TYPE_NOT_FOUND = "ERROR_MESSAGE_CATEGORY_TYPE_NOT_FOUND"
ERROR_MESSAGE_CATEGORY_NOT_FOUND = "ERROR_MESSAGE_CATEGORY_NOT_FOUND"
ERROR_MESSAGE_USER_NOT_FOUND = "ERROR_MESSAGE_USER_NOT_FOUND"
ERROR_MESSAGE_ACTIVITY_PUB_OBJECT_NOT_FOUND = "ERROR_MESSAGE_ACTIVITY_PUB_OBJECT_NOT_FOUND"
ERROR_MESSAGE_ACTIVITY_PUB_ACTIVITY_NOT_FOUND = "ERROR_MESSAGE_ACTIVITY_PUB_ACTIVITY_NOT_FOUND"
ERROR_MESSAGE_ACTIVITY_PUB_PUBLIC_KEY_NOT_FOUND = "ERROR_MESSAGE_ACTIVITY_PUB_PUBLIC_KEY_NOT_FOUND"
ERROR_MESSAGE_ACTIVITY_PUB_LINK_NOT_FOUND = "ERROR_MESSAGE_ACTIVITY_PUB_LINK_NOT_FOUND"
ERROR_MESSAGE_ACTIVITY_PUB_MEDIA_NOT_FOUND = "ERROR_MESSAGE_ACTIVITY_PUB_MEDIA_NOT_FOUND"
ERROR_MESSAGE_SPI_NOT_FOUND = "ERROR_MESSAGE_SPI_NOT_FOUND"
ERROR_MESSAGE_UNKNOWN_DOCUMENT = "ERROR_MESSAGE_UNKNOWN_DOCUMENT"
ERROR_MESSAGE_UNKNOWN_SYSTEM_SCHEDULE = "ERROR_MESSAGE_UNKNOWN_SYSTEM_SCHEDULE"
ERROR_MESSAGE_UNKNOWN_IDENTITY = "ERROR_MESSAGE_UNKNOWN_IDENTITY"
ERROR_MESSAGE_UNKNOWN_ACCESS_CONTROL = "ERROR_MESSAGE_UNKNOWN_ACCESS_CONTROL"
ERROR_MESSAGE_UNKNOWN_REMOTE_ACTIVITY = "ERROR_MESSAGE_UNKNOWN_REMOTE_ACTIVITY"
ERROR_MESSAGE_UNKNOWN_CATEGORY_TYPE = "ERROR_MESSAGE_UNKNOWN_CATEGORY_TYPE"
ERROR_MESSAGE_UNKNOWN_CATEGORY = "ERROR_MESSAGE_UNKNOWN_CATEGORY"
ERROR_MESSAGE_UNKNOWN_USER = "ERROR_MESSAGE_UNKNOWN_USER"
ERROR_MESSAGE_UNKNOWN_ACTIVITY_PUB_OBJECT = "ERROR_MESSAGE_UNKNOWN_ACTIVITY_PUB_OBJECT"
ERROR_MESSAGE_UNKNOWN_ACTIVITY_PUB_ACTIVITY = "ERROR_MESSAGE_UNKNOWN_ACTIVITY_PUB_ACTIVITY"
ERROR_MESSAGE_UNKNOWN_ACTIVITY_PUB_PUBLIC_KEY = "ERROR_MESSAGE_UNKNOWN_ACTIVITY_PUB_PUBLIC_KEY"
ERROR_MESSAGE_UNKNOWN_ACTIVITY_PUB_LINK = "ERROR_MESSAGE_UNKNOWN_ACTIVITY_PUB_LINK"
ERROR_MESSAGE_UNKNOWN_ACTIVITY_PUB_MEDIA = "ERROR_MESSAGE_UNKNOWN_ACTIVITY_PUB_MEDIA"
ERROR_MESSAGE_UNKNOWN_SPI = "ERROR_MESSAGE_UNKNOWN_SPI"
ERROR_MESSAGE_INVALID_ID = "ERROR_MESSAGE_INVALID_ID"
ERROR_MESSAGE_INVALID_PARAMETERS = "ERROR_MESSAGE_INVALID_PARAMETERS"
// CUSTOM_ERRORS
ERROR_MESSAGE_DATA_INTEGRITY_VIOLATION = "ERROR_MESSAGE_DATA_INTEGRITY_VIOLATION"
ERROR_MESSAGE_INVALID_STATE = "ERROR_MESSAGE_INVALID_STATE"
@ -55,36 +61,42 @@ const (
// noinspection GoSnakeCaseUsage,GoUnusedGlobalVariable
var (
// SYSTEM_ERRORS
ERROR_INITIALIZE = errors.New(ERROR_MESSAGE_INITIALIZE)
ERROR_NOT_IMPLEMENTED = errors.New(ERROR_MESSAGE_NOT_IMPLEMENTED)
ERROR_OPERATION_FAILED = errors.New(ERROR_MESSAGE_OPERATION_FAILED)
ERROR_OPERATION_NOT_SUPPORTED = errors.New(ERROR_MESSAGE_OPERATION_NOT_SUPPORTED)
ERROR_UNRESOLVED_DEPENDENCIES = errors.New(ERROR_MESSAGE_UNRESOLVED_DEPENDENCIES)
ERROR_SYSTEM_COMPONENT_NOT_FOUND = errors.New(ERROR_MESSAGE_SYSTEM_COMPONENT_NOT_FOUND)
ERROR_DOCUMENT_NOT_FOUND = errors.New(ERROR_MESSAGE_DOCUMENT_NOT_FOUND)
ERROR_SYSTEM_SCHEDULE_NOT_FOUND = errors.New(ERROR_MESSAGE_SYSTEM_SCHEDULE_NOT_FOUND)
ERROR_IDENTITY_NOT_FOUND = errors.New(ERROR_MESSAGE_IDENTITY_NOT_FOUND)
ERROR_ACCESS_CONTROL_NOT_FOUND = errors.New(ERROR_MESSAGE_ACCESS_CONTROL_NOT_FOUND)
ERROR_REMOTE_ACTIVITY_NOT_FOUND = errors.New(ERROR_MESSAGE_REMOTE_ACTIVITY_NOT_FOUND)
ERROR_CATEGORY_TYPE_NOT_FOUND = errors.New(ERROR_MESSAGE_CATEGORY_TYPE_NOT_FOUND)
ERROR_CATEGORY_NOT_FOUND = errors.New(ERROR_MESSAGE_CATEGORY_NOT_FOUND)
ERROR_USER_NOT_FOUND = errors.New(ERROR_MESSAGE_USER_NOT_FOUND)
ERROR_ACTIVITY_PUB_OBJECT_NOT_FOUND = errors.New(ERROR_MESSAGE_ACTIVITY_PUB_OBJECT_NOT_FOUND)
ERROR_ACTIVITY_PUB_ACTIVITY_NOT_FOUND = errors.New(ERROR_MESSAGE_ACTIVITY_PUB_ACTIVITY_NOT_FOUND)
ERROR_SPI_NOT_FOUND = errors.New(ERROR_MESSAGE_SPI_NOT_FOUND)
ERROR_UNKNOWN_DOCUMENT = errors.New(ERROR_MESSAGE_UNKNOWN_DOCUMENT)
ERROR_UNKNOWN_SYSTEM_SCHEDULE = errors.New(ERROR_MESSAGE_UNKNOWN_SYSTEM_SCHEDULE)
ERROR_UNKNOWN_IDENTITY = errors.New(ERROR_MESSAGE_UNKNOWN_IDENTITY)
ERROR_UNKNOWN_ACCESS_CONTROL = errors.New(ERROR_MESSAGE_UNKNOWN_ACCESS_CONTROL)
ERROR_UNKNOWN_REMOTE_ACTIVITY = errors.New(ERROR_MESSAGE_UNKNOWN_REMOTE_ACTIVITY)
ERROR_UNKNOWN_CATEGORY_TYPE = errors.New(ERROR_MESSAGE_UNKNOWN_CATEGORY_TYPE)
ERROR_UNKNOWN_CATEGORY = errors.New(ERROR_MESSAGE_UNKNOWN_CATEGORY)
ERROR_UNKNOWN_USER = errors.New(ERROR_MESSAGE_UNKNOWN_USER)
ERROR_UNKNOWN_ACTIVITY_PUB_OBJECT = errors.New(ERROR_MESSAGE_UNKNOWN_ACTIVITY_PUB_OBJECT)
ERROR_UNKNOWN_ACTIVITY_PUB_ACTIVITY = errors.New(ERROR_MESSAGE_UNKNOWN_ACTIVITY_PUB_ACTIVITY)
ERROR_UNKNOWN_SPI = errors.New(ERROR_MESSAGE_UNKNOWN_SPI)
ERROR_INVALID_ID = errors.New(ERROR_MESSAGE_INVALID_ID)
ERROR_INVALID_PARAMETERS = errors.New(ERROR_MESSAGE_INVALID_PARAMETERS)
ERROR_INITIALIZE = errors.New(ERROR_MESSAGE_INITIALIZE)
ERROR_NOT_IMPLEMENTED = errors.New(ERROR_MESSAGE_NOT_IMPLEMENTED)
ERROR_OPERATION_FAILED = errors.New(ERROR_MESSAGE_OPERATION_FAILED)
ERROR_OPERATION_NOT_SUPPORTED = errors.New(ERROR_MESSAGE_OPERATION_NOT_SUPPORTED)
ERROR_UNRESOLVED_DEPENDENCIES = errors.New(ERROR_MESSAGE_UNRESOLVED_DEPENDENCIES)
ERROR_SYSTEM_COMPONENT_NOT_FOUND = errors.New(ERROR_MESSAGE_SYSTEM_COMPONENT_NOT_FOUND)
ERROR_DOCUMENT_NOT_FOUND = errors.New(ERROR_MESSAGE_DOCUMENT_NOT_FOUND)
ERROR_SYSTEM_SCHEDULE_NOT_FOUND = errors.New(ERROR_MESSAGE_SYSTEM_SCHEDULE_NOT_FOUND)
ERROR_IDENTITY_NOT_FOUND = errors.New(ERROR_MESSAGE_IDENTITY_NOT_FOUND)
ERROR_ACCESS_CONTROL_NOT_FOUND = errors.New(ERROR_MESSAGE_ACCESS_CONTROL_NOT_FOUND)
ERROR_REMOTE_ACTIVITY_NOT_FOUND = errors.New(ERROR_MESSAGE_REMOTE_ACTIVITY_NOT_FOUND)
ERROR_CATEGORY_TYPE_NOT_FOUND = errors.New(ERROR_MESSAGE_CATEGORY_TYPE_NOT_FOUND)
ERROR_CATEGORY_NOT_FOUND = errors.New(ERROR_MESSAGE_CATEGORY_NOT_FOUND)
ERROR_USER_NOT_FOUND = errors.New(ERROR_MESSAGE_USER_NOT_FOUND)
ERROR_ACTIVITY_PUB_OBJECT_NOT_FOUND = errors.New(ERROR_MESSAGE_ACTIVITY_PUB_OBJECT_NOT_FOUND)
ERROR_ACTIVITY_PUB_ACTIVITY_NOT_FOUND = errors.New(ERROR_MESSAGE_ACTIVITY_PUB_ACTIVITY_NOT_FOUND)
ERROR_ACTIVITY_PUB_PUBLIC_KEY_NOT_FOUND = errors.New(ERROR_MESSAGE_ACTIVITY_PUB_PUBLIC_KEY_NOT_FOUND)
ERROR_ACTIVITY_PUB_LINK_NOT_FOUND = errors.New(ERROR_MESSAGE_ACTIVITY_PUB_LINK_NOT_FOUND)
ERROR_ACTIVITY_PUB_MEDIA_NOT_FOUND = errors.New(ERROR_MESSAGE_ACTIVITY_PUB_MEDIA_NOT_FOUND)
ERROR_SPI_NOT_FOUND = errors.New(ERROR_MESSAGE_SPI_NOT_FOUND)
ERROR_UNKNOWN_DOCUMENT = errors.New(ERROR_MESSAGE_UNKNOWN_DOCUMENT)
ERROR_UNKNOWN_SYSTEM_SCHEDULE = errors.New(ERROR_MESSAGE_UNKNOWN_SYSTEM_SCHEDULE)
ERROR_UNKNOWN_IDENTITY = errors.New(ERROR_MESSAGE_UNKNOWN_IDENTITY)
ERROR_UNKNOWN_ACCESS_CONTROL = errors.New(ERROR_MESSAGE_UNKNOWN_ACCESS_CONTROL)
ERROR_UNKNOWN_REMOTE_ACTIVITY = errors.New(ERROR_MESSAGE_UNKNOWN_REMOTE_ACTIVITY)
ERROR_UNKNOWN_CATEGORY_TYPE = errors.New(ERROR_MESSAGE_UNKNOWN_CATEGORY_TYPE)
ERROR_UNKNOWN_CATEGORY = errors.New(ERROR_MESSAGE_UNKNOWN_CATEGORY)
ERROR_UNKNOWN_USER = errors.New(ERROR_MESSAGE_UNKNOWN_USER)
ERROR_UNKNOWN_ACTIVITY_PUB_OBJECT = errors.New(ERROR_MESSAGE_UNKNOWN_ACTIVITY_PUB_OBJECT)
ERROR_UNKNOWN_ACTIVITY_PUB_ACTIVITY = errors.New(ERROR_MESSAGE_UNKNOWN_ACTIVITY_PUB_ACTIVITY)
ERROR_UNKNOWN_ACTIVITY_PUB_PUBLIC_KEY = errors.New(ERROR_MESSAGE_UNKNOWN_ACTIVITY_PUB_PUBLIC_KEY)
ERROR_UNKNOWN_ACTIVITY_PUB_LINK = errors.New(ERROR_MESSAGE_UNKNOWN_ACTIVITY_PUB_LINK)
ERROR_UNKNOWN_ACTIVITY_PUB_MEDIA = errors.New(ERROR_MESSAGE_UNKNOWN_ACTIVITY_PUB_MEDIA)
ERROR_UNKNOWN_SPI = errors.New(ERROR_MESSAGE_UNKNOWN_SPI)
ERROR_INVALID_ID = errors.New(ERROR_MESSAGE_INVALID_ID)
ERROR_INVALID_PARAMETERS = errors.New(ERROR_MESSAGE_INVALID_PARAMETERS)
// CUSTOM_ERRORS
ERROR_DATA_INTEGRITY_VIOLATION = errors.New(ERROR_MESSAGE_DATA_INTEGRITY_VIOLATION)
ERROR_INVALID_STATE = errors.New(ERROR_MESSAGE_INVALID_STATE)

Wyświetl plik

@ -5,36 +5,42 @@ import . "github.com/xeronith/diamante/contracts/localization"
// noinspection GoUnusedGlobalVariable
var Errors = Resource{
// SYSTEM_ERRORS
ERROR_MESSAGE_INITIALIZE: "initialize",
ERROR_MESSAGE_NOT_IMPLEMENTED: "not_implemented",
ERROR_MESSAGE_OPERATION_FAILED: "operation_failed",
ERROR_MESSAGE_OPERATION_NOT_SUPPORTED: "operation_not_supported",
ERROR_MESSAGE_UNRESOLVED_DEPENDENCIES: "unresolved_dependencies",
ERROR_MESSAGE_SYSTEM_COMPONENT_NOT_FOUND: "system_component_not_found",
ERROR_MESSAGE_DOCUMENT_NOT_FOUND: "document_not_found",
ERROR_MESSAGE_SYSTEM_SCHEDULE_NOT_FOUND: "system_schedule_not_found",
ERROR_MESSAGE_IDENTITY_NOT_FOUND: "identity_not_found",
ERROR_MESSAGE_ACCESS_CONTROL_NOT_FOUND: "access_control_not_found",
ERROR_MESSAGE_REMOTE_ACTIVITY_NOT_FOUND: "remote_activity_not_found",
ERROR_MESSAGE_CATEGORY_TYPE_NOT_FOUND: "category_type_not_found",
ERROR_MESSAGE_CATEGORY_NOT_FOUND: "category_not_found",
ERROR_MESSAGE_USER_NOT_FOUND: "user_not_found",
ERROR_MESSAGE_ACTIVITY_PUB_OBJECT_NOT_FOUND: "activity_pub_object_not_found",
ERROR_MESSAGE_ACTIVITY_PUB_ACTIVITY_NOT_FOUND: "activity_pub_activity_not_found",
ERROR_MESSAGE_SPI_NOT_FOUND: "spi_not_found",
ERROR_MESSAGE_UNKNOWN_DOCUMENT: "unknown_document",
ERROR_MESSAGE_UNKNOWN_SYSTEM_SCHEDULE: "unknown_system_schedule",
ERROR_MESSAGE_UNKNOWN_IDENTITY: "unknown_identity",
ERROR_MESSAGE_UNKNOWN_ACCESS_CONTROL: "unknown_access_control",
ERROR_MESSAGE_UNKNOWN_REMOTE_ACTIVITY: "unknown_remote_activity",
ERROR_MESSAGE_UNKNOWN_CATEGORY_TYPE: "unknown_category_type",
ERROR_MESSAGE_UNKNOWN_CATEGORY: "unknown_category",
ERROR_MESSAGE_UNKNOWN_USER: "unknown_user",
ERROR_MESSAGE_UNKNOWN_ACTIVITY_PUB_OBJECT: "unknown_activity_pub_object",
ERROR_MESSAGE_UNKNOWN_ACTIVITY_PUB_ACTIVITY: "unknown_activity_pub_activity",
ERROR_MESSAGE_UNKNOWN_SPI: "unknown_spi",
ERROR_MESSAGE_INVALID_ID: "invalid_id",
ERROR_MESSAGE_INVALID_PARAMETERS: "invalid_parameters",
ERROR_MESSAGE_INITIALIZE: "initialize",
ERROR_MESSAGE_NOT_IMPLEMENTED: "not_implemented",
ERROR_MESSAGE_OPERATION_FAILED: "operation_failed",
ERROR_MESSAGE_OPERATION_NOT_SUPPORTED: "operation_not_supported",
ERROR_MESSAGE_UNRESOLVED_DEPENDENCIES: "unresolved_dependencies",
ERROR_MESSAGE_SYSTEM_COMPONENT_NOT_FOUND: "system_component_not_found",
ERROR_MESSAGE_DOCUMENT_NOT_FOUND: "document_not_found",
ERROR_MESSAGE_SYSTEM_SCHEDULE_NOT_FOUND: "system_schedule_not_found",
ERROR_MESSAGE_IDENTITY_NOT_FOUND: "identity_not_found",
ERROR_MESSAGE_ACCESS_CONTROL_NOT_FOUND: "access_control_not_found",
ERROR_MESSAGE_REMOTE_ACTIVITY_NOT_FOUND: "remote_activity_not_found",
ERROR_MESSAGE_CATEGORY_TYPE_NOT_FOUND: "category_type_not_found",
ERROR_MESSAGE_CATEGORY_NOT_FOUND: "category_not_found",
ERROR_MESSAGE_USER_NOT_FOUND: "user_not_found",
ERROR_MESSAGE_ACTIVITY_PUB_OBJECT_NOT_FOUND: "activity_pub_object_not_found",
ERROR_MESSAGE_ACTIVITY_PUB_ACTIVITY_NOT_FOUND: "activity_pub_activity_not_found",
ERROR_MESSAGE_ACTIVITY_PUB_PUBLIC_KEY_NOT_FOUND: "activity_pub_public_key_not_found",
ERROR_MESSAGE_ACTIVITY_PUB_LINK_NOT_FOUND: "activity_pub_link_not_found",
ERROR_MESSAGE_ACTIVITY_PUB_MEDIA_NOT_FOUND: "activity_pub_media_not_found",
ERROR_MESSAGE_SPI_NOT_FOUND: "spi_not_found",
ERROR_MESSAGE_UNKNOWN_DOCUMENT: "unknown_document",
ERROR_MESSAGE_UNKNOWN_SYSTEM_SCHEDULE: "unknown_system_schedule",
ERROR_MESSAGE_UNKNOWN_IDENTITY: "unknown_identity",
ERROR_MESSAGE_UNKNOWN_ACCESS_CONTROL: "unknown_access_control",
ERROR_MESSAGE_UNKNOWN_REMOTE_ACTIVITY: "unknown_remote_activity",
ERROR_MESSAGE_UNKNOWN_CATEGORY_TYPE: "unknown_category_type",
ERROR_MESSAGE_UNKNOWN_CATEGORY: "unknown_category",
ERROR_MESSAGE_UNKNOWN_USER: "unknown_user",
ERROR_MESSAGE_UNKNOWN_ACTIVITY_PUB_OBJECT: "unknown_activity_pub_object",
ERROR_MESSAGE_UNKNOWN_ACTIVITY_PUB_ACTIVITY: "unknown_activity_pub_activity",
ERROR_MESSAGE_UNKNOWN_ACTIVITY_PUB_PUBLIC_KEY: "unknown_activity_pub_public_key",
ERROR_MESSAGE_UNKNOWN_ACTIVITY_PUB_LINK: "unknown_activity_pub_link",
ERROR_MESSAGE_UNKNOWN_ACTIVITY_PUB_MEDIA: "unknown_activity_pub_media",
ERROR_MESSAGE_UNKNOWN_SPI: "unknown_spi",
ERROR_MESSAGE_INVALID_ID: "invalid_id",
ERROR_MESSAGE_INVALID_PARAMETERS: "invalid_parameters",
// CUSTOM_ERRORS
ERROR_MESSAGE_DATA_INTEGRITY_VIOLATION: "data_integrity_violation",
ERROR_MESSAGE_INVALID_STATE: "invalid_state",

Wyświetl plik

@ -0,0 +1,78 @@
package contracts
import . "github.com/xeronith/diamante/contracts/security"
var ActivityPubLinkPassThroughFilter = func(IActivityPubLink) bool { return true }
type (
ActivityPubLinks []IActivityPubLink
ActivityPubLinkIterator func(IActivityPubLink)
ActivityPubLinkCondition func(IActivityPubLink) bool
ActivityPubLinkFilterPredicate func(IActivityPubLink) bool
ActivityPubLinkMapPredicate func(IActivityPubLink) IActivityPubLink
ActivityPubLinkCacheCallback func()
IActivityPubLink interface {
// Href returns 'Href' of this 'ActivityPubLink' instance.
Href() string
// SetHref sets 'Href' in-memory value of this 'ActivityPubLink' instance.
// This doesn't affect the persistent data store.
SetHref(href string)
// Rel returns 'Rel' of this 'ActivityPubLink' instance.
Rel() string
// SetRel sets 'Rel' in-memory value of this 'ActivityPubLink' instance.
// This doesn't affect the persistent data store.
SetRel(rel string)
// Type returns 'Type' of this 'ActivityPubLink' instance.
Type() string
// SetType sets 'Type' in-memory value of this 'ActivityPubLink' instance.
// This doesn't affect the persistent data store.
SetType(type_ string)
// Template returns 'Template' of this 'ActivityPubLink' instance.
Template() string
// SetTemplate sets 'Template' in-memory value of this 'ActivityPubLink' instance.
// This doesn't affect the persistent data store.
SetTemplate(template string)
}
IActivityPubLinkCollection interface {
Count() int
IsEmpty() bool
IsNotEmpty() bool
HasExactlyOneItem() bool
HasAtLeastOneItem() bool
First() IActivityPubLink
Append(activityPubLink IActivityPubLink)
ForEach(ActivityPubLinkIterator)
Array() ActivityPubLinks
}
IActivityPubLinkManager interface {
ISystemComponent
OnCacheChanged(ActivityPubLinkCacheCallback)
Count() int
Exists(id int64) bool
ExistsWhich(condition ActivityPubLinkCondition) bool
ListActivityPubLinks(pageIndex uint32, pageSize uint32, criteria string, editor Identity) IActivityPubLinkCollection
GetActivityPubLink(id int64, editor Identity) (IActivityPubLink, error)
AddActivityPubLink(editor Identity) (IActivityPubLink, error)
AddActivityPubLinkWithCustomId(id int64, editor Identity) (IActivityPubLink, error)
AddActivityPubLinkObject(activityPubLink IActivityPubLink, editor Identity) (IActivityPubLink, error)
AddActivityPubLinkAtomic(transaction ITransaction, editor Identity) (IActivityPubLink, error)
AddActivityPubLinkWithCustomIdAtomic(id int64, transaction ITransaction, editor Identity) (IActivityPubLink, error)
AddActivityPubLinkObjectAtomic(transaction ITransaction, activityPubLink IActivityPubLink, editor Identity) (IActivityPubLink, error)
Log(source string, editor Identity, payload string)
UpdateActivityPubLink(id int64, editor Identity) (IActivityPubLink, error)
UpdateActivityPubLinkObject(id int64, activityPubLink IActivityPubLink, editor Identity) (IActivityPubLink, error)
UpdateActivityPubLinkAtomic(transaction ITransaction, id int64, editor Identity) (IActivityPubLink, error)
UpdateActivityPubLinkObjectAtomic(transaction ITransaction, id int64, activityPubLink IActivityPubLink, editor Identity) (IActivityPubLink, error)
AddOrUpdateActivityPubLinkObject(id int64, activityPubLink IActivityPubLink, editor Identity) (IActivityPubLink, error)
AddOrUpdateActivityPubLinkObjectAtomic(transaction ITransaction, id int64, activityPubLink IActivityPubLink, editor Identity) (IActivityPubLink, error)
RemoveActivityPubLink(id int64, editor Identity) (IActivityPubLink, error)
RemoveActivityPubLinkAtomic(transaction ITransaction, id int64, editor Identity) (IActivityPubLink, error)
Find(id int64) IActivityPubLink
ForEach(iterator ActivityPubLinkIterator)
Filter(predicate ActivityPubLinkFilterPredicate) IActivityPubLinkCollection
Map(predicate ActivityPubLinkMapPredicate) IActivityPubLinkCollection
}
)

Wyświetl plik

@ -0,0 +1,83 @@
package contracts
import . "github.com/xeronith/diamante/contracts/security"
var ActivityPubMediaPassThroughFilter = func(IActivityPubMedia) bool { return true }
type (
ActivityPubMedias []IActivityPubMedia
ActivityPubMediaIterator func(IActivityPubMedia)
ActivityPubMediaCondition func(IActivityPubMedia) bool
ActivityPubMediaFilterPredicate func(IActivityPubMedia) bool
ActivityPubMediaMapPredicate func(IActivityPubMedia) IActivityPubMedia
ActivityPubMediaCacheCallback func()
IActivityPubMedia interface {
// MediaType returns 'MediaType' of this 'ActivityPubMedia' instance.
MediaType() string
// SetMediaType sets 'MediaType' in-memory value of this 'ActivityPubMedia' instance.
// This doesn't affect the persistent data store.
SetMediaType(mediaType string)
// Type returns 'Type' of this 'ActivityPubMedia' instance.
Type() string
// SetType sets 'Type' in-memory value of this 'ActivityPubMedia' instance.
// This doesn't affect the persistent data store.
SetType(type_ string)
// Url returns 'Url' of this 'ActivityPubMedia' instance.
Url() string
// SetUrl sets 'Url' in-memory value of this 'ActivityPubMedia' instance.
// This doesn't affect the persistent data store.
SetUrl(url string)
// Width returns 'Width' of this 'ActivityPubMedia' instance.
Width() int32
// SetWidth sets 'Width' in-memory value of this 'ActivityPubMedia' instance.
// This doesn't affect the persistent data store.
SetWidth(width int32)
// Height returns 'Height' of this 'ActivityPubMedia' instance.
Height() int32
// SetHeight sets 'Height' in-memory value of this 'ActivityPubMedia' instance.
// This doesn't affect the persistent data store.
SetHeight(height int32)
}
IActivityPubMediaCollection interface {
Count() int
IsEmpty() bool
IsNotEmpty() bool
HasExactlyOneItem() bool
HasAtLeastOneItem() bool
First() IActivityPubMedia
Append(activityPubMedia IActivityPubMedia)
ForEach(ActivityPubMediaIterator)
Array() ActivityPubMedias
}
IActivityPubMediaManager interface {
ISystemComponent
OnCacheChanged(ActivityPubMediaCacheCallback)
Count() int
Exists(id int64) bool
ExistsWhich(condition ActivityPubMediaCondition) bool
ListActivityPubMedias(pageIndex uint32, pageSize uint32, criteria string, editor Identity) IActivityPubMediaCollection
GetActivityPubMedia(id int64, editor Identity) (IActivityPubMedia, error)
AddActivityPubMedia(editor Identity) (IActivityPubMedia, error)
AddActivityPubMediaWithCustomId(id int64, editor Identity) (IActivityPubMedia, error)
AddActivityPubMediaObject(activityPubMedia IActivityPubMedia, editor Identity) (IActivityPubMedia, error)
AddActivityPubMediaAtomic(transaction ITransaction, editor Identity) (IActivityPubMedia, error)
AddActivityPubMediaWithCustomIdAtomic(id int64, transaction ITransaction, editor Identity) (IActivityPubMedia, error)
AddActivityPubMediaObjectAtomic(transaction ITransaction, activityPubMedia IActivityPubMedia, editor Identity) (IActivityPubMedia, error)
Log(source string, editor Identity, payload string)
UpdateActivityPubMedia(id int64, editor Identity) (IActivityPubMedia, error)
UpdateActivityPubMediaObject(id int64, activityPubMedia IActivityPubMedia, editor Identity) (IActivityPubMedia, error)
UpdateActivityPubMediaAtomic(transaction ITransaction, id int64, editor Identity) (IActivityPubMedia, error)
UpdateActivityPubMediaObjectAtomic(transaction ITransaction, id int64, activityPubMedia IActivityPubMedia, editor Identity) (IActivityPubMedia, error)
AddOrUpdateActivityPubMediaObject(id int64, activityPubMedia IActivityPubMedia, editor Identity) (IActivityPubMedia, error)
AddOrUpdateActivityPubMediaObjectAtomic(transaction ITransaction, id int64, activityPubMedia IActivityPubMedia, editor Identity) (IActivityPubMedia, error)
RemoveActivityPubMedia(id int64, editor Identity) (IActivityPubMedia, error)
RemoveActivityPubMediaAtomic(transaction ITransaction, id int64, editor Identity) (IActivityPubMedia, error)
Find(id int64) IActivityPubMedia
ForEach(iterator ActivityPubMediaIterator)
Filter(predicate ActivityPubMediaFilterPredicate) IActivityPubMediaCollection
Map(predicate ActivityPubMediaMapPredicate) IActivityPubMediaCollection
}
)

Wyświetl plik

@ -0,0 +1,73 @@
package contracts
import . "github.com/xeronith/diamante/contracts/security"
var ActivityPubPublicKeyPassThroughFilter = func(IActivityPubPublicKey) bool { return true }
type (
ActivityPubPublicKeys []IActivityPubPublicKey
ActivityPubPublicKeyIterator func(IActivityPubPublicKey)
ActivityPubPublicKeyCondition func(IActivityPubPublicKey) bool
ActivityPubPublicKeyFilterPredicate func(IActivityPubPublicKey) bool
ActivityPubPublicKeyMapPredicate func(IActivityPubPublicKey) IActivityPubPublicKey
ActivityPubPublicKeyCacheCallback func()
IActivityPubPublicKey interface {
// Id returns 'Id' of this 'ActivityPubPublicKey' instance.
Id() string
// SetId sets 'Id' in-memory value of this 'ActivityPubPublicKey' instance.
// This doesn't affect the persistent data store.
SetId(id string)
// Owner returns 'Owner' of this 'ActivityPubPublicKey' instance.
Owner() string
// SetOwner sets 'Owner' in-memory value of this 'ActivityPubPublicKey' instance.
// This doesn't affect the persistent data store.
SetOwner(owner string)
// PublicKeyPem returns 'PublicKeyPem' of this 'ActivityPubPublicKey' instance.
PublicKeyPem() string
// SetPublicKeyPem sets 'PublicKeyPem' in-memory value of this 'ActivityPubPublicKey' instance.
// This doesn't affect the persistent data store.
SetPublicKeyPem(publicKeyPem string)
}
IActivityPubPublicKeyCollection interface {
Count() int
IsEmpty() bool
IsNotEmpty() bool
HasExactlyOneItem() bool
HasAtLeastOneItem() bool
First() IActivityPubPublicKey
Append(activityPubPublicKey IActivityPubPublicKey)
ForEach(ActivityPubPublicKeyIterator)
Array() ActivityPubPublicKeys
}
IActivityPubPublicKeyManager interface {
ISystemComponent
OnCacheChanged(ActivityPubPublicKeyCacheCallback)
Count() int
Exists(id int64) bool
ExistsWhich(condition ActivityPubPublicKeyCondition) bool
ListActivityPubPublicKeys(pageIndex uint32, pageSize uint32, criteria string, editor Identity) IActivityPubPublicKeyCollection
GetActivityPubPublicKey(id int64, editor Identity) (IActivityPubPublicKey, error)
AddActivityPubPublicKey(editor Identity) (IActivityPubPublicKey, error)
AddActivityPubPublicKeyWithCustomId(id int64, editor Identity) (IActivityPubPublicKey, error)
AddActivityPubPublicKeyObject(activityPubPublicKey IActivityPubPublicKey, editor Identity) (IActivityPubPublicKey, error)
AddActivityPubPublicKeyAtomic(transaction ITransaction, editor Identity) (IActivityPubPublicKey, error)
AddActivityPubPublicKeyWithCustomIdAtomic(id int64, transaction ITransaction, editor Identity) (IActivityPubPublicKey, error)
AddActivityPubPublicKeyObjectAtomic(transaction ITransaction, activityPubPublicKey IActivityPubPublicKey, editor Identity) (IActivityPubPublicKey, error)
Log(source string, editor Identity, payload string)
UpdateActivityPubPublicKey(id int64, editor Identity) (IActivityPubPublicKey, error)
UpdateActivityPubPublicKeyObject(id int64, activityPubPublicKey IActivityPubPublicKey, editor Identity) (IActivityPubPublicKey, error)
UpdateActivityPubPublicKeyAtomic(transaction ITransaction, id int64, editor Identity) (IActivityPubPublicKey, error)
UpdateActivityPubPublicKeyObjectAtomic(transaction ITransaction, id int64, activityPubPublicKey IActivityPubPublicKey, editor Identity) (IActivityPubPublicKey, error)
AddOrUpdateActivityPubPublicKeyObject(id int64, activityPubPublicKey IActivityPubPublicKey, editor Identity) (IActivityPubPublicKey, error)
AddOrUpdateActivityPubPublicKeyObjectAtomic(transaction ITransaction, id int64, activityPubPublicKey IActivityPubPublicKey, editor Identity) (IActivityPubPublicKey, error)
RemoveActivityPubPublicKey(id int64, editor Identity) (IActivityPubPublicKey, error)
RemoveActivityPubPublicKeyAtomic(transaction ITransaction, id int64, editor Identity) (IActivityPubPublicKey, error)
Find(id int64) IActivityPubPublicKey
ForEach(iterator ActivityPubPublicKeyIterator)
Filter(predicate ActivityPubPublicKeyFilterPredicate) IActivityPubPublicKeyCollection
Map(predicate ActivityPubPublicKeyMapPredicate) IActivityPubPublicKeyCollection
}
)

Wyświetl plik

@ -0,0 +1,272 @@
package core
import (
"fmt"
. "github.com/xeronith/diamante/contracts/security"
"rail.town/infrastructure/app/validators"
. "rail.town/infrastructure/components/constants"
. "rail.town/infrastructure/components/contracts"
"rail.town/infrastructure/components/model/repository"
)
type activityPubLink struct {
href string
rel string
type_ string
template string
}
// noinspection GoUnusedExportedFunction
func InitializeActivityPubLink() {
_ = ENABLE_SECURITY
_ = ENABLE_CUSTOM_ERRORS
_ = validators.Initialize
_ = repository.Initialize
}
func NewActivityPubLink() (IActivityPubLink, error) {
instance := &activityPubLink{}
if err := instance.Validate(); err != nil {
return nil, err
}
return instance, nil
}
func (activityPubLink *activityPubLink) Href() string {
return activityPubLink.href
}
func (activityPubLink *activityPubLink) SetHref(value string) {
activityPubLink.href = value
}
func (activityPubLink *activityPubLink) Rel() string {
return activityPubLink.rel
}
func (activityPubLink *activityPubLink) SetRel(value string) {
activityPubLink.rel = value
}
func (activityPubLink *activityPubLink) Type() string {
return activityPubLink.type_
}
func (activityPubLink *activityPubLink) SetType(value string) {
activityPubLink.type_ = value
}
func (activityPubLink *activityPubLink) Template() string {
return activityPubLink.template
}
func (activityPubLink *activityPubLink) SetTemplate(value string) {
activityPubLink.template = value
}
func (activityPubLink *activityPubLink) Validate() error {
return nil
}
func (activityPubLink *activityPubLink) String() string {
return fmt.Sprintf("ActivityPubLink (Id: %d)", 0)
}
//------------------------------------------------------------------------------
type activityPubLinks struct {
collection ActivityPubLinks
}
// NewActivityPubLinks creates an empty collection of 'Activity Pub Link' which is not thread-safe.
func NewActivityPubLinks() IActivityPubLinkCollection {
return &activityPubLinks{
collection: make(ActivityPubLinks, 0),
}
}
func (activityPubLinks *activityPubLinks) Count() int {
return len(activityPubLinks.collection)
}
func (activityPubLinks *activityPubLinks) IsEmpty() bool {
return len(activityPubLinks.collection) == 0
}
func (activityPubLinks *activityPubLinks) IsNotEmpty() bool {
return len(activityPubLinks.collection) > 0
}
func (activityPubLinks *activityPubLinks) HasExactlyOneItem() bool {
return len(activityPubLinks.collection) == 1
}
func (activityPubLinks *activityPubLinks) HasAtLeastOneItem() bool {
return len(activityPubLinks.collection) >= 1
}
func (activityPubLinks *activityPubLinks) First() IActivityPubLink {
return activityPubLinks.collection[0]
}
func (activityPubLinks *activityPubLinks) Append(activityPubLink IActivityPubLink) {
activityPubLinks.collection = append(activityPubLinks.collection, activityPubLink)
}
func (activityPubLinks *activityPubLinks) ForEach(iterator ActivityPubLinkIterator) {
if iterator == nil {
return
}
for _, value := range activityPubLinks.collection {
iterator(value)
}
}
func (activityPubLinks *activityPubLinks) Array() ActivityPubLinks {
return activityPubLinks.collection
}
//------------------------------------------------------------------------------
func (dispatcher *dispatcher) ActivityPubLinkExists(id int64) bool {
return dispatcher.conductor.ActivityPubLinkManager().Exists(id)
}
func (dispatcher *dispatcher) ActivityPubLinkExistsWhich(condition ActivityPubLinkCondition) bool {
return dispatcher.conductor.ActivityPubLinkManager().ExistsWhich(condition)
}
func (dispatcher *dispatcher) ListActivityPubLinks() IActivityPubLinkCollection {
return dispatcher.conductor.ActivityPubLinkManager().ListActivityPubLinks(0, 0, "", dispatcher.identity)
}
func (dispatcher *dispatcher) ForEachActivityPubLink(iterator ActivityPubLinkIterator) {
dispatcher.conductor.ActivityPubLinkManager().ForEach(iterator)
}
func (dispatcher *dispatcher) FilterActivityPubLinks(predicate ActivityPubLinkFilterPredicate) IActivityPubLinkCollection {
return dispatcher.conductor.ActivityPubLinkManager().Filter(predicate)
}
func (dispatcher *dispatcher) MapActivityPubLinks(predicate ActivityPubLinkMapPredicate) IActivityPubLinkCollection {
return dispatcher.conductor.ActivityPubLinkManager().Map(predicate)
}
func (dispatcher *dispatcher) GetActivityPubLink(id int64) IActivityPubLink {
if activityPubLink, err := dispatcher.conductor.ActivityPubLinkManager().GetActivityPubLink(id, dispatcher.identity); err != nil {
panic(err.Error())
} else {
return activityPubLink
}
}
func (dispatcher *dispatcher) AddActivityPubLink() IActivityPubLink {
transaction := dispatcher.transaction
if transaction != nil {
if activityPubLink, err := dispatcher.conductor.ActivityPubLinkManager().AddActivityPubLinkAtomic(transaction, dispatcher.identity); err != nil {
panic(err.Error())
} else {
return activityPubLink
}
} else {
if activityPubLink, err := dispatcher.conductor.ActivityPubLinkManager().AddActivityPubLink(dispatcher.identity); err != nil {
panic(err.Error())
} else {
return activityPubLink
}
}
}
func (dispatcher *dispatcher) AddActivityPubLinkWithCustomId(id int64) IActivityPubLink {
transaction := dispatcher.transaction
if transaction != nil {
if activityPubLink, err := dispatcher.conductor.ActivityPubLinkManager().AddActivityPubLinkWithCustomIdAtomic(id, transaction, dispatcher.identity); err != nil {
panic(err.Error())
} else {
return activityPubLink
}
} else {
if activityPubLink, err := dispatcher.conductor.ActivityPubLinkManager().AddActivityPubLinkWithCustomId(id, dispatcher.identity); err != nil {
panic(err.Error())
} else {
return activityPubLink
}
}
}
func (dispatcher *dispatcher) LogActivityPubLink(source string, payload string) {
dispatcher.conductor.ActivityPubLinkManager().Log(source, dispatcher.identity, payload)
}
func (dispatcher *dispatcher) UpdateActivityPubLink(id int64) IActivityPubLink {
transaction := dispatcher.transaction
if transaction != nil {
if activityPubLink, err := dispatcher.conductor.ActivityPubLinkManager().UpdateActivityPubLinkAtomic(transaction, id, dispatcher.identity); err != nil {
panic(err.Error())
} else {
return activityPubLink
}
} else {
if activityPubLink, err := dispatcher.conductor.ActivityPubLinkManager().UpdateActivityPubLink(id, dispatcher.identity); err != nil {
panic(err.Error())
} else {
return activityPubLink
}
}
}
// noinspection GoUnusedParameter
func (dispatcher *dispatcher) UpdateActivityPubLinkObject(object IObject, activityPubLink IActivityPubLink) IActivityPubLink {
transaction := dispatcher.transaction
if transaction != nil {
if activityPubLink, err := dispatcher.conductor.ActivityPubLinkManager().UpdateActivityPubLinkAtomic(transaction, object.Id(), dispatcher.identity); err != nil {
panic(err.Error())
} else {
return activityPubLink
}
} else {
if activityPubLink, err := dispatcher.conductor.ActivityPubLinkManager().UpdateActivityPubLink(object.Id(), dispatcher.identity); err != nil {
panic(err.Error())
} else {
return activityPubLink
}
}
}
func (dispatcher *dispatcher) AddOrUpdateActivityPubLinkObject(object IObject, activityPubLink IActivityPubLink) IActivityPubLink {
transaction := dispatcher.transaction
if transaction != nil {
if activityPubLink, err := dispatcher.conductor.ActivityPubLinkManager().AddOrUpdateActivityPubLinkObjectAtomic(transaction, object.Id(), activityPubLink, dispatcher.identity); err != nil {
panic(err.Error())
} else {
return activityPubLink
}
} else {
if activityPubLink, err := dispatcher.conductor.ActivityPubLinkManager().AddOrUpdateActivityPubLinkObject(object.Id(), activityPubLink, dispatcher.identity); err != nil {
panic(err.Error())
} else {
return activityPubLink
}
}
}
func (dispatcher *dispatcher) RemoveActivityPubLink(id int64) IActivityPubLink {
transaction := dispatcher.transaction
if transaction != nil {
if activityPubLink, err := dispatcher.conductor.ActivityPubLinkManager().RemoveActivityPubLinkAtomic(transaction, id, dispatcher.identity); err != nil {
panic(err.Error())
} else {
return activityPubLink
}
} else {
if activityPubLink, err := dispatcher.conductor.ActivityPubLinkManager().RemoveActivityPubLink(id, dispatcher.identity); err != nil {
panic(err.Error())
} else {
return activityPubLink
}
}
}

Wyświetl plik

@ -0,0 +1,281 @@
package core
import (
"fmt"
. "github.com/xeronith/diamante/contracts/security"
"rail.town/infrastructure/app/validators"
. "rail.town/infrastructure/components/constants"
. "rail.town/infrastructure/components/contracts"
"rail.town/infrastructure/components/model/repository"
)
type activityPubMedia struct {
mediaType string
type_ string
url string
width int32
height int32
}
// noinspection GoUnusedExportedFunction
func InitializeActivityPubMedia() {
_ = ENABLE_SECURITY
_ = ENABLE_CUSTOM_ERRORS
_ = validators.Initialize
_ = repository.Initialize
}
func NewActivityPubMedia() (IActivityPubMedia, error) {
instance := &activityPubMedia{}
if err := instance.Validate(); err != nil {
return nil, err
}
return instance, nil
}
func (activityPubMedia *activityPubMedia) MediaType() string {
return activityPubMedia.mediaType
}
func (activityPubMedia *activityPubMedia) SetMediaType(value string) {
activityPubMedia.mediaType = value
}
func (activityPubMedia *activityPubMedia) Type() string {
return activityPubMedia.type_
}
func (activityPubMedia *activityPubMedia) SetType(value string) {
activityPubMedia.type_ = value
}
func (activityPubMedia *activityPubMedia) Url() string {
return activityPubMedia.url
}
func (activityPubMedia *activityPubMedia) SetUrl(value string) {
activityPubMedia.url = value
}
func (activityPubMedia *activityPubMedia) Width() int32 {
return activityPubMedia.width
}
func (activityPubMedia *activityPubMedia) SetWidth(value int32) {
activityPubMedia.width = value
}
func (activityPubMedia *activityPubMedia) Height() int32 {
return activityPubMedia.height
}
func (activityPubMedia *activityPubMedia) SetHeight(value int32) {
activityPubMedia.height = value
}
func (activityPubMedia *activityPubMedia) Validate() error {
return nil
}
func (activityPubMedia *activityPubMedia) String() string {
return fmt.Sprintf("ActivityPubMedia (Id: %d)", 0)
}
//------------------------------------------------------------------------------
type activityPubMedias struct {
collection ActivityPubMedias
}
// NewActivityPubMedias creates an empty collection of 'Activity Pub Media' which is not thread-safe.
func NewActivityPubMedias() IActivityPubMediaCollection {
return &activityPubMedias{
collection: make(ActivityPubMedias, 0),
}
}
func (activityPubMedias *activityPubMedias) Count() int {
return len(activityPubMedias.collection)
}
func (activityPubMedias *activityPubMedias) IsEmpty() bool {
return len(activityPubMedias.collection) == 0
}
func (activityPubMedias *activityPubMedias) IsNotEmpty() bool {
return len(activityPubMedias.collection) > 0
}
func (activityPubMedias *activityPubMedias) HasExactlyOneItem() bool {
return len(activityPubMedias.collection) == 1
}
func (activityPubMedias *activityPubMedias) HasAtLeastOneItem() bool {
return len(activityPubMedias.collection) >= 1
}
func (activityPubMedias *activityPubMedias) First() IActivityPubMedia {
return activityPubMedias.collection[0]
}
func (activityPubMedias *activityPubMedias) Append(activityPubMedia IActivityPubMedia) {
activityPubMedias.collection = append(activityPubMedias.collection, activityPubMedia)
}
func (activityPubMedias *activityPubMedias) ForEach(iterator ActivityPubMediaIterator) {
if iterator == nil {
return
}
for _, value := range activityPubMedias.collection {
iterator(value)
}
}
func (activityPubMedias *activityPubMedias) Array() ActivityPubMedias {
return activityPubMedias.collection
}
//------------------------------------------------------------------------------
func (dispatcher *dispatcher) ActivityPubMediaExists(id int64) bool {
return dispatcher.conductor.ActivityPubMediaManager().Exists(id)
}
func (dispatcher *dispatcher) ActivityPubMediaExistsWhich(condition ActivityPubMediaCondition) bool {
return dispatcher.conductor.ActivityPubMediaManager().ExistsWhich(condition)
}
func (dispatcher *dispatcher) ListActivityPubMedias() IActivityPubMediaCollection {
return dispatcher.conductor.ActivityPubMediaManager().ListActivityPubMedias(0, 0, "", dispatcher.identity)
}
func (dispatcher *dispatcher) ForEachActivityPubMedia(iterator ActivityPubMediaIterator) {
dispatcher.conductor.ActivityPubMediaManager().ForEach(iterator)
}
func (dispatcher *dispatcher) FilterActivityPubMedias(predicate ActivityPubMediaFilterPredicate) IActivityPubMediaCollection {
return dispatcher.conductor.ActivityPubMediaManager().Filter(predicate)
}
func (dispatcher *dispatcher) MapActivityPubMedias(predicate ActivityPubMediaMapPredicate) IActivityPubMediaCollection {
return dispatcher.conductor.ActivityPubMediaManager().Map(predicate)
}
func (dispatcher *dispatcher) GetActivityPubMedia(id int64) IActivityPubMedia {
if activityPubMedia, err := dispatcher.conductor.ActivityPubMediaManager().GetActivityPubMedia(id, dispatcher.identity); err != nil {
panic(err.Error())
} else {
return activityPubMedia
}
}
func (dispatcher *dispatcher) AddActivityPubMedia() IActivityPubMedia {
transaction := dispatcher.transaction
if transaction != nil {
if activityPubMedia, err := dispatcher.conductor.ActivityPubMediaManager().AddActivityPubMediaAtomic(transaction, dispatcher.identity); err != nil {
panic(err.Error())
} else {
return activityPubMedia
}
} else {
if activityPubMedia, err := dispatcher.conductor.ActivityPubMediaManager().AddActivityPubMedia(dispatcher.identity); err != nil {
panic(err.Error())
} else {
return activityPubMedia
}
}
}
func (dispatcher *dispatcher) AddActivityPubMediaWithCustomId(id int64) IActivityPubMedia {
transaction := dispatcher.transaction
if transaction != nil {
if activityPubMedia, err := dispatcher.conductor.ActivityPubMediaManager().AddActivityPubMediaWithCustomIdAtomic(id, transaction, dispatcher.identity); err != nil {
panic(err.Error())
} else {
return activityPubMedia
}
} else {
if activityPubMedia, err := dispatcher.conductor.ActivityPubMediaManager().AddActivityPubMediaWithCustomId(id, dispatcher.identity); err != nil {
panic(err.Error())
} else {
return activityPubMedia
}
}
}
func (dispatcher *dispatcher) LogActivityPubMedia(source string, payload string) {
dispatcher.conductor.ActivityPubMediaManager().Log(source, dispatcher.identity, payload)
}
func (dispatcher *dispatcher) UpdateActivityPubMedia(id int64) IActivityPubMedia {
transaction := dispatcher.transaction
if transaction != nil {
if activityPubMedia, err := dispatcher.conductor.ActivityPubMediaManager().UpdateActivityPubMediaAtomic(transaction, id, dispatcher.identity); err != nil {
panic(err.Error())
} else {
return activityPubMedia
}
} else {
if activityPubMedia, err := dispatcher.conductor.ActivityPubMediaManager().UpdateActivityPubMedia(id, dispatcher.identity); err != nil {
panic(err.Error())
} else {
return activityPubMedia
}
}
}
// noinspection GoUnusedParameter
func (dispatcher *dispatcher) UpdateActivityPubMediaObject(object IObject, activityPubMedia IActivityPubMedia) IActivityPubMedia {
transaction := dispatcher.transaction
if transaction != nil {
if activityPubMedia, err := dispatcher.conductor.ActivityPubMediaManager().UpdateActivityPubMediaAtomic(transaction, object.Id(), dispatcher.identity); err != nil {
panic(err.Error())
} else {
return activityPubMedia
}
} else {
if activityPubMedia, err := dispatcher.conductor.ActivityPubMediaManager().UpdateActivityPubMedia(object.Id(), dispatcher.identity); err != nil {
panic(err.Error())
} else {
return activityPubMedia
}
}
}
func (dispatcher *dispatcher) AddOrUpdateActivityPubMediaObject(object IObject, activityPubMedia IActivityPubMedia) IActivityPubMedia {
transaction := dispatcher.transaction
if transaction != nil {
if activityPubMedia, err := dispatcher.conductor.ActivityPubMediaManager().AddOrUpdateActivityPubMediaObjectAtomic(transaction, object.Id(), activityPubMedia, dispatcher.identity); err != nil {
panic(err.Error())
} else {
return activityPubMedia
}
} else {
if activityPubMedia, err := dispatcher.conductor.ActivityPubMediaManager().AddOrUpdateActivityPubMediaObject(object.Id(), activityPubMedia, dispatcher.identity); err != nil {
panic(err.Error())
} else {
return activityPubMedia
}
}
}
func (dispatcher *dispatcher) RemoveActivityPubMedia(id int64) IActivityPubMedia {
transaction := dispatcher.transaction
if transaction != nil {
if activityPubMedia, err := dispatcher.conductor.ActivityPubMediaManager().RemoveActivityPubMediaAtomic(transaction, id, dispatcher.identity); err != nil {
panic(err.Error())
} else {
return activityPubMedia
}
} else {
if activityPubMedia, err := dispatcher.conductor.ActivityPubMediaManager().RemoveActivityPubMedia(id, dispatcher.identity); err != nil {
panic(err.Error())
} else {
return activityPubMedia
}
}
}

Wyświetl plik

@ -0,0 +1,263 @@
package core
import (
"fmt"
. "github.com/xeronith/diamante/contracts/security"
"rail.town/infrastructure/app/validators"
. "rail.town/infrastructure/components/constants"
. "rail.town/infrastructure/components/contracts"
"rail.town/infrastructure/components/model/repository"
)
type activityPubPublicKey struct {
id string
owner string
publicKeyPem string
}
// noinspection GoUnusedExportedFunction
func InitializeActivityPubPublicKey() {
_ = ENABLE_SECURITY
_ = ENABLE_CUSTOM_ERRORS
_ = validators.Initialize
_ = repository.Initialize
}
func NewActivityPubPublicKey() (IActivityPubPublicKey, error) {
instance := &activityPubPublicKey{}
if err := instance.Validate(); err != nil {
return nil, err
}
return instance, nil
}
func (activityPubPublicKey *activityPubPublicKey) Id() string {
return activityPubPublicKey.id
}
func (activityPubPublicKey *activityPubPublicKey) SetId(value string) {
activityPubPublicKey.id = value
}
func (activityPubPublicKey *activityPubPublicKey) Owner() string {
return activityPubPublicKey.owner
}
func (activityPubPublicKey *activityPubPublicKey) SetOwner(value string) {
activityPubPublicKey.owner = value
}
func (activityPubPublicKey *activityPubPublicKey) PublicKeyPem() string {
return activityPubPublicKey.publicKeyPem
}
func (activityPubPublicKey *activityPubPublicKey) SetPublicKeyPem(value string) {
activityPubPublicKey.publicKeyPem = value
}
func (activityPubPublicKey *activityPubPublicKey) Validate() error {
return nil
}
func (activityPubPublicKey *activityPubPublicKey) String() string {
return fmt.Sprintf("ActivityPubPublicKey (Id: %d)", 0)
}
//------------------------------------------------------------------------------
type activityPubPublicKeys struct {
collection ActivityPubPublicKeys
}
// NewActivityPubPublicKeys creates an empty collection of 'Activity Pub Public Key' which is not thread-safe.
func NewActivityPubPublicKeys() IActivityPubPublicKeyCollection {
return &activityPubPublicKeys{
collection: make(ActivityPubPublicKeys, 0),
}
}
func (activityPubPublicKeys *activityPubPublicKeys) Count() int {
return len(activityPubPublicKeys.collection)
}
func (activityPubPublicKeys *activityPubPublicKeys) IsEmpty() bool {
return len(activityPubPublicKeys.collection) == 0
}
func (activityPubPublicKeys *activityPubPublicKeys) IsNotEmpty() bool {
return len(activityPubPublicKeys.collection) > 0
}
func (activityPubPublicKeys *activityPubPublicKeys) HasExactlyOneItem() bool {
return len(activityPubPublicKeys.collection) == 1
}
func (activityPubPublicKeys *activityPubPublicKeys) HasAtLeastOneItem() bool {
return len(activityPubPublicKeys.collection) >= 1
}
func (activityPubPublicKeys *activityPubPublicKeys) First() IActivityPubPublicKey {
return activityPubPublicKeys.collection[0]
}
func (activityPubPublicKeys *activityPubPublicKeys) Append(activityPubPublicKey IActivityPubPublicKey) {
activityPubPublicKeys.collection = append(activityPubPublicKeys.collection, activityPubPublicKey)
}
func (activityPubPublicKeys *activityPubPublicKeys) ForEach(iterator ActivityPubPublicKeyIterator) {
if iterator == nil {
return
}
for _, value := range activityPubPublicKeys.collection {
iterator(value)
}
}
func (activityPubPublicKeys *activityPubPublicKeys) Array() ActivityPubPublicKeys {
return activityPubPublicKeys.collection
}
//------------------------------------------------------------------------------
func (dispatcher *dispatcher) ActivityPubPublicKeyExists(id int64) bool {
return dispatcher.conductor.ActivityPubPublicKeyManager().Exists(id)
}
func (dispatcher *dispatcher) ActivityPubPublicKeyExistsWhich(condition ActivityPubPublicKeyCondition) bool {
return dispatcher.conductor.ActivityPubPublicKeyManager().ExistsWhich(condition)
}
func (dispatcher *dispatcher) ListActivityPubPublicKeys() IActivityPubPublicKeyCollection {
return dispatcher.conductor.ActivityPubPublicKeyManager().ListActivityPubPublicKeys(0, 0, "", dispatcher.identity)
}
func (dispatcher *dispatcher) ForEachActivityPubPublicKey(iterator ActivityPubPublicKeyIterator) {
dispatcher.conductor.ActivityPubPublicKeyManager().ForEach(iterator)
}
func (dispatcher *dispatcher) FilterActivityPubPublicKeys(predicate ActivityPubPublicKeyFilterPredicate) IActivityPubPublicKeyCollection {
return dispatcher.conductor.ActivityPubPublicKeyManager().Filter(predicate)
}
func (dispatcher *dispatcher) MapActivityPubPublicKeys(predicate ActivityPubPublicKeyMapPredicate) IActivityPubPublicKeyCollection {
return dispatcher.conductor.ActivityPubPublicKeyManager().Map(predicate)
}
func (dispatcher *dispatcher) GetActivityPubPublicKey(id int64) IActivityPubPublicKey {
if activityPubPublicKey, err := dispatcher.conductor.ActivityPubPublicKeyManager().GetActivityPubPublicKey(id, dispatcher.identity); err != nil {
panic(err.Error())
} else {
return activityPubPublicKey
}
}
func (dispatcher *dispatcher) AddActivityPubPublicKey() IActivityPubPublicKey {
transaction := dispatcher.transaction
if transaction != nil {
if activityPubPublicKey, err := dispatcher.conductor.ActivityPubPublicKeyManager().AddActivityPubPublicKeyAtomic(transaction, dispatcher.identity); err != nil {
panic(err.Error())
} else {
return activityPubPublicKey
}
} else {
if activityPubPublicKey, err := dispatcher.conductor.ActivityPubPublicKeyManager().AddActivityPubPublicKey(dispatcher.identity); err != nil {
panic(err.Error())
} else {
return activityPubPublicKey
}
}
}
func (dispatcher *dispatcher) AddActivityPubPublicKeyWithCustomId(id int64) IActivityPubPublicKey {
transaction := dispatcher.transaction
if transaction != nil {
if activityPubPublicKey, err := dispatcher.conductor.ActivityPubPublicKeyManager().AddActivityPubPublicKeyWithCustomIdAtomic(id, transaction, dispatcher.identity); err != nil {
panic(err.Error())
} else {
return activityPubPublicKey
}
} else {
if activityPubPublicKey, err := dispatcher.conductor.ActivityPubPublicKeyManager().AddActivityPubPublicKeyWithCustomId(id, dispatcher.identity); err != nil {
panic(err.Error())
} else {
return activityPubPublicKey
}
}
}
func (dispatcher *dispatcher) LogActivityPubPublicKey(source string, payload string) {
dispatcher.conductor.ActivityPubPublicKeyManager().Log(source, dispatcher.identity, payload)
}
func (dispatcher *dispatcher) UpdateActivityPubPublicKey(id int64) IActivityPubPublicKey {
transaction := dispatcher.transaction
if transaction != nil {
if activityPubPublicKey, err := dispatcher.conductor.ActivityPubPublicKeyManager().UpdateActivityPubPublicKeyAtomic(transaction, id, dispatcher.identity); err != nil {
panic(err.Error())
} else {
return activityPubPublicKey
}
} else {
if activityPubPublicKey, err := dispatcher.conductor.ActivityPubPublicKeyManager().UpdateActivityPubPublicKey(id, dispatcher.identity); err != nil {
panic(err.Error())
} else {
return activityPubPublicKey
}
}
}
// noinspection GoUnusedParameter
func (dispatcher *dispatcher) UpdateActivityPubPublicKeyObject(object IObject, activityPubPublicKey IActivityPubPublicKey) IActivityPubPublicKey {
transaction := dispatcher.transaction
if transaction != nil {
if activityPubPublicKey, err := dispatcher.conductor.ActivityPubPublicKeyManager().UpdateActivityPubPublicKeyAtomic(transaction, object.Id(), dispatcher.identity); err != nil {
panic(err.Error())
} else {
return activityPubPublicKey
}
} else {
if activityPubPublicKey, err := dispatcher.conductor.ActivityPubPublicKeyManager().UpdateActivityPubPublicKey(object.Id(), dispatcher.identity); err != nil {
panic(err.Error())
} else {
return activityPubPublicKey
}
}
}
func (dispatcher *dispatcher) AddOrUpdateActivityPubPublicKeyObject(object IObject, activityPubPublicKey IActivityPubPublicKey) IActivityPubPublicKey {
transaction := dispatcher.transaction
if transaction != nil {
if activityPubPublicKey, err := dispatcher.conductor.ActivityPubPublicKeyManager().AddOrUpdateActivityPubPublicKeyObjectAtomic(transaction, object.Id(), activityPubPublicKey, dispatcher.identity); err != nil {
panic(err.Error())
} else {
return activityPubPublicKey
}
} else {
if activityPubPublicKey, err := dispatcher.conductor.ActivityPubPublicKeyManager().AddOrUpdateActivityPubPublicKeyObject(object.Id(), activityPubPublicKey, dispatcher.identity); err != nil {
panic(err.Error())
} else {
return activityPubPublicKey
}
}
}
func (dispatcher *dispatcher) RemoveActivityPubPublicKey(id int64) IActivityPubPublicKey {
transaction := dispatcher.transaction
if transaction != nil {
if activityPubPublicKey, err := dispatcher.conductor.ActivityPubPublicKeyManager().RemoveActivityPubPublicKeyAtomic(transaction, id, dispatcher.identity); err != nil {
panic(err.Error())
} else {
return activityPubPublicKey
}
} else {
if activityPubPublicKey, err := dispatcher.conductor.ActivityPubPublicKeyManager().RemoveActivityPubPublicKey(id, dispatcher.identity); err != nil {
panic(err.Error())
} else {
return activityPubPublicKey
}
}
}