AshishJain
I'm new here

Delete a feature in Content Transport

Jump to solution

Hello,

I am a new FirstSpirit user. I was playing around with Content Transport. I created a Feature in it. But now I do not find a way to delete it. Can someone please help me with this?

Thanks.

Ashish Jain

0 Kudos
1 Solution

Accepted Solutions
thomas_ritter
I'm new here

Hello Ashish,

it´s not possible to do this by GUI. Therefor you need a litte script, like this:

/*

    deleting old features from server

*/

import de.espirit.firstspirit.feature.FeatureAgent;

/* Array of feature names to be deleted */

String[] deleteFeatures = { "NAME_OF_FEATURE_TO_BE_DELETED" };

/* Do a test run without really deleting anything */

boolean testmode = false;

FeatureAgent agent = context.requireSpecialist(FeatureAgent.TYPE);

ArrayList featureDescriptors = agent.getFeatureDescriptors();

for ( fd : featureDescriptors ) {

     if( Arrays.asList(deleteFeatures).contains(fd.getFeatureName()) ) {

        if (!testmode) agent.deleteFeature(fd);

        context.logInfo("deleted feature: " + fd.toString());

        print("deleted feature: " + fd.toString());

     } else {

        context.logInfo("NOT deleted:    " + fd.toString());

        print("NOT deleted:    " + fd.toString());

     }

}

More Information you can find in die DEV-API:

https://yourhost.com/help/odfs/dev/index.html?de/espirit/firstspirit/feature/package-frame.html

regards

thomas

View solution in original post

0 Kudos
3 Replies
thomas_ritter
I'm new here

Hello Ashish,

it´s not possible to do this by GUI. Therefor you need a litte script, like this:

/*

    deleting old features from server

*/

import de.espirit.firstspirit.feature.FeatureAgent;

/* Array of feature names to be deleted */

String[] deleteFeatures = { "NAME_OF_FEATURE_TO_BE_DELETED" };

/* Do a test run without really deleting anything */

boolean testmode = false;

FeatureAgent agent = context.requireSpecialist(FeatureAgent.TYPE);

ArrayList featureDescriptors = agent.getFeatureDescriptors();

for ( fd : featureDescriptors ) {

     if( Arrays.asList(deleteFeatures).contains(fd.getFeatureName()) ) {

        if (!testmode) agent.deleteFeature(fd);

        context.logInfo("deleted feature: " + fd.toString());

        print("deleted feature: " + fd.toString());

     } else {

        context.logInfo("NOT deleted:    " + fd.toString());

        print("NOT deleted:    " + fd.toString());

     }

}

More Information you can find in die DEV-API:

https://yourhost.com/help/odfs/dev/index.html?de/espirit/firstspirit/feature/package-frame.html

regards

thomas

0 Kudos
sebastianc
Crownpeak employee

Hallo Ashish Jain,

ist diese Frage noch offen? Benötigst du noch weitere Hilfe oder konnte Thomas dir bereits weiterhelfen? In diesem Fall wäre es super, wenn du seine "richtige Antwort" entsprechend markierst.

Solltest du selbst eine Lösung gefunden haben, wäre es toll, wenn du sie hier bereitstellst.

Viele Grüße,

Sebastian

0 Kudos
jessica_aust
Crownpeak employee

Vielleicht interessant:

Ab Version 5.2.717 können Feature-Zusammenstellungen nun auch über die GUI gelöscht werden.

Für die Details siehe [RELEASE] FirstSpirit™ 5.2R7 Build 717 released

0 Kudos