Skip to content

Commit

Permalink
CSPACE-6960: Add workflowState ui type.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ray Lee committed Jun 26, 2016
1 parent 9e5933b commit adcf528
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 2 deletions.
Expand Up @@ -196,7 +196,9 @@ protected void actualFieldRefactored(JSONObject out, FieldSet fs, UISpecRunConte
actualExternalURLField(out, fs, context);
} else if("valueDeURNed".equalsIgnoreCase(uiType)){
actualDeURNedField(out, fs, context);
} else if(fs.isASelfRenderer()){ // also based upon uiType
} else if("workflowState".equalsIgnoreCase(uiType)){
actualWorkflowStateField(out, fs, context);
} else if(fs.isASelfRenderer()){ // also based upon uiType
actualSelfRendererField(out, fs, context);
} else{
actualField(out, fs, context);
Expand Down Expand Up @@ -238,6 +240,15 @@ protected void actualDateField(JSONObject out, FieldSet fs, UISpecRunContext con
*/
protected void actualValidatedField(JSONObject out, FieldSet fs, UISpecRunContext context) throws JSONException{
}
/**
* Overwrite with output you need for this thing you are doing
* @param out
* @param fs
* @param context
* @throws JSONException
*/
protected void actualWorkflowStateField(JSONObject out, FieldSet fs, UISpecRunContext context) throws JSONException{
}
/**
*
* @param out
Expand Down Expand Up @@ -295,6 +306,8 @@ protected void actualFieldNotRefactored(JSONObject out,FieldSet fs, UISpecRunCon
actualDateField(out, fs, context);
} else if("validated".equals(uiType)){
actualValidatedField(out, fs, context);
} else if("workflowState".equals(uiType)){
actualWorkflowStateField(out, fs, context);
} else if("externalURL".equalsIgnoreCase(uiType)){
actualExternalURLField(out, fs, context);
} else if("valueDeurned".equalsIgnoreCase(uiType)){
Expand Down
Expand Up @@ -94,6 +94,13 @@ protected void actualValidatedField(JSONObject out, FieldSet fs, UISpecRunContex
out.put(getSelector(fs,context),validator);
}

protected void actualWorkflowStateField(JSONObject out, FieldSet fs, UISpecRunContext context) throws JSONException{
String datatype = "string";
JSONObject workflowStateField = new JSONObject();
actualSchemaObject(datatype, null, null, null, workflowStateField);
out.put(getSelector(fs,context),workflowStateField);
}

protected void actualExternalURLField(JSONObject out, FieldSet fs, UISpecRunContext context) throws JSONException{
String datatype = "string";
JSONObject urlfield = new JSONObject();
Expand Down
Expand Up @@ -388,6 +388,38 @@ protected void actualValidatedField(JSONObject out, FieldSet fs, UISpecRunContex
out.put(fieldSelector,generateDataTypeValidator(fs,context, decorators));
}

/**
* Overwrite with output you need for this thing you are doing
* @param out
* @param fs
* @param context
* @throws JSONException
*/
@Override
protected void actualWorkflowStateField(JSONObject out, FieldSet fs, UISpecRunContext context) throws JSONException{
String fieldSelector = getSelector(fs,context);
JSONArray decorators = getExistingDecoratorsArray(out, fieldSelector);
out.put(fieldSelector,actualWorkflowState(fs,context, decorators));
}

private JSONObject actualWorkflowState(FieldSet fs,UISpecRunContext context, JSONArray decorators) throws JSONException {
JSONObject out=new JSONObject();
Field f = (Field)fs;
JSONObject decorator=getDecorator("fluid",null,"cspace.util.workflowToStyleFieldConverter",null,f.isReadOnly());
if(!f.isRefactored()){
if(f.hasContainer()){
decorator.put("container",getSelector(f,context));
}
}
if(decorators==null) {
decorators=new JSONArray();
}
decorators.put(decorator);
out.put(DECORATORS_KEY,decorators);
out.put("value", actualFieldEntry(f,context));
return out;
}

/**
* Overwrite with output you need for this thing you are doing
* @param out
Expand Down
Expand Up @@ -31,7 +31,7 @@


<section id="termListItemInformation">
<field id="workflow" exists-in-services="false" services-derived="true" section="collectionspace_core" attributes="GET" mini="search,list">
<field id="workflow" exists-in-services="false" services-derived="true" section="collectionspace_core" attributes="GET" mini="search,list" ui-type="workflowState">
<services-tag>workflowState</services-tag>
</field>
<field id="_subrecordcsid"></field> <!-- What is this field? -->
Expand Down

0 comments on commit adcf528

Please sign in to comment.