Page 1 of 1

Manage central outoutclass

Posted: Thu Aug 27, 2015 10:09 pm
by axhxu
I am looking for a way to manage a central list of outputclasses for our authoring team.

Currently I have the list in default-options.xml but this has caused an issue where those outputclasses are listed in the Edit Profiling window.

I would like to find a different solution. I started looking at the cc_value_config.xml which works in 17.0 but does not work in 16.1 and we are currently limited to this version.

One note the cc_value_config.xml works with codeblock which is the file by default.

Any suggestions?

Thanks

Re: Manage central outoutclass

Posted: Fri Aug 28, 2015 9:00 am
by Radu
Hi,

A couple of weeks ago I wrote a blog entry about various ways to have controlled attribute values with DITA:

http://blog.oxygenxml.com/2015/07/contr ... -your.html

You should try the Subject Scheme Map approach.

One more thing, I do not understand this remark you made:
One note the cc_value_config.xml works with codeblock which is the file by default.
Regards,
Radu

Re: Manage central outoutclass

Posted: Fri Aug 28, 2015 4:36 pm
by axhxu
Hi Radu,
thanks for the reply.

I tried dropping the cc_value_config.xml file into our 16.1 plugin folder and it worked for codeblock but when I tried to edit the file to add outputclasses for other elements it did not work.

Our vendor for our CMS/Oxygen tool has heard back from your support recommending we:
ro.sync.contentcompletion.xml.SchemaManagerFilter" API and use it in the "Extensions" tab for the DITA document type configuration.

But i am not sure how to do this.

I will look at the Subject Scheme Map approach as well as an alternative.

Re: Manage central outoutclass

Posted: Fri Aug 28, 2015 4:42 pm
by Radu
Hi,

I also discussed in a separate email exchange with your vendor.
The " cc_value_config.xml" is a feature added in Oxygen 17.0 so it will not work with Oxygen 16.1.
The subject scheme map approach does not work when Oxygen is integrated with Ixiasoft because they have their own way of editing DITA Maps.
So if you have a Java developer the only approach with 16.1 would be to develop a Java extension of the "ro.sync.contentcompletion.xml.SchemaManagerFilter" API and use it in the "Extensions" tab for the DITA document type configuration.

http://www.oxygenxml.com/doc/versions/1 ... ndler.html

Our Author SDK Maven-based project is located here:

http://www.oxygenxml.com/oxygen_sdk.html

Of course I would recommend upgrading to Oxygen 17.0 but I do not know if Ixia officially supports it.

Regards,
Radu

Re: Manage central outoutclass

Posted: Thu Sep 03, 2015 6:32 pm
by axhxu
Hi Radu,
I created a test extension based on the code samples found here:
http://www.oxygenxml.com/doc/versions/1 ... ndler.html

I created the following class just to test getting this working:

Code: Select all

package org.agfa.sync.contentcompletion.xml;

import java.util.List;
import java.util.ArrayList;

import ro.sync.contentcompletion.xml.CIAttribute;
import ro.sync.contentcompletion.xml.CIElement;
import ro.sync.contentcompletion.xml.CIValue;
import ro.sync.contentcompletion.xml.Context;
import ro.sync.contentcompletion.xml.ContextElement;
import ro.sync.contentcompletion.xml.SchemaManagerFilter;
import ro.sync.contentcompletion.xml.WhatAttributesCanGoHereContext;
import ro.sync.contentcompletion.xml.WhatElementsCanGoHereContext;
import ro.sync.contentcompletion.xml.WhatPossibleValuesHasAttributeContext;

public class SDFSchemaManagerFilter implements SchemaManagerFilter {
/**
* Filter attributes of the "table" element.
*/
public List<CIAttribute> filterAttributes(List<CIAttribute> attributes,
WhatAttributesCanGoHereContext context) {



// If the element from the current context is the 'table' element add the
// attribute named 'frame' to the list of default content completion proposals
if (context != null) {
ContextElement contextElement = context.getParentElement();
if ("table".equals(contextElement.getQName())) {
CIAttribute frameAttribute = new CIAttribute();
frameAttribute.setName("frame");
frameAttribute.setRequired(false);
frameAttribute.setFixed(false);
frameAttribute.setDefaultValue("topbot");
if (attributes == null) {
attributes = new ArrayList<CIAttribute>();
}
attributes.add(frameAttribute);
}
}
return attributes;
}
public List<CIValue> filterAttributeValues(java.util.List<CIValue> attributeValues, WhatPossibleValuesHasAttributeContext context) {

return attributeValues;
}
public java.util.List<CIElement> filterElements(java.util.List<CIElement> elements, WhatElementsCanGoHereContext context){

return elements;
}
public java.util.List<CIValue> filterElementValues(java.util.List<CIValue> elementValues, Context context){

return elementValues;
}
public java.lang.String getDescription(){
return "";
}
}
It compiles. And my assumption this would set the default for the frame attribute to topbot.

So question when I go to the extensions tab how do I add it to the extensions tab?

Do i change the extensions bundle?

Or add it under one of the individual extensions?

Thanks

Re: Manage central outoutclass

Posted: Thu Sep 03, 2015 10:33 pm
by axhxu
Hi Radu,
I have tried the java route to create an extension as suggested but it does not seem to be working.

I took the code sample found here:
http://www.oxygenxml.com/doc/versions/1 ... ndler.html

And tried to implement the Filter attributes but i cannot seem to get it to work. Reading the code if element equals table then it sets the frame attribute.

I made this slight change:

frameAttribute.setDefaultValue("topbot");

So for a table element and if I select frame attribute it should default to topbot.

I added the classpath to DITA Document Type association and on the extensions tab added my extension to the Content Completion handler. Is this correct?

Thanks
Arron

Re: Manage central outoutclass

Posted: Fri Sep 04, 2015 11:57 am
by Radu
Hi Aaron,

Coming back to your original intention of providing a default list of possible values for a certain @outputclass attribute on a certain element, that could have been done like this:

Code: Select all

      public List<CIValue> filterAttributeValues(java.util.List<CIValue> attributeValues, WhatPossibleValuesHasAttributeContext context) {
if (context != null) {
ContextElement contextElement = context.getParentElement();
if ("p".equals(contextElement.getQName())) {
if("outputclass".equals(context.getAttributeName())){
if(attributeValues == null){
attributeValues = new ArrayList<CIValue>();
}
attributeValues.add(new CIValue("val1"));
attributeValues.add(new CIValue("val2"));
}
}
}
return attributeValues;
}
If the extension is properly installed, then in the Attributes view when you want to edit the @outputclass attribute on a DITA <p> element you should have 2 values listed there.

You can also check your extension is installed by printing some debug information to an external file when the filterAttributeValues method is called. In this way we would know if the extension was properly installed or not.

Coming back to what you tried to do by changing the filterAttributes callback, is it another use case that you have?

Regards,
Radu

Re: Manage central outoutclass

Posted: Wed Sep 09, 2015 3:35 pm
by axhxu
Thanks Radu...that got it working...now all I need to do is hook it up to use the file.

Re: Manage central outoutclass

Posted: Fri Sep 11, 2015 8:18 pm
by axhxu
Issue popped up..the extension is overriding all attributes, so our audience, prop, etc are not loading.

Is there a way to have the default behaviour happen for other attributes and only override outputclass?

Code: Select all


public List<CIValue> filterAttributeValues(java.util.List<CIValue> attributeValues, WhatPossibleValuesHasAttributeContext context) 
{

ContextElement contextElement = context.getParentElement();
if (context == null || contextElement == null)
{
//log.ERROR
return attributeValues;
}


String elementName = contextElement.getQName();

if("outputclass".equals(context.getAttributeName()))
{
try
{
if(attributeValues == null)
{

attributeValues = new ArrayList<CIValue>();
//Get outputclasses that apply to all nodes
addAttributesToList(getItemNodeList("*"),attributeValues);
}
}
catch (Exception e)
{
appendToFile(e, "filterAttributeValues - all nodes");
}

try
{

if (elementName != null)
{
//Get outputclasses that apply to current element
NodeList nodeList = null;
try
{
nodeList = getItemNodeList(elementName);
}
catch (Exception e)
{
appendToFile(e, "filterAttributeValues - nodeList");
}
try
{
addAttributesToList(nodeList,attributeValues);
}
catch (Exception e)
{
appendToFile(e, "filterAttributeValues - addAttributesToList");
}
}
}
catch (Exception e)
{
appendToFile(e, "filterAttributeValues - current element=" + elementName);
}
}


return attributeValues;
}

Re: Manage central outoutclass

Posted: Mon Sep 14, 2015 10:52 am
by Radu
Hi,

That's the main problem with setting the Java extension, it overrides the default DITA ro.sync.ecss.extensions.dita.DITASchemaManagerFilter which provides values for profiling attribute values, for key references.
You could try to extend the ro.sync.ecss.extensions.dita.DITASchemaManagerFilter (located in the "dita.jar") and at the end of your implementation of filterAttributeValues, delegate to super.filterAttributeValues.

https://www.oxygenxml.com/InstData/Edit ... ilter.html

If for some reason this fails you can email us at support@oxygenxml.com and I will provide the entire Java sources for the DITASchemaManagerFilter class so that you can incorporate both behaviors in your extension class.

Regards,
Radu

Re: Manage central outoutclass

Posted: Mon Sep 14, 2015 5:03 pm
by axhxu
Thanks Radu.

I tried extending my implementation but now I can no longer add my class to the content completion handler. It does not find it.

Code: Select all

public class SDFSchemaManagerFilter extends ro.sync.ecss.extensions.dita.DITASchemaManagerFilter implements SchemaManagerFilter 
{

//SDFSchemaManagerFilter(){
//return super();
//}

SDFSchemaManagerFilter(java.lang.String documentTypeName){
super(documentTypeName);
return;
...
}

Re: Manage central outoutclass

Posted: Tue Sep 15, 2015 4:49 pm
by Radu
Hi Aaron,

I will look into the problem with the detection when the class does not directly extend the interface.
Could you try this workaround?
Have the class directly extend the interface. The class would have the "DITASchemaManagerFilter" defined as a field inside it like:

Code: Select all

public class SDFSchemaManagerFilter implements SchemaManagerFilter {

private DITASchemaManagerFilter ditaFilter = new DITASchemaManagerFilter("DITA");


/**
* @see ro.sync.contentcompletion.xml.SchemaManagerFilter#filterElements(java.util.List, ro.sync.contentcompletion.xml.WhatElementsCanGoHereContext)
*/
@Override
public List<CIElement> filterElements(List<CIElement> elements,
WhatElementsCanGoHereContext context) {
return ditaFilter.filterElements(elements, context);
}

/**
* @see ro.sync.contentcompletion.xml.SchemaManagerFilter#filterAttributeValues(java.util.List, ro.sync.contentcompletion.xml.WhatPossibleValuesHasAttributeContext)
*/
@Override
public List<CIValue> filterAttributeValues(List<CIValue> attributeValues,
WhatPossibleValuesHasAttributeContext context) {
//HERE YOU DO YOUR THING
return ditaFilter.filterAttributeValues(attributeValues, context);
}

///AND SO ON, DELEGATE ALL CALLBACKS TO THE DITA FILTER
Regards,
Radu

Re: Manage central outoutclass

Posted: Thu Sep 17, 2015 12:11 pm
by Radu
Hi,

I looked more into this problem:
I tried extending my implementation but now I can no longer add my class to the content completion handler.
When the schema manager filter is set as an individual custom extension, it needs to have a default constructor in order to be instantiated.
So the code should have been something like:

Code: Select all

public class SDFSchemaManagerFilter extends ro.sync.ecss.extensions.dita.DITASchemaManagerFilter implements SchemaManagerFilter
{

SDFSchemaManagerFilter(){
super("DITA");
return;
...
}
Regards,
Radu

Re: Manage central outoutclass

Posted: Fri Sep 18, 2015 5:19 pm
by axhxu
Thanks that worked like a charm.