Customize workflow alfresco multiple assignee - workflow

I'm try multiple assignee from link
The workflow starts a problem. and Model has error
Model error:
WARN (searcherExecutor-21-thread-1-processing-x:alfresco) [ x:alfresco] o.a.s.AlfrescoSolrDataModel Model not updated: exwf:workflowmodel Failed to validate model update - found non-incrementally updated TYPE '{http://www.extest.com/model/workflow/1.0}submitConcurrentReviewTask'
I have attached links to my files below. If there is a problem with them, or if there is a better method of achieving this goal, please let me know!
Many thanks
bpmn20 file : https://drive.google.com/file/d/1mLu9sUUuRp779RNVoPGud0tLkiLdK8oD/view?usp=sharing
model file: https://drive.google.com/file/d/12UvXOy_DsCUin4M4zG07edmZLHsLceh5/view?usp=sharing
share-config-custom file : https://drive.google.com/file/d/1MLRtbHf75ekWD4a2tx7bzQoCbXrJGPIf/view?usp=sharing
log : https://drive.google.com/file/d/1xbwu18DTOJDBMr_-Bz-gHa4SDI3arDAZ/view?usp=sharing

Related

Access related model fields from ModelAdmin actions for exporting to excel

I am desperately waiting for someone attention to get my question answered.... please help..
ModelAdmin model has to export to Excel action method.
I need to access related model fields in action method. That means I can not pass any arguments therefore I tried relatedmodel_set but ModelAdmin action method shows memory location and fails when I try to access values through attributes:
<django.db.models.fields.related_descriptors.create_reverse_many_to_one_manager..RelatedManager object at 0x7f8eea904ac0>
model.py
class EnrolStudent(models.Model):
def get_trn_activity(self):
return self.studenttraininactivities_set
class StudentTraininActivities(models.Model):
trainin_activities = models.ForeignKey(EnrolStudent,
on_delete=CASCADE, null=True )
<other fields...>
admin.py
#admin.register(EnrolStudent)
class EnrolAdmin(admin.ModelAdmin):
form = CityInlineForm
inlines = [CohortTraininActivitiesInline]
...
actions = [export_as_txt_action_0120("File NAT00120 data Export"
, fields=['information_no', 'get_trn_activity',
'student_enrol__student_code'])]
I need to access related model fields to export to excel.
I can not pass parameter to get_trn_activity as you have noticed.
Therefore selected rows only data from Django admin change_list page will only need bit of work using its queryset in actions method used in separate actions.py file that I can do!
Please help me with this issue. I am new to Python / Django.
I also tried property decorator in related model then access in a method in main model then call it inside action but same problem with memory address not the direct value and then how to get data of memory location here .... I don't know.
If I can access the related fields then I can do it no issue.
Another question:
I had same situation with model/related model before, but they were connected through OneToOneField relationship and I was able to use dundor to access related model fields but in this case of ForiegnKey relationship I can not see related model in queryset.
In other case this is what I can do easily; here cohortdetails is related model and when I debug I saw it was listed in queryset that was great.
actions = [export_as_txt_action_0080("File NAT00080 txt Export",
fields=['rto_student_code', 'first_name', 'family_name'
,'cohortdetails__highest_school__highestschool_levelcode',
'cohortdetails__cohort_gender'
, 'cohortdetails__student_dob' ])]

Unable to implement check in my integration, getting 'map undefined' for create method of checks

I am trying to implement Checks into my GitHub app. My App is built with probot.
I am just not able to implement the checks. I have tried going through the documentation which demonstrate ruby example that includes several different setups(not sure if required with probot).
I just got confused with the example there.
Below is the code that resides in my index.js :
app.on('check_suite.requested', async context =>{
console.log('************------------ check suite requested')
await context.github.checks.create({
mediaType:'application/vnd.github.antiope-preview+json',
name : 'test-check-1',
head_sha: context.payload.check_suite.after,
conclusion: "success"
})
})
I get below error
ERROR probot: Cannot read property 'map' of undefined
TypeError: Cannot read property 'map' of undefined
The error log complains about index.js:24:35, which is precisely the createmethod in the line await context.github.checks.create
Is the above code sufficient to create the check test-check-1 or do I need to take care of other things too. I already have the "Required status checks to pass before merging" option enabled under the branch protection settings of my repo.
And that section displays Sorry, we couldn’t find any status checks in the last week for this repository.
Not sure how to connect everything.
EDIT 1 : START
Below is the code after including the required params as suggested by #OscarDOM :--
app.on('check_suite.requested', async context =>{
console.log('*****check suite requested*****')
context.github.checks.create({
owner:context.payload.repository.owner,
repo:context.payload.repository.name,
mediaType:'application/vnd.github.antiope-preview+json',
name : 'test-check-1',
head_sha: context.payload.check_suite.after,
conclusion: "success"
})
})
Unfortunately, I still get the same error at exact same line and column.
EDIT 1 : END
EDIT 2 : START
Below is the final working code after including corrections for the mediaType parameter :
Please note there was one more mistake I had to correct and that is the value owner param. The correct way is to specify context.payload.repository.owner.login and this was something I had recently learnt from this StackOverflow post
app.on('check_suite.requested', async context =>{
console.log('*****check suite requested*****')
context.github.checks.create({
owner:context.payload.repository.owner.login,
repo:context.payload.repository.name,
mediaType: { previews: ['antiope']},
name : 'test-check-1',
head_sha: context.payload.check_suite.after,
conclusion: "success"
})
})
EDIT 2 : END
Would it be possible you need to pass the owner and the repository to context.github.checks.create() method? I think they are required properties: https://octokit.github.io/rest.js/v17#checks
Also, make sure the Github App has the following permissions: checks:write(https://developer.github.com/v3/activity/events/types/#checkrunevent)
Also, checking your code snippet, seems that you are not using the mediaType properly. If you check the type definition, mediaType has the following structure:
mediaTypes: {
format?: string,
previews?: string[]
}
Reference here: https://octokit.github.io/rest.js/v17#previews
Can you try it with this?
app.on('check_suite.requested', async context =>{
console.log('************------------ check suite requested')
await context.github.checks.create({
owner: '<YOUR_ORGANIZATION>',
repo: '<YOUR_REPO>',
mediaType: { previews: ['antiope']},
name : 'test-check-1',
head_sha: context.payload.check_suite.after,
conclusion: "success"
})
})
As a general feedback, I suggest you to try TypeScript, these issues would have been spotted using it :)

How to turn OFF Schema Validations dynamically using MongoDB-JAVA APIs

I have created a collection with schema validation as below,
ValidationOptions collOptions = new ValidationOptions();
collOptions.validator(sdoc);
collOptions.validationLevel(ValidationLevel.MODERATE);
collOptions.validationAction(ValidationAction.WARN);
srdmDatabase.createCollection(collectionName,new CreateCollectionOptions().validationOptions(collOptions));
My collection is created successfully with schema validation.
In some cases, I want to turn OFF the validation check dynamically.
I found that there is an option to turn OFF the validation(ValidationLevel.OFF) in monogdb-java-driver, but I have no idea about how to use this option.
Please help me some one how to turn off the validation check programmatically.
We are using MongoDB-4.0 and mongo-java-driver-3.10.2.
Thanks in advance.
You can try using the following code to bypass the validation.
For updates
collection.updateOne(
Filters.eq("_id", 1),
Updates.set("name", "Fresh Breads and Tulips"),
new UpdateOptions().upsert(true).bypassDocumentValidation(true));
Similarly for inserts, you can use InsertOptions.bypassDocumentValidation(true)
Refer this link for more info https://docs.mongodb.com/manual/core/schema-validation/#bypass-document-validation

load only components scripts that are in the current page

What I'm trying to achieve is that if i have 2 components nodes :
component1
clientlib
component1.js
component2
clientlib
component2.js
and i drag them into page1, then when page1 is generated, only component1.js and component2.js will be loaded when navigating to page1 .
One approach i saw is to use custom Tag Library as described here : http://www.icidigital.com/blog/best-approaches-clientlibs-aem-part-3/
I have two questions :
1) is there an existing feature in AEM to do this ?
2) if not, what is the easiest way to create such custom Tag Library ?
EDIT:
Assume that there is no ability to just include all component clientLibs, rather load only those that are added to the page.
There is no built in feature to do this. Although I've heard that the clientlib infrastructure is being looked at for a re-write so I'm optimistic that something like this will be added in the future.
We have, and I know other company have, created a "deferred script tag." Ours is a very simple tag that take a chunk of html like a clientlib include, add it to a unique list and then on an out call at the footer, spits it all out one after another.
Here's the core of a simple tag implementation that extends BodyTagSupport. Then in your footer grab the attribute and write it out.
public int doEndTag() throws JspException {
SlingHttpServletRequest request = (SlingHttpServletRequest)pageContext.getAttribute("slingRequest");
Set<String> delayed = (Set<String>)request.getAttribute(DELAYED_INCLUDE);
if(delayed == null){
delayed = new HashSet<String>();
}
if(StringUtils.isNotBlank(this.bodyContent.getString())){
delayed.add(this.bodyContent.getString().trim());
}
request.setAttribute(DELAYED_INCLUDE, delayed);
return EVAL_PAGE;
}
Theoretically the possible way of doing is to write script in your page component/abstract page component that does something like this -
Step1 : String path = currentPage.getPath()
Step2 : Query this path for components (one way is to have a master list do a contains clause on sling:resourceType)
Step 3: User resource resolver to resolve the resourceType in Step 3, this will give you resource under your apps.
Step 4: From the above resource get the sub-resource with primary type as cq:ClientLibraryFolder
Step 5: from the client libs resource in Step 4 get the categories and include the JS from them
you could actually write a model to adapt a component resource to a clientLibrary to actually clean the code.
Let me know if you need actual code, I can write that in my free time.

GetExportedValues<MyType> returns nothing, I can see the parts

I have a strange MEF problem, I tested this in a test project and it all seems to work pretty well but for some reason not working in the real project
This is the exporting code
public void RegisterComponents()
{
_registrationBuilder = new RegistrationBuilder();
_registrationBuilder
.ForTypesDerivedFrom(typeof(MyType))
.SetCreationPolicy(CreationPolicy.NonShared)
.Export();
var catalog = new AggregateCatalog();
catalog.Catalogs.Add(new AssemblyCatalog(typeof(MyType).Assembly, _registrationBuilder));
var directoryCatalog = new DirectoryCatalog(PathToMyTypeDerived, _registrationBuilder);
catalog.Catalogs.Add(directoryCatalog);
_compositionContainer = new CompositionContainer(catalog);
_compositionContainer.ComposeParts();
var exports = _compositionContainer.GetExportedValues<MyType>();
Console.WriteLine("{0} exports in AppDomain {1}", exports.Count(), AppDomain.CurrentDomain.FriendlyName);
}
exports count is 0 :( Any ideas why?
IN the log file I have many of this
System.ComponentModel.Composition Information: 6 : The ComposablePartDefinition 'SomeOthertype' was ignored because it contains no exports.
Though I would think this is ok because I wasn' interested in exporting 'someOtherType'
UPDATE: I found this link but after debuging over it I am not wiser but maybe I m not following up properly.
Thanks for any pointers
Cheers
I just had the same problem and this article helped me a lot.
It describes different reasons why a resolve can fail. One of the more important ones is that the dependency of a dependency of the type you want to resolve is not registered.
What helped me a lot was the the trace output that gets written to the Output window when you debug your application. It describes exactly the reasons why a type couldn't be resolved.
Even with this output. you might need to dig a little bit, because I only got one level deep.
Example:
I wanted to resolve type A and I got a message like this:
System.ComponentModel.Composition Warning: 1 : The ComposablePartDefinition 'Namespace.A' has been rejected. The composition remains unchanged. The changes were rejected because of the following error(s): The composition produced multiple composition errors, with 1 root causes. The root causes are provided below. Review the CompositionException.Errors property for more detailed information.
1) No exports were found that match the constraint:
ContractName Namespace.IB
RequiredTypeIdentity Namespace.IB
Resulting in: Cannot set import 'Namespace.A..ctor (Parameter="b", ContractName="namespace.IB")' on part 'Namespace A'.
Element: Namespace.A..ctor (Parameter="b", ContractName="Namespace.IB") --> Namespace.A --> AssemblyCatalog (Assembly="assembly, Version=0.0.0.0, Culture=neutral, PublicKeyToken=...")
But I clearly saw a part for Namespace.IB. So, in the debugger, I tried to resolve that one. And I got another trace output. This time it told me that my implementation of Namespace.IB couldn't be resolved because for one of its imports there was a missing export, so basically the same message as above, just with different types. And this time, I didn't find a part for that missing import. Now I knew, which type was the real problem and figure out, why no registration happened for it.